From adb3e151580556b7c425cbeded1f7be43a3d7302 Mon Sep 17 00:00:00 2001 From: Alisson Oliveira Date: Mon, 9 Apr 2018 09:20:04 -0300 Subject: [PATCH 001/236] =?UTF-8?q?Utiliza=20Engine=20padr=C3=A3o=20InnoDB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Datapack/sql/armor.sql | 2 +- Datapack/sql/armorsets.sql | 105 +- Datapack/sql/auction.sql | 2 +- Datapack/sql/auto_chat.sql | 2 +- Datapack/sql/auto_chat_text.sql | 2 +- Datapack/sql/castle_manor_procure.sql | 2 +- Datapack/sql/castle_manor_production.sql | 2 +- Datapack/sql/char_templates.sql | 182 +-- Datapack/sql/clan_wars.sql | 2 +- Datapack/sql/clanhall.sql | 89 +- Datapack/sql/class_list.sql | 2 +- Datapack/sql/cursed_weapons.sql | 2 +- Datapack/sql/dimensional_rift.sql | 2 +- Datapack/sql/droplist.sql | 2 +- Datapack/sql/enchant_skill_trees.sql | 2 +- Datapack/sql/etcitem.sql | 2 +- Datapack/sql/experimental/spawnlist.sql | 2 +- Datapack/sql/fish.sql | 2 +- Datapack/sql/fishing_skill_trees.sql | 2 +- Datapack/sql/forums.sql | 9 +- Datapack/sql/helper_buff_list.sql | 4 +- Datapack/sql/henna.sql | 2 +- Datapack/sql/locations.sql | 2 +- Datapack/sql/lvlupgain.sql | 182 +-- Datapack/sql/mapregion.sql | 2 +- Datapack/sql/merchant_areas_list.sql | 30 +- Datapack/sql/merchant_buylists.sql | 2 +- Datapack/sql/merchant_shopids.sql | 1282 +++++++++++----------- Datapack/sql/merchants.sql | 162 +-- Datapack/sql/minions.sql | 2 +- Datapack/sql/mods_wedding.sql | 2 +- Datapack/sql/npc.sql | 2 +- Datapack/sql/npcskills.sql | 2 +- Datapack/sql/pets_stats.sql | 2 +- Datapack/sql/pledge_skill_trees.sql | 129 +-- Datapack/sql/random_spawn_loc.sql | 2 +- Datapack/sql/skill_learn.sql | 2 +- Datapack/sql/skill_spellbooks.sql | 2 +- Datapack/sql/skill_trees.sql | 2 +- Datapack/sql/spawnlist.sql | 2 +- Datapack/sql/teleport.sql | 2 +- Datapack/sql/topic.sql | 2 +- Datapack/sql/walker_routes.sql | 2 +- Datapack/sql/weapon.sql | 2 +- Datapack/sql/zone.sql | 654 +++++------ 45 files changed, 1450 insertions(+), 1446 deletions(-) diff --git a/Datapack/sql/armor.sql b/Datapack/sql/armor.sql index 1dc72fd8..338139d7 100644 --- a/Datapack/sql/armor.sql +++ b/Datapack/sql/armor.sql @@ -26,7 +26,7 @@ CREATE TABLE `armor` ( `item_skill_id` decimal(11,0) NOT NULL default '0', `item_skill_lvl` decimal(11,0) NOT NULL default '0', PRIMARY KEY (`item_id`) -) ENGINE=MyISAM; +); -- -- Dumping data for table `armor` diff --git a/Datapack/sql/armorsets.sql b/Datapack/sql/armorsets.sql index 273804f7..af89c1bf 100644 --- a/Datapack/sql/armorsets.sql +++ b/Datapack/sql/armorsets.sql @@ -15,87 +15,88 @@ CREATE TABLE armorsets ( shield_skill_id decimal(11,0) NOT NULL default '0', enchant6skill decimal(11,0) NOT NULL default '0', PRIMARY KEY (id,chest) -) ENGINE=MyISAM; +); -- NO GRADE ------------- -- ######################## id chest legs head gloves feet skill shield sh_skill enchant6 -INSERT INTO armorsets VALUES(1, 23, 2386, 43, 0, 0, 3500, 0, 0, 0); -- Wooden Breastplate set (heavy) -INSERT INTO armorsets VALUES(2, 1101, 1104, 44, 0, 0, 3501, 0, 0, 0); -- Devotion robe set (robe) +INSERT INTO armorsets VALUES + (1, 23, 2386, 43, 0, 0, 3500, 0, 0, 0), -- Wooden Breastplate set (heavy) + (2, 1101, 1104, 44, 0, 0, 3501, 0, 0, 0), -- Devotion robe set (robe) -- D GRADE ------------- -- ######################## id chest legs head gloves feet skill shield sh_skill enchant6 -INSERT INTO armorsets VALUES(3, 58, 59, 47, 0, 0, 3502, 628, 3543, 3611); -- Mithril Breastplate set(heavy) -INSERT INTO armorsets VALUES(4, 352, 2378, 2411, 0, 0, 3506, 2493, 3544, 3611); -- Brigandine Armor set +(3, 58, 59, 47, 0, 0, 3502, 628, 3543, 3611), -- Mithril Breastplate set(heavy) +(4, 352, 2378, 2411, 0, 0, 3506, 2493, 3544, 3611), -- Brigandine Armor set -INSERT INTO armorsets VALUES(5, 394, 416, 0, 0, 2422, 3503, 0, 0, 3612); -- Reinforced leather set -INSERT INTO armorsets VALUES(6, 395, 417, 0, 0, 2424, 3505, 0, 0, 3612); -- Manticore skin set +(5, 394, 416, 0, 0, 2422, 3503, 0, 0, 3612), -- Reinforced leather set +(6, 395, 417, 0, 0, 2424, 3505, 0, 0, 3612), -- Manticore skin set -INSERT INTO armorsets VALUES(7, 436, 469, 0, 2447, 0, 3504, 0, 0, 3613); -- Tunic of knowledge set -INSERT INTO armorsets VALUES(8, 437, 470, 0, 2450, 0, 3507, 0, 0, 3613); -- Mithril Tunic +(7, 436, 469, 0, 2447, 0, 3504, 0, 0, 3613), -- Tunic of knowledge set +(8, 437, 470, 0, 2450, 0, 3507, 0, 0, 3613), -- Mithril Tunic -- C GRADE ------------- -- ######################## id chest legs head gloves feet skill shield sh_skill enchant6 -INSERT INTO armorsets VALUES(9, 354, 381, 2413, 0, 0, 3509, 2495, 3545, 3614); -- Chain Mail Shirt set -INSERT INTO armorsets VALUES(10, 60, 0, 517, 0, 0, 3512, 107, 3546, 3614); -- Composite Armor set -INSERT INTO armorsets VALUES(11, 356, 0, 2414, 0, 0, 3516, 2497, 3547, 3614); -- Full Plate Armor set +(9, 354, 381, 2413, 0, 0, 3509, 2495, 3545, 3614), -- Chain Mail Shirt set +(10, 60, 0, 517, 0, 0, 3512, 107, 3546, 3614), -- Composite Armor set +(11, 356, 0, 2414, 0, 0, 3516, 2497, 3547, 3614), -- Full Plate Armor set -INSERT INTO armorsets VALUES(12, 397, 2387, 0, 0, 62, 3508, 0, 0, 3615); -- Mithrill shirt set -INSERT INTO armorsets VALUES(13, 398, 418, 0, 0, 2431, 3511, 0, 0, 3615); -- Plated leather set -INSERT INTO armorsets VALUES(14, 400, 420, 0, 0, 2436, 3514, 0, 0, 3615); -- Theca leather set -INSERT INTO armorsets VALUES(15, 401, 0, 0, 0, 2437, 3515, 0, 0, 3615); -- Drake leather set +(12, 397, 2387, 0, 0, 62, 3508, 0, 0, 3615), -- Mithrill shirt set +(13, 398, 418, 0, 0, 2431, 3511, 0, 0, 3615), -- Plated leather set +(14, 400, 420, 0, 0, 2436, 3514, 0, 0, 3615), -- Theca leather set +(15, 401, 0, 0, 0, 2437, 3515, 0, 0, 3615), -- Drake leather set -INSERT INTO armorsets VALUES(16, 439, 471, 0, 2454, 0, 3510, 0, 0, 3616); -- Karmian robe set -INSERT INTO armorsets VALUES(17, 441, 472, 0, 2459, 0, 3513, 0, 0, 3616); -- Demon robe set -INSERT INTO armorsets VALUES(18, 442, 473, 0, 2463, 0, 3517, 0, 0, 3616); -- Divine robe set +(16, 439, 471, 0, 2454, 0, 3510, 0, 0, 3616), -- Karmian robe set +(17, 441, 472, 0, 2459, 0, 3513, 0, 0, 3616), -- Demon robe set +(18, 442, 473, 0, 2463, 0, 3517, 0, 0, 3616), -- Divine robe set -- B GRADE ------------- -- ######################## id chest legs head gloves feet skill shield sh_skill enchant6 -INSERT INTO armorsets VALUES(19, 357, 383, 503, 5710, 5726, 3518, 0, 0, 3617); -- Zubei's Breastplate set -INSERT INTO armorsets VALUES(20, 2384, 2388, 503, 5711, 5727, 3520, 0, 0, 3618); -- Zubei's leather set -INSERT INTO armorsets VALUES(21, 2397, 2402, 503, 5712, 5728, 3522, 0, 0, 3619); -- Zubei robe set +(19, 357, 383, 503, 5710, 5726, 3518, 0, 0, 3617), -- Zubei's Breastplate set +(20, 2384, 2388, 503, 5711, 5727, 3520, 0, 0, 3618), -- Zubei's leather set +(21, 2397, 2402, 503, 5712, 5728, 3522, 0, 0, 3619), -- Zubei robe set -INSERT INTO armorsets VALUES(22, 2376, 2379, 2415, 5714, 5730, 3519, 673, 3548, 3617); -- Avadon heavy set -INSERT INTO armorsets VALUES(23, 2390, 0, 2415, 5715, 5731, 3521, 0, 0, 3618); -- Avadon leather set -INSERT INTO armorsets VALUES(24, 2406, 0, 2415, 5716, 5732, 3523, 0, 0, 3619); -- Avadon robe set +(22, 2376, 2379, 2415, 5714, 5730, 3519, 673, 3548, 3617), -- Avadon heavy set +(23, 2390, 0, 2415, 5715, 5731, 3521, 0, 0, 3618), -- Avadon leather set +(24, 2406, 0, 2415, 5716, 5732, 3523, 0, 0, 3619), -- Avadon robe set -INSERT INTO armorsets VALUES(25, 358, 2380, 2416, 5718, 5734, 3524, 0, 0, 3617); -- Blue Wolf's Breastplate set -INSERT INTO armorsets VALUES(26, 2391, 0, 2416, 5719, 5735, 3526, 0, 0, 3618); -- Blue wolf leather set -INSERT INTO armorsets VALUES(27, 2398, 2403, 2416, 5720, 5736, 3528, 0, 0, 3619); -- Blue Wolf robe set +(25, 358, 2380, 2416, 5718, 5734, 3524, 0, 0, 3617), -- Blue Wolf's Breastplate set +(26, 2391, 0, 2416, 5719, 5735, 3526, 0, 0, 3618), -- Blue wolf leather set +(27, 2398, 2403, 2416, 5720, 5736, 3528, 0, 0, 3619), -- Blue Wolf robe set -INSERT INTO armorsets VALUES(28, 2381, 0, 2417, 5722, 5738, 3525, 110, 3549, 3617); -- Doom plate heavy set -INSERT INTO armorsets VALUES(29, 2392, 0, 2417, 5723, 5739, 3527, 0, 0, 3618); -- Doom leather set -INSERT INTO armorsets VALUES(30, 2399, 2404, 2417, 5724, 5740, 3529, 0, 0, 3619); -- Doom robe set +(28, 2381, 0, 2417, 5722, 5738, 3525, 110, 3549, 3617), -- Doom plate heavy set +(29, 2392, 0, 2417, 5723, 5739, 3527, 0, 0, 3618), -- Doom leather set +(30, 2399, 2404, 2417, 5724, 5740, 3529, 0, 0, 3619), -- Doom robe set -- A GRADE ------------- -- ######################## id chest legs head gloves feet skill shield sh_skill enchant6 -INSERT INTO armorsets VALUES(31, 365, 388, 512, 5765, 5777, 3530, 641, 3550, 3620); -- Dark Crystal Breastplate set -INSERT INTO armorsets VALUES(32, 2385, 2389, 512, 5766, 5778, 3532, 0, 0, 3621); -- Dark Crystal leather set -INSERT INTO armorsets VALUES(33, 2407, 0, 512, 5767, 5779, 3535, 0, 0, 3622); -- Dark Crystal robe set +(31, 365, 388, 512, 5765, 5777, 3530, 641, 3550, 3620), -- Dark Crystal Breastplate set +(32, 2385, 2389, 512, 5766, 5778, 3532, 0, 0, 3621), -- Dark Crystal leather set +(33, 2407, 0, 512, 5767, 5779, 3535, 0, 0, 3622), -- Dark Crystal robe set -INSERT INTO armorsets VALUES(34, 2382, 0, 547, 5768, 5780, 3531, 0, 0, 3620); -- Tallum plate heavy set -INSERT INTO armorsets VALUES(35, 2393, 0, 547, 5769, 5781, 3533, 0, 0, 3621); -- Tallum leather set -INSERT INTO armorsets VALUES(36, 2400, 2405, 547, 5770, 5782, 3534, 0, 0, 3622); -- Tallum robe set +(34, 2382, 0, 547, 5768, 5780, 3531, 0, 0, 3620), -- Tallum plate heavy set +(35, 2393, 0, 547, 5769, 5781, 3533, 0, 0, 3621), -- Tallum leather set +(36, 2400, 2405, 547, 5770, 5782, 3534, 0, 0, 3622), -- Tallum robe set -INSERT INTO armorsets VALUES(37, 374, 0, 2418, 5771, 5783, 3536, 2498, 3551, 3620); -- Nightmare heavy set -INSERT INTO armorsets VALUES(38, 2394, 0, 2418, 5772, 5784, 3538, 0, 0, 3621); -- Nightmare leather set -INSERT INTO armorsets VALUES(39, 2408, 0, 2418, 5773, 5785, 3540, 0, 0, 3622); -- Robe of nightmare set +(37, 374, 0, 2418, 5771, 5783, 3536, 2498, 3551, 3620), -- Nightmare heavy set +(38, 2394, 0, 2418, 5772, 5784, 3538, 0, 0, 3621), -- Nightmare leather set +(39, 2408, 0, 2418, 5773, 5785, 3540, 0, 0, 3622), -- Robe of nightmare set -INSERT INTO armorsets VALUES(40, 2383, 0, 2419, 5774, 5786, 3537, 0, 0, 3620); -- Majestic plate heavy set -INSERT INTO armorsets VALUES(41, 2395, 0, 2419, 5775, 5787, 3539, 0, 0, 3621); -- Majestic leather set -INSERT INTO armorsets VALUES(42, 2409, 0, 2419, 5776, 5788, 3541, 0, 0, 3622); -- Majestic robe set +(40, 2383, 0, 2419, 5774, 5786, 3537, 0, 0, 3620), -- Majestic plate heavy set +(41, 2395, 0, 2419, 5775, 5787, 3539, 0, 0, 3621), -- Majestic leather set +(42, 2409, 0, 2419, 5776, 5788, 3541, 0, 0, 3622), -- Majestic robe set -- S GRADE ------------- -- ######################## id chest legs head gloves feet skill shield sh_skill enchant6 -INSERT INTO armorsets VALUES(43, 6373, 6374, 6378, 6375, 6376, 3553, 6377, 3554, 3623); -- Imperial crusader set -INSERT INTO armorsets VALUES(44, 6379, 0, 6382, 6380, 6381, 3555, 0, 0, 3624); -- Draconic leather set -INSERT INTO armorsets VALUES(45, 6383, 0, 6386, 6384, 6385, 3556, 0, 0, 3625); -- Major arcana robe set +(43, 6373, 6374, 6378, 6375, 6376, 3553, 6377, 3554, 3623), -- Imperial crusader set +(44, 6379, 0, 6382, 6380, 6381, 3555, 0, 0, 3624), -- Draconic leather set +(45, 6383, 0, 6386, 6384, 6385, 3556, 0, 0, 3625), -- Major arcana robe set -- Clan Sets ------------- -- ######################## id chest legs head gloves feet skill shield sh_skill enchant6 -INSERT INTO armorsets VALUES(46, 7851, 0, 7850, 7852, 7853, 3605, 0, 0, 3611); -- Clan oath Armor set (heavy) -INSERT INTO armorsets VALUES(47, 7854, 0, 7850, 7855, 7856, 3606, 0, 0, 3612); -- Clan Oath Brigandine set (light) -INSERT INTO armorsets VALUES(48, 7857, 0, 7850, 7858, 7859, 3607, 0, 0, 3613); -- Clan Oath Aketon set (robe) +(46, 7851, 0, 7850, 7852, 7853, 3605, 0, 0, 3611), -- Clan oath Armor set (heavy) +(47, 7854, 0, 7850, 7855, 7856, 3606, 0, 0, 3612), -- Clan Oath Brigandine set (light) +(48, 7857, 0, 7850, 7858, 7859, 3607, 0, 0, 3613), -- Clan Oath Aketon set (robe) -INSERT INTO armorsets VALUES(49, 7861, 0, 7860, 7862, 7863, 3608, 0, 0, 3620); -- Apella plate armor set (heavy) -INSERT INTO armorsets VALUES(50, 7864, 0, 7860, 7865, 7866, 3609, 0, 0, 3621); -- Apella Brigandine set (light) -INSERT INTO armorsets VALUES(51, 7867, 0, 7860, 7868, 7869, 3610, 0, 0, 3622); -- Apella Doublet set (robe) +(49, 7861, 0, 7860, 7862, 7863, 3608, 0, 0, 3620), -- Apella plate armor set (heavy) +(50, 7864, 0, 7860, 7865, 7866, 3609, 0, 0, 3621), -- Apella Brigandine set (light) +(51, 7867, 0, 7860, 7868, 7869, 3610, 0, 0, 3622); -- Apella Doublet set (robe) diff --git a/Datapack/sql/auction.sql b/Datapack/sql/auction.sql index 0fe235f7..42031bda 100644 --- a/Datapack/sql/auction.sql +++ b/Datapack/sql/auction.sql @@ -16,7 +16,7 @@ CREATE TABLE IF NOT EXISTS `auction` ( endDate decimal(20,0) NOT NULL default '0', PRIMARY KEY (`itemType`,`itemId`,`itemObjectId`), KEY `id` (`id`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1; +); -- -- Dumping data for table `auction` diff --git a/Datapack/sql/auto_chat.sql b/Datapack/sql/auto_chat.sql index 19f9fe26..bd2e8a51 100644 --- a/Datapack/sql/auto_chat.sql +++ b/Datapack/sql/auto_chat.sql @@ -4,7 +4,7 @@ CREATE TABLE `auto_chat` ( `npcId` INT NOT NULL default '0', `chatDelay` BIGINT NOT NULL default '-1', PRIMARY KEY (`groupId`) -) ENGINE=InnoDB; +) ; INSERT INTO `auto_chat` VALUES diff --git a/Datapack/sql/auto_chat_text.sql b/Datapack/sql/auto_chat_text.sql index 46cab218..ed4b5d7f 100644 --- a/Datapack/sql/auto_chat_text.sql +++ b/Datapack/sql/auto_chat_text.sql @@ -3,7 +3,7 @@ CREATE TABLE `auto_chat_text` ( `groupId` INT NOT NULL default '0', `chatText` VARCHAR(255) NOT NULL default '', PRIMARY KEY (`groupId`,`chatText`) -) ENGINE=InnoDB; +); INSERT INTO `auto_chat_text` VALUES (1,'%player_cabal_loser%! All is lost! Prepare to meet the goddess of death!'), diff --git a/Datapack/sql/castle_manor_procure.sql b/Datapack/sql/castle_manor_procure.sql index 8a397035..51f8be07 100644 --- a/Datapack/sql/castle_manor_procure.sql +++ b/Datapack/sql/castle_manor_procure.sql @@ -10,4 +10,4 @@ CREATE TABLE IF NOT EXISTS `castle_manor_procure` ( `reward_type` int(11) NOT NULL DEFAULT '0', `period` INT NOT NULL DEFAULT '1', PRIMARY KEY (`castle_id`,`crop_id`,`period`) -) DEFAULT CHARSET=utf8; +); diff --git a/Datapack/sql/castle_manor_production.sql b/Datapack/sql/castle_manor_production.sql index 81d1b831..6841c969 100644 --- a/Datapack/sql/castle_manor_production.sql +++ b/Datapack/sql/castle_manor_production.sql @@ -9,4 +9,4 @@ CREATE TABLE IF NOT EXISTS `castle_manor_production` ( `seed_price` int(11) NOT NULL DEFAULT '0', `period` INT NOT NULL DEFAULT '1', PRIMARY KEY (`castle_id`,`seed_id`,`period`) -) DEFAULT CHARSET=utf8; +); diff --git a/Datapack/sql/char_templates.sql b/Datapack/sql/char_templates.sql index c051c31f..f5eeb261 100644 --- a/Datapack/sql/char_templates.sql +++ b/Datapack/sql/char_templates.sql @@ -42,98 +42,98 @@ CREATE TABLE `char_templates` ( `items4` int(4) NOT NULL default '0', `items5` int(10) NOT NULL default '0', PRIMARY KEY (`ClassId`) -) ENGINE=MyISAM; +); -- -- Dumping data for table `char_templates` -- - -INSERT INTO `char_templates` VALUES (0, 'Human Fighter', 0, 40, 43, 30, 21, 11, 25, 4, 80, 6, 41, 300, 333, 33, 44, 33, 115, 81900, -71338, 258271, -3104, 0, 1.10, 1.188000, 9.0, 23.0, 1.10, 1.188000, 8.0, 23.5, 1147, 1146, 10, 2369, 5588); -INSERT INTO `char_templates` VALUES (1, 'Warrior', 0, 40, 43, 30, 21, 11, 25, 4, 80, 6, 41, 300, 333, 33, 44, 33, 115, 81900, -71338, 258271, -3104, 0, 1.10, 1.188000, 9.0, 23.0, 1.10, 1.188000, 8.0, 23.5, 1147, 1146, 10, 2369, 5588); -INSERT INTO `char_templates` VALUES (2, 'Gladiator', 0, 40, 43, 30, 21, 11, 25, 4, 80, 6, 41, 300, 333, 33, 44, 33, 115, 81900, -71338, 258271, -3104, 0, 1.10, 1.188000, 9.0, 23.0, 1.10, 1.188000, 8.0, 23.5, 1147, 1146, 10, 2369, 5588); -INSERT INTO `char_templates` VALUES (3, 'Warlord', 0, 40, 43, 30, 21, 11, 25, 4, 80, 6, 41, 300, 333, 33, 44, 33, 115, 81900, -71338, 258271, -3104, 0, 1.10, 1.188000, 9.0, 23.0, 1.10, 1.188000, 8.0, 23.5, 1147, 1146, 10, 2369, 5588); -INSERT INTO `char_templates` VALUES (4, 'Human Knight', 0, 40, 43, 30, 21, 11, 25, 4, 80, 6, 41, 300, 333, 33, 44, 33, 115, 81900, -71338, 258271, -3104, 0, 1.10, 1.188000, 9.0, 23.0, 1.10, 1.188000, 8.0, 23.5, 1147, 1146, 10, 2369, 5588); -INSERT INTO `char_templates` VALUES (5, 'Paladin', 0, 40, 43, 30, 21, 11, 25, 4, 80, 6, 41, 300, 333, 33, 44, 33, 115, 81900, -71338, 258271, -3104, 0, 1.10, 1.188000, 9.0, 23.0, 1.10, 1.188000, 8.0, 23.5, 1147, 1146, 10, 2369, 5588); -INSERT INTO `char_templates` VALUES (6, 'Dark Avenger', 0, 40, 43, 30, 21, 11, 25, 4, 80, 6, 41, 300, 333, 33, 44, 33, 115, 81900, -71338, 258271, -3104, 0, 1.10, 1.188000, 9.0, 23.0, 1.10, 1.188000, 8.0, 23.5, 1147, 1146, 10, 2369, 5588); -INSERT INTO `char_templates` VALUES (7, 'Rogue', 0, 40, 43, 30, 21, 11, 25, 4, 80, 6, 41, 300, 333, 33, 44, 33, 115, 81900, -71338, 258271, -3104, 0, 1.10, 1.188000, 9.0, 23.0, 1.10, 1.188000, 8.0, 23.5, 1147, 1146, 10, 2369, 5588); -INSERT INTO `char_templates` VALUES (8, 'Treasure Hunter', 0, 40, 43, 30, 21, 11, 25, 4, 80, 6, 41, 300, 333, 33, 44, 33, 115, 81900, -71338, 258271, -3104, 0, 1.10, 1.188000, 9.0, 23.0, 1.10, 1.188000, 8.0, 23.5, 1147, 1146, 10, 2369, 5588); -INSERT INTO `char_templates` VALUES (9, 'Hawkeye', 0, 40, 43, 30, 21, 11, 25, 4, 80, 6, 41, 300, 333, 33, 44, 33, 115, 81900, -71338, 258271, -3104, 0, 1.10, 1.188000, 9.0, 23.0, 1.10, 1.188000, 8.0, 23.5, 1147, 1146, 10, 2369, 5588); -INSERT INTO `char_templates` VALUES (10, 'Human Mage', 0, 22, 27, 21, 41, 20, 39, 3, 54, 6, 41, 300, 333, 28, 40, 28, 120, 62500, -90890, 248027, -3570, 0, 1.01, 0.872640, 7.5, 22.8, 1.01, 0.872640, 6.5, 22.5, 425, 461, 6, 5588, 0); -INSERT INTO `char_templates` VALUES (11, 'Human Wizard', 0, 22, 27, 21, 41, 20, 39, 3, 54, 6, 41, 300, 333, 28, 40, 28, 120, 62500, -90890, 248027, -3570, 0, 1.01, 0.872640, 7.5, 22.8, 1.01, 0.872640, 6.5, 22.5, 425, 461, 6, 5588, 0); -INSERT INTO `char_templates` VALUES (12, 'Sorcerer', 0, 22, 27, 21, 41, 20, 39, 3, 54, 6, 41, 300, 333, 28, 40, 28, 120, 62500, -90890, 248027, -3570, 0, 1.01, 0.872640, 7.5, 22.8, 1.01, 0.872640, 6.5, 22.5, 425, 461, 6, 5588, 0); -INSERT INTO `char_templates` VALUES (13, 'Necromancer', 0, 22, 27, 21, 41, 20, 39, 3, 54, 6, 41, 300, 333, 28, 40, 28, 120, 62500, -90890, 248027, -3570, 0, 1.01, 0.872640, 7.5, 22.8, 1.01, 0.872640, 6.5, 22.5, 425, 461, 6, 5588, 0); -INSERT INTO `char_templates` VALUES (14, 'Warlock', 0, 22, 27, 21, 41, 20, 39, 3, 54, 6, 41, 300, 333, 28, 40, 28, 120, 62500, -90890, 248027, -3570, 0, 1.01, 0.872640, 7.5, 22.8, 1.01, 0.872640, 6.5, 22.5, 425, 461, 6, 5588, 0); -INSERT INTO `char_templates` VALUES (15, 'Cleric', 0, 22, 27, 21, 41, 20, 39, 3, 54, 6, 41, 300, 333, 28, 40, 28, 120, 62500, -90890, 248027, -3570, 0, 1.01, 0.872640, 7.5, 22.8, 1.01, 0.872640, 6.5, 22.5, 425, 461, 6, 5588, 0); -INSERT INTO `char_templates` VALUES (16, 'Bishop', 0, 22, 27, 21, 41, 20, 39, 3, 54, 6, 41, 300, 333, 28, 40, 28, 120, 62500, -90890, 248027, -3570, 0, 1.01, 0.872640, 7.5, 22.8, 1.01, 0.872640, 6.5, 22.5, 425, 461, 6, 5588, 0); -INSERT INTO `char_templates` VALUES (17, 'Human Prophet', 0, 22, 27, 21, 41, 20, 39, 3, 54, 6, 41, 300, 333, 28, 40, 28, 120, 62500, -90890, 248027, -3570, 0, 1.01, 0.872640, 7.5, 22.8, 1.01, 0.872640, 6.5, 22.5, 425, 461, 6, 5588, 0); -INSERT INTO `char_templates` VALUES (18, 'Elf Fighter', 1, 36, 36, 35, 23, 14, 26, 4, 80, 6, 41, 300, 333, 36, 46, 36, 125, 73000, 45978, 41196, -3440, 0, 1.15, 1.242000, 7.5, 24.0, 1.15, 1.242000, 7.5, 23.0, 1147, 1146, 10, 2369, 5588); -INSERT INTO `char_templates` VALUES (19, 'Elf Knight', 1, 36, 36, 35, 23, 14, 26, 4, 80, 6, 41, 300, 333, 36, 46, 36, 125, 73000, 45978, 41196, -3440, 0, 1.15, 1.242000, 7.5, 24.0, 1.15, 1.242000, 7.5, 23.0, 1147, 1146, 10, 2369, 5588); -INSERT INTO `char_templates` VALUES (20, 'Temple Knight', 1, 36, 36, 35, 23, 14, 26, 4, 80, 6, 41, 300, 333, 36, 46, 36, 125, 73000, 45978, 41196, -3440, 0, 1.15, 1.242000, 7.5, 24.0, 1.15, 1.242000, 7.5, 23.0, 1147, 1146, 10, 2369, 5588); -INSERT INTO `char_templates` VALUES (21, 'Swordsinger', 1, 36, 36, 35, 23, 14, 26, 4, 80, 6, 41, 300, 333, 36, 46, 36, 125, 73000, 45978, 41196, -3440, 0, 1.15, 1.242000, 7.5, 24.0, 1.15, 1.242000, 7.5, 23.0, 1147, 1146, 10, 2369, 5588); -INSERT INTO `char_templates` VALUES (22, 'Scout', 1, 36, 36, 35, 23, 14, 26, 4, 80, 6, 41, 300, 333, 36, 46, 36, 125, 73000, 45978, 41196, -3440, 0, 1.15, 1.242000, 7.5, 24.0, 1.15, 1.242000, 7.5, 23.0, 1147, 1146, 10, 2369, 5588); -INSERT INTO `char_templates` VALUES (23, 'Plains Walker', 1, 36, 36, 35, 23, 14, 26, 4, 80, 6, 41, 300, 333, 36, 46, 36, 125, 73000, 45978, 41196, -3440, 0, 1.15, 1.242000, 7.5, 24.0, 1.15, 1.242000, 7.5, 23.0, 1147, 1146, 10, 2369, 5588); -INSERT INTO `char_templates` VALUES (24, 'Silver Ranger', 1, 36, 36, 35, 23, 14, 26, 4, 80, 6, 41, 300, 333, 36, 46, 36, 125, 73000, 45978, 41196, -3440, 0, 1.15, 1.242000, 7.5, 24.0, 1.15, 1.242000, 7.5, 23.0, 1147, 1146, 10, 2369, 5588); -INSERT INTO `char_templates` VALUES (25, 'Elf Mage', 1, 21, 25, 24, 37, 23, 40, 3, 54, 6, 41, 300, 333, 30, 41, 30, 122, 62400, 46182, 41198, -3440, 0, 1.04, 0.898560, 7.5, 24.0, 1.04, 0.898560, 7.5, 23.0, 425, 461, 6, 5588, 0); -INSERT INTO `char_templates` VALUES (26, 'Elf Wizard', 1, 21, 25, 24, 37, 23, 40, 3, 54, 6, 41, 300, 333, 30, 41, 30, 122, 62400, 46182, 41198, -3440, 0, 1.04, 0.898560, 7.5, 24.0, 1.04, 0.898560, 7.5, 23.0, 425, 461, 6, 5588, 0); -INSERT INTO `char_templates` VALUES (27, 'Spellsinger', 1, 21, 25, 24, 37, 23, 40, 3, 54, 6, 41, 300, 333, 30, 41, 30, 122, 62400, 46182, 41198, -3440, 0, 1.04, 0.898560, 7.5, 24.0, 1.04, 0.898560, 7.5, 23.0, 425, 461, 6, 5588, 0); -INSERT INTO `char_templates` VALUES (28, 'Elemental Summoner', 1, 21, 25, 24, 37, 23, 40, 3, 54, 6, 41, 300, 333, 30, 41, 30, 122, 62400, 46182, 41198, -3440, 0, 1.04, 0.898560, 7.5, 24.0, 1.04, 0.898560, 7.5, 23.0, 425, 461, 6, 5588, 0); -INSERT INTO `char_templates` VALUES (29, 'Oracle', 1, 21, 25, 24, 37, 23, 40, 3, 54, 6, 41, 300, 333, 30, 41, 30, 122, 62400, 46182, 41198, -3440, 0, 1.04, 0.898560, 7.5, 24.0, 1.04, 0.898560, 7.5, 23.0, 425, 461, 6, 5588, 0); -INSERT INTO `char_templates` VALUES (30, 'Elder', 1, 21, 25, 24, 37, 23, 40, 3, 54, 6, 41, 300, 333, 30, 41, 30, 122, 62400, 46182, 41198, -3440, 0, 1.04, 0.898560, 7.5, 24.0, 1.04, 0.898560, 7.5, 23.0, 425, 461, 6, 5588, 0); -INSERT INTO `char_templates` VALUES (31, 'DE Fighter', 2, 41, 32, 34, 25, 12, 26, 4, 80, 6, 41, 300, 333, 35, 45, 35, 122, 69000, 28377, 10916, -4224, 0, 1.14, 1.231200, 7.5, 24.0, 1.14, 1.231200, 7.0, 23.5, 1147, 1146, 10, 2369, 5588); -INSERT INTO `char_templates` VALUES (32, 'Palus Knight', 2, 41, 32, 34, 25, 12, 26, 4, 80, 6, 41, 300, 333, 35, 45, 35, 122, 69000, 28377, 10916, -4224, 0, 1.14, 1.231200, 7.5, 24.0, 1.14, 1.231200, 7.0, 23.5, 1147, 1146, 10, 2369, 5588); -INSERT INTO `char_templates` VALUES (33, 'Shillien Knight', 2, 41, 32, 34, 25, 12, 26, 4, 80, 6, 41, 300, 333, 35, 45, 35, 122, 69000, 28377, 10916, -4224, 0, 1.14, 1.231200, 7.5, 24.0, 1.14, 1.231200, 7.0, 23.5, 1147, 1146, 10, 2369, 5588); -INSERT INTO `char_templates` VALUES (34, 'Bladedancer', 2, 41, 32, 34, 25, 12, 26, 4, 80, 6, 41, 300, 333, 35, 45, 35, 122, 69000, 28377, 10916, -4224, 0, 1.14, 1.231200, 7.5, 24.0, 1.14, 1.231200, 7.0, 23.5, 1147, 1146, 10, 2369, 5588); -INSERT INTO `char_templates` VALUES (35, 'Assassin', 2, 41, 32, 34, 25, 12, 26, 4, 80, 6, 41, 300, 333, 35, 45, 35, 122, 69000, 28377, 10916, -4224, 0, 1.14, 1.231200, 7.5, 24.0, 1.14, 1.231200, 7.0, 23.5, 1147, 1146, 10, 2369, 5588); -INSERT INTO `char_templates` VALUES (36, 'Abyss Walker', 2, 41, 32, 34, 25, 12, 26, 4, 80, 6, 41, 300, 333, 35, 45, 35, 122, 69000, 28377, 10916, -4224, 0, 1.14, 1.231200, 7.5, 24.0, 1.14, 1.231200, 7.0, 23.5, 1147, 1146, 10, 2369, 5588); -INSERT INTO `char_templates` VALUES (37, 'Phantom Ranger', 2, 41, 32, 34, 25, 12, 26, 4, 80, 6, 41, 300, 333, 35, 45, 35, 122, 69000, 28377, 10916, -4224, 0, 1.14, 1.231200, 7.5, 24.0, 1.14, 1.231200, 7.0, 23.5, 1147, 1146, 10, 2369, 5588); -INSERT INTO `char_templates` VALUES (38, 'DE Mage', 2, 23, 24, 23, 44, 19, 37, 3, 54, 6, 41, 300, 333, 29, 41, 29, 122, 61000, 28295, 11063, -4224, 0, 1.14, 1.231200, 7.5, 24.0, 1.03, 0.889920, 7.0, 23.5, 425, 461, 6, 5588, 0); -INSERT INTO `char_templates` VALUES (39, 'DE Wizard', 2, 23, 24, 23, 44, 19, 37, 3, 54, 6, 41, 300, 333, 29, 41, 29, 122, 61000, 28295, 11063, -4224, 0, 1.14, 1.231200, 7.5, 24.0, 1.03, 0.889920, 7.0, 23.5, 425, 461, 6, 5588, 0); -INSERT INTO `char_templates` VALUES (40, 'Spell Howler', 2, 23, 24, 23, 44, 19, 37, 3, 54, 6, 41, 300, 333, 29, 41, 29, 122, 61000, 28295, 11063, -4224, 0, 1.14, 1.231200, 7.5, 24.0, 1.03, 0.889920, 7.0, 23.5, 425, 461, 6, 5588, 0); -INSERT INTO `char_templates` VALUES (41, 'Phantom Summoner', 2, 23, 24, 23, 44, 19, 37, 3, 54, 6, 41, 300, 333, 29, 41, 29, 122, 61000, 28295, 11063, -4224, 0, 1.14, 1.231200, 7.5, 24.0, 1.03, 0.889920, 7.0, 23.5, 425, 461, 6, 5588, 0); -INSERT INTO `char_templates` VALUES (42, 'Shillien Oracle', 2, 23, 24, 23, 44, 19, 37, 3, 54, 6, 41, 300, 333, 29, 41, 29, 122, 61000, 28295, 11063, -4224, 0, 1.14, 1.231200, 7.5, 24.0, 1.03, 0.889920, 7.0, 23.5, 425, 461, 6, 5588, 0); -INSERT INTO `char_templates` VALUES (43, 'Shillien Elder', 2, 23, 24, 23, 44, 19, 37, 3, 54, 6, 41, 300, 333, 29, 41, 29, 122, 61000, 28295, 11063, -4224, 0, 1.14, 1.231200, 7.5, 24.0, 1.03, 0.889920, 7.0, 23.5, 425, 461, 6, 5588, 0); -INSERT INTO `char_templates` VALUES (44, 'Orc Fighter', 3, 40, 47, 26, 18, 12, 27, 4, 80, 6, 41, 300, 333, 31, 42, 31, 117, 87000, -56693, -113610, -690, 0, 1.06, 1.144800, 11.0, 28.0, 1.06, 1.144800, 7.0, 27.0, 1147, 1146, 2368, 2369, 5588); -INSERT INTO `char_templates` VALUES (45, 'Raider', 3, 40, 47, 26, 18, 12, 27, 4, 80, 6, 41, 300, 333, 31, 42, 31, 117, 87000, -56693, -113610, -690, 0, 1.06, 1.144800, 11.0, 28.0, 1.06, 1.144800, 7.0, 27.0, 1147, 1146, 2368, 2369, 5588); -INSERT INTO `char_templates` VALUES (46, 'Destroyer', 3, 40, 47, 26, 18, 12, 27, 4, 80, 6, 41, 300, 333, 31, 42, 31, 117, 87000, -56693, -113610, -690, 0, 1.06, 1.144800, 11.0, 28.0, 1.06, 1.144800, 7.0, 27.0, 1147, 1146, 2368, 2369, 5588); -INSERT INTO `char_templates` VALUES (47, 'Monk', 3, 40, 47, 26, 18, 12, 27, 4, 80, 6, 41, 300, 333, 31, 42, 31, 117, 87000, -56682, -113610, -690, 0, 1.06, 1.144800, 11.0, 28.0, 1.06, 1.144800, 7.0, 27.0, 1147, 1146, 2368, 2369, 5588); -INSERT INTO `char_templates` VALUES (48, 'Tyrant', 3, 40, 47, 26, 18, 12, 27, 4, 80, 6, 41, 300, 333, 31, 42, 31, 117, 87000, -56693, -113610, -690, 0, 1.06, 1.144800, 11.0, 28.0, 1.06, 1.144800, 7.0, 27.0, 1147, 1146, 2368, 2369, 5588); -INSERT INTO `char_templates` VALUES (49, 'Orc Mage', 3, 27, 31, 24, 31, 15, 42, 3, 54, 6, 41, 300, 333, 30, 41, 30, 121, 68000, -56682, -113730, -690, 0, 1.04, 0.898560, 7.0, 27.5, 1.04, 0.898560, 8.0, 25.5, 425, 461, 2368, 5588, 0); -INSERT INTO `char_templates` VALUES (50, 'Shaman', 3, 27, 31, 24, 31, 15, 42, 3, 54, 6, 41, 300, 333, 30, 41, 30, 121, 68000, -56682, -113730, -690, 0, 1.04, 0.898560, 7.0, 27.5, 1.04, 0.898560, 8.0, 25.5, 425, 461, 2368, 5588, 0); -INSERT INTO `char_templates` VALUES (51, 'Overlord', 3, 27, 31, 24, 31, 15, 42, 3, 54, 6, 41, 300, 333, 30, 41, 30, 121, 68000, -56682, -113730, -690, 0, 1.04, 0.898560, 7.0, 27.5, 1.04, 0.898560, 8.0, 25.5, 425, 461, 2368, 5588, 0); -INSERT INTO `char_templates` VALUES (52, 'Warcryer', 3, 27, 31, 24, 31, 15, 42, 3, 54, 6, 41, 300, 333, 30, 41, 30, 121, 68000, -56682, -113730, -690, 0, 1.04, 0.898560, 7.0, 27.5, 1.04, 0.898560, 8.0, 25.5, 425, 461, 2368, 5588, 0); -INSERT INTO `char_templates` VALUES (53, 'Dwarf Fighter', 4, 39, 45, 29, 20, 10, 27, 4, 80, 6, 41, 300, 333, 33, 43, 33, 115, 83000, 108512, -174026, -400, 1, 1.09, 1.487196, 9.0, 18.0, 1.09, 1.487196, 5.0, 19.0, 1147, 1146, 10, 2370, 5588); -INSERT INTO `char_templates` VALUES (54, 'Scavenger', 4, 39, 45, 29, 20, 10, 27, 4, 80, 6, 41, 300, 333, 33, 43, 33, 115, 83000, 108512, -174026, -400, 1, 1.09, 1.487196, 9.0, 18.0, 1.09, 1.487196, 5.0, 19.0, 1147, 1146, 10, 2370, 5588); -INSERT INTO `char_templates` VALUES (55, 'Bounty Hunter', 4, 39, 45, 29, 20, 10, 27, 4, 80, 6, 41, 300, 333, 33, 43, 33, 115, 83000, 108512, -174026, -400, 1, 1.09, 1.487196, 9.0, 18.0, 1.09, 1.487196, 5.0, 19.0, 1147, 1146, 10, 2370, 5588); -INSERT INTO `char_templates` VALUES (56, 'Artisan', 4, 39, 45, 29, 20, 10, 27, 4, 80, 6, 41, 300, 333, 33, 43, 33, 115, 83000, 108512, -174026, -400, 1, 1.09, 1.487196, 9.0, 18.0, 1.09, 1.487196, 5.0, 19.0, 1147, 1146, 10, 2370, 5588); -INSERT INTO `char_templates` VALUES (57, 'Warsmith', 4, 39, 45, 29, 20, 10, 27, 4, 80, 6, 41, 300, 333, 33, 43, 33, 115, 83000, 108512, -174026, -400, 1, 1.09, 1.487196, 9.0, 18.0, 1.09, 1.487196, 5.0, 19.0, 1147, 1146, 10, 2370, 5588); -INSERT INTO `char_templates` VALUES (88, 'Duelist', 0, 40, 43, 30, 21, 11, 25, 4, 80, 6, 41, 300, 333, 33, 44, 33, 115, 81900, -71338, 258271, -3104, 0, 1.10, 1.188000, 9.0, 23.0, 1.10, 1.188000, 8.0, 23.5, 1147, 1146, 10, 2369, 5588); -INSERT INTO `char_templates` VALUES (89, 'DreadNought', 0, 40, 43, 30, 21, 11, 25, 4, 80, 6, 41, 300, 333, 33, 44, 33, 115, 81900, -71338, 258271, -3104, 0, 1.10, 1.188000, 9.0, 23.0, 1.10, 1.188000, 8.0, 23.5, 1147, 1146, 10, 2369, 5588); -INSERT INTO `char_templates` VALUES (90, 'Phoenix Knight', 0, 40, 43, 30, 21, 11, 25, 4, 80, 6, 41, 300, 333, 33, 44, 33, 115, 81900, -71338, 258271, -3104, 0, 1.10, 1.188000, 9.0, 23.0, 1.10, 1.188000, 8.0, 23.5, 1147, 1146, 10, 2369, 5588); -INSERT INTO `char_templates` VALUES (91, 'Hell Knight', 0, 40, 43, 30, 21, 11, 25, 4, 80, 6, 41, 300, 333, 33, 44, 33, 115, 81900, -71338, 258271, -3104, 0, 1.10, 1.188000, 9.0, 23.0, 1.10, 1.188000, 8.0, 23.5, 1147, 1146, 10, 2369, 5588); -INSERT INTO `char_templates` VALUES (92, 'Sagittarius', 0, 40, 43, 30, 21, 11, 25, 4, 80, 6, 41, 300, 333, 33, 44, 33, 115, 81900, -71338, 258271, -3104, 0, 1.10, 1.188000, 9.0, 23.0, 1.10, 1.188000, 8.0, 23.5, 1147, 1146, 10, 2369, 5588); -INSERT INTO `char_templates` VALUES (93, 'Adventurer', 0, 40, 43, 30, 21, 11, 25, 4, 80, 6, 41, 300, 333, 33, 44, 33, 115, 81900, -71338, 258271, -3104, 0, 1.10, 1.188000, 9.0, 23.0, 1.10, 1.188000, 8.0, 23.5, 1147, 1146, 10, 2369, 5588); -INSERT INTO `char_templates` VALUES (94, 'Archmage', 0, 22, 27, 21, 41, 20, 39, 3, 54, 6, 41, 300, 333, 28, 40, 28, 120, 62500, -90890, 248027, -3570, 0, 1.01, 0.872640, 7.5, 22.8, 1.01, 0.872640, 6.5, 22.5, 425, 461, 6, 5588, 0); -INSERT INTO `char_templates` VALUES (95, 'Soultaker', 0, 22, 27, 21, 41, 20, 39, 3, 54, 6, 41, 300, 333, 28, 40, 28, 120, 62500, -90890, 248027, -3570, 0, 1.01, 0.872640, 7.5, 22.8, 1.01, 0.872640, 6.5, 22.5, 425, 461, 6, 5588, 0); -INSERT INTO `char_templates` VALUES (96, 'Arcana Lord', 0, 22, 27, 21, 41, 20, 39, 3, 54, 6, 41, 300, 333, 28, 40, 28, 120, 62500, -90890, 248027, -3570, 0, 1.01, 0.872640, 7.5, 22.8, 1.01, 0.872640, 6.5, 22.5, 425, 461, 6, 5588, 0); -INSERT INTO `char_templates` VALUES (97, 'Cardinal', 0, 22, 27, 21, 41, 20, 39, 3, 54, 6, 41, 300, 333, 28, 40, 28, 120, 62500, -90890, 248027, -3570, 0, 1.01, 0.872640, 7.5, 22.8, 1.01, 0.872640, 6.5, 22.5, 425, 461, 6, 5588, 0); -INSERT INTO `char_templates` VALUES (98, 'Hierophant', 0, 22, 27, 21, 41, 20, 39, 3, 54, 6, 41, 300, 333, 28, 40, 28, 120, 62500, -90890, 248027, -3570, 0, 1.01, 0.872640, 7.5, 22.8, 1.01, 0.872640, 6.5, 22.5, 425, 461, 6, 5588, 0); -INSERT INTO `char_templates` VALUES (99, 'Eva Templar', 1, 36, 36, 35, 23, 14, 26, 4, 80, 6, 41, 300, 333, 36, 46, 36, 125, 73000, 45978, 41196, -3440, 0, 1.15, 1.242000, 7.5, 24.0, 1.15, 1.242000, 7.5, 23.0, 1147, 1146, 10, 2369, 5588); -INSERT INTO `char_templates` VALUES (100, 'Sword Muse', 1, 36, 36, 35, 23, 14, 26, 4, 80, 6, 41, 300, 333, 36, 46, 36, 125, 73000, 45978, 41196, -3440, 0, 1.15, 1.242000, 7.5, 24.0, 1.15, 1.242000, 7.5, 23.0, 1147, 1146, 10, 2369, 5588); -INSERT INTO `char_templates` VALUES (101, 'Wind Rider', 1, 36, 36, 35, 23, 14, 26, 4, 80, 6, 41, 300, 333, 36, 46, 36, 125, 73000, 45978, 41196, -3440, 0, 1.15, 1.242000, 7.5, 24.0, 1.15, 1.242000, 7.5, 23.0, 1147, 1146, 10, 2369, 5588); -INSERT INTO `char_templates` VALUES (102, 'Moonlight Sentinel', 1, 36, 36, 35, 23, 14, 26, 4, 80, 6, 41, 300, 333, 36, 46, 36, 125, 73000, 45978, 41196, -3440, 0, 1.15, 1.242000, 7.5, 24.0, 1.15, 1.242000, 7.5, 23.0, 1147, 1146, 10, 2369, 5588); -INSERT INTO `char_templates` VALUES (103, 'Mystic Muse', 1, 21, 25, 24, 37, 23, 40, 3, 54, 6, 41, 300, 333, 30, 41, 30, 122, 62400, 46182, 41198, -3440, 0, 1.04, 0.898560, 7.5, 24.0, 1.04, 0.898560, 7.5, 23.0, 425, 461, 6, 5588, 0); -INSERT INTO `char_templates` VALUES (104, 'Elemental Master', 1, 21, 25, 24, 37, 23, 40, 3, 54, 6, 41, 300, 333, 30, 41, 30, 122, 62400, 46182, 41198, -3440, 0, 1.04, 0.898560, 7.5, 24.0, 1.04, 0.898560, 7.5, 23.0, 425, 461, 6, 5588, 0); -INSERT INTO `char_templates` VALUES (105, 'Eva Saint', 1, 21, 25, 24, 37, 23, 40, 3, 54, 6, 41, 300, 333, 30, 41, 30, 122, 62400, 46182, 41198, -3440, 0, 1.04, 0.898560, 7.5, 24.0, 1.04, 0.898560, 7.5, 23.0, 425, 461, 6, 5588, 0); -INSERT INTO `char_templates` VALUES (106, 'Shillien Templar', 2, 41, 32, 34, 25, 12, 26, 4, 80, 6, 41, 300, 333, 35, 45, 35, 122, 69000, 28377, 10916, -4224, 0, 1.14, 1.231200, 7.5, 24.0, 1.14, 1.231200, 7.0, 23.5, 1147, 1146, 10, 2369, 5588); -INSERT INTO `char_templates` VALUES (107, 'Spectral Dancer', 2, 41, 32, 34, 25, 12, 26, 4, 80, 6, 41, 300, 333, 35, 45, 35, 122, 69000, 28377, 10916, -4224, 0, 1.14, 1.231200, 7.5, 24.0, 1.14, 1.231200, 7.0, 23.5, 1147, 1146, 10, 2369, 5588); -INSERT INTO `char_templates` VALUES (108, 'Ghost Hunter', 2, 41, 32, 34, 25, 12, 26, 4, 80, 6, 41, 300, 333, 35, 45, 35, 122, 69000, 28377, 10916, -4224, 0, 1.14, 1.231200, 7.5, 24.0, 1.14, 1.231200, 7.0, 23.5, 1147, 1146, 10, 2369, 5588); -INSERT INTO `char_templates` VALUES (109, 'Ghost Sentinel', 2, 41, 32, 34, 25, 12, 26, 4, 80, 6, 41, 300, 333, 35, 45, 35, 122, 69000, 28377, 10916, -4224, 0, 1.14, 1.231200, 7.5, 24.0, 1.14, 1.231200, 7.0, 23.5, 1147, 1146, 10, 2369, 5588); -INSERT INTO `char_templates` VALUES (110, 'Storm Screamer', 2, 23, 24, 23, 44, 19, 37, 3, 54, 6, 41, 300, 333, 29, 41, 29, 122, 61000, 28295, 11063, -4224, 0, 1.14, 1.231200, 7.5, 24.0, 1.03, 0.889920, 7.0, 23.5, 425, 461, 6, 5588, 0); -INSERT INTO `char_templates` VALUES (111, 'Spectral Master', 2, 23, 24, 23, 44, 19, 37, 3, 54, 6, 41, 300, 333, 29, 41, 29, 122, 61000, 28295, 11063, -4224, 0, 1.14, 1.231200, 7.5, 24.0, 1.03, 0.889920, 7.0, 23.5, 425, 461, 6, 5588, 0); -INSERT INTO `char_templates` VALUES (112, 'Shillen Saint', 2, 23, 24, 23, 44, 19, 37, 3, 54, 6, 41, 300, 333, 29, 41, 29, 122, 61000, 28295, 11063, -4224, 0, 1.14, 1.231200, 7.5, 24.0, 1.03, 0.889920, 7.0, 23.5, 425, 461, 6, 5588, 0); -INSERT INTO `char_templates` VALUES (113, 'Titan', 3, 40, 47, 26, 18, 12, 27, 4, 80, 6, 41, 300, 333, 31, 42, 31, 117, 87000, -56693, -113610, -690, 0, 1.06, 1.144800, 11.0, 28.0, 1.06, 1.144800, 7.0, 27.0, 1147, 1146, 2368, 2369, 5588); -INSERT INTO `char_templates` VALUES (114, 'Grand Khauatari', 3, 40, 47, 26, 18, 12, 27, 4, 80, 6, 41, 300, 333, 31, 42, 31, 117, 87000, -56693, -113610, -690, 0, 1.06, 1.144800, 11.0, 28.0, 1.06, 1.144800, 7.0, 27.0, 1147, 1146, 2368, 2369, 5588); -INSERT INTO `char_templates` VALUES (115, 'Dominator', 3, 27, 31, 24, 31, 15, 42, 3, 54, 6, 41, 300, 333, 30, 41, 30, 121, 68000, -56682, -113730, -690, 0, 1.04, 0.898560, 7.0, 27.5, 1.04, 0.898560, 8.0, 25.5, 425, 461, 2368, 5588, 0); -INSERT INTO `char_templates` VALUES (116, 'Doomcryer', 3, 27, 31, 24, 31, 15, 42, 3, 54, 6, 41, 300, 333, 30, 41, 30, 121, 68000, -56682, -113730, -690, 0, 1.04, 0.898560, 7.0, 27.5, 1.04, 0.898560, 8.0, 25.5, 425, 461, 2368, 5588, 0); -INSERT INTO `char_templates` VALUES (117, 'Fortune Seeker', 4, 39, 45, 29, 20, 10, 27, 4, 80, 6, 41, 300, 333, 33, 43, 33, 115, 83000, 108512, -174026, -400, 1, 1.09, 1.487196, 9.0, 18.0, 1.09, 1.487196, 5.0, 19.0, 1147, 1146, 10, 2370, 5588); -INSERT INTO `char_templates` VALUES (118, 'Maestro', 4, 39, 45, 29, 20, 10, 27, 4, 80, 6, 41, 300, 333, 33, 43, 33, 115, 83000, 108512, -174026, -400, 1, 1.09, 1.487196, 9.0, 18.0, 1.09, 1.487196, 5.0, 19.0, 1147, 1146, 10, 2370, 5588); \ No newline at end of file +INSERT INTO `char_templates` VALUES + (0, 'Human Fighter', 0, 40, 43, 30, 21, 11, 25, 4, 80, 6, 41, 300, 333, 33, 44, 33, 115, 81900, -71338, 258271, -3104, 0, 1.10, 1.188000, 9.0, 23.0, 1.10, 1.188000, 8.0, 23.5, 1147, 1146, 10, 2369, 5588), + (1, 'Warrior', 0, 40, 43, 30, 21, 11, 25, 4, 80, 6, 41, 300, 333, 33, 44, 33, 115, 81900, -71338, 258271, -3104, 0, 1.10, 1.188000, 9.0, 23.0, 1.10, 1.188000, 8.0, 23.5, 1147, 1146, 10, 2369, 5588), + (2, 'Gladiator', 0, 40, 43, 30, 21, 11, 25, 4, 80, 6, 41, 300, 333, 33, 44, 33, 115, 81900, -71338, 258271, -3104, 0, 1.10, 1.188000, 9.0, 23.0, 1.10, 1.188000, 8.0, 23.5, 1147, 1146, 10, 2369, 5588), + (3, 'Warlord', 0, 40, 43, 30, 21, 11, 25, 4, 80, 6, 41, 300, 333, 33, 44, 33, 115, 81900, -71338, 258271, -3104, 0, 1.10, 1.188000, 9.0, 23.0, 1.10, 1.188000, 8.0, 23.5, 1147, 1146, 10, 2369, 5588), + (4, 'Human Knight', 0, 40, 43, 30, 21, 11, 25, 4, 80, 6, 41, 300, 333, 33, 44, 33, 115, 81900, -71338, 258271, -3104, 0, 1.10, 1.188000, 9.0, 23.0, 1.10, 1.188000, 8.0, 23.5, 1147, 1146, 10, 2369, 5588), + (5, 'Paladin', 0, 40, 43, 30, 21, 11, 25, 4, 80, 6, 41, 300, 333, 33, 44, 33, 115, 81900, -71338, 258271, -3104, 0, 1.10, 1.188000, 9.0, 23.0, 1.10, 1.188000, 8.0, 23.5, 1147, 1146, 10, 2369, 5588), + (6, 'Dark Avenger', 0, 40, 43, 30, 21, 11, 25, 4, 80, 6, 41, 300, 333, 33, 44, 33, 115, 81900, -71338, 258271, -3104, 0, 1.10, 1.188000, 9.0, 23.0, 1.10, 1.188000, 8.0, 23.5, 1147, 1146, 10, 2369, 5588), + (7, 'Rogue', 0, 40, 43, 30, 21, 11, 25, 4, 80, 6, 41, 300, 333, 33, 44, 33, 115, 81900, -71338, 258271, -3104, 0, 1.10, 1.188000, 9.0, 23.0, 1.10, 1.188000, 8.0, 23.5, 1147, 1146, 10, 2369, 5588), + (8, 'Treasure Hunter', 0, 40, 43, 30, 21, 11, 25, 4, 80, 6, 41, 300, 333, 33, 44, 33, 115, 81900, -71338, 258271, -3104, 0, 1.10, 1.188000, 9.0, 23.0, 1.10, 1.188000, 8.0, 23.5, 1147, 1146, 10, 2369, 5588), + (9, 'Hawkeye', 0, 40, 43, 30, 21, 11, 25, 4, 80, 6, 41, 300, 333, 33, 44, 33, 115, 81900, -71338, 258271, -3104, 0, 1.10, 1.188000, 9.0, 23.0, 1.10, 1.188000, 8.0, 23.5, 1147, 1146, 10, 2369, 5588), + (10, 'Human Mage', 0, 22, 27, 21, 41, 20, 39, 3, 54, 6, 41, 300, 333, 28, 40, 28, 120, 62500, -90890, 248027, -3570, 0, 1.01, 0.872640, 7.5, 22.8, 1.01, 0.872640, 6.5, 22.5, 425, 461, 6, 5588, 0), + (11, 'Human Wizard', 0, 22, 27, 21, 41, 20, 39, 3, 54, 6, 41, 300, 333, 28, 40, 28, 120, 62500, -90890, 248027, -3570, 0, 1.01, 0.872640, 7.5, 22.8, 1.01, 0.872640, 6.5, 22.5, 425, 461, 6, 5588, 0), + (12, 'Sorcerer', 0, 22, 27, 21, 41, 20, 39, 3, 54, 6, 41, 300, 333, 28, 40, 28, 120, 62500, -90890, 248027, -3570, 0, 1.01, 0.872640, 7.5, 22.8, 1.01, 0.872640, 6.5, 22.5, 425, 461, 6, 5588, 0), + (13, 'Necromancer', 0, 22, 27, 21, 41, 20, 39, 3, 54, 6, 41, 300, 333, 28, 40, 28, 120, 62500, -90890, 248027, -3570, 0, 1.01, 0.872640, 7.5, 22.8, 1.01, 0.872640, 6.5, 22.5, 425, 461, 6, 5588, 0), + (14, 'Warlock', 0, 22, 27, 21, 41, 20, 39, 3, 54, 6, 41, 300, 333, 28, 40, 28, 120, 62500, -90890, 248027, -3570, 0, 1.01, 0.872640, 7.5, 22.8, 1.01, 0.872640, 6.5, 22.5, 425, 461, 6, 5588, 0), + (15, 'Cleric', 0, 22, 27, 21, 41, 20, 39, 3, 54, 6, 41, 300, 333, 28, 40, 28, 120, 62500, -90890, 248027, -3570, 0, 1.01, 0.872640, 7.5, 22.8, 1.01, 0.872640, 6.5, 22.5, 425, 461, 6, 5588, 0), + (16, 'Bishop', 0, 22, 27, 21, 41, 20, 39, 3, 54, 6, 41, 300, 333, 28, 40, 28, 120, 62500, -90890, 248027, -3570, 0, 1.01, 0.872640, 7.5, 22.8, 1.01, 0.872640, 6.5, 22.5, 425, 461, 6, 5588, 0), + (17, 'Human Prophet', 0, 22, 27, 21, 41, 20, 39, 3, 54, 6, 41, 300, 333, 28, 40, 28, 120, 62500, -90890, 248027, -3570, 0, 1.01, 0.872640, 7.5, 22.8, 1.01, 0.872640, 6.5, 22.5, 425, 461, 6, 5588, 0), + (18, 'Elf Fighter', 1, 36, 36, 35, 23, 14, 26, 4, 80, 6, 41, 300, 333, 36, 46, 36, 125, 73000, 45978, 41196, -3440, 0, 1.15, 1.242000, 7.5, 24.0, 1.15, 1.242000, 7.5, 23.0, 1147, 1146, 10, 2369, 5588), + (19, 'Elf Knight', 1, 36, 36, 35, 23, 14, 26, 4, 80, 6, 41, 300, 333, 36, 46, 36, 125, 73000, 45978, 41196, -3440, 0, 1.15, 1.242000, 7.5, 24.0, 1.15, 1.242000, 7.5, 23.0, 1147, 1146, 10, 2369, 5588), + (20, 'Temple Knight', 1, 36, 36, 35, 23, 14, 26, 4, 80, 6, 41, 300, 333, 36, 46, 36, 125, 73000, 45978, 41196, -3440, 0, 1.15, 1.242000, 7.5, 24.0, 1.15, 1.242000, 7.5, 23.0, 1147, 1146, 10, 2369, 5588), + (21, 'Swordsinger', 1, 36, 36, 35, 23, 14, 26, 4, 80, 6, 41, 300, 333, 36, 46, 36, 125, 73000, 45978, 41196, -3440, 0, 1.15, 1.242000, 7.5, 24.0, 1.15, 1.242000, 7.5, 23.0, 1147, 1146, 10, 2369, 5588), + (22, 'Scout', 1, 36, 36, 35, 23, 14, 26, 4, 80, 6, 41, 300, 333, 36, 46, 36, 125, 73000, 45978, 41196, -3440, 0, 1.15, 1.242000, 7.5, 24.0, 1.15, 1.242000, 7.5, 23.0, 1147, 1146, 10, 2369, 5588), + (23, 'Plains Walker', 1, 36, 36, 35, 23, 14, 26, 4, 80, 6, 41, 300, 333, 36, 46, 36, 125, 73000, 45978, 41196, -3440, 0, 1.15, 1.242000, 7.5, 24.0, 1.15, 1.242000, 7.5, 23.0, 1147, 1146, 10, 2369, 5588), + (24, 'Silver Ranger', 1, 36, 36, 35, 23, 14, 26, 4, 80, 6, 41, 300, 333, 36, 46, 36, 125, 73000, 45978, 41196, -3440, 0, 1.15, 1.242000, 7.5, 24.0, 1.15, 1.242000, 7.5, 23.0, 1147, 1146, 10, 2369, 5588), + (25, 'Elf Mage', 1, 21, 25, 24, 37, 23, 40, 3, 54, 6, 41, 300, 333, 30, 41, 30, 122, 62400, 46182, 41198, -3440, 0, 1.04, 0.898560, 7.5, 24.0, 1.04, 0.898560, 7.5, 23.0, 425, 461, 6, 5588, 0), + (26, 'Elf Wizard', 1, 21, 25, 24, 37, 23, 40, 3, 54, 6, 41, 300, 333, 30, 41, 30, 122, 62400, 46182, 41198, -3440, 0, 1.04, 0.898560, 7.5, 24.0, 1.04, 0.898560, 7.5, 23.0, 425, 461, 6, 5588, 0), + (27, 'Spellsinger', 1, 21, 25, 24, 37, 23, 40, 3, 54, 6, 41, 300, 333, 30, 41, 30, 122, 62400, 46182, 41198, -3440, 0, 1.04, 0.898560, 7.5, 24.0, 1.04, 0.898560, 7.5, 23.0, 425, 461, 6, 5588, 0), + (28, 'Elemental Summoner', 1, 21, 25, 24, 37, 23, 40, 3, 54, 6, 41, 300, 333, 30, 41, 30, 122, 62400, 46182, 41198, -3440, 0, 1.04, 0.898560, 7.5, 24.0, 1.04, 0.898560, 7.5, 23.0, 425, 461, 6, 5588, 0), + (29, 'Oracle', 1, 21, 25, 24, 37, 23, 40, 3, 54, 6, 41, 300, 333, 30, 41, 30, 122, 62400, 46182, 41198, -3440, 0, 1.04, 0.898560, 7.5, 24.0, 1.04, 0.898560, 7.5, 23.0, 425, 461, 6, 5588, 0), + (30, 'Elder', 1, 21, 25, 24, 37, 23, 40, 3, 54, 6, 41, 300, 333, 30, 41, 30, 122, 62400, 46182, 41198, -3440, 0, 1.04, 0.898560, 7.5, 24.0, 1.04, 0.898560, 7.5, 23.0, 425, 461, 6, 5588, 0), + (31, 'DE Fighter', 2, 41, 32, 34, 25, 12, 26, 4, 80, 6, 41, 300, 333, 35, 45, 35, 122, 69000, 28377, 10916, -4224, 0, 1.14, 1.231200, 7.5, 24.0, 1.14, 1.231200, 7.0, 23.5, 1147, 1146, 10, 2369, 5588), + (32, 'Palus Knight', 2, 41, 32, 34, 25, 12, 26, 4, 80, 6, 41, 300, 333, 35, 45, 35, 122, 69000, 28377, 10916, -4224, 0, 1.14, 1.231200, 7.5, 24.0, 1.14, 1.231200, 7.0, 23.5, 1147, 1146, 10, 2369, 5588), + (33, 'Shillien Knight', 2, 41, 32, 34, 25, 12, 26, 4, 80, 6, 41, 300, 333, 35, 45, 35, 122, 69000, 28377, 10916, -4224, 0, 1.14, 1.231200, 7.5, 24.0, 1.14, 1.231200, 7.0, 23.5, 1147, 1146, 10, 2369, 5588), + (34, 'Bladedancer', 2, 41, 32, 34, 25, 12, 26, 4, 80, 6, 41, 300, 333, 35, 45, 35, 122, 69000, 28377, 10916, -4224, 0, 1.14, 1.231200, 7.5, 24.0, 1.14, 1.231200, 7.0, 23.5, 1147, 1146, 10, 2369, 5588), + (35, 'Assassin', 2, 41, 32, 34, 25, 12, 26, 4, 80, 6, 41, 300, 333, 35, 45, 35, 122, 69000, 28377, 10916, -4224, 0, 1.14, 1.231200, 7.5, 24.0, 1.14, 1.231200, 7.0, 23.5, 1147, 1146, 10, 2369, 5588), + (36, 'Abyss Walker', 2, 41, 32, 34, 25, 12, 26, 4, 80, 6, 41, 300, 333, 35, 45, 35, 122, 69000, 28377, 10916, -4224, 0, 1.14, 1.231200, 7.5, 24.0, 1.14, 1.231200, 7.0, 23.5, 1147, 1146, 10, 2369, 5588), + (37, 'Phantom Ranger', 2, 41, 32, 34, 25, 12, 26, 4, 80, 6, 41, 300, 333, 35, 45, 35, 122, 69000, 28377, 10916, -4224, 0, 1.14, 1.231200, 7.5, 24.0, 1.14, 1.231200, 7.0, 23.5, 1147, 1146, 10, 2369, 5588), + (38, 'DE Mage', 2, 23, 24, 23, 44, 19, 37, 3, 54, 6, 41, 300, 333, 29, 41, 29, 122, 61000, 28295, 11063, -4224, 0, 1.14, 1.231200, 7.5, 24.0, 1.03, 0.889920, 7.0, 23.5, 425, 461, 6, 5588, 0), + (39, 'DE Wizard', 2, 23, 24, 23, 44, 19, 37, 3, 54, 6, 41, 300, 333, 29, 41, 29, 122, 61000, 28295, 11063, -4224, 0, 1.14, 1.231200, 7.5, 24.0, 1.03, 0.889920, 7.0, 23.5, 425, 461, 6, 5588, 0), + (40, 'Spell Howler', 2, 23, 24, 23, 44, 19, 37, 3, 54, 6, 41, 300, 333, 29, 41, 29, 122, 61000, 28295, 11063, -4224, 0, 1.14, 1.231200, 7.5, 24.0, 1.03, 0.889920, 7.0, 23.5, 425, 461, 6, 5588, 0), + (41, 'Phantom Summoner', 2, 23, 24, 23, 44, 19, 37, 3, 54, 6, 41, 300, 333, 29, 41, 29, 122, 61000, 28295, 11063, -4224, 0, 1.14, 1.231200, 7.5, 24.0, 1.03, 0.889920, 7.0, 23.5, 425, 461, 6, 5588, 0), + (42, 'Shillien Oracle', 2, 23, 24, 23, 44, 19, 37, 3, 54, 6, 41, 300, 333, 29, 41, 29, 122, 61000, 28295, 11063, -4224, 0, 1.14, 1.231200, 7.5, 24.0, 1.03, 0.889920, 7.0, 23.5, 425, 461, 6, 5588, 0), + (43, 'Shillien Elder', 2, 23, 24, 23, 44, 19, 37, 3, 54, 6, 41, 300, 333, 29, 41, 29, 122, 61000, 28295, 11063, -4224, 0, 1.14, 1.231200, 7.5, 24.0, 1.03, 0.889920, 7.0, 23.5, 425, 461, 6, 5588, 0), + (44, 'Orc Fighter', 3, 40, 47, 26, 18, 12, 27, 4, 80, 6, 41, 300, 333, 31, 42, 31, 117, 87000, -56693, -113610, -690, 0, 1.06, 1.144800, 11.0, 28.0, 1.06, 1.144800, 7.0, 27.0, 1147, 1146, 2368, 2369, 5588), + (45, 'Raider', 3, 40, 47, 26, 18, 12, 27, 4, 80, 6, 41, 300, 333, 31, 42, 31, 117, 87000, -56693, -113610, -690, 0, 1.06, 1.144800, 11.0, 28.0, 1.06, 1.144800, 7.0, 27.0, 1147, 1146, 2368, 2369, 5588), + (46, 'Destroyer', 3, 40, 47, 26, 18, 12, 27, 4, 80, 6, 41, 300, 333, 31, 42, 31, 117, 87000, -56693, -113610, -690, 0, 1.06, 1.144800, 11.0, 28.0, 1.06, 1.144800, 7.0, 27.0, 1147, 1146, 2368, 2369, 5588), + (47, 'Monk', 3, 40, 47, 26, 18, 12, 27, 4, 80, 6, 41, 300, 333, 31, 42, 31, 117, 87000, -56682, -113610, -690, 0, 1.06, 1.144800, 11.0, 28.0, 1.06, 1.144800, 7.0, 27.0, 1147, 1146, 2368, 2369, 5588), + (48, 'Tyrant', 3, 40, 47, 26, 18, 12, 27, 4, 80, 6, 41, 300, 333, 31, 42, 31, 117, 87000, -56693, -113610, -690, 0, 1.06, 1.144800, 11.0, 28.0, 1.06, 1.144800, 7.0, 27.0, 1147, 1146, 2368, 2369, 5588), + (49, 'Orc Mage', 3, 27, 31, 24, 31, 15, 42, 3, 54, 6, 41, 300, 333, 30, 41, 30, 121, 68000, -56682, -113730, -690, 0, 1.04, 0.898560, 7.0, 27.5, 1.04, 0.898560, 8.0, 25.5, 425, 461, 2368, 5588, 0), + (50, 'Shaman', 3, 27, 31, 24, 31, 15, 42, 3, 54, 6, 41, 300, 333, 30, 41, 30, 121, 68000, -56682, -113730, -690, 0, 1.04, 0.898560, 7.0, 27.5, 1.04, 0.898560, 8.0, 25.5, 425, 461, 2368, 5588, 0), + (51, 'Overlord', 3, 27, 31, 24, 31, 15, 42, 3, 54, 6, 41, 300, 333, 30, 41, 30, 121, 68000, -56682, -113730, -690, 0, 1.04, 0.898560, 7.0, 27.5, 1.04, 0.898560, 8.0, 25.5, 425, 461, 2368, 5588, 0), + (52, 'Warcryer', 3, 27, 31, 24, 31, 15, 42, 3, 54, 6, 41, 300, 333, 30, 41, 30, 121, 68000, -56682, -113730, -690, 0, 1.04, 0.898560, 7.0, 27.5, 1.04, 0.898560, 8.0, 25.5, 425, 461, 2368, 5588, 0), + (53, 'Dwarf Fighter', 4, 39, 45, 29, 20, 10, 27, 4, 80, 6, 41, 300, 333, 33, 43, 33, 115, 83000, 108512, -174026, -400, 1, 1.09, 1.487196, 9.0, 18.0, 1.09, 1.487196, 5.0, 19.0, 1147, 1146, 10, 2370, 5588), + (54, 'Scavenger', 4, 39, 45, 29, 20, 10, 27, 4, 80, 6, 41, 300, 333, 33, 43, 33, 115, 83000, 108512, -174026, -400, 1, 1.09, 1.487196, 9.0, 18.0, 1.09, 1.487196, 5.0, 19.0, 1147, 1146, 10, 2370, 5588), + (55, 'Bounty Hunter', 4, 39, 45, 29, 20, 10, 27, 4, 80, 6, 41, 300, 333, 33, 43, 33, 115, 83000, 108512, -174026, -400, 1, 1.09, 1.487196, 9.0, 18.0, 1.09, 1.487196, 5.0, 19.0, 1147, 1146, 10, 2370, 5588), + (56, 'Artisan', 4, 39, 45, 29, 20, 10, 27, 4, 80, 6, 41, 300, 333, 33, 43, 33, 115, 83000, 108512, -174026, -400, 1, 1.09, 1.487196, 9.0, 18.0, 1.09, 1.487196, 5.0, 19.0, 1147, 1146, 10, 2370, 5588), + (57, 'Warsmith', 4, 39, 45, 29, 20, 10, 27, 4, 80, 6, 41, 300, 333, 33, 43, 33, 115, 83000, 108512, -174026, -400, 1, 1.09, 1.487196, 9.0, 18.0, 1.09, 1.487196, 5.0, 19.0, 1147, 1146, 10, 2370, 5588), + (88, 'Duelist', 0, 40, 43, 30, 21, 11, 25, 4, 80, 6, 41, 300, 333, 33, 44, 33, 115, 81900, -71338, 258271, -3104, 0, 1.10, 1.188000, 9.0, 23.0, 1.10, 1.188000, 8.0, 23.5, 1147, 1146, 10, 2369, 5588), + (89, 'DreadNought', 0, 40, 43, 30, 21, 11, 25, 4, 80, 6, 41, 300, 333, 33, 44, 33, 115, 81900, -71338, 258271, -3104, 0, 1.10, 1.188000, 9.0, 23.0, 1.10, 1.188000, 8.0, 23.5, 1147, 1146, 10, 2369, 5588), + (90, 'Phoenix Knight', 0, 40, 43, 30, 21, 11, 25, 4, 80, 6, 41, 300, 333, 33, 44, 33, 115, 81900, -71338, 258271, -3104, 0, 1.10, 1.188000, 9.0, 23.0, 1.10, 1.188000, 8.0, 23.5, 1147, 1146, 10, 2369, 5588), + (91, 'Hell Knight', 0, 40, 43, 30, 21, 11, 25, 4, 80, 6, 41, 300, 333, 33, 44, 33, 115, 81900, -71338, 258271, -3104, 0, 1.10, 1.188000, 9.0, 23.0, 1.10, 1.188000, 8.0, 23.5, 1147, 1146, 10, 2369, 5588), + (92, 'Sagittarius', 0, 40, 43, 30, 21, 11, 25, 4, 80, 6, 41, 300, 333, 33, 44, 33, 115, 81900, -71338, 258271, -3104, 0, 1.10, 1.188000, 9.0, 23.0, 1.10, 1.188000, 8.0, 23.5, 1147, 1146, 10, 2369, 5588), + (93, 'Adventurer', 0, 40, 43, 30, 21, 11, 25, 4, 80, 6, 41, 300, 333, 33, 44, 33, 115, 81900, -71338, 258271, -3104, 0, 1.10, 1.188000, 9.0, 23.0, 1.10, 1.188000, 8.0, 23.5, 1147, 1146, 10, 2369, 5588), + (94, 'Archmage', 0, 22, 27, 21, 41, 20, 39, 3, 54, 6, 41, 300, 333, 28, 40, 28, 120, 62500, -90890, 248027, -3570, 0, 1.01, 0.872640, 7.5, 22.8, 1.01, 0.872640, 6.5, 22.5, 425, 461, 6, 5588, 0), + (95, 'Soultaker', 0, 22, 27, 21, 41, 20, 39, 3, 54, 6, 41, 300, 333, 28, 40, 28, 120, 62500, -90890, 248027, -3570, 0, 1.01, 0.872640, 7.5, 22.8, 1.01, 0.872640, 6.5, 22.5, 425, 461, 6, 5588, 0), + (96, 'Arcana Lord', 0, 22, 27, 21, 41, 20, 39, 3, 54, 6, 41, 300, 333, 28, 40, 28, 120, 62500, -90890, 248027, -3570, 0, 1.01, 0.872640, 7.5, 22.8, 1.01, 0.872640, 6.5, 22.5, 425, 461, 6, 5588, 0), + (97, 'Cardinal', 0, 22, 27, 21, 41, 20, 39, 3, 54, 6, 41, 300, 333, 28, 40, 28, 120, 62500, -90890, 248027, -3570, 0, 1.01, 0.872640, 7.5, 22.8, 1.01, 0.872640, 6.5, 22.5, 425, 461, 6, 5588, 0), + (98, 'Hierophant', 0, 22, 27, 21, 41, 20, 39, 3, 54, 6, 41, 300, 333, 28, 40, 28, 120, 62500, -90890, 248027, -3570, 0, 1.01, 0.872640, 7.5, 22.8, 1.01, 0.872640, 6.5, 22.5, 425, 461, 6, 5588, 0), + (99, 'Eva Templar', 1, 36, 36, 35, 23, 14, 26, 4, 80, 6, 41, 300, 333, 36, 46, 36, 125, 73000, 45978, 41196, -3440, 0, 1.15, 1.242000, 7.5, 24.0, 1.15, 1.242000, 7.5, 23.0, 1147, 1146, 10, 2369, 5588), + (100, 'Sword Muse', 1, 36, 36, 35, 23, 14, 26, 4, 80, 6, 41, 300, 333, 36, 46, 36, 125, 73000, 45978, 41196, -3440, 0, 1.15, 1.242000, 7.5, 24.0, 1.15, 1.242000, 7.5, 23.0, 1147, 1146, 10, 2369, 5588), + (101, 'Wind Rider', 1, 36, 36, 35, 23, 14, 26, 4, 80, 6, 41, 300, 333, 36, 46, 36, 125, 73000, 45978, 41196, -3440, 0, 1.15, 1.242000, 7.5, 24.0, 1.15, 1.242000, 7.5, 23.0, 1147, 1146, 10, 2369, 5588), + (102, 'Moonlight Sentinel', 1, 36, 36, 35, 23, 14, 26, 4, 80, 6, 41, 300, 333, 36, 46, 36, 125, 73000, 45978, 41196, -3440, 0, 1.15, 1.242000, 7.5, 24.0, 1.15, 1.242000, 7.5, 23.0, 1147, 1146, 10, 2369, 5588), + (103, 'Mystic Muse', 1, 21, 25, 24, 37, 23, 40, 3, 54, 6, 41, 300, 333, 30, 41, 30, 122, 62400, 46182, 41198, -3440, 0, 1.04, 0.898560, 7.5, 24.0, 1.04, 0.898560, 7.5, 23.0, 425, 461, 6, 5588, 0), + (104, 'Elemental Master', 1, 21, 25, 24, 37, 23, 40, 3, 54, 6, 41, 300, 333, 30, 41, 30, 122, 62400, 46182, 41198, -3440, 0, 1.04, 0.898560, 7.5, 24.0, 1.04, 0.898560, 7.5, 23.0, 425, 461, 6, 5588, 0), + (105, 'Eva Saint', 1, 21, 25, 24, 37, 23, 40, 3, 54, 6, 41, 300, 333, 30, 41, 30, 122, 62400, 46182, 41198, -3440, 0, 1.04, 0.898560, 7.5, 24.0, 1.04, 0.898560, 7.5, 23.0, 425, 461, 6, 5588, 0), + (106, 'Shillien Templar', 2, 41, 32, 34, 25, 12, 26, 4, 80, 6, 41, 300, 333, 35, 45, 35, 122, 69000, 28377, 10916, -4224, 0, 1.14, 1.231200, 7.5, 24.0, 1.14, 1.231200, 7.0, 23.5, 1147, 1146, 10, 2369, 5588), + (107, 'Spectral Dancer', 2, 41, 32, 34, 25, 12, 26, 4, 80, 6, 41, 300, 333, 35, 45, 35, 122, 69000, 28377, 10916, -4224, 0, 1.14, 1.231200, 7.5, 24.0, 1.14, 1.231200, 7.0, 23.5, 1147, 1146, 10, 2369, 5588), + (108, 'Ghost Hunter', 2, 41, 32, 34, 25, 12, 26, 4, 80, 6, 41, 300, 333, 35, 45, 35, 122, 69000, 28377, 10916, -4224, 0, 1.14, 1.231200, 7.5, 24.0, 1.14, 1.231200, 7.0, 23.5, 1147, 1146, 10, 2369, 5588), + (109, 'Ghost Sentinel', 2, 41, 32, 34, 25, 12, 26, 4, 80, 6, 41, 300, 333, 35, 45, 35, 122, 69000, 28377, 10916, -4224, 0, 1.14, 1.231200, 7.5, 24.0, 1.14, 1.231200, 7.0, 23.5, 1147, 1146, 10, 2369, 5588), + (110, 'Storm Screamer', 2, 23, 24, 23, 44, 19, 37, 3, 54, 6, 41, 300, 333, 29, 41, 29, 122, 61000, 28295, 11063, -4224, 0, 1.14, 1.231200, 7.5, 24.0, 1.03, 0.889920, 7.0, 23.5, 425, 461, 6, 5588, 0), + (111, 'Spectral Master', 2, 23, 24, 23, 44, 19, 37, 3, 54, 6, 41, 300, 333, 29, 41, 29, 122, 61000, 28295, 11063, -4224, 0, 1.14, 1.231200, 7.5, 24.0, 1.03, 0.889920, 7.0, 23.5, 425, 461, 6, 5588, 0), + (112, 'Shillen Saint', 2, 23, 24, 23, 44, 19, 37, 3, 54, 6, 41, 300, 333, 29, 41, 29, 122, 61000, 28295, 11063, -4224, 0, 1.14, 1.231200, 7.5, 24.0, 1.03, 0.889920, 7.0, 23.5, 425, 461, 6, 5588, 0), + (113, 'Titan', 3, 40, 47, 26, 18, 12, 27, 4, 80, 6, 41, 300, 333, 31, 42, 31, 117, 87000, -56693, -113610, -690, 0, 1.06, 1.144800, 11.0, 28.0, 1.06, 1.144800, 7.0, 27.0, 1147, 1146, 2368, 2369, 5588), + (114, 'Grand Khauatari', 3, 40, 47, 26, 18, 12, 27, 4, 80, 6, 41, 300, 333, 31, 42, 31, 117, 87000, -56693, -113610, -690, 0, 1.06, 1.144800, 11.0, 28.0, 1.06, 1.144800, 7.0, 27.0, 1147, 1146, 2368, 2369, 5588), + (115, 'Dominator', 3, 27, 31, 24, 31, 15, 42, 3, 54, 6, 41, 300, 333, 30, 41, 30, 121, 68000, -56682, -113730, -690, 0, 1.04, 0.898560, 7.0, 27.5, 1.04, 0.898560, 8.0, 25.5, 425, 461, 2368, 5588, 0), + (116, 'Doomcryer', 3, 27, 31, 24, 31, 15, 42, 3, 54, 6, 41, 300, 333, 30, 41, 30, 121, 68000, -56682, -113730, -690, 0, 1.04, 0.898560, 7.0, 27.5, 1.04, 0.898560, 8.0, 25.5, 425, 461, 2368, 5588, 0), + (117, 'Fortune Seeker', 4, 39, 45, 29, 20, 10, 27, 4, 80, 6, 41, 300, 333, 33, 43, 33, 115, 83000, 108512, -174026, -400, 1, 1.09, 1.487196, 9.0, 18.0, 1.09, 1.487196, 5.0, 19.0, 1147, 1146, 10, 2370, 5588), + (118, 'Maestro', 4, 39, 45, 29, 20, 10, 27, 4, 80, 6, 41, 300, 333, 33, 43, 33, 115, 83000, 108512, -174026, -400, 1, 1.09, 1.487196, 9.0, 18.0, 1.09, 1.487196, 5.0, 19.0, 1147, 1146, 10, 2370, 5588); \ No newline at end of file diff --git a/Datapack/sql/clan_wars.sql b/Datapack/sql/clan_wars.sql index 19b0cb5c..d643722f 100644 --- a/Datapack/sql/clan_wars.sql +++ b/Datapack/sql/clan_wars.sql @@ -7,7 +7,7 @@ CREATE TABLE IF NOT EXISTS `clan_wars` ( `clan2` varchar(35) NOT NULL default '', `wantspeace1` decimal(1,0) NOT NULL default '0', `wantspeace2` decimal(1,0) NOT NULL default '0' -) ENGINE=MyISAM; +); diff --git a/Datapack/sql/clanhall.sql b/Datapack/sql/clanhall.sql index 1d49709f..22594268 100644 --- a/Datapack/sql/clanhall.sql +++ b/Datapack/sql/clanhall.sql @@ -17,47 +17,48 @@ CREATE TABLE IF NOT EXISTS `clanhall` ( -- ---------------------------- -- Records -- ---------------------------- -INSERT IGNORE INTO `clanhall` VALUES ('21','Fortress of Resistance','0','100000','Ol Mahum Fortress of Resistance','Dion','0','0','0'); -INSERT IGNORE INTO `clanhall` VALUES ('22','Moonstone Hall','0','100000','Clan hall located in the Town of Gludio','Gludio','0','2','0'); -INSERT IGNORE INTO `clanhall` VALUES ('23','Onyx Hall','0','100000','Clan hall located in the Town of Gludio','Gludio','0','2','0'); -INSERT IGNORE INTO `clanhall` VALUES ('24','Topaz Hall','0','100000','Clan hall located in the Town of Gludio','Gludio','0','2','0'); -INSERT IGNORE INTO `clanhall` VALUES ('25','Ruby Hall','0','100000','Clan hall located in the Town of Gludio','Gludio','0','2','0'); -INSERT IGNORE INTO `clanhall` VALUES ('26','Crystal Hall','0','100000','Clan hall located in Gludin Village','Gludin','0','2','0'); -INSERT IGNORE INTO `clanhall` VALUES ('27','Onyx Hall','0','100000','Clan hall located in Gludin Village','Gludin','0','2','0'); -INSERT IGNORE INTO `clanhall` VALUES ('28','Sapphire Hall','0','100000','Clan hall located in Gludin Village','Gludin','0','2','0'); -INSERT IGNORE INTO `clanhall` VALUES ('29','Moonstone Hall','0','100000','Clan hall located in Gludin Village','Gludin','0','2','0'); -INSERT IGNORE INTO `clanhall` VALUES ('30','Emerald Hall','0','100000','Clan hall located in Gludin Village','Gludin','0','2','0'); -INSERT IGNORE INTO `clanhall` VALUES ('31','The Atramental Barracks','0','100000','Clan hall located in the Town of Dion','Dion','0','1','0'); -INSERT IGNORE INTO `clanhall` VALUES ('32','The Scarlet Barracks','0','100000','Clan hall located in the Town of Dion','Dion','0','1','0'); -INSERT IGNORE INTO `clanhall` VALUES ('33','The Viridian Barracks','0','100000','Clan hall located in the Town of Dion','Dion','0','1','0'); -INSERT IGNORE INTO `clanhall` VALUES ('34','Devastated Castle','0','100000','Contestable Clan Hall','Aden','0','0','0'); -INSERT IGNORE INTO `clanhall` VALUES ('35','Bandit Stronghold','0','100000','Contestable Clan Hall','Oren','0','0','0'); -INSERT IGNORE INTO `clanhall` VALUES ('36','The Golden Chamber','0','100000','Clan hall located in the Town of Aden','Aden','0','3','0'); -INSERT IGNORE INTO `clanhall` VALUES ('37','The Silver Chamber','0','100000','Clan hall located in the Town of Aden','Aden','0','3','0'); -INSERT IGNORE INTO `clanhall` VALUES ('38','The Mithril Chamber','0','100000','Clan hall located in the Town of Aden','Aden','0','3','0'); -INSERT IGNORE INTO `clanhall` VALUES ('39','Silver Manor','0','100000','Clan hall located in the Town of Aden','Aden','0','3','0'); -INSERT IGNORE INTO `clanhall` VALUES ('40','Gold Manor','0','100000','Clan hall located in the Town of Aden','Aden','0','3','0'); -INSERT IGNORE INTO `clanhall` VALUES ('41','The Bronze Chamber','0','100000','Clan hall located in the Town of Aden','Aden','0','3','0'); -INSERT IGNORE INTO `clanhall` VALUES ('42','The Golden Chamber','0','100000','Clan hall located in the Town of Giran','Giran','0','3','0'); -INSERT IGNORE INTO `clanhall` VALUES ('43','The Silver Chamber','0','100000','Clan hall located in the Town of Giran','Giran','0','3','0'); -INSERT IGNORE INTO `clanhall` VALUES ('44','The Mithril Chamber','0','100000','Clan hall located in the Town of Giran','Giran','0','3','0'); -INSERT IGNORE INTO `clanhall` VALUES ('45','The Bronze Chamber','0','100000','Clan hall located in the Town of Giran','Giran','0','3','0'); -INSERT IGNORE INTO `clanhall` VALUES ('46','Silver Manor','0','100000','Clan hall located in the Town of Giran','Giran','0','3','0'); -INSERT IGNORE INTO `clanhall` VALUES ('47','Moonstone Hall','0','100000','Clan hall located in the Town of Goddard','Goddard','0','3','0'); -INSERT IGNORE INTO `clanhall` VALUES ('48','Onyx Hall','0','100000','Clan hall located in the Town of Goddard','Goddard','0','3','0'); -INSERT IGNORE INTO `clanhall` VALUES ('49','Emerald Hall','0','100000','Clan hall located in the Town of Goddard','Goddard','0','3','0'); -INSERT IGNORE INTO `clanhall` VALUES ('50','Sapphire Hall','0','100000','Clan hall located in the Town of Goddard','Goddard','0','3','0'); -INSERT IGNORE INTO `clanhall` VALUES ('51','Mont Chamber','0','100000','An upscale Clan hall located in the Rune Township','Rune','0','3','0'); -INSERT IGNORE INTO `clanhall` VALUES ('52','Astaire Chamber','0','100000','An upscale Clan hall located in the Rune Township','Rune','0','3','0'); -INSERT IGNORE INTO `clanhall` VALUES ('53','Aria Chamber','0','100000','An upscale Clan hall located in the Rune Township','Rune','0','3','0'); -INSERT IGNORE INTO `clanhall` VALUES ('54','Yiana Chamber','0','100000','An upscale Clan hall located in the Rune Township','Rune','0','3','0'); -INSERT IGNORE INTO `clanhall` VALUES ('55','Roien Chamber','0','100000','An upscale Clan hall located in the Rune Township','Rune','0','3','0'); -INSERT IGNORE INTO `clanhall` VALUES ('56','Luna Chamber','0','100000','An upscale Clan hall located in the Rune Township','Rune','0','3','0'); -INSERT IGNORE INTO `clanhall` VALUES ('57','Traban Chamber','0','100000','An upscale Clan hall located in the Rune Township','Rune','0','3','0'); -INSERT IGNORE INTO `clanhall` VALUES ('58','Eisen Hall','0','100000','Clan hall located in the Town of Schuttgart','Schuttgart','0','2','0'); -INSERT IGNORE INTO `clanhall` VALUES ('59','Heavy Metal Hall','0','100000','Clan hall located in the Town of Schuttgart','Schuttgart','0','2','0'); -INSERT IGNORE INTO `clanhall` VALUES ('60','Molten Ore Hall','0','100000','Clan hall located in the Town of Schuttgart','Schuttgart','0','2','0'); -INSERT IGNORE INTO `clanhall` VALUES ('61','Titan Hall','0','100000','Clan hall located in the Town of Schuttgart','Schuttgart','0','2','0'); -INSERT IGNORE INTO `clanhall` VALUES ('62','Rainbow Springs','0','100000','','Goddard','0','0','0'); -INSERT IGNORE INTO `clanhall` VALUES ('63','Beast Farm','0','100000','','Rune','0','0','0'); -INSERT IGNORE INTO `clanhall` VALUES ('64','Fortress of the Dead','0','100000','','Rune','0','0','0'); \ No newline at end of file +INSERT IGNORE INTO `clanhall` VALUE + ('21','Fortress of Resistance','0','100000','Ol Mahum Fortress of Resistance','Dion','0','0','0'), +('22','Moonstone Hall','0','100000','Clan hall located in the Town of Gludio','Gludio','0','2','0'), +('23','Onyx Hall','0','100000','Clan hall located in the Town of Gludio','Gludio','0','2','0'), +('24','Topaz Hall','0','100000','Clan hall located in the Town of Gludio','Gludio','0','2','0'), +('25','Ruby Hall','0','100000','Clan hall located in the Town of Gludio','Gludio','0','2','0'), +('26','Crystal Hall','0','100000','Clan hall located in Gludin Village','Gludin','0','2','0'), +('27','Onyx Hall','0','100000','Clan hall located in Gludin Village','Gludin','0','2','0'), +('28','Sapphire Hall','0','100000','Clan hall located in Gludin Village','Gludin','0','2','0'), +('29','Moonstone Hall','0','100000','Clan hall located in Gludin Village','Gludin','0','2','0'), +('30','Emerald Hall','0','100000','Clan hall located in Gludin Village','Gludin','0','2','0'), +('31','The Atramental Barracks','0','100000','Clan hall located in the Town of Dion','Dion','0','1','0'), +('32','The Scarlet Barracks','0','100000','Clan hall located in the Town of Dion','Dion','0','1','0'), +('33','The Viridian Barracks','0','100000','Clan hall located in the Town of Dion','Dion','0','1','0'), +('34','Devastated Castle','0','100000','Contestable Clan Hall','Aden','0','0','0'), +('35','Bandit Stronghold','0','100000','Contestable Clan Hall','Oren','0','0','0'), +('36','The Golden Chamber','0','100000','Clan hall located in the Town of Aden','Aden','0','3','0'), +('37','The Silver Chamber','0','100000','Clan hall located in the Town of Aden','Aden','0','3','0'), +('38','The Mithril Chamber','0','100000','Clan hall located in the Town of Aden','Aden','0','3','0'), +('39','Silver Manor','0','100000','Clan hall located in the Town of Aden','Aden','0','3','0'), +('40','Gold Manor','0','100000','Clan hall located in the Town of Aden','Aden','0','3','0'), +('41','The Bronze Chamber','0','100000','Clan hall located in the Town of Aden','Aden','0','3','0'), +('42','The Golden Chamber','0','100000','Clan hall located in the Town of Giran','Giran','0','3','0'), +('43','The Silver Chamber','0','100000','Clan hall located in the Town of Giran','Giran','0','3','0'), +('44','The Mithril Chamber','0','100000','Clan hall located in the Town of Giran','Giran','0','3','0'), +('45','The Bronze Chamber','0','100000','Clan hall located in the Town of Giran','Giran','0','3','0'), +('46','Silver Manor','0','100000','Clan hall located in the Town of Giran','Giran','0','3','0'), +('47','Moonstone Hall','0','100000','Clan hall located in the Town of Goddard','Goddard','0','3','0'), +('48','Onyx Hall','0','100000','Clan hall located in the Town of Goddard','Goddard','0','3','0'), +('49','Emerald Hall','0','100000','Clan hall located in the Town of Goddard','Goddard','0','3','0'), +('50','Sapphire Hall','0','100000','Clan hall located in the Town of Goddard','Goddard','0','3','0'), +('51','Mont Chamber','0','100000','An upscale Clan hall located in the Rune Township','Rune','0','3','0'), +('52','Astaire Chamber','0','100000','An upscale Clan hall located in the Rune Township','Rune','0','3','0'), +('53','Aria Chamber','0','100000','An upscale Clan hall located in the Rune Township','Rune','0','3','0'), +('54','Yiana Chamber','0','100000','An upscale Clan hall located in the Rune Township','Rune','0','3','0'), +('55','Roien Chamber','0','100000','An upscale Clan hall located in the Rune Township','Rune','0','3','0'), +('56','Luna Chamber','0','100000','An upscale Clan hall located in the Rune Township','Rune','0','3','0'), +('57','Traban Chamber','0','100000','An upscale Clan hall located in the Rune Township','Rune','0','3','0'), +('58','Eisen Hall','0','100000','Clan hall located in the Town of Schuttgart','Schuttgart','0','2','0'), +('59','Heavy Metal Hall','0','100000','Clan hall located in the Town of Schuttgart','Schuttgart','0','2','0'), +('60','Molten Ore Hall','0','100000','Clan hall located in the Town of Schuttgart','Schuttgart','0','2','0'), +('61','Titan Hall','0','100000','Clan hall located in the Town of Schuttgart','Schuttgart','0','2','0'), +('62','Rainbow Springs','0','100000','','Goddard','0','0','0'), +('63','Beast Farm','0','100000','','Rune','0','0','0'), +('64','Fortress of the Dead','0','100000','','Rune','0','0','0'); \ No newline at end of file diff --git a/Datapack/sql/class_list.sql b/Datapack/sql/class_list.sql index e5b7d867..a3deb472 100644 --- a/Datapack/sql/class_list.sql +++ b/Datapack/sql/class_list.sql @@ -7,7 +7,7 @@ CREATE TABLE `class_list` ( `id` int(10) unsigned NOT NULL default '0', `parent_id` int(11) NOT NULL default '0', PRIMARY KEY (`id`) -) ENGINE=MyISAM; +); #---------------------------- # Records for table class_list #---------------------------- diff --git a/Datapack/sql/cursed_weapons.sql b/Datapack/sql/cursed_weapons.sql index 9cf74777..0db0082b 100644 --- a/Datapack/sql/cursed_weapons.sql +++ b/Datapack/sql/cursed_weapons.sql @@ -9,4 +9,4 @@ CREATE TABLE IF NOT EXISTS `cursed_weapons` ( `nbKills` INT DEFAULT 0, `endTime` DECIMAL(20,0) DEFAULT 0, PRIMARY KEY (`itemId`) -) ENGINE=MyISAM; +); diff --git a/Datapack/sql/dimensional_rift.sql b/Datapack/sql/dimensional_rift.sql index 1c2b01ea..0fe17c64 100644 --- a/Datapack/sql/dimensional_rift.sql +++ b/Datapack/sql/dimensional_rift.sql @@ -16,7 +16,7 @@ CREATE TABLE `dimensional_rift` ( `zT` int(11) NOT NULL, `boss` tinyint(1) NOT NULL default '0', PRIMARY KEY (`type`,`room_id`) -) DEFAULT CHARSET=utf8; +); -- ---------------------------- -- Records for table dimensional_rift diff --git a/Datapack/sql/droplist.sql b/Datapack/sql/droplist.sql index aaf0a7d8..8d22d3d0 100644 --- a/Datapack/sql/droplist.sql +++ b/Datapack/sql/droplist.sql @@ -32,7 +32,7 @@ CREATE TABLE `droplist` ( `chance` INT NOT NULL DEFAULT '0', PRIMARY KEY (`mobId`,`itemId`,`category`), KEY `key_mobId` (`mobId`) -) ENGINE=MyISAM; +); -- -- Dumping data for table `droplist` diff --git a/Datapack/sql/enchant_skill_trees.sql b/Datapack/sql/enchant_skill_trees.sql index 4bd6c9d3..b239def1 100644 --- a/Datapack/sql/enchant_skill_trees.sql +++ b/Datapack/sql/enchant_skill_trees.sql @@ -12,7 +12,7 @@ CREATE TABLE `enchant_skill_trees` ( `success_rate77` int(3) NOT NULL default '0', `success_rate78` int(3) NOT NULL default '0', PRIMARY KEY (`skill_id`,`level`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1; +); INSERT INTO enchant_skill_trees VALUES diff --git a/Datapack/sql/etcitem.sql b/Datapack/sql/etcitem.sql index 56293a63..d69439b8 100644 --- a/Datapack/sql/etcitem.sql +++ b/Datapack/sql/etcitem.sql @@ -22,7 +22,7 @@ CREATE TABLE `etcitem` ( `oldname` varchar(100) NOT NULL default '', `oldtype` varchar(100) NOT NULL default '', PRIMARY KEY (`item_id`) -) ENGINE=MyISAM; +); -- -- Dumping data for table `etcitem` diff --git a/Datapack/sql/experimental/spawnlist.sql b/Datapack/sql/experimental/spawnlist.sql index 9bde0152..d3fecff3 100644 --- a/Datapack/sql/experimental/spawnlist.sql +++ b/Datapack/sql/experimental/spawnlist.sql @@ -19,7 +19,7 @@ CREATE TABLE `spawnlist` ( `periodOfDay` decimal(2,0) default '0', PRIMARY KEY (id), KEY `key_npc_templateid` (`npc_templateid`) -) ENGINE=MyISAM; +) ; -- -- Dumping data for table `spawnlist` diff --git a/Datapack/sql/fish.sql b/Datapack/sql/fish.sql index 7b7821fd..d4a9468f 100644 --- a/Datapack/sql/fish.sql +++ b/Datapack/sql/fish.sql @@ -15,7 +15,7 @@ CREATE TABLE `fish` ( `wait_time` INT(5) NOT NULL default '0', `combat_time` INT(5) NOT NULL default '0', PRIMARY KEY (`id`,`level`) -) ENGINE=MyISAM; +); -- -- Records for table fish -- diff --git a/Datapack/sql/fishing_skill_trees.sql b/Datapack/sql/fishing_skill_trees.sql index 4bebd694..fbbefc7e 100644 --- a/Datapack/sql/fishing_skill_trees.sql +++ b/Datapack/sql/fishing_skill_trees.sql @@ -12,7 +12,7 @@ CREATE TABLE IF NOT EXISTS `fishing_skill_trees` ( `cost` int(10) NOT NULL default '0', `isfordwarf` int(1) NOT NULL default '0', PRIMARY KEY (`skill_id`,`level`) -) ENGINE=MyISAM; +); -- -- Records for table fishing_skill_trees -- diff --git a/Datapack/sql/forums.sql b/Datapack/sql/forums.sql index 88d0ea0b..88d0d2fe 100644 --- a/Datapack/sql/forums.sql +++ b/Datapack/sql/forums.sql @@ -13,7 +13,8 @@ CREATE TABLE IF NOT EXISTS `forums` ( ); -INSERT IGNORE INTO `forums` VALUES (1, 'NormalRoot', 0, 0, 0, 1, 0); -INSERT IGNORE INTO `forums` VALUES (2, 'ClanRoot', 0, 0, 0, 0, 0); -INSERT IGNORE INTO `forums` VALUES (3, 'MemoRoot', 0, 0, 0, 0, 0); -INSERT IGNORE INTO `forums` VALUES (4, 'MailRoot', 0, 0, 0, 0, 0); +INSERT IGNORE INTO `forums` VALUES + (1, 'NormalRoot', 0, 0, 0, 1, 0), + (2, 'ClanRoot', 0, 0, 0, 0, 0), + (3, 'MemoRoot', 0, 0, 0, 0, 0), + (4, 'MailRoot', 0, 0, 0, 0, 0); diff --git a/Datapack/sql/helper_buff_list.sql b/Datapack/sql/helper_buff_list.sql index be3a4f7f..dddb4aac 100644 --- a/Datapack/sql/helper_buff_list.sql +++ b/Datapack/sql/helper_buff_list.sql @@ -31,5 +31,5 @@ insert into helper_buff_list values (10, 4328, 'Bless the Soul', 1, 12, 22, 'true'), (11, 4329, 'Acumen', 1, 13, 21, 'true'), (12, 4330, 'Concentration', 1, 14, 20, 'true'), -(13, 4331, 'Empower', 1, 15, 19, 'true'); --- (14, 5182, 'Blessing of Protection', 1, 1, 39, 'false'); -- Keeps you safe from an attack by a chaotic character who is more than 10 levels apart from you. +(13, 4331, 'Empower', 1, 15, 19, 'true'), +(14, 5182, 'Blessing of Protection', 1, 1, 39, 'false'); -- Keeps you safe from an attack by a chaotic character who is more than 10 levels apart from you. diff --git a/Datapack/sql/henna.sql b/Datapack/sql/henna.sql index 3c879532..a0259343 100644 --- a/Datapack/sql/henna.sql +++ b/Datapack/sql/henna.sql @@ -15,7 +15,7 @@ CREATE TABLE henna ( stat_DEX decimal(11,0) default NULL, stat_WIT decimal(11,0) default NULL, PRIMARY KEY (symbol_id) -) ENGINE=MyISAM; +); -- -- Dumping data for table `henna` diff --git a/Datapack/sql/locations.sql b/Datapack/sql/locations.sql index 228877ca..5bcd4dfe 100644 --- a/Datapack/sql/locations.sql +++ b/Datapack/sql/locations.sql @@ -11,7 +11,7 @@ CREATE TABLE `locations` ( `proc` int(3) NOT NULL default '0', PRIMARY KEY (`loc_id`,`loc_x`,`loc_y`), KEY `proc` (`proc`) -) ENGINE=MyISAM; +); -- -- Dumping data for table `locations` diff --git a/Datapack/sql/lvlupgain.sql b/Datapack/sql/lvlupgain.sql index bd04494a..793f6999 100644 --- a/Datapack/sql/lvlupgain.sql +++ b/Datapack/sql/lvlupgain.sql @@ -16,98 +16,98 @@ CREATE TABLE `lvlupgain` ( `defaultmpmod` decimal(4,2) NOT NULL default '0.00', `class_lvl` int(3) NOT NULL default '0', PRIMARY KEY (`classid`) -) ENGINE=MyISAM; +); -- -- Dumping data for table `lvlupgain` -- - -INSERT INTO `lvlupgain` VALUES ('0', '80.0', '11.83', '0.37', '32.0', '4.73', '0.22', '30.0', '5.46', '0.14', '1'); -INSERT INTO `lvlupgain` VALUES ('1', '327.0', '33.00', '0.37', '261.6', '26.40', '0.22', '144.0', '9.90', '0.14', '20'); -INSERT INTO `lvlupgain` VALUES ('2', '1044.0', '49.40', '0.37', '939.6', '44.46', '0.22', '359.1', '19.50', '0.14', '40'); -INSERT INTO `lvlupgain` VALUES ('3', '1044.0', '54.60', '0.37', '835.2', '43.68', '0.22', '359.1', '19.50', '0.14', '40'); -INSERT INTO `lvlupgain` VALUES ('4', '327.0', '29.70', '0.37', '196.2', '17.82', '0.22', '144.0', '9.90', '0.14', '20'); -INSERT INTO `lvlupgain` VALUES ('5', '972.3', '46.80', '0.37', '583.3', '28.08', '0.22', '359.1', '19.50', '0.14', '40'); -INSERT INTO `lvlupgain` VALUES ('6', '972.3', '46.80', '0.37', '583.3', '28.08', '0.22', '359.1', '19.50', '0.14', '40'); -INSERT INTO `lvlupgain` VALUES ('7', '327.0', '27.50', '0.37', '130.8', '11.00', '0.22', '144.0', '9.90', '0.14', '20'); -INSERT INTO `lvlupgain` VALUES ('8', '924.5', '41.60', '0.37', '369.8', '16.64', '0.22', '359.1', '19.50', '0.14', '40'); -INSERT INTO `lvlupgain` VALUES ('9', '924.5', '44.20', '0.37', '647.1', '30.94', '0.22', '359.1', '19.50', '0.14', '40'); -INSERT INTO `lvlupgain` VALUES ('10', '101.0', '15.57', '0.37', '50.5', '7.84', '0.22', '40.0', '7.38', '0.14', '1'); -INSERT INTO `lvlupgain` VALUES ('11', '424.0', '27.60', '0.37', '212.0', '13.85', '0.22', '192.0', '13.30', '0.14', '20'); -INSERT INTO `lvlupgain` VALUES ('12', '1021.5', '45.60', '0.37', '510.7', '22.85', '0.22', '478.8', '26.10', '0.14', '40'); -INSERT INTO `lvlupgain` VALUES ('13', '1021.5', '45.60', '0.37', '510.7', '22.85', '0.22', '478.8', '26.10', '0.14', '40'); -INSERT INTO `lvlupgain` VALUES ('14', '1021.5', '49.50', '0.37', '612.9', '29.74', '0.22', '478.8', '26.10', '0.14', '40'); -INSERT INTO `lvlupgain` VALUES ('15', '424.0', '34.20', '0.37', '212.0', '17.15', '0.22', '192.0', '13.30', '0.14', '20'); -INSERT INTO `lvlupgain` VALUES ('16', '1164.9', '49.50', '0.37', '815.4', '34.68', '0.22', '478.8', '26.10', '0.14', '40'); -INSERT INTO `lvlupgain` VALUES ('17', '1164.9', '53.40', '0.37', '582.4', '26.75', '0.22', '478.8', '26.10', '0.14', '40'); -INSERT INTO `lvlupgain` VALUES ('18', '89.0', '12.74', '0.37', '35.6', '5.00', '0.22', '30.0', '5.46', '0.14', '1'); -INSERT INTO `lvlupgain` VALUES ('19', '355.0', '33.00', '0.37', '177.5', '16.50', '0.22', '144.0', '9.90', '0.14', '20'); -INSERT INTO `lvlupgain` VALUES ('20', '1072.0', '52.00', '0.37', '643.2', '31.20', '0.22', '359.1', '19.50', '0.14', '40'); -INSERT INTO `lvlupgain` VALUES ('21', '1072.0', '54.60', '0.37', '536.0', '27.30', '0.22', '359.1', '19.50', '0.14', '40'); -INSERT INTO `lvlupgain` VALUES ('22', '355.0', '30.80', '0.37', '142.0', '12.32', '0.22', '144.0', '9.90', '0.14', '20'); -INSERT INTO `lvlupgain` VALUES ('23', '1024.2', '46.80', '0.37', '409.6', '18.72', '0.22', '359.1', '19.50', '0.14', '40'); -INSERT INTO `lvlupgain` VALUES ('24', '1024.2', '49.40', '0.37', '512.1', '24.70', '0.22', '359.1', '19.50', '0.14', '40'); -INSERT INTO `lvlupgain` VALUES ('25', '104.0', '15.57', '0.37', '52.0', '7.84', '0.22', '40.0', '7.38', '0.14', '1'); -INSERT INTO `lvlupgain` VALUES ('26', '427.0', '28.70', '0.37', '213.5', '14.40', '0.22', '192.0', '13.30', '0.14', '20'); -INSERT INTO `lvlupgain` VALUES ('27', '1048.4', '48.20', '0.37', '524.2', '24.15', '0.22', '478.8', '26.10', '0.14', '40'); -INSERT INTO `lvlupgain` VALUES ('28', '1048.4', '50.80', '0.37', '629.0', '30.52', '0.22', '478.8', '26.10', '0.14', '40'); -INSERT INTO `lvlupgain` VALUES ('29', '427.0', '35.30', '0.37', '213.5', '17.70', '0.22', '192.0', '13.30', '0.14', '20'); -INSERT INTO `lvlupgain` VALUES ('30', '1191.8', '54.70', '0.37', '595.9', '27.40', '0.22', '478.8', '26.10', '0.14', '40'); -INSERT INTO `lvlupgain` VALUES ('31', '94.0', '13.65', '0.37', '37.6', '5.46', '0.22', '30.0', '5.46', '0.14', '1'); -INSERT INTO `lvlupgain` VALUES ('32', '379.0', '35.20', '0.37', '189.5', '17.60', '0.22', '144.0', '9.90', '0.14', '20'); -INSERT INTO `lvlupgain` VALUES ('33', '1143.8', '54.60', '0.37', '686.2', '32.76', '0.22', '359.1', '19.50', '0.14', '40'); -INSERT INTO `lvlupgain` VALUES ('34', '1143.8', '58.50', '0.37', '571.9', '29.25', '0.22', '359.1', '19.50', '0.14', '40'); -INSERT INTO `lvlupgain` VALUES ('35', '379.0', '33.00', '0.37', '151.6', '13.20', '0.22', '144.0', '9.90', '0.14', '20'); -INSERT INTO `lvlupgain` VALUES ('36', '1096.0', '49.40', '0.37', '438.4', '19.76', '0.22', '359.1', '19.50', '0.14', '40'); -INSERT INTO `lvlupgain` VALUES ('37', '1096.0', '52.00', '0.37', '548.0', '26.00', '0.22', '359.1', '19.50', '0.14', '40'); -INSERT INTO `lvlupgain` VALUES ('38', '106.0', '15.57', '0.37', '53.0', '7.84', '0.22', '40.0', '7.38', '0.14', '1'); -INSERT INTO `lvlupgain` VALUES ('39', '429.0', '29.80', '0.37', '214.5', '14.95', '0.22', '192.0', '13.30', '0.14', '20'); -INSERT INTO `lvlupgain` VALUES ('40', '1074.3', '48.20', '0.37', '537.1', '24.15', '0.22', '478.8', '26.10', '0.14', '40'); -INSERT INTO `lvlupgain` VALUES ('41', '1074.3', '52.10', '0.37', '644.5', '31.30', '0.22', '478.8', '26.10', '0.14', '40'); -INSERT INTO `lvlupgain` VALUES ('42', '429.0', '36.40', '0.37', '214.5', '18.25', '0.22', '192.0', '13.30', '0.14', '20'); -INSERT INTO `lvlupgain` VALUES ('43', '1217.7', '54.70', '0.37', '608.8', '27.40', '0.22', '478.8', '26.10', '0.14', '40'); -INSERT INTO `lvlupgain` VALUES ('44', '80.0', '12.64', '0.37', '40.0', '6.27', '0.22', '30.0', '5.36', '0.14', '1'); -INSERT INTO `lvlupgain` VALUES ('45', '346.0', '35.10', '0.37', '242.2', '24.54', '0.22', '144.0', '9.80', '0.14', '20'); -INSERT INTO `lvlupgain` VALUES ('46', '1110.8', '57.10', '0.37', '777.5', '39.94', '0.22', '359.1', '19.40', '0.14', '40'); -INSERT INTO `lvlupgain` VALUES ('47', '346.0', '32.90', '0.37', '173.0', '16.40', '0.22', '144.0', '9.80', '0.14', '20'); -INSERT INTO `lvlupgain` VALUES ('48', '1063.0', '54.50', '0.37', '531.5', '27.20', '0.22', '359.1', '19.40', '0.14', '40'); -INSERT INTO `lvlupgain` VALUES ('49', '95.0', '15.47', '0.37', '47.5', '7.74', '0.22', '40.0', '7.28', '0.14', '1'); -INSERT INTO `lvlupgain` VALUES ('50', '418.0', '35.20', '0.37', '209.0', '17.60', '0.22', '192.0', '13.20', '0.14', '20'); -INSERT INTO `lvlupgain` VALUES ('51', '1182.8', '53.30', '0.37', '946.2', '42.64', '0.22', '478.8', '26.00', '0.14', '40'); -INSERT INTO `lvlupgain` VALUES ('52', '1182.8', '53.30', '0.37', '591.4', '26.65', '0.22', '478.8', '26.00', '0.14', '40'); -INSERT INTO `lvlupgain` VALUES ('53', '80.0', '12.64', '0.37', '56.0', '8.82', '0.22', '30.0', '5.36', '0.14', '1'); -INSERT INTO `lvlupgain` VALUES ('54', '346.0', '35.10', '0.37', '242.2', '24.54', '0.22', '144.0', '9.80', '0.14', '20'); -INSERT INTO `lvlupgain` VALUES ('55', '1110.8', '57.10', '0.37', '777.5', '39.94', '0.22', '359.1', '19.40', '0.14', '40'); -INSERT INTO `lvlupgain` VALUES ('56', '346.0', '32.90', '0.37', '276.8', '26.30', '0.22', '144.0', '9.80', '0.14', '20'); -INSERT INTO `lvlupgain` VALUES ('57', '1063.0', '54.50', '0.37', '850.4', '43.58', '0.22', '359.1', '19.40', '0.14', '40'); -INSERT INTO `lvlupgain` VALUES ('88', '3061.8', '63.08', '0.37', '2755.6', '56.77', '0.22', '1155.6', '24.90', '0.14', '76'); -INSERT INTO `lvlupgain` VALUES ('89', '3274.2', '69.72', '0.37', '2619.3', '55.78', '0.22', '1155.6', '24.90', '0.14', '76'); -INSERT INTO `lvlupgain` VALUES ('90', '2883.9', '59.76', '0.37', '1730.3', '35.86', '0.22', '1155.6', '24.90', '0.14', '76'); -INSERT INTO `lvlupgain` VALUES ('91', '2883.9', '59.76', '0.37', '1730.3', '35.86', '0.22', '1155.6', '24.90', '0.14', '76'); -INSERT INTO `lvlupgain` VALUES ('92', '2729.9', '56.44', '0.37', '1910.9', '39.51', '0.22', '1155.6', '24.90', '0.14', '76'); -INSERT INTO `lvlupgain` VALUES ('93', '2623.7', '53.12', '0.37', '1049.4', '21.25', '0.22', '1155.6', '24.90', '0.14', '76'); -INSERT INTO `lvlupgain` VALUES ('94', '2880.0', '58.10', '0.37', '1440.0', '29.05', '0.22', '1540.8', '33.20', '0.14', '76'); -INSERT INTO `lvlupgain` VALUES ('95', '2880.0', '58.10', '0.37', '1440.0', '29.05', '0.22', '1540.8', '33.20', '0.14', '76'); -INSERT INTO `lvlupgain` VALUES ('96', '3039.3', '63.08', '0.37', '1823.5', '37.85', '0.22', '1540.8', '33.20', '0.14', '76'); -INSERT INTO `lvlupgain` VALUES ('97', '3182.7', '63.08', '0.37', '2227.8', '44.16', '0.22', '1540.8', '33.20', '0.14', '76'); -INSERT INTO `lvlupgain` VALUES ('98', '3342.0', '68.06', '0.37', '1671.0', '34.03', '0.22', '1540.8', '33.20', '0.14', '76'); -INSERT INTO `lvlupgain` VALUES ('99', '3196.0', '66.40', '0.37', '1917.6', '39.84', '0.22', '1155.6', '24.90', '0.14', '76'); -INSERT INTO `lvlupgain` VALUES ('100', '3302.2', '69.72', '0.37', '1651.1', '34.86', '0.22', '1155.6', '24.90', '0.14', '76'); -INSERT INTO `lvlupgain` VALUES ('101', '2935.8', '59.76', '0.37', '1174.3', '23.90', '0.22', '1155.6', '24.90', '0.14', '76'); -INSERT INTO `lvlupgain` VALUES ('102', '3042.0', '63.08', '0.37', '1521.0', '31.54', '0.22', '1155.6', '24.90', '0.14', '76'); -INSERT INTO `lvlupgain` VALUES ('103', '3013.1', '61.42', '0.37', '1506.5', '30.71', '0.22', '1540.8', '33.20', '0.14', '76'); -INSERT INTO `lvlupgain` VALUES ('104', '3119.3', '64.74', '0.37', '1871.5', '38.84', '0.22', '1540.8', '33.20', '0.14', '76'); -INSERT INTO `lvlupgain` VALUES ('105', '3422.0', '69.72', '0.37', '1711.0', '34.86', '0.22', '1540.8', '33.20', '0.14', '76'); -INSERT INTO `lvlupgain` VALUES ('106', '3374.0', '69.72', '0.37', '2024.4', '41.83', '0.22', '1155.6', '24.90', '0.14', '76'); -INSERT INTO `lvlupgain` VALUES ('107', '3533.3', '74.70', '0.37', '1766.6', '37.35', '0.22', '1155.6', '24.90', '0.14', '76'); -INSERT INTO `lvlupgain` VALUES ('108', '3113.8', '63.08', '0.37', '1245.5', '25.23', '0.22', '1155.6', '24.90', '0.14', '76'); -INSERT INTO `lvlupgain` VALUES ('109', '3220.0', '66.40', '0.37', '1610.0', '33.20', '0.22', '1155.6', '24.90', '0.14', '76'); -INSERT INTO `lvlupgain` VALUES ('110', '3039.0', '61.42', '0.37', '1519.5', '30.71', '0.22', '1540.8', '33.20', '0.14', '76'); -INSERT INTO `lvlupgain` VALUES ('111', '3198.3', '66.40', '0.37', '1918.9', '39.84', '0.22', '1540.8', '33.20', '0.14', '76'); -INSERT INTO `lvlupgain` VALUES ('112', '3447.9', '69.72', '0.37', '1723.9', '34.86', '0.22', '1540.8', '33.20', '0.14', '76'); -INSERT INTO `lvlupgain` VALUES ('113', '3447.2', '72.94', '0.37', '2413.0', '51.03', '0.22', '1155.6', '24.80', '0.14', '76'); -INSERT INTO `lvlupgain` VALUES ('114', '3293.2', '69.62', '0.37', '1646.6', '34.76', '0.22', '1155.6', '24.80', '0.14', '76'); -INSERT INTO `lvlupgain` VALUES ('115', '3359.9', '67.96', '0.37', '2687.9', '54.35', '0.22', '1540.8', '33.10', '0.14', '76'); -INSERT INTO `lvlupgain` VALUES ('116', '3359.9', '67.96', '0.37', '1679.9', '33.93', '0.22', '1540.8', '33.10', '0.14', '76'); -INSERT INTO `lvlupgain` VALUES ('117', '3447.2', '72.94', '0.37', '2413.0', '51.03', '0.22', '1155.6', '24.80', '0.14', '76'); -INSERT INTO `lvlupgain` VALUES ('118', '3293.2', '69.62', '0.37', '2634.5', '55.68', '0.22', '1155.6', '24.80', '0.14', '76'); \ No newline at end of file +INSERT INTO `lvlupgain` VALUES + ('0', '80.0', '11.83', '0.37', '32.0', '4.73', '0.22', '30.0', '5.46', '0.14', '1'), + ('1', '327.0', '33.00', '0.37', '261.6', '26.40', '0.22', '144.0', '9.90', '0.14', '20'), + ('2', '1044.0', '49.40', '0.37', '939.6', '44.46', '0.22', '359.1', '19.50', '0.14', '40'), + ('3', '1044.0', '54.60', '0.37', '835.2', '43.68', '0.22', '359.1', '19.50', '0.14', '40'), + ('4', '327.0', '29.70', '0.37', '196.2', '17.82', '0.22', '144.0', '9.90', '0.14', '20'), + ('5', '972.3', '46.80', '0.37', '583.3', '28.08', '0.22', '359.1', '19.50', '0.14', '40'), + ('6', '972.3', '46.80', '0.37', '583.3', '28.08', '0.22', '359.1', '19.50', '0.14', '40'), + ('7', '327.0', '27.50', '0.37', '130.8', '11.00', '0.22', '144.0', '9.90', '0.14', '20'), + ('8', '924.5', '41.60', '0.37', '369.8', '16.64', '0.22', '359.1', '19.50', '0.14', '40'), + ('9', '924.5', '44.20', '0.37', '647.1', '30.94', '0.22', '359.1', '19.50', '0.14', '40'), + ('10', '101.0', '15.57', '0.37', '50.5', '7.84', '0.22', '40.0', '7.38', '0.14', '1'), + ('11', '424.0', '27.60', '0.37', '212.0', '13.85', '0.22', '192.0', '13.30', '0.14', '20'), + ('12', '1021.5', '45.60', '0.37', '510.7', '22.85', '0.22', '478.8', '26.10', '0.14', '40'), + ('13', '1021.5', '45.60', '0.37', '510.7', '22.85', '0.22', '478.8', '26.10', '0.14', '40'), + ('14', '1021.5', '49.50', '0.37', '612.9', '29.74', '0.22', '478.8', '26.10', '0.14', '40'), + ('15', '424.0', '34.20', '0.37', '212.0', '17.15', '0.22', '192.0', '13.30', '0.14', '20'), + ('16', '1164.9', '49.50', '0.37', '815.4', '34.68', '0.22', '478.8', '26.10', '0.14', '40'), + ('17', '1164.9', '53.40', '0.37', '582.4', '26.75', '0.22', '478.8', '26.10', '0.14', '40'), + ('18', '89.0', '12.74', '0.37', '35.6', '5.00', '0.22', '30.0', '5.46', '0.14', '1'), + ('19', '355.0', '33.00', '0.37', '177.5', '16.50', '0.22', '144.0', '9.90', '0.14', '20'), + ('20', '1072.0', '52.00', '0.37', '643.2', '31.20', '0.22', '359.1', '19.50', '0.14', '40'), + ('21', '1072.0', '54.60', '0.37', '536.0', '27.30', '0.22', '359.1', '19.50', '0.14', '40'), + ('22', '355.0', '30.80', '0.37', '142.0', '12.32', '0.22', '144.0', '9.90', '0.14', '20'), + ('23', '1024.2', '46.80', '0.37', '409.6', '18.72', '0.22', '359.1', '19.50', '0.14', '40'), + ('24', '1024.2', '49.40', '0.37', '512.1', '24.70', '0.22', '359.1', '19.50', '0.14', '40'), + ('25', '104.0', '15.57', '0.37', '52.0', '7.84', '0.22', '40.0', '7.38', '0.14', '1'), + ('26', '427.0', '28.70', '0.37', '213.5', '14.40', '0.22', '192.0', '13.30', '0.14', '20'), + ('27', '1048.4', '48.20', '0.37', '524.2', '24.15', '0.22', '478.8', '26.10', '0.14', '40'), + ('28', '1048.4', '50.80', '0.37', '629.0', '30.52', '0.22', '478.8', '26.10', '0.14', '40'), + ('29', '427.0', '35.30', '0.37', '213.5', '17.70', '0.22', '192.0', '13.30', '0.14', '20'), + ('30', '1191.8', '54.70', '0.37', '595.9', '27.40', '0.22', '478.8', '26.10', '0.14', '40'), + ('31', '94.0', '13.65', '0.37', '37.6', '5.46', '0.22', '30.0', '5.46', '0.14', '1'), + ('32', '379.0', '35.20', '0.37', '189.5', '17.60', '0.22', '144.0', '9.90', '0.14', '20'), + ('33', '1143.8', '54.60', '0.37', '686.2', '32.76', '0.22', '359.1', '19.50', '0.14', '40'), + ('34', '1143.8', '58.50', '0.37', '571.9', '29.25', '0.22', '359.1', '19.50', '0.14', '40'), + ('35', '379.0', '33.00', '0.37', '151.6', '13.20', '0.22', '144.0', '9.90', '0.14', '20'), + ('36', '1096.0', '49.40', '0.37', '438.4', '19.76', '0.22', '359.1', '19.50', '0.14', '40'), + ('37', '1096.0', '52.00', '0.37', '548.0', '26.00', '0.22', '359.1', '19.50', '0.14', '40'), + ('38', '106.0', '15.57', '0.37', '53.0', '7.84', '0.22', '40.0', '7.38', '0.14', '1'), + ('39', '429.0', '29.80', '0.37', '214.5', '14.95', '0.22', '192.0', '13.30', '0.14', '20'), + ('40', '1074.3', '48.20', '0.37', '537.1', '24.15', '0.22', '478.8', '26.10', '0.14', '40'), + ('41', '1074.3', '52.10', '0.37', '644.5', '31.30', '0.22', '478.8', '26.10', '0.14', '40'), + ('42', '429.0', '36.40', '0.37', '214.5', '18.25', '0.22', '192.0', '13.30', '0.14', '20'), + ('43', '1217.7', '54.70', '0.37', '608.8', '27.40', '0.22', '478.8', '26.10', '0.14', '40'), + ('44', '80.0', '12.64', '0.37', '40.0', '6.27', '0.22', '30.0', '5.36', '0.14', '1'), + ('45', '346.0', '35.10', '0.37', '242.2', '24.54', '0.22', '144.0', '9.80', '0.14', '20'), + ('46', '1110.8', '57.10', '0.37', '777.5', '39.94', '0.22', '359.1', '19.40', '0.14', '40'), + ('47', '346.0', '32.90', '0.37', '173.0', '16.40', '0.22', '144.0', '9.80', '0.14', '20'), + ('48', '1063.0', '54.50', '0.37', '531.5', '27.20', '0.22', '359.1', '19.40', '0.14', '40'), + ('49', '95.0', '15.47', '0.37', '47.5', '7.74', '0.22', '40.0', '7.28', '0.14', '1'), + ('50', '418.0', '35.20', '0.37', '209.0', '17.60', '0.22', '192.0', '13.20', '0.14', '20'), + ('51', '1182.8', '53.30', '0.37', '946.2', '42.64', '0.22', '478.8', '26.00', '0.14', '40'), + ('52', '1182.8', '53.30', '0.37', '591.4', '26.65', '0.22', '478.8', '26.00', '0.14', '40'), + ('53', '80.0', '12.64', '0.37', '56.0', '8.82', '0.22', '30.0', '5.36', '0.14', '1'), + ('54', '346.0', '35.10', '0.37', '242.2', '24.54', '0.22', '144.0', '9.80', '0.14', '20'), + ('55', '1110.8', '57.10', '0.37', '777.5', '39.94', '0.22', '359.1', '19.40', '0.14', '40'), + ('56', '346.0', '32.90', '0.37', '276.8', '26.30', '0.22', '144.0', '9.80', '0.14', '20'), + ('57', '1063.0', '54.50', '0.37', '850.4', '43.58', '0.22', '359.1', '19.40', '0.14', '40'), + ('88', '3061.8', '63.08', '0.37', '2755.6', '56.77', '0.22', '1155.6', '24.90', '0.14', '76'), + ('89', '3274.2', '69.72', '0.37', '2619.3', '55.78', '0.22', '1155.6', '24.90', '0.14', '76'), + ('90', '2883.9', '59.76', '0.37', '1730.3', '35.86', '0.22', '1155.6', '24.90', '0.14', '76'), + ('91', '2883.9', '59.76', '0.37', '1730.3', '35.86', '0.22', '1155.6', '24.90', '0.14', '76'), + ('92', '2729.9', '56.44', '0.37', '1910.9', '39.51', '0.22', '1155.6', '24.90', '0.14', '76'), + ('93', '2623.7', '53.12', '0.37', '1049.4', '21.25', '0.22', '1155.6', '24.90', '0.14', '76'), + ('94', '2880.0', '58.10', '0.37', '1440.0', '29.05', '0.22', '1540.8', '33.20', '0.14', '76'), + ('95', '2880.0', '58.10', '0.37', '1440.0', '29.05', '0.22', '1540.8', '33.20', '0.14', '76'), + ('96', '3039.3', '63.08', '0.37', '1823.5', '37.85', '0.22', '1540.8', '33.20', '0.14', '76'), + ('97', '3182.7', '63.08', '0.37', '2227.8', '44.16', '0.22', '1540.8', '33.20', '0.14', '76'), + ('98', '3342.0', '68.06', '0.37', '1671.0', '34.03', '0.22', '1540.8', '33.20', '0.14', '76'), + ('99', '3196.0', '66.40', '0.37', '1917.6', '39.84', '0.22', '1155.6', '24.90', '0.14', '76'), + ('100', '3302.2', '69.72', '0.37', '1651.1', '34.86', '0.22', '1155.6', '24.90', '0.14', '76'), + ('101', '2935.8', '59.76', '0.37', '1174.3', '23.90', '0.22', '1155.6', '24.90', '0.14', '76'), + ('102', '3042.0', '63.08', '0.37', '1521.0', '31.54', '0.22', '1155.6', '24.90', '0.14', '76'), + ('103', '3013.1', '61.42', '0.37', '1506.5', '30.71', '0.22', '1540.8', '33.20', '0.14', '76'), + ('104', '3119.3', '64.74', '0.37', '1871.5', '38.84', '0.22', '1540.8', '33.20', '0.14', '76'), + ('105', '3422.0', '69.72', '0.37', '1711.0', '34.86', '0.22', '1540.8', '33.20', '0.14', '76'), + ('106', '3374.0', '69.72', '0.37', '2024.4', '41.83', '0.22', '1155.6', '24.90', '0.14', '76'), + ('107', '3533.3', '74.70', '0.37', '1766.6', '37.35', '0.22', '1155.6', '24.90', '0.14', '76'), + ('108', '3113.8', '63.08', '0.37', '1245.5', '25.23', '0.22', '1155.6', '24.90', '0.14', '76'), + ('109', '3220.0', '66.40', '0.37', '1610.0', '33.20', '0.22', '1155.6', '24.90', '0.14', '76'), + ('110', '3039.0', '61.42', '0.37', '1519.5', '30.71', '0.22', '1540.8', '33.20', '0.14', '76'), + ('111', '3198.3', '66.40', '0.37', '1918.9', '39.84', '0.22', '1540.8', '33.20', '0.14', '76'), + ('112', '3447.9', '69.72', '0.37', '1723.9', '34.86', '0.22', '1540.8', '33.20', '0.14', '76'), + ('113', '3447.2', '72.94', '0.37', '2413.0', '51.03', '0.22', '1155.6', '24.80', '0.14', '76'), + ('114', '3293.2', '69.62', '0.37', '1646.6', '34.76', '0.22', '1155.6', '24.80', '0.14', '76'), + ('115', '3359.9', '67.96', '0.37', '2687.9', '54.35', '0.22', '1540.8', '33.10', '0.14', '76'), + ('116', '3359.9', '67.96', '0.37', '1679.9', '33.93', '0.22', '1540.8', '33.10', '0.14', '76'), + ('117', '3447.2', '72.94', '0.37', '2413.0', '51.03', '0.22', '1155.6', '24.80', '0.14', '76'), + ('118', '3293.2', '69.62', '0.37', '2634.5', '55.68', '0.22', '1155.6', '24.80', '0.14', '76'); \ No newline at end of file diff --git a/Datapack/sql/mapregion.sql b/Datapack/sql/mapregion.sql index 2503f864..92a9a2f3 100644 --- a/Datapack/sql/mapregion.sql +++ b/Datapack/sql/mapregion.sql @@ -15,7 +15,7 @@ CREATE TABLE `mapregion` ( `sec8` int(2) NOT NULL default '0', `sec9` int(2) NOT NULL default '0', PRIMARY KEY (`region`) -) ENGINE=MyISAM; +); -- -- Dumping data for table `mapregion` diff --git a/Datapack/sql/merchant_areas_list.sql b/Datapack/sql/merchant_areas_list.sql index 506534b4..c186e7ac 100644 --- a/Datapack/sql/merchant_areas_list.sql +++ b/Datapack/sql/merchant_areas_list.sql @@ -8,24 +8,24 @@ CREATE TABLE `merchant_areas_list` ( `tax` double(3,2) unsigned NOT NULL default '0.00', `Chaotic` int(11) NOT NULL default '0', PRIMARY KEY (`merchant_area_id`) -) ENGINE=MyISAM; +); -- -- Dumping data for table `merchant_areas_list` -- -INSERT INTO `merchant_areas_list` VALUES (1,'Starter Town',0.15,0); -INSERT INTO `merchant_areas_list` VALUES (2,'West of Alter of Rights',0.50,1); -INSERT INTO `merchant_areas_list` VALUES (3,'Gludin',0.20,0); -INSERT INTO `merchant_areas_list` VALUES (4,'Gludio',0.20,0); -INSERT INTO `merchant_areas_list` VALUES (5,'South Wastelands',0.50,1); -INSERT INTO `merchant_areas_list` VALUES (6,'Dion',0.20,0); -INSERT INTO `merchant_areas_list` VALUES (7,'Floran',0.50,1); -INSERT INTO `merchant_areas_list` VALUES (8,'Hunters Village',0.30,0); -INSERT INTO `merchant_areas_list` VALUES (9,'Giran',0.10,0); -INSERT INTO `merchant_areas_list` VALUES (10,'Oren',0.15,0); -INSERT INTO `merchant_areas_list` VALUES (11,'Ivory Tower',0.15,0); -INSERT INTO `merchant_areas_list` VALUES (12,'Harden\'s Ac.',0.20,0); -INSERT INTO `merchant_areas_list` VALUES (13,'Aden',0.20,0); -INSERT INTO `merchant_areas_list` VALUES (14,'Castle',0.0,0); +(1,'Starter Town',0.15,0), +(2,'West of Alter of Rights',0.50,1), +(3,'Gludin',0.20,0), +(4,'Gludio',0.20,0), +(5,'South Wastelands',0.50,1), +(6,'Dion',0.20,0), +(7,'Floran',0.50,1), +(8,'Hunters Village',0.30,0), +(9,'Giran',0.10,0), +(10,'Oren',0.15,0), +(11,'Ivory Tower',0.15,0), +(12,'Harden\'s Ac.',0.20,0), +(13,'Aden',0.20,0), +(14,'Castle',0.0,0); diff --git a/Datapack/sql/merchant_buylists.sql b/Datapack/sql/merchant_buylists.sql index ecb5ad1e..a2b1afd4 100644 --- a/Datapack/sql/merchant_buylists.sql +++ b/Datapack/sql/merchant_buylists.sql @@ -12,7 +12,7 @@ CREATE TABLE merchant_buylists ( time INT NOT NULL DEFAULT '0', savetimer DECIMAL(20,0) NOT NULL DEFAULT '0', PRIMARY KEY (shop_id,`order`) -) ENGINE=MyISAM; +); -- -- Dumping data for table `merchant_buylists` diff --git a/Datapack/sql/merchant_shopids.sql b/Datapack/sql/merchant_shopids.sql index 4d2e2aab..75273773 100644 --- a/Datapack/sql/merchant_shopids.sql +++ b/Datapack/sql/merchant_shopids.sql @@ -6,668 +6,668 @@ CREATE TABLE merchant_shopids ( shop_id decimal(9,0) NOT NULL default '0', npc_id varchar(9) default NULL, PRIMARY KEY (shop_id) -) ENGINE=MyISAM; +); -- -- Dumping data for table `merchant_shopids` -- -- General Shops - -INSERT INTO merchant_shopids VALUES (1,'30001'); -INSERT INTO merchant_shopids VALUES (2,'30001'); -INSERT INTO merchant_shopids VALUES (3,'30087'); -INSERT INTO merchant_shopids VALUES (4,'30087'); -INSERT INTO merchant_shopids VALUES (5,'30088'); -INSERT INTO merchant_shopids VALUES (6,'30088'); -INSERT INTO merchant_shopids VALUES (7,'30090'); -INSERT INTO merchant_shopids VALUES (8,'30091'); -INSERT INTO merchant_shopids VALUES (9,'30093'); -INSERT INTO merchant_shopids VALUES (10,'30093'); -INSERT INTO merchant_shopids VALUES (11,'30002'); -INSERT INTO merchant_shopids VALUES (12,'30002'); -INSERT INTO merchant_shopids VALUES (13,'30003'); -INSERT INTO merchant_shopids VALUES (14,'30004'); -INSERT INTO merchant_shopids VALUES (15,'30060'); -INSERT INTO merchant_shopids VALUES (16,'30060'); -INSERT INTO merchant_shopids VALUES (17,'30061'); -INSERT INTO merchant_shopids VALUES (18,'30061'); -INSERT INTO merchant_shopids VALUES (19,'30062'); -INSERT INTO merchant_shopids VALUES (20,'30063'); -INSERT INTO merchant_shopids VALUES (21,'30165'); -INSERT INTO merchant_shopids VALUES (22,'30078'); -INSERT INTO merchant_shopids VALUES (23,'30081'); -INSERT INTO merchant_shopids VALUES (24,'30082'); -INSERT INTO merchant_shopids VALUES (25,'30084'); -INSERT INTO merchant_shopids VALUES (26,'30084'); -INSERT INTO merchant_shopids VALUES (27,'30085'); -INSERT INTO merchant_shopids VALUES (28,'30085'); -INSERT INTO merchant_shopids VALUES (29,'30094'); -INSERT INTO merchant_shopids VALUES (30,'30094'); -INSERT INTO merchant_shopids VALUES (31,'30135'); -INSERT INTO merchant_shopids VALUES (32,'30135'); -INSERT INTO merchant_shopids VALUES (33,'30136'); -INSERT INTO merchant_shopids VALUES (34,'30136'); -INSERT INTO merchant_shopids VALUES (35,'30137'); -INSERT INTO merchant_shopids VALUES (36,'30138'); -INSERT INTO merchant_shopids VALUES (37,'30147'); -INSERT INTO merchant_shopids VALUES (38,'30147'); -INSERT INTO merchant_shopids VALUES (39,'30148'); -INSERT INTO merchant_shopids VALUES (40,'30148'); -INSERT INTO merchant_shopids VALUES (41,'30149'); -INSERT INTO merchant_shopids VALUES (42,'30150'); -INSERT INTO merchant_shopids VALUES (43,'30163'); -INSERT INTO merchant_shopids VALUES (44,'30164'); -INSERT INTO merchant_shopids VALUES (45,'30165'); -INSERT INTO merchant_shopids VALUES (46,'30166'); -INSERT INTO merchant_shopids VALUES (47,'30178'); -INSERT INTO merchant_shopids VALUES (48,'30178'); -INSERT INTO merchant_shopids VALUES (49,'30179'); -INSERT INTO merchant_shopids VALUES (50,'30179'); -INSERT INTO merchant_shopids VALUES (51,'30180'); -INSERT INTO merchant_shopids VALUES (52,'30181'); -INSERT INTO merchant_shopids VALUES (53,'30207'); -INSERT INTO merchant_shopids VALUES (54,'30207'); -INSERT INTO merchant_shopids VALUES (55,'30208'); -INSERT INTO merchant_shopids VALUES (56,'30208'); -INSERT INTO merchant_shopids VALUES (57,'30209'); -INSERT INTO merchant_shopids VALUES (58,'30230'); -INSERT INTO merchant_shopids VALUES (59,'30230'); -INSERT INTO merchant_shopids VALUES (60,'30231'); -INSERT INTO merchant_shopids VALUES (61,'30253'); -INSERT INTO merchant_shopids VALUES (62,'30253'); -INSERT INTO merchant_shopids VALUES (63,'30254'); -INSERT INTO merchant_shopids VALUES (64,'30294'); -INSERT INTO merchant_shopids VALUES (65,'30301'); -INSERT INTO merchant_shopids VALUES (66,'30313'); -INSERT INTO merchant_shopids VALUES (67,'30314'); -INSERT INTO merchant_shopids VALUES (68,'30315'); -INSERT INTO merchant_shopids VALUES (69,'30321'); -INSERT INTO merchant_shopids VALUES (70,'30321'); -INSERT INTO merchant_shopids VALUES (71,'30420'); -INSERT INTO merchant_shopids VALUES (72,'30436'); -INSERT INTO merchant_shopids VALUES (73,'30834'); -INSERT INTO merchant_shopids VALUES (74,'30437'); -INSERT INTO merchant_shopids VALUES (75,'30516'); -INSERT INTO merchant_shopids VALUES (76,'30516'); -INSERT INTO merchant_shopids VALUES (77,'30517'); -INSERT INTO merchant_shopids VALUES (78,'30517'); -INSERT INTO merchant_shopids VALUES (79,'30518'); -INSERT INTO merchant_shopids VALUES (80,'30519'); -INSERT INTO merchant_shopids VALUES (81,'30558'); -INSERT INTO merchant_shopids VALUES (82,'30558'); -INSERT INTO merchant_shopids VALUES (83,'30559'); -INSERT INTO merchant_shopids VALUES (84,'30559'); -INSERT INTO merchant_shopids VALUES (85,'30560'); -INSERT INTO merchant_shopids VALUES (86,'30561'); -INSERT INTO merchant_shopids VALUES (87,'30684'); -INSERT INTO merchant_shopids VALUES (88,'30684'); -INSERT INTO merchant_shopids VALUES (89,'30731'); -INSERT INTO merchant_shopids VALUES (90,'30827'); -INSERT INTO merchant_shopids VALUES (91,'30828'); -INSERT INTO merchant_shopids VALUES (92,'30829'); -INSERT INTO merchant_shopids VALUES (93,'30830'); -INSERT INTO merchant_shopids VALUES (94,'30831'); -INSERT INTO merchant_shopids VALUES (95,'30834'); -INSERT INTO merchant_shopids VALUES (96,'30837'); -INSERT INTO merchant_shopids VALUES (97,'30837'); -INSERT INTO merchant_shopids VALUES (98,'30838'); -INSERT INTO merchant_shopids VALUES (99,'30838'); -INSERT INTO merchant_shopids VALUES (100,'30839'); -INSERT INTO merchant_shopids VALUES (101,'30840'); -INSERT INTO merchant_shopids VALUES (102,'30841'); -INSERT INTO merchant_shopids VALUES (103,'30842'); -INSERT INTO merchant_shopids VALUES (104,'30869'); -INSERT INTO merchant_shopids VALUES (105,'31256'); -INSERT INTO merchant_shopids VALUES (106,'31256'); -INSERT INTO merchant_shopids VALUES (107,'31257'); -INSERT INTO merchant_shopids VALUES (108,'31257'); -INSERT INTO merchant_shopids VALUES (109,'31258'); -INSERT INTO merchant_shopids VALUES (110,'31258'); -INSERT INTO merchant_shopids VALUES (111,'31259'); -INSERT INTO merchant_shopids VALUES (112,'31259'); -INSERT INTO merchant_shopids VALUES (113,'31260'); -INSERT INTO merchant_shopids VALUES (114,'31261'); -INSERT INTO merchant_shopids VALUES (115,'31262'); -INSERT INTO merchant_shopids VALUES (116,'31263'); -INSERT INTO merchant_shopids VALUES (117,'31263'); -INSERT INTO merchant_shopids VALUES (118,'31265'); -INSERT INTO merchant_shopids VALUES (119,'31273'); -INSERT INTO merchant_shopids VALUES (120,'31274'); -INSERT INTO merchant_shopids VALUES (121,'31284'); -INSERT INTO merchant_shopids VALUES (122,'31291'); -INSERT INTO merchant_shopids VALUES (123,'31300'); -INSERT INTO merchant_shopids VALUES (124,'31300'); -INSERT INTO merchant_shopids VALUES (125,'31301'); -INSERT INTO merchant_shopids VALUES (126,'31301'); -INSERT INTO merchant_shopids VALUES (127,'31302'); -INSERT INTO merchant_shopids VALUES (128,'31302'); -INSERT INTO merchant_shopids VALUES (129,'31303'); -INSERT INTO merchant_shopids VALUES (130,'31303'); -INSERT INTO merchant_shopids VALUES (131,'31304'); -INSERT INTO merchant_shopids VALUES (132,'31305'); -INSERT INTO merchant_shopids VALUES (133,'31306'); -INSERT INTO merchant_shopids VALUES (134,'31307'); -INSERT INTO merchant_shopids VALUES (135,'31307'); -INSERT INTO merchant_shopids VALUES (136,'31309'); -INSERT INTO merchant_shopids VALUES (137,'31318'); -INSERT INTO merchant_shopids VALUES (138,'31319'); -INSERT INTO merchant_shopids VALUES (139,'31338'); -INSERT INTO merchant_shopids VALUES (140,'31339'); -INSERT INTO merchant_shopids VALUES (141,'31366'); -INSERT INTO merchant_shopids VALUES (145,'31366'); -INSERT INTO merchant_shopids VALUES (146,'31445'); -INSERT INTO merchant_shopids VALUES (147,'31386'); -INSERT INTO merchant_shopids VALUES (148,'31438'); -INSERT INTO merchant_shopids VALUES (149,'31413'); -INSERT INTO merchant_shopids VALUES (150,'31419'); -INSERT INTO merchant_shopids VALUES (151,'31666'); -INSERT INTO merchant_shopids VALUES (152,'31431'); -INSERT INTO merchant_shopids VALUES (153,'31954'); -INSERT INTO merchant_shopids VALUES (154,'31441'); -INSERT INTO merchant_shopids VALUES (155,'31442'); -INSERT INTO merchant_shopids VALUES (156,'31444'); -INSERT INTO merchant_shopids VALUES (157,'31669'); -INSERT INTO merchant_shopids VALUES (158,'31963'); -INSERT INTO merchant_shopids VALUES (159,'31414'); -INSERT INTO merchant_shopids VALUES (160,'31418'); -INSERT INTO merchant_shopids VALUES (161,'31415'); -INSERT INTO merchant_shopids VALUES (162,'31423'); -INSERT INTO merchant_shopids VALUES (163,'31433'); -INSERT INTO merchant_shopids VALUES (164,'31440'); -INSERT INTO merchant_shopids VALUES (165,'31432'); -INSERT INTO merchant_shopids VALUES (166,'31425'); -INSERT INTO merchant_shopids VALUES (167,'31439'); -INSERT INTO merchant_shopids VALUES (168,'31954'); -INSERT INTO merchant_shopids VALUES (169,'31962'); -INSERT INTO merchant_shopids VALUES (170,'31416'); -INSERT INTO merchant_shopids VALUES (171,'31417'); -INSERT INTO merchant_shopids VALUES (172,'31435'); -INSERT INTO merchant_shopids VALUES (173,'31437'); -INSERT INTO merchant_shopids VALUES (174,'31422'); -INSERT INTO merchant_shopids VALUES (175,'31668'); -INSERT INTO merchant_shopids VALUES (176,'31434'); -INSERT INTO merchant_shopids VALUES (177,'31426'); -INSERT INTO merchant_shopids VALUES (178,'31428'); -INSERT INTO merchant_shopids VALUES (179,'31945'); -INSERT INTO merchant_shopids VALUES (180,'31945'); -INSERT INTO merchant_shopids VALUES (181,'31946'); -INSERT INTO merchant_shopids VALUES (182,'31946'); -INSERT INTO merchant_shopids VALUES (183,'31947'); -INSERT INTO merchant_shopids VALUES (184,'31947'); -INSERT INTO merchant_shopids VALUES (185,'31948'); -INSERT INTO merchant_shopids VALUES (186,'31948'); -INSERT INTO merchant_shopids VALUES (187,'31949'); -INSERT INTO merchant_shopids VALUES (188,'31950'); -INSERT INTO merchant_shopids VALUES (189,'31951'); -INSERT INTO merchant_shopids VALUES (190,'31952'); -INSERT INTO merchant_shopids VALUES (191,'31952'); -INSERT INTO merchant_shopids VALUES (192,'31962'); -INSERT INTO merchant_shopids VALUES (193,'31963'); -INSERT INTO merchant_shopids VALUES (194,'31973'); -INSERT INTO merchant_shopids VALUES (195,'31980'); -INSERT INTO merchant_shopids VALUES (196,'31670'); -INSERT INTO merchant_shopids VALUES (197,'31420'); -INSERT INTO merchant_shopids VALUES (198,'31427'); -INSERT INTO merchant_shopids VALUES (199,'31436'); -INSERT INTO merchant_shopids VALUES (200,'31443'); -INSERT INTO merchant_shopids VALUES (201,'31429'); -INSERT INTO merchant_shopids VALUES (202,'31421'); -INSERT INTO merchant_shopids VALUES (203,'31430'); -INSERT INTO merchant_shopids VALUES (204,'31667'); -INSERT INTO merchant_shopids VALUES (205,'30314'); -INSERT INTO merchant_shopids VALUES (351,'30047'); -INSERT INTO merchant_shopids VALUES (352,'30387'); -INSERT INTO merchant_shopids VALUES (353,'30879'); -INSERT INTO merchant_shopids VALUES (354,'31351'); -INSERT INTO merchant_shopids VALUES (355,'30003'); -INSERT INTO merchant_shopids VALUES (359,'31414'); -INSERT INTO merchant_shopids VALUES (360,'30149'); -INSERT INTO merchant_shopids VALUES (361,'31415'); -INSERT INTO merchant_shopids VALUES (362,'30138'); -INSERT INTO merchant_shopids VALUES (363,'30560'); -INSERT INTO merchant_shopids VALUES (364,'31424'); -INSERT INTO merchant_shopids VALUES (365,'32106'); -INSERT INTO merchant_shopids VALUES (366,'30062'); -INSERT INTO merchant_shopids VALUES (367,'30063'); -INSERT INTO merchant_shopids VALUES (368,'30081'); -INSERT INTO merchant_shopids VALUES (369,'30082'); -INSERT INTO merchant_shopids VALUES (370,'30180'); -INSERT INTO merchant_shopids VALUES (371,'30181'); -INSERT INTO merchant_shopids VALUES (372,'30254'); -INSERT INTO merchant_shopids VALUES (373,'30294'); -INSERT INTO merchant_shopids VALUES (374,'30301'); -INSERT INTO merchant_shopids VALUES (375,'30841'); -INSERT INTO merchant_shopids VALUES (376,'30842'); -INSERT INTO merchant_shopids VALUES (377,'30892'); -INSERT INTO merchant_shopids VALUES (378,'30893'); -INSERT INTO merchant_shopids VALUES (379,'30166'); -INSERT INTO merchant_shopids VALUES (380,'30231'); -INSERT INTO merchant_shopids VALUES (381,'32105'); -INSERT INTO merchant_shopids VALUES (382,'31380'); -INSERT INTO merchant_shopids VALUES (383,'31373'); -INSERT INTO merchant_shopids VALUES (5600,'30892'); -INSERT INTO merchant_shopids VALUES (5601,'30893'); -INSERT INTO merchant_shopids VALUES (5710,'31067'); -INSERT INTO merchant_shopids VALUES (5800,'30890'); -INSERT INTO merchant_shopids VALUES (5801,'30890'); -INSERT INTO merchant_shopids VALUES (5802,'30891'); -INSERT INTO merchant_shopids VALUES (5803,'30891'); -INSERT INTO merchant_shopids VALUES (5804,'31044'); -INSERT INTO merchant_shopids VALUES (5805,'31045'); -INSERT INTO merchant_shopids VALUES (350071,'35007'); +INSERT INTO merchant_shopids VALUES + (1,'30001'), + (2,'30001'), + (3,'30087'), + (4,'30087'), + (5,'30088'), + (6,'30088'), + (7,'30090'), + (8,'30091'), + (9,'30093'), + (10,'30093'), + (11,'30002'), + (12,'30002'), + (13,'30003'), + (14,'30004'), + (15,'30060'), + (16,'30060'), + (17,'30061'), + (18,'30061'), + (19,'30062'), + (20,'30063'), + (21,'30165'), + (22,'30078'), + (23,'30081'), + (24,'30082'), + (25,'30084'), + (26,'30084'), + (27,'30085'), + (28,'30085'), + (29,'30094'), + (30,'30094'), + (31,'30135'), + (32,'30135'), + (33,'30136'), + (34,'30136'), + (35,'30137'), + (36,'30138'), + (37,'30147'), + (38,'30147'), + (39,'30148'), + (40,'30148'), + (41,'30149'), + (42,'30150'), + (43,'30163'), + (44,'30164'), + (45,'30165'), + (46,'30166'), + (47,'30178'), + (48,'30178'), + (49,'30179'), + (50,'30179'), + (51,'30180'), + (52,'30181'), + (53,'30207'), + (54,'30207'), + (55,'30208'), + (56,'30208'), + (57,'30209'), + (58,'30230'), + (59,'30230'), + (60,'30231'), + (61,'30253'), + (62,'30253'), + (63,'30254'), + (64,'30294'), + (65,'30301'), + (66,'30313'), + (67,'30314'), + (68,'30315'), + (69,'30321'), + (70,'30321'), + (71,'30420'), + (72,'30436'), + (73,'30834'), + (74,'30437'), + (75,'30516'), + (76,'30516'), + (77,'30517'), + (78,'30517'), + (79,'30518'), + (80,'30519'), + (81,'30558'), + (82,'30558'), + (83,'30559'), + (84,'30559'), + (85,'30560'), + (86,'30561'), + (87,'30684'), + (88,'30684'), + (89,'30731'), + (90,'30827'), + (91,'30828'), + (92,'30829'), + (93,'30830'), + (94,'30831'), + (95,'30834'), + (96,'30837'), + (97,'30837'), + (98,'30838'), + (99,'30838'), + (100,'30839'), + (101,'30840'), + (102,'30841'), + (103,'30842'), + (104,'30869'), + (105,'31256'), + (106,'31256'), + (107,'31257'), + (108,'31257'), + (109,'31258'), + (110,'31258'), + (111,'31259'), + (112,'31259'), + (113,'31260'), + (114,'31261'), + (115,'31262'), + (116,'31263'), + (117,'31263'), + (118,'31265'), + (119,'31273'), + (120,'31274'), + (121,'31284'), + (122,'31291'), + (123,'31300'), + (124,'31300'), + (125,'31301'), + (126,'31301'), + (127,'31302'), + (128,'31302'), + (129,'31303'), + (130,'31303'), + (131,'31304'), + (132,'31305'), + (133,'31306'), + (134,'31307'), + (135,'31307'), + (136,'31309'), + (137,'31318'), + (138,'31319'), + (139,'31338'), + (140,'31339'), + (141,'31366'), + (145,'31366'), + (146,'31445'), + (147,'31386'), + (148,'31438'), + (149,'31413'), + (150,'31419'), + (151,'31666'), + (152,'31431'), + (153,'31954'), + (154,'31441'), + (155,'31442'), + (156,'31444'), + (157,'31669'), + (158,'31963'), + (159,'31414'), + (160,'31418'), + (161,'31415'), + (162,'31423'), + (163,'31433'), + (164,'31440'), + (165,'31432'), + (166,'31425'), + (167,'31439'), + (168,'31954'), + (169,'31962'), + (170,'31416'), + (171,'31417'), + (172,'31435'), + (173,'31437'), + (174,'31422'), + (175,'31668'), + (176,'31434'), + (177,'31426'), + (178,'31428'), + (179,'31945'), + (180,'31945'), + (181,'31946'), + (182,'31946'), + (183,'31947'), + (184,'31947'), + (185,'31948'), + (186,'31948'), + (187,'31949'), + (188,'31950'), + (189,'31951'), + (190,'31952'), + (191,'31952'), + (192,'31962'), + (193,'31963'), + (194,'31973'), + (195,'31980'), + (196,'31670'), + (197,'31420'), + (198,'31427'), + (199,'31436'), + (200,'31443'), + (201,'31429'), + (202,'31421'), + (203,'31430'), + (204,'31667'), + (205,'30314'), + (351,'30047'), + (352,'30387'), + (353,'30879'), + (354,'31351'), + (355,'30003'), + (359,'31414'), + (360,'30149'), + (361,'31415'), + (362,'30138'), + (363,'30560'), + (364,'31424'), + (365,'32106'), + (366,'30062'), + (367,'30063'), + (368,'30081'), + (369,'30082'), + (370,'30180'), + (371,'30181'), + (372,'30254'), + (373,'30294'), + (374,'30301'), + (375,'30841'), + (376,'30842'), + (377,'30892'), + (378,'30893'), + (379,'30166'), + (380,'30231'), + (381,'32105'), + (382,'31380'), + (383,'31373'), + (5600,'30892'), + (5601,'30893'), + (5710,'31067'), + (5800,'30890'), + (5801,'30890'), + (5802,'30891'), + (5803,'30891'), + (5804,'31044'), + (5805,'31045'), + (350071,'35007'), -- Mercenary Managers -INSERT INTO merchant_shopids VALUES (351021,'35102'); -INSERT INTO merchant_shopids VALUES (351441,'35144'); -INSERT INTO merchant_shopids VALUES (351861,'35186'); -INSERT INTO merchant_shopids VALUES (352281,'35228'); -INSERT INTO merchant_shopids VALUES (352761,'35276'); -INSERT INTO merchant_shopids VALUES (353181,'35318'); -INSERT INTO merchant_shopids VALUES (353651,'35365'); + (351021,'35102'), + (351441,'35144'), + (351861,'35186'), + (352281,'35228'), + (352761,'35276'), + (353181,'35318'), + (353651,'35365'), -- Fishermens -INSERT INTO merchant_shopids VALUES (142,'31578'); -INSERT INTO merchant_shopids VALUES (143,'31579'); -INSERT INTO merchant_shopids VALUES (144,'31696'); -INSERT INTO merchant_shopids VALUES (400,'31562'); -INSERT INTO merchant_shopids VALUES (401,'31563'); -INSERT INTO merchant_shopids VALUES (402,'31564'); -INSERT INTO merchant_shopids VALUES (403,'31565'); -INSERT INTO merchant_shopids VALUES (404,'31566'); -INSERT INTO merchant_shopids VALUES (405,'31567'); -INSERT INTO merchant_shopids VALUES (406,'31568'); -INSERT INTO merchant_shopids VALUES (407,'31569'); -INSERT INTO merchant_shopids VALUES (408,'31570'); -INSERT INTO merchant_shopids VALUES (409,'31571'); -INSERT INTO merchant_shopids VALUES (410,'31572'); -INSERT INTO merchant_shopids VALUES (411,'31573'); -INSERT INTO merchant_shopids VALUES (412,'31574'); -INSERT INTO merchant_shopids VALUES (413,'31575'); -INSERT INTO merchant_shopids VALUES (414,'31576'); -INSERT INTO merchant_shopids VALUES (415,'31577'); -INSERT INTO merchant_shopids VALUES (416,'31578'); -INSERT INTO merchant_shopids VALUES (417,'31579'); -INSERT INTO merchant_shopids VALUES (418,'31616'); -INSERT INTO merchant_shopids VALUES (419,'31696'); -INSERT INTO merchant_shopids VALUES (420,'31697'); -INSERT INTO merchant_shopids VALUES (421,'31989'); -INSERT INTO merchant_shopids VALUES (423,'32105'); + (142,'31578'), + (143,'31579'), + (144,'31696'), + (400,'31562'), + (401,'31563'), + (402,'31564'), + (403,'31565'), + (404,'31566'), + (405,'31567'), + (406,'31568'), + (407,'31569'), + (408,'31570'), + (409,'31571'), + (410,'31572'), + (411,'31573'), + (412,'31574'), + (413,'31575'), + (414,'31576'), + (415,'31577'), + (416,'31578'), + (417,'31579'), + (418,'31616'), + (419,'31696'), + (420,'31697'), + (421,'31989'), + (423,'32105'), -- GM Shops -INSERT INTO merchant_shopids VALUES (1001,'gm'); -INSERT INTO merchant_shopids VALUES (1002,'gm'); -INSERT INTO merchant_shopids VALUES (1003,'gm'); -INSERT INTO merchant_shopids VALUES (1004,'gm'); -INSERT INTO merchant_shopids VALUES (1005,'gm'); -INSERT INTO merchant_shopids VALUES (1006,'gm'); -INSERT INTO merchant_shopids VALUES (1007,'gm'); -INSERT INTO merchant_shopids VALUES (1008,'gm'); -INSERT INTO merchant_shopids VALUES (1009,'gm'); -INSERT INTO merchant_shopids VALUES (1010,'gm'); -INSERT INTO merchant_shopids VALUES (1011,'gm'); -INSERT INTO merchant_shopids VALUES (1012,'gm'); -INSERT INTO merchant_shopids VALUES (1013,'gm'); -INSERT INTO merchant_shopids VALUES (1014,'gm'); -INSERT INTO merchant_shopids VALUES (1015,'gm'); -INSERT INTO merchant_shopids VALUES (1020,'gm'); -INSERT INTO merchant_shopids VALUES (2011,'gm'); -INSERT INTO merchant_shopids VALUES (2012,'gm'); -INSERT INTO merchant_shopids VALUES (2013,'gm'); -INSERT INTO merchant_shopids VALUES (2014,'gm'); -INSERT INTO merchant_shopids VALUES (2015,'gm'); -INSERT INTO merchant_shopids VALUES (3001,'gm'); -INSERT INTO merchant_shopids VALUES (3002,'gm'); -INSERT INTO merchant_shopids VALUES (3003,'gm'); -INSERT INTO merchant_shopids VALUES (9001,'gm'); -INSERT INTO merchant_shopids VALUES (9002,'gm'); -INSERT INTO merchant_shopids VALUES (9003,'gm'); -INSERT INTO merchant_shopids VALUES (9004,'gm'); -INSERT INTO merchant_shopids VALUES (9005,'gm'); -INSERT INTO merchant_shopids VALUES (9006,'gm'); -INSERT INTO merchant_shopids VALUES (9007,'gm'); -INSERT INTO merchant_shopids VALUES (9008,'gm'); -INSERT INTO merchant_shopids VALUES (9009,'gm'); -INSERT INTO merchant_shopids VALUES (9010,'gm'); -INSERT INTO merchant_shopids VALUES (9011,'gm'); -INSERT INTO merchant_shopids VALUES (9012,'gm'); -INSERT INTO merchant_shopids VALUES (9013,'gm'); -INSERT INTO merchant_shopids VALUES (9014,'gm'); -INSERT INTO merchant_shopids VALUES (9015,'gm'); -INSERT INTO merchant_shopids VALUES (9016,'gm'); -INSERT INTO merchant_shopids VALUES (9017,'gm'); -INSERT INTO merchant_shopids VALUES (9018,'gm'); -INSERT INTO merchant_shopids VALUES (9019,'gm'); -INSERT INTO merchant_shopids VALUES (9020,'gm'); -INSERT INTO merchant_shopids VALUES (9021,'gm'); -INSERT INTO merchant_shopids VALUES (9022,'gm'); -INSERT INTO merchant_shopids VALUES (9023,'gm'); -INSERT INTO merchant_shopids VALUES (9024,'gm'); -INSERT INTO merchant_shopids VALUES (9025,'gm'); -INSERT INTO merchant_shopids VALUES (9026,'gm'); -INSERT INTO merchant_shopids VALUES (9027,'gm'); -INSERT INTO merchant_shopids VALUES (9028,'gm'); -INSERT INTO merchant_shopids VALUES (9029,'gm'); -INSERT INTO merchant_shopids VALUES (9030,'gm'); -INSERT INTO merchant_shopids VALUES (9031,'gm'); -INSERT INTO merchant_shopids VALUES (9032,'gm'); -INSERT INTO merchant_shopids VALUES (9033,'gm'); -INSERT INTO merchant_shopids VALUES (9034,'gm'); -INSERT INTO merchant_shopids VALUES (9035,'gm'); -INSERT INTO merchant_shopids VALUES (9036,'gm'); -INSERT INTO merchant_shopids VALUES (9037,'gm'); -INSERT INTO merchant_shopids VALUES (9038,'gm'); -INSERT INTO merchant_shopids VALUES (9039,'gm'); -INSERT INTO merchant_shopids VALUES (9040,'gm'); -INSERT INTO merchant_shopids VALUES (9041,'gm'); -INSERT INTO merchant_shopids VALUES (9042,'gm'); -INSERT INTO merchant_shopids VALUES (9043,'gm'); -INSERT INTO merchant_shopids VALUES (9044,'gm'); -INSERT INTO merchant_shopids VALUES (9045,'gm'); -INSERT INTO merchant_shopids VALUES (9046,'gm'); -INSERT INTO merchant_shopids VALUES (9047,'gm'); -INSERT INTO merchant_shopids VALUES (9048,'gm'); -INSERT INTO merchant_shopids VALUES (9049,'gm'); -INSERT INTO merchant_shopids VALUES (9050,'gm'); -INSERT INTO merchant_shopids VALUES (9051,'gm'); -INSERT INTO merchant_shopids VALUES (9052,'gm'); -INSERT INTO merchant_shopids VALUES (9053,'gm'); -INSERT INTO merchant_shopids VALUES (9054,'gm'); -INSERT INTO merchant_shopids VALUES (9055,'gm'); -INSERT INTO merchant_shopids VALUES (9056,'gm'); -INSERT INTO merchant_shopids VALUES (9057,'gm'); -INSERT INTO merchant_shopids VALUES (9058,'gm'); -INSERT INTO merchant_shopids VALUES (9059,'gm'); -INSERT INTO merchant_shopids VALUES (9060,'gm'); -INSERT INTO merchant_shopids VALUES (9061,'gm'); -INSERT INTO merchant_shopids VALUES (9062,'gm'); -INSERT INTO merchant_shopids VALUES (9063,'gm'); -INSERT INTO merchant_shopids VALUES (9064,'gm'); -INSERT INTO merchant_shopids VALUES (9065,'gm'); -INSERT INTO merchant_shopids VALUES (9066,'gm'); -INSERT INTO merchant_shopids VALUES (9067,'gm'); -INSERT INTO merchant_shopids VALUES (9068,'gm'); -INSERT INTO merchant_shopids VALUES (9069,'gm'); -INSERT INTO merchant_shopids VALUES (9070,'gm'); -INSERT INTO merchant_shopids VALUES (9071,'gm'); -INSERT INTO merchant_shopids VALUES (9072,'gm'); -INSERT INTO merchant_shopids VALUES (9073,'gm'); -INSERT INTO merchant_shopids VALUES (9074,'gm'); -INSERT INTO merchant_shopids VALUES (9075,'gm'); -INSERT INTO merchant_shopids VALUES (9076,'gm'); -INSERT INTO merchant_shopids VALUES (9077,'gm'); -INSERT INTO merchant_shopids VALUES (9078,'gm'); -INSERT INTO merchant_shopids VALUES (9079,'gm'); -INSERT INTO merchant_shopids VALUES (9080,'gm'); -INSERT INTO merchant_shopids VALUES (9081,'gm'); -INSERT INTO merchant_shopids VALUES (9082,'gm'); -INSERT INTO merchant_shopids VALUES (9083,'gm'); -INSERT INTO merchant_shopids VALUES (9084,'gm'); -INSERT INTO merchant_shopids VALUES (9085,'gm'); -INSERT INTO merchant_shopids VALUES (9086,'gm'); -INSERT INTO merchant_shopids VALUES (9087,'gm'); -INSERT INTO merchant_shopids VALUES (9088,'gm'); -INSERT INTO merchant_shopids VALUES (9089,'gm'); -INSERT INTO merchant_shopids VALUES (9090,'gm'); -INSERT INTO merchant_shopids VALUES (9091,'gm'); -INSERT INTO merchant_shopids VALUES (9092,'gm'); -INSERT INTO merchant_shopids VALUES (9093,'gm'); -INSERT INTO merchant_shopids VALUES (9094,'gm'); -INSERT INTO merchant_shopids VALUES (9095,'gm'); -INSERT INTO merchant_shopids VALUES (9096,'gm'); -INSERT INTO merchant_shopids VALUES (9097,'gm'); -INSERT INTO merchant_shopids VALUES (9098,'gm'); -INSERT INTO merchant_shopids VALUES (9099,'gm'); -INSERT INTO merchant_shopids VALUES (9100,'gm'); -INSERT INTO merchant_shopids VALUES (9101,'gm'); -INSERT INTO merchant_shopids VALUES (9102,'gm'); -INSERT INTO merchant_shopids VALUES (9103,'gm'); -INSERT INTO merchant_shopids VALUES (9104,'gm'); -INSERT INTO merchant_shopids VALUES (9105,'gm'); -INSERT INTO merchant_shopids VALUES (9106,'gm'); -INSERT INTO merchant_shopids VALUES (9107,'gm'); -INSERT INTO merchant_shopids VALUES (9108,'gm'); -INSERT INTO merchant_shopids VALUES (9109,'gm'); -INSERT INTO merchant_shopids VALUES (9110,'gm'); -INSERT INTO merchant_shopids VALUES (9111,'gm'); -INSERT INTO merchant_shopids VALUES (9112,'gm'); -INSERT INTO merchant_shopids VALUES (9113,'gm'); -INSERT INTO merchant_shopids VALUES (9114,'gm'); -INSERT INTO merchant_shopids VALUES (9115,'gm'); -INSERT INTO merchant_shopids VALUES (9116,'gm'); -INSERT INTO merchant_shopids VALUES (9117,'gm'); -INSERT INTO merchant_shopids VALUES (9118,'gm'); -INSERT INTO merchant_shopids VALUES (9119,'gm'); -INSERT INTO merchant_shopids VALUES (9120,'gm'); -INSERT INTO merchant_shopids VALUES (9121,'gm'); -INSERT INTO merchant_shopids VALUES (9122,'gm'); -INSERT INTO merchant_shopids VALUES (9123,'gm'); -INSERT INTO merchant_shopids VALUES (9124,'gm'); -INSERT INTO merchant_shopids VALUES (9125,'gm'); -INSERT INTO merchant_shopids VALUES (9126,'gm'); -INSERT INTO merchant_shopids VALUES (9127,'gm'); -INSERT INTO merchant_shopids VALUES (9128,'gm'); -INSERT INTO merchant_shopids VALUES (9148,'gm'); -INSERT INTO merchant_shopids VALUES (9149,'gm'); -INSERT INTO merchant_shopids VALUES (9150,'gm'); -INSERT INTO merchant_shopids VALUES (30040,'gm'); -INSERT INTO merchant_shopids VALUES (30041,'gm'); -INSERT INTO merchant_shopids VALUES (30042,'gm'); -INSERT INTO merchant_shopids VALUES (30043,'gm'); -INSERT INTO merchant_shopids VALUES (30044,'gm'); -INSERT INTO merchant_shopids VALUES (30045,'gm'); -INSERT INTO merchant_shopids VALUES (30046,'gm'); -INSERT INTO merchant_shopids VALUES (30047,'gm'); -INSERT INTO merchant_shopids VALUES (30048,'gm'); -INSERT INTO merchant_shopids VALUES (30049,'gm'); -INSERT INTO merchant_shopids VALUES (30050,'gm'); -INSERT INTO merchant_shopids VALUES (30051,'gm'); -INSERT INTO merchant_shopids VALUES (30052,'gm'); -INSERT INTO merchant_shopids VALUES (30053,'gm'); -INSERT INTO merchant_shopids VALUES (30054,'gm'); -INSERT INTO merchant_shopids VALUES (30055,'gm'); -INSERT INTO merchant_shopids VALUES (30056,'gm'); -INSERT INTO merchant_shopids VALUES (30057,'gm'); -INSERT INTO merchant_shopids VALUES (30058,'gm'); -INSERT INTO merchant_shopids VALUES (30059,'gm'); -INSERT INTO merchant_shopids VALUES (71021,'gm'); -INSERT INTO merchant_shopids VALUES (71022,'gm'); -INSERT INTO merchant_shopids VALUES (71023,'gm'); -INSERT INTO merchant_shopids VALUES (71024,'gm'); -INSERT INTO merchant_shopids VALUES (71025,'gm'); -INSERT INTO merchant_shopids VALUES (71026,'gm'); -INSERT INTO merchant_shopids VALUES (71027,'gm'); -INSERT INTO merchant_shopids VALUES (71028,'gm'); -INSERT INTO merchant_shopids VALUES (71029,'gm'); -INSERT INTO merchant_shopids VALUES (71030,'gm'); -INSERT INTO merchant_shopids VALUES (300523,'gm'); -INSERT INTO merchant_shopids VALUES (300524,'gm'); -INSERT INTO merchant_shopids VALUES (300525,'gm'); -INSERT INTO merchant_shopids VALUES (300526,'gm'); -INSERT INTO merchant_shopids VALUES (300527,'gm'); -INSERT INTO merchant_shopids VALUES (300528,'gm'); -INSERT INTO merchant_shopids VALUES (300529,'gm'); -INSERT INTO merchant_shopids VALUES (300530,'gm'); -INSERT INTO merchant_shopids VALUES (300531,'gm'); -INSERT INTO merchant_shopids VALUES (300532,'gm'); -INSERT INTO merchant_shopids VALUES (300533,'gm'); -INSERT INTO merchant_shopids VALUES (300534,'gm'); -INSERT INTO merchant_shopids VALUES (300535,'gm'); -INSERT INTO merchant_shopids VALUES (300536,'gm'); -INSERT INTO merchant_shopids VALUES (300537,'gm'); -INSERT INTO merchant_shopids VALUES (300538,'gm'); -INSERT INTO merchant_shopids VALUES (300539,'gm'); -INSERT INTO merchant_shopids VALUES (300540,'gm'); -INSERT INTO merchant_shopids VALUES (300541,'gm'); -INSERT INTO merchant_shopids VALUES (300522,'gm'); -INSERT INTO merchant_shopids VALUES (300511,'gm'); -INSERT INTO merchant_shopids VALUES (300510,'gm'); -INSERT INTO merchant_shopids VALUES (300410,'gm'); -INSERT INTO merchant_shopids VALUES (300542,'gm'); -INSERT INTO merchant_shopids VALUES (71031, 'gm'); -INSERT INTO merchant_shopids VALUES (71032, 'gm'); + (1001,'gm'), + (1002,'gm'), + (1003,'gm'), + (1004,'gm'), + (1005,'gm'), + (1006,'gm'), + (1007,'gm'), + (1008,'gm'), + (1009,'gm'), + (1010,'gm'), + (1011,'gm'), + (1012,'gm'), + (1013,'gm'), + (1014,'gm'), + (1015,'gm'), + (1020,'gm'), + (2011,'gm'), + (2012,'gm'), + (2013,'gm'), + (2014,'gm'), + (2015,'gm'), + (3001,'gm'), + (3002,'gm'), + (3003,'gm'), + (9001,'gm'), + (9002,'gm'), + (9003,'gm'), + (9004,'gm'), + (9005,'gm'), + (9006,'gm'), + (9007,'gm'), + (9008,'gm'), + (9009,'gm'), + (9010,'gm'), + (9011,'gm'), + (9012,'gm'), + (9013,'gm'), + (9014,'gm'), + (9015,'gm'), + (9016,'gm'), + (9017,'gm'), + (9018,'gm'), + (9019,'gm'), + (9020,'gm'), + (9021,'gm'), + (9022,'gm'), + (9023,'gm'), + (9024,'gm'), + (9025,'gm'), + (9026,'gm'), + (9027,'gm'), + (9028,'gm'), + (9029,'gm'), + (9030,'gm'), + (9031,'gm'), + (9032,'gm'), + (9033,'gm'), + (9034,'gm'), + (9035,'gm'), + (9036,'gm'), + (9037,'gm'), + (9038,'gm'), + (9039,'gm'), + (9040,'gm'), + (9041,'gm'), + (9042,'gm'), + (9043,'gm'), + (9044,'gm'), + (9045,'gm'), + (9046,'gm'), + (9047,'gm'), + (9048,'gm'), + (9049,'gm'), + (9050,'gm'), + (9051,'gm'), + (9052,'gm'), + (9053,'gm'), + (9054,'gm'), + (9055,'gm'), + (9056,'gm'), + (9057,'gm'), + (9058,'gm'), + (9059,'gm'), + (9060,'gm'), + (9061,'gm'), + (9062,'gm'), + (9063,'gm'), + (9064,'gm'), + (9065,'gm'), + (9066,'gm'), + (9067,'gm'), + (9068,'gm'), + (9069,'gm'), + (9070,'gm'), + (9071,'gm'), + (9072,'gm'), + (9073,'gm'), + (9074,'gm'), + (9075,'gm'), + (9076,'gm'), + (9077,'gm'), + (9078,'gm'), + (9079,'gm'), + (9080,'gm'), + (9081,'gm'), + (9082,'gm'), + (9083,'gm'), + (9084,'gm'), + (9085,'gm'), + (9086,'gm'), + (9087,'gm'), + (9088,'gm'), + (9089,'gm'), + (9090,'gm'), + (9091,'gm'), + (9092,'gm'), + (9093,'gm'), + (9094,'gm'), + (9095,'gm'), + (9096,'gm'), + (9097,'gm'), + (9098,'gm'), + (9099,'gm'), + (9100,'gm'), + (9101,'gm'), + (9102,'gm'), + (9103,'gm'), + (9104,'gm'), + (9105,'gm'), + (9106,'gm'), + (9107,'gm'), + (9108,'gm'), + (9109,'gm'), + (9110,'gm'), + (9111,'gm'), + (9112,'gm'), + (9113,'gm'), + (9114,'gm'), + (9115,'gm'), + (9116,'gm'), + (9117,'gm'), + (9118,'gm'), + (9119,'gm'), + (9120,'gm'), + (9121,'gm'), + (9122,'gm'), + (9123,'gm'), + (9124,'gm'), + (9125,'gm'), + (9126,'gm'), + (9127,'gm'), + (9128,'gm'), + (9148,'gm'), + (9149,'gm'), + (9150,'gm'), + (30040,'gm'), + (30041,'gm'), + (30042,'gm'), + (30043,'gm'), + (30044,'gm'), + (30045,'gm'), + (30046,'gm'), + (30047,'gm'), + (30048,'gm'), + (30049,'gm'), + (30050,'gm'), + (30051,'gm'), + (30052,'gm'), + (30053,'gm'), + (30054,'gm'), + (30055,'gm'), + (30056,'gm'), + (30057,'gm'), + (30058,'gm'), + (30059,'gm'), + (71021,'gm'), + (71022,'gm'), + (71023,'gm'), + (71024,'gm'), + (71025,'gm'), + (71026,'gm'), + (71027,'gm'), + (71028,'gm'), + (71029,'gm'), + (71030,'gm'), + (300523,'gm'), + (300524,'gm'), + (300525,'gm'), + (300526,'gm'), + (300527,'gm'), + (300528,'gm'), + (300529,'gm'), + (300530,'gm'), + (300531,'gm'), + (300532,'gm'), + (300533,'gm'), + (300534,'gm'), + (300535,'gm'), + (300536,'gm'), + (300537,'gm'), + (300538,'gm'), + (300539,'gm'), + (300540,'gm'), + (300541,'gm'), + (300522,'gm'), + (300511,'gm'), + (300510,'gm'), + (300410,'gm'), + (300542,'gm'), + (71031, 'gm'), + (71032, 'gm'), -- -- Castle -- -INSERT INTO `merchant_shopids` VALUES (335103, '35103'); -INSERT INTO `merchant_shopids` VALUES (335145, '35145'); -INSERT INTO `merchant_shopids` VALUES (335187, '35187'); -INSERT INTO `merchant_shopids` VALUES (335229, '35229'); -INSERT INTO `merchant_shopids` VALUES (335230, '35230'); -INSERT INTO `merchant_shopids` VALUES (335231, '35231'); -INSERT INTO `merchant_shopids` VALUES (335277, '35277'); -INSERT INTO `merchant_shopids` VALUES (335319, '35319'); -INSERT INTO `merchant_shopids` VALUES (335366, '35366'); -INSERT INTO `merchant_shopids` VALUES (335512, '35512'); -INSERT INTO `merchant_shopids` VALUES (335558, '35558'); -INSERT INTO `merchant_shopids` VALUES (335644, '35644'); -INSERT INTO `merchant_shopids` VALUES (335645, '35645'); + (335103, '35103'), + (335145, '35145'), + (335187, '35187'), + (335229, '35229'), + (335230, '35230'), + (335231, '35231'), + (335277, '35277'), + (335319, '35319'), + (335366, '35366'), + (335512, '35512'), + (335558, '35558'), + (335644, '35644'), + (335645, '35645'), -- -- Castles Item creation -- -INSERT INTO merchant_shopids VALUES (351001,'35100'); -INSERT INTO merchant_shopids VALUES (351002,'35100'); -INSERT INTO merchant_shopids VALUES (351421,'35142'); -INSERT INTO merchant_shopids VALUES (351422,'35142'); -INSERT INTO merchant_shopids VALUES (351841,'35184'); -INSERT INTO merchant_shopids VALUES (351842,'35184'); -INSERT INTO merchant_shopids VALUES (352261,'35226'); -INSERT INTO merchant_shopids VALUES (352262,'35226'); -INSERT INTO merchant_shopids VALUES (352741,'35274'); -INSERT INTO merchant_shopids VALUES (352742,'35274'); -INSERT INTO merchant_shopids VALUES (353161,'35316'); -INSERT INTO merchant_shopids VALUES (353162,'35316'); -INSERT INTO merchant_shopids VALUES (353631,'35363'); -INSERT INTO merchant_shopids VALUES (353632,'35363'); -INSERT INTO merchant_shopids VALUES (355091,'35509'); -INSERT INTO merchant_shopids VALUES (355092,'35509'); -INSERT INTO merchant_shopids VALUES (355551,'35555'); -INSERT INTO merchant_shopids VALUES (355552,'35555'); + (351001,'35100'), + (351002,'35100'), + (351421,'35142'), + (351422,'35142'), + (351841,'35184'), + (351842,'35184'), + (352261,'35226'), + (352262,'35226'), + (352741,'35274'), + (352742,'35274'), + (353161,'35316'), + (353162,'35316'), + (353631,'35363'), + (353632,'35363'), + (355091,'35509'), + (355092,'35509'), + (355551,'35555'), + (355552,'35555'), -- -- Clan Halls Item creation -- -INSERT INTO merchant_shopids VALUES (135445, '35445'); -INSERT INTO merchant_shopids VALUES (235445, '35445'); -INSERT INTO merchant_shopids VALUES (335445, '35445'); -INSERT INTO merchant_shopids VALUES (135453, '35453'); -INSERT INTO merchant_shopids VALUES (235453, '35453'); -INSERT INTO merchant_shopids VALUES (335453, '35453'); -INSERT INTO merchant_shopids VALUES (135455, '35455'); -INSERT INTO merchant_shopids VALUES (235455, '35455'); -INSERT INTO merchant_shopids VALUES (335455, '35455'); -INSERT INTO merchant_shopids VALUES (135451, '35451'); -INSERT INTO merchant_shopids VALUES (235451, '35451'); -INSERT INTO merchant_shopids VALUES (335451, '35451'); -INSERT INTO merchant_shopids VALUES (135457, '35457'); -INSERT INTO merchant_shopids VALUES (235457, '35457'); -INSERT INTO merchant_shopids VALUES (335457, '35457'); -INSERT INTO merchant_shopids VALUES (135459, '35459'); -INSERT INTO merchant_shopids VALUES (235459, '35459'); -INSERT INTO merchant_shopids VALUES (335459, '35459'); -INSERT INTO merchant_shopids VALUES (135383, '35383'); -INSERT INTO merchant_shopids VALUES (235383, '35383'); -INSERT INTO merchant_shopids VALUES (335383, '35383'); -INSERT INTO merchant_shopids VALUES (135398, '35398'); -INSERT INTO merchant_shopids VALUES (235398, '35398'); -INSERT INTO merchant_shopids VALUES (335398, '35398'); -INSERT INTO merchant_shopids VALUES (135400, '35400'); -INSERT INTO merchant_shopids VALUES (235400, '35400'); -INSERT INTO merchant_shopids VALUES (335400, '35400'); -INSERT INTO merchant_shopids VALUES (135392, '35392'); -INSERT INTO merchant_shopids VALUES (235392, '35392'); -INSERT INTO merchant_shopids VALUES (335392, '35392'); -INSERT INTO merchant_shopids VALUES (135394, '35394'); -INSERT INTO merchant_shopids VALUES (235394, '35394'); -INSERT INTO merchant_shopids VALUES (335394, '35394'); -INSERT INTO merchant_shopids VALUES (135396, '35396'); -INSERT INTO merchant_shopids VALUES (235396, '35396'); -INSERT INTO merchant_shopids VALUES (335396, '35396'); -INSERT INTO merchant_shopids VALUES (135384, '35384'); -INSERT INTO merchant_shopids VALUES (235384, '35384'); -INSERT INTO merchant_shopids VALUES (335384, '35384'); -INSERT INTO merchant_shopids VALUES (135390, '35390'); -INSERT INTO merchant_shopids VALUES (235390, '35390'); -INSERT INTO merchant_shopids VALUES (335390, '35390'); -INSERT INTO merchant_shopids VALUES (135386, '35386'); -INSERT INTO merchant_shopids VALUES (235386, '35386'); -INSERT INTO merchant_shopids VALUES (335386, '35386'); -INSERT INTO merchant_shopids VALUES (135388, '35388'); -INSERT INTO merchant_shopids VALUES (235388, '35388'); -INSERT INTO merchant_shopids VALUES (335388, '35388'); -INSERT INTO merchant_shopids VALUES (135407, '35407'); -INSERT INTO merchant_shopids VALUES (235407, '35407'); -INSERT INTO merchant_shopids VALUES (335407, '35407'); -INSERT INTO merchant_shopids VALUES (135403, '35403'); -INSERT INTO merchant_shopids VALUES (235403, '35403'); -INSERT INTO merchant_shopids VALUES (335403, '35403'); -INSERT INTO merchant_shopids VALUES (135405, '35405'); -INSERT INTO merchant_shopids VALUES (235405, '35405'); -INSERT INTO merchant_shopids VALUES (335405, '35405'); -INSERT INTO merchant_shopids VALUES (135421, '35421'); -INSERT INTO merchant_shopids VALUES (235421, '35421'); -INSERT INTO merchant_shopids VALUES (335421, '35421'); -INSERT INTO merchant_shopids VALUES (135439, '35439'); -INSERT INTO merchant_shopids VALUES (235439, '35439'); -INSERT INTO merchant_shopids VALUES (335439, '35439'); -INSERT INTO merchant_shopids VALUES (135441, '35441'); -INSERT INTO merchant_shopids VALUES (235441, '35441'); -INSERT INTO merchant_shopids VALUES (335441, '35441'); -INSERT INTO merchant_shopids VALUES (135443, '35443'); -INSERT INTO merchant_shopids VALUES (235443, '35443'); -INSERT INTO merchant_shopids VALUES (335443, '35443'); -INSERT INTO merchant_shopids VALUES (135447, '35447'); -INSERT INTO merchant_shopids VALUES (235447, '35447'); -INSERT INTO merchant_shopids VALUES (335447, '35447'); -INSERT INTO merchant_shopids VALUES (135449, '35449'); -INSERT INTO merchant_shopids VALUES (235449, '35449'); -INSERT INTO merchant_shopids VALUES (335449, '35449'); -INSERT INTO merchant_shopids VALUES (135467, '35467'); -INSERT INTO merchant_shopids VALUES (235467, '35467'); -INSERT INTO merchant_shopids VALUES (335467, '35467'); -INSERT INTO merchant_shopids VALUES (135465, '35465'); -INSERT INTO merchant_shopids VALUES (235465, '35465'); -INSERT INTO merchant_shopids VALUES (335465, '35465'); -INSERT INTO merchant_shopids VALUES (135463, '35463'); -INSERT INTO merchant_shopids VALUES (235463, '35463'); -INSERT INTO merchant_shopids VALUES (335463, '35463'); -INSERT INTO merchant_shopids VALUES (135461, '35461'); -INSERT INTO merchant_shopids VALUES (235461, '35461'); -INSERT INTO merchant_shopids VALUES (335461, '35461'); -INSERT INTO merchant_shopids VALUES (335566, '35566'); -INSERT INTO merchant_shopids VALUES (235566, '35566'); -INSERT INTO merchant_shopids VALUES (135566, '35566'); -INSERT INTO merchant_shopids VALUES (335568, '35568'); -INSERT INTO merchant_shopids VALUES (235568, '35568'); -INSERT INTO merchant_shopids VALUES (135568, '35568'); -INSERT INTO merchant_shopids VALUES (335570, '35570'); -INSERT INTO merchant_shopids VALUES (235570, '35570'); -INSERT INTO merchant_shopids VALUES (135570, '35570'); -INSERT INTO merchant_shopids VALUES (335572, '35572'); -INSERT INTO merchant_shopids VALUES (235572, '35572'); -INSERT INTO merchant_shopids VALUES (135572, '35572'); -INSERT INTO merchant_shopids VALUES (335574, '35574'); -INSERT INTO merchant_shopids VALUES (235574, '35574'); -INSERT INTO merchant_shopids VALUES (135574, '35574'); -INSERT INTO merchant_shopids VALUES (335576, '35576'); -INSERT INTO merchant_shopids VALUES (235576, '35576'); -INSERT INTO merchant_shopids VALUES (135576, '35576'); -INSERT INTO merchant_shopids VALUES (335578, '35578'); -INSERT INTO merchant_shopids VALUES (235578, '35578'); -INSERT INTO merchant_shopids VALUES (135578, '35578'); -INSERT INTO merchant_shopids VALUES (235580, '35580'); -INSERT INTO merchant_shopids VALUES (135580, '35580'); -INSERT INTO merchant_shopids VALUES (335580, '35580'); -INSERT INTO merchant_shopids VALUES (335582, '35582'); -INSERT INTO merchant_shopids VALUES (235582, '35582'); -INSERT INTO merchant_shopids VALUES (135582, '35582'); -INSERT INTO merchant_shopids VALUES (135584, '35584'); -INSERT INTO merchant_shopids VALUES (235584, '35584'); -INSERT INTO merchant_shopids VALUES (335584, '35584'); -INSERT INTO merchant_shopids VALUES (335586, '35586'); -INSERT INTO merchant_shopids VALUES (135586, '35586'); -INSERT INTO merchant_shopids VALUES (235586, '35586'); -INSERT INTO merchant_shopids VALUES (355111, '35511'); -INSERT INTO merchant_shopids VALUES (355571, '35557'); + (135445, '35445'), + (235445, '35445'), + (335445, '35445'), + (135453, '35453'), + (235453, '35453'), + (335453, '35453'), + (135455, '35455'), + (235455, '35455'), + (335455, '35455'), + (135451, '35451'), + (235451, '35451'), + (335451, '35451'), + (135457, '35457'), + (235457, '35457'), + (335457, '35457'), + (135459, '35459'), + (235459, '35459'), + (335459, '35459'), + (135383, '35383'), + (235383, '35383'), + (335383, '35383'), + (135398, '35398'), + (235398, '35398'), + (335398, '35398'), + (135400, '35400'), + (235400, '35400'), + (335400, '35400'), + (135392, '35392'), + (235392, '35392'), + (335392, '35392'), + (135394, '35394'), + (235394, '35394'), + (335394, '35394'), + (135396, '35396'), + (235396, '35396'), + (335396, '35396'), + (135384, '35384'), + (235384, '35384'), + (335384, '35384'), + (135390, '35390'), + (235390, '35390'), + (335390, '35390'), + (135386, '35386'), + (235386, '35386'), + (335386, '35386'), + (135388, '35388'), + (235388, '35388'), + (335388, '35388'), + (135407, '35407'), + (235407, '35407'), + (335407, '35407'), + (135403, '35403'), + (235403, '35403'), + (335403, '35403'), + (135405, '35405'), + (235405, '35405'), + (335405, '35405'), + (135421, '35421'), + (235421, '35421'), + (335421, '35421'), + (135439, '35439'), + (235439, '35439'), + (335439, '35439'), + (135441, '35441'), + (235441, '35441'), + (335441, '35441'), + (135443, '35443'), + (235443, '35443'), + (335443, '35443'), + (135447, '35447'), + (235447, '35447'), + (335447, '35447'), + (135449, '35449'), + (235449, '35449'), + (335449, '35449'), + (135467, '35467'), + (235467, '35467'), + (335467, '35467'), + (135465, '35465'), + (235465, '35465'), + (335465, '35465'), + (135463, '35463'), + (235463, '35463'), + (335463, '35463'), + (135461, '35461'), + (235461, '35461'), + (335461, '35461'), + (335566, '35566'), + (235566, '35566'), + (135566, '35566'), + (335568, '35568'), + (235568, '35568'), + (135568, '35568'), + (335570, '35570'), + (235570, '35570'), + (135570, '35570'), + (335572, '35572'), + (235572, '35572'), + (135572, '35572'), + (335574, '35574'), + (235574, '35574'), + (135574, '35574'), + (335576, '35576'), + (235576, '35576'), + (135576, '35576'), + (335578, '35578'), + (235578, '35578'), + (135578, '35578'), + (235580, '35580'), + (135580, '35580'), + (335580, '35580'), + (335582, '35582'), + (235582, '35582'), + (135582, '35582'), + (135584, '35584'), + (235584, '35584'), + (335584, '35584'), + (335586, '35586'), + (135586, '35586'), + (235586, '35586'), + (355111, '35511'), + (355571, '35557'); diff --git a/Datapack/sql/merchants.sql b/Datapack/sql/merchants.sql index 798bee1c..508bc6b5 100644 --- a/Datapack/sql/merchants.sql +++ b/Datapack/sql/merchants.sql @@ -6,88 +6,88 @@ CREATE TABLE `merchants` ( `npc_id` int(11) NOT NULL default '0', `merchant_area_id` tinyint(4) default NULL, PRIMARY KEY (`npc_id`) -) ENGINE=MyISAM; +); -- -- Dumping data for table `merchants` -- - -INSERT INTO `merchants` VALUES (1030001,1); -INSERT INTO `merchants` VALUES (1030002,1); -INSERT INTO `merchants` VALUES (1030003,1); -INSERT INTO `merchants` VALUES (1030004,1); -INSERT INTO `merchants` VALUES (1030060,6); -INSERT INTO `merchants` VALUES (1030061,6); -INSERT INTO `merchants` VALUES (1030062,6); -INSERT INTO `merchants` VALUES (1030063,6); -INSERT INTO `merchants` VALUES (1030078,7); -INSERT INTO `merchants` VALUES (1030081,9); -INSERT INTO `merchants` VALUES (1030082,9); -INSERT INTO `merchants` VALUES (1030084,9); -INSERT INTO `merchants` VALUES (1030085,9); -INSERT INTO `merchants` VALUES (1030087,9); -INSERT INTO `merchants` VALUES (1030088,9); -INSERT INTO `merchants` VALUES (1030090,9); -INSERT INTO `merchants` VALUES (1030091,9); -INSERT INTO `merchants` VALUES (1030093,9); -INSERT INTO `merchants` VALUES (1030094,9); -INSERT INTO `merchants` VALUES (1030135,1); -INSERT INTO `merchants` VALUES (1030136,1); -INSERT INTO `merchants` VALUES (1030137,1); -INSERT INTO `merchants` VALUES (1030138,1); -INSERT INTO `merchants` VALUES (1030147,1); -INSERT INTO `merchants` VALUES (1030148,1); -INSERT INTO `merchants` VALUES (1030149,1); -INSERT INTO `merchants` VALUES (1030150,1); -INSERT INTO `merchants` VALUES (1030163,11); -INSERT INTO `merchants` VALUES (1030164,11); -INSERT INTO `merchants` VALUES (1030165,11); -INSERT INTO `merchants` VALUES (1030166,11); -INSERT INTO `merchants` VALUES (1030178,10); -INSERT INTO `merchants` VALUES (1030179,10); -INSERT INTO `merchants` VALUES (1030180,10); -INSERT INTO `merchants` VALUES (1030181,10); -INSERT INTO `merchants` VALUES (1030207,3); -INSERT INTO `merchants` VALUES (1030208,3); -INSERT INTO `merchants` VALUES (1030209,3); -INSERT INTO `merchants` VALUES (1030230,8); -INSERT INTO `merchants` VALUES (1030231,8); -INSERT INTO `merchants` VALUES (1030253,4); -INSERT INTO `merchants` VALUES (1030254,4); -INSERT INTO `merchants` VALUES (1030294,4); -INSERT INTO `merchants` VALUES (1030301,8); -INSERT INTO `merchants` VALUES (1030313,3); -INSERT INTO `merchants` VALUES (1030314,3); -INSERT INTO `merchants` VALUES (1030315,3); -INSERT INTO `merchants` VALUES (1030321,4); -INSERT INTO `merchants` VALUES (1030420,2); -INSERT INTO `merchants` VALUES (1030436,5); -INSERT INTO `merchants` VALUES (1030437,5); -INSERT INTO `merchants` VALUES (1030516,1); -INSERT INTO `merchants` VALUES (1030517,1); -INSERT INTO `merchants` VALUES (1030518,1); -INSERT INTO `merchants` VALUES (1030519,1); -INSERT INTO `merchants` VALUES (1030558,1); -INSERT INTO `merchants` VALUES (1030559,1); -INSERT INTO `merchants` VALUES (1030560,1); -INSERT INTO `merchants` VALUES (1030561,1); -INSERT INTO `merchants` VALUES (1030684,8); -INSERT INTO `merchants` VALUES (1030746,8); -INSERT INTO `merchants` VALUES (1030834,12); -INSERT INTO `merchants` VALUES (1030839,13); -INSERT INTO `merchants` VALUES (1030840,13); -INSERT INTO `merchants` VALUES (1030841,13); -INSERT INTO `merchants` VALUES (1030842,13); -INSERT INTO `merchants` VALUES (1035102,14); -INSERT INTO `merchants` VALUES (1035144,14); -INSERT INTO `merchants` VALUES (1035228,14); -INSERT INTO `merchants` VALUES (1035186,14); -INSERT INTO `merchants` VALUES (1035276,14); -INSERT INTO `merchants` VALUES (1035007,14); -INSERT INTO `merchants` VALUES (1031562,1); -INSERT INTO `merchants` VALUES (1031424,1); -INSERT INTO `merchants` VALUES (1031564,1); -INSERT INTO `merchants` VALUES (1031415,1); -INSERT INTO `merchants` VALUES (1031563,1); -INSERT INTO `merchants` VALUES (1031414,1); -INSERT INTO `merchants` VALUES (1031565,1); +INSERT INTO `merchants` VALUES + (1030001,1), + (1030002,1), + (1030003,1), + (1030004,1), + (1030060,6), + (1030061,6), + (1030062,6), + (1030063,6), + (1030078,7), + (1030081,9), + (1030082,9), + (1030084,9), + (1030085,9), + (1030087,9), + (1030088,9), + (1030090,9), + (1030091,9), + (1030093,9), + (1030094,9), + (1030135,1), + (1030136,1), + (1030137,1), + (1030138,1), + (1030147,1), + (1030148,1), + (1030149,1), + (1030150,1), + (1030163,11), + (1030164,11), + (1030165,11), + (1030166,11), + (1030178,10), + (1030179,10), + (1030180,10), + (1030181,10), + (1030207,3), + (1030208,3), + (1030209,3), + (1030230,8), + (1030231,8), + (1030253,4), + (1030254,4), + (1030294,4), + (1030301,8), + (1030313,3), + (1030314,3), + (1030315,3), + (1030321,4), + (1030420,2), + (1030436,5), + (1030437,5), + (1030516,1), + (1030517,1), + (1030518,1), + (1030519,1), + (1030558,1), + (1030559,1), + (1030560,1), + (1030561,1), + (1030684,8), + (1030746,8), + (1030834,12), + (1030839,13), + (1030840,13), + (1030841,13), + (1030842,13), + (1035102,14), + (1035144,14), + (1035228,14), + (1035186,14), + (1035276,14), + (1035007,14), + (1031562,1), + (1031424,1), + (1031564,1), + (1031415,1), + (1031563,1), + (1031414,1), + (1031565,1); diff --git a/Datapack/sql/minions.sql b/Datapack/sql/minions.sql index e69ff9f6..0f27c7e8 100644 --- a/Datapack/sql/minions.sql +++ b/Datapack/sql/minions.sql @@ -9,7 +9,7 @@ CREATE TABLE `minions` ( `amount_min` int(4) NOT NULL default '0', `amount_max` int(4) NOT NULL default '0', PRIMARY KEY (`boss_id`,`minion_id`) -) ENGINE=MyISAM; +); -- -- Dumping data for table `minions` diff --git a/Datapack/sql/mods_wedding.sql b/Datapack/sql/mods_wedding.sql index b35d21fe..156f4b09 100644 --- a/Datapack/sql/mods_wedding.sql +++ b/Datapack/sql/mods_wedding.sql @@ -10,4 +10,4 @@ CREATE TABLE IF NOT EXISTS `mods_wedding` ( `affianceDate` decimal(20,0) default '0', `weddingDate` decimal(20,0) default '0', PRIMARY KEY (`id`) -) ENGINE=MyISAM; +); diff --git a/Datapack/sql/npc.sql b/Datapack/sql/npc.sql index 8782b21e..ec980dad 100644 --- a/Datapack/sql/npc.sql +++ b/Datapack/sql/npc.sql @@ -46,7 +46,7 @@ CREATE TABLE `npc`( `absorb_level` decimal(2,0) default 0, `absorb_type` enum('FULL_PARTY','LAST_HIT','PARTY_ONE_RANDOM') DEFAULT 'LAST_HIT' NOT NULL, PRIMARY KEY (`id`) -) ENGINE=MyISAM; +); -- -- Dumping data for table `npc` -- diff --git a/Datapack/sql/npcskills.sql b/Datapack/sql/npcskills.sql index 8d554e48..f8f6e428 100644 --- a/Datapack/sql/npcskills.sql +++ b/Datapack/sql/npcskills.sql @@ -7,7 +7,7 @@ CREATE TABLE npcskills ( skillid int(11) NOT NULL default '0', level int(11) NOT NULL default '0', PRIMARY KEY (npcid,skillid,level) -) ENGINE=MyISAM; +); -- -- Dumping data for table `npcskills` diff --git a/Datapack/sql/pets_stats.sql b/Datapack/sql/pets_stats.sql index c1206b1d..7de75ad3 100644 --- a/Datapack/sql/pets_stats.sql +++ b/Datapack/sql/pets_stats.sql @@ -27,7 +27,7 @@ CREATE TABLE `pets_stats` ( `mpregen` int(11) NOT NULL default '0', `owner_exp_taken` DECIMAL(3,2) DEFAULT '0' NOT NULL, PRIMARY KEY (`typeID`,`level`) -) ENGINE=MyISAM; +); #---------------------------- # Records for table pets_stats #---------------------------- diff --git a/Datapack/sql/pledge_skill_trees.sql b/Datapack/sql/pledge_skill_trees.sql index d664da5c..02140fdd 100644 --- a/Datapack/sql/pledge_skill_trees.sql +++ b/Datapack/sql/pledge_skill_trees.sql @@ -12,67 +12,68 @@ CREATE TABLE IF NOT EXISTS `pledge_skill_trees` ( -- ---------------------------- -- Records -- ---------------------------- -INSERT INTO `pledge_skill_trees` VALUES ('370', '1', 'Clan Body', '5', 'Clan members Max HP is raised', '500', '8166'); -INSERT INTO `pledge_skill_trees` VALUES ('370', '2', 'Clan Body', '5', 'Clan members Max HP is raised', '500', '8166'); -INSERT INTO `pledge_skill_trees` VALUES ('370', '3', 'Clan Body', '5', 'Clan members Max HP is raised', '500', '8166'); -INSERT INTO `pledge_skill_trees` VALUES ('371', '1', 'Clan Spirit', '6', 'Clan members Max cp is raised', '800', '8169'); -INSERT INTO `pledge_skill_trees` VALUES ('371', '2', 'Clan Spirit', '6', 'Clan members Max cp is raised', '800', '8169'); -INSERT INTO `pledge_skill_trees` VALUES ('371', '3', 'Clan Spirit', '6', 'Clan members Max cp is raised', '800', '8169'); -INSERT INTO `pledge_skill_trees` VALUES ('372', '1', 'Clan Soul', '8', 'Clan members Max MP is raised', '3900', '8172'); -INSERT INTO `pledge_skill_trees` VALUES ('372', '2', 'Clan Soul', '8', 'Clan members Max MP is raised', '3900', '8172'); -INSERT INTO `pledge_skill_trees` VALUES ('372', '3', 'Clan Soul', '8', 'Clan members Max MP is raised', '3900', '8172'); -INSERT INTO `pledge_skill_trees` VALUES ('373', '1', 'Clan Health', '5', 'Clan members HP Regen speed is enhanced', '500', '8166'); -INSERT INTO `pledge_skill_trees` VALUES ('373', '2', 'Clan Health', '5', 'Clan members HP Regen speed is enhanced', '500', '8166'); -INSERT INTO `pledge_skill_trees` VALUES ('373', '3', 'Clan Health', '5', 'Clan members HP Regen speed is enhanced', '500', '8166'); -INSERT INTO `pledge_skill_trees` VALUES ('374', '1', 'Clan Moral', '6', 'Clan members CP Regen speed is enhanced', '900', '8169'); -INSERT INTO `pledge_skill_trees` VALUES ('374', '2', 'Clan Moral', '6', 'Clan members CP Regen speed is enhanced', '900', '8169'); -INSERT INTO `pledge_skill_trees` VALUES ('374', '3', 'Clan Moral', '6', 'Clan members CP Regen speed is enhanced', '900', '8169'); -INSERT INTO `pledge_skill_trees` VALUES ('375', '1', 'Clan Clarity', '8', 'Clan members MP Regen speed is enhanced', '3900', '8172'); -INSERT INTO `pledge_skill_trees` VALUES ('375', '2', 'Clan Clarity', '8', 'Clan members MP Regen speed is enhanced', '3900', '8172'); -INSERT INTO `pledge_skill_trees` VALUES ('375', '3', 'Clan Clarity', '8', 'Clan members MP Regen speed is enhanced', '3900', '8172'); -INSERT INTO `pledge_skill_trees` VALUES ('376', '1', 'Clan Might', '6', 'Clan members P Atk is raised', '1000', '8163'); -INSERT INTO `pledge_skill_trees` VALUES ('376', '2', 'Clan Might', '6', 'Clan members P Atk is raised', '1000', '8163'); -INSERT INTO `pledge_skill_trees` VALUES ('376', '3', 'Clan Might', '6', 'Clan members P Atk is raised', '1000', '8163'); -INSERT INTO `pledge_skill_trees` VALUES ('377', '1', 'Clan Shield', '6', 'Clan members Defence is enhanced', '1000', '8166'); -INSERT INTO `pledge_skill_trees` VALUES ('377', '2', 'Clan Shield', '6', 'Clan members Defence is enhanced', '1000', '8166'); -INSERT INTO `pledge_skill_trees` VALUES ('377', '3', 'Clan Shield', '6', 'Clan members Defence is enhanced', '1000', '8166'); -INSERT INTO `pledge_skill_trees` VALUES ('378', '1', 'Clan Empower', '8', 'Clan members M Atk is raised', '3900', '8172'); -INSERT INTO `pledge_skill_trees` VALUES ('378', '2', 'Clan Empower', '8', 'Clan members M Atk is raised', '3900', '8172'); -INSERT INTO `pledge_skill_trees` VALUES ('378', '3', 'Clan Empower', '8', 'Clan members M Atk is raised', '3900', '8172'); -INSERT INTO `pledge_skill_trees` VALUES ('379', '1', 'Clan Magic Barrier', '5', 'Clan members Magic Resistance is enhanced', '500', '8163'); -INSERT INTO `pledge_skill_trees` VALUES ('379', '2', 'Clan Magic Barrier', '5', 'Clan members Magic Resistance is enhanced', '500', '8163'); -INSERT INTO `pledge_skill_trees` VALUES ('379', '3', 'Clan Magic Barrier', '5', 'Clan members Magic Resistance is enhanced', '500', '8163'); -INSERT INTO `pledge_skill_trees` VALUES ('380', '1', 'Clan Guidance', '7', 'Clan members Accuracy is raised', '1900', '8160'); -INSERT INTO `pledge_skill_trees` VALUES ('380', '2', 'Clan Guidance', '7', 'Clan members Accuracy is raised', '1900', '8160'); -INSERT INTO `pledge_skill_trees` VALUES ('380', '3', 'Clan Guidance', '7', 'Clan members Accuracy is raised', '1900', '8160'); -INSERT INTO `pledge_skill_trees` VALUES ('381', '1', 'Clan Agility', '8', 'Clan members Flee is raised', '4000', '8160'); -INSERT INTO `pledge_skill_trees` VALUES ('381', '2', 'Clan Agility', '8', 'Clan members Flee is raised', '4000', '8160'); -INSERT INTO `pledge_skill_trees` VALUES ('381', '3', 'Clan Agility', '8', 'Clan members Flee is raised', '4000', '8160'); -INSERT INTO `pledge_skill_trees` VALUES ('382', '1', 'Clan Shield Block', '7', 'Clan members Shield Blocking chance enhanced', '800', '8160'); -INSERT INTO `pledge_skill_trees` VALUES ('382', '2', 'Clan Shield Block', '7', 'Clan members Shield Blocking chance enhanced', '800', '8160'); -INSERT INTO `pledge_skill_trees` VALUES ('382', '3', 'Clan Shield Block', '7', 'Clan members Shield Blocking chance enhanced', '800', '8160'); -INSERT INTO `pledge_skill_trees` VALUES ('383', '1', 'Clan Shield Defence', '6', 'Clan members Shield Defence is raised', '800', '8163'); -INSERT INTO `pledge_skill_trees` VALUES ('383', '2', 'Clan Shield Defence', '6', 'Clan members Shield Defence is raised', '800', '8163'); -INSERT INTO `pledge_skill_trees` VALUES ('383', '3', 'Clan Shield Defence', '6', 'Clan members Shield Defence is raised', '800', '8163'); -INSERT INTO `pledge_skill_trees` VALUES ('384', '1', 'Clan Resist Typoon', '7', 'Clan members Resistance against Water / Wind is enhanced', '1800', '8176'); -INSERT INTO `pledge_skill_trees` VALUES ('384', '2', 'Clan Resist Typoon', '7', 'Clan members Resistance against Water / Wind is enhanced', '1800', '8176'); -INSERT INTO `pledge_skill_trees` VALUES ('384', '3', 'Clan Resist Typoon', '7', 'Clan members Resistance against Water / Wind is enhanced', '1800', '8176'); -INSERT INTO `pledge_skill_trees` VALUES ('385', '1', 'Clan Resist Lava', '7', 'Clan members Resistance against Fire / Earth is raised', '1800', '8176'); -INSERT INTO `pledge_skill_trees` VALUES ('385', '2', 'Clan Resist Lava', '7', 'Clan members Resistance against Fire / Earth is raised', '1800', '8176'); -INSERT INTO `pledge_skill_trees` VALUES ('385', '3', 'Clan Resist Lava', '7', 'Clan members Resistance against Fire / Earth is raised', '1800', '8176'); -INSERT INTO `pledge_skill_trees` VALUES ('386', '1', 'Clan Fortitude', '7', 'Clan members Resistance against Shock attack is enhanced', '1000', '8176'); -INSERT INTO `pledge_skill_trees` VALUES ('386', '2', 'Clan Fortitude', '7', 'Clan members Resistance against Shock attack is enhanced', '1000', '8176'); -INSERT INTO `pledge_skill_trees` VALUES ('386', '3', 'Clan Fortitude', '7', 'Clan members Resistance against Shock attack is enhanced', '1000', '8176'); -INSERT INTO `pledge_skill_trees` VALUES ('387', '1', 'Clan Freedom', '7', 'Clan members Resistance against Root magic is raised', '1800', '8176'); -INSERT INTO `pledge_skill_trees` VALUES ('387', '2', 'Clan Freedom', '7', 'Clan members Resistance against Root magic is raised', '1800', '8176'); -INSERT INTO `pledge_skill_trees` VALUES ('387', '3', 'Clan Freedom', '7', 'Clan members Resistance against Root magic is raised', '1800', '8176'); -INSERT INTO `pledge_skill_trees` VALUES ('388', '1', 'Clan Vigilance', '7', 'Clan members Resistance against Sleep magic is raised', '1800', '8176'); -INSERT INTO `pledge_skill_trees` VALUES ('388', '2', 'Clan Vigilance', '7', 'Clan members Resistance against Sleep magic is raised', '1800', '8176'); -INSERT INTO `pledge_skill_trees` VALUES ('388', '3', 'Clan Vigilance', '7', 'Clan members Resistance against Sleep magic is raised', '1800', '8176'); -INSERT INTO `pledge_skill_trees` VALUES ('389', '1', 'Clan Movement', '8', 'Clan members moving speed is raised', '3800', '8175'); -INSERT INTO `pledge_skill_trees` VALUES ('389', '2', 'Clan Movement', '8', 'Clan members moving speed is raised', '3800', '8175'); -INSERT INTO `pledge_skill_trees` VALUES ('389', '3', 'Clan Movement', '8', 'Clan members moving speed is raised', '3800', '8175'); -INSERT INTO `pledge_skill_trees` VALUES ('390', '1', 'Clan Death', '7', 'Clan members exp loss and item drop rate from PK / Monsters is REDUCED', '2200', '8175'); -INSERT INTO `pledge_skill_trees` VALUES ('390', '2', 'Clan Death', '7', 'Clan members exp loss and item drop rate from PK / Monsters is REDUCED', '2200', '8175'); -INSERT INTO `pledge_skill_trees` VALUES ('390', '3', 'Clan Death', '7', 'Clan members exp loss and item drop rate from PK / Monsters is REDUCED', '2200', '8175'); -INSERT INTO `pledge_skill_trees` VALUES ('391', '1', 'Clan Emperium', '5', 'Permission to create Clan leader chat channel.', '0', '8176'); +INSERT INTO `pledge_skill_trees` VALUES + ('370', '1', 'Clan Body', '5', 'Clan members Max HP is raised', '500', '8166'), + ('370', '2', 'Clan Body', '5', 'Clan members Max HP is raised', '500', '8166'), + ('370', '3', 'Clan Body', '5', 'Clan members Max HP is raised', '500', '8166'), + ('371', '1', 'Clan Spirit', '6', 'Clan members Max cp is raised', '800', '8169'), + ('371', '2', 'Clan Spirit', '6', 'Clan members Max cp is raised', '800', '8169'), + ('371', '3', 'Clan Spirit', '6', 'Clan members Max cp is raised', '800', '8169'), + ('372', '1', 'Clan Soul', '8', 'Clan members Max MP is raised', '3900', '8172'), + ('372', '2', 'Clan Soul', '8', 'Clan members Max MP is raised', '3900', '8172'), + ('372', '3', 'Clan Soul', '8', 'Clan members Max MP is raised', '3900', '8172'), + ('373', '1', 'Clan Health', '5', 'Clan members HP Regen speed is enhanced', '500', '8166'), + ('373', '2', 'Clan Health', '5', 'Clan members HP Regen speed is enhanced', '500', '8166'), + ('373', '3', 'Clan Health', '5', 'Clan members HP Regen speed is enhanced', '500', '8166'), + ('374', '1', 'Clan Moral', '6', 'Clan members CP Regen speed is enhanced', '900', '8169'), + ('374', '2', 'Clan Moral', '6', 'Clan members CP Regen speed is enhanced', '900', '8169'), + ('374', '3', 'Clan Moral', '6', 'Clan members CP Regen speed is enhanced', '900', '8169'), + ('375', '1', 'Clan Clarity', '8', 'Clan members MP Regen speed is enhanced', '3900', '8172'), + ('375', '2', 'Clan Clarity', '8', 'Clan members MP Regen speed is enhanced', '3900', '8172'), + ('375', '3', 'Clan Clarity', '8', 'Clan members MP Regen speed is enhanced', '3900', '8172'), + ('376', '1', 'Clan Might', '6', 'Clan members P Atk is raised', '1000', '8163'), + ('376', '2', 'Clan Might', '6', 'Clan members P Atk is raised', '1000', '8163'), + ('376', '3', 'Clan Might', '6', 'Clan members P Atk is raised', '1000', '8163'), + ('377', '1', 'Clan Shield', '6', 'Clan members Defence is enhanced', '1000', '8166'), + ('377', '2', 'Clan Shield', '6', 'Clan members Defence is enhanced', '1000', '8166'), + ('377', '3', 'Clan Shield', '6', 'Clan members Defence is enhanced', '1000', '8166'), + ('378', '1', 'Clan Empower', '8', 'Clan members M Atk is raised', '3900', '8172'), + ('378', '2', 'Clan Empower', '8', 'Clan members M Atk is raised', '3900', '8172'), + ('378', '3', 'Clan Empower', '8', 'Clan members M Atk is raised', '3900', '8172'), + ('379', '1', 'Clan Magic Barrier', '5', 'Clan members Magic Resistance is enhanced', '500', '8163'), + ('379', '2', 'Clan Magic Barrier', '5', 'Clan members Magic Resistance is enhanced', '500', '8163'), + ('379', '3', 'Clan Magic Barrier', '5', 'Clan members Magic Resistance is enhanced', '500', '8163'), + ('380', '1', 'Clan Guidance', '7', 'Clan members Accuracy is raised', '1900', '8160'), + ('380', '2', 'Clan Guidance', '7', 'Clan members Accuracy is raised', '1900', '8160'), + ('380', '3', 'Clan Guidance', '7', 'Clan members Accuracy is raised', '1900', '8160'), + ('381', '1', 'Clan Agility', '8', 'Clan members Flee is raised', '4000', '8160'), + ('381', '2', 'Clan Agility', '8', 'Clan members Flee is raised', '4000', '8160'), + ('381', '3', 'Clan Agility', '8', 'Clan members Flee is raised', '4000', '8160'), + ('382', '1', 'Clan Shield Block', '7', 'Clan members Shield Blocking chance enhanced', '800', '8160'), + ('382', '2', 'Clan Shield Block', '7', 'Clan members Shield Blocking chance enhanced', '800', '8160'), + ('382', '3', 'Clan Shield Block', '7', 'Clan members Shield Blocking chance enhanced', '800', '8160'), + ('383', '1', 'Clan Shield Defence', '6', 'Clan members Shield Defence is raised', '800', '8163'), + ('383', '2', 'Clan Shield Defence', '6', 'Clan members Shield Defence is raised', '800', '8163'), + ('383', '3', 'Clan Shield Defence', '6', 'Clan members Shield Defence is raised', '800', '8163'), + ('384', '1', 'Clan Resist Typoon', '7', 'Clan members Resistance against Water / Wind is enhanced', '1800', '8176'), + ('384', '2', 'Clan Resist Typoon', '7', 'Clan members Resistance against Water / Wind is enhanced', '1800', '8176'), + ('384', '3', 'Clan Resist Typoon', '7', 'Clan members Resistance against Water / Wind is enhanced', '1800', '8176'), + ('385', '1', 'Clan Resist Lava', '7', 'Clan members Resistance against Fire / Earth is raised', '1800', '8176'), + ('385', '2', 'Clan Resist Lava', '7', 'Clan members Resistance against Fire / Earth is raised', '1800', '8176'), + ('385', '3', 'Clan Resist Lava', '7', 'Clan members Resistance against Fire / Earth is raised', '1800', '8176'), + ('386', '1', 'Clan Fortitude', '7', 'Clan members Resistance against Shock attack is enhanced', '1000', '8176'), + ('386', '2', 'Clan Fortitude', '7', 'Clan members Resistance against Shock attack is enhanced', '1000', '8176'), + ('386', '3', 'Clan Fortitude', '7', 'Clan members Resistance against Shock attack is enhanced', '1000', '8176'), + ('387', '1', 'Clan Freedom', '7', 'Clan members Resistance against Root magic is raised', '1800', '8176'), + ('387', '2', 'Clan Freedom', '7', 'Clan members Resistance against Root magic is raised', '1800', '8176'), + ('387', '3', 'Clan Freedom', '7', 'Clan members Resistance against Root magic is raised', '1800', '8176'), + ('388', '1', 'Clan Vigilance', '7', 'Clan members Resistance against Sleep magic is raised', '1800', '8176'), + ('388', '2', 'Clan Vigilance', '7', 'Clan members Resistance against Sleep magic is raised', '1800', '8176'), + ('388', '3', 'Clan Vigilance', '7', 'Clan members Resistance against Sleep magic is raised', '1800', '8176'), + ('389', '1', 'Clan Movement', '8', 'Clan members moving speed is raised', '3800', '8175'), + ('389', '2', 'Clan Movement', '8', 'Clan members moving speed is raised', '3800', '8175'), + ('389', '3', 'Clan Movement', '8', 'Clan members moving speed is raised', '3800', '8175'), + ('390', '1', 'Clan Death', '7', 'Clan members exp loss and item drop rate from PK / Monsters is REDUCED', '2200', '8175'), + ('390', '2', 'Clan Death', '7', 'Clan members exp loss and item drop rate from PK / Monsters is REDUCED', '2200', '8175'), + ('390', '3', 'Clan Death', '7', 'Clan members exp loss and item drop rate from PK / Monsters is REDUCED', '2200', '8175'), + ('391', '1', 'Clan Emperium', '5', 'Permission to create Clan leader chat channel.', '0', '8176'); diff --git a/Datapack/sql/random_spawn_loc.sql b/Datapack/sql/random_spawn_loc.sql index f8daa75f..6d0eff88 100644 --- a/Datapack/sql/random_spawn_loc.sql +++ b/Datapack/sql/random_spawn_loc.sql @@ -6,7 +6,7 @@ CREATE TABLE `random_spawn_loc` ( `z` int(11) NOT NULL default '0', `heading` int(11) NOT NULL default '-1', PRIMARY KEY (`groupId`,`x`,`y`,`z`,`heading`) -) ENGINE=InnoDB; +); -- -- Dumping data for table `l2jdb`.`random_spawn_loc` diff --git a/Datapack/sql/skill_learn.sql b/Datapack/sql/skill_learn.sql index 76ee4ea4..5c53726a 100644 --- a/Datapack/sql/skill_learn.sql +++ b/Datapack/sql/skill_learn.sql @@ -6,7 +6,7 @@ CREATE TABLE skill_learn ( npc_id int(11) NOT NULL default '0', class_id int(11) NOT NULL default '0', PRIMARY KEY (npc_id,class_id) -) ENGINE=MyISAM; +); -- -- Dumping data for table `skill_learn` diff --git a/Datapack/sql/skill_spellbooks.sql b/Datapack/sql/skill_spellbooks.sql index 4502768a..0e3555e6 100644 --- a/Datapack/sql/skill_spellbooks.sql +++ b/Datapack/sql/skill_spellbooks.sql @@ -6,7 +6,7 @@ CREATE TABLE `skill_spellbooks` ( `skill_id` int(11) NOT NULL default '-1', `item_id` int(11) NOT NULL default '-1', KEY `skill_id` (`skill_id`,`item_id`) -) ENGINE=MyISAM; +); -- -- Dumping data for table `skill_spellbooks` diff --git a/Datapack/sql/skill_trees.sql b/Datapack/sql/skill_trees.sql index 5c4d2e94..cf980505 100644 --- a/Datapack/sql/skill_trees.sql +++ b/Datapack/sql/skill_trees.sql @@ -7,7 +7,7 @@ CREATE TABLE skill_trees ( sp int(10) unsigned NOT NULL default '0', min_level int(10) unsigned NOT NULL default '0', PRIMARY KEY (class_id,skill_id,level) -) ENGINE=MyISAM; +); -- -- Dumping data for table `skill_trees` diff --git a/Datapack/sql/spawnlist.sql b/Datapack/sql/spawnlist.sql index 4e800917..66ed965c 100644 --- a/Datapack/sql/spawnlist.sql +++ b/Datapack/sql/spawnlist.sql @@ -19,7 +19,7 @@ CREATE TABLE `spawnlist` ( `periodOfDay` decimal(2,0) default '0', PRIMARY KEY (id), KEY `key_npc_templateid` (`npc_templateid`) -) ENGINE=MyISAM; +); -- -- Dumping data for table `spawnlist` diff --git a/Datapack/sql/teleport.sql b/Datapack/sql/teleport.sql index 61f87495..37722fec 100644 --- a/Datapack/sql/teleport.sql +++ b/Datapack/sql/teleport.sql @@ -11,7 +11,7 @@ CREATE TABLE teleport ( price decimal(6,0) default NULL, fornoble int(1) NOT NULL default '0', PRIMARY KEY (id) -) ENGINE=MyISAM; +); -- -- Dumping data for table `teleport` diff --git a/Datapack/sql/topic.sql b/Datapack/sql/topic.sql index 1f4da098..ad0796b6 100644 --- a/Datapack/sql/topic.sql +++ b/Datapack/sql/topic.sql @@ -10,4 +10,4 @@ CREATE TABLE IF NOT EXISTS `topic` ( `topic_ownerid` int(8) NOT NULL default '0', `topic_type` int(8) NOT NULL default '0', `topic_reply` int(8) NOT NULL default '0' -) ENGINE=MyISAM; +); diff --git a/Datapack/sql/walker_routes.sql b/Datapack/sql/walker_routes.sql index fc25e71a..c7099209 100644 --- a/Datapack/sql/walker_routes.sql +++ b/Datapack/sql/walker_routes.sql @@ -13,7 +13,7 @@ CREATE TABLE `walker_routes` ( `delay` int(9) NOT NULL default '0', `running` tinyint(1) NOT NULL default '0', PRIMARY KEY (`route_id`,`npc_id`,`move_point`) -) DEFAULT CHARSET=utf8; +); -- -- Dumping data for table `walker_routes` diff --git a/Datapack/sql/weapon.sql b/Datapack/sql/weapon.sql index 7f7274bf..5fc53a46 100644 --- a/Datapack/sql/weapon.sql +++ b/Datapack/sql/weapon.sql @@ -42,7 +42,7 @@ CREATE TABLE `weapon` ( `onCrit_skill_lvl` decimal(11,0) NOT NULL default '0', `onCrit_skill_chance` decimal(11,0) NOT NULL default '0', PRIMARY KEY (`item_id`) -) ENGINE=MyISAM; +); -- -- Dumping data for table `weapon` diff --git a/Datapack/sql/zone.sql b/Datapack/sql/zone.sql index 0d6c1d22..d64264c7 100644 --- a/Datapack/sql/zone.sql +++ b/Datapack/sql/zone.sql @@ -15,68 +15,68 @@ CREATE TABLE zone ( taxById INT NOT NULL default 0 ); -insert into zone values (1, 'Arena', 'Giran Arena', 72498, 142271, 73495, 143255, -3774, 0, 0); -insert into zone values (2, 'Arena', 'Gludin Arena', -88410, 142728, -87421, 141730, -3633, 0, 0); -insert into zone values (3, 'Arena', 'Collusieum', 148014, 45304, 150976, 48020, -3410, 0, 0); -insert into zone values (4, 'Arena', 'Monster Track', 11955, 183017, 12937, 184008, -3565, 0, 0); +insert into zone values + (1, 'Arena', 'Giran Arena', 72498, 142271, 73495, 143255, -3774, 0, 0), + (2, 'Arena', 'Gludin Arena', -88410, 142728, -87421, 141730, -3633, 0, 0), + (3, 'Arena', 'Collusieum', 148014, 45304, 150976, 48020, -3410, 0, 0), + (4, 'Arena', 'Monster Track', 11955, 183017, 12937, 184008, -3565, 0, 0), -insert into zone values (1, 'Arena Spawn', 'Giran Arena', 73890, 142656, 0, 0, -3778, 0, 0); -insert into zone values (2, 'Arena Spawn', 'Gludin Arena', -86979, 142402, 0, 0, -3643, 0, 0); -insert into zone values (3, 'Arena Spawn', 'Collusieum', 147451, 46728, 0, 0, -3410, 0, 0); -insert into zone values (4, 'Arena Spawn', 'Monster Track', 12312, 182752, 0, 0, -3558, 0, 0); + (1, 'Arena Spawn', 'Giran Arena', 73890, 142656, 0, 0, -3778, 0, 0), + (2, 'Arena Spawn', 'Gludin Arena', -86979, 142402, 0, 0, -3643, 0, 0), + (3, 'Arena Spawn', 'Collusieum', 147451, 46728, 0, 0, -3410, 0, 0), + (4, 'Arena Spawn', 'Monster Track', 12312, 182752, 0, 0, -3558, 0, 0), -insert into zone values (1, 'Castle Area', 'Gludio', -22615, 104510, -13313, 116950, 0, 0 ,5); -insert into zone values (1, 'Castle Area', 'Gludio', -15500, 116500, -15000, 117000, 0, 0 ,5); -- Tyron (-15172,116723) registers sieges to Gludio -insert into zone values (2, 'Castle Area', 'Dion', 17273, 152800, 26575, 165240, 0, 0 ,5); -insert into zone values (2, 'Castle Area', 'Dion', 19000, 152750, 19500, 153250, 0, 0 ,5); -- Gibbson (19132,153027) registers sieges to Dion -insert into zone values (3, 'Castle Area', 'Giran', 109026, 140571, 121358, 149919, 0, 0 ,5); -insert into zone values (3, 'Castle Area', 'Giran', 107000, 145500, 107500, 146000, 0, 0 ,5); -- Holmes (107386,145807) registers sieges to Giran -insert into zone values (4, 'Castle Area', 'Oren', 75102, 32666, 87434, 42014, 0, 0 ,5); -insert into zone values (4, 'Castle Area', 'Oren', 75000, 40000, 75500, 40500, 0, 0 ,5); -- Sherwood (75275,40132) registers sieges to Oren -insert into zone values (5, 'Castle Area', 'Aden', 142431, 362, 152282, 15197, 0, 0, 0); -insert into zone values (5, 'Castle Area', 'Aden', 147250, 19250, 147750, 19750, 0, 0, 0); -- Ruford (147551,19577) registers sieges to Aden -insert into zone values (6, 'Castle Area', 'Innadril', 111224, 241579, 120526, 254019, 0, 0 ,5); -insert into zone values (6, 'Castle Area', 'Innadril', 117000, 241500, 117500, 242000, 0, 0 ,5); -- Raybell (117136,241763) registers sieges to Innadril -insert into zone values (7, 'Castle Area', 'Goddard', 141457, -51510, 151949, -39107, 0, 0 ,8); -- needs an n-poly to curve around south wall -insert into zone values (7, 'Castle Area', 'Goddard', 154000, -52000, 154500, -51000, 0, 0 ,8); -- Daven (154208,-51648) registers sieges to Goddard -insert into zone values (8, 'Castle Area', 'Rune', 7000, -55500, 27000, -41716, 0, 0, 8); -- needs an n-poly to curve around west & east walls -insert into zone values (8, 'Castle Area', 'Rune', 26750, -49250, 27250, -48750, 0, 0, 8);-- Sherman (27074,-48986) registers sieges to Rune -insert into zone values (9, 'Castle Area', 'Schuttgart', 73000, -156600, 82560, -145920, 0, 0, 8); -- needs an n-poly to curve around south wall -insert into zone values (9, 'Castle Area', 'Schuttgart', 75500, -145250, 76000, -144750, 0, 0, 8); -- Daguerre (75707,-144899) registers sieges to Schuttgart + (1, 'Castle Area', 'Gludio', -22615, 104510, -13313, 116950, 0, 0 ,5), + (1, 'Castle Area', 'Gludio', -15500, 116500, -15000, 117000, 0, 0 ,5), -- Tyron (-15172,116723) registers sieges to Gludio + (2, 'Castle Area', 'Dion', 17273, 152800, 26575, 165240, 0, 0 ,5), + (2, 'Castle Area', 'Dion', 19000, 152750, 19500, 153250, 0, 0 ,5), -- Gibbson (19132,153027) registers sieges to Dion + (3, 'Castle Area', 'Giran', 109026, 140571, 121358, 149919, 0, 0 ,5), + (3, 'Castle Area', 'Giran', 107000, 145500, 107500, 146000, 0, 0 ,5), -- Holmes (107386,145807) registers sieges to Giran + (4, 'Castle Area', 'Oren', 75102, 32666, 87434, 42014, 0, 0 ,5), + (4, 'Castle Area', 'Oren', 75000, 40000, 75500, 40500, 0, 0 ,5), -- Sherwood (75275,40132) registers sieges to Oren + (5, 'Castle Area', 'Aden', 142431, 362, 152282, 15197, 0, 0, 0), + (5, 'Castle Area', 'Aden', 147250, 19250, 147750, 19750, 0, 0, 0), -- Ruford (147551,19577) registers sieges to Aden + (6, 'Castle Area', 'Innadril', 111224, 241579, 120526, 254019, 0, 0 ,5), + (6, 'Castle Area', 'Innadril', 117000, 241500, 117500, 242000, 0, 0 ,5), -- Raybell (117136,241763) registers sieges to Innadril + (7, 'Castle Area', 'Goddard', 141457, -51510, 151949, -39107, 0, 0 ,8), -- needs an n-poly to curve around south wall + (7, 'Castle Area', 'Goddard', 154000, -52000, 154500, -51000, 0, 0 ,8), -- Daven (154208,-51648) registers sieges to Goddard + (8, 'Castle Area', 'Rune', 7000, -55500, 27000, -41716, 0, 0, 8), -- needs an n-poly to curve around west & east walls + (8, 'Castle Area', 'Rune', 26750, -49250, 27250, -48750, 0, 0, 8),-- Sherman (27074,-48986) registers sieges to Rune + (9, 'Castle Area', 'Schuttgart', 73000, -156600, 82560, -145920, 0, 0, 8), -- needs an n-poly to curve around south wall + (9, 'Castle Area', 'Schuttgart', 75500, -145250, 76000, -144750, 0, 0, 8), -- Daguerre (75707,-144899) registers sieges to Schuttgart -- is this even used ??? -- no mention of 'Castle HQ' in ZoneType.java - try commenting out and see what breaks :) -insert into zone values (1, 'Castle HQ', 'Gludio', -20400, 106800, -15700, 113750, 0, 0 ,5); -insert into zone values (2, 'Castle HQ', 'Dion', 19650, 163000, 24350, 155950, 0, 0 ,5); -insert into zone values (3, 'Castle HQ', 'Giran', 119200, 142750, 112200, 147450, 0, 0 ,5); -insert into zone values (4, 'Castle HQ', 'Oren', 85300, 34900, 78100, 39600, 0, 0 ,5); -insert into zone values (5, 'Castle HQ', 'Aden', 144600, 550, 150300, 8550, 0, 0, 0); -insert into zone values (6, 'Castle HQ', 'Innadril', 111975, 241396, 120720, 253425, 0, 0 ,5); -insert into zone values (7, 'Castle HQ', 'Goddard', 142931, -52434, 152986, -41716, 0, 0 ,8); -insert into zone values (8, 'Castle HQ', 'Rune', 7000, -52500, 18493, -45900, -547, 0, 8); -insert into zone values (9, 'Castle HQ', 'Schuttgart', 73694, -156000, 81286, -149400, -700, 1750, 8); + (1, 'Castle HQ', 'Gludio', -20400, 106800, -15700, 113750, 0, 0 ,5), + (2, 'Castle HQ', 'Dion', 19650, 163000, 24350, 155950, 0, 0 ,5), + (3, 'Castle HQ', 'Giran', 119200, 142750, 112200, 147450, 0, 0 ,5), + (4, 'Castle HQ', 'Oren', 85300, 34900, 78100, 39600, 0, 0 ,5), + (5, 'Castle HQ', 'Aden', 144600, 550, 150300, 8550, 0, 0, 0), + (6, 'Castle HQ', 'Innadril', 111975, 241396, 120720, 253425, 0, 0 ,5), + (7, 'Castle HQ', 'Goddard', 142931, -52434, 152986, -41716, 0, 0 ,8), + (8, 'Castle HQ', 'Rune', 7000, -52500, 18493, -45900, -547, 0, 8), + (9, 'Castle HQ', 'Schuttgart', 73694, -156000, 81286, -149400, -700, 1750, 8), -insert into zone values (1, 'Siege Battlefield', 'Gludio', -22615, 104510, -13313, 116950, 0, 0, 0); -insert into zone values (2, 'Siege Battlefield', 'Dion', 17273, 152800, 26575, 165240, 0, 0, 0); -insert into zone values (3, 'Siege Battlefield', 'Giran', 109026, 140571, 121358, 149919, 0, 0, 0); -insert into zone values (4, 'Siege Battlefield', 'Oren', 75102, 32666, 87434, 42014, 0, 0, 0); -insert into zone values (5, 'Siege Battlefield', 'Aden', 142431, 362, 152282, 15197, 0, 0, 0); -insert into zone values (6, 'Siege Battlefield', 'Innadril', 111224, 241579, 120526, 254019, 0, 0, 0); -insert into zone values (7, 'Siege Battlefield', 'Goddard', 141457, -51510, 151949, -39107, 0, 0, 0); -- should be an n-poly -insert into zone values (8, 'Siege Battlefield', 'Rune', 7000, -55500, 27000, -41716, 0, 0, 0); -- need official info -insert into zone values (9, 'Siege Battlefield', 'Schuttgart', 73000, -156600, 82560, -145920, 0, 0, 0); -- need official info + (1, 'Siege Battlefield', 'Gludio', -22615, 104510, -13313, 116950, 0, 0, 0), + (2, 'Siege Battlefield', 'Dion', 17273, 152800, 26575, 165240, 0, 0, 0), + (3, 'Siege Battlefield', 'Giran', 109026, 140571, 121358, 149919, 0, 0, 0), + (4, 'Siege Battlefield', 'Oren', 75102, 32666, 87434, 42014, 0, 0, 0), + (5, 'Siege Battlefield', 'Aden', 142431, 362, 152282, 15197, 0, 0, 0), + (6, 'Siege Battlefield', 'Innadril', 111224, 241579, 120526, 254019, 0, 0, 0), + (7, 'Siege Battlefield', 'Goddard', 141457, -51510, 151949, -39107, 0, 0, 0), -- should be an n-poly + (8, 'Siege Battlefield', 'Rune', 7000, -55500, 27000, -41716, 0, 0, 0), -- need official info + (9, 'Siege Battlefield', 'Schuttgart', 73000, -156600, 82560, -145920, 0, 0, 0), -- need official info -insert into zone values (1, 'Castle Defender Spawn', 'Gludio', -18105, 110303, 0, 0, -2146, 0, 0); -insert into zone values (2, 'Castle Defender Spawn', 'Dion', 22080, 159450, 0, 0, -2441, 0, 0); -insert into zone values (3, 'Castle Defender Spawn', 'Giran', 115621, 145097, 0, 0, -2214, 0, 0); -insert into zone values (4, 'Castle Defender Spawn', 'Oren', 81707, 37208, 0, 0, -1941, 0, 0); -insert into zone values (5, 'Castle Defender Spawn', 'Aden', 147456, 6048, 0, 0, 253, 0, 0); -insert into zone values (6, 'Castle Defender Spawn', 'Innadril', 116025, 248229, 0, 0, -536, 0, 0); -insert into zone values (7, 'Castle Defender Spawn', 'Goddard', 147408, -46448, 0, 0, -963, 0, 0); -insert into zone values (8, 'Castle Defender Spawn', 'Rune', 11388, -49160, 0, 0, -537, 0, 0); -insert into zone values (9, 'Castle Defender Spawn', 'Schuttgart', 77524, -152709, 0, 0, -545, 0, 0); + (1, 'Castle Defender Spawn', 'Gludio', -18105, 110303, 0, 0, -2146, 0, 0), + (2, 'Castle Defender Spawn', 'Dion', 22080, 159450, 0, 0, -2441, 0, 0), + (3, 'Castle Defender Spawn', 'Giran', 115621, 145097, 0, 0, -2214, 0, 0), + (4, 'Castle Defender Spawn', 'Oren', 81707, 37208, 0, 0, -1941, 0, 0), + (5, 'Castle Defender Spawn', 'Aden', 147456, 6048, 0, 0, 253, 0, 0), + (6, 'Castle Defender Spawn', 'Innadril', 116025, 248229, 0, 0, -536, 0, 0), + (7, 'Castle Defender Spawn', 'Goddard', 147408, -46448, 0, 0, -963, 0, 0), + (8, 'Castle Defender Spawn', 'Rune', 11388, -49160, 0, 0, -537, 0, 0), + (9, 'Castle Defender Spawn', 'Schuttgart', 77524, -152709, 0, 0, -545, 0, 0), -INSERT INTO zone VALUES (21, 'Clan Hall', 'Partisan Hideaway', 43151, 108377, 43648, 109399, -1980,0, 1), (22, 'Clan Hall', 'Gludio 1', -16400, 123275, -15551, 123850, -3101, 0, 1), (23, 'Clan Hall', 'Gludio 2', -15100, 125350, -14800, 125800, -3128, 0, 1), @@ -121,294 +121,294 @@ INSERT INTO zone VALUES (58, 'Clan Hall', 'Schuttgart 1', 85426, -143448, 86069, -142769, -1328, 0, 8), (59, 'Clan Hall', 'Schuttgart 2', 86162, -142094, 87003, -141727, -1328, 0, 8), (60, 'Clan Hall', 'Schuttgart 3', 88600, -142111, 87724, -141750, -1328, 0, 8), - (61, 'Clan Hall', 'Schuttgart 4', 88500, -143500, 89500, -142880, -1328, 0, 8); + (61, 'Clan Hall', 'Schuttgart 4', 88500, -143500, 89500, -142880, -1328, 0, 8), -- ------------------------------- -- Other Clan Halls (these are not correct, but just to avoid NPEs) -- ------------------------------- -INSERT INTO zone (id, type, name, x1, y1, x2, y2, z, taxById) VALUES - (34, "Clan Hall", "Devastated Castle", 0, 0, 0, 0, 0, 0), - (62, "Clan Hall", "Hot Springs Guild House", 141414, -124508, 140590, -124706, -1896, 1), - (63, "Clan Hall", "Beast Farm", 0, 0, 0, 0, 0, 0), - (64, "Clan Hall", "Fortress of the Dead", 0, 0, 0, 0, 0, 0); + (34, 'Clan Hall', 'Devastated Castle', 0, 0, 0, 0, 0, 0, 0), + (62, 'Clan Hall', 'Hot Springs Guild House', 141414, -124508, 140590, -124706, -1896, 1, 0), + (63, 'Clan Hall', 'Beast Farm', 0, 0, 0, 0, 0, 0, 0), + (64, 'Clan Hall', 'Fortress of the Dead', 0, 0, 0, 0, 0, 0, 0), +-- ------------------------- + + (1, 'Peace', 'Giran Arena', 72249, 142018, 72498, 143510, -3774, 0, 0), + (1, 'Peace', 'Giran Arena', 73495, 142018, 73738, 143510, -3774, 0, 0), + (1, 'Peace', 'Giran Arena', 72498, 142018, 73495, 142271, -3774, 0, 0), + (1, 'Peace', 'Giran Arena', 72498, 143255, 73495, 143510, -3774, 0, 0), + (2, 'Peace', 'Gudin Arena', -88654, 141479, -88410, 142960, -3648, 0, 0), + (2, 'Peace', 'Gudin Arena', -87421, 141479, -87172, 142960, -3648, 0, 0), + (2, 'Peace', 'Gudin Arena', -88410, 141479, -87421, 141728, -3648, 0, 0), + (2, 'Peace', 'Gudin Arena', -88410, 142715, -87421, 142960, -3648, 0, 0), + (3, 'Peace', 'Collusieum', 147117, 46230, 148014, 47217, -3410, 0, 0), + (3, 'Peace', 'Collusieum', 147771, 45304, 148014, 46230, -3410, 0, 0), + (3, 'Peace', 'Collusieum', 147771, 47217, 148014, 48020, -3410, 0, 0), + (3, 'Peace', 'Collusieum', 150976, 46228, 151885, 47217, -3410, 0, 0), + (3, 'Peace', 'Collusieum', 150976, 45304, 151218, 46228, -3410, 0, 0), + (3, 'Peace', 'Collusieum', 150976, 47217, 151218, 48020, -3410, 0, 0), + (4, 'Peace', 'Monster Track', 11703, 181289, 14574, 183017, -3564, 0, 0), + (4, 'Peace', 'Monster Track', 11703, 183017, 11955, 184260, -3564, 0, 0), + (4, 'Peace', 'Monster Track', 11955, 184008, 12937, 184260, -3564, 0, 0), + (4, 'Peace', 'Monster Track', 12937, 183017, 13192, 184260, -3564, 0, 0), -insert into zone values (1, 'Peace', 'Giran Arena', 72249, 142018, 72498, 143510, -3774, 0, 0); -insert into zone values (1, 'Peace', 'Giran Arena', 73495, 142018, 73738, 143510, -3774, 0, 0); -insert into zone values (1, 'Peace', 'Giran Arena', 72498, 142018, 73495, 142271, -3774, 0, 0); -insert into zone values (1, 'Peace', 'Giran Arena', 72498, 143255, 73495, 143510, -3774, 0, 0); -insert into zone values (2, 'Peace', 'Gudin Arena', -88654, 141479, -88410, 142960, -3648, 0, 0); -insert into zone values (2, 'Peace', 'Gudin Arena', -87421, 141479, -87172, 142960, -3648, 0, 0); -insert into zone values (2, 'Peace', 'Gudin Arena', -88410, 141479, -87421, 141728, -3648, 0, 0); -insert into zone values (2, 'Peace', 'Gudin Arena', -88410, 142715, -87421, 142960, -3648, 0, 0); -insert into zone values (3, 'Peace', 'Collusieum', 147117, 46230, 148014, 47217, -3410, 0, 0); -insert into zone values (3, 'Peace', 'Collusieum', 147771, 45304, 148014, 46230, -3410, 0, 0); -insert into zone values (3, 'Peace', 'Collusieum', 147771, 47217, 148014, 48020, -3410, 0, 0); -insert into zone values (3, 'Peace', 'Collusieum', 150976, 46228, 151885, 47217, -3410, 0, 0); -insert into zone values (3, 'Peace', 'Collusieum', 150976, 45304, 151218, 46228, -3410, 0, 0); -insert into zone values (3, 'Peace', 'Collusieum', 150976, 47217, 151218, 48020, -3410, 0, 0); -insert into zone values (4, 'Peace', 'Monster Track', 11703, 181289, 14574, 183017, -3564, 0, 0); -insert into zone values (4, 'Peace', 'Monster Track', 11703, 183017, 11955, 184260, -3564, 0, 0); -insert into zone values (4, 'Peace', 'Monster Track', 11955, 184008, 12937, 184260, -3564, 0, 0); -insert into zone values (4, 'Peace', 'Monster Track', 12937, 183017, 13192, 184260, -3564, 0, 0); + (1, 'Town', 'DE Village', 6063, 19664, 17248, 14019, 0,0, 4), + (2, 'Town', 'Talking Island', -87312, 240096, -81129, 246345, 0,0, 1), + (3, 'Town', 'Elven Village', 48294, 52995, 42402, 46155, 0,0, 4), + (4, 'Town', 'Orc Village', -42078, -109785, -47648, -117366, 0,0, 8), + (5, 'Town', 'Gludin Village', -84892, 149075, -76820, 156125, 0,0, 1), + (6, 'Town', 'Dwarven Village', 117395, -176766, 114650, -184347, 0,0, 8), + (7, 'Town', 'Gludio Castle Town', -11853, 126610, -16652, 121003, 0,0, 1), + (8, 'Town', 'Dion Castle Town', 15300, 141609, 21570, 147635, 0,0, 2), + (9, 'Town', 'Giran Castle Town', 76995, 141424, 90565, 153614, 0,0, 3), + (10, 'Town', 'Town of Oren', 76696, 57199, 84511, 50120, 0,0, 4), + (11, 'Town', 'Hunter Village', 121308, 73941, 114667, 80383, 0,0, 5), + (12, 'Town', 'Town of Aden', 142312, 32317, 152163, 19708, 0,0, 5), + (13, 'Town', 'Goddard', 143444, -59854, 152043, -51601, 0,0, 7), + (14, 'Town', 'Rune Castle Town', 47150, -44815, 32531, -52045, 0,0, 8), + (15, 'Town', 'Heine', 103598, 216010, 118991, 225905, 0,0, 6), + (16, 'Town', 'Floran Village', 0, 0, 0, 0, 0,0, 2), + (17, 'Town', 'Schuttgart', 83881, -146500, 90908, -139486, 0, 0, 9), + (18, 'Town', 'Ivory Tower', 0, 0, 0, 0, 0, 0, 4), -insert into zone values (1, 'Town', 'DE Village', 6063, 19664, 17248, 14019, 0,0, 4); -insert into zone values (2, 'Town', 'Talking Island', -87312, 240096, -81129, 246345, 0,0, 1); -insert into zone values (3, 'Town', 'Elven Village', 48294, 52995, 42402, 46155, 0,0, 4); -insert into zone values (4, 'Town', 'Orc Village', -42078, -109785, -47648, -117366, 0,0, 8); -insert into zone values (5, 'Town', 'Gludin Village', -84892, 149075, -76820, 156125, 0,0, 1); -insert into zone values (6, 'Town', 'Dwarven Village', 117395, -176766, 114650, -184347, 0,0, 8); -insert into zone values (7, 'Town', 'Gludio Castle Town', -11853, 126610, -16652, 121003, 0,0, 1); -insert into zone values (8, 'Town', 'Dion Castle Town', 15300, 141609, 21570, 147635, 0,0, 2); -insert into zone values (9, 'Town', 'Giran Castle Town', 76995, 141424, 90565, 153614, 0,0, 3); -insert into zone values (10, 'Town', 'Town of Oren', 76696, 57199, 84511, 50120, 0,0, 4); -insert into zone values (11, 'Town', 'Hunter Village', 121308, 73941, 114667, 80383, 0,0, 5); -insert into zone values (12, 'Town', 'Town of Aden', 142312, 32317, 152163, 19708, 0,0, 5); -insert into zone values (13, 'Town', 'Goddard', 143444, -59854, 152043, -51601, 0,0, 7); -insert into zone values (14, 'Town', 'Rune Castle Town', 47150, -44815, 32531, -52045, 0,0, 8); -insert into zone values (15, 'Town', 'Heine', 103598, 216010, 118991, 225905, 0,0, 6); -insert into zone values (16, 'Town', 'Floran Village', 0, 0, 0, 0, 0,0, 2); -insert into zone values (17, 'Town', 'Schuttgart', 83881, -146500, 90908, -139486, 0, 0, 9); -insert into zone values (18, 'Town', 'Ivory Tower', 0, 0, 0, 0, 0, 0, 4); + (1, 'Town Spawn', 'DE Village', 12181, 16675, 0, 0, -4580,0, 0), + (2, 'Town Spawn', 'Talking Island', -84176, 243382, 0, 0, -3126,0, 0), + (3, 'Town Spawn', 'Elven Village', 45525, 48376, 0, 0, -3059,0, 0), + (4, 'Town Spawn', 'Orc Village', -45232, -113603, 0, 0, -224,0, 0), + (5, 'Town Spawn', 'Gludin Village', -82856, 150901, 0, 0, -3128,0, 0), + (6, 'Town Spawn', 'Dwarven Village', 115074, -178115, 0, 0, -880,0, 0), + (7, 'Town Spawn', 'Gludio Castle Town', -14138, 122042, 0, 0, -2988,0, 0), + (8, 'Town Spawn', 'Dion Castle Town', 18823, 145048, 0, 0, -3126,0, 0), + (9, 'Town Spawn', 'Giran Castle Town', 81236, 148638, 0, 0, -3469, 0, 0), + (10, 'Town Spawn', 'Town of Oren', 80853, 54653, 0, 0, -1524,0, 0), + (11, 'Town Spawn', 'Hunter Village', 117163, 76511, 0, 0, -2712,0, 0), + (12, 'Town Spawn', 'Town of Aden', 147391, 25967, 0, 0, -2012,0, 0), + (13, 'Town Spawn', 'Goddard', 148558, -56030, 0, 0, -2781,0, 0), + (14, 'Town Spawn', 'Rune Castle Town', 43894, -48330, 0, 0, -797, 0, 0), + (15, 'Town Spawn', 'Heine', 111381, 219064, 0, 0, -3543,0, 0), + (16, 'Town Spawn', 'Floran Village', 17817, 170079, 0, 0, -3530,0, 0), + (17, 'Town Spawn', 'Schuttgart', 87331, -142842, 0, 0, -1317, 0, 0), + (18, 'Town Spawn', 'Ivory Tower', 0, 0, 0, 0, 0, 0, 0), -insert into zone values (1, 'Town Spawn', 'DE Village', 12181, 16675, 0, 0, -4580,0, 0); -insert into zone values (2, 'Town Spawn', 'Talking Island', -84176, 243382, 0, 0, -3126,0, 0); -insert into zone values (3, 'Town Spawn', 'Elven Village', 45525, 48376, 0, 0, -3059,0, 0); -insert into zone values (4, 'Town Spawn', 'Orc Village', -45232, -113603, 0, 0, -224,0, 0); -insert into zone values (5, 'Town Spawn', 'Gludin Village', -82856, 150901, 0, 0, -3128,0, 0); -insert into zone values (6, 'Town Spawn', 'Dwarven Village', 115074, -178115, 0, 0, -880,0, 0); -insert into zone values (7, 'Town Spawn', 'Gludio Castle Town', -14138, 122042, 0, 0, -2988,0, 0); -insert into zone values (8, 'Town Spawn', 'Dion Castle Town', 18823, 145048, 0, 0, -3126,0, 0); -insert into zone values (9, 'Town Spawn', 'Giran Castle Town', 81236, 148638, 0, 0, -3469, 0, 0); -insert into zone values (10, 'Town Spawn', 'Town of Oren', 80853, 54653, 0, 0, -1524,0, 0); -insert into zone values (11, 'Town Spawn', 'Hunter Village', 117163, 76511, 0, 0, -2712,0, 0); -insert into zone values (12, 'Town Spawn', 'Town of Aden', 147391, 25967, 0, 0, -2012,0, 0); -insert into zone values (13, 'Town Spawn', 'Goddard', 148558, -56030, 0, 0, -2781,0, 0); -insert into zone values (14, 'Town Spawn', 'Rune Castle Town', 43894, -48330, 0, 0, -797, 0, 0); -insert into zone values (15, 'Town Spawn', 'Heine', 111381, 219064, 0, 0, -3543,0, 0); -insert into zone values (16, 'Town Spawn', 'Floran Village', 17817, 170079, 0, 0, -3530,0, 0); -insert into zone values (17, 'Town Spawn', 'Schuttgart', 87331, -142842, 0, 0, -1317, 0, 0); -insert into zone values (18, 'Town Spawn', 'Ivory Tower', 0, 0, 0, 0, 0, 0, 0); + (1, 'Underground', 'Ascetics Necropolis', 0, 0, 0, 0, -4844, 0, 0), + (2, 'Underground', 'Elven Ruins', 43100, 246500, 49400, 249200, -6614, 0, 0), + (3, 'Underground', 'School of Dark Arts', -49800, 56879, -35311, 43790, -6000, 0, 0), + (4, 'Underground', 'School of Dark Arts', -47150, 41782, -54659, 53065, -6000, 0, 0), + (5, 'Underground', 'School of Dark Arts', -38741, 55152, -55186, 62474, -6000, 0, 0), + (6, 'Underground', 'Ants Nest', 917, 165166, -45452, 201937, -6000, 0, 0), + (7, 'Underground', 'Elven Fortress', 6068, 88790, 36734, 69188, -6000, 0, 0), + (8, 'Underground', 'Ivory Tower', 76563, 27040, 98577, 7238, -6000, 0, 0), + (9, 'Underground', 'Hunter Village', 123457, 68112, 98542, 92245, -6000, 0, 0), + (10, 'Underground', 'DE Village', 34061, 8905, -7877, 26384, -6000, 0, 0), + (11, 'Underground', 'Ruins of Despair', -1231, 131977, -31364, 160147, -5000, 0, 0), + (12, 'Underground', 'Gludin North Road', -77276, 134858, -69590, 120547, -5000, 0, 0), + (13, 'Underground', '', 38116, 147264, -69590, 120547, -5000, 0, 0), -insert into zone values (1, 'Underground', 'Ascetics Necropolis', 0, 0, 0, 0, -4844, 0, 0); -insert into zone values (2, 'Underground', 'Elven Ruins', 43100, 246500, 49400, 249200, -6614, 0, 0); -insert into zone values (3, 'Underground', 'School of Dark Arts', -49800, 56879, -35311, 43790, -6000, 0, 0); -insert into zone values (4, 'Underground', 'School of Dark Arts', -47150, 41782, -54659, 53065, -6000, 0, 0); -insert into zone values (5, 'Underground', 'School of Dark Arts', -38741, 55152, -55186, 62474, -6000, 0, 0); -insert into zone values (6, 'Underground', 'Ants Nest', 917, 165166, -45452, 201937, -6000, 0, 0); -insert into zone values (7, 'Underground', 'Elven Fortress', 6068, 88790, 36734, 69188, -6000, 0, 0); -insert into zone values (8, 'Underground', 'Ivory Tower', 76563, 27040, 98577, 7238, -6000, 0, 0); -insert into zone values (9, 'Underground', 'Hunter Village', 123457, 68112, 98542, 92245, -6000, 0, 0); -insert into zone values (10, 'Underground', 'DE Village', 34061, 8905, -7877, 26384, -6000, 0, 0); -insert into zone values (11, 'Underground', 'Ruins of Despair', -1231, 131977, -31364, 160147, -5000, 0, 0); -insert into zone values (12, 'Underground', 'Gludin North Road', -77276, 134858, -69590, 120547, -5000, 0, 0); -insert into zone values (13, 'Underground', '', 38116, 147264, -69590, 120547, -5000, 0, 0); + (1, 'Water', 'Ascetics Necropolis', -56190, 78595, -55175, 79600, -3061, 0, 0), + (169, 'Fishing', 'Giran North Entrance1', 82480, 143048, 83321, 141782, 0, 0, 0), + (170, 'Fishing', 'Giran North Entrance2', 82109, 142550, 82211, 142149, 0, 0, 0), + (171, 'Fishing', 'Giran North Entrance3', 82235, 141780, 82700, 142718, 0, 0, 0), + (1, 'No Landing', 'ToI', 109448, 10233, 118547, 21446, 0, 0, 0), -insert into zone values (1, 'Water', 'Ascetics Necropolis', -56190, 78595, -55175, 79600, -3061, 0, 0); -insert into zone values (169, 'Fishing', 'Giran North Entrance1', 82480, 143048, 83321, 141782, 0, 0, 0); -insert into zone values (170, 'Fishing', 'Giran North Entrance2', 82109, 142550, 82211, 142149, 0, 0, 0); -insert into zone values (171, 'Fishing', 'Giran North Entrance3', 82235, 141780, 82700, 142718, 0, 0, 0); -insert into zone values (1, 'No Landing', 'ToI', 109448, 10233, 118547, 21446, 0, 0, 0); + (1, 'Jail', 'GM Jail', -115600, -250700, -113500, -248200, 0, 0, 0), + (1, 'Monster Derby Track', 'Monster Derby Track', 11600, 181200, 14600, 184500, -3565, 0, 0), -insert into zone values (1, 'Jail', 'GM Jail', -115600, -250700, -113500, -248200, 0, 0, 0); -insert into zone values (1, 'Monster Derby Track', 'Monster Derby Track', 11600, 181200, 14600, 184500, -3565, 0, 0); -insert into zone values -(1, "Olympiad Stadia", "Stadia 1",-19627, -19712, -22024, -22322, -3026, 0, 0), -(2, "Olympiad Stadia", "Stadia 2",-119100, -223705, -121484, -226316, -3331, 0, 0), -(3, "Olympiad Stadia", "Stadia 3",-103690, -210300, -101325, -207724, -3331, 0, 0), -(4, "Olympiad Stadia", "Stadia 4",-119079, -206078, -121438, -208668, -3331, 0, 0), -(5, "Olympiad Stadia", "Stadia 5",-88700, -226280, -86351, -223722, -3331, 0, 0), -(6, "Olympiad Stadia", "Stadia 6",-80586, -211911, -82939, -214487, -3331, 0, 0), -(7, "Olympiad Stadia", "Stadia 7",-88659, -208652, -86297, -206075, -3331, 0, 0), -(8, "Olympiad Stadia", "Stadia 8",-95000, -219531, -92632, -216950, -3331, 0, 0), -(9, "Olympiad Stadia", "Stadia 9",-75936, -217408, -78306, -220017, -3331, 0, 0), -(10, "Olympiad Stadia", "Stadia 10",-68560, -207718, -70933, -210312, -3331, 0, 0), -(11, "Olympiad Stadia", "Stadia 11",-78008, -202528, -75663, -199943, -3331, 0, 0), -(12, "Olympiad Stadia", "Stadia 12",-108690, -217403, -111072, -220023, -3331, 0, 0), -(13, "Olympiad Stadia", "Stadia 13",-127766, -219555, -125394, -216946, -3331, 0, 0), -(14, "Olympiad Stadia", "Stadia 14",-108428, -199935, -110796, -202541, -3331, 0, 0), -(15, "Olympiad Stadia", "Stadia 15",-88677, -241444, -86294, -238836, -3331, 0, 0), -(16, "Olympiad Stadia", "Stadia 16",-82938, -247261, -80580, -244668, -3331, 0, 0), -(17, "Olympiad Stadia", "Stadia 17",-75930, -250175, -78298, -252779, -3331, 0, 0), -(18, "Olympiad Stadia", "Stadia 18",-70920, -243079, -68547, -240473, -3331, 0, 0), -(19, "Olympiad Stadia", "Stadia 19",-75670, -232712, -78027, -235326, -3331, 0, 0), -(20, "Olympiad Stadia", "Stadia 20",-92632, -249706, -94999, -252316, -3331, 0, 0), -(21, "Olympiad Stadia", "Stadia 21",-87816, -254280, -86332, -256466, -3331, 0, 0), -(22, "Olympiad Stadia", "Stadia 22",-113332, -211881, -115713, -214513, -3331, 0, 0); +(1, 'Olympiad Stadia', 'Stadia 1',-19627, -19712, -22024, -22322, -3026, 0, 0), +(2, 'Olympiad Stadia', 'Stadia 2',-119100, -223705, -121484, -226316, -3331, 0, 0), +(3, 'Olympiad Stadia', 'Stadia 3',-103690, -210300, -101325, -207724, -3331, 0, 0), +(4, 'Olympiad Stadia', 'Stadia 4',-119079, -206078, -121438, -208668, -3331, 0, 0), +(5, 'Olympiad Stadia', 'Stadia 5',-88700, -226280, -86351, -223722, -3331, 0, 0), +(6, 'Olympiad Stadia', 'Stadia 6',-80586, -211911, -82939, -214487, -3331, 0, 0), +(7, 'Olympiad Stadia', 'Stadia 7',-88659, -208652, -86297, -206075, -3331, 0, 0), +(8, 'Olympiad Stadia', 'Stadia 8',-95000, -219531, -92632, -216950, -3331, 0, 0), +(9, 'Olympiad Stadia', 'Stadia 9',-75936, -217408, -78306, -220017, -3331, 0, 0), +(10, 'Olympiad Stadia', 'Stadia 10',-68560, -207718, -70933, -210312, -3331, 0, 0), +(11, 'Olympiad Stadia', 'Stadia 11',-78008, -202528, -75663, -199943, -3331, 0, 0), +(12, 'Olympiad Stadia', 'Stadia 12',-108690, -217403, -111072, -220023, -3331, 0, 0), +(13, 'Olympiad Stadia', 'Stadia 13',-127766, -219555, -125394, -216946, -3331, 0, 0), +(14, 'Olympiad Stadia', 'Stadia 14',-108428, -199935, -110796, -202541, -3331, 0, 0), +(15, 'Olympiad Stadia', 'Stadia 15',-88677, -241444, -86294, -238836, -3331, 0, 0), +(16, 'Olympiad Stadia', 'Stadia 16',-82938, -247261, -80580, -244668, -3331, 0, 0), +(17, 'Olympiad Stadia', 'Stadia 17',-75930, -250175, -78298, -252779, -3331, 0, 0), +(18, 'Olympiad Stadia', 'Stadia 18',-70920, -243079, -68547, -240473, -3331, 0, 0), +(19, 'Olympiad Stadia', 'Stadia 19',-75670, -232712, -78027, -235326, -3331, 0, 0), +(20, 'Olympiad Stadia', 'Stadia 20',-92632, -249706, -94999, -252316, -3331, 0, 0), +(21, 'Olympiad Stadia', 'Stadia 21',-87816, -254280, -86332, -256466, -3331, 0, 0), +(22, 'Olympiad Stadia', 'Stadia 22',-113332, -211881, -115713, -214513, -3331, 0, 0), + -insert into zone values (1, 'MotherTree', 'Shadow of the Mother Tree', 47600, 38290, 44483, 41745, -3491, 0, 0), (2, 'MotherTree', 'Elven Village', 46249, 50036, 44431, 49176, -3060, 0, 0), (3, 'MotherTree', 'East Elven Village', 20580, 51713, 21667, 50393, -3690, 0, 0), (4, 'MotherTree', 'Elven Fortress', 24993, 80655, 25454, 82314, -3165, 0, 0), -(5, 'MotherTree', 'Iris Lake', 57052, 85445, 57937, 87057, -3658, 0, 0); +(5, 'MotherTree', 'Iris Lake', 57052, 85445, 57937, 87057, -3658, 0, 0), -INSERT INTO `zone` VALUES ('1', 'Fishing', 'Water1', '-131072', '98304', '-98304', '131072', '-3780', '0', '0'); -INSERT INTO `zone` VALUES ('2', 'Fishing', 'Water2', '-131072', '131072', '-98304', '163840', '-3780', '0', '0'); -INSERT INTO `zone` VALUES ('3', 'Fishing', 'Water3', '-131072', '163840', '-98304', '196608', '-3780', '0', '0'); -INSERT INTO `zone` VALUES ('4', 'Fishing', 'Water4', '-131072', '196608', '-98304', '229376', '-3780', '0', '0'); -INSERT INTO `zone` VALUES ('5', 'Fishing', 'Water5', '-131072', '237205', '-98304', '262144', '-3780', '0', '0'); -INSERT INTO `zone` VALUES ('6', 'Fishing', 'Water6', '-98304', '65536', '-85504', '98304', '-3780', '0', '0'); -INSERT INTO `zone` VALUES ('7', 'Fishing', 'Water7', '-85504', '65536', '-65536', '80384', '-3780', '0', '0'); -INSERT INTO `zone` VALUES ('8', 'Fishing', 'Water8', '-85056', '86208', '-84416', '86848', '-3504', '0', '0'); -INSERT INTO `zone` VALUES ('9', 'Fishing', 'Water9', '-84416', '86208', '-82944', '86848', '-5248', '0', '0'); -INSERT INTO `zone` VALUES ('10', 'Fishing', 'Water10', '-98304', '121072', '-88304', '131072', '-3780', '0', '0'); -INSERT INTO `zone` VALUES ('11', 'Fishing', 'Water11', '-98304', '98304', '-96804', '99804', '-3780', '0', '0'); -INSERT INTO `zone` VALUES ('12', 'Fishing', 'Water12', '-68536', '128072', '-65536', '131072', '-3179', '0', '0'); -INSERT INTO `zone` VALUES ('13', 'Fishing', 'Water13', '-84032', '111040', '-83392', '111680', '-3248', '0', '0'); -INSERT INTO `zone` VALUES ('14', 'Fishing', 'Water14', '-83392', '111040', '-81920', '111680', '-4992', '0', '0'); -INSERT INTO `zone` VALUES ('15', 'Fishing', 'Water15', '-98304', '131072', '-78304', '163840', '-3780', '0', '0'); -INSERT INTO `zone` VALUES ('16', 'Fishing', 'Water16', '-69836', '131072', '-65536', '140072', '-3179', '0', '0'); -INSERT INTO `zone` VALUES ('17', 'Fishing', 'Water17', '-98304', '163840', '-65536', '196608', '-3780', '0', '0'); -INSERT INTO `zone` VALUES ('18', 'Fishing', 'Water18', '-98304', '196608', '-65536', '229376', '-3780', '0', '0'); -INSERT INTO `zone` VALUES ('19', 'Fishing', 'Water19', '-98304', '229376', '-65536', '262144', '-3780', '0', '0'); -INSERT INTO `zone` VALUES ('20', 'Fishing', 'Water20', '-65536', '-103304', '-32768', '-98304', '-3780', '0', '0'); -INSERT INTO `zone` VALUES ('21', 'Fishing', 'Water21', '-65536', '32768', '-52036', '65536', '-3780', '0', '0'); -INSERT INTO `zone` VALUES ('22', 'Fishing', 'Water22', '-52036', '32768', '-32768', '40768', '-3780', '0', '0'); -INSERT INTO `zone` VALUES ('23', 'Fishing', 'Water23', '-65536', '65536', '-55536', '75536', '-3780', '0', '0'); -INSERT INTO `zone` VALUES ('24', 'Fishing', 'Water24', '-55360', '78784', '-53888', '79424', '-4832', '0', '0'); -INSERT INTO `zone` VALUES ('25', 'Fishing', 'Water25', '-56000', '78784', '-55360', '79424', '-3088', '0', '0'); -INSERT INTO `zone` VALUES ('26', 'Fishing', 'Water26', '-65536', '122368', '-52480', '131072', '-3179', '0', '0'); -INSERT INTO `zone` VALUES ('27', 'Fishing', 'Water27', '-65536', '113088', '-57664', '121856', '-3659', '0', '0'); -INSERT INTO `zone` VALUES ('28', 'Fishing', 'Water28', '-65536', '131072', '-62464', '141056', '-3179', '0', '0'); -INSERT INTO `zone` VALUES ('29', 'Fishing', 'Water29', '-61764', '131072', '-55748', '132608', '-3179', '0', '0'); -INSERT INTO `zone` VALUES ('30', 'Fishing', 'Water30', '-65536', '191350', '-53536', '196608', '-3780', '0', '0'); -INSERT INTO `zone` VALUES ('31', 'Fishing', 'Water31', '-65535', '179446', '-62962', '191446', '-3780', '0', '0'); -INSERT INTO `zone` VALUES ('32', 'Fishing', 'Water32', '-54681', '180234', '-53049', '183018', '-4702', '0', '0'); -INSERT INTO `zone` VALUES ('33', 'Fishing', 'Water33', '-53616', '183018', '-52368', '184394', '-4702', '0', '0'); -INSERT INTO `zone` VALUES ('34', 'Fishing', 'Water34', '-41888', '206688', '-41248', '208160', '-5177', '0', '0'); -INSERT INTO `zone` VALUES ('35', 'Fishing', 'Water35', '-65536', '196608', '-53536', '229376', '-3780', '0', '0'); -INSERT INTO `zone` VALUES ('36', 'Fishing', 'Water36', '-53536', '220976', '-32768', '229376', '-3780', '0', '0'); -INSERT INTO `zone` VALUES ('37', 'Fishing', 'Water37', '-41024', '212576', '-32768', '220976', '-3780', '0', '0'); -INSERT INTO `zone` VALUES ('38', 'Fishing', 'Water38', '-53536', '212576', '-45280', '220976', '-3780', '0', '0'); -INSERT INTO `zone` VALUES ('39', 'Fishing', 'Water39', '-53536', '202208', '-47584', '209584', '-3780', '0', '0'); -INSERT INTO `zone` VALUES ('40', 'Fishing', 'Water40', '-45280', '212576', '-41024', '220976', '-3780', '0', '0'); -INSERT INTO `zone` VALUES ('41', 'Fishing', 'Water41', '-41888', '206048', '-41248', '206688', '-3434', '0', '0'); -INSERT INTO `zone` VALUES ('42', 'Fishing', 'Water42', '-65536', '229376', '-32768', '262144', '-3780', '0', '0'); -INSERT INTO `zone` VALUES ('43', 'Fishing', 'Water43', '-32768', '-101304', '-29768', '-98304', '-3780', '0', '0'); -INSERT INTO `zone` VALUES ('44', 'Fishing', 'Water44', '-23168', '13184', '-22528', '13824', '-3248', '0', '0'); -INSERT INTO `zone` VALUES ('45', 'Fishing', 'Water45', '-22528', '13184', '-21056', '13824', '-4991', '0', '0'); -INSERT INTO `zone` VALUES ('46', 'Fishing', 'Water46', '-12972', '57536', '-5972', '65536', '-3784', '0', '0'); -INSERT INTO `zone` VALUES ('47', 'Fishing', 'Water47', '-5840', '60646', '-3840', '62646', '-3788', '0', '0'); -INSERT INTO `zone` VALUES ('48', 'Fishing', 'Water48', '-25472', '77056', '-24832', '77696', '-3520', '0', '0'); -INSERT INTO `zone` VALUES ('49', 'Fishing', 'Water49', '-24832', '77056', '-23360', '77696', '-5263', '0', '0'); -INSERT INTO `zone` VALUES ('50', 'Fishing', 'Water50', '-32768', '209376', '-10000', '229376', '-3780', '0', '0'); -INSERT INTO `zone` VALUES ('51', 'Fishing', 'Water51', '4608', '65480', '32768', '70344', '-3794', '0', '0'); -INSERT INTO `zone` VALUES ('52', 'Fishing', 'Water52', '32768', '32768', '60672', '65536', '-3780', '0', '0'); -INSERT INTO `zone` VALUES ('53', 'Fishing', 'Water53', '32768', '65536', '63568', '90536', '-3780', '0', '0'); -INSERT INTO `zone` VALUES ('54', 'Fishing', 'Water54', '63236', '73140', '65536', '75440', '-3780', '0', '0'); -INSERT INTO `zone` VALUES ('55', 'Fishing', 'Water55', '43517', '116837', '52517', '126093', '-3780', '0', '0'); -INSERT INTO `zone` VALUES ('56', 'Fishing', 'Water56', '48773', '115910', '50237', '116709', '-2227', '0', '0'); -INSERT INTO `zone` VALUES ('57', 'Fishing', 'Water57', '46597', '111629', '49597', '115129', '-2259', '0', '0'); -INSERT INTO `zone` VALUES ('58', 'Fishing', 'Water58', '49172', '115129', '50136', '116869', '-2259', '0', '0'); -INSERT INTO `zone` VALUES ('59', 'Fishing', 'Water59', '48000', '115129', '49172', '116357', '-2259', '0', '0'); -INSERT INTO `zone` VALUES ('60', 'Fishing', 'Water60', '44928', '126976', '45568', '127616', '-3776', '0', '0'); -INSERT INTO `zone` VALUES ('61', 'Fishing', 'Water61', '44928', '125504', '45568', '126976', '-5504', '0', '0'); -INSERT INTO `zone` VALUES ('62', 'Fishing', 'Water62', '41917', '139480', '51917', '152770', '-3749', '0', '0'); -INSERT INTO `zone` VALUES ('63', 'Fishing', 'Water63', '39296', '143616', '39936', '144256', '-3728', '0', '0'); -INSERT INTO `zone` VALUES ('64', 'Fishing', 'Water64', '39936', '143616', '41408', '144256', '-5471', '0', '0'); -INSERT INTO `zone` VALUES ('65', 'Fishing', 'Water65', '32768', '181240', '65536', '196608', '-3780', '0', '0'); -INSERT INTO `zone` VALUES ('66', 'Fishing', 'Water66', '32768', '175600', '44032', '181240', '-3780', '0', '0'); -INSERT INTO `zone` VALUES ('67', 'Fishing', 'Water67', '57472', '175600', '65536', '181240', '-3780', '0', '0'); -INSERT INTO `zone` VALUES ('68', 'Fishing', 'Water68', '42496', '169984', '43136', '170624', '-3328', '0', '0'); -INSERT INTO `zone` VALUES ('69', 'Fishing', 'Water69', '43136', '169984', '44608', '170624', '-5071', '0', '0'); -INSERT INTO `zone` VALUES ('70', 'Fishing', 'Water70', '32768', '196608', '65536', '229376', '-3780', '0', '0'); -INSERT INTO `zone` VALUES ('71', 'Fishing', 'Water71', '65536', '4768', '75536', '32768', '-3780', '0', '0'); -INSERT INTO `zone` VALUES ('72', 'Fishing', 'Water72', '75536', '27768', '98304', '32768', '-3780', '0', '0'); -INSERT INTO `zone` VALUES ('73', 'Fishing', 'Water73', '84727', '32768', '91727', '53768', '-3780', '0', '0'); -INSERT INTO `zone` VALUES ('74', 'Fishing', 'Water74', '65536', '91304', '98304', '98304', '-3772', '0', '0'); -INSERT INTO `zone` VALUES ('75', 'Fishing', 'Water75', '65536', '71304', '70536', '91304', '-3772', '0', '0'); -INSERT INTO `zone` VALUES ('76', 'Fishing', 'Water76', '73984', '78080', '74624', '78720', '-3472', '0', '0'); -INSERT INTO `zone` VALUES ('77', 'Fishing', 'Water77', '74624', '78080', '76096', '78720', '-5215', '0', '0'); -INSERT INTO `zone` VALUES ('78', 'Fishing', 'Water78', '78304', '139840', '98304', '163840', '-3780', '0', '0'); -INSERT INTO `zone` VALUES ('79', 'Fishing', 'Water79', '65536', '163840', '74752', '196608', '-3780', '0', '0'); -INSERT INTO `zone` VALUES ('80', 'Fishing', 'Water80', '74752', '163840', '85215', '173976', '-3780', '0', '0'); -INSERT INTO `zone` VALUES ('81', 'Fishing', 'Water81', '74752', '173976', '83244', '178267', '-3780', '0', '0'); -INSERT INTO `zone` VALUES ('82', 'Fishing', 'Water82', '74752', '178267', '78031', '180291', '-3780', '0', '0'); -INSERT INTO `zone` VALUES ('83', 'Fishing', 'Water83', '91149', '163840', '98304', '166737', '-3780', '0', '0'); -INSERT INTO `zone` VALUES ('84', 'Fishing', 'Water84', '95485', '166737', '98304', '193105', '-3780', '0', '0'); -INSERT INTO `zone` VALUES ('85', 'Fishing', 'Water85', '92290', '173976', '95485', '185103', '-3780', '0', '0'); -INSERT INTO `zone` VALUES ('86', 'Fishing', 'Water86', '92290', '193105', '98304', '196608', '-3780', '0', '0'); -INSERT INTO `zone` VALUES ('87', 'Fishing', 'Water87', '93696', '224128', '98304', '229376', '-3780', '0', '0'); -INSERT INTO `zone` VALUES ('88', 'Fishing', 'Water88', '93056', '196608', '98304', '201216', '-3780', '0', '0'); -INSERT INTO `zone` VALUES ('89', 'Fishing', 'Water89', '65536', '196608', '76032', '200320', '-3780', '0', '0'); -INSERT INTO `zone` VALUES ('90', 'Fishing', 'Water90', '70024', '222217', '77862', '229376', '-3780', '0', '0'); -INSERT INTO `zone` VALUES ('91', 'Fishing', 'Water91', '65536', '200320', '70024', '229376', '-3780', '0', '0'); -INSERT INTO `zone` VALUES ('92', 'Fishing', 'Water92', '70024', '200320', '79174', '222217', '-3780', '0', '0'); -INSERT INTO `zone` VALUES ('93', 'Fishing', 'Water93', '77862', '224128', '93696', '229376', '-3780', '0', '0'); -INSERT INTO `zone` VALUES ('94', 'Fishing', 'Water94', '80192', '201216', '98304', '224128', '-3780', '0', '0'); -INSERT INTO `zone` VALUES ('95', 'Fishing', 'Water95', '81856', '196608', '93056', '201216', '-3780', '0', '0'); -INSERT INTO `zone` VALUES ('96', 'Fishing', 'Water96', '79360', '208897', '80000', '209537', '-3786', '0', '0'); -INSERT INTO `zone` VALUES ('97', 'Fishing', 'Water97', '80000', '208897', '81472', '209537', '-5529', '0', '0'); -INSERT INTO `zone` VALUES ('98', 'Fishing', 'Water98', '79174', '209727', '80192', '224128', '-3780', '0', '0'); -INSERT INTO `zone` VALUES ('99', 'Fishing', 'Water99', '79174', '201216', '80192', '208704', '-3780', '0', '0'); -INSERT INTO `zone` VALUES ('100', 'Fishing', 'Water100', '79010', '246661', '86498', '254711', '-10886', '0', '0'); -INSERT INTO `zone` VALUES ('101', 'Fishing', 'Water101', '84195', '239660', '86179', '242732', '-4203', '0', '0'); -INSERT INTO `zone` VALUES ('102', 'Fishing', 'Water102', '82979', '241472', '84195', '241920', '-6763', '0', '0'); -INSERT INTO `zone` VALUES ('103', 'Fishing', 'Water103', '80356', '245013', '84644', '245845', '-8898', '0', '0'); -INSERT INTO `zone` VALUES ('104', 'Fishing', 'Water104', '80303', '258157', '84591', '258989', '-8898', '0', '0'); -INSERT INTO `zone` VALUES ('105', 'Fishing', 'Water105', '65536', '229376', '98304', '262144', '-3780', '0', '0'); -INSERT INTO `zone` VALUES ('106', 'Fishing', 'Water106', '78624', '254711', '82336', '255593', '-10886', '0', '0'); -INSERT INTO `zone` VALUES ('107', 'Fishing', 'Water107', '82785', '254711', '86497', '255593', '-10886', '0', '0'); -INSERT INTO `zone` VALUES ('108', 'Fishing', 'Water108', '82336', '255351', '82785', '255593', '-10886', '0', '0'); -INSERT INTO `zone` VALUES ('109', 'Fishing', 'Water109', '98304', '-229376', '131072', '-196608', '-3780', '0', '0'); -INSERT INTO `zone` VALUES ('110', 'Fishing', 'Water110', '119040', '-196608', '131072', '-178624', '-3780', '0', '0'); -INSERT INTO `zone` VALUES ('111', 'Fishing', 'Water111', '98305', '27768', '120321', '32768', '-3780', '0', '0'); -INSERT INTO `zone` VALUES ('112', 'Fishing', 'Water112', '103091', '37760', '128091', '62760', '-4656', '0', '0'); -INSERT INTO `zone` VALUES ('113', 'Fishing', 'Water113', '110208', '84224', '110848', '84864', '-4864', '0', '0'); -INSERT INTO `zone` VALUES ('114', 'Fishing', 'Water114', '110848', '84224', '112320', '84864', '-6631', '0', '0'); -INSERT INTO `zone` VALUES ('115', 'Fishing', 'Water115', '98304', '138240', '131072', '163840', '-3780', '0', '0'); -INSERT INTO `zone` VALUES ('116', 'Fishing', 'Water116', '112096', '142624', '119232', '147604', '-2892', '0', '0'); -INSERT INTO `zone` VALUES ('117', 'Fishing', 'Water117', '117509', '136740', '122009', '138240', '-3780', '0', '0'); -INSERT INTO `zone` VALUES ('118', 'Fishing', 'Water118', '117509', '136740', '122009', '138240', '-3780', '0', '0'); -INSERT INTO `zone` VALUES ('119', 'Fishing', 'Water119', '117509', '136740', '122009', '138240', '-3780', '0', '0'); -INSERT INTO `zone` VALUES ('120', 'Fishing', 'Water120', '114560', '132480', '115200', '133120', '-3184', '0', '0'); -INSERT INTO `zone` VALUES ('121', 'Fishing', 'Water121', '115200', '132480', '116672', '133120', '-4928', '0', '0'); -INSERT INTO `zone` VALUES ('122', 'Fishing', 'Water122', '98304', '163840', '131072', '167840', '-3780', '0', '0'); -INSERT INTO `zone` VALUES ('123', 'Fishing', 'Water123', '98304', '167840', '102304', '196608', '-3780', '0', '0'); -INSERT INTO `zone` VALUES ('124', 'Fishing', 'Water124', '124072', '167840', '131072', '196608', '-3780', '0', '0'); -INSERT INTO `zone` VALUES ('125', 'Fishing', 'Water125', '102304', '191608', '124072', '196608', '-3780', '0', '0'); -INSERT INTO `zone` VALUES ('126', 'Fishing', 'Water126', '121672', '186199', '124072', '189151', '-3780', '0', '0'); -INSERT INTO `zone` VALUES ('127', 'Fishing', 'Water127', '102304', '184170', '105652', '187250', '-3780', '0', '0'); -INSERT INTO `zone` VALUES ('128', 'Fishing', 'Water128', '102304', '168567', '106804', '173567', '-3780', '0', '0'); -INSERT INTO `zone` VALUES ('129', 'Fishing', 'Water129', '107520', '173696', '108160', '174336', '-3776', '0', '0'); -INSERT INTO `zone` VALUES ('130', 'Fishing', 'Water130', '108160', '173696', '109632', '174336', '-5529', '0', '0'); -INSERT INTO `zone` VALUES ('131', 'Fishing', 'Water131', '98304', '196608', '131072', '229376', '-3780', '0', '0'); -INSERT INTO `zone` VALUES ('132', 'Fishing', 'Water132', '98304', '229376', '131072', '262144', '-3780', '0', '0'); -INSERT INTO `zone` VALUES ('133', 'Fishing', 'Water133', '131072', '-229376', '163840', '-196608', '-3780', '0', '0'); -INSERT INTO `zone` VALUES ('134', 'Fishing', 'Water134', '131072', '-196608', '163840', '-178608', '-3780', '0', '0'); -INSERT INTO `zone` VALUES ('135', 'Fishing', 'Water135', '145081', '25139', '149881', '29939', '-2528', '0', '0'); -INSERT INTO `zone` VALUES ('136', 'Fishing', 'Water136', '131059', '32768', '163827', '65536', '-3776', '0', '0'); -INSERT INTO `zone` VALUES ('137', 'Fishing', 'Water137', '136648', '79304', '137400', '80056', '-3736', '0', '0'); -INSERT INTO `zone` VALUES ('138', 'Fishing', 'Water138', '137400', '79360', '138816', '80000', '-5519', '0', '0'); -INSERT INTO `zone` VALUES ('139', 'Fishing', 'Water139', '137472', '65536', '163840', '98304', '-3780', '0', '0'); -INSERT INTO `zone` VALUES ('140', 'Fishing', 'Water140', '131072', '126072', '136072', '131072', '-3780', '0', '0'); -INSERT INTO `zone` VALUES ('141', 'Fishing', 'Water141', '163840', '-229376', '196608', '-196608', '-3780', '0', '0'); -INSERT INTO `zone` VALUES ('142', 'Fishing', 'Water142', '163840', '-196608', '168840', '-186608', '-3780', '0', '0'); -INSERT INTO `zone` VALUES ('143', 'Fishing', 'Water143', '173411', '-187756', '186042', '-182534', '-4465', '0', '0'); -INSERT INTO `zone` VALUES ('144', 'Fishing', 'Water144', '174206', '-182687', '176749', '-179167', '-2066', '0', '0'); -INSERT INTO `zone` VALUES ('145', 'Fishing', 'Water145', '170908', '-116846', '173748', '-113953', '-4033', '0', '0'); -INSERT INTO `zone` VALUES ('146', 'Fishing', 'Water146', '170926', '-113936', '173766', '-111043', '-5256', '0', '0'); -INSERT INTO `zone` VALUES ('147', 'Fishing', 'Water147', '163840', '65760', '173840', '95072', '-3780', '0', '0'); -INSERT INTO `zone` VALUES ('148', 'Fishing', 'Water148', '168576', '-17920', '169216', '-17280', '-3248', '0', '0'); -INSERT INTO `zone` VALUES ('149', 'Fishing', 'Water149', '169216', '-17920', '170688', '-17280', '-4991', '0', '0'); -INSERT INTO `zone` VALUES ('150', 'Fishing', 'Water150', '32768', '-98304', '65536', '-65536', '-3780', '0', '0'); -INSERT INTO `zone` VALUES ('151', 'Fishing', 'Water151', '32768', '-65536', '65536', '-32768', '-3784', '0', '0'); -INSERT INTO `zone` VALUES ('152', 'Fishing', 'Water152', '65536', '-40960', '98304', '-32768', '-3780', '0', '0'); -INSERT INTO `zone` VALUES ('153', 'Fishing', 'Water153', '91829', '-55930', '95637', '-50266', '-2633', '0', '0'); -INSERT INTO `zone` VALUES ('154', 'Fishing', 'Water154', '87765', '-54554', '91829', '-50266', '-2633', '0', '0'); -INSERT INTO `zone` VALUES ('155', 'Fishing', 'Water155', '84947', '-50234', '90133', '-46202', '-3152', '0', '0'); -INSERT INTO `zone` VALUES ('156', 'Fishing', 'Water156', '76003', '-46368', '84947', '-39968', '-3248', '0', '0'); -INSERT INTO `zone` VALUES ('157', 'Fishing', 'Water157', '68852', '-62008', '74036', '-56192', '-3161', '0', '0'); -INSERT INTO `zone` VALUES ('158', 'Fishing', 'Water158', '69480', '-56192', '77032', '-53203', '-3161', '0', '0'); -INSERT INTO `zone` VALUES ('159', 'Fishing', 'Water159', '71311', '-53203', '76175', '-50292', '-3161', '0', '0'); -INSERT INTO `zone` VALUES ('160', 'Fishing', 'Water160', '75059', '-63591', '78355', '-57517', '-2352', '0', '0'); -INSERT INTO `zone` VALUES ('161', 'Fishing', 'Water161', '78355', '-65184', '83859', '-51872', '-2352', '0', '0'); -INSERT INTO `zone` VALUES ('162', 'Fishing', 'Water162', '83859', '-64826', '87187', '-55418', '-2352', '0', '0'); -INSERT INTO `zone` VALUES ('163', 'Fishing', 'Water163', '87187', '-62909', '90963', '-58301', '-2352', '0', '0'); -INSERT INTO `zone` VALUES ('164', 'Fishing', 'Water164', '77283', '-51872', '83747', '-49440', '-2352', '0', '0'); -INSERT INTO `zone` VALUES ('165', 'Fishing', 'Water165', '83859', '-55418', '86227', '-52602', '-2352', '0', '0'); -INSERT INTO `zone` VALUES ('166', 'Fishing', 'Water166', '69635', '-47328', '76003', '-39776', '-3248', '0', '0'); -INSERT INTO `zone` VALUES ('167', 'Fishing', 'Water167', '87187', '-58301', '89235', '-56541', '-2352', '0', '0'); -INSERT INTO `zone` VALUES ('168', 'Fishing', 'Water168', '76800', '-32768', '98304', '-18432', '-3780', '0', '0'); + ('1', 'Fishing', 'Water1', '-131072', '98304', '-98304', '131072', '-3780', '0', '0'), + ('2', 'Fishing', 'Water2', '-131072', '131072', '-98304', '163840', '-3780', '0', '0'), + ('3', 'Fishing', 'Water3', '-131072', '163840', '-98304', '196608', '-3780', '0', '0'), + ('4', 'Fishing', 'Water4', '-131072', '196608', '-98304', '229376', '-3780', '0', '0'), + ('5', 'Fishing', 'Water5', '-131072', '237205', '-98304', '262144', '-3780', '0', '0'), + ('6', 'Fishing', 'Water6', '-98304', '65536', '-85504', '98304', '-3780', '0', '0'), + ('7', 'Fishing', 'Water7', '-85504', '65536', '-65536', '80384', '-3780', '0', '0'), + ('8', 'Fishing', 'Water8', '-85056', '86208', '-84416', '86848', '-3504', '0', '0'), + ('9', 'Fishing', 'Water9', '-84416', '86208', '-82944', '86848', '-5248', '0', '0'), + ('10', 'Fishing', 'Water10', '-98304', '121072', '-88304', '131072', '-3780', '0', '0'), + ('11', 'Fishing', 'Water11', '-98304', '98304', '-96804', '99804', '-3780', '0', '0'), + ('12', 'Fishing', 'Water12', '-68536', '128072', '-65536', '131072', '-3179', '0', '0'), + ('13', 'Fishing', 'Water13', '-84032', '111040', '-83392', '111680', '-3248', '0', '0'), + ('14', 'Fishing', 'Water14', '-83392', '111040', '-81920', '111680', '-4992', '0', '0'), + ('15', 'Fishing', 'Water15', '-98304', '131072', '-78304', '163840', '-3780', '0', '0'), + ('16', 'Fishing', 'Water16', '-69836', '131072', '-65536', '140072', '-3179', '0', '0'), + ('17', 'Fishing', 'Water17', '-98304', '163840', '-65536', '196608', '-3780', '0', '0'), + ('18', 'Fishing', 'Water18', '-98304', '196608', '-65536', '229376', '-3780', '0', '0'), + ('19', 'Fishing', 'Water19', '-98304', '229376', '-65536', '262144', '-3780', '0', '0'), + ('20', 'Fishing', 'Water20', '-65536', '-103304', '-32768', '-98304', '-3780', '0', '0'), + ('21', 'Fishing', 'Water21', '-65536', '32768', '-52036', '65536', '-3780', '0', '0'), + ('22', 'Fishing', 'Water22', '-52036', '32768', '-32768', '40768', '-3780', '0', '0'), + ('23', 'Fishing', 'Water23', '-65536', '65536', '-55536', '75536', '-3780', '0', '0'), + ('24', 'Fishing', 'Water24', '-55360', '78784', '-53888', '79424', '-4832', '0', '0'), + ('25', 'Fishing', 'Water25', '-56000', '78784', '-55360', '79424', '-3088', '0', '0'), + ('26', 'Fishing', 'Water26', '-65536', '122368', '-52480', '131072', '-3179', '0', '0'), + ('27', 'Fishing', 'Water27', '-65536', '113088', '-57664', '121856', '-3659', '0', '0'), + ('28', 'Fishing', 'Water28', '-65536', '131072', '-62464', '141056', '-3179', '0', '0'), + ('29', 'Fishing', 'Water29', '-61764', '131072', '-55748', '132608', '-3179', '0', '0'), + ('30', 'Fishing', 'Water30', '-65536', '191350', '-53536', '196608', '-3780', '0', '0'), + ('31', 'Fishing', 'Water31', '-65535', '179446', '-62962', '191446', '-3780', '0', '0'), + ('32', 'Fishing', 'Water32', '-54681', '180234', '-53049', '183018', '-4702', '0', '0'), + ('33', 'Fishing', 'Water33', '-53616', '183018', '-52368', '184394', '-4702', '0', '0'), + ('34', 'Fishing', 'Water34', '-41888', '206688', '-41248', '208160', '-5177', '0', '0'), + ('35', 'Fishing', 'Water35', '-65536', '196608', '-53536', '229376', '-3780', '0', '0'), + ('36', 'Fishing', 'Water36', '-53536', '220976', '-32768', '229376', '-3780', '0', '0'), + ('37', 'Fishing', 'Water37', '-41024', '212576', '-32768', '220976', '-3780', '0', '0'), + ('38', 'Fishing', 'Water38', '-53536', '212576', '-45280', '220976', '-3780', '0', '0'), + ('39', 'Fishing', 'Water39', '-53536', '202208', '-47584', '209584', '-3780', '0', '0'), + ('40', 'Fishing', 'Water40', '-45280', '212576', '-41024', '220976', '-3780', '0', '0'), + ('41', 'Fishing', 'Water41', '-41888', '206048', '-41248', '206688', '-3434', '0', '0'), + ('42', 'Fishing', 'Water42', '-65536', '229376', '-32768', '262144', '-3780', '0', '0'), + ('43', 'Fishing', 'Water43', '-32768', '-101304', '-29768', '-98304', '-3780', '0', '0'), + ('44', 'Fishing', 'Water44', '-23168', '13184', '-22528', '13824', '-3248', '0', '0'), + ('45', 'Fishing', 'Water45', '-22528', '13184', '-21056', '13824', '-4991', '0', '0'), + ('46', 'Fishing', 'Water46', '-12972', '57536', '-5972', '65536', '-3784', '0', '0'), + ('47', 'Fishing', 'Water47', '-5840', '60646', '-3840', '62646', '-3788', '0', '0'), + ('48', 'Fishing', 'Water48', '-25472', '77056', '-24832', '77696', '-3520', '0', '0'), + ('49', 'Fishing', 'Water49', '-24832', '77056', '-23360', '77696', '-5263', '0', '0'), + ('50', 'Fishing', 'Water50', '-32768', '209376', '-10000', '229376', '-3780', '0', '0'), + ('51', 'Fishing', 'Water51', '4608', '65480', '32768', '70344', '-3794', '0', '0'), + ('52', 'Fishing', 'Water52', '32768', '32768', '60672', '65536', '-3780', '0', '0'), + ('53', 'Fishing', 'Water53', '32768', '65536', '63568', '90536', '-3780', '0', '0'), + ('54', 'Fishing', 'Water54', '63236', '73140', '65536', '75440', '-3780', '0', '0'), + ('55', 'Fishing', 'Water55', '43517', '116837', '52517', '126093', '-3780', '0', '0'), + ('56', 'Fishing', 'Water56', '48773', '115910', '50237', '116709', '-2227', '0', '0'), + ('57', 'Fishing', 'Water57', '46597', '111629', '49597', '115129', '-2259', '0', '0'), + ('58', 'Fishing', 'Water58', '49172', '115129', '50136', '116869', '-2259', '0', '0'), + ('59', 'Fishing', 'Water59', '48000', '115129', '49172', '116357', '-2259', '0', '0'), + ('60', 'Fishing', 'Water60', '44928', '126976', '45568', '127616', '-3776', '0', '0'), + ('61', 'Fishing', 'Water61', '44928', '125504', '45568', '126976', '-5504', '0', '0'), + ('62', 'Fishing', 'Water62', '41917', '139480', '51917', '152770', '-3749', '0', '0'), + ('63', 'Fishing', 'Water63', '39296', '143616', '39936', '144256', '-3728', '0', '0'), + ('64', 'Fishing', 'Water64', '39936', '143616', '41408', '144256', '-5471', '0', '0'), + ('65', 'Fishing', 'Water65', '32768', '181240', '65536', '196608', '-3780', '0', '0'), + ('66', 'Fishing', 'Water66', '32768', '175600', '44032', '181240', '-3780', '0', '0'), + ('67', 'Fishing', 'Water67', '57472', '175600', '65536', '181240', '-3780', '0', '0'), + ('68', 'Fishing', 'Water68', '42496', '169984', '43136', '170624', '-3328', '0', '0'), + ('69', 'Fishing', 'Water69', '43136', '169984', '44608', '170624', '-5071', '0', '0'), + ('70', 'Fishing', 'Water70', '32768', '196608', '65536', '229376', '-3780', '0', '0'), + ('71', 'Fishing', 'Water71', '65536', '4768', '75536', '32768', '-3780', '0', '0'), + ('72', 'Fishing', 'Water72', '75536', '27768', '98304', '32768', '-3780', '0', '0'), + ('73', 'Fishing', 'Water73', '84727', '32768', '91727', '53768', '-3780', '0', '0'), + ('74', 'Fishing', 'Water74', '65536', '91304', '98304', '98304', '-3772', '0', '0'), + ('75', 'Fishing', 'Water75', '65536', '71304', '70536', '91304', '-3772', '0', '0'), + ('76', 'Fishing', 'Water76', '73984', '78080', '74624', '78720', '-3472', '0', '0'), + ('77', 'Fishing', 'Water77', '74624', '78080', '76096', '78720', '-5215', '0', '0'), + ('78', 'Fishing', 'Water78', '78304', '139840', '98304', '163840', '-3780', '0', '0'), + ('79', 'Fishing', 'Water79', '65536', '163840', '74752', '196608', '-3780', '0', '0'), + ('80', 'Fishing', 'Water80', '74752', '163840', '85215', '173976', '-3780', '0', '0'), + ('81', 'Fishing', 'Water81', '74752', '173976', '83244', '178267', '-3780', '0', '0'), + ('82', 'Fishing', 'Water82', '74752', '178267', '78031', '180291', '-3780', '0', '0'), + ('83', 'Fishing', 'Water83', '91149', '163840', '98304', '166737', '-3780', '0', '0'), + ('84', 'Fishing', 'Water84', '95485', '166737', '98304', '193105', '-3780', '0', '0'), + ('85', 'Fishing', 'Water85', '92290', '173976', '95485', '185103', '-3780', '0', '0'), + ('86', 'Fishing', 'Water86', '92290', '193105', '98304', '196608', '-3780', '0', '0'), + ('87', 'Fishing', 'Water87', '93696', '224128', '98304', '229376', '-3780', '0', '0'), + ('88', 'Fishing', 'Water88', '93056', '196608', '98304', '201216', '-3780', '0', '0'), + ('89', 'Fishing', 'Water89', '65536', '196608', '76032', '200320', '-3780', '0', '0'), + ('90', 'Fishing', 'Water90', '70024', '222217', '77862', '229376', '-3780', '0', '0'), + ('91', 'Fishing', 'Water91', '65536', '200320', '70024', '229376', '-3780', '0', '0'), + ('92', 'Fishing', 'Water92', '70024', '200320', '79174', '222217', '-3780', '0', '0'), + ('93', 'Fishing', 'Water93', '77862', '224128', '93696', '229376', '-3780', '0', '0'), + ('94', 'Fishing', 'Water94', '80192', '201216', '98304', '224128', '-3780', '0', '0'), + ('95', 'Fishing', 'Water95', '81856', '196608', '93056', '201216', '-3780', '0', '0'), + ('96', 'Fishing', 'Water96', '79360', '208897', '80000', '209537', '-3786', '0', '0'), + ('97', 'Fishing', 'Water97', '80000', '208897', '81472', '209537', '-5529', '0', '0'), + ('98', 'Fishing', 'Water98', '79174', '209727', '80192', '224128', '-3780', '0', '0'), + ('99', 'Fishing', 'Water99', '79174', '201216', '80192', '208704', '-3780', '0', '0'), + ('100', 'Fishing', 'Water100', '79010', '246661', '86498', '254711', '-10886', '0', '0'), + ('101', 'Fishing', 'Water101', '84195', '239660', '86179', '242732', '-4203', '0', '0'), + ('102', 'Fishing', 'Water102', '82979', '241472', '84195', '241920', '-6763', '0', '0'), + ('103', 'Fishing', 'Water103', '80356', '245013', '84644', '245845', '-8898', '0', '0'), + ('104', 'Fishing', 'Water104', '80303', '258157', '84591', '258989', '-8898', '0', '0'), + ('105', 'Fishing', 'Water105', '65536', '229376', '98304', '262144', '-3780', '0', '0'), + ('106', 'Fishing', 'Water106', '78624', '254711', '82336', '255593', '-10886', '0', '0'), + ('107', 'Fishing', 'Water107', '82785', '254711', '86497', '255593', '-10886', '0', '0'), + ('108', 'Fishing', 'Water108', '82336', '255351', '82785', '255593', '-10886', '0', '0'), + ('109', 'Fishing', 'Water109', '98304', '-229376', '131072', '-196608', '-3780', '0', '0'), + ('110', 'Fishing', 'Water110', '119040', '-196608', '131072', '-178624', '-3780', '0', '0'), + ('111', 'Fishing', 'Water111', '98305', '27768', '120321', '32768', '-3780', '0', '0'), + ('112', 'Fishing', 'Water112', '103091', '37760', '128091', '62760', '-4656', '0', '0'), + ('113', 'Fishing', 'Water113', '110208', '84224', '110848', '84864', '-4864', '0', '0'), + ('114', 'Fishing', 'Water114', '110848', '84224', '112320', '84864', '-6631', '0', '0'), + ('115', 'Fishing', 'Water115', '98304', '138240', '131072', '163840', '-3780', '0', '0'), + ('116', 'Fishing', 'Water116', '112096', '142624', '119232', '147604', '-2892', '0', '0'), + ('117', 'Fishing', 'Water117', '117509', '136740', '122009', '138240', '-3780', '0', '0'), + ('118', 'Fishing', 'Water118', '117509', '136740', '122009', '138240', '-3780', '0', '0'), + ('119', 'Fishing', 'Water119', '117509', '136740', '122009', '138240', '-3780', '0', '0'), + ('120', 'Fishing', 'Water120', '114560', '132480', '115200', '133120', '-3184', '0', '0'), + ('121', 'Fishing', 'Water121', '115200', '132480', '116672', '133120', '-4928', '0', '0'), + ('122', 'Fishing', 'Water122', '98304', '163840', '131072', '167840', '-3780', '0', '0'), + ('123', 'Fishing', 'Water123', '98304', '167840', '102304', '196608', '-3780', '0', '0'), + ('124', 'Fishing', 'Water124', '124072', '167840', '131072', '196608', '-3780', '0', '0'), + ('125', 'Fishing', 'Water125', '102304', '191608', '124072', '196608', '-3780', '0', '0'), + ('126', 'Fishing', 'Water126', '121672', '186199', '124072', '189151', '-3780', '0', '0'), + ('127', 'Fishing', 'Water127', '102304', '184170', '105652', '187250', '-3780', '0', '0'), + ('128', 'Fishing', 'Water128', '102304', '168567', '106804', '173567', '-3780', '0', '0'), + ('129', 'Fishing', 'Water129', '107520', '173696', '108160', '174336', '-3776', '0', '0'), + ('130', 'Fishing', 'Water130', '108160', '173696', '109632', '174336', '-5529', '0', '0'), + ('131', 'Fishing', 'Water131', '98304', '196608', '131072', '229376', '-3780', '0', '0'), + ('132', 'Fishing', 'Water132', '98304', '229376', '131072', '262144', '-3780', '0', '0'), + ('133', 'Fishing', 'Water133', '131072', '-229376', '163840', '-196608', '-3780', '0', '0'), + ('134', 'Fishing', 'Water134', '131072', '-196608', '163840', '-178608', '-3780', '0', '0'), + ('135', 'Fishing', 'Water135', '145081', '25139', '149881', '29939', '-2528', '0', '0'), + ('136', 'Fishing', 'Water136', '131059', '32768', '163827', '65536', '-3776', '0', '0'), + ('137', 'Fishing', 'Water137', '136648', '79304', '137400', '80056', '-3736', '0', '0'), + ('138', 'Fishing', 'Water138', '137400', '79360', '138816', '80000', '-5519', '0', '0'), + ('139', 'Fishing', 'Water139', '137472', '65536', '163840', '98304', '-3780', '0', '0'), + ('140', 'Fishing', 'Water140', '131072', '126072', '136072', '131072', '-3780', '0', '0'), + ('141', 'Fishing', 'Water141', '163840', '-229376', '196608', '-196608', '-3780', '0', '0'), + ('142', 'Fishing', 'Water142', '163840', '-196608', '168840', '-186608', '-3780', '0', '0'), + ('143', 'Fishing', 'Water143', '173411', '-187756', '186042', '-182534', '-4465', '0', '0'), + ('144', 'Fishing', 'Water144', '174206', '-182687', '176749', '-179167', '-2066', '0', '0'), + ('145', 'Fishing', 'Water145', '170908', '-116846', '173748', '-113953', '-4033', '0', '0'), + ('146', 'Fishing', 'Water146', '170926', '-113936', '173766', '-111043', '-5256', '0', '0'), + ('147', 'Fishing', 'Water147', '163840', '65760', '173840', '95072', '-3780', '0', '0'), + ('148', 'Fishing', 'Water148', '168576', '-17920', '169216', '-17280', '-3248', '0', '0'), + ('149', 'Fishing', 'Water149', '169216', '-17920', '170688', '-17280', '-4991', '0', '0'), + ('150', 'Fishing', 'Water150', '32768', '-98304', '65536', '-65536', '-3780', '0', '0'), + ('151', 'Fishing', 'Water151', '32768', '-65536', '65536', '-32768', '-3784', '0', '0'), + ('152', 'Fishing', 'Water152', '65536', '-40960', '98304', '-32768', '-3780', '0', '0'), + ('153', 'Fishing', 'Water153', '91829', '-55930', '95637', '-50266', '-2633', '0', '0'), + ('154', 'Fishing', 'Water154', '87765', '-54554', '91829', '-50266', '-2633', '0', '0'), + ('155', 'Fishing', 'Water155', '84947', '-50234', '90133', '-46202', '-3152', '0', '0'), + ('156', 'Fishing', 'Water156', '76003', '-46368', '84947', '-39968', '-3248', '0', '0'), + ('157', 'Fishing', 'Water157', '68852', '-62008', '74036', '-56192', '-3161', '0', '0'), + ('158', 'Fishing', 'Water158', '69480', '-56192', '77032', '-53203', '-3161', '0', '0'), + ('159', 'Fishing', 'Water159', '71311', '-53203', '76175', '-50292', '-3161', '0', '0'), + ('160', 'Fishing', 'Water160', '75059', '-63591', '78355', '-57517', '-2352', '0', '0'), + ('161', 'Fishing', 'Water161', '78355', '-65184', '83859', '-51872', '-2352', '0', '0'), + ('162', 'Fishing', 'Water162', '83859', '-64826', '87187', '-55418', '-2352', '0', '0'), + ('163', 'Fishing', 'Water163', '87187', '-62909', '90963', '-58301', '-2352', '0', '0'), + ('164', 'Fishing', 'Water164', '77283', '-51872', '83747', '-49440', '-2352', '0', '0'), + ('165', 'Fishing', 'Water165', '83859', '-55418', '86227', '-52602', '-2352', '0', '0'), + ('166', 'Fishing', 'Water166', '69635', '-47328', '76003', '-39776', '-3248', '0', '0'), + ('167', 'Fishing', 'Water167', '87187', '-58301', '89235', '-56541', '-2352', '0', '0'), + ('168', 'Fishing', 'Water168', '76800', '-32768', '98304', '-18432', '-3780', '0', '0'); From c4316194471bfb026d1cfe1a36a8c305c5bc4666 Mon Sep 17 00:00:00 2001 From: Alisson Oliveira Date: Mon, 9 Apr 2018 13:01:46 -0300 Subject: [PATCH 002/236] Substitue C3P0 por HikariCP --- Commons/build.gradle | 4 +- .../com/l2jbr/commons/Config.java | 8 +- .../com/l2jbr/commons/L2DatabaseFactory.java | 242 ------------------ .../commons/database/L2DatabaseFactory.java | 131 ++++++++++ .../com/l2jbr/commons/lib/SqlUtils.java | 2 +- .../main/com.l2jbr.commons/module-info.java | 3 +- Datapack/build.gradle | 2 +- .../503_PursuitClanAmbition/__init__.py | 2 +- Gameserver/build.gradle | 5 +- .../com/l2jbr/gameserver/GameServer.java | 2 +- .../com/l2jbr/gameserver/Olympiad.java | 2 +- .../com/l2jbr/gameserver/SevenSigns.java | 2 +- .../l2jbr/gameserver/SevenSignsFestival.java | 2 +- .../com/l2jbr/gameserver/Shutdown.java | 2 +- .../com/l2jbr/gameserver/TradeController.java | 2 +- .../l2jbr/gameserver/cache/CrestCache.java | 2 +- .../gameserver/clientpackets/EnterWorld.java | 2 +- .../gameserver/clientpackets/Logout.java | 2 +- .../RequestAnswerFriendInvite.java | 2 +- .../clientpackets/RequestDestroyItem.java | 2 +- .../RequestExSetPledgeCrestLarge.java | 2 +- .../clientpackets/RequestFriendDel.java | 2 +- .../clientpackets/RequestFriendInvite.java | 2 +- .../clientpackets/RequestFriendList.java | 2 +- .../clientpackets/RequestSetAllyCrest.java | 2 +- .../clientpackets/RequestSetPledgeCrest.java | 2 +- .../gameserver/communitybbs/BB/Forum.java | 2 +- .../gameserver/communitybbs/BB/Post.java | 2 +- .../gameserver/communitybbs/BB/Topic.java | 2 +- .../Manager/ForumsBBSManager.java | 2 +- .../gameserver/datatables/ArmorSetsTable.java | 2 +- .../gameserver/datatables/CharNameTable.java | 2 +- .../datatables/CharTemplateTable.java | 2 +- .../gameserver/datatables/ClanTable.java | 2 +- .../gameserver/datatables/FishTable.java | 2 +- .../datatables/HelperBuffTable.java | 2 +- .../gameserver/datatables/HennaTable.java | 2 +- .../gameserver/datatables/HennaTreeTable.java | 2 +- .../gameserver/datatables/ItemTable.java | 2 +- .../gameserver/datatables/LevelUpData.java | 2 +- .../gameserver/datatables/MapRegionTable.java | 2 +- .../l2jbr/gameserver/datatables/NpcTable.java | 2 +- .../datatables/NpcWalkerRoutesTable.java | 2 +- .../gameserver/datatables/PetNameTable.java | 2 +- .../datatables/SkillSpellbookTable.java | 2 +- .../gameserver/datatables/SkillTreeTable.java | 2 +- .../gameserver/datatables/SpawnTable.java | 2 +- .../datatables/TeleportLocationTable.java | 2 +- .../l2jbr/gameserver/datatables/ZoneData.java | 2 +- .../admincommandhandlers/AdminBan.java | 2 +- .../AdminChangeAccessLevel.java | 2 +- .../admincommandhandlers/AdminEditNpc.java | 2 +- .../admincommandhandlers/AdminMenu.java | 2 +- .../admincommandhandlers/AdminRepairChar.java | 2 +- .../usercommandhandlers/ClanWarsList.java | 2 +- .../voicedcommandhandlers/Wedding.java | 2 +- .../idfactory/CompactionIDFactory.java | 2 +- .../l2jbr/gameserver/idfactory/IdFactory.java | 2 +- .../gameserver/idfactory/StackIDFactory.java | 2 +- .../instancemanager/AuctionManager.java | 2 +- .../instancemanager/CastleManager.java | 2 +- .../instancemanager/CastleManorManager.java | 2 +- .../instancemanager/ClanHallManager.java | 2 +- .../instancemanager/CoupleManager.java | 2 +- .../instancemanager/CursedWeaponsManager.java | 2 +- .../DimensionalRiftManager.java | 2 +- .../instancemanager/ItemsOnGroundManager.java | 2 +- .../instancemanager/MercTicketManager.java | 2 +- .../instancemanager/RaidBossSpawnManager.java | 2 +- .../instancemanager/SiegeGuardManager.java | 2 +- .../instancemanager/SiegeManager.java | 2 +- .../instancemanager/games/Lottery.java | 2 +- .../gameserver/model/AutoChatHandler.java | 2 +- .../gameserver/model/AutoSpawnHandler.java | 2 +- .../l2jbr/gameserver/model/CursedWeapon.java | 2 +- .../com/l2jbr/gameserver/model/Inventory.java | 2 +- .../l2jbr/gameserver/model/ItemContainer.java | 2 +- .../gameserver/model/L2Augmentation.java | 2 +- .../com/l2jbr/gameserver/model/L2Clan.java | 2 +- .../l2jbr/gameserver/model/L2ClanMember.java | 2 +- .../gameserver/model/L2ItemInstance.java | 2 +- .../gameserver/model/L2PetDataTable.java | 2 +- .../l2jbr/gameserver/model/L2TradeList.java | 2 +- .../com/l2jbr/gameserver/model/MacroList.java | 2 +- .../l2jbr/gameserver/model/PcInventory.java | 2 +- .../com/l2jbr/gameserver/model/ShortCuts.java | 2 +- .../model/actor/instance/L2BoxInstance.java | 2 +- .../model/actor/instance/L2PcInstance.java | 2 +- .../model/actor/instance/L2PetInstance.java | 2 +- .../gameserver/model/actor/stat/PcStat.java | 2 +- .../gameserver/model/entity/Auction.java | 2 +- .../l2jbr/gameserver/model/entity/Castle.java | 2 +- .../gameserver/model/entity/ClanHall.java | 2 +- .../l2jbr/gameserver/model/entity/Couple.java | 2 +- .../l2jbr/gameserver/model/entity/Hero.java | 2 +- .../l2jbr/gameserver/model/entity/Siege.java | 2 +- .../l2jbr/gameserver/model/quest/Quest.java | 2 +- .../gameserver/network/L2GameClient.java | 2 +- .../serverpackets/CharSelectInfo.java | 2 +- .../gameserver/serverpackets/FriendList.java | 2 +- .../gameserver/status/GameStatusThread.java | 2 +- .../gameserver/taskmanager/TaskManager.java | 2 +- Loginserver/build.gradle | 5 +- .../l2jbr/loginserver/GameServerTable.java | 2 +- .../com/l2jbr/loginserver/L2LoginServer.java | 2 +- .../l2jbr/loginserver/LoginController.java | 2 +- .../loginserver/status/LoginStatusThread.java | 2 +- Tools/build.gradle | 5 +- .../accountmanager/SQLAccountManager.java | 2 +- .../gsregistering/GameServerRegister.java | 2 +- build.gradle | 2 +- 111 files changed, 251 insertions(+), 358 deletions(-) delete mode 100644 Commons/src/main/com.l2jbr.commons/com/l2jbr/commons/L2DatabaseFactory.java create mode 100644 Commons/src/main/com.l2jbr.commons/com/l2jbr/commons/database/L2DatabaseFactory.java diff --git a/Commons/build.gradle b/Commons/build.gradle index d849cc2a..28a5e04d 100644 --- a/Commons/build.gradle +++ b/Commons/build.gradle @@ -4,7 +4,7 @@ plugins { id "eclipse" } -version '1.3.0' +version '1.3.1' ext.moduleName = 'com.l2jbr.commons' @@ -20,7 +20,7 @@ sourceSets { } dependencies { - compile 'com.mchange:c3p0:0.9.5.2' + compile 'com.zaxxer:HikariCP:3.0.0' compile 'org.slf4j:slf4j-api:1.8.0-beta2' } diff --git a/Commons/src/main/com.l2jbr.commons/com/l2jbr/commons/Config.java b/Commons/src/main/com.l2jbr.commons/com/l2jbr/commons/Config.java index bebfa3d0..7e1c0214 100644 --- a/Commons/src/main/com.l2jbr.commons/com/l2jbr/commons/Config.java +++ b/Commons/src/main/com.l2jbr.commons/com/l2jbr/commons/Config.java @@ -37,6 +37,8 @@ */ public final class Config { protected static final Logger _log = LoggerFactory.getLogger(Config.class.getName()); + + /** * Debug/release mode */ @@ -102,6 +104,8 @@ public final class Config { */ public static int DATABASE_MAX_CONNECTIONS; + public static int DATABASE_MAX_IDLE_TIME; + /** * Maximum number of players allowed to play simultaneously on server */ @@ -1908,6 +1912,7 @@ public static void load() { DATABASE_LOGIN = serverSettings.getProperty("Login", "root"); DATABASE_PASSWORD = serverSettings.getProperty("Password", ""); DATABASE_MAX_CONNECTIONS = Integer.parseInt(serverSettings.getProperty("MaximumDbConnections", "10")); + DATABASE_MAX_IDLE_TIME = Integer.parseInt(serverSettings.getProperty("MaximumDbIdleTime", "0")); DATAPACK_ROOT = new File(serverSettings.getProperty("DatapackRoot", ".")).getCanonicalFile(); @@ -2735,7 +2740,8 @@ public static void load() { DATABASE_LOGIN = serverSettings.getProperty("Login", "root"); DATABASE_PASSWORD = serverSettings.getProperty("Password", ""); DATABASE_MAX_CONNECTIONS = Integer.parseInt(serverSettings.getProperty("MaximumDbConnections", "10")); - + DATABASE_MAX_IDLE_TIME = Integer.parseInt(serverSettings.getProperty("MaximumDbIdleTime", "0")); + SHOW_LICENCE = Boolean.parseBoolean(serverSettings.getProperty("ShowLicence", "true")); IP_UPDATE_TIME = Integer.parseInt(serverSettings.getProperty("IpUpdateTime", "15")); FORCE_GGAUTH = Boolean.parseBoolean(serverSettings.getProperty("ForceGGAuth", "false")); diff --git a/Commons/src/main/com.l2jbr.commons/com/l2jbr/commons/L2DatabaseFactory.java b/Commons/src/main/com.l2jbr.commons/com/l2jbr/commons/L2DatabaseFactory.java deleted file mode 100644 index 90d69585..00000000 --- a/Commons/src/main/com.l2jbr.commons/com/l2jbr/commons/L2DatabaseFactory.java +++ /dev/null @@ -1,242 +0,0 @@ -/* - * This program 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 2, 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, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA - * 02111-1307, USA. - * - * http://www.gnu.org/copyleft/gpl.html - */ -package com.l2jbr.commons; - -import com.mchange.v2.c3p0.ComboPooledDataSource; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import java.sql.Connection; -import java.sql.SQLException; - - -public class L2DatabaseFactory -{ - static Logger _log = LoggerFactory.getLogger(L2DatabaseFactory.class.getName()); - - public static enum ProviderType - { - MySql, - MsSql - } - - // ========================================================= - // Data Field - private static L2DatabaseFactory _instance; - private ProviderType _providerType; - private ComboPooledDataSource _source; - - // ========================================================= - // Constructor - public L2DatabaseFactory() throws SQLException - { - try - { - if (Config.DATABASE_MAX_CONNECTIONS < 2) - { - Config.DATABASE_MAX_CONNECTIONS = 2; - _log.warn("at least " + Config.DATABASE_MAX_CONNECTIONS + " db connections are required."); - } - - _source = new ComboPooledDataSource(); - _source.setAutoCommitOnClose(true); - - _source.setInitialPoolSize(10); - _source.setMinPoolSize(10); - _source.setMaxPoolSize(Config.DATABASE_MAX_CONNECTIONS); - - _source.setAcquireRetryAttempts(0); // try to obtain connections indefinitely (0 = never quit) - _source.setAcquireRetryDelay(500); // 500 miliseconds wait before try to acquire connection again - _source.setCheckoutTimeout(0); // 0 = wait indefinitely for new connection - // if pool is exhausted - _source.setAcquireIncrement(5); // if pool is exhausted, get 5 more connections at a time - // cause there is a "long" delay on acquire connection - // so taking more than one connection at once will make connection pooling - // more effective. - - // this "connection_test_table" is automatically created if not already there - _source.setAutomaticTestTable("connection_test_table"); - _source.setTestConnectionOnCheckin(false); - - // testing OnCheckin used with IdleConnectionTestPeriod is faster than testing on checkout - - _source.setIdleConnectionTestPeriod(3600); // test idle connection every 60 sec - _source.setMaxIdleTime(0); // 0 = idle connections never expire - // *THANKS* to connection testing configured above - // but I prefer to disconnect all connections not used - // for more than 1 hour - - // enables statement caching, there is a "semi-bug" in c3p0 0.9.0 but in 0.9.0.2 and later it's fixed - _source.setMaxStatementsPerConnection(100); - - _source.setBreakAfterAcquireFailure(false); // never fail if any way possible - // setting this to true will make - // c3p0 "crash" and refuse to work - // till restart thus making acquire - // errors "FATAL" ... we don't want that - // it should be possible to recover - _source.setDriverClass(Config.DATABASE_DRIVER); - _source.setJdbcUrl(Config.DATABASE_URL); - _source.setUser(Config.DATABASE_LOGIN); - _source.setPassword(Config.DATABASE_PASSWORD); - - /* Test the connection */ - _source.getConnection().close(); - - if (Config.DEBUG) - { - _log.debug("Database Connection Working"); - } - - if (Config.DATABASE_DRIVER.toLowerCase().contains("microsoft")) - { - _providerType = ProviderType.MsSql; - } - else - { - _providerType = ProviderType.MySql; - } - } - catch (SQLException x) - { - if (Config.DEBUG) - { - _log.debug("Database Connection FAILED"); - } - // rethrow the exception - throw x; - } - catch (Exception e) - { - if (Config.DEBUG) - { - _log.debug("Database Connection FAILED"); - } - throw new SQLException("could not init DB connection:" + e); - } - } - - // ========================================================= - // Method - Public - public final String prepQuerySelect(String[] fields, String tableName, String whereClause, boolean returnOnlyTopRecord) - { - String msSqlTop1 = ""; - String mySqlTop1 = ""; - if (returnOnlyTopRecord) - { - if (getProviderType() == ProviderType.MsSql) - { - msSqlTop1 = " Top 1 "; - } - if (getProviderType() == ProviderType.MySql) - { - mySqlTop1 = " Limit 1 "; - } - } - String query = "SELECT " + msSqlTop1 + safetyString(fields) + " FROM " + tableName + " WHERE " + whereClause + mySqlTop1; - return query; - } - - public void shutdown() - { - try - { - _source.close(); - } - catch (Exception e) - { - _log.info( "", e); - } - try - { - _source = null; - } - catch (Exception e) - { - _log.info( "", e); - } - } - - public final String safetyString(String[] whatToCheck) - { - // NOTE: Use brace as a safty percaution just incase name is a reserved word - String braceLeft = "`"; - String braceRight = "`"; - if (getProviderType() == ProviderType.MsSql) - { - braceLeft = "["; - braceRight = "]"; - } - - String result = ""; - for (String word : whatToCheck) - { - if (result != "") - { - result += ", "; - } - result += braceLeft + word + braceRight; - } - return result; - } - - // ========================================================= - // Property - Public - public static L2DatabaseFactory getInstance() throws SQLException - { - if (_instance == null) - { - _instance = new L2DatabaseFactory(); - } - return _instance; - } - - public Connection getConnection() // throws SQLException - { - Connection con = null; - - while (con == null) - { - try - { - con = _source.getConnection(); - } - catch (SQLException e) - { - _log.warn("L2DatabaseFactory: getConnection() failed, trying again " + e); - } - } - return con; - } - - public int getBusyConnectionCount() throws SQLException - { - return _source.getNumBusyConnectionsDefaultUser(); - } - - public int getIdleConnectionCount() throws SQLException - { - return _source.getNumIdleConnectionsDefaultUser(); - } - - public final ProviderType getProviderType() - { - return _providerType; - } -} diff --git a/Commons/src/main/com.l2jbr.commons/com/l2jbr/commons/database/L2DatabaseFactory.java b/Commons/src/main/com.l2jbr.commons/com/l2jbr/commons/database/L2DatabaseFactory.java new file mode 100644 index 00000000..072c52a5 --- /dev/null +++ b/Commons/src/main/com.l2jbr.commons/com/l2jbr/commons/database/L2DatabaseFactory.java @@ -0,0 +1,131 @@ +/* + * This program 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 2, 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, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA + * 02111-1307, USA. + * + * http://www.gnu.org/copyleft/gpl.html + */ +package com.l2jbr.commons.database; + +import com.l2jbr.commons.Config; +import com.zaxxer.hikari.HikariConfig; +import com.zaxxer.hikari.HikariDataSource; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import java.sql.Connection; +import java.sql.SQLException; + + +public class L2DatabaseFactory { + private static Logger _log = LoggerFactory.getLogger(L2DatabaseFactory.class); + + private static L2DatabaseFactory _instance; + private final HikariDataSource _dataSource; + + public L2DatabaseFactory() throws SQLException { + + + HikariConfig config = new HikariConfig(); + config.setJdbcUrl(Config.DATABASE_URL); + config.setUsername(Config.DATABASE_LOGIN); + config.setPassword(Config.DATABASE_PASSWORD); + config.addDataSourceProperty("cachePrepStmts", true); + config.addDataSourceProperty("prepStmtCacheSize", 250); + config.addDataSourceProperty("prepStmtCacheSqlLimit", 2048); + config.addDataSourceProperty("useServerPrepStmts", true); + config.addDataSourceProperty("useLocalSessionState", true); + config.addDataSourceProperty("useLocalTransactionState", true); + config.addDataSourceProperty("rewriteBatchedStatements", true); + config.addDataSourceProperty("cacheServerConfiguration", true); + config.addDataSourceProperty("cacheResultSetMetadata", true); + config.addDataSourceProperty("maintainTimeStats", true); + config.addDataSourceProperty("logger", "com.mysql.cj.core.log.Slf4JLogger"); + config.addDataSourceProperty("autoCommit", true); + config.addDataSourceProperty("minimumIdle", 10); + config.addDataSourceProperty("validationTimeout", 500); // 500 milliseconds wait before try to acquire connection again + config.addDataSourceProperty("connectionTimeout", 0); // 0 = wait indefinitely for new connection if pool is exhausted + config.addDataSourceProperty("maximumPoolSize", Config.DATABASE_MAX_CONNECTIONS); + config.addDataSourceProperty("idleTimeout", Config.DATABASE_MAX_IDLE_TIME); // 0 = idle connections never expire + config.addDataSourceProperty("driverClassName", Config.DATABASE_DRIVER); + _dataSource = new HikariDataSource(config); + + + // Test DB connection + try { + _dataSource.getConnection().close(); + } catch (SQLException e) { + if (Config.DEBUG) { + _log.error("Database Connection FAILED"); + } + _log.error(e.getMessage(), e); + } + } + + public final static String prepQuerySelect(String[] fields, String tableName, String whereClause, boolean returnOnlyTopRecord) { + String msSqlTop1 = ""; + String mySqlTop1 = ""; + if (returnOnlyTopRecord) { + mySqlTop1 = " Limit 1 "; + } + String query = "SELECT " + msSqlTop1 + safetyString(fields) + " FROM " + tableName + " WHERE " + whereClause + mySqlTop1; + return query; + } + + public void shutdown() { + try { + _dataSource.close(); + } catch (Exception e) { + _log.info(e.getMessage(), e); + } + + } + + public final static String safetyString(String[] whatToCheck) { + // NOTE: Use brace as a safty percaution just incase name is a reserved word + String braceLeft = "`"; + String braceRight = "`"; + + String result = ""; + for (String word : whatToCheck) { + if (result != "") result += ", "; + result += braceLeft + word + braceRight; + } + return result; + } + + public static L2DatabaseFactory getInstance() throws SQLException { + if (_instance == null) { + _instance = new L2DatabaseFactory(); + } + return _instance; + } + + public Connection getConnection() //throws SQLException + { + Connection con = null; + + while (con == null) { + try { + con = _dataSource.getConnection(); + } catch (SQLException e) { + _log.warn("L2DatabaseFactory: getConnection() failed, trying again", e); + } + } + return con; + } + + public static void close(Connection conn) { + } +} \ No newline at end of file diff --git a/Commons/src/main/com.l2jbr.commons/com/l2jbr/commons/lib/SqlUtils.java b/Commons/src/main/com.l2jbr.commons/com/l2jbr/commons/lib/SqlUtils.java index 2a0361b1..c279ba8c 100644 --- a/Commons/src/main/com.l2jbr.commons/com/l2jbr/commons/lib/SqlUtils.java +++ b/Commons/src/main/com.l2jbr.commons/com/l2jbr/commons/lib/SqlUtils.java @@ -17,7 +17,7 @@ */ package com.l2jbr.commons.lib; -import com.l2jbr.commons.L2DatabaseFactory; +import com.l2jbr.commons.database.L2DatabaseFactory; import org.slf4j.Logger; import org.slf4j.LoggerFactory; diff --git a/Commons/src/main/com.l2jbr.commons/module-info.java b/Commons/src/main/com.l2jbr.commons/module-info.java index 0ea3d9c8..6dcc10af 100644 --- a/Commons/src/main/com.l2jbr.commons/module-info.java +++ b/Commons/src/main/com.l2jbr.commons/module-info.java @@ -1,9 +1,9 @@ module com.l2jbr.commons { requires java.sql; - requires c3p0; requires java.naming; requires java.desktop; requires org.slf4j; + requires com.zaxxer.hikari; exports com.l2jbr.commons.util; exports com.l2jbr.commons.xml; @@ -11,5 +11,6 @@ exports com.l2jbr.commons.status; exports com.l2jbr.commons.lib; exports com.l2jbr.commons; + exports com.l2jbr.commons.database; } \ No newline at end of file diff --git a/Datapack/build.gradle b/Datapack/build.gradle index 38f13605..5bfb5a24 100644 --- a/Datapack/build.gradle +++ b/Datapack/build.gradle @@ -4,7 +4,7 @@ plugins { id "eclipse" } -version '1.3.0' +version '1.3.1' task zip(type: Zip) { from('data') { diff --git a/Datapack/data/jscript/quests/503_PursuitClanAmbition/__init__.py b/Datapack/data/jscript/quests/503_PursuitClanAmbition/__init__.py index 01b22176..f89e38f4 100644 --- a/Datapack/data/jscript/quests/503_PursuitClanAmbition/__init__.py +++ b/Datapack/data/jscript/quests/503_PursuitClanAmbition/__init__.py @@ -8,7 +8,7 @@ from com.l2jbr.gameserver.model.quest import State from com.l2jbr.gameserver.model.quest import QuestState from com.l2jbr.gameserver.model.quest.jython import QuestJython as JQuest -from com.l2jbr.commons import L2DatabaseFactory +from com.l2jbr.commons.database import L2DatabaseFactory qn = "503_PursuitClanAmbition" qd = "Pursuit Clan Ambition" diff --git a/Gameserver/build.gradle b/Gameserver/build.gradle index 476a687e..f7572505 100644 --- a/Gameserver/build.gradle +++ b/Gameserver/build.gradle @@ -6,7 +6,7 @@ plugins { ext.moduleName = 'com.l2jbr.gameserver' -version '1.3.0' +version '1.3.1' sourceSets { main { @@ -34,8 +34,7 @@ dependencies { runtime 'org.apache.logging.log4j:log4j-api:2.11.0' runtime 'org.apache.logging.log4j:log4j-slf4j-impl:2.11.0' runtime 'org.beanshell:bsh:2.0b5' - runtime 'com.mchange:c3p0:0.9.5.2' - runtime 'com.mchange:mchange-commons-java:0.2.15' + runtime 'com.zaxxer:HikariCP:3.0.0' runtime 'mysql:mysql-connector-java:8.0.9-rc' } diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/GameServer.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/GameServer.java index fe098f6b..081f9928 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/GameServer.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/GameServer.java @@ -19,7 +19,7 @@ package com.l2jbr.gameserver; import com.l2jbr.commons.Config; -import com.l2jbr.commons.L2DatabaseFactory; +import com.l2jbr.commons.database.L2DatabaseFactory; import com.l2jbr.commons.Server; import com.l2jbr.commons.status.Status; import com.l2jbr.gameserver.cache.CrestCache; diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/Olympiad.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/Olympiad.java index 73101fd4..418755bc 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/Olympiad.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/Olympiad.java @@ -24,7 +24,7 @@ package com.l2jbr.gameserver; import com.l2jbr.commons.Config; -import com.l2jbr.commons.L2DatabaseFactory; +import com.l2jbr.commons.database.L2DatabaseFactory; import com.l2jbr.commons.util.Rnd; import com.l2jbr.gameserver.datatables.HeroSkillTable; import com.l2jbr.gameserver.datatables.SkillTable; diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/SevenSigns.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/SevenSigns.java index 3be63051..d9e8742b 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/SevenSigns.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/SevenSigns.java @@ -18,7 +18,7 @@ package com.l2jbr.gameserver; import com.l2jbr.commons.Config; -import com.l2jbr.commons.L2DatabaseFactory; +import com.l2jbr.commons.database.L2DatabaseFactory; import com.l2jbr.gameserver.datatables.MapRegionTable; import com.l2jbr.gameserver.instancemanager.CastleManager; import com.l2jbr.gameserver.model.AutoChatHandler; diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/SevenSignsFestival.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/SevenSignsFestival.java index f549a949..16d17198 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/SevenSignsFestival.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/SevenSignsFestival.java @@ -18,7 +18,7 @@ package com.l2jbr.gameserver; import com.l2jbr.commons.Config; -import com.l2jbr.commons.L2DatabaseFactory; +import com.l2jbr.commons.database.L2DatabaseFactory; import com.l2jbr.commons.util.Rnd; import com.l2jbr.gameserver.ai.CtrlIntention; import com.l2jbr.gameserver.datatables.ClanTable; diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/Shutdown.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/Shutdown.java index 9bd72fc2..6f29013f 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/Shutdown.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/Shutdown.java @@ -19,7 +19,7 @@ package com.l2jbr.gameserver; import com.l2jbr.commons.Config; -import com.l2jbr.commons.L2DatabaseFactory; +import com.l2jbr.commons.database.L2DatabaseFactory; import com.l2jbr.gameserver.gameserverpackets.ServerStatus; import com.l2jbr.gameserver.instancemanager.*; import com.l2jbr.gameserver.model.L2World; diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/TradeController.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/TradeController.java index 66822f93..6dcaa20c 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/TradeController.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/TradeController.java @@ -19,7 +19,7 @@ package com.l2jbr.gameserver; import com.l2jbr.commons.Config; -import com.l2jbr.commons.L2DatabaseFactory; +import com.l2jbr.commons.database.L2DatabaseFactory; import com.l2jbr.gameserver.datatables.ItemTable; import com.l2jbr.gameserver.model.L2ItemInstance; import com.l2jbr.gameserver.model.L2TradeList; diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/cache/CrestCache.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/cache/CrestCache.java index cc78357b..08a3c459 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/cache/CrestCache.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/cache/CrestCache.java @@ -19,7 +19,7 @@ package com.l2jbr.gameserver.cache; import com.l2jbr.commons.Config; -import com.l2jbr.commons.L2DatabaseFactory; +import com.l2jbr.commons.database.L2DatabaseFactory; import com.l2jbr.gameserver.datatables.ClanTable; import com.l2jbr.gameserver.idfactory.IdFactory; import com.l2jbr.gameserver.model.L2Clan; diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/clientpackets/EnterWorld.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/clientpackets/EnterWorld.java index af58009e..1649f272 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/clientpackets/EnterWorld.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/clientpackets/EnterWorld.java @@ -20,7 +20,7 @@ import com.l2jbr.commons.Base64; import com.l2jbr.commons.Config; -import com.l2jbr.commons.L2DatabaseFactory; +import com.l2jbr.commons.database.L2DatabaseFactory; import com.l2jbr.gameserver.*; import com.l2jbr.gameserver.cache.HtmCache; import com.l2jbr.gameserver.communitybbs.Manager.RegionBBSManager; diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/clientpackets/Logout.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/clientpackets/Logout.java index bf036579..b141b9e6 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/clientpackets/Logout.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/clientpackets/Logout.java @@ -19,7 +19,7 @@ package com.l2jbr.gameserver.clientpackets; import com.l2jbr.commons.Config; -import com.l2jbr.commons.L2DatabaseFactory; +import com.l2jbr.commons.database.L2DatabaseFactory; import com.l2jbr.gameserver.Olympiad; import com.l2jbr.gameserver.SevenSignsFestival; import com.l2jbr.gameserver.communitybbs.Manager.RegionBBSManager; diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/clientpackets/RequestAnswerFriendInvite.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/clientpackets/RequestAnswerFriendInvite.java index 343f0bed..4404c709 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/clientpackets/RequestAnswerFriendInvite.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/clientpackets/RequestAnswerFriendInvite.java @@ -18,7 +18,7 @@ */ package com.l2jbr.gameserver.clientpackets; -import com.l2jbr.commons.L2DatabaseFactory; +import com.l2jbr.commons.database.L2DatabaseFactory; import com.l2jbr.gameserver.model.actor.instance.L2PcInstance; import com.l2jbr.gameserver.network.SystemMessageId; import com.l2jbr.gameserver.serverpackets.SystemMessage; diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/clientpackets/RequestDestroyItem.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/clientpackets/RequestDestroyItem.java index cc18d30f..5ae57834 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/clientpackets/RequestDestroyItem.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/clientpackets/RequestDestroyItem.java @@ -19,7 +19,7 @@ package com.l2jbr.gameserver.clientpackets; import com.l2jbr.commons.Config; -import com.l2jbr.commons.L2DatabaseFactory; +import com.l2jbr.commons.database.L2DatabaseFactory; import com.l2jbr.gameserver.instancemanager.CursedWeaponsManager; import com.l2jbr.gameserver.model.L2ItemInstance; import com.l2jbr.gameserver.model.L2PetDataTable; diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/clientpackets/RequestExSetPledgeCrestLarge.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/clientpackets/RequestExSetPledgeCrestLarge.java index 7c51ba85..d8e0e875 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/clientpackets/RequestExSetPledgeCrestLarge.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/clientpackets/RequestExSetPledgeCrestLarge.java @@ -18,7 +18,7 @@ */ package com.l2jbr.gameserver.clientpackets; -import com.l2jbr.commons.L2DatabaseFactory; +import com.l2jbr.commons.database.L2DatabaseFactory; import com.l2jbr.gameserver.cache.CrestCache; import com.l2jbr.gameserver.idfactory.IdFactory; import com.l2jbr.gameserver.model.L2Clan; diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/clientpackets/RequestFriendDel.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/clientpackets/RequestFriendDel.java index 0ca80ac9..dfa3578b 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/clientpackets/RequestFriendDel.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/clientpackets/RequestFriendDel.java @@ -18,7 +18,7 @@ */ package com.l2jbr.gameserver.clientpackets; -import com.l2jbr.commons.L2DatabaseFactory; +import com.l2jbr.commons.database.L2DatabaseFactory; import com.l2jbr.gameserver.model.L2World; import com.l2jbr.gameserver.model.actor.instance.L2PcInstance; import com.l2jbr.gameserver.network.SystemMessageId; diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/clientpackets/RequestFriendInvite.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/clientpackets/RequestFriendInvite.java index ec5b4497..d0f8b45d 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/clientpackets/RequestFriendInvite.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/clientpackets/RequestFriendInvite.java @@ -18,7 +18,7 @@ */ package com.l2jbr.gameserver.clientpackets; -import com.l2jbr.commons.L2DatabaseFactory; +import com.l2jbr.commons.database.L2DatabaseFactory; import com.l2jbr.gameserver.model.L2World; import com.l2jbr.gameserver.model.actor.instance.L2PcInstance; import com.l2jbr.gameserver.network.SystemMessageId; diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/clientpackets/RequestFriendList.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/clientpackets/RequestFriendList.java index 30c8bdcb..ce3d3897 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/clientpackets/RequestFriendList.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/clientpackets/RequestFriendList.java @@ -18,7 +18,7 @@ */ package com.l2jbr.gameserver.clientpackets; -import com.l2jbr.commons.L2DatabaseFactory; +import com.l2jbr.commons.database.L2DatabaseFactory; import com.l2jbr.gameserver.model.L2World; import com.l2jbr.gameserver.model.actor.instance.L2PcInstance; import com.l2jbr.gameserver.network.SystemMessageId; diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/clientpackets/RequestSetAllyCrest.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/clientpackets/RequestSetAllyCrest.java index e99bd200..aa1e2846 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/clientpackets/RequestSetAllyCrest.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/clientpackets/RequestSetAllyCrest.java @@ -18,7 +18,7 @@ */ package com.l2jbr.gameserver.clientpackets; -import com.l2jbr.commons.L2DatabaseFactory; +import com.l2jbr.commons.database.L2DatabaseFactory; import com.l2jbr.gameserver.cache.CrestCache; import com.l2jbr.gameserver.datatables.ClanTable; import com.l2jbr.gameserver.idfactory.IdFactory; diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/clientpackets/RequestSetPledgeCrest.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/clientpackets/RequestSetPledgeCrest.java index e5073609..65384a3e 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/clientpackets/RequestSetPledgeCrest.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/clientpackets/RequestSetPledgeCrest.java @@ -18,7 +18,7 @@ */ package com.l2jbr.gameserver.clientpackets; -import com.l2jbr.commons.L2DatabaseFactory; +import com.l2jbr.commons.database.L2DatabaseFactory; import com.l2jbr.gameserver.cache.CrestCache; import com.l2jbr.gameserver.idfactory.IdFactory; import com.l2jbr.gameserver.model.L2Clan; diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/communitybbs/BB/Forum.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/communitybbs/BB/Forum.java index 8396fcf2..1420e81c 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/communitybbs/BB/Forum.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/communitybbs/BB/Forum.java @@ -18,7 +18,7 @@ */ package com.l2jbr.gameserver.communitybbs.BB; -import com.l2jbr.commons.L2DatabaseFactory; +import com.l2jbr.commons.database.L2DatabaseFactory; import com.l2jbr.gameserver.communitybbs.Manager.ForumsBBSManager; import com.l2jbr.gameserver.communitybbs.Manager.TopicBBSManager; import org.slf4j.Logger; diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/communitybbs/BB/Post.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/communitybbs/BB/Post.java index 2628f63c..d7da2484 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/communitybbs/BB/Post.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/communitybbs/BB/Post.java @@ -18,7 +18,7 @@ */ package com.l2jbr.gameserver.communitybbs.BB; -import com.l2jbr.commons.L2DatabaseFactory; +import com.l2jbr.commons.database.L2DatabaseFactory; import com.l2jbr.gameserver.communitybbs.Manager.PostBBSManager; import org.slf4j.Logger; import org.slf4j.LoggerFactory; diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/communitybbs/BB/Topic.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/communitybbs/BB/Topic.java index 72f12d9d..47a6ef21 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/communitybbs/BB/Topic.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/communitybbs/BB/Topic.java @@ -18,7 +18,7 @@ */ package com.l2jbr.gameserver.communitybbs.BB; -import com.l2jbr.commons.L2DatabaseFactory; +import com.l2jbr.commons.database.L2DatabaseFactory; import com.l2jbr.gameserver.communitybbs.Manager.TopicBBSManager; import org.slf4j.Logger; import org.slf4j.LoggerFactory; diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/communitybbs/Manager/ForumsBBSManager.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/communitybbs/Manager/ForumsBBSManager.java index a8b4a0c3..ec3a2e54 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/communitybbs/Manager/ForumsBBSManager.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/communitybbs/Manager/ForumsBBSManager.java @@ -18,7 +18,7 @@ */ package com.l2jbr.gameserver.communitybbs.Manager; -import com.l2jbr.commons.L2DatabaseFactory; +import com.l2jbr.commons.database.L2DatabaseFactory; import com.l2jbr.gameserver.communitybbs.BB.Forum; import com.l2jbr.gameserver.model.actor.instance.L2PcInstance; import org.slf4j.Logger; diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/datatables/ArmorSetsTable.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/datatables/ArmorSetsTable.java index b3d4f434..4d0de2c4 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/datatables/ArmorSetsTable.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/datatables/ArmorSetsTable.java @@ -23,7 +23,7 @@ package com.l2jbr.gameserver.datatables; -import com.l2jbr.commons.L2DatabaseFactory; +import com.l2jbr.commons.database.L2DatabaseFactory; import com.l2jbr.gameserver.model.L2ArmorSet; import org.slf4j.Logger; import org.slf4j.LoggerFactory; diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/datatables/CharNameTable.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/datatables/CharNameTable.java index 9804b06f..7474bedd 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/datatables/CharNameTable.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/datatables/CharNameTable.java @@ -18,7 +18,7 @@ */ package com.l2jbr.gameserver.datatables; -import com.l2jbr.commons.L2DatabaseFactory; +import com.l2jbr.commons.database.L2DatabaseFactory; import org.slf4j.Logger; import org.slf4j.LoggerFactory; diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/datatables/CharTemplateTable.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/datatables/CharTemplateTable.java index 16e661f1..18d17ebf 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/datatables/CharTemplateTable.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/datatables/CharTemplateTable.java @@ -18,7 +18,7 @@ */ package com.l2jbr.gameserver.datatables; -import com.l2jbr.commons.L2DatabaseFactory; +import com.l2jbr.commons.database.L2DatabaseFactory; import com.l2jbr.gameserver.model.base.ClassId; import com.l2jbr.gameserver.templates.L2PcTemplate; import com.l2jbr.gameserver.templates.StatsSet; diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/datatables/ClanTable.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/datatables/ClanTable.java index 1954a805..1e1e4c11 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/datatables/ClanTable.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/datatables/ClanTable.java @@ -19,7 +19,7 @@ package com.l2jbr.gameserver.datatables; import com.l2jbr.commons.Config; -import com.l2jbr.commons.L2DatabaseFactory; +import com.l2jbr.commons.database.L2DatabaseFactory; import com.l2jbr.gameserver.ThreadPoolManager; import com.l2jbr.gameserver.idfactory.IdFactory; import com.l2jbr.gameserver.instancemanager.SiegeManager; diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/datatables/FishTable.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/datatables/FishTable.java index 9620c878..9272b578 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/datatables/FishTable.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/datatables/FishTable.java @@ -18,7 +18,7 @@ */ package com.l2jbr.gameserver.datatables; -import com.l2jbr.commons.L2DatabaseFactory; +import com.l2jbr.commons.database.L2DatabaseFactory; import com.l2jbr.gameserver.model.FishData; import org.slf4j.Logger; import org.slf4j.LoggerFactory; diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/datatables/HelperBuffTable.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/datatables/HelperBuffTable.java index 34cf487f..43e67962 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/datatables/HelperBuffTable.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/datatables/HelperBuffTable.java @@ -18,7 +18,7 @@ */ package com.l2jbr.gameserver.datatables; -import com.l2jbr.commons.L2DatabaseFactory; +import com.l2jbr.commons.database.L2DatabaseFactory; import com.l2jbr.gameserver.templates.L2HelperBuff; import com.l2jbr.gameserver.templates.StatsSet; import org.slf4j.Logger; diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/datatables/HennaTable.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/datatables/HennaTable.java index e43c1376..453214c7 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/datatables/HennaTable.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/datatables/HennaTable.java @@ -18,7 +18,7 @@ */ package com.l2jbr.gameserver.datatables; -import com.l2jbr.commons.L2DatabaseFactory; +import com.l2jbr.commons.database.L2DatabaseFactory; import com.l2jbr.gameserver.templates.L2Henna; import com.l2jbr.gameserver.templates.StatsSet; import org.slf4j.Logger; diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/datatables/HennaTreeTable.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/datatables/HennaTreeTable.java index 473631be..87050e37 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/datatables/HennaTreeTable.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/datatables/HennaTreeTable.java @@ -18,7 +18,7 @@ */ package com.l2jbr.gameserver.datatables; -import com.l2jbr.commons.L2DatabaseFactory; +import com.l2jbr.commons.database.L2DatabaseFactory; import com.l2jbr.gameserver.model.L2HennaInstance; import com.l2jbr.gameserver.model.base.ClassId; import com.l2jbr.gameserver.templates.L2Henna; diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/datatables/ItemTable.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/datatables/ItemTable.java index bf3e2622..46e280f6 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/datatables/ItemTable.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/datatables/ItemTable.java @@ -19,7 +19,7 @@ package com.l2jbr.gameserver.datatables; import com.l2jbr.commons.Config; -import com.l2jbr.commons.L2DatabaseFactory; +import com.l2jbr.commons.database.L2DatabaseFactory; import com.l2jbr.gameserver.Item; import com.l2jbr.gameserver.ThreadPoolManager; import com.l2jbr.gameserver.idfactory.IdFactory; diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/datatables/LevelUpData.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/datatables/LevelUpData.java index 4f1352a0..420cd2d3 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/datatables/LevelUpData.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/datatables/LevelUpData.java @@ -18,7 +18,7 @@ */ package com.l2jbr.gameserver.datatables; -import com.l2jbr.commons.L2DatabaseFactory; +import com.l2jbr.commons.database.L2DatabaseFactory; import com.l2jbr.gameserver.model.L2LvlupData; import com.l2jbr.gameserver.model.base.ClassId; import org.slf4j.Logger; diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/datatables/MapRegionTable.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/datatables/MapRegionTable.java index 83d2e760..0aa784e7 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/datatables/MapRegionTable.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/datatables/MapRegionTable.java @@ -19,7 +19,7 @@ package com.l2jbr.gameserver.datatables; import com.l2jbr.commons.Config; -import com.l2jbr.commons.L2DatabaseFactory; +import com.l2jbr.commons.database.L2DatabaseFactory; import com.l2jbr.gameserver.instancemanager.ArenaManager; import com.l2jbr.gameserver.instancemanager.CastleManager; import com.l2jbr.gameserver.instancemanager.ClanHallManager; diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/datatables/NpcTable.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/datatables/NpcTable.java index b14ef0dd..1274f740 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/datatables/NpcTable.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/datatables/NpcTable.java @@ -19,7 +19,7 @@ package com.l2jbr.gameserver.datatables; import com.l2jbr.commons.Config; -import com.l2jbr.commons.L2DatabaseFactory; +import com.l2jbr.commons.database.L2DatabaseFactory; import com.l2jbr.gameserver.model.L2DropCategory; import com.l2jbr.gameserver.model.L2DropData; import com.l2jbr.gameserver.model.L2MinionData; diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/datatables/NpcWalkerRoutesTable.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/datatables/NpcWalkerRoutesTable.java index 01c01baa..b090be5a 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/datatables/NpcWalkerRoutesTable.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/datatables/NpcWalkerRoutesTable.java @@ -18,7 +18,7 @@ */ package com.l2jbr.gameserver.datatables; -import com.l2jbr.commons.L2DatabaseFactory; +import com.l2jbr.commons.database.L2DatabaseFactory; import com.l2jbr.gameserver.model.L2NpcWalkerNode; import org.slf4j.Logger; import org.slf4j.LoggerFactory; diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/datatables/PetNameTable.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/datatables/PetNameTable.java index 4ab25be8..bb901dca 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/datatables/PetNameTable.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/datatables/PetNameTable.java @@ -19,7 +19,7 @@ package com.l2jbr.gameserver.datatables; import com.l2jbr.commons.Config; -import com.l2jbr.commons.L2DatabaseFactory; +import com.l2jbr.commons.database.L2DatabaseFactory; import com.l2jbr.gameserver.model.L2PetDataTable; import org.slf4j.Logger; import org.slf4j.LoggerFactory; diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/datatables/SkillSpellbookTable.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/datatables/SkillSpellbookTable.java index 0926f0f0..75857b38 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/datatables/SkillSpellbookTable.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/datatables/SkillSpellbookTable.java @@ -18,7 +18,7 @@ */ package com.l2jbr.gameserver.datatables; -import com.l2jbr.commons.L2DatabaseFactory; +import com.l2jbr.commons.database.L2DatabaseFactory; import com.l2jbr.gameserver.model.L2Skill; import org.slf4j.Logger; import org.slf4j.LoggerFactory; diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/datatables/SkillTreeTable.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/datatables/SkillTreeTable.java index 3eb02654..86a079df 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/datatables/SkillTreeTable.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/datatables/SkillTreeTable.java @@ -18,7 +18,7 @@ */ package com.l2jbr.gameserver.datatables; -import com.l2jbr.commons.L2DatabaseFactory; +import com.l2jbr.commons.database.L2DatabaseFactory; import com.l2jbr.gameserver.model.L2EnchantSkillLearn; import com.l2jbr.gameserver.model.L2PledgeSkillLearn; import com.l2jbr.gameserver.model.L2Skill; diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/datatables/SpawnTable.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/datatables/SpawnTable.java index 8949db43..3ecb9bcb 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/datatables/SpawnTable.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/datatables/SpawnTable.java @@ -19,7 +19,7 @@ package com.l2jbr.gameserver.datatables; import com.l2jbr.commons.Config; -import com.l2jbr.commons.L2DatabaseFactory; +import com.l2jbr.commons.database.L2DatabaseFactory; import com.l2jbr.gameserver.instancemanager.DayNightSpawnManager; import com.l2jbr.gameserver.model.L2Spawn; import com.l2jbr.gameserver.model.actor.instance.L2PcInstance; diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/datatables/TeleportLocationTable.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/datatables/TeleportLocationTable.java index 9c5e17ec..fe16885d 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/datatables/TeleportLocationTable.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/datatables/TeleportLocationTable.java @@ -18,7 +18,7 @@ */ package com.l2jbr.gameserver.datatables; -import com.l2jbr.commons.L2DatabaseFactory; +import com.l2jbr.commons.database.L2DatabaseFactory; import com.l2jbr.gameserver.model.L2TeleportLocation; import org.slf4j.Logger; import org.slf4j.LoggerFactory; diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/datatables/ZoneData.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/datatables/ZoneData.java index 0b991681..b28f7086 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/datatables/ZoneData.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/datatables/ZoneData.java @@ -18,7 +18,7 @@ package com.l2jbr.gameserver.datatables; import com.l2jbr.commons.Config; -import com.l2jbr.commons.L2DatabaseFactory; +import com.l2jbr.commons.database.L2DatabaseFactory; import com.l2jbr.gameserver.instancemanager.ArenaManager; import com.l2jbr.gameserver.instancemanager.FishingZoneManager; import com.l2jbr.gameserver.instancemanager.OlympiadStadiaManager; diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/handler/admincommandhandlers/AdminBan.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/handler/admincommandhandlers/AdminBan.java index 1a1476fc..23cc2e8f 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/handler/admincommandhandlers/AdminBan.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/handler/admincommandhandlers/AdminBan.java @@ -19,7 +19,7 @@ package com.l2jbr.gameserver.handler.admincommandhandlers; import com.l2jbr.commons.Config; -import com.l2jbr.commons.L2DatabaseFactory; +import com.l2jbr.commons.database.L2DatabaseFactory; import com.l2jbr.gameserver.LoginServerThread; import com.l2jbr.gameserver.communitybbs.Manager.RegionBBSManager; import com.l2jbr.gameserver.handler.IAdminCommandHandler; diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/handler/admincommandhandlers/AdminChangeAccessLevel.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/handler/admincommandhandlers/AdminChangeAccessLevel.java index 3fca4292..9aee668b 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/handler/admincommandhandlers/AdminChangeAccessLevel.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/handler/admincommandhandlers/AdminChangeAccessLevel.java @@ -19,7 +19,7 @@ package com.l2jbr.gameserver.handler.admincommandhandlers; import com.l2jbr.commons.Config; -import com.l2jbr.commons.L2DatabaseFactory; +import com.l2jbr.commons.database.L2DatabaseFactory; import com.l2jbr.gameserver.handler.IAdminCommandHandler; import com.l2jbr.gameserver.model.GMAudit; import com.l2jbr.gameserver.model.L2World; diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/handler/admincommandhandlers/AdminEditNpc.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/handler/admincommandhandlers/AdminEditNpc.java index a94368e5..487331c4 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/handler/admincommandhandlers/AdminEditNpc.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/handler/admincommandhandlers/AdminEditNpc.java @@ -19,7 +19,7 @@ package com.l2jbr.gameserver.handler.admincommandhandlers; import com.l2jbr.commons.Config; -import com.l2jbr.commons.L2DatabaseFactory; +import com.l2jbr.commons.database.L2DatabaseFactory; import com.l2jbr.gameserver.TradeController; import com.l2jbr.gameserver.cache.HtmCache; import com.l2jbr.gameserver.datatables.ItemTable; diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/handler/admincommandhandlers/AdminMenu.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/handler/admincommandhandlers/AdminMenu.java index 68a895eb..d5350394 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/handler/admincommandhandlers/AdminMenu.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/handler/admincommandhandlers/AdminMenu.java @@ -19,7 +19,7 @@ package com.l2jbr.gameserver.handler.admincommandhandlers; import com.l2jbr.commons.Config; -import com.l2jbr.commons.L2DatabaseFactory; +import com.l2jbr.commons.database.L2DatabaseFactory; import com.l2jbr.gameserver.LoginServerThread; import com.l2jbr.gameserver.handler.IAdminCommandHandler; import com.l2jbr.gameserver.model.*; diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/handler/admincommandhandlers/AdminRepairChar.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/handler/admincommandhandlers/AdminRepairChar.java index d6e37dd3..15d55d1d 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/handler/admincommandhandlers/AdminRepairChar.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/handler/admincommandhandlers/AdminRepairChar.java @@ -19,7 +19,7 @@ package com.l2jbr.gameserver.handler.admincommandhandlers; import com.l2jbr.commons.Config; -import com.l2jbr.commons.L2DatabaseFactory; +import com.l2jbr.commons.database.L2DatabaseFactory; import com.l2jbr.gameserver.handler.IAdminCommandHandler; import com.l2jbr.gameserver.model.GMAudit; import com.l2jbr.gameserver.model.actor.instance.L2PcInstance; diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/handler/usercommandhandlers/ClanWarsList.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/handler/usercommandhandlers/ClanWarsList.java index cf0f8b32..b9e08efa 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/handler/usercommandhandlers/ClanWarsList.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/handler/usercommandhandlers/ClanWarsList.java @@ -19,7 +19,7 @@ package com.l2jbr.gameserver.handler.usercommandhandlers; -import com.l2jbr.commons.L2DatabaseFactory; +import com.l2jbr.commons.database.L2DatabaseFactory; import com.l2jbr.gameserver.handler.IUserCommandHandler; import com.l2jbr.gameserver.model.L2Clan; import com.l2jbr.gameserver.model.actor.instance.L2PcInstance; diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/handler/voicedcommandhandlers/Wedding.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/handler/voicedcommandhandlers/Wedding.java index 2957b9dc..4dcdbd69 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/handler/voicedcommandhandlers/Wedding.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/handler/voicedcommandhandlers/Wedding.java @@ -2,7 +2,7 @@ package com.l2jbr.gameserver.handler.voicedcommandhandlers; import com.l2jbr.commons.Config; -import com.l2jbr.commons.L2DatabaseFactory; +import com.l2jbr.commons.database.L2DatabaseFactory; import com.l2jbr.gameserver.GameTimeController; import com.l2jbr.gameserver.ThreadPoolManager; import com.l2jbr.gameserver.ai.CtrlIntention; diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/idfactory/CompactionIDFactory.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/idfactory/CompactionIDFactory.java index 69728f81..cc670f98 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/idfactory/CompactionIDFactory.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/idfactory/CompactionIDFactory.java @@ -15,7 +15,7 @@ package com.l2jbr.gameserver.idfactory; import com.l2jbr.commons.Config; -import com.l2jbr.commons.L2DatabaseFactory; +import com.l2jbr.commons.database.L2DatabaseFactory; import org.slf4j.Logger; import org.slf4j.LoggerFactory; diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/idfactory/IdFactory.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/idfactory/IdFactory.java index 156a3d9a..b2549f3b 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/idfactory/IdFactory.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/idfactory/IdFactory.java @@ -19,7 +19,7 @@ package com.l2jbr.gameserver.idfactory; import com.l2jbr.commons.Config; -import com.l2jbr.commons.L2DatabaseFactory; +import com.l2jbr.commons.database.L2DatabaseFactory; import org.slf4j.Logger; import org.slf4j.LoggerFactory; diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/idfactory/StackIDFactory.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/idfactory/StackIDFactory.java index 629928ba..cad38e5b 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/idfactory/StackIDFactory.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/idfactory/StackIDFactory.java @@ -19,7 +19,7 @@ package com.l2jbr.gameserver.idfactory; import com.l2jbr.commons.Config; -import com.l2jbr.commons.L2DatabaseFactory; +import com.l2jbr.commons.database.L2DatabaseFactory; import org.slf4j.Logger; import org.slf4j.LoggerFactory; diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/instancemanager/AuctionManager.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/instancemanager/AuctionManager.java index 396e4cda..44ae12d7 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/instancemanager/AuctionManager.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/instancemanager/AuctionManager.java @@ -17,7 +17,7 @@ */ package com.l2jbr.gameserver.instancemanager; -import com.l2jbr.commons.L2DatabaseFactory; +import com.l2jbr.commons.database.L2DatabaseFactory; import com.l2jbr.gameserver.model.entity.Auction; import org.slf4j.Logger; import org.slf4j.LoggerFactory; diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/instancemanager/CastleManager.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/instancemanager/CastleManager.java index ac769261..838817e5 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/instancemanager/CastleManager.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/instancemanager/CastleManager.java @@ -17,7 +17,7 @@ */ package com.l2jbr.gameserver.instancemanager; -import com.l2jbr.commons.L2DatabaseFactory; +import com.l2jbr.commons.database.L2DatabaseFactory; import com.l2jbr.gameserver.SevenSigns; import com.l2jbr.gameserver.model.L2Clan; import com.l2jbr.gameserver.model.L2ClanMember; diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/instancemanager/CastleManorManager.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/instancemanager/CastleManorManager.java index 9308be8b..1639552f 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/instancemanager/CastleManorManager.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/instancemanager/CastleManorManager.java @@ -18,7 +18,7 @@ package com.l2jbr.gameserver.instancemanager; import com.l2jbr.commons.Config; -import com.l2jbr.commons.L2DatabaseFactory; +import com.l2jbr.commons.database.L2DatabaseFactory; import com.l2jbr.commons.util.Rnd; import com.l2jbr.gameserver.ThreadPoolManager; import com.l2jbr.gameserver.datatables.ClanTable; diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/instancemanager/ClanHallManager.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/instancemanager/ClanHallManager.java index fe6a2e77..83b31225 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/instancemanager/ClanHallManager.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/instancemanager/ClanHallManager.java @@ -17,7 +17,7 @@ */ package com.l2jbr.gameserver.instancemanager; -import com.l2jbr.commons.L2DatabaseFactory; +import com.l2jbr.commons.database.L2DatabaseFactory; import com.l2jbr.gameserver.datatables.ClanTable; import com.l2jbr.gameserver.model.L2Clan; import com.l2jbr.gameserver.model.entity.ClanHall; diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/instancemanager/CoupleManager.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/instancemanager/CoupleManager.java index d85be4da..ae7f5cfd 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/instancemanager/CoupleManager.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/instancemanager/CoupleManager.java @@ -18,7 +18,7 @@ */ package com.l2jbr.gameserver.instancemanager; -import com.l2jbr.commons.L2DatabaseFactory; +import com.l2jbr.commons.database.L2DatabaseFactory; import com.l2jbr.gameserver.model.L2World; import com.l2jbr.gameserver.model.actor.instance.L2PcInstance; import com.l2jbr.gameserver.model.entity.Couple; diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/instancemanager/CursedWeaponsManager.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/instancemanager/CursedWeaponsManager.java index 04cf602e..bef48c66 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/instancemanager/CursedWeaponsManager.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/instancemanager/CursedWeaponsManager.java @@ -18,7 +18,7 @@ package com.l2jbr.gameserver.instancemanager; import com.l2jbr.commons.Config; -import com.l2jbr.commons.L2DatabaseFactory; +import com.l2jbr.commons.database.L2DatabaseFactory; import com.l2jbr.gameserver.model.*; import com.l2jbr.gameserver.model.actor.instance.L2FestivalMonsterInstance; import com.l2jbr.gameserver.model.actor.instance.L2PcInstance; diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/instancemanager/DimensionalRiftManager.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/instancemanager/DimensionalRiftManager.java index 276d82d9..d948e03d 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/instancemanager/DimensionalRiftManager.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/instancemanager/DimensionalRiftManager.java @@ -19,7 +19,7 @@ package com.l2jbr.gameserver.instancemanager; import com.l2jbr.commons.Config; -import com.l2jbr.commons.L2DatabaseFactory; +import com.l2jbr.commons.database.L2DatabaseFactory; import com.l2jbr.commons.util.Rnd; import com.l2jbr.gameserver.datatables.NpcTable; import com.l2jbr.gameserver.datatables.SpawnTable; diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/instancemanager/ItemsOnGroundManager.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/instancemanager/ItemsOnGroundManager.java index 59f9b8a3..c02ee2bb 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/instancemanager/ItemsOnGroundManager.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/instancemanager/ItemsOnGroundManager.java @@ -18,7 +18,7 @@ package com.l2jbr.gameserver.instancemanager; import com.l2jbr.commons.Config; -import com.l2jbr.commons.L2DatabaseFactory; +import com.l2jbr.commons.database.L2DatabaseFactory; import com.l2jbr.gameserver.ItemsAutoDestroy; import com.l2jbr.gameserver.ThreadPoolManager; import com.l2jbr.gameserver.model.L2ItemInstance; diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/instancemanager/MercTicketManager.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/instancemanager/MercTicketManager.java index f0815eb4..0e7fe7d2 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/instancemanager/MercTicketManager.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/instancemanager/MercTicketManager.java @@ -17,7 +17,7 @@ */ package com.l2jbr.gameserver.instancemanager; -import com.l2jbr.commons.L2DatabaseFactory; +import com.l2jbr.commons.database.L2DatabaseFactory; import com.l2jbr.gameserver.ThreadPoolManager; import com.l2jbr.gameserver.datatables.NpcTable; import com.l2jbr.gameserver.idfactory.IdFactory; diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/instancemanager/RaidBossSpawnManager.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/instancemanager/RaidBossSpawnManager.java index e01c6e7f..9a70c696 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/instancemanager/RaidBossSpawnManager.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/instancemanager/RaidBossSpawnManager.java @@ -19,7 +19,7 @@ package com.l2jbr.gameserver.instancemanager; import com.l2jbr.commons.Config; -import com.l2jbr.commons.L2DatabaseFactory; +import com.l2jbr.commons.database.L2DatabaseFactory; import com.l2jbr.commons.util.Rnd; import com.l2jbr.gameserver.GmListTable; import com.l2jbr.gameserver.ThreadPoolManager; diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/instancemanager/SiegeGuardManager.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/instancemanager/SiegeGuardManager.java index 2c0ca1f8..6a0eaa6d 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/instancemanager/SiegeGuardManager.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/instancemanager/SiegeGuardManager.java @@ -17,7 +17,7 @@ */ package com.l2jbr.gameserver.instancemanager; -import com.l2jbr.commons.L2DatabaseFactory; +import com.l2jbr.commons.database.L2DatabaseFactory; import com.l2jbr.gameserver.datatables.NpcTable; import com.l2jbr.gameserver.model.L2Spawn; import com.l2jbr.gameserver.model.actor.instance.L2PcInstance; diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/instancemanager/SiegeManager.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/instancemanager/SiegeManager.java index 4fb13b9f..3bd016bd 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/instancemanager/SiegeManager.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/instancemanager/SiegeManager.java @@ -18,7 +18,7 @@ package com.l2jbr.gameserver.instancemanager; import com.l2jbr.commons.Config; -import com.l2jbr.commons.L2DatabaseFactory; +import com.l2jbr.commons.database.L2DatabaseFactory; import com.l2jbr.gameserver.datatables.SkillTable; import com.l2jbr.gameserver.model.L2Character; import com.l2jbr.gameserver.model.L2Clan; diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/instancemanager/games/Lottery.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/instancemanager/games/Lottery.java index fd3f5246..1ca12b8e 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/instancemanager/games/Lottery.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/instancemanager/games/Lottery.java @@ -19,7 +19,7 @@ package com.l2jbr.gameserver.instancemanager.games; import com.l2jbr.commons.Config; -import com.l2jbr.commons.L2DatabaseFactory; +import com.l2jbr.commons.database.L2DatabaseFactory; import com.l2jbr.commons.util.Rnd; import com.l2jbr.gameserver.Announcements; import com.l2jbr.gameserver.ThreadPoolManager; diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/AutoChatHandler.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/AutoChatHandler.java index 34a18538..ccfbc313 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/AutoChatHandler.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/AutoChatHandler.java @@ -19,7 +19,7 @@ package com.l2jbr.gameserver.model; import com.l2jbr.commons.Config; -import com.l2jbr.commons.L2DatabaseFactory; +import com.l2jbr.commons.database.L2DatabaseFactory; import com.l2jbr.commons.util.Rnd; import com.l2jbr.gameserver.SevenSigns; import com.l2jbr.gameserver.ThreadPoolManager; diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/AutoSpawnHandler.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/AutoSpawnHandler.java index 96f4fc11..83da9238 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/AutoSpawnHandler.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/AutoSpawnHandler.java @@ -18,7 +18,7 @@ package com.l2jbr.gameserver.model; import com.l2jbr.commons.Config; -import com.l2jbr.commons.L2DatabaseFactory; +import com.l2jbr.commons.database.L2DatabaseFactory; import com.l2jbr.commons.util.Rnd; import com.l2jbr.gameserver.Announcements; import com.l2jbr.gameserver.ThreadPoolManager; diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/CursedWeapon.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/CursedWeapon.java index 06025b3e..736fe9a0 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/CursedWeapon.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/CursedWeapon.java @@ -18,7 +18,7 @@ package com.l2jbr.gameserver.model; import com.l2jbr.commons.Config; -import com.l2jbr.commons.L2DatabaseFactory; +import com.l2jbr.commons.database.L2DatabaseFactory; import com.l2jbr.commons.util.Rnd; import com.l2jbr.gameserver.ThreadPoolManager; import com.l2jbr.gameserver.datatables.SkillTable; diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/Inventory.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/Inventory.java index 3895d8f1..9fb4495b 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/Inventory.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/Inventory.java @@ -19,7 +19,7 @@ package com.l2jbr.gameserver.model; import com.l2jbr.commons.Config; -import com.l2jbr.commons.L2DatabaseFactory; +import com.l2jbr.commons.database.L2DatabaseFactory; import com.l2jbr.gameserver.datatables.ArmorSetsTable; import com.l2jbr.gameserver.datatables.ItemTable; import com.l2jbr.gameserver.datatables.SkillTable; diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/ItemContainer.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/ItemContainer.java index 42d2045e..c0ee9d0c 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/ItemContainer.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/ItemContainer.java @@ -19,7 +19,7 @@ package com.l2jbr.gameserver.model; import com.l2jbr.commons.Config; -import com.l2jbr.commons.L2DatabaseFactory; +import com.l2jbr.commons.database.L2DatabaseFactory; import com.l2jbr.gameserver.GameTimeController; import com.l2jbr.gameserver.datatables.ItemTable; import com.l2jbr.gameserver.model.L2ItemInstance.ItemLocation; diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/L2Augmentation.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/L2Augmentation.java index 7ad9ae04..f8276af7 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/L2Augmentation.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/L2Augmentation.java @@ -18,7 +18,7 @@ package com.l2jbr.gameserver.model; -import com.l2jbr.commons.L2DatabaseFactory; +import com.l2jbr.commons.database.L2DatabaseFactory; import com.l2jbr.gameserver.datatables.AugmentationData; import com.l2jbr.gameserver.datatables.SkillTable; import com.l2jbr.gameserver.model.actor.instance.L2PcInstance; diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/L2Clan.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/L2Clan.java index aef5ea26..cb3e271f 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/L2Clan.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/L2Clan.java @@ -19,7 +19,7 @@ package com.l2jbr.gameserver.model; import com.l2jbr.commons.Config; -import com.l2jbr.commons.L2DatabaseFactory; +import com.l2jbr.commons.database.L2DatabaseFactory; import com.l2jbr.gameserver.communitybbs.BB.Forum; import com.l2jbr.gameserver.communitybbs.Manager.ForumsBBSManager; import com.l2jbr.gameserver.datatables.ClanTable; diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/L2ClanMember.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/L2ClanMember.java index 05c2cd3b..7601b6f6 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/L2ClanMember.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/L2ClanMember.java @@ -18,7 +18,7 @@ */ package com.l2jbr.gameserver.model; -import com.l2jbr.commons.L2DatabaseFactory; +import com.l2jbr.commons.database.L2DatabaseFactory; import com.l2jbr.gameserver.instancemanager.SiegeManager; import com.l2jbr.gameserver.model.actor.instance.L2PcInstance; diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/L2ItemInstance.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/L2ItemInstance.java index dfe38ed0..cba124b6 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/L2ItemInstance.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/L2ItemInstance.java @@ -19,7 +19,7 @@ package com.l2jbr.gameserver.model; import com.l2jbr.commons.Config; -import com.l2jbr.commons.L2DatabaseFactory; +import com.l2jbr.commons.database.L2DatabaseFactory; import com.l2jbr.gameserver.ThreadPoolManager; import com.l2jbr.gameserver.ai.CtrlIntention; import com.l2jbr.gameserver.datatables.ItemTable; diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/L2PetDataTable.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/L2PetDataTable.java index f0da3be7..b62c78a5 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/L2PetDataTable.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/L2PetDataTable.java @@ -18,7 +18,7 @@ */ package com.l2jbr.gameserver.model; -import com.l2jbr.commons.L2DatabaseFactory; +import com.l2jbr.commons.database.L2DatabaseFactory; import com.l2jbr.gameserver.model.actor.instance.L2PetInstance; import org.slf4j.Logger; import org.slf4j.LoggerFactory; diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/L2TradeList.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/L2TradeList.java index 0d7617e6..ca09044c 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/L2TradeList.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/L2TradeList.java @@ -18,7 +18,7 @@ */ package com.l2jbr.gameserver.model; -import com.l2jbr.commons.L2DatabaseFactory; +import com.l2jbr.commons.database.L2DatabaseFactory; import com.l2jbr.gameserver.datatables.ItemTable; import com.l2jbr.gameserver.model.actor.instance.L2PcInstance; import com.l2jbr.gameserver.network.SystemMessageId; diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/MacroList.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/MacroList.java index 58618a70..6f69f298 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/MacroList.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/MacroList.java @@ -18,7 +18,7 @@ */ package com.l2jbr.gameserver.model; -import com.l2jbr.commons.L2DatabaseFactory; +import com.l2jbr.commons.database.L2DatabaseFactory; import com.l2jbr.gameserver.model.L2Macro.L2MacroCmd; import com.l2jbr.gameserver.model.actor.instance.L2PcInstance; import com.l2jbr.gameserver.serverpackets.SendMacroList; diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/PcInventory.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/PcInventory.java index aa22532f..db4a96ba 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/PcInventory.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/PcInventory.java @@ -17,7 +17,7 @@ */ package com.l2jbr.gameserver.model; -import com.l2jbr.commons.L2DatabaseFactory; +import com.l2jbr.commons.database.L2DatabaseFactory; import com.l2jbr.gameserver.model.L2ItemInstance.ItemLocation; import com.l2jbr.gameserver.model.TradeList.TradeItem; import com.l2jbr.gameserver.model.actor.instance.L2PcInstance; diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/ShortCuts.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/ShortCuts.java index a63bb7a3..e1b11dd7 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/ShortCuts.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/ShortCuts.java @@ -18,7 +18,7 @@ */ package com.l2jbr.gameserver.model; -import com.l2jbr.commons.L2DatabaseFactory; +import com.l2jbr.commons.database.L2DatabaseFactory; import com.l2jbr.gameserver.model.actor.instance.L2PcInstance; import com.l2jbr.gameserver.serverpackets.ExAutoSoulShot; import com.l2jbr.gameserver.serverpackets.ShortCutInit; diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/actor/instance/L2BoxInstance.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/actor/instance/L2BoxInstance.java index facf374b..c76799c8 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/actor/instance/L2BoxInstance.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/actor/instance/L2BoxInstance.java @@ -17,7 +17,7 @@ */ package com.l2jbr.gameserver.model.actor.instance; -import com.l2jbr.commons.L2DatabaseFactory; +import com.l2jbr.commons.database.L2DatabaseFactory; import com.l2jbr.gameserver.model.L2ItemInstance; import com.l2jbr.gameserver.serverpackets.ActionFailed; import com.l2jbr.gameserver.serverpackets.NpcHtmlMessage; diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/actor/instance/L2PcInstance.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/actor/instance/L2PcInstance.java index e8245c3a..79950257 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/actor/instance/L2PcInstance.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/actor/instance/L2PcInstance.java @@ -19,7 +19,7 @@ package com.l2jbr.gameserver.model.actor.instance; import com.l2jbr.commons.Config; -import com.l2jbr.commons.L2DatabaseFactory; +import com.l2jbr.commons.database.L2DatabaseFactory; import com.l2jbr.commons.util.Rnd; import com.l2jbr.gameserver.*; import com.l2jbr.gameserver.ai.CtrlIntention; diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/actor/instance/L2PetInstance.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/actor/instance/L2PetInstance.java index 1c57af1e..c8462b01 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/actor/instance/L2PetInstance.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/actor/instance/L2PetInstance.java @@ -19,7 +19,7 @@ package com.l2jbr.gameserver.model.actor.instance; import com.l2jbr.commons.Config; -import com.l2jbr.commons.L2DatabaseFactory; +import com.l2jbr.commons.database.L2DatabaseFactory; import com.l2jbr.gameserver.ThreadPoolManager; import com.l2jbr.gameserver.ai.CtrlIntention; import com.l2jbr.gameserver.idfactory.IdFactory; diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/actor/stat/PcStat.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/actor/stat/PcStat.java index 21b08f66..f2ac24fc 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/actor/stat/PcStat.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/actor/stat/PcStat.java @@ -18,7 +18,7 @@ package com.l2jbr.gameserver.model.actor.stat; import com.l2jbr.commons.Config; -import com.l2jbr.commons.L2DatabaseFactory; +import com.l2jbr.commons.database.L2DatabaseFactory; import com.l2jbr.gameserver.model.L2Character; import com.l2jbr.gameserver.model.actor.instance.L2PcInstance; import com.l2jbr.gameserver.model.actor.instance.L2PetInstance; diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/entity/Auction.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/entity/Auction.java index 25502d3a..2efbe5f6 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/entity/Auction.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/entity/Auction.java @@ -18,7 +18,7 @@ */ package com.l2jbr.gameserver.model.entity; -import com.l2jbr.commons.L2DatabaseFactory; +import com.l2jbr.commons.database.L2DatabaseFactory; import com.l2jbr.gameserver.GameServer; import com.l2jbr.gameserver.ThreadPoolManager; import com.l2jbr.gameserver.datatables.ClanTable; diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/entity/Castle.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/entity/Castle.java index 082fb158..396d3b41 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/entity/Castle.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/entity/Castle.java @@ -19,7 +19,7 @@ package com.l2jbr.gameserver.model.entity; import com.l2jbr.commons.Config; -import com.l2jbr.commons.L2DatabaseFactory; +import com.l2jbr.commons.database.L2DatabaseFactory; import com.l2jbr.gameserver.Announcements; import com.l2jbr.gameserver.CastleUpdater; import com.l2jbr.gameserver.SevenSigns; diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/entity/ClanHall.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/entity/ClanHall.java index 48acbe0d..674d0e6c 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/entity/ClanHall.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/entity/ClanHall.java @@ -19,7 +19,7 @@ package com.l2jbr.gameserver.model.entity; import com.l2jbr.commons.Config; -import com.l2jbr.commons.L2DatabaseFactory; +import com.l2jbr.commons.database.L2DatabaseFactory; import com.l2jbr.gameserver.GameServer; import com.l2jbr.gameserver.ThreadPoolManager; import com.l2jbr.gameserver.datatables.ClanTable; diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/entity/Couple.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/entity/Couple.java index f81e0fa8..417cdf32 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/entity/Couple.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/entity/Couple.java @@ -18,7 +18,7 @@ */ package com.l2jbr.gameserver.model.entity; -import com.l2jbr.commons.L2DatabaseFactory; +import com.l2jbr.commons.database.L2DatabaseFactory; import com.l2jbr.gameserver.idfactory.IdFactory; import com.l2jbr.gameserver.model.actor.instance.L2PcInstance; import org.slf4j.Logger; diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/entity/Hero.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/entity/Hero.java index c1c34965..f40bddd2 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/entity/Hero.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/entity/Hero.java @@ -24,7 +24,7 @@ package com.l2jbr.gameserver.model.entity; import com.l2jbr.commons.Config; -import com.l2jbr.commons.L2DatabaseFactory; +import com.l2jbr.commons.database.L2DatabaseFactory; import com.l2jbr.gameserver.Olympiad; import com.l2jbr.gameserver.datatables.ClanTable; import com.l2jbr.gameserver.model.L2Clan; diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/entity/Siege.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/entity/Siege.java index 7c873e1b..185b83c2 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/entity/Siege.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/entity/Siege.java @@ -18,7 +18,7 @@ */ package com.l2jbr.gameserver.model.entity; -import com.l2jbr.commons.L2DatabaseFactory; +import com.l2jbr.commons.database.L2DatabaseFactory; import com.l2jbr.gameserver.Announcements; import com.l2jbr.gameserver.ThreadPoolManager; import com.l2jbr.gameserver.datatables.ClanTable; diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/quest/Quest.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/quest/Quest.java index 97f5b0d1..98cf33f7 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/quest/Quest.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/quest/Quest.java @@ -19,7 +19,7 @@ package com.l2jbr.gameserver.model.quest; import com.l2jbr.commons.Config; -import com.l2jbr.commons.L2DatabaseFactory; +import com.l2jbr.commons.database.L2DatabaseFactory; import com.l2jbr.commons.util.Rnd; import com.l2jbr.gameserver.ThreadPoolManager; import com.l2jbr.gameserver.cache.HtmCache; diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/network/L2GameClient.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/network/L2GameClient.java index 7f637cf8..a043a13b 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/network/L2GameClient.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/network/L2GameClient.java @@ -18,7 +18,7 @@ package com.l2jbr.gameserver.network; import com.l2jbr.commons.Config; -import com.l2jbr.commons.L2DatabaseFactory; +import com.l2jbr.commons.database.L2DatabaseFactory; import com.l2jbr.gameserver.LoginServerThread; import com.l2jbr.gameserver.LoginServerThread.SessionKey; import com.l2jbr.gameserver.ThreadPoolManager; diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/serverpackets/CharSelectInfo.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/serverpackets/CharSelectInfo.java index 43c5294e..afc9f7c5 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/serverpackets/CharSelectInfo.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/serverpackets/CharSelectInfo.java @@ -18,7 +18,7 @@ */ package com.l2jbr.gameserver.serverpackets; -import com.l2jbr.commons.L2DatabaseFactory; +import com.l2jbr.commons.database.L2DatabaseFactory; import com.l2jbr.gameserver.model.CharSelectInfoPackage; import com.l2jbr.gameserver.model.Inventory; import com.l2jbr.gameserver.model.L2Clan; diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/serverpackets/FriendList.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/serverpackets/FriendList.java index 7d41f47f..2c7ec3bd 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/serverpackets/FriendList.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/serverpackets/FriendList.java @@ -18,7 +18,7 @@ */ package com.l2jbr.gameserver.serverpackets; -import com.l2jbr.commons.L2DatabaseFactory; +import com.l2jbr.commons.database.L2DatabaseFactory; import com.l2jbr.gameserver.model.L2World; import com.l2jbr.gameserver.model.actor.instance.L2PcInstance; import org.slf4j.Logger; diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/status/GameStatusThread.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/status/GameStatusThread.java index 92c7a88c..fc936052 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/status/GameStatusThread.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/status/GameStatusThread.java @@ -18,7 +18,7 @@ package com.l2jbr.gameserver.status; import com.l2jbr.commons.Config; -import com.l2jbr.commons.L2DatabaseFactory; +import com.l2jbr.commons.database.L2DatabaseFactory; import com.l2jbr.gameserver.*; import com.l2jbr.gameserver.Shutdown; import com.l2jbr.gameserver.cache.HtmCache; diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/taskmanager/TaskManager.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/taskmanager/TaskManager.java index 76e85521..8578ab94 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/taskmanager/TaskManager.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/taskmanager/TaskManager.java @@ -17,7 +17,7 @@ */ package com.l2jbr.gameserver.taskmanager; -import com.l2jbr.commons.L2DatabaseFactory; +import com.l2jbr.commons.database.L2DatabaseFactory; import com.l2jbr.gameserver.ThreadPoolManager; import com.l2jbr.gameserver.taskmanager.tasks.*; import org.slf4j.Logger; diff --git a/Loginserver/build.gradle b/Loginserver/build.gradle index 579d4865..eae0da79 100644 --- a/Loginserver/build.gradle +++ b/Loginserver/build.gradle @@ -5,7 +5,7 @@ plugins { } ext.moduleName = 'com.l2jbr.loginserver' -version '1.3.0' +version '1.3.1' sourceSets { main { @@ -31,8 +31,7 @@ dependencies { runtime 'org.apache.logging.log4j:log4j-core:2.11.0' runtime 'org.apache.logging.log4j:log4j-api:2.11.0' runtime 'org.apache.logging.log4j:log4j-slf4j-impl:2.11.0' - runtime 'com.mchange:c3p0:0.9.5.2' - runtime 'com.mchange:mchange-commons-java:0.2.15' + runtime 'com.zaxxer:HikariCP:3.0.0' runtime 'mysql:mysql-connector-java:8.0.9-rc' diff --git a/Loginserver/src/main/com.l2jbr.loginserver/com/l2jbr/loginserver/GameServerTable.java b/Loginserver/src/main/com.l2jbr.loginserver/com/l2jbr/loginserver/GameServerTable.java index ba9446ff..e2a5f60c 100644 --- a/Loginserver/src/main/com.l2jbr.loginserver/com/l2jbr/loginserver/GameServerTable.java +++ b/Loginserver/src/main/com.l2jbr.loginserver/com/l2jbr/loginserver/GameServerTable.java @@ -17,7 +17,7 @@ */ package com.l2jbr.loginserver; -import com.l2jbr.commons.L2DatabaseFactory; +import com.l2jbr.commons.database.L2DatabaseFactory; import com.l2jbr.commons.util.Rnd; import com.l2jbr.commons.xml.XMLDocumentFactory; import com.l2jbr.loginserver.gameserverpackets.ServerStatus; diff --git a/Loginserver/src/main/com.l2jbr.loginserver/com/l2jbr/loginserver/L2LoginServer.java b/Loginserver/src/main/com.l2jbr.loginserver/com/l2jbr/loginserver/L2LoginServer.java index 19c626af..a6eeb0e1 100644 --- a/Loginserver/src/main/com.l2jbr.loginserver/com/l2jbr/loginserver/L2LoginServer.java +++ b/Loginserver/src/main/com.l2jbr.loginserver/com/l2jbr/loginserver/L2LoginServer.java @@ -18,7 +18,7 @@ package com.l2jbr.loginserver; import com.l2jbr.commons.Config; -import com.l2jbr.commons.L2DatabaseFactory; +import com.l2jbr.commons.database.L2DatabaseFactory; import com.l2jbr.commons.Server; import com.l2jbr.commons.status.Status; import com.l2jbr.loginserver.status.LoginStatus; diff --git a/Loginserver/src/main/com.l2jbr.loginserver/com/l2jbr/loginserver/LoginController.java b/Loginserver/src/main/com.l2jbr.loginserver/com/l2jbr/loginserver/LoginController.java index ff7611ce..e26923a5 100644 --- a/Loginserver/src/main/com.l2jbr.loginserver/com/l2jbr/loginserver/LoginController.java +++ b/Loginserver/src/main/com.l2jbr.loginserver/com/l2jbr/loginserver/LoginController.java @@ -20,7 +20,7 @@ import com.l2jbr.commons.Base64; import com.l2jbr.commons.Config; -import com.l2jbr.commons.L2DatabaseFactory; +import com.l2jbr.commons.database.L2DatabaseFactory; import com.l2jbr.commons.lib.Log; import com.l2jbr.commons.util.Rnd; import com.l2jbr.loginserver.GameServerTable.GameServerInfo; diff --git a/Loginserver/src/main/com.l2jbr.loginserver/com/l2jbr/loginserver/status/LoginStatusThread.java b/Loginserver/src/main/com.l2jbr.loginserver/com/l2jbr/loginserver/status/LoginStatusThread.java index 902f225a..378ecd25 100644 --- a/Loginserver/src/main/com.l2jbr.loginserver/com/l2jbr/loginserver/status/LoginStatusThread.java +++ b/Loginserver/src/main/com.l2jbr.loginserver/com/l2jbr/loginserver/status/LoginStatusThread.java @@ -19,7 +19,7 @@ import com.l2jbr.commons.Base64; import com.l2jbr.commons.Config; -import com.l2jbr.commons.L2DatabaseFactory; +import com.l2jbr.commons.database.L2DatabaseFactory; import com.l2jbr.loginserver.GameServerTable; import com.l2jbr.loginserver.L2LoginServer; import com.l2jbr.loginserver.LoginController; diff --git a/Tools/build.gradle b/Tools/build.gradle index c56f9109..396cb42e 100644 --- a/Tools/build.gradle +++ b/Tools/build.gradle @@ -4,7 +4,7 @@ plugins { id "eclipse" } -version '1.3.0' +version '1.3.1' ext.moduleName = 'com.l2jbr.tools' @@ -27,8 +27,7 @@ dependencies { runtime project(':Mmocore') - runtime 'com.mchange:c3p0:0.9.5.2' - runtime 'com.mchange:mchange-commons-java:0.2.15' + runtime 'com.zaxxer:HikariCP:3.0.0' runtime 'mysql:mysql-connector-java:8.0.9-rc' } diff --git a/Tools/src/main/com.l2jbr.tools/com/l2jbr/tools/accountmanager/SQLAccountManager.java b/Tools/src/main/com.l2jbr.tools/com/l2jbr/tools/accountmanager/SQLAccountManager.java index d5c021d7..7d168ae6 100644 --- a/Tools/src/main/com.l2jbr.tools/com/l2jbr/tools/accountmanager/SQLAccountManager.java +++ b/Tools/src/main/com.l2jbr.tools/com/l2jbr/tools/accountmanager/SQLAccountManager.java @@ -20,7 +20,7 @@ import com.l2jbr.commons.Base64; import com.l2jbr.commons.Config; -import com.l2jbr.commons.L2DatabaseFactory; +import com.l2jbr.commons.database.L2DatabaseFactory; import com.l2jbr.commons.Server; import java.io.IOException; diff --git a/Tools/src/main/com.l2jbr.tools/com/l2jbr/tools/gsregistering/GameServerRegister.java b/Tools/src/main/com.l2jbr.tools/com/l2jbr/tools/gsregistering/GameServerRegister.java index 29bde162..0270128a 100644 --- a/Tools/src/main/com.l2jbr.tools/com/l2jbr/tools/gsregistering/GameServerRegister.java +++ b/Tools/src/main/com.l2jbr.tools/com/l2jbr/tools/gsregistering/GameServerRegister.java @@ -19,7 +19,7 @@ package com.l2jbr.tools.gsregistering; import com.l2jbr.commons.Config; -import com.l2jbr.commons.L2DatabaseFactory; +import com.l2jbr.commons.database.L2DatabaseFactory; import com.l2jbr.commons.Server; import com.l2jbr.gameserver.LoginServerThread; import com.l2jbr.loginserver.GameServerTable; diff --git a/build.gradle b/build.gradle index f95656c7..dd312679 100644 --- a/build.gradle +++ b/build.gradle @@ -5,7 +5,7 @@ plugins { id "eclipse" } -version '1.3.0' +version '1.3.1' defaultTasks('clean', 'build') From 6810cb7be270afd785d8c26971445721bcf0e0a5 Mon Sep 17 00:00:00 2001 From: Alisson Oliveira Date: Tue, 10 Apr 2018 18:54:11 -0300 Subject: [PATCH 003/236] =?UTF-8?q?Inicializa=20a=20cria=C3=A7=C3=A3o=20de?= =?UTF-8?q?=20DAO's=20para=20separa=C3=A7=C3=A3o=20da=20camada=20de=20aces?= =?UTF-8?q?so=20a=20dados.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .travis.yml | 5 +- .../com/l2jbr/commons/database/dao/DAO.java | 4 + .../main/com.l2jbr.commons/module-info.java | 1 + Datapack/sql/account_data.sql | 3 +- .../gameserver/model/dao/AccountData.java | 10 +++ .../l2jbr/gameserver/model/dao/Accounts.java | 13 +++ .../com/l2jbr/gameserver/model/dao/Armor.java | 28 +++++++ .../l2jbr/gameserver/model/dao/ArmorSet.java | 15 ++++ .../l2jbr/gameserver/model/dao/Auction.java | 19 +++++ .../gameserver/model/dao/AuctionBid.java | 13 +++ .../gameserver/model/dao/AuctionWatch.java | 6 ++ .../gameserver/model/dao/Augmentations.java | 11 +++ .../l2jbr/gameserver/model/dao/AutoChat.java | 10 +++ .../gameserver/model/dao/AutoChatText.java | 9 ++ .../l2jbr/gameserver/model/dao/BoxAccess.java | 8 ++ .../com/l2jbr/gameserver/model/dao/Boxes.java | 14 ++++ .../l2jbr/gameserver/model/dao/Castle.java | 13 +++ .../gameserver/model/dao/CastleDoor.java | 22 +++++ .../model/dao/CastleDoorUpgrade.java | 11 +++ .../model/dao/CastleManorProcure.java | 15 ++++ .../model/dao/CastleManorProduction.java | 12 +++ .../model/dao/CastleSiegeGuard.java | 16 ++++ .../gameserver/model/dao/CharTemplates.java | 44 ++++++++++ .../model/dao/CharacterFriends.java | 10 +++ .../gameserver/model/dao/CharacterHennas.java | 10 +++ .../model/dao/CharacterMacroses.java | 13 +++ .../gameserver/model/dao/CharacterQuests.java | 12 +++ .../model/dao/CharacterRecipeBook.java | 10 +++ .../model/dao/CharacterRecommends.java | 8 ++ .../model/dao/CharacterShortcuts.java | 13 +++ .../gameserver/model/dao/CharacterSkills.java | 12 +++ .../model/dao/CharacterSkillsSave.java | 16 ++++ .../model/dao/CharacterSubclasses.java | 14 ++++ .../gameserver/model/dao/Characters.java | 84 +++++++++++++++++++ .../l2jbr/gameserver/model/dao/ClanData.java | 23 +++++ .../l2jbr/gameserver/model/dao/ClanHall.java | 16 ++++ .../model/dao/ClanHallFunctions.java | 13 +++ .../l2jbr/gameserver/model/dao/ClanPrivs.java | 11 +++ .../gameserver/model/dao/ClanSkills.java | 10 +++ .../gameserver/model/dao/ClanSubpledges.java | 11 +++ .../l2jbr/gameserver/model/dao/ClanWars.java | 12 +++ .../gameserver/model/dao/CursedWeapons.java | 12 +++ .../gameserver/model/dao/DimensionalRift.java | 18 ++++ .../l2jbr/gameserver/model/dao/DropList.java | 12 +++ .../model/dao/EnchantSkillTrees.java | 17 ++++ .../l2jbr/gameserver/model/dao/EtcItem.java | 23 +++++ .../com/l2jbr/gameserver/model/dao/Fish.java | 17 ++++ .../model/dao/FishingSkillTrees.java | 15 ++++ .../l2jbr/gameserver/model/dao/Forums.java | 14 ++++ .../gameserver/model/dao/GameServers.java | 7 ++ .../com/l2jbr/gameserver/model/dao/Games.java | 18 ++++ .../l2jbr/gameserver/model/dao/classList.java | 9 ++ .../dao/repository/AccountDataRepository.java | 9 ++ 53 files changed, 769 insertions(+), 2 deletions(-) create mode 100644 Commons/src/main/com.l2jbr.commons/com/l2jbr/commons/database/dao/DAO.java create mode 100644 Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/AccountData.java create mode 100644 Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/Accounts.java create mode 100644 Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/Armor.java create mode 100644 Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/ArmorSet.java create mode 100644 Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/Auction.java create mode 100644 Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/AuctionBid.java create mode 100644 Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/AuctionWatch.java create mode 100644 Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/Augmentations.java create mode 100644 Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/AutoChat.java create mode 100644 Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/AutoChatText.java create mode 100644 Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/BoxAccess.java create mode 100644 Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/Boxes.java create mode 100644 Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/Castle.java create mode 100644 Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/CastleDoor.java create mode 100644 Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/CastleDoorUpgrade.java create mode 100644 Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/CastleManorProcure.java create mode 100644 Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/CastleManorProduction.java create mode 100644 Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/CastleSiegeGuard.java create mode 100644 Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/CharTemplates.java create mode 100644 Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/CharacterFriends.java create mode 100644 Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/CharacterHennas.java create mode 100644 Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/CharacterMacroses.java create mode 100644 Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/CharacterQuests.java create mode 100644 Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/CharacterRecipeBook.java create mode 100644 Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/CharacterRecommends.java create mode 100644 Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/CharacterShortcuts.java create mode 100644 Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/CharacterSkills.java create mode 100644 Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/CharacterSkillsSave.java create mode 100644 Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/CharacterSubclasses.java create mode 100644 Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/Characters.java create mode 100644 Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/ClanData.java create mode 100644 Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/ClanHall.java create mode 100644 Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/ClanHallFunctions.java create mode 100644 Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/ClanPrivs.java create mode 100644 Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/ClanSkills.java create mode 100644 Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/ClanSubpledges.java create mode 100644 Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/ClanWars.java create mode 100644 Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/CursedWeapons.java create mode 100644 Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/DimensionalRift.java create mode 100644 Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/DropList.java create mode 100644 Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/EnchantSkillTrees.java create mode 100644 Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/EtcItem.java create mode 100644 Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/Fish.java create mode 100644 Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/FishingSkillTrees.java create mode 100644 Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/Forums.java create mode 100644 Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/GameServers.java create mode 100644 Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/Games.java create mode 100644 Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/classList.java create mode 100644 Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/repository/AccountDataRepository.java diff --git a/.travis.yml b/.travis.yml index f5dd9ec6..5107062f 100644 --- a/.travis.yml +++ b/.travis.yml @@ -17,4 +17,7 @@ before_cache: cache: directories: - $HOME/.gradle/caches/ - - $HOME/.gradle/wrapper/ \ No newline at end of file + - $HOME/.gradle/wrapper/ + +notifications: + email: false \ No newline at end of file diff --git a/Commons/src/main/com.l2jbr.commons/com/l2jbr/commons/database/dao/DAO.java b/Commons/src/main/com.l2jbr.commons/com/l2jbr/commons/database/dao/DAO.java new file mode 100644 index 00000000..985a09a5 --- /dev/null +++ b/Commons/src/main/com.l2jbr.commons/com/l2jbr/commons/database/dao/DAO.java @@ -0,0 +1,4 @@ +package com.l2jbr.commons.database.dao; + +public interface DAO { +} diff --git a/Commons/src/main/com.l2jbr.commons/module-info.java b/Commons/src/main/com.l2jbr.commons/module-info.java index 6dcc10af..4ffa0b74 100644 --- a/Commons/src/main/com.l2jbr.commons/module-info.java +++ b/Commons/src/main/com.l2jbr.commons/module-info.java @@ -12,5 +12,6 @@ exports com.l2jbr.commons.lib; exports com.l2jbr.commons; exports com.l2jbr.commons.database; + exports com.l2jbr.commons.database.dao; } \ No newline at end of file diff --git a/Datapack/sql/account_data.sql b/Datapack/sql/account_data.sql index f545b119..5f2e1dfe 100644 --- a/Datapack/sql/account_data.sql +++ b/Datapack/sql/account_data.sql @@ -5,5 +5,6 @@ CREATE TABLE IF NOT EXISTS `account_data` ( account_name VARCHAR(45) NOT NULL DEFAULT '', var VARCHAR(20) NOT NULL DEFAULT '', value VARCHAR(255) , - PRIMARY KEY (account_name,var) + PRIMARY KEY (account_name,var), + CONSTRAINT FK_AccountName FOREIGN KEY (account_name) REFERENCES accounts(login) ); \ No newline at end of file diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/AccountData.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/AccountData.java new file mode 100644 index 00000000..5c97a322 --- /dev/null +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/AccountData.java @@ -0,0 +1,10 @@ +package com.l2jbr.gameserver.model.dao; + +import com.l2jbr.commons.database.dao.DAO; + +public class AccountData implements DAO { + private String accountName; + private String var; + private String value; + +} diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/Accounts.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/Accounts.java new file mode 100644 index 00000000..db781f18 --- /dev/null +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/Accounts.java @@ -0,0 +1,13 @@ +package com.l2jbr.gameserver.model.dao; + +import com.l2jbr.commons.database.dao.DAO; + +public class Accounts implements DAO { + + private String login; + private String password; + private long lastActive; + private int accessLevel; + private String lastIp; + private int lastServer; +} diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/Armor.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/Armor.java new file mode 100644 index 00000000..aae53697 --- /dev/null +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/Armor.java @@ -0,0 +1,28 @@ +package com.l2jbr.gameserver.model.dao; + +import com.l2jbr.commons.database.dao.DAO; + +public class Armor implements DAO { + + private int itemId; + private String name; + private String bodyPart; + private String crystallizable; + private String armorType; + private int weight; + private String material; + private String crystalType; + private int avoidModify; + private int duration; + private int pDef; + private int mDef; + private int MpBonus; + private int price; + private int crystalCount; + private String sellable; + private String dropable; + private String destroyable; + private String tradeable; + private int item_skill_id; + private int item_skill_lvl; +} diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/ArmorSet.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/ArmorSet.java new file mode 100644 index 00000000..588d7a8c --- /dev/null +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/ArmorSet.java @@ -0,0 +1,15 @@ +package com.l2jbr.gameserver.model.dao; + +public class ArmorSet { + + private int id; + private int chest; + private int legs; + private int head; + private int gloves; + private int feet; + private int skill_id; + private int shield; + private int shield_skill_id; + private int enchant6skill; +} diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/Auction.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/Auction.java new file mode 100644 index 00000000..16d710e0 --- /dev/null +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/Auction.java @@ -0,0 +1,19 @@ +package com.l2jbr.gameserver.model.dao; + +import com.l2jbr.commons.database.dao.DAO; + +public class Auction implements DAO { + + private int id; + private int sellerId; + private String sellerName; + private String sellerClanName; + private String itemType; + private int itemId; + private int itemObjectId; + private String itemName; + private int itemQuantity; + private int startingBid; + private int currentBid; + private long endDate; +} diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/AuctionBid.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/AuctionBid.java new file mode 100644 index 00000000..09ef57e6 --- /dev/null +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/AuctionBid.java @@ -0,0 +1,13 @@ +package com.l2jbr.gameserver.model.dao; + +import com.l2jbr.commons.database.dao.DAO; + +public class AuctionBid implements DAO { + private int id; + private int auctionId; + private int bidderId; + private String bidderName; + private String clanName; + private int maxBid; + private long timeBid; +} diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/AuctionWatch.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/AuctionWatch.java new file mode 100644 index 00000000..6d82c9f1 --- /dev/null +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/AuctionWatch.java @@ -0,0 +1,6 @@ +package com.l2jbr.gameserver.model.dao; + +public class AuctionWatch { + private int charObjId; + private int auctionId; +} diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/Augmentations.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/Augmentations.java new file mode 100644 index 00000000..91b007f1 --- /dev/null +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/Augmentations.java @@ -0,0 +1,11 @@ +package com.l2jbr.gameserver.model.dao; + +import com.l2jbr.commons.database.dao.DAO; + +public class Augmentations implements DAO { + + private int itemId; + private int attributes; + private int skill; + private int level; +} diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/AutoChat.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/AutoChat.java new file mode 100644 index 00000000..48b57018 --- /dev/null +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/AutoChat.java @@ -0,0 +1,10 @@ +package com.l2jbr.gameserver.model.dao; + +import com.l2jbr.commons.database.dao.DAO; + +public class AutoChat implements DAO { + + private int groupId; + private int npcId; + private long chatDelay; +} diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/AutoChatText.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/AutoChatText.java new file mode 100644 index 00000000..41a31658 --- /dev/null +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/AutoChatText.java @@ -0,0 +1,9 @@ +package com.l2jbr.gameserver.model.dao; + +import com.l2jbr.commons.database.dao.DAO; + +public class AutoChatText implements DAO { + + private int groupId; + private String chatText; +} diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/BoxAccess.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/BoxAccess.java new file mode 100644 index 00000000..ab248649 --- /dev/null +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/BoxAccess.java @@ -0,0 +1,8 @@ +package com.l2jbr.gameserver.model.dao; + +import com.l2jbr.commons.database.dao.DAO; + +public class BoxAccess implements DAO { + private int spawn; + private String charName; +} diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/Boxes.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/Boxes.java new file mode 100644 index 00000000..80be4655 --- /dev/null +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/Boxes.java @@ -0,0 +1,14 @@ +package com.l2jbr.gameserver.model.dao; + +import com.l2jbr.commons.database.dao.DAO; + +public class Boxes implements DAO { + private int id; + private int spawn; + private int npcId; + private String drawer; + private int itemId; + private String name; + private int count; + private int enchant; +} diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/Castle.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/Castle.java new file mode 100644 index 00000000..bce0a4b4 --- /dev/null +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/Castle.java @@ -0,0 +1,13 @@ +package com.l2jbr.gameserver.model.dao; + +import com.l2jbr.commons.database.dao.DAO; + +public class Castle implements DAO { + private int id; + private String name; + private int taxPercent; + private int treasury; + private long siegeDate; + private int siegeDayOfWeek; + private int siegeHourOfDay; +} diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/CastleDoor.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/CastleDoor.java new file mode 100644 index 00000000..3a28d008 --- /dev/null +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/CastleDoor.java @@ -0,0 +1,22 @@ +package com.l2jbr.gameserver.model.dao; + +import com.l2jbr.commons.database.dao.DAO; + +public class CastleDoor implements DAO { + + private int castleId; + private int id; + private String name; + private int x; + private int y; + private int z; + private int rangeXmin; + private int rangeYmin; + private int rangeZmin; + private int rangeXmax; + private int rangeYmax; + private int rangeZmax; + private int hp; + private int pDef; + private int mDef; +} diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/CastleDoorUpgrade.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/CastleDoorUpgrade.java new file mode 100644 index 00000000..15a74cfe --- /dev/null +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/CastleDoorUpgrade.java @@ -0,0 +1,11 @@ +package com.l2jbr.gameserver.model.dao; + +import com.l2jbr.commons.database.dao.DAO; + +public class CastleDoorUpgrade implements DAO { + + private int doorId; + private int hp; + private int pDef; + private int mDef; +} diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/CastleManorProcure.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/CastleManorProcure.java new file mode 100644 index 00000000..f34f7107 --- /dev/null +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/CastleManorProcure.java @@ -0,0 +1,15 @@ +package com.l2jbr.gameserver.model.dao; + +import com.l2jbr.commons.database.dao.DAO; + +public class CastleManorProcure implements DAO { + + private int castleId; + private int cropId; + private int canBuy; + private int startBuy; + private int price; + private int rewardType; + private int period; + +} diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/CastleManorProduction.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/CastleManorProduction.java new file mode 100644 index 00000000..31add91b --- /dev/null +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/CastleManorProduction.java @@ -0,0 +1,12 @@ +package com.l2jbr.gameserver.model.dao; + +import com.l2jbr.commons.database.dao.DAO; + +public class CastleManorProduction implements DAO { + private int castleId; + private int seedd; + private int canproduce; + private int startProduce; + private int seedPrice; + private int period; +} diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/CastleSiegeGuard.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/CastleSiegeGuard.java new file mode 100644 index 00000000..364d8eb7 --- /dev/null +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/CastleSiegeGuard.java @@ -0,0 +1,16 @@ +package com.l2jbr.gameserver.model.dao; + +import com.l2jbr.commons.database.dao.DAO; + +public class CastleSiegeGuard implements DAO { + + private int castleId; + private int id; + private int npcId; + private int x; + private int y; + private int z; + private int heading; + private int respawnDelay; + private int isHired; +} diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/CharTemplates.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/CharTemplates.java new file mode 100644 index 00000000..968556c6 --- /dev/null +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/CharTemplates.java @@ -0,0 +1,44 @@ +package com.l2jbr.gameserver.model.dao; + +import com.l2jbr.commons.database.dao.DAO; + +public class CharTemplates implements DAO { + + private int classId; + private String className; + private int raceId; + private int STR; + private int CON; + private int DEX; + private int INT; + private int WIT; + private int MEN; + private int P_ATK; + private int P_DEF; + private int M_ATK; + private int M_DEF; + private int P_SPD; + private int M_SPD; + private int ACC; + private int CRITICAL; + private int EVASION; + private int MOVE_SPD; + private int _LOAD; + private int x; + private int y; + private int z; + private int canCraft; + private int M_UNK1; + private int M_UNK2; + private int M_COL_R; + private int M_COL_H; + private int F_UNK1; + private int F_UNK2; + private int F_COL_R; + private int F_COL_H; + private int items1; + private int items2; + private int items3; + private int items4; + private int items5; +} diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/CharacterFriends.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/CharacterFriends.java new file mode 100644 index 00000000..9b54c63b --- /dev/null +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/CharacterFriends.java @@ -0,0 +1,10 @@ +package com.l2jbr.gameserver.model.dao; + +import com.l2jbr.commons.database.dao.DAO; + +public class CharacterFriends implements DAO { + + private int char_id; + private int friend_id; + private String friend_name; +} diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/CharacterHennas.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/CharacterHennas.java new file mode 100644 index 00000000..72399812 --- /dev/null +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/CharacterHennas.java @@ -0,0 +1,10 @@ +package com.l2jbr.gameserver.model.dao; + +import com.l2jbr.commons.database.dao.DAO; + +public class CharacterHennas implements DAO { + private int char_obj_id; + private int symbol_id; + private int slot; + private int class_index; +} diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/CharacterMacroses.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/CharacterMacroses.java new file mode 100644 index 00000000..b30f749a --- /dev/null +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/CharacterMacroses.java @@ -0,0 +1,13 @@ +package com.l2jbr.gameserver.model.dao; + +import com.l2jbr.commons.database.dao.DAO; + +public class CharacterMacroses implements DAO { + private int char_obj_id; + private int id; + private int icon; + private String name; + private String descr; + private String acronym; + private String commands; +} diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/CharacterQuests.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/CharacterQuests.java new file mode 100644 index 00000000..9f9ecf75 --- /dev/null +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/CharacterQuests.java @@ -0,0 +1,12 @@ +package com.l2jbr.gameserver.model.dao; + +import com.l2jbr.commons.database.dao.DAO; + +public class CharacterQuests implements DAO { + private int char_id; + private String name; + private String var; + private String value; + private int class_index; + +} diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/CharacterRecipeBook.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/CharacterRecipeBook.java new file mode 100644 index 00000000..d6181df5 --- /dev/null +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/CharacterRecipeBook.java @@ -0,0 +1,10 @@ +package com.l2jbr.gameserver.model.dao; + +import com.l2jbr.commons.database.dao.DAO; + +public class CharacterRecipeBook implements DAO { + private int char_id; + private int id; + private int type; +} + diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/CharacterRecommends.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/CharacterRecommends.java new file mode 100644 index 00000000..57bbe335 --- /dev/null +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/CharacterRecommends.java @@ -0,0 +1,8 @@ +package com.l2jbr.gameserver.model.dao; + +import com.l2jbr.commons.database.dao.DAO; + +public class CharacterRecommends implements DAO { + private int char_id; + private int target_id; +} diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/CharacterShortcuts.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/CharacterShortcuts.java new file mode 100644 index 00000000..b8e77863 --- /dev/null +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/CharacterShortcuts.java @@ -0,0 +1,13 @@ +package com.l2jbr.gameserver.model.dao; + +import com.l2jbr.commons.database.dao.DAO; + +public class CharacterShortcuts implements DAO { + private int char_obj_id; + private int slot; + private int page; + private int type; + private int shortcut_id; + private String level; + private int class_index; +} diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/CharacterSkills.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/CharacterSkills.java new file mode 100644 index 00000000..8e17fa98 --- /dev/null +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/CharacterSkills.java @@ -0,0 +1,12 @@ +package com.l2jbr.gameserver.model.dao; + +import com.l2jbr.commons.database.dao.DAO; + +public class CharacterSkills implements DAO { + + private int char_obj_id; + private int skill_id; + private int skill_level; + private String skill_name; + private int class_index; +} diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/CharacterSkillsSave.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/CharacterSkillsSave.java new file mode 100644 index 00000000..78cb6381 --- /dev/null +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/CharacterSkillsSave.java @@ -0,0 +1,16 @@ +package com.l2jbr.gameserver.model.dao; + +import com.l2jbr.commons.database.dao.DAO; + +public class CharacterSkillsSave implements DAO { + + private int char_obj_id; + private int skill_id; + private int skill_level; + private int effect_count; + private int effect_cur_time; + private int reuse_delay; + private int restore_type; + private int class_index; + private int buff_index; +} diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/CharacterSubclasses.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/CharacterSubclasses.java new file mode 100644 index 00000000..e03cdaea --- /dev/null +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/CharacterSubclasses.java @@ -0,0 +1,14 @@ +package com.l2jbr.gameserver.model.dao; + +import com.l2jbr.commons.database.dao.DAO; + +public class CharacterSubclasses implements DAO { + + private int char_obj_id; + private int class_id; + private long exp; + private long sp; + private int level; + private int class_index; + +} diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/Characters.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/Characters.java new file mode 100644 index 00000000..ad9a840a --- /dev/null +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/Characters.java @@ -0,0 +1,84 @@ +package com.l2jbr.gameserver.model.dao; + +import com.l2jbr.commons.database.dao.DAO; + +public class Characters implements DAO { + + private String account_name; + private int obj_Id; + private String char_name; + private int level; + private int maxHp; + private long curHp; + private int maxCp; + private long curCp; + private int maxMp; + private long curMp; + private int acc; + private int crit; + private int evasion; + private int mAtk; + private int mDef; + private int mSpd; + private int pAtk; + private int pDef; + private int pSpd; + private int runSpd; + private int walkSpd; + private int str; + private int con; + private int dex; + private int _int; + private int men; + private int wit; + private int face; + private int hairStyle; + private int hairColor; + private int sex; + private int heading; + private int x; + private int y; + private int z; + private int movement_multiplier; + private int attack_speed_multiplier; + private int colRad; + private int colHeight; + private long exp; + private long expBeforeDeath; + private int sp; + private int karma; + private int pvpkills; + private int pkkills; + private int clanid; + private int maxload; + private int race; + private int classid; + private int base_class; + private long deletetime; + private int cancraft; + private String title; + private int rec_have; + private int rec_left; + private int accesslevel; + private int online; + private long onlinetime; + private int char_slot; + private int newbie; + private long lastAccess; + private int clan_privs; + private int wantspeace; + private int isin7sdungeon; + private int in_jail; + private long jail_timer; + private int power_grade; + private int nobless; + private int subpledge; + private long last_recom_date; + private int lvl_joined_academy; + private int apprentice; + private int sponsor; + private int varka_ketra_ally; + private long clan_join_expiry_time; + private long clan_create_expiry_time; + private int death_penalty_level; +} diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/ClanData.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/ClanData.java new file mode 100644 index 00000000..9aca3ea6 --- /dev/null +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/ClanData.java @@ -0,0 +1,23 @@ +package com.l2jbr.gameserver.model.dao; + +import com.l2jbr.commons.database.dao.DAO; + +public class ClanData implements DAO { + + private int clan_id; + private String clan_name; + private int clan_level; + private int reputation_score; + private int hasCastle; + private int ally_id; + private String ally_name; + private int leader_id; + private int crest_id; + private int crest_large_id; + private int ally_crest_id; + private int auction_bid_at; + private long ally_penalty_expiry_time; + private long ally_penalty_type; + private long char_penalty_expiry_time; + private long dissolving_expiry_time; +} diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/ClanHall.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/ClanHall.java new file mode 100644 index 00000000..209e2daa --- /dev/null +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/ClanHall.java @@ -0,0 +1,16 @@ +package com.l2jbr.gameserver.model.dao; + +import com.l2jbr.commons.database.dao.DAO; + +public class ClanHall implements DAO { + + private int id; + private String name; + private int ownerId; + private int lease; + private String desctext; + private String location; + private long paidUntil; + private int Grade; + private int paid; +} diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/ClanHallFunctions.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/ClanHallFunctions.java new file mode 100644 index 00000000..dc0f6f50 --- /dev/null +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/ClanHallFunctions.java @@ -0,0 +1,13 @@ +package com.l2jbr.gameserver.model.dao; + +import com.l2jbr.commons.database.dao.DAO; + +public class ClanHallFunctions implements DAO { + + private int hall_id; + private int type; + private int lvl; + private int lease; + private long rate; + private long endTime; +} diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/ClanPrivs.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/ClanPrivs.java new file mode 100644 index 00000000..77bc0115 --- /dev/null +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/ClanPrivs.java @@ -0,0 +1,11 @@ +package com.l2jbr.gameserver.model.dao; + +import com.l2jbr.commons.database.dao.DAO; + +public class ClanPrivs implements DAO { + + private int clan_id; + private int rank; + private int party; + private int privs; +} diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/ClanSkills.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/ClanSkills.java new file mode 100644 index 00000000..6e15a820 --- /dev/null +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/ClanSkills.java @@ -0,0 +1,10 @@ +package com.l2jbr.gameserver.model.dao; + +import com.l2jbr.commons.database.dao.DAO; + +public class ClanSkills implements DAO { + private int clan_id; + private int skill_id; + private int skill_level; + private String skill_name; +} diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/ClanSubpledges.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/ClanSubpledges.java new file mode 100644 index 00000000..84e872c4 --- /dev/null +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/ClanSubpledges.java @@ -0,0 +1,11 @@ +package com.l2jbr.gameserver.model.dao; + +import com.l2jbr.commons.database.dao.DAO; + +public class ClanSubpledges implements DAO { + + private int clan_id; + private int sub_pledge_id; + private String name; + private String leader_name; +} diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/ClanWars.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/ClanWars.java new file mode 100644 index 00000000..cd3b9ab4 --- /dev/null +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/ClanWars.java @@ -0,0 +1,12 @@ +package com.l2jbr.gameserver.model.dao; + +import com.l2jbr.commons.database.dao.DAO; + +public class ClanWars implements DAO { + + private String clan1; + private String clan2; + private int wantspeace1; + private int wantspeace2; + +} diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/CursedWeapons.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/CursedWeapons.java new file mode 100644 index 00000000..549f8b0b --- /dev/null +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/CursedWeapons.java @@ -0,0 +1,12 @@ +package com.l2jbr.gameserver.model.dao; + +import com.l2jbr.commons.database.dao.DAO; + +public class CursedWeapons implements DAO { + private int itemId; + private int playerId; + private int playerKarma; + private int playerPkKills; + private int nbKills; + private long endTime; +} diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/DimensionalRift.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/DimensionalRift.java new file mode 100644 index 00000000..3557d67a --- /dev/null +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/DimensionalRift.java @@ -0,0 +1,18 @@ +package com.l2jbr.gameserver.model.dao; + +import com.l2jbr.commons.database.dao.DAO; + +public class DimensionalRift implements DAO { + private int type; + private int room_id; + private int xMin; + private int xMax; + private int yMin; + private int yMax; + private int zMin; + private int zMax; + private int xT; + private int yT; + private int zT; + private int boss; +} diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/DropList.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/DropList.java new file mode 100644 index 00000000..db019ddd --- /dev/null +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/DropList.java @@ -0,0 +1,12 @@ +package com.l2jbr.gameserver.model.dao; + +import com.l2jbr.commons.database.dao.DAO; + +public class DropList implements DAO { + private int mobId; + private int itemId; + private int min; + private int max; + private int category; + private int chance; +} diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/EnchantSkillTrees.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/EnchantSkillTrees.java new file mode 100644 index 00000000..432fcb55 --- /dev/null +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/EnchantSkillTrees.java @@ -0,0 +1,17 @@ +package com.l2jbr.gameserver.model.dao; + +import com.l2jbr.commons.database.dao.DAO; + +public class EnchantSkillTrees implements DAO { + private int skill_id; + private int level; + private String name; + private int base_lvl; + private String enchant_type; + private int sp; + private int exp; + private int min_skill_lvl; + private int success_rate76; + private int success_rate77; + private int success_rate78; +} diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/EtcItem.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/EtcItem.java new file mode 100644 index 00000000..d4d7f183 --- /dev/null +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/EtcItem.java @@ -0,0 +1,23 @@ +package com.l2jbr.gameserver.model.dao; + +import com.l2jbr.commons.database.dao.DAO; + +public class EtcItem implements DAO { + private int item_id; + private String name; + private String crystallizable; + private String item_type; + private int weight; + private String consume_type; + private String material; + private String crystal_type; + private int duration; + private int price; + private int crystal_count; + private String sellable; + private String dropable; + private String destroyable; + private String tradeable; + private String oldname; + private String oldtype; +} diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/Fish.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/Fish.java new file mode 100644 index 00000000..ff609398 --- /dev/null +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/Fish.java @@ -0,0 +1,17 @@ +package com.l2jbr.gameserver.model.dao; + +import com.l2jbr.commons.database.dao.DAO; + +public class Fish implements DAO { + private int id; + private int level; + private String name; + private int hp; + private int hpregen; + private int fish_type; + private int fish_group; + private int fish_guts; + private int guts_check_time; + private int wait_time; + private int combat_time; +} diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/FishingSkillTrees.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/FishingSkillTrees.java new file mode 100644 index 00000000..09eb0f1a --- /dev/null +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/FishingSkillTrees.java @@ -0,0 +1,15 @@ +package com.l2jbr.gameserver.model.dao; + +import com.l2jbr.commons.database.dao.DAO; + +public class FishingSkillTrees implements DAO { + + private int skill_id; + private int level; + private String name; + private int sp; + private int min_level; + private int costid; + private int cost; + private int isfordwarf; +} diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/Forums.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/Forums.java new file mode 100644 index 00000000..c74194d2 --- /dev/null +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/Forums.java @@ -0,0 +1,14 @@ +package com.l2jbr.gameserver.model.dao; + +import com.l2jbr.commons.database.dao.DAO; + +public class Forums implements DAO { + private int forum_id; + private String forum_name; + private int forum_parent; + private int forum_post; + private int forum_type; + private int forum_perm; + private int forum_owner_id; + +} diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/GameServers.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/GameServers.java new file mode 100644 index 00000000..8705dc38 --- /dev/null +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/GameServers.java @@ -0,0 +1,7 @@ +package com.l2jbr.gameserver.model.dao; + +public class GameServers { + private int server_id; + private String hexid; + private String host; +} diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/Games.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/Games.java new file mode 100644 index 00000000..47b71d26 --- /dev/null +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/Games.java @@ -0,0 +1,18 @@ +package com.l2jbr.gameserver.model.dao; + +import com.l2jbr.commons.database.dao.DAO; + +public class Games implements DAO { + + private int id; + private int idnr; + private int number1; + private int number2; + private int prize; + private int newprize; + private int prize1; + private int prize2; + private int prize3; + private long enddate; + private int finished; +} diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/classList.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/classList.java new file mode 100644 index 00000000..a5590d35 --- /dev/null +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/classList.java @@ -0,0 +1,9 @@ +package com.l2jbr.gameserver.model.dao; + +import com.l2jbr.commons.database.dao.DAO; + +public class classList implements DAO { + private String class_name; + private int id; + private int parent_id; +} diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/repository/AccountDataRepository.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/repository/AccountDataRepository.java new file mode 100644 index 00000000..2512aca1 --- /dev/null +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/repository/AccountDataRepository.java @@ -0,0 +1,9 @@ +package com.l2jbr.gameserver.model.dao.repository; + +import org.springframework.data.repository.CrudRepository; + +public interface AccountData extends CrudRepository { + + + +} From 1e6d90c745c7659a3f85d3ed1cce0b821ecb6778 Mon Sep 17 00:00:00 2001 From: Alisson Oliveira Date: Wed, 11 Apr 2018 19:14:08 -0300 Subject: [PATCH 004/236] =?UTF-8?q?Adiciona=20chaves=20estrangeiras=20?= =?UTF-8?q?=C3=A0s=20tabelas=20do=20BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Commons/build.gradle | 4 + Datapack/sql/experimental/l2j.model.mwb | Bin 0 -> 74886 bytes .../sql/experimental/l2j_full_structure.sql | 2304 +++++++++++++++++ .../gameserver/model/dao/GlobalTasks.java | 14 + .../gameserver/model/dao/HelperBuffList.java | 13 + .../com/l2jbr/gameserver/model/dao/Henna.java | 18 + .../gameserver/model/dao/HennaTrees.java | 8 + .../l2jbr/gameserver/model/dao/Heroes.java | 11 + .../com/l2jbr/gameserver/model/dao/Items.java | 20 + .../gameserver/model/dao/ItemsOnGround.java | 16 + .../gameserver/model/dao/LevelUpGain.java | 17 + .../l2jbr/gameserver/model/dao/Locations.java | 13 + .../l2jbr/gameserver/model/dao/MapRegion.java | 17 + .../model/dao/MerchantAreasList.java | 10 + .../gameserver/model/dao/MerchantBuyList.java | 15 + .../gameserver/model/dao/MerchantLease.java | 11 + .../gameserver/model/dao/MerchantShopIds.java | 9 + .../l2jbr/gameserver/model/dao/Merchants.java | 8 + .../l2jbr/gameserver/model/dao/Minions.java | 10 + .../gameserver/model/dao/ModsWedding.java | 13 + .../com/l2jbr/gameserver/model/dao/Npc.java | 49 + .../l2jbr/gameserver/model/dao/NpcSkills.java | 7 + .../gameserver/model/dao/OlympiadNobles.java | 12 + .../com/l2jbr/gameserver/model/dao/Pets.java | 17 + .../l2jbr/gameserver/model/dao/PetsStats.java | 31 + .../model/dao/PledgeSkillTrees.java | 14 + .../com/l2jbr/gameserver/model/dao/Posts.java | 14 + .../gameserver/model/dao/QuestGlobalData.java | 10 + .../model/dao/RaidbossSpawnList.java | 17 + .../gameserver/model/dao/RandomSpawn.java | 15 + .../gameserver/model/dao/RandomSpawnLoc.java | 12 + .../gameserver/model/dao/SevenSigns.java | 14 + .../model/dao/SevenSignsFestival.java | 12 + .../model/dao/SevenSignsStatus.java | 31 + .../l2jbr/gameserver/model/dao/SiegeClan.java | 10 + .../gameserver/model/dao/SkillLearn.java | 9 + .../gameserver/model/dao/SkillSpellBooks.java | 8 + .../gameserver/model/dao/SkillTrees.java | 14 + .../l2jbr/gameserver/model/dao/Spawnlist.java | 19 + .../l2jbr/gameserver/model/dao/Teleport.java | 13 + .../com/l2jbr/gameserver/model/dao/Topic.java | 15 + .../gameserver/model/dao/WalkerRoutes.java | 15 + .../l2jbr/gameserver/model/dao/Weapon.java | 43 + .../com/l2jbr/gameserver/model/dao/Zone.java | 16 + .../gameserver/model/dao/ZoneVertices.java | 10 + .../dao/repository/AccountDataRepository.java | 9 - 46 files changed, 2958 insertions(+), 9 deletions(-) create mode 100644 Datapack/sql/experimental/l2j.model.mwb create mode 100644 Datapack/sql/experimental/l2j_full_structure.sql create mode 100644 Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/GlobalTasks.java create mode 100644 Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/HelperBuffList.java create mode 100644 Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/Henna.java create mode 100644 Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/HennaTrees.java create mode 100644 Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/Heroes.java create mode 100644 Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/Items.java create mode 100644 Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/ItemsOnGround.java create mode 100644 Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/LevelUpGain.java create mode 100644 Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/Locations.java create mode 100644 Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/MapRegion.java create mode 100644 Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/MerchantAreasList.java create mode 100644 Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/MerchantBuyList.java create mode 100644 Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/MerchantLease.java create mode 100644 Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/MerchantShopIds.java create mode 100644 Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/Merchants.java create mode 100644 Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/Minions.java create mode 100644 Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/ModsWedding.java create mode 100644 Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/Npc.java create mode 100644 Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/NpcSkills.java create mode 100644 Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/OlympiadNobles.java create mode 100644 Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/Pets.java create mode 100644 Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/PetsStats.java create mode 100644 Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/PledgeSkillTrees.java create mode 100644 Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/Posts.java create mode 100644 Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/QuestGlobalData.java create mode 100644 Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/RaidbossSpawnList.java create mode 100644 Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/RandomSpawn.java create mode 100644 Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/RandomSpawnLoc.java create mode 100644 Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/SevenSigns.java create mode 100644 Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/SevenSignsFestival.java create mode 100644 Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/SevenSignsStatus.java create mode 100644 Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/SiegeClan.java create mode 100644 Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/SkillLearn.java create mode 100644 Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/SkillSpellBooks.java create mode 100644 Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/SkillTrees.java create mode 100644 Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/Spawnlist.java create mode 100644 Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/Teleport.java create mode 100644 Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/Topic.java create mode 100644 Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/WalkerRoutes.java create mode 100644 Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/Weapon.java create mode 100644 Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/Zone.java create mode 100644 Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/ZoneVertices.java delete mode 100644 Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/repository/AccountDataRepository.java diff --git a/Commons/build.gradle b/Commons/build.gradle index 28a5e04d..22305127 100644 --- a/Commons/build.gradle +++ b/Commons/build.gradle @@ -8,6 +8,10 @@ version '1.3.1' ext.moduleName = 'com.l2jbr.commons' +configurations.all { + transitive = false +} + sourceSets { main { java { diff --git a/Datapack/sql/experimental/l2j.model.mwb b/Datapack/sql/experimental/l2j.model.mwb new file mode 100644 index 0000000000000000000000000000000000000000..2ab3b93f62d30c0617df4d3bd943576fb4b2b806 GIT binary patch literal 74886 zcmZ^KV|XRqw(g4EVaFY_W7{^ngN~haY}>Y-j+2gU+qSJ0JGsfX_de%7_uTVm)w8PR zoP}96$9OU1rNF?^0000qfIm4*IF&kYPg!K>FBgV5RS1VQ6VjYvH6v>uh0u z`ufXmMY6s;to=fJ3n-O=YNLUAFV&~MzNPCnT8!ClF{1xt4wX12CAvz+mpZyO|MCQp zK#`GB%3z(J2-Si&oKh;E7HM#_;$HY}{%zsigC~vmc|6UKrQ-eG?)_r@`u%zD{k8*B zEyh@7%uI1S4NL9y;y~cp&)8gcfk~@^tTYYcePd!{L*tF_BJk$HA20BooR4p8#O>o))q6QQK1UI&q`O3EUbtYAXjwqbF=Gf*=XrdiqaH9N@)!2TS(hGhi_>MZn0YTw0eA*Ds(W|<_&LQ zvJ1HxjToVpOU_!;4jHVg+`gzu+w&^$@>&~@cDy^&6e9FMP~%s{Bpq7YU4eXc5sBi> zk4-q1J9sJPxv{C7T@wtBA?u%#KVC*)%$t=L=p+b1ehXwA$0*b3fN zGSHJBDLmqky?JAWO4Foxd_ppRozpO*kNkfI<(<>v=ggnEJioFgw6`&@dw87AE8oA{ zab`KVup8qqlpfIW9B~QY$o_22An4dv4&t?z7QPuF63IfmTvuvlguxA=nafvlOzq6u=>36!rBQ95wvA1TP3Jn~6 zkkmnzCtG486&MKGj$H9j_@_QnOS?7}dVlP&?geO7t^+k}n!=U}&*)N0Rg2baF#KIj zA5PAZJ2Dr}?uU9zfhQ;=u>z-i6T|m`7Agk~3t^@rrE}!AE!V}!)^Qu}S?326+HYr8 zWB2!YIAOUstRgd%fPOWjq_;jCw+sY@ct}_+Or#rtMMh zF3mOg>d?!Dq4TdD+EVS`6~8!Sm5&H3t;%6YfP7h-^-IbZ>jFo!_xI%hfjG+}xID|z z+4S-4$=SR=N3q``N9yI-&)3N$9;M<)CZA|U^lEoAj&yB*v4d-S@SnYAF2=}vz(KoP z#!mxe@h5NP$k}tM1+!3wBI5$1sN#)bawVR*Mw=OS)Qnp(2Hqpxrjp4uSXUWX9 zQ75c7vD$=h-MjRZmNvJAwj`Xq;Xpc8I^|vLGAh5>7mHQLimuyb^zAM*kRi~y%(M;b zrCqF#ffjJW;gO4#IjswApLL@)Z08T2_z`DG;U!BDxm9nn53NZ5Eh?Bh79}S(C&$yi zoH!}wZzrbzOKa9&ae?Id@pN9tYX_$2jETh8x-HgMDKPpiz$3JIJxPT2$Ir$^gm7K; zD6rFg_%I?CIPGHYc`)#KTe22jwQP{iWO8qFBM8|;T;(b~-}SG|YDnL@2H%>6xyyTv z@ej!&A$V28zYil=yW`kHZKb?83X8w6=f2rJ4hR;gT(gQjaVixz2py+1msb-cwsu9G zJ`J*Uk_e!Ecl=XuR*M4bhFoYrll-F*>wDAHS$#<@=o&`X$&Ee$XUw|!ls>h z1c=d1bQY0e&XMEK!HC|1m=}@3Hypj;|F~zLi>ySCPSuwoDSfDg*#>BVcx?r{~ z#;4Kei!oYSyPYYp-~ZjZLSC~({BrZS{aQNl{<9_1?6J7mNSID#eH6L;M0H`#YhJ@e zU$v~MQ#`IKN25$U!W;(IoRi(l(5=X>Q`Mt%T7Wj&t>X%38E(3)BvPQFWmwHq zEG@-E=hfZ`*~(dMu0flpwKa>+W&7J&&Pq+h<%O{+6W8_}U{Z_R%l5+k26r6K^>QQ0Z)53fI8g)Z-t zsH)W+SC#0zTac3exJf*RXgEB}WeP?+V;wr!Lqo>4_hDo?iC||GrKt zXl`!C5LB~xBkc}ZOWm@qqm2*rcrIl->rJD4yGmjOOJ{4C3tdjuSc7Q%a~&}K%i>Z} zsBF0Lg77Z$v5T)&-d6gQ`B_RC7nWwcJE>6BC72b{-dNinlUBafzu=Nax$)3~L!9{s zZmXZ%JAdI+Y}2|)ilKtJQXc7m%`d3Pl|Ttqq}pWFdA(_#IwHY5((&bz(`qN|@Vd9R zLV3(KHg$7v3o_Ei1K~7@%met0|t&<)(=2*Lz9lVDF;WZ4A zOvJaP{*IM{pNl&hs|$BCVO?4FR5y6|PJXs}0j8p}#U_Mf zL-gV^etk=EI>5^E*>+qCHqaUOei6gh!*bTkMYxMMAdl|NWukr8hOy*|PVm+^*fpv3 zaU6$f7d4E9`$@q3FH}_%^^9Tr?y;awo6FA+Hg+EyZ5 zC=lA02nj95oe>EQD?VF%UiJrcC}wO~KsGeENIDAIkR7^^yaBu~QAranxCj9Sr~oo_ zD0d&CI=?))FVV9;5q3)UAc`JQ=)u94jW#WRVdw4oXz^rWEi^R}lJ2dQ14$vZ;6Ss4 z8MJjZIVE9*_~kqj-<}&G4q1gdwcbCBlae%;;uk-DGIr|wV|5-tKTt$Y{#ue4qvjOM z+J=7hj+|T&m7W#OZ5(LBUA6n;!Rg~0EZOC>K6A}Yd0Kq$erSvk?An*UW`8kpGenL( z#PftaIf49?0CH%I|0-#Q_zLI%>55`y8~K_dTiVg=6#4`mA9jET4d*?HfRv~Pjie6M z&8QC`B*hMwUb@+)83S9$C8l%cfs(%l&NJMdeZ zpUiZil&K@#X7#f(iD$WNT|sAYG?o^4SnxK_@Q-=FUX3l+6&44B92rcBpHCtFEsmU| z6Stk5;CzBGHHrECeUq)R!7H$y$1t}ENrivV`pJ%^|Y7V(#mPoYDctc>~t}3E*8LpEXbwG2J z-ilRrzl(V8>%Psb3oBz(-ZQ@d3Er!zTK`Oz zN%FS7CFR-9A=w=Ia{)TYn^kYTYZQJtJlBJ{>hsLBi={k63vXBCY~#w(t@)54jbDE9 z?Dqu80N+S{dN~jQ971t-H-g~xJCM428W*mf@Ilv5QCmbW`YXHMi9tlT%?Z{QhY6Zc zAHGew{F&xX`+BJ?4I2z(U9{AST0W`QD zrqMa8AicOEKN6C%w+@#A7Mmacmi##g(w*mDKy=USTKn4_1qD<38yZwL8{n<#u4j~! z;qdyZLj7{d;ITYami+6Cakeu1Jv+1$pBOtP9)~RAmoKq?x`}>%o7s3!g&T#U0u)GA z&LrG7d0>cne^QCQrHiiu{QIgbGYPhBCXq5sidr@b-uwSt~#N7N?&!>iooum?U-E7WG zmrRSgv6Sl3r)Ko?@ndq6a2W%y5cUpto2b|#wQ`o>Sn+(eyp;WcVa4z_<$)UN$j;dk z?-?*ami#@a)YAW5!68bCM#${_dc|J0L-VJXO-6G;*riQXEN#V|?~92_9;=eJqmyPE zwc=3x9pg3rSv!I_NJe|X`0qRbA8}xFduO(q#j*WS{-OMy8hfPXi%9tesYf?l#j$@`|9$h zU;MPv+O&<~&;s~tPxPXO|0@U)yvQs9QU3a5u5>IhRmdmMZUBlDd1ZSs`yTOVM&MIZU zDy`ROT8~S(IP25zw)#b24HYqqT~i@l2jN$@R|m}#>TmZ9iP#{_cmhoCQ$JUka+`0c zRSfD*$=;1+hvJWgAA8dbxj>@wZRF0L90+M88d&Z>0&zlfA(DY61vPn;M|K9kYn&rn zY=}z>j-38#S#u46=G9GsnZ00Zc|}QcTX0x&X2+up&-mHuLTlm(x{%<#zE>$FTW1uV zjDy3Rk=aV=(uGo%2kJFEWwNU z-&!3$!m&H~jZ{O?*_qF<+Yd1t6cHb}%n=XCtJe}5it~EDulv_`D7({-^^3-0_$C6n9hs1CAr+B}RwjKx~5x*lu7HSM{8v7z6Ma?m z7#Z@PV=bxU9d=-InX0(=gHU10VuKg~^iU1a?h1pSYpstv=>eqHd5Ex0lq*o&A;1-_ zf0I=)sv8q`Rw*ZwNX-(Y=@R)MHSZGPNW;na|@l~{tzisW* zs8n=lxWDLlYayD`ELUh-igEKWZ9bo2^2L?bKK^ zQ?|8AFJ^N{N~HFRlGBB3f3)Tx6_XJDyaXt*pe_ZJ0l#gNhDDN1lMUS0t|2|GG+q-D zlpiM#w{KP3)16h@P*lnyO+GWdE7@G%6r0?Gl>ZHpf`mM={i*mv_X{jbsS8N0fW#3d z!cVN^|3OC}14rke=eU+pjtY0w`*{ZNjMnUqCC9w zl8kkfF+NZd-kdrD^m&xoUhP&rcwM^+SD9g?pGn5) zD$^2vPM0W2Xteuu{W73<+u&l?M|bS#qj4nsP{Ug0;!12cvN5KANzMu5GBD|f$Mamz$n#?yxkfJHTBb#K zgWmb^z`3$psrG9b8h4*qJwiQ5u3q@w)j%sp`cW_(?YWsO4Qu!rI3Y^{S7!T5pz`VM zf;?rmQ!Vs&viGeSt0T^w-He*j9B3(Q#s_;;yQY#>)gS$^}R~5oFtMdf#;>^$^ zICF~r-QdQN1Y9zEr{UrVKlmcWlEum?{-UV%N)wG-0qtS8X_cIGqhfh_+cHmCSIde{ zfVF($m7TGYTIy6^iaSc|4|GavB;`LGT+=Qs_)@$X!bZ6Etp_%3;yi9+Jk`4Fr6Z3% zXOa#6uI(JrZs>_QlP4)c4%NEG)f`j|&EY_Q#@{-l`(W(`mhBRmQ+#Q#gz{3yNm+@c zlOgx)f%ws1W)2&caZ4Wz+>c+t*d;}B0=gmB<|n?jiL8#7w0pL_wzX$^j1k0>BV}j$ zGv4}6uJpb$O;-+56)97hN3%!W_GOLiT(l?qmhg7@msiL3X)`8Wk3OW4`oSF{6$1HM z?Vp-ecSc;5=Wm^7Y-|A%a7$;QOO<-{tDYWgDDUf93CFAjlxG*AM^=7#Q90zQl0WW! zWZF=@z@2a#?ZBJ_`n|c}Y?2B)zgd%qwUB1Xy4dLgTytYqg|uOAnta+P5BRe{pLpF} zJ+vMI1dI@0^yF|n>2SR_KBzrAM@+yeSu!PfXs_)T-*zZyPEY|wP+wRiZYGd0TySuZ zIhY4mNwYXKw1@*d7?0>l1QgL2C=_+EZVIBiX!>A*?ycxb^-DFUHpq1Vtf+02C&=Le z^lLKW)6zX2y&l9m*fvi#?2~jW1X|b*-kqS%1j1>b1mJWjsEs|R6R)z+w++Emx=W5Z z)eSn_n_mn`HIP5s;W^W0=#)^$pUoR=<(~Qa{1d+1gbDDm9VQtd9~x_eBpcvD5Ww<( zy?N#Ptyobq7lHK>B5H@|1A}x3397^g33?`^bDYFafJEW(W;YiSG^f&$V&ahmy^jY_ z0!$(UV!;8mNZw-H>md99ATnUuVW!q594N<~==Lz;&Bq2z3ZMiUbwQ}_Sl$6l&>&8r*ssK3r zxI4{Enz8%FmuA-YmE;#3SZsO61df)bgW{3X?}b-3c=3jF(GD3S%-a|GW*H-*6a%tb z@t@O!ZhvdCPluj)fyc}4PE2s2M3bz3OD>8ek}MN1;>$g+u2fo~%t+rJHL3^A`B)jY zX$;m=O8$S@hH6VBcEh>KS;R)Tv#m+56q1=(O!_R%(SAl~E794?XT~v^QT*Q-N6Kf$ zaU^G|h%T~t|Hu8|)Klx;txuqqEp0xGHSpB@nCI;Hw0gebvBzIl;x$3KupJAPwzx>$ zbPDgB#f{wa_Qh1CDAX1#e#6FQ&6X@_qnte|j4EV!RuE(1%z|vX0gLu;D(&B(ui}tr z+us@4STr>v!jD1oo_6y%JB!X;l$FAdW>a4 zL{^gQrR8mPd8RvK9_1>&PSwX+v|ONMtQ0WT5$iX_A4=+kTNWVIHbq%UcDJy!BlJj% zagT7eQh5e~$I_8#8_TuhaWT^uFWv?#RWlce51on+#fw%P&2&D8<^K=LlHlKz<;?#@ zSr*iZF?4^#i!}YNE3pg=%>!GuK&^>|f#y&=u9rV9zK(J6p3N=6Y^`O-D;0QJ>l0br zQyn&kcjo%7Ur*dP9SfI#y&fB9Y*O-8TT~)^`KnKy#J4}T#Vz*oaC;6@+ZR~5c47;pHjq_Zeng!H^+t=uA=iY^hxI}8gR^;c1<(1cdymYZ_yj-hVJt|N& z^^A{`{I$>X5^Hx}x1?O1>_Anbc8Bxz);{K7l(< zX$7V+{U}(xA<=q+M8yR3b-^Dv6-jj#FTIXuLVD^}~bnsWi zkD74Hq7)XttR>M@3V**wxA8Z`8|7M^DpJ$#Uly}CDhFC_2Ij?1>A$sTI=Z%`xzuy} zv`*S-w@oNt%u58lf>|43ElgbK^kI%bH;iU7-}jtRTyMiEvI9&5SH0 z!AUhW819;Rb8&tC-nep2FQ?o!S#V0c;#yzZ&&w!YZqvQVTQ?6wJhG(X@ zV`m2tbrXnG@VHX=rlTyR_acsjdDdleu{bj~jdtJ(En_3JS1}^$22xefO0hG!eg(?A zUMSbgy@JZ%D-0i!tVjfz*H&Y!V<;T$vlQc#v2G%_n?D~NThR>%3l~>$WwzVE4DUsN3^}>cCn3LM%1EmXVlN0k6Mq6VwQgU7{NaF&_1OzfM!((>ZFQ zTji?X-pBvUZL!QwTf{`S58`%M*0>4djaYKRqRHt`9%jAUz$w(1^-is_d(h+NTdggz zVwrh2_$zAJ!5TE)Anvem@NW8DHQ0{P97!_882$uvx!4*_hUL~ie|$e{inbatd+%if zT%aA8r@%gl=Uo@wAoM2G1Lget9p>dND4%%TErHB@;>9YbY4x8!#Yw^qci4NXe}+OQ zcfh8sx5#I$DFyig14kTt$%90>nKd%!tzqEhM6!fXEzGfL`36Hh&&0mU5ZP-tn_%7g zBqMO#8xH zq05s4Lv`3hhK03o;Y(VB^9H-G^xV>vj#k2j&09l~-=ug*^zvkTAq(TG-tm6#a$?!2 z5^&TIb130=PY!v@26AMCcgvw18iWgy=lRP*+A~Ii`^W}{SAyF!Hao4OabislE#jkc z9rU{`3?a3&W;!rh+Bs7gn%qErYYJ#HG4%JjR>!h%w2JvDikYjq7~!}zJ2FXYuH9mN z3}u2L+EQtbtz1|9$)rAA-16Po`a6tO9QQyWtUCCxuUiP#Gi?PneN~Hm;RCTkOW#e2&=^V#%r$>QcF} zgFTfnGZi~1qjEM#&~+c4WOQ{LMSFXut&aEIL0=2nZ_@rY%QqBh$a-2=(-%rp;4CFu zD#cp=womJx#a=5&S1((M7uedLjhN%a8cV?`71<}lE}c?E2uSN3!;ZDC%{pQ3#w;nS;?%F}f9k_JCASI0eH;py-4G4*6DS$)hg*^ROtg51?;CktUVA*WunrXQ>v8iZGn- zlq!n;LIT zXC#g6);IO|C+Zi|GMR|@Vjc^#(NtCzQGK_SS@z{w+4TZZb1Nl%6D6TE?B&@qOC@~> zk+jsD?oJtE$Cyw%`4G$ri&?nE^?kulm^~xY3;P?D;dPDRU+=a-Z+i>p{*LqQ3EBq(G8IIK(%HwDaME=gxL34j!Y0)}6rvnUoo$q^5pO;X8625ZGE3A(cS z?K`O1chCV#Z9Z7g{A*ZHL)|!E{@t9y-jGa`V^Vpf%8Hn34|91We&YNcSkOISDkU-g zrX9FDDH^zPr<2in0y+#dxJ?;CJH{993og@UEG~beVY(Mr!-6D5l4&3?=;tu6I^~MU zQ1j1W0+~D#*k-}ZXFrR4=G6|7*HIi%s=cjmXg%feX9KdjJqMCv`lgPeyX&2t*mazS zlT#Fq$Ch&ibbRlo%}okq%~iYuvCA_Dm=N_h9Mhd)WoLHbf;SwQPtI+!MohuH0~Ci< z6H|jlk@O{Uyd@stX3P=UZWwDV#^z`_o@&_&z4FNLaT2wGjdR$FjJ1K`xh%pgNkYG& z)rBUpednXe+2p4_w@~^-IGVo)&sN}Wf=q6MaNC30m_vlCPGpFfnYW3&s>x!&jSbh> zsc;}D$A^cr5?+A^El&HgBTujsG&ge2>hm>iQoT5xYHIVI$yh0w&t<2!0-m!^Y1x9h zH(I~@z|2u3Kt9$06$3z4#Acok&n6t0eF%Js)Sshv#%WR_G*jmnp(JrcO(N#e*!C9T zH>n3jRXH)kcQ~uE%YJot$z5ElGN{*nY^(6ge$3CGhvHkVZXEqqhIM>Y1;$vm{=S#g zN!BCHZNn-_5BHb5+v`kryEh)2^dQzY^6`l}&2#;h)k8-Y6!b;fqzziW(p*K9K6#W{ z^HO(!q;CQUa#xA=YiCb3-%P2luS!p3Wu#)|c(+OqjFdGQtZ{BSFDi>L@GBq-XH!Za z5~v2<&irvh-f|%BA1^w^y?=Kj6fZ201C)0hgcqkv#fTj~yr=W~u0FzJ7mmkGNS{rV z2mGm>pGS((0mGsb-kqUZWG+A086F9&-_j}7efbI;B8A zvaCX*O{lLC5{v=|^F_w}EccjFuztq-jE;>XrX z{IY{=FF?Jzy^H**$(g>eq*E`9MSwiOd`Nm8Sd$0PPnf*|=EC??q5W6JM>Z+uR#s0Y!Fe}50k62Kh1_KpAbM?JOkc`gF1oEjbl*QD-mMNB|W&~+L6L`mX<2IeH~*N8v& zS0%VwbYk0J9+BA<;y%1^Q(_+3h=(WlJXbE@EkVI8fKNI_As)o(s*#K8B$vH1$RP)+ z%M#kLrLz@j)Xv|98tVF#>XHaAw^t~HJgoJ%$GT<|q9Z+lJ-DNdAb{&x2cr;K2WoMs zd)ym)Z0tb?>RCWVM+MzG!=qBF6|)lT)Ij$>iTCsk8~=2Z>k#@hHXPIuy_;4Jz||>> z?kKasz|@raqmK8sSHCHUZ}AJKZ^x|hXOE zs2Dd9AC!7Fv>`9=7bq^F4g|zL*bCBs*b54%k2h*=OwQKA@;WXYs7#Lg+3nh!5AJdR z8VL1LZ0VWWvoS_-sRHn_+@zCp-<;rm*^>Zy0r4tH%i0Hi4k+fsCk9l3{O44ZAAN?l zFHQvU-3IgqtM0$X+ReC5wBM_BoPKMb{q954qR-NZDfmoRjE+Me`Q)(N??+E45vlDyDZZBZl z5l22{;vi441fw^Z5 zdSf)KvV!&1m)PL^cAgN`p);9YP!c`z55zWtS~V+16euiBiQMu4+&}B6ouR+@gID<1 zP{%MFel!yPbda6p^^1)ch%zh#@j})CUt&qeSQ^!br!s6^lDs?XwyN%)-@9b~0l?Cs z)wY}trWjsHaI>;+nEL`Z{mH}+WPC93Rm9>^XEXbw{CLkt=S1tk>JqCCS7#SKud80& zD4_;poSpJT!eV`=lD4@D&;7T|ZQ>Qk6#`j?e%nX=b=+~yUhU;`%S1ZX*;B3Wzb*gp zcswE$FP>DKs2d+OMpey1XJ106K1OXEjD;7`@{D{{qiGp>Pf=pb=TzXmG+L7F)GuC9 z5({bmFobcPUw`P(6%yP51Sf*J94@C|XW-LmwJkByqbqC9*gHmZZQ$ou1#Ca^P`52S ze#~ixYW#l;VZ_Y;mZ8Z^|06>ubpH<-`ijjea-JfnW?%)7WZy2&NlL0^5d0O>=fIe* z^)TRq=i1N9IcGOHI6f5NQc&pa3N0*BpJi|S#NnGiKFu#%^wfd|`Jvo~5d!(s;MLAT zFM@W|W}e!b8mRA9`gna3Xb`+EwD)R5_oelXjVo`;$tx>T(XwYva`4n+C@nMUGB}iF zj^9j|H_FdMK}7L{iSN$F&S$>cET-x?95<3r&h?rBDvD3JAu4vOzP*)bQt`N{|n}y zrKCnUq5xx8Aff<~B^CW>zIbZaH2ta;82DFIU)jy?S&JQ>C6$>o2V3U33TD>Cp9o$% zf(&779GVX|6+0rb9%R-8e9mM(tTd3m{h4NGn0eZ(Cs`5!k@2^(+4N}QzR9_9aogAw zM{1tj8g6;q9(*1Lr;r_UYF1?(FcEt2_nv-s%=n(_6 ze=gGP*zA*4rl&Z?g_%tI4M2RjuAAKX^bfj9mpIb4T`l7b~aj}%F` z-Q);2{{+GzsSniQ5>y)rfj3?@Ib2)dI{`wPJ>P;@mN5N2;1J9^5>N>Q;fDY`8AIwQ z0K5U&_HzSiW|o`bVXEm{x`^1ZJSO5--bg3RBs0G9d_&DD4cyq3fq&HcTA8V#atYPa z6@?fhP)x*OMJoA)Vv{qFKawwmA$H$Dg9_}}GxjXDI1#48lYQB(sUq(`FZlHNctd{O z4Wc}ZaAgWn(xxWmt_J9WJXgENF#&tWF+m3f1+IT$6u#+xG87-&a;BI=xPr&ALdGNJ zoct3H3b&_9lQ^=XQDz^}|vLZL59>E`!IyX`bk<^etygIX} z->5&F<`8bt0;fWd4CFBmjKQ9Q`gqrt(U;E5jKSdsJ<$T(?vBf~@I=I<21o%PUlOE3 z23!B9W zL$E09zy#PJx-w)RK;HQFLfxGDX+@*`>+AUKvH6)D!sr}8pAG{mYmgjCAx;5YYKv=! zJ?BR5m3}dW#FcP0NR>5+j=KH-N&&r&dd@2@yT0^iM0V0%5qFOBE{gC%{nN{1&%bVC zMl4f@;Jy=TM^>d%OwW5l5Ez5<&zHPF>kW66=Q$%0e=;LS_MxWvI}{Q_hxdR(EAwx< zSo|7hzw+iMkZ+dJedPPmBXjdT7y=vbL1%T^&qnIVWt4L#k%&$)HNLAT{MT@@Xb-(5 zM;TCOu`&O35hDE8$MU(+DDpY!2AwJD$Q) zjMh$!`&hSn-%;24-SnfwWMP^}BsF}~I{|Jw)U%$iwp`maLd06R@L-xOg?h?g!vBs+ z2`tP^)oD$>O}a8SQWDorUlachpSuZuD_I`%4?R3>g$O1FaaWwc8fDnh02C2M11RyoD9ooe^)`Jg~YADI_>Z@9s`%y=x z&<9_9ayqo&bFUB=su{)3G=g#(p%$BR1h0pwh`1ch8J;`JsB}CHrCt5xKdu&t8YqCPpc$&h2nrRFc%VoCX zR^T!Oj8c)Ncx?irFfc@zca~Q8J6e(EX@PLXih+e`ccJtLpXTz%)|pYR7wQ2Q1b+;` z3jxeXaigvba`P!1Ys2_r{Ymk_a6#WW#El@m3JW$3bO2uL{Jccc{k-nJdWxV#mI8&= zjJ-XwVD`v{d8^pZ73jckadYsqF<(W+v;et1GifIkizv44=o7#k#njod;gPTfr_!T*#O1p4czIeH#Z_ zz+3J7ojAZQsCU0fba4S?W1Zr{5Vdc7$Wi)uw(|)xae8+^pe|2|@erAi5PRcD*7@k* z0dfSvZmlDoTw=~D@tYX|t$7?DrpkBj;nK2+q4;p+tH zd~bSnJc18NZ6Vy@W4Vo>wW*BaX(cEifw`wBZ|Ph;?zZB_FsECL7~lyGLzles<<2c36M5nRkKzgn%yK z`)Y%&>Hipg?^)^i+8C-DD3Lxq!Z!312>TGJ?H)SoYRMSjq{&eG5(_S($@iY=qf}ko zV#z8bI++2Zd3c`(7%%2d7M^-hp|^1_U@;Fkx?AXdZ88H|;q>wUd5ZT>*L_K03l-~F z(F0H@|JakQ-X}^&;82^VeSJRMdbroPTUzm*3=@LqBBs#i zK5o@kx4dsz4S`yxA521&yY-k|fIF$i^@qLrG-8BhB1o+aIpxR+UmI&PQy%j^8|s8x zEE~hPa=ZrF^|7(++LnF-aQ*kz#fgV^zKeANd7hNl{F>T86NN48nvWH%>Wh&}WF;+vZlW>a$+U@vk&CmHv9Ck?Yz2+cdOHL0DH@B{$Tz`3(MOz zI}`R6RA~02Coe22uUOH5Vlq%ooF_3L8?UHPux%3Qw);{65z_sGd~>7UtciAAjpFB# zmkV%>Av_k@$-~2a(8$sH0>z6{EY`o*dEnNWNqPFAA7iWpwF&WYT3??uw+%YtYFW0w zDpHO*?svQyPMy!U{8Myg!rS!yKSfv128eXx9n_){DF?1l#BA5Q|7FNF{HVQ>qt=Sj zf@QL%#9-N3a2nAW`#zjBQCCxBF_}Rk*|p3-;)$#9-t@9cI#cTMY~L}iT^CJHD`^EP}aEZgOggn-oaTb?VD8A)2xRH^V$X3T4|Z!PZ+HB&FQw6`4m0L2DA z|F3nAnJrf0p4d+Kgmd2EHmmLwX-N~@Dhu|b>`|S??blsHzHOQ<)m*(H@S4X6?(#Y8 z7oEzrTGBu%T9H!qscqwv$6=b zGP=KKiwy82c0B~SxvC^|Ed}r z`8ODz2l*Em-uy2xtS?+WrF~M@7nr4qRh%;NzhL3|?M&pkeB&mfQbV>!K0C<*W%6P2 zb?OxuXX*$yv#<&{8;NF%M!DUR(pjGW4GN2dj*%Uvl}y20*0+}&-x1LsyT0wS-Lf~> zXJ^RN~YojLVM(%Q)@@5Wg7eg>wiFD)Pzu>*5$?y?)Q`nIL%DGJ)2qRYbsN+wVky3 zg}T|Chp8)4;~Z0OxCC0)v@b;H*?RZDPmfxJ=TTx)o2G)x`_aFON9~%Tq}sLXNc-0U zi@M=Aw0sSGv!1jJh`N#%E9SWrL4GN-MJhjN!DJvke{9>?XcLg|BR55HySRc?M!g9e zRSDV_)QJo!stQ_EQ;);0}_7C1?{-5 zrh}$dgoV+!xNEca_Sle^ky-QsRy+qWfQEwO;DOnctiKdL&E9V}UMSrz!;D$p&=%(e z48+kN#$sy?ld$}!EHc3G;>UpB^-$V{rI7$K+Va8H9f2S-n>%S#@B63Gs8xvls%dvg zA~|L!VP9^i9yO}s;lSa(m(Sh(?)Ww-ED9eD(JZzZVnXAI|6J>%0Fu>Nw)UH8i(L;A z1|B|kKo{0!X}dHjY- zl&kL5rM&kBcc`iXWW>cf?C!*eKD<)$rG;lq;wPu?#AD{K*X~%2bawqPG{qYblA^JDY+9R-_p8 za}Os9c&K77B?wyn`2(_`0&J+_vwnA!+#d>3cNd=Tl4to>NC}DwF-R>DuZNO02M+n$ zj5QJ}CBi{fIN$nVE+=)%CUxD7Tq69D27iB4=5eEG7T;Z`%p{_~6*x(TAj;|axd5_p z0MZU_c>OS)|EjX}ZXdRzk`?Di1h@C|9!XPU$im*rvZlB{Jn-|3oQ#6Z&hpsPmZTi! z>y*RxoOv7u+=J&f2DJhP?Z8~ra6w(}28l$1MQx<{gv3s_*ZW_y-frZYMTbGEg zp&o~n{f4F)nR>XB1g6)qj?oG0CI$tJyl5%KSMiKWSQFWW6lh(bb>x*g4BH zDq0JF!u*NS6SGjUZjMKHkA z$eZ|J&w|Rlps8o;PlB>k5JP_M5`?qgRnHC?$cBKWnSA|{n2Vc%en=J)gjS@8ntrHx zDgqOqKThQ{&0Q%D6K{AJ=9EX58368ad3W1aL*a`CkG=CFmhdE=UyYMrHyIaT5AIzH z0MLLFgnc*{<DoU9DYHri+08L)TdcMAfcce_)8AySr0K=?3W(5J9C|X;8YmK~hNpDQS>K zI;4@77`kC-r2O{abIyCdH~w*8c8z;8`@Z+J*7{xGp&Rv&_CK;dc`f>#H^Qgnhgy!K zScl1MsF$4UhUpd;j$GhNl{RZ;r6vJJHlpq=$^bJ7n))twQ&ap&uGyY zD)5h%or;_&O_mqbtFaeI5?AE4<6KFp(pD3EltS_)?b=gh?S!?GPBy~2$Dl9~@@$f> zuca%gEgJOhno)K;Mr#8#p0T!?Qn$r@1Wjy^=GT7E0_Nd?bTZb>{`=U6SQ zok`$2o8VyGm}%%KFg<}OVJGXzZon#^?9+vz3+wD)?R17w?y|0Hs`Tf|V4o}E_UA@E zqj4^JPf^6Su1OcxB+0z$?F#%}!A%=p;;JftD{(;|@dG@=q!q+%Osw?z1b547QAm=4 zI)S+B_Z%I2XI)%bFnxwap;Z`tgsm!eot2#sHD-lVumW6^jY>pjf#JRlw=%<8YZsOF8pPyk&v!*x5ljWpKdmLtFrf z_i9IIpJe#j8Eq^sn!J(N7WJ|%vQJ92`)l@+!gC;U#jSO!9qt5u=h zSMJ`{glyeTy)3b(*-wnhuakNcZoyxIoeYRcrXg#vA##%pe%5`W-T^u~XInJ9%v*VL zp1s#H!B(;)y>t)Bay)sr(Y&ViB8lHcu{*LB3(p#G0@@Nll(3+y)@r9>Jcke6tBEdJ9TS|lcuy&=l{FFKz z&#f&o%IZmSgU4+)f|0hNWd6aQ4AY;=#)+2tX;hHUBkXPsT4Uy=H7Hh2Pe2`wrTmvM z?hhW#Jt(tFdVxN%m0VWF*&+L)6Ilos0X}gxqevI>iY*i1;{{s7+&4GatC>OWPtyY2 zx2;oqUSEQJpb>Ip)F)$IOA0t%S%lN)m0KQ~?oMPerD3hC+ftshzuCNIG02-HyB@>S}!~Jk|K;)yJ*$xnf1Ok6V2+V#@_J7=}Yz%bss@^sX3sKW?A$SAL0TJ1evK z?7)Zp=F|2d=+Rpi2NRA*4kn^vf~aF@`k@c!lQNGyCf#~S&TLbdg3l)HGtW;=C9(Zp z)u|I1^9l>i4P+HXGpF8!033HTl?#`-!+awhz|!oBg;5 zDyG}2?KihWo4HlF^O_vqEMDVttPERj0`AlX`88U-+bzy{rzMlF8PZ!*`XUuSSmn2f zL@IO=>EFl+{IK?a)Q9#ERYv;q7KtXPov@u{*;(}?M;kAEdeap|^D*wmT4GbUs{D6a zzEZ~To&&smN6z8CT#^qa{4}Y@XrJO_xsFY84is@5$OUDX!f#oMd> zx^-6WF%BC@)_DpTx~QU11Dn_L8_Wm|D1PCM;>5UH+hxSoh@n_@%)LZHDTKatBrn5K z_x7q4c=obZKt^)pU~0ZUN7-@LvSH#K!5J@A)3p49DKXPnC$GmP<5AYwJgFjq)u$*A z>s5Xo{O001y6PF;q7(XlyQGs}OPkOBm9+Ve6Zw#|;jR;)o`X@;Ps@{<$II0)s`2rp z<<=pTVFejbv_Nv|c+ksYfKN9zFNBX|K*768I5xk%6l66v??2sppEfIOCqZ8pV<&)9 zhBeh@up&AaH;v--`V9jnTAk9HJgLDdf=7KOgbLQe-^w={eBM$%>RWx(w*(T2)xR;Z zG#7z1#$51y{IGxvOb)CgFg4!=1qQ@&Yu4i-Vv1paJ%rg&0INM2(&NI@WQiLfD2^(Q zvfYT#Dx?MyzX2)%)H$fz1F{a|kA<(t2!PDrnGn3hiO+?6ww`;rGWz~#NNZHj-M-CF zX4fMpi(_)n*I3F>i#F10l0#Ztp(xcVCo5)>p`)m1i={m)mujTq)bi`x~DVzjs*QsJ#=_U@VnYqS^i^udmU>p$8? z;=>lx>()t-#mlVzUVXq>xG_1B+p$SoY!-HfYLrgxZP8f?DLYMGvB4!ydLQ&PTArac z`{|ri@I{n1`hk@enh{wpgm`-W|$!rH^zlyD{d`WWKzaaK~-e=|M!cRKO_n;~SYWb{c`K-q* z&MG`Xs#;M+w8GB?%Gn;7}VEP9lb1ho z1N|B@IZZV7{@sB1^B4KwsAZiUgc7|dtjX|~J^+CVq?MWt2$Bcn*o}g&pCPJyh5?6= zk{r3YLQPteF~tir_#lM?Gk?sm-VrCM1{c3}7BSfe)jAi+PVzPg$&LoU7CG+ghnz=> z`bpF~L*_r+`SEKlGO%R=FZ!K$e*!-b(MfXF0BBO9Z&0;}{dqT|-x(I0mR zW~(*GT>E(0kIJ+t+4N1yR>O~^oz~YU9J=52BsfC@L)+ruzT(%$I+tQ4V0gN~7MK#a z6){ND{zOYxkBGHPMrZIBNXo^^G8uH0Awh4_oTzxAjQ+YvYg;CHEF|#pWCHD22!4Tt zYc4Qnmx8ZwV-_g4_A{i(=MkzFtL`~!Zu4vueG*MmIfUr<)3*u0k1N~_1YsR{w1BzF ze$fQRD&*{n7Dy_Dbr=aO#IB(D5r-fJoOWT5H63UW6NChs`WR5A6->@}jSqKLh1j5- z&4smb4+co&XkhuI6iZ{_`?G&GR6cl_Bz>U3AB$XBrgd#Kx zJ5SWGPd+*$W5pX1zwaQQB)T8Ry{(D&OOhrcz5TGcT>aYhD*uKi4V2@~e+hv&XevO` zy73^^GzcHkg8XT7-m(P8G+hO)(_qTHUZIKWki_`iH>h>Y1^R;tt9X%Gz;+waM-KSe z(SHVUsIHStis+GkbdF;*Wa)g#Y~~aaF~Lt6$}wc3gw|EgebC437=jnc?X5=&7}6#9 zt8vS@^V~x86OUT_-jEi5H~m4weDcKTICFxg*Xr9YC_<*Hg1P?Q zqD#A#?E48;9=OZUEPB^h!41S!@iPvHnULReD+IRFpxkr!WtGQDswO#O`;p4N6o-Wc zNJeYlb0>__Uv))y(8xbY4U)vXHG$%Q{nA*BFmSKB+G#BPRP$Z)@44%bHjVM~TrmxH zpI@vJ5?qal_N))p_p>oW9K{x5)>asYox~Q})>hX0otRml9%SNNqBx3WJj^_}qqN+Y z-GmT?G@^8H0|V^2D`5~)YZ@?yq)Zf{LH?vcaC+4}6fY4+BDXxAi%UuZV?bfmDPdIh z+)9!C%F{%O`pO-c4Who$R7g_*qi@djiIFqU9wVI+rq%QNw`@QnP!%-w!u7auH3Hnn z8xs_?-#VHGY2&{SZIQZpk3hwE21VS3oW1Bq5Wo2$Mr<{9hkQC|xI0&H^9$ooj`wWX ziOC4>UJ{N{;<_-72wM&>Rm=&UnJej!u&_AAPtPUH#ez?AHG@|;Xi8jGB66j3y@g~p zy4;*T^}{T(JHt+Z0r&tIfUD_$pi7bp94Z=;XD*1T1H&*ZsbP)hJ=%Lj@P2@V)y?_f zL3kVx8Hnh_%$UlER1)DH!CwuiVcFcze=~2VqPryc=INh!p3Ieu7Bpbuk-7rAWH3t;k$gjW)py(3n3uEN;+ZORt zf1@w8^`NWX;>|yyzqoCGu%Vm%+lKDTieIJ0@*nz;<$I@RReQ%@Y^%056sPtTr&O`5 zA^Wn%%Q@}7hMu^yz`UhxcbXFEg02!Lzz4D~*@KfMWlV#31NaF?)fp>~Bv04;x_5Aq zE{^y-xA!>eC`Ki|m4njQ$OlVG3G`LU=8T8u76sj?oR_bXj;-3@D}TYI9WMIw|qaXXG-VWTt+ z<7uvq_2v}9W}ne~j#?!R-d+_)7S&F}0Mp-?IxR5Jp#G+$GfEHeK3Ny#xRBwhMD?O8 z`HrCLS083Dl;jIY|9M7e*NxKOxr17ZVs5fcsOM|`M07exg=CALbb*nKwh_GT{kcw7 z*nnipXIjK7xa>6CfBuKm@gpAKcE9ol9P%){7m)^NZS>S6SG@kCV<}rrJO~m1-2^ap z!o_ULPQ6KaSdUgv|sz>v$h2K-x&*2Im%}E1*J_p0^6Vnq+Ugv}AAN3FJb6AM2wB zC_4nI!uN125KZo6c=+H|PAa0Oy%g7}kJPBlwuLXx<82TBtX$iQ;^!!l;sLCOCS2eP z$_{EYe{qT`1y);eV+{naThSf+Vu{~K;6~K%5Ah5SQbb?kPA(iWK(H^SwDYLDwuG8T zNfBOFD)@^lR4OnSkIL_BVecb&vCn#Sseoq*!dIy;(2aq}V}cOM1!p&Pgo-iFtaiuJ zMyJ1UkRq@ls*8kPWuM8271M<>&Mf$Xu(F=JdZ3YXgPEn}in7Bnp)(5DCs8`i!%q4B zSriQ{0+fMnD~5|A8W2##N56=E>-<>0aR3b!*k5W_z^L**o)8TFLEcQ);lTh`FSZY! z*cGKT4FpCI-z4 z3d^g@1%Jbd@=X7%n6bf?Ce&@V%r*WM$uqOy3t7BZmy`inH0^Gq^4q_q5rBLJ`WOe= z#=myk1nd^Q;ZQ%K6|wx`)U+j*G`?C?#j4a0O7a2)pJp+DFzJPk<{<5~fv41lOrNO0(o8fXIanZAFC^gO0d-pm$FspdD_bL{L27e}UFw`l{Tk zk@$!gc4+v;;{NU(TjtQb){D9iK@>tG#kiBg%)OOsF2NB>5K#$=^fWn!nzhr~oHTIc zdrihtqTFTXLFBC=R#GBxGpfSuc_X3%db0$_O228l7G*3Q^y+7$^>sQo!RAwXrv+IW z)f-A_Bl51=QTekv82H*>;>p<^PDOcJdGweDC;a3EWOIPlxnVW<{u>RLw}?1}W<#LL z*Qn>?e=m4DaKSCuFmDNSE(MPqHq*A)#J+KYPusj}s*+C^N$#JyFxqca2c@>nG&C$=`cvge&ffVa2m4$xNmS8D=Rt!fm z!8)dZ+f4#)xvxNAT(ILg_)4d}{;KT?NZ+XVTtvV*NRF2-$bN)}zRy?VIu`+RZ0E9| z_SucVv#XA|QM@Z6o{YPVU6-`PCf@PY2Uk1rS%}V@+^_W`B(OCk;a?9v zXYtHW)(#|?>(sYUfRA)*jqV^xv7(^ueuLo44ttY|S*{@g08dPC%6(&v<2)SCYw)~= z!b)i>3mX>a$^$JgM4tlID@mc-M#S%w*nY(C>iL|NgCzglE*=)0EWzfG=sYUt_@mnBo-9H@Uh$NfMxn3uk&WEvr#p{FR^A zworaQ;|hq&_E}eH`9&CfizvmjR=WX*bc zh5Axb;fh4Q@?2Z^dNuoUTZNRUod(7d_xnUCk1+Ez~uvICy2EOgQC0~g77wd-(H29r4;Oazxyr`=fmx1W+l&fRP7c(3iC zxonPY2JV|0JfDy_K5pY|#2XPqwWgF-c^bdfss#pG%s-TL#^jx_(O$D08$u{9CT@{` zd(SPZ1G65M3Ca=}IO{lpmA5X)frKf3#3=!67{~Ou5FKm83=(YyJ75Z$A!~%*EU7S- z+EaN`gX^P@kKkh+5Wl|U{JK_eupE;RK0Pp_!TbZr-eD`*G5Z{S7FS{Qe$1j!mV=ng zQRagJCq6qEKEk3I9VdvZW|aZHAIQ$J7y*DZ$=^}7bkpQDx%;ZL~Aq}hw4Qn{|G zm)4M%QVQ0JVzY<_in6PPIds;nO0w0~4mPbNs%Je>@Gk&2l52>sFeZXsKFxrX%p7^;148Qqrx*8{m6~av4-a=oKP`Xu;<5o!FQw3+Xx4yi(EpU2 z1WMmf^rPpUuw7~nbw4Z3thhj@<`|KHGb#Ffzr1>1kNkcXIh6iQ$GKZI^htWTJ+tr?ChpxWlDF^uxHWp-Jh5ZmxFanz~T;Nv?0weSl-D`ZBz~X z;K|5gvo1cPZ!R!%7DD*5ndr+uATl^4z`0k)sv}R#q=;4;zcRfluuNs@yZE|rYEA6A57r*VCjXEE(1W){KGJNE7m!!&6Sv(vVCU(w7 zSIgOyI>bcAsi9=}F|)gg9{Gzqd3H*n1t<$33B9xK4k|2Mv(d+lE(~^u+8l`;v}Js~ zdOQBSeL+muqVtWN*gnbRq?GiX@o)*Npr(RD&|wQh|Hd+2aCaQTu4Jm8vbpCIhmxt8 z^dHPZ8p_)By2J~B-9AB&=VW9_DL&W`Zvs4XzAjV!Tk+_dXmg*CvE>qtDo#q$j4DhS zsmRr_?mJ6T?`BlLj3odGT96eNgF}MM2vpq)T8Fdmi<khJLDFmBbQ+s)^vWz2IN-fVKi)9)NTRmpZX@+&qb`fX=ama1*7<2Iy6x){EKdnIHjKQzEA0OlwJ2}OzG*n zphLRX1j4O6UtP;;okrh!eR2UFw_MfUj}9%ls{Ju1ns}1`2COneP02{^HPKs@X=yRR zEE=sQxOTvm{XZx?1OHHXod1Ku^U2<;2ZAB<-L46EsKFx1*Vm=0Gko9p-MiGJ8`Hew zzxf09baA#Jm~UF~z5GpP!J0(xGY0=&2J1~p-)zDE37?ys$jS8Y!~b3=asj8n?v?zJ zD{l%K_`fKyHM<|Vn`(E}rnZCKUmEGUr5ewi-wr$MI@xcvZPvZ|MvC7=b8`#9`Uk%w zyznplPUio_@3ag9_??lJ^?&d?>nPoCaI3EW8-9m^U@6w3OzsiAVOYOWmZ_Ta8DXCf zb%iV}@2T2|%ug6GyY<;ORylQI%I|(~`W%VdFW!2W&3L73;pkPyNW^Th)SII98{L-% z3wD|8L;D9z{md8o&`&SYnBILm4;~i^9?!s)9}GkkI1S940^`dMB8oizv#1uTgQzCJh%NM0p9lUTxiB* z4h+8&bK2=hDFd~>WT(q=17jqEF(#sjOgmyP>^XjAPSKs_&A^1i545$IgkAVk$C-*0 zoLyu41Hs>SE7!*44lAyE2%kCucz}?<~a&0E77PpCcg0)7UrftI;KH*#{vxz3RnXpXbHsH|G>48 zP71;>{IIiYIZ+;=>jD%Fd)33(<=(}`B5!Y_P(@@1#9oXiAayiE%C%Ra3cdTo(WOI( zwnL50=C}>PR>Gz<2=AhotAbFMWaRD)Ie4)V>oPPeD4>WmN%zq+=H&Ufa(;%mB2f`- z_m^xqOWZB_{^F#VTE&iwjvPsL8+I@%2RvtGmL`p_DGmQrm%mpreTahTWxr|wqG0#; z@F-ZI6C;l?uUd2A}aeM-Te@p4{d5^e?4FL zz3*0!iT<=4W?hBFjT*MzJ0Bkhkz-lq+dJ_esTTNb0N@_u^bnrT58sKtq z!T&y;M)7~RToNggmznFc=w6Qq{I+2@*t1elPN=I+62G=ZFS2{#s>SE)qenS;KtF&b z^`64j>Wy?qt?)lSIWRrollwI0omo6NqVqGuX$!mmnf3{aWOWdO1K!7f8{|Y|mkrx9 z&3;!+Ef2kw?BD#yAV*B~YVD}8drHqPVPmk{O8AANg~8u^nEAi+VRrwS4=etg4-<|4 z|HdoYj~cIm@ygO={pVKHWrf6_mj|9D8--s!;ms~%S>53XpRGE8`gXV<`F|r%e|r2U@>C^d z?|=B~?z;5S5q!OEN=i!ww0{{6ZyM2O%$AWo*4vY@nXUis`BS|meU;14hOgbjrPe?= zLuLu(0X}~0_P-EMH+q9d!bj zc8;ZtREE5!GeaQ5*hytKK_`pi>3>nQ=^S6>AB}9zNo#hz{ssYs45R^OFP>$bemlx|@4fDiKjN{LQGYH& z{MH{!oe5sPJ;8+5;CeHHfU>YY?9q4KpT&45KothtryC4+q~Nauj+AYcPDh>XC}|0^ zbpV9oZHw+J)3LCYjdL&D`909z@8lMMDgulK&^Ay42cU%hS=68)ISPL+%A&ir4_`i2 zcjXvg*0Dh%yUD4+bZ+B8lTWFcBHW&lXr&WyeJ9#ypR>+?Ji$s4K8Y+@F!_``Ilc)u z(l}r;WQ7dRD!z#{d9uguej;u<5+^q7Lr-Tjzqz~#x%+MyLEub?;z)b!gkL=IsuU!rDNOJB+jFu*r0)!$? zkU0V^u%Hq-xM7J(4kG%|jG1XRsF@3T@SCC+J}QZ2~taV7#6o z%-qFrHU6uQ8oft)o+SQjdUXtNyu1G*UFFR?ByYx3c#Kbh7ZHZwJrP5A6r2 zv68%k=et^Q7btKqzhrPPkxrn*Lj=UoWhirSoczUBrz61ez?J^d>J$MU8>0vn0x7Ap zVN1Oi>!HOqt``DD43C8O2MM(|bR$gnSpI2Z2>|WDdgTyLguW>-`oCbnmx}5)Oz=lM zm@Kp}oF1?X9amQieT*;lAi!xy+lC`aF@oq3wg}O3^8FS4b9qVW5pdBQRTyanKR?4r z@L!2S!u@9*Tr_TW{P;dX_zD2rhngl?vHflj1A<(HflT>5;w~JSd#eZ0U2~q1xZUaP zbc|U|MuCt(=@_5KQi{@ukCy?nll42rFiX++8_P+=TVI?X*yBpoNS6yx!*p|KmfHfy zPtXGRQm2t5ZN-pVg1fPB+7it`kBL(g;F?vwL(`TwWg3CP8!>*kwSt%M{Ilh*1?6<=TmOz=hD#5GF{nm zE?90TJ#n|zlcc{`hL;#UdxfvE02}MqYgW7g+1}hZ)1tTA`ZOCEzj&LAKT7$CWayMp zt=dq}rj-Dcyl9<+^x_YSnoccoia&-F8-Q#?6@Nu!znJ{+ zZB1V6Ij!AHb}d!@2JItM8)3yk@j73H_>`d9g{3rO3tncM#>ZZvMH#kycPqbUqB36L zH9TffxMlpNs9p{kf4L*?U;*VhdpEzHlKCqmMf$*D{Z>qd zgd}q$bgU^NdXMfFT z)u}-i!SCei<|vdK?C=`^xrDVM&blCZd0_4XB1#L=g=6*8+;u+fgE<8;ciIbRfZ}bi z!Bzk%ipMU|R|<0rVeHW_7fJ=vLYSjpy6&Vb#c`YC)Sz>R7xd9y!lZTarKc4U1M#wHnTy;H+z**0JQj7>KTR|=v#fd(z4|& z$a)?`m|G_RqIV$>097KmPoO~mHBtNpX`ktCo_3q%x?a}e2$TF!jGt>Y?w8OpA4Ky( z@j$ppj#EVigP`ibE*9=t<5`sB{3d|+bD2bjUSL=5t){Ok&O6!Ow|%ZrRY>XSRO#uf zS0M}pl<7mlym*pP(0+bv1?H9d!RAkUQCJqu^~)bA92|oK83-wJp^)=+FKI*tRw0># zxCsBO5j^%gg`|uryb=|t38df|0#&Qm-IcV{)?Lm?OXUDgiQLNw3Ogpoz>oeRzzcc$ zN6@@7W`=XiVgvuUK0VNHV-}CbP?YJsU0k7|FNfZk;gVDbsa;(E&`okIEDI3y!ncCl z?QtsVHLT5R#o};by2jhM49T$-Vc-m{m{U$52qB(zo3r_+ep1TjX z>F|M}1ep9{7t&01ILVV4NYlmnDcu@rB<^56r6-)j{ffM}$&)8Z?8VXCsXEX49zFj7 z+|KFAKE5c9J)`PY4l(Ed;pT&JwsBXFS(@_W9>MISKzN`mfvceE$w`42?eve-38a$( z7QJEiN2y!|PH`s%^73wx@DR06LxS0U9=U-d?nVe}#aF~2<;R<{*Tb4@VsEt!w_BvQ z)I9l`XvaJ#f<`{sK1R(HgujO+;-GQT6*NNOx^&Seho7OorM7?KIqh-t8xb7oz#bCU z?X&;%CdP8)&G%&B`+pO&DI~DhT{YJ!N>3kZRuf0_Nqnz(t}{y8OMUpd@uGN+1ltZlDJQf*4qh z`xQg>iU82yuIT*%kX(TT0sxXTBA3fUG|FKi+QIVo`g+IB$15&)1OGxW>!cxrvEqE< zM|Pz}N+C+-nXb>tNetx^_n-E+)HKNKBV(NdaskZs^AJtr$;O)qVF!N);q z_ z6CU{`{N^xy9NT$;)uIi}jJQ6uOgg7RJz9WLMVb7zq&Rx98t@*P$$50o`)v8{$&YL7 zZ%gH{*siT%k)>pbheM6X`CQJB?ulZnI4HRHY0oyz^@?U8L#f~@l}G(n>86rtIIr5_Q!pyAyP^@Ek`+;RMu;~m z@Up+Ndxib1qJKrSNRO`bJ&ep7b@7a9=mTL}kQt0hXLtiD3R#xE!Uh%%VCkU1e>{vs ztDuZHqAi{Owe-l&T*Rit8F@=Oxmw}s@x`imf9551zH~q53H3UR+I9V_W_#|k<%)i; zzicO#f?2_b+_{zpZsRUSLiwY*XK2MJ&X9 z;`<$5V|e>dscRQFyA9W6N3do;RGh08rH*(Kb5SwEj3u_wVb0-=a}Y5^aY2vCO9|iU<1q={UhJ=^Egm45 zR{he)EhVuP{0k?ESYUZ^2yv5XKC`u1gFS-({W~V6H@@(G8|pGNzh6z%s(zkO%xmy? z9q_*t?Mw%Si(gI-6%-&}&|BYDcf?-4%Rd;wl7(AIyHTvVWg7_#8arBQj~b6*b9XI= zmyto%4w@Atc9@ycizB+qS7s@(neOBry^ri;|P~e}1b}n2mYKu%Du7TT%HE z4ehJ8im}sP$l_Id$f7dNL%g964zs@b$16O`9DR#$)i>LpWWxp^zw9ZI9e}j`!rMsH6X*`9| z)U=D}$GB#!Kp~}CP@0UeC*hBAO86TR_((s-KQDwip8<>vRs~sMfa2*s{vs)_Ug2{N zY1uOvWvf>!>(kVPQ{{1wACI0zJ~rc@Z5%gNKn%Aum^D`DOo*`bw65fH?Du|X=ah^v zr#i0aSyA(OLOFmX>VKS{?A)VXV%uZ(hkUrBZHRHGY=*}H?-N@->7JYa3@~07&j$KgkwWUl^hgzj zNUiC>QK~5cfj>U{TK4|E6*d_4=N@(uBOUTR;N%ICk=lNCIh$STj8gr#f{1`tonrSx zyp*6yd)#lBD!9`Uohe!pCF}%*{OTQ(+{izVwJMR2sd8ygrKB;~`XQ_k^j%GEKGlvP z3G~kVR-6wPVo^5&Hh;KQRC2!w%|08g>4^^WP_iv0!#RgWx;yh_b&-GQ5?lj1m5d&p zE46|i{`i1YV-Mh3hFu5GYynUeGoGH7v@TQS3YpsOJpvSM?zF`69v76LVmwk+wk>Dw zw7?ER%rC~==Zumvq^cdpwtlK|$BLL=4w1A4u#ihbPnlZ2Bwgb%*_+dR)1Jh5U7u+x zfwNzg`Pnd-Ku$e_)>IlrUjzWaR?)`wGWF#ZDsN#yk?`I~4n?bu`a~Alx}Y=kY6k|K zEjfh*iHfU;zj!Rt*)|qNn2C5ZQa0SxN&8LVQ{SbSb#-S*7c#8FahwQ-7e1kn*49a{ zC8C&s1M#YD)GzOMHMpBPDBA^VKF;!D4aUl2V2ze3nwksmWL17tg3!^4Pz8IpHWAGd z24ou{5EXenh+?j;6%&HK0DH&@!~rx6J3@t9nE;k7aQ8duNF2vI>EYpDf6Hi;v3?QH zrLZHIV>kA$y4-3(^PGiXSRAu6VVnpv1vjAvKZvQy8eR&k-R&jC zM`*sc`ObHTKoj26Ajm9_pRwHekX|vrE{y-QxZkca(S68v$7CG>rMDNfHvl#Eu0E}_Zm?SA|$mX(?s52St9S)`PA--!^Qz3>^ile`Q`aT_k@Yx z>#O`sKu_mSegadG9HeAhDACb=*@7)iCBI4=UbY^7cbfI^J$l9;GAxkl3>Q%9$)~@5 zUhpqC0UE!t7eLwn)%fis@t?+T?2U+6K7iuiSz)k&BAHnA!z+#HUu}VYzJu12I9jpz zM*CS3-~U&?w~+tr_f`)$E~m4oLINE+2(R22ZsSV4GHjK!ZnBrZ zxLhApUq|gF@xG3Zi%NEVS_d=)Y9_B6_+8z+x0@WVY+sw2T>nI0ORaP&W(2FzhxgMf z*uS2Z|B+P^HsyIQea-*N2*Bm{?Qd_OAFYq>e+4$GwIs8@BER+iKKJj2Zx*NQ7Q6pz z!#BTo&Hu$0c<%iztrj|!)_O@4(r^4EbLNOE^na-C2>+<=*#D`zzZQ8=-4~g!(4P(l z@|TvFjqQ~aX*JoRi4h1N6gEe>cMX=b-R-Vy+}#eWh-{8Ov|fFSaXOo6>u_G0?dD&2 z)&H$Spg}vj>eYRkVAv^X!rQYMPrIrWD?NGJP3Ql;gF#+dgO!}y4sZ{!om0CX%}8XM zia3c79DIjJt+JLizr82(D$$DByBg|NJP6FNB6q)C2pP_a}?;PB;Y z&}bghacSW>hpm~j8woUVghW|1bu~HkMe?{M@*D=2=Ze?pEtJNPRhU_^{Fzg@9>oc~ z{VHYYb3ZOrM>TIz^B4(VwSWWE61c6cWj5 z3%*}UJu8*mLOhWW>4=|uTHxhO$QH0DwNzmE zEK$X+P#-`;cTo-+NMx|&Lf#$g+w`@vQW71=jEz7J$d}3`nd4aq`^67CP^X9vwIBhr zdK*r0PxDr@a1P0!hWd}bs}B|VL&BWnd@5z!f_;2n`TJZ{jcS;}6>yVfT|Of&%nl9K z6yR2gTEcO*MtD{e?`y%!e%*n(KzTP^TEKRN7VI4BgMg_?WnvW1TRAFmfvk@XWH}S} z_g*|{%>490*J9PU&|C`WNXeoDbfom8q^yk#%FSMhW)Wf?=%C3rAfwL##*A51u#Vnr zYAQSq${;+8dZAQZ5u=T(ef9w;mfv?E7vhjm5-Z3$b(nlCG*I6OBnbZ20EMxtes$|W zqi=v_%p-4Aw&x)~7LuOL!-xf-a}V*bEz&92J0SMIqz=4XxViyN;Rw0iMR#<=VedRq z99RTfGhfK89Ppz!6w(IQ6SQOkdQSZZ*7KDE*S>ZS3I_GP zT|&n4W|89t*du2*^k*5^&TFok__8=7oj;|Ocpr-kEq5K$g8PC}mP>YAO*|>%_rxQc;Yz?%beFS1z zuX3m}u&8nkH>JTNozE&VU0BaGca@Hu$>SwnKkf|^eL>z7*i2dNAg~&n|F`>)zODx5 zfjxQ{kOX%Waz*m>0F?;>Ji#!yXMUhFZX}h1U`xMywINKLl(H$X6_M9Lz%*|2p%IWc z-xvkW3H-C1DDEQw+<~}mq_$AnEXLy!3t@*@oQb6C1%fzulirzH)Ysb7By&=(YQI$2 z4#uB6DjR>oBv$u)hW{)Fpza8gJX+Nd_04OUbj}{R{nuIvQQ=9#h)3a)H-6C50y8A7t$_C{3yJmpR3RYfIH7 zLO;losbiA~3G0k}Iv)z(F1BVY6MPj`<(I`*V}f)dEYn7L?ZCb+%6Ap6d+mVhPZ1AV zKryg1hr$`a?W7P_aDbRUX+}s74GsaJAM1V6c0Dath2EDd7UE%XL}uC?1|-fL94iI{ z8+3s7XN$y7PfANYD1O~>G6uBs#Y0-<%r_#l%AwgVl>2_z_hp*}AHMK>jOdzYyL(Pi zGAjr$x)>Y){;jHc4O;jY?Jk$%jH8t>(dlBm!sjg#;8aQ4ey>6j)F=6L4J$4%K6X!5 zB$oNNX8xM>u08`53I5CcHRa`+7b4~U{nN!yzjcl|CzJu8Hu{&ibDq!4_eOC@{)}cj z)IIsu!gqFi%U-?llCxUZlS%Fyzsrtx#9OqO=S6R&Ee3Ob5D$A7y~Q%Hz+l(YYz+KC zq*IcBWFg29v@MJ%j%bHXk*fd!;@3B~ zFLBa%fSk&Y9Uy*Fnc9m9#6^-SNys}5g(UVn+<;AvA@EHy;?MycT!^>>X!37s?Z$z= zH`9iR0fGQo9We8XDF8RhlwRX(pZ&oJd?p%YK(}=ZtRJjc2;PV`&R@yJvE&m^8%~mz zLNOK4M#*)EnNv;DHxu~aHEB?j&Kfp1G%#$LwqeN!r)$ndCupfX@cf14pKvC{A~{XU z?EGsg^GkMM=BsIK`PzugK+T*C+ojA4R^Y~0Sgnaq_SI1{Fep(NwV*na)KQbXHYia_ z;CkKcA3LM~BU_ZN`TLA)(iGe?kI2JS%g#nm%7$ zCL|iU5lrB$>;KO7S%`eScRYvQfBI91LQo{GfrAh^W99{?$7!Y@0fB%z9HMGY1QsK~ zIF-?ZD&+qDg7}@UCeDEIH?i0JzSj!q1}-*NZf!2>`Pv2g02gqL`V}VC3Uv(Kl_kxk z^(%ibXcqqE=3p|yJ{mv)I3GiwP~dr5%Uj{>s>GG0w2U zBl(OCRg3YW%QGfKN~Pu`ky{0cV&X5ju9uianev#2+Vn`tXlD&hUqf zRrvZxaS`EhJ7c#8Ra}&rdXgf3>nIn_{t_3Nl2W6s{hz^S$8+9hKER0YnG#44SwnbY z#Wv!Z7)XMqKDu_+^7h_rb=!D!3k4_WUTh1+jI>9jvx(Q-IMZzlWstR}Q96S{hi)m7 z^ZU+UVJt}FE5~FWhAnf&8n80YB869zHNcl+E1P{YKiG*qvxn6Bit>s(34f`8V*H^IdEvZJ?+}) z@$+-P>4koR<$j(7D`VxjK9pIQ{n-H|-q+5ydAzT^Wcf<_qG>c+jcTZ;PLKVBwoaP= z?0$Htn*iB*!JKCD#v{Z-36E1w?B!Y%{Qfc^)no?+y zos9|2M_wpXyd=7V^UnelG#^m}0b9$|VU}0`MYB59q-)Jb&A)8vH6I1p&fTZ=Z!78y zww>5qD!05y-N>i7(|oMW<`sNo%C&2uwBO>XpT$I6oXS**@P54r8I5+!bVXPm-%^vS zOJ8>9aU(!K63lO;Cs#f?e=gSU63UJE9>~1O>Ae-RQna=o74CwdVxhW@IYvF=+vNaI zyLq%?9aOo-c(TDg^611oRbhce2w~5_)fD#mAb3B+OJ~PXyhEq$ycYxFhVa`1`epxD zQC_o9AJeLZH5!CJ3s4$0IulcdKi0|}k}!>whll$Mv5?LNg;vB#mmtrfpl{(ZlV;T5 z^X}p;ERg44CF6$U`-L+z2~8WR`!WkqXt?btn=CcE3wl7%ZPSTBYB^mo=t_U4rpL{evCmo|7|HKaK&x1$p_v~N^* z!Cwo(S8uG8W+(W4jg_mQ0!+`mAD};#J{r`h{qL;A5u`!1I}sn*;8HNWB~T(~r~7 z(~n=gPB>04&k5`com7svl+021O*~c9!XfY8(sS^Ifuwu0eQQjT+NQv1s z)yQQH?kZ4sv8n*h03cvIe;=F> z5i1Pv?y0?!SI77Ud7JBapkabZJgvRpF6jBH~q zvux%=;F}E3>>PA*m*V-PwKg))`l^ofGfZt}M7t+23-epY zR(`A(ffdF0@N;D;a|Of+`US+;Nxg>M0r*j{pB;23W?6{COeMz)Oas7LSx=~MfcRzI zN^W(>;Kmg;?m}`z9!ljtP!w1-twwRp zpNk@9k)s9t&V-&_($rGH)MJ&xcH2Y}YpvZUDp3l{4Bwj=<(w-w+?gJ9&Sj23pBp}Q zLKi}bbk23z(={w~g0pR6=kmV9v}96(R-l5)K4!toKBh+1e*72pHl{~`h~R*V8}j@# z#V4@uo5gl6{pUroW6!@3gMVS86}~@brpo1!hrO(CZ+TN^VN$p+!g+g|FcS>u;^mjo z#Lg)mFYqe<1^G21&CgK;oNo&4fb&hk?|7tTj`MSOiES%((XyZgPB=&c2|&6_;35a) z_#M-6BLcj5#A|m2bMyoa`WT;?wYF@!nKhaUE1F9|vgtc<;}P^rLLHY*3|(JS=P+dP zUYIKy_)jSd!X%K({OaUF!)X~3^p`Z1Ak=~?JGosfSsL&sZJJ6&-d-3q0M}l^B_Kk_ z^TAj;RIZI$cP3TSgm;@VfxD-oP1NHLo~73_%=9y6}{~N|F9K+9=b=Cm{C zXeoU!QXVYyqk+GoehPkF#4Y}5Ry5~3;?-x zLAsn}BGydAhg*@%;k$K^$RN3l38&SXV=@|Js{Ec~^RjlwXb!ln zmTz=(`~f>+fiWtou(TAW5i=W0FPabYwvUrMc^vPmoBG8K)ZM#lk(*66iKa~~J*(JE zT?F+wuwXlmzm3P)N09^CH$pR8NO#g$-!=KGIM0cJ{z+ezeRWg?zG?u21RK;KL4?S?ZAJ5tpNsGyDPeH?t&AjRaG=k- z4|oFrn*>f9>Hz@)&8*)h`Cw~d0oatHObUnYTgJr^jG5^^Ss?!x9a=6sC&L9^(s0H3 zQDcK9C5?^o1KY2$djo-R;a(nUP1r!rdtTlIQq#B0tn{_?i)#BC=rR^fSD&Y(FWm z^C4GN_q8npm)6uk5yktT%a)*)=aKqlH@mA}BlQDh_tzu!jlF17?x4GZEKpd`Psi3z zB|rBCQ=*G#6rNcsJYy6!y;JFxeurB%3~&lV*rlaCPD9vh#c0sL2{bg-qBKd90j}&s z1HSvw2FcMBWM3bOOe)1}^leUB^n>{J*KPF8eMkxEFl0zAy-16Vr8i%({;K4#)M91i zF}_pj(SA2x`RP>?TM7+@h?nrone4bC#h!#XgX}n#vLeBh#0~sLGr}VC{NUeidcA+f z|65Vt`M09}^xqWqHfOp|*)8@y5z+%s-DJA)z2RP+mMsP}4D+A=;o%BzG^T8R@^E<@ z$N%l&BKX_GCGn4k>kCew+J}Qn13S;T=QK7RaH9XegIkmqb+Yo`MyQO}y86@Vz0FDe zKh^Y#l{UqG|H{K<82RsRvVVc8!#~~RnSXVYBmS$Ktm?Ex{>>2cb7I{StakE>)zCTO z1=)YXYC)(U`(>JT6MzVH)OG#Z*@J>-?hwBk?>+* znE#`Wj@8j0|DWU*7HD!y?$3Gj7il9va*Ns)e1}?1h06YmcRR=HPHRrG;h%d~3gz?-zq`fOchH`p+V?}Ixn>oI{i`clZzp>;y2%W6dG}BT!TGC z1ILnMYeXyy;pPH8;ztkVb36nJ3Mft_MHH;{HgmH=YuK8xYv2#eZGfb$10ZSZz;|>Q zW9}mf?15e3Tguodk3eK16W%tnAz$Y&Kl8DmU|m=)7?>;=ioMoYPGAUr|?B6^S8@e80FuE>vI}w0W3C>Imn~neV=NAC4HXUC9Sy}P10Z?WuNj~ z3bim=f3|Kny#4IZ`=L_eC5ck@xCS67pf@#{_s_-4Cj7AgD1$d4eLciH8%Im^Ou6ho zSIMhu$Z}q4+I4N|Dw&Q)a--K4!MoW9it|}yVLt(YX7A8YL^#}-tt%bc-T#_fWiGi< z_Zs$oqp8Jqb1%dG&&J-C3~OMmOS0ePW^v8#hbR%fWHQM^PC}S2QnSHPHn?{jFrXN2 z4F}lVq>%`A!{*m8*u-WXaFUmOcKj0Jel4DlyJxMnYB0WPZSUTOqpd#XDY!&DlCk1? z6Fw4=e8qkU-)6Af@|9^c;|Q{Q5ZJw6=tWcgL$ zMEqH{KasvSD%!+p3~f$>NtkiR3mE;pK#K>H2qDfR>j4GhH|P^m(xLM>>N3Iz#o>^8 zMv7f}H2M!4@>wR1AaP^iI{Jlv=J2bhiG0vC*h>pWjU6qWD3s=}OXUVHGTXBi=>cGYtD|18o+Q

_Z`n0Q~LEnEIfh_cu za=k*@NXJ}B5_7LLgfn!m08{##7II{L_bxU1F7@Y^$U?p|i%9O+a|OZ?V6CCQ<@C@D zn@A|q3|Q&P^zA5OGYd)eDdqRP%Ih%JbQxc`s*vqdDz|cgw- zIF;Q$UXTUCxAyyF_g6bJ>mJ9|JDc!YNuAk|Rg!Rp(kO&x#=xj7YKk@)N#p2#!_-AW zz;90{fPOfOn%26E@>v`eO(7pmQN0A?sVBX5hW)CqkLWuT618r;O9clbPTUMRNK=TV zN7pNVec(7E3|@c~^E4rUrL83_SX6n`DIg5KZ$JEp*X(#mSg|p6^LzdFW72~t(1L4- zPja9S>%!d~(61cV0(1VRUB+(vTZZ51DDtP}8EVz~EhrgvixOlOFp7blmXBks=#(?%%Hgk4Iq+t>~C zBL;_7^t7HHJnO#?VAOh2+M5Cu{u>D(H3kWsb|e-cL%EiQ@!QE0lmS!;FWM4ZCA^@nmq zUS1AhB8m&=gwe?05HOXL^FT{*$blJI>O#uV8hu{i)iy?}t>foEEdZh9o1VcW+0u;{ zDU1(5dyz68kl(L#E`5iXn+?0mA#?$_#&CgPlXkZSoK<(LPD#*h98Yqeq26<9vi=JrHb*c0y zh!XpWNH@_lQfK>hsU(7)-g7DmjUhkqp2y}1R!`u%suMgd(4XcSh{fit1KzX!UV9zK zX~cA$L-oCon=5{d!BQZ2YL-X#r8bc z%Gl&89~&q#F+4-xe6F4`Eo%sFZ?XiAfvDEOcgBYBXQXM0vE5v#3=+3OUY z=_6{Dt~+3(e;ySE%k#36dMxt}$$--iad5tu#$ki$6X>;AMIR5d>M!YS0_G+(4@hib z1&CoBXMNwQ-qbrc(oWy{5`b1IHCK9eQ8iVVv-N)_z4oNB>#dw;MQfTi>hpb}<+qK3 z1cWh-;!i8+ypdncXX~hWDm*38l;WR@ zt`-AI0V!dlsQa(^2%e9Y zGXgHk!}jO%IEN?rbIgP;@m7?|;>H@3J_F@vq2NSl&AJ`z_k(VmO>Fz4eniXol|pC> zXqz{<#jDe^0Kgz}0ca)4x$nlD;mnb!mxk9?o0KROQ<03e2D@X2ZYAOufD1-J?Ap3f zs(A)2m)w-*!jv<_4OGIU(d<4^<7`M4lq1V`MXcB^sX(lc%{AJ9F)~wtgAGFHr*(Rf zK59k?*mX{c6Sj~}?@M4#_hquFdJ3csAu9|yd1oB!B1dT!5V;(u5&(7I0QTFK*QTR5 zM|P*HO-ct;tI`vg#eB4)-Z)j#ta(a6{^;9{yy}wu+GBA|$h_}+5j4-dZ`W>*h1wZB zWjAp;+UF4bIS@b^J~TLDkU@fj&08)otuETKnlrtK_jr6V`(@hbnYh1ZGA*4u zT2_6{`odG9LP^N)xSGX!lL%<++Ms{{9c90D*${^M|Gk#$YnGR(Y}ui_Jl%TVVAe?R z`u27Q9N1d$v3)-&eTJ@J&>pN6=SMliR`5nz{$`S=UwAgIcl>v249}64{A^dr=2JeK zJHSeHJ_cB+n3>P<%SM=%oRsvy)6HcUL6zpoh>X9XlQzO4W6hkU(f3Zt>GCvc|C3y9g2r0fZ&43<#c%|{MmwT=^Shy^- z$C?gnw`7}KOCwx$yGsdS!n@Bs?a$T@-3krNHVDSGw{Q+5xe5zd2H0VUfIbx&-IGV^ zp0;fS`dC(=z?XlK1?)>1ESBU zoyVS{&vx=~IHiDulZz7g9Wb|2;$Soq z9Qg~J6Cs#yqQ9S`vpOQ8a1I1kJQpN+ErKGRBN>eu;bUh#nuwtWTn_x1M16Re^MI|+ z)xfe?|D%KB>sZ!W>GK9xl&h~(S!*Qt4eH-Ui;`v|*v*>R+yIHO%xKoY(~?pK3NU`& z{x_gKuNY9TPvQeV_IGScSs2+vGxGDkWtn_oDI*-BE$>FsQFHg(A zbSnM$@%jH`XkOgFc>)a0F-B|Hfld%g1_jD1PGk(~APgM4owH(=P|zi@Y{iQ@$kUk! zV;O`yDA~O|40QP?4U~@;X?!K%;dinWSdo~~ zIs?QNM)krZb3|{4pP?mD?NpK`v#VmhNLwlCm_)M;@dG-a;o{cq=Xr=pB;3TJ-w0Ke z4H65L_>2ABCDsS26kCNw-nI%4Oz?#g4tjJY$-fKs$a;sls4CV zTk{gzhmcgkuiOM9_3NCa?Nz&e)YT{aojze{Pg~ro5h9C@krr&*cJHodK1h+qaCowZ>R{X3awA6_>(TP~TWkB=k%^;)FGtrMwFC$n}G2i9G>ZopJG& zWBUT*iFL=MZHK4_k&jKMs4wYAB>!L#Jz=d0rFdnCA-<2dmUY)yw5bspV{Elnt;sFs zd47#vs5t%#p3*MU@!h+2c6j3voc&7Nnd%C}q|=3LLRI*M=>49hvNA`cfR;Pd6uwWy zfw^{FD=XOc>3%g9gdqmgDYJ2`q=Z^r`#)4S8IXM1gG5nQO=>JImtlWQq@<61YL}k@ zA1Wrr_H)NSuv6*3r$5tnQ@EU`sQ*-R(KH*T7?@Dpe;&^K4jE0QK$P@n2h0W%lY?Xd zGbyM)C@GJ9lfF-y86DV4fC~+z;o@Vhva?2ouR)Nxv)o?tXmc4C^O{io_y_No8&VW) zmAq9h`nNF>V;j?N!;&OYR*=a9d*M5T;87B0nQipkW(;BYmwV_HA$ie5nk$gv;Q&QB z;ZL&c7WGFKgp8*1^Pi-xAkgL<^xnJ%?u{_K%s7dsubKIzHay2zBCb*fh0+|!)pagE zOl=^tNHbs9TpRHuQa`pWye3(|9LywAOc@5g9BeIY3C4arN-c&NVlC{-z@C9U3=jM( z4ua3Wi6XM5i6CCaNiC8=@+tzP90LitW8>m}fv3IBrrT(eMiB7%=QPe#d2cr8GcFf} zT*8$A=NlIgPY450P|di37+9t0hZk2r`eMEY0GK>TDy+YH8|R5B>a_uKE3nqnYUhNz zL$8P*Y!C=eN_l;Ij2FK_`QS1-f^+MPbZem4%7X|rW94qa?_AGCDBpRW2dBKDdgUTI z@@*m!?IEFfNj`vyBs}E};ktzurfdL{P&$mprWHGDE&~&g`$F+)1`=}&->R6$AV5m- zY5wiIBxRR;Sf2@Sba3)%ay*Kezq}t0c1#gdm%iltxSm)&g+q@nt0lmXN>Q(K!pqh+ zqIJs4H8cX@BX$1dd1>8+^O|oJS0Z|UDuOK+=e>(fVwXp(;CO-jCqRhukK-J4NR9%x zA;V0i%va00ZfXOoMIlr4y`VoF&WE{^g|p$U_fSEGmA3f8f~C>FnEkDhPt1O&WUTl6 zSHHfx&YVUgV;B6OXAqhF&Zmo!XL}76eQLnsT=d=8|MmWAb?hnKA^HXZ;c zHJ>j~;W>*F0_mE+G1X+;#lm&iNO`6SFp_fF?X~&Vw{{ON#unezGzv_rBFfJ#`uzUA zbgX!T^@8dAQatf0Ex~p7bx$M)kii_17)tgvx&!@dlGS4UNA@{U%AfFu=FW9#iDXOH zL`Wq}}bl(w_6yQ81;nVHXwRqiR8 zD95!IyfM{ZYW`=duTuz0cMj^=;CWhb$AB#Z5Nd-|JAG(mbSS=R6#_m2A_4PtFz;{w z5p)EGAdL7x?CK+_L2;DkE@AFF>SM3;p27)qMdUAVZxBM2xbKqh?5J7WHg5kOFMp4U%!P98>R%-pu zFxk^=wJb*~DJgvyvO9aNAv>)_D?{_x zUH{$iA7zKUoMGZOeHPsHi?{0vn~dh%G|?!2r@-DW_Icm@DzRx=SQMhbMW39>QoX1l5Tl2>WlReva^%~t*F?5ees}|ycHR;K zFkY0Rcew_8dcp0Hphc#BuE+*cQ%+tTIZYqjsKzpDKp~bNgrLp<<+KrI$kG1oT^HJc zmJzxr7V3Sc7Uby9mv{-lB^VeF0|?;a&AGBGD-P+r_*kb*lKmJX>eh#@JZejbAB{u& zTuy+;1Qz<3bcDmlq9Tr~%DzNpP0g~)4dg&sai znS}0#{;6dm-t#2%ZAxSk!EGdDo8C4lG^58c=I%X-+4B~fzoRVKU#jfU1JbW~mFifWA5a1Z-8WcKl`P_oT*q=$spxN{$lJg;8 zxLaR;)YCK4W3*u=91|kFrL^7#VW?p7)qukoNC+_CYuYpOR-Ss(2&jNk+DH877SfgH zX0Q*mmTi)hhzA1nDvLZ0JAwgD8 zWZqu#Gu1SFLKC^OjC-`*Ni@P|FgP-YZV*i@?RvJiX%wqnluIMq>wt?pZ(2J(-s||t zHPlP!{_d+eWn|mar9s)x!enNjg%@tgO$_ndzKzIl%9)^V26~+iHrkU-T4Y00jgUW! z>!suDu@UWghQ({7uxRry6EBi zoh!aQ4j6ahJbSWXoK3P>JCG}W22F<*O*<6oXrd3?$&MXV87FVvG0v7Q4}x9i=uv2b z`Q;5XMlOuMTG5?o$LF$9bR{t@1$}M#M+5f_@T3ixe6eD&FXoILw8%N z%Wsrz;n(p1B>NTQ8}N`tp)YyAbm7Em1468`eROyiGUI^zJPph_8Qu!aSG^fl9Vl&V8VO7u<+ia?XeE3piH;wk`v-&{4=k3Fhg zyh3AzV!44o2%01e#)|U+Fv1dkxc=T7H3v>C40=quA(NC>l0r_jQ%{-JuX+bHv72W zSe!}_88wtUwhG-`uN0CY2zOax?TZJG&cgKc+-eQUKjY;WvMe%}J9B=NmH#B24#k@PdFUk{Ylw4y`(QQnv2NsVi&I7pe-lUT{Qm22 z{KFqw$n0tSKREAg*oyCIdw+y`ublE0Q_o20?e9)9zRWt7=^k%yGvn~`x4jKb@fTnf zs((kyl}Q6gx#7JlBAFs=UY7^2KW3%3^G)@uMDC3+-`!~M4X9p+VUZy}ZOVv2kF!q?C4-ASc3%_@@1e?s0m-3JTmtjN~B&1`N}icBr- z>PhUuXqTgfdh~4( zMm-UR?iF4;k3{T_SHA&IRb}4i2r=lC;cehKrW_!Mru-7Cou3ZX^|y;X@p62Ytfvm$1msWDvN15t0po$@3_joX_siybWkm{$p0S}r#-|esjIOJ zXlSY}+7z3&2nO88;XJadbF8lSQmt-ib4!0dH@Uk119-EdUoM|BU3J*g0kE8$Qv4rB zd`U_5qZmAjFEEYTbf>_bL{e}lxOeK*mQtkgyX1(N%Va|GV~O*!ceR?t&8d1TFdF0? z8dC(@A2q2evAy$BVY~yf+0UWYmq~<6Xmo=(ahWh&3s>-ZL@Z=L2N3TkA?D=qSO2*i z@D8NJ?7wo-6hC9xxyxc>0j=Yj%W4eccOI>e9)9~-_&sk9^7aCS+?GSs@Y}y% z#V7)twb)*e+d2f)x4oXi?*%wlM_a$lw79NcUQBeq7F_NIHcN`18P2eXxO^9(K^b9rzBt?q!x&cWKj813bgnR1JtjJ{2dMt9BJ*deXnCXHsGFFyl9 zL?uvezp-lsl*J@}mv@=*Jq=k=v_= z??Q+rdl{Lne%Xg+jV*bp#2kcJrNL+=tNE*jJZ)bGhYJ`^cjsm_JbmWj#=&$IIyD}H zlx*v(gLp5~8*0$T!qQ|S6SrPe&yp49pF1mVgXywwo}gkwu8^&gfJbbM6*4eaZUjKC zouJ9KmbqVsbqCjYC^JfEX(+e7g&Wixii>~nZ;0W(Ja;5cdaEjG8@q41{+g~a&8nrg zDq0JMr94T+OKYI0iIz&+FyS=OmnY$rG$mOt+cM#lM^_mAb-&7U9K2Gc@T3R}DKJ5H zXynW#fB1MENo1M>?JuZU^(y*rvFb6P0N8;80#Nt5Kq}<4M`XzDHA>i zG&urP9KYSC_k<74v`L2b1u`v)V5r(Y!?bkQIZnCRwi)RIdnCtZ0XcZb1I=mh{+I2X zSBdC=jT#@K=K{aD2PYMVEcO%mYK2l&(LBq?$)GrLL`B%nOfKVwaWQy;S|i-#tEWDE zUrD7Y`MUTSgpwUd_WTnDBzu}#ufv}S6dHg&bo$?85c$@Aa;p*vYeJV>BRS)s&j{C6 z-+kR{f5I`?%=2Tqt|G*7rS!nXt%?X-RQ6$68gp5CWGi_4=?IG8Rk6M%o5OznJ3fQ?Y!KKqk^?_H1?^MU`({8{~@qA{H)0# z8MBL`!L^xqp(}e2Nx%zoM@X{JB|ePQ;LOj(OzlZlx(?opI!bqxlprZ+)oW+T|mn*Pm!wPvmR!=dtF@?E(tsH@S_EX=EC z4G`U9Pr8P9qX+5nYsdF+@giQDS6aoU4^ihKBReYO5-}t+RbhK;WyGL*XY~IHSZe-y z;^Sg3JF8C}=Q9&*Q^z*LM&oHgb7{&c_YHZ!&-CaE$*vy-(>Y}30Cc{JF0IEe%{c-i zCaFQ_&C5HQ8H?xbwC91~9ccvTeJRC>;v$JPn&j}B=8Gc|Uo0Y!vMhS-))>^(0S|pD zqyj{#HAuY`XI*RG90qJ%JB zgtYNmP{W#hHkj3szn>NB&jK(;MH)KB0tNnwXNseI5ea=bA?>O21dxw70ai4}%9s!U z(YENdtn^+2qh>1-5#RwGuLImkFG6_V%fNC5Dxh!J7ZlGwrJUnUtF<6QiF~>sNqK?? zofzEq*Tft|pLqQ?p^vXOL+%#nT=9ur)`5HuBeo;p{lyVa27-qP2t9GJj$PsX<Q4HINmuET-3%+WCG&{ut-_5WsLkGSlIJ(hCxN1&m~a_dH?=JOb3cvwC4`Rm*6# zqeSQdzJQdpj`P>BO6%(e)wvC)D%xdLO-&xiv9%|(EKqn`M>HEZ^mkqG9SNul1{y6Y zpmjlck;Zr3f7J!oD{{MFMAqXA?=Al7ttVY+LvvJP(f%JY4R-5zLuH%4>w=VDf7Jy{ zdO%%J|1qe~?C-ij>0fmL0~Q}QP#3riHqz(*t1eJ7*@*4_&$>WRG|Y#W`v0v9X8xlt zkc8F+ng3Q7oS&k{*aFd)r&<)Ix>Rjpw%!K+fDqC@{2K^CcmD~5aQ>^^FoBB0Y@XC@ zcG3MJ$fyWzhE3E<<}c{BL+?S-tgdK|xKY!Gi<@QJX&nxU=k`*Q3yLYJ@q;+u_VlNx zKK!ndF@KNKrhR_5~v} zAVI82s@m(dqVLzww884eG<#(vzZF6~x7C5v2=2e4680hEK>hB3SsCFib5E;0Z<5+IijJ|d(tLCUiow}M@!l6CGE4_{{lga`6DoT0HouosTY~0_T`pmoH*+HztK~_ zxaaZh&l@${FfFN`q_)G2~rzFi6>4ifSR8l{M7O!yV{@At`1mTOqT^;REMI1%?@1)c0d712*=?p_t_e%y+c=;^Z!Hc0=b(iLNwQImUaZ+1(gkEIeVgczWq_RN_(&dWN-m=U6t2 zJmw;M^zP3Zd{(K%#eFVr2fBN(kn}Gk`zs!9fsXx|44q++hKO2Pp#zCPYRb)QG>{5| zG-Wj>QYXTK0lRZjO04Y)II`T*#|sM$C$9>9um4rvWc~)qn|-_8W&gAJLN%OOf*d<< zvzHiK11Lsg&!SH;^j*q&rjcEg8=*y+Ft$->Ry};d-p>SX4=iewVTPnV=Ren)? ziCVGynJJ+RA8oZnccVL8!11w&LwDx_^$xmrEi;*2iCG`5;L}w(|7zm(y%2XiCE|HTBcB46;=FcauJBI63M1 zo>ugG*WeHJIRPIoPdKqebpuLZUd+^GaI)GSTI5;-6sxpgAOkv~&^R{~o!yrU8(r7L zSjh1=uPZt}#ugK&8;lZu3~Io$Pmu;Edx6P;(`-5fkc)otW2vMn zEVX|6^KTP{=WC+TJpNyl`og~`ksxh`99J=O@J-1K*=TPvO%&Qmcr=|gysybf{yTqL zTl||+I%#tF&}vX}-zXnTCw4}%n2q)ik_ne;lM220lnd3D)Xnz;OE9;yU{4=%--pDcbe zTHQ9vC=Mrl!eA1bw~LJt78odS>FL6$Pp7CiSoZO*7z(ie6`Zxm9Bz+f$7`GkJC8nN zsc)SL4q<@)S}DM|IxYdW4|^OO`Gb=+#$Payv67rOhvIDO8q?tg{K2y4>B-#=b1NXL zVn%h7VP%HU9k>%v>HlflR1T~R-Vt%M#JvHa$%2Rz>P-)1^mWI zpmcs9Pf4bvjTNOXN5py zef1ut<>%j&mPF~98R4_BF}74t7FmXgZh@THCl1nozSif|NLwr)^4%#e1uWg_^@EBH zhEPv*V@YU(2{1^kd%0#3v_fD>d5{(pXxLBc8qq3ej;rU%#|Ae>v4g^}`9gAO*84Cf z(J^SOL9-?AF%!!D@0#QzeuO^uj zLj`%(e}VIO!rcq|xo3G_E2Nme`3-KtI#PrW4~@EUvFUoQ&6V(b;2S&flEExH-1R3I zqZP#C=o&2FP$DFtC}Tns=h^d6xu}1lCw4>Kb8IfgBhve0*Z_*byiy=*qObNzk%rui zFzO2L?Jo;WQs3&q0niVnl7OQ8+~F5;GyW)$BZ-dd1kKV600J}Nnp+1YkII3qBY5c6 zQG(>fkn}d94IGebSv7jskMgedbG#UIF$@%+Cs@DP7}zwxew;dr@N1)qk?8gJL?8~faLHz zE@iGQ`=H$*7nF#{Nb^{?&G5z-Na3UvKwLD@r|7)*Rb$0;2JKlBn)ql`Mox>5-0j>Wm77aveq$2hG4JhHk}>-CTJXY znGfaE)1f*S^bqzb$RSD#gL9rv3SxoAIS)wddIo+(*r0H}mdX5hTos!7?X}^LqMj8C z5hTvnQ*SU0e?U)iG}+~>DnCLQ06bTi z;dEr}shukzND{J9b1q}WUkMn$M+mmtS9+C!zd)lp+hzi55Op5`Co1}L<2|6}1Chri z=U#P4a9;HGvd2-c*`WH?G0pa#$CAjsOSe8W!IuB<-5A?n;iYK>ar!I{m$m-TZLF4A zIM@{X$A>uMihu!d7BP8xCvXKdc#s)swuBp0Eup}rXkuR&(w?ZAdf!A}$UjTgJxA@k z(l*d`RJg-Xe@4zOj8sv_ zg2q%^`}{kdf7p~3OYN0vjagMlcb6wSV?&`09jnRs8)?Qeme-MlS4Gc%;0o3LdKn~F zS_>QnmzVMA|r z&U0o5m3s*#|1J0O$x1lC3i*#-TsTF_Q!g&n9Xr}}-NIwt;`3r(@EOu40m}WYFv?E? zzaUL{4J$}n7=n&%UhupG*NGhwafToBu9O+9egbwAY zH*oZd%4>QpI16h=2v%elQS((Tmd7NTP8()LQfL;eT7Bk8`!kq*^1!#SVlT){6nLL5 zEE?Tb+`aRyK!X(#Fy2zoRC^J)nBLu4O0@+=lBqP7f2z3jxgCT8%}=FBzhl`5W@GOa zuJ91n21m-i)iD=+VdIVuAiQt&NA~tqeaQZs4IxNk9_&SG_9}b)<-GO)GYsg(E{zPn0BsxPwbB@eVu3`u`;WjxyX3M7h)9f=SrK631HtNC8`k7DIY1`A}s+VULNzyKcH z4*>U~`p|vWi$u}(Rjo5)$VrB3@7H(4li_*Fx>qHj%x4NEX?MqkH3?B(2|-c0`TaPf z9-sJLR32{5m@92z2slyd3U3}qfE1D_$f*I^LSBD&q1A!as zE#F^dRPty=+V^)BGH})Y>MR6(JK^e!?tO)oL>u(`w68V=ZJ;(K8vE72=&KZ8p3zs7 zDZgFRQLQ=1SP61#(Z5-Iu1T>;=C$UCmwHzZ$^*`9&`IUivMc*pb1Vb!fZsedDS%KK zKVJ5omsKhe&j2eyd@shnoJoB|mYzQ2V6~!2y`odoXzW_39BL5J$3m$%q0(0uDPK( zUsbVPVE)GTHBOW`-e6;%4jzX&@MM@7Vs6&AixNs24oGiS9w(o^TAEEK^0|~LFZqtt z*8DwQiOL7)1?E#SD4|?n>y_w9>I}&5jyc=dc9)#167QtppzRn@nI{aQwTlX*_0Ta} z&RzjsRzeg@MCX`k?@q680&CSl0!Sgr0G}PpAG>E)hCI5W#?krfBW?@6L%6bHsurQI!{|$=mn%v>HsNb z3?)h(xA`|J0a9>&(q;=Xepa^BSf834Q-=z(uu%DSA$ULv`Wj8Qp!|uX`-r@41i80Bb$s~hf`W~sqAlpw4QjJA;sl6mJWfMH;8g z&r2nkf#HG(4iNS?7LxO&yIK=F%)29Q_n846aiiZ=r9=?tZnlcvzSfOX85@N^R4sY^ zHM2ODm%GS?1`hz-6G8#^=sdl*bD(xn7z9`;1JKgJOh$h08__E+#XuG7f7{9*ln|@(C@>12 zCjf(4b=f)CP#o!+`axp1&*gdfO;-YWg`MoQb(%LIi$cO!Bkpe_9OqKkP7Y;8`>5&p zA-S6#V6jX`w$K(qYVn_oI)r4 zfEM(!bl%CSrg({uWJpp5ousNCmShc9M5zXhER0rz->QfWYd=$60Qac))4!K|KrS6N zy*RZs4T2KvQyxH5+17xqO;jMy*n*5PIzmHW8#{V{CWahac8_amFuf|<&*{&?f~J6r-O`&lW%e(V+P7}t7#?i zC1dVTqVu+m;t<2rzhQ} z=~XaE{nwnHc)*;bZJEHF-g6uhNv4M7so5yO(z9uYE7;FMze6el zRPtg43!PXHFfW|9uL5K~_zH#u=g|q8?z*H-vD}KyY5D;5thTdZ3ISxx5&Js|qVT+}{n7H|g#J zKDcgL@VzV2PCJMK_`KasuaVywu@xVi-mcp||A)`J8}Tqp7oDtd(J(7;_Ww4lH=Y{S zw(*9j&z)F^p07>6A21tY?N1%4t^Q&^nzgRnj?epd%AqJDkaBqE);g?P6+RxVy7;@1 z{_Gi=^<$;)>00kHM8QShtFD$_QMw$o6S(K?!fG!*-pGL)zcPr9i8;Lgci5rup;&8J zYSYT|4ZFL8#%>Y4w@uyG(45}<5pX@w2qn)nE@S`Rfb&OTN=&_$uk>NWaYE?9!{DLY zJu36rubyt@hF^1Nrv-0g=iL0DJ?c3{2D3SpiFwv^jG;_3enTW=XvN3gVw z;_eQ?3GNWw-CZ{BPH=Y%?(XjH9^Bm_I0SchyF2GS?|1K7-~BUd_Uf6QncmgaRn=9` zBj@^jayRq_$o;BzCA9v`1Z{};XjcJKe-E1dm*84FiiRsIKGA+T1liB7Vyf*YzU zr#99GmtUQR$&9%4!`Thh&Ruhcoe^G7uNLO52pcQH|MC?g{giQL82vQC;gf*pQ6eb_$Dwl={v{1 z(p6ZBxs~{D%vR-ljV(7+wEh0!E7;8V0Pz)yFR39kvEe4hjEO8L0mSV^bjZIIv)dCY63~3-=Lcdf z@Xa%BI<~g*(Aaem{4dr*{6DOP#kO@EwX~CeSPS><*zQnRR^dL@U1ZpG0WN!^kWW-i zGUq&weSGXJ7id{+O!j{RTf*0p6oBQ3*fjXkSBL=4-o21(zkisx2<2$-t4EY%i8P?^ zQN4E3R;|c8wC|+CaEA)`nf=)0${`#M(L6nMEPxqihE2 zhsq*t>X@-ernyQ@dP+y@b@fQ}K*D4+YUAJei&fz2kO?rbD&QMZf|Zd3M|+P-fNOwh~up-+bz^1uFVN!-Xcvbg7I( zSOPe?J@ok>3NnAu zA_rG>F0QH*@bRgT;53Yqgv0D9*z4=(GTUa~jrM@K7W(`D0V8s~*_~SVvn(~#W2_yb z!0aTnF;NRnH9vY~!us(l2i8=}Ne_<_VD*5L?_*J;KKxy)sNz1wGwP#ys5`1K+X=-ByyfHv5mG z!V>czE?F4Gu51;$I{!fuvm6waQ`$V(mRSQREcBHzEU{jBP5SB_#Bb;Kfkh;G2oUDy z&YafNmyjr~YyX1_Rksk%sg=b44Nn60rg!d>Yt2Sfz5{S)138|07*B(~orV{}pdnuo z(pRlCAZcV)izg1d>7UqIskH6_{@lC71oj_Rj(@>OSf?zxG{pg&2t0AL!lQXrlJgS0 zkWr)w`|-%AB+Xq-4Lu-J9^Jnr|7Z>%2ib?{e>liEt#A~s9-=id3x_l>NkkgIi}0-E zuq`s@#oX*n4aJ-wFEV4)jN!Q;Ah{rv83RSZ1p$`}w#?Z19VRaZ)FtYJIln~>2oyIw z^PTV%hbB1gpLtI}cAX6vk<>Jc=N3oFllv3RzDsvEOHnmT@!l_Bmut_nJxdwIZ`h1K zDwWBvY>?Q_meo_$^ULBQBsB zc%86}LoWT$1Z1v!h9`SLz{g6YZA3nt5y$kV-S!_FTi_7pQ|sdRc;8#3z7${Y(| z+z5;u%>Xn{IA32t1E;dh;3lsVymU>LpifdS(EshlyWQ6|#fLuSx5)#s^nSqK?zvzB z%Ez|KDF>s47G?T5WV2Caux?dD+hXcaonA<`?1 zi8zAB@N5dCKpb;5h^c_w=PK#a?MyL3cTaEJ^M+1ZG(U+9S#{MNEhJPDt0DDx-F=zs7&0&1_C;`>W9J?!)^favbmd!~IG3%A^p#lR|Af;F z3z7pzVwbA<_$DsD?IcIgn(lh_{xI{DyZwIi`9K>m@luhK&SGz7s^*!a8*gS&-mnCE z5k)W?O0h7${lW>dLMKPOyEe8m*(S&E$zpYL4zOiYjyn-ch$MN4Vqp21vnX}3Ahluzn)HfP2SyXkI#-gX zLGabB$}>YK#nQCfDqH%HalaKKR87?t3!;&OSuK0CFdFUO&hy+Qx7DZ8{Z3xHH)DmO z4`x_!0Q1|P)j7=DUTKp6gVS`R-qPM1uJnB@<0KeYQy4$isLnU|{Xe(&&4Mw8SYEEN zEc$MZ8Z~W@4W@Z&xm{||7E1~n6|n#QdN#4jklg)nV)Tc^_ve$TPVC%I<~5~+sH}|W zjuMWp;XjGrsb8V=i~q z{z5duqVLzkMaPKa)H;>4sWddeYm+Uh?@iF&E7aBgjyewtm-@H49*1L{mR zGtdQGUP+2i6f-jh@f*^VMQIq~2#vAa7ut^C67&51@sYnTdcOWIJc!q9k{G$mNvj5I zgBr>LS-~z6syuPQRHg;v9QZ@IAdi$tFyLOu%&iU+^5ogrZ|4D9WUUB|vvX`aPmFuP zzHmjRkldaSj3z{6VCB_Yt%omm!`6$B@1RK6QaH-YqhVVu*$o&G5X|8f{Ynewrshb3 zH%T}f<^~_E(FZa7C=C<{H1R;Wg-kN|#w_qRU;0Ef47(p)U*c~t2Jj|NG{#cPq-sdI zpRNc$_%8F)jz!y!)*v<(V!dhz0=;&&h%a>`|85}wIF;m`X*MEd?G;2W#Snn}s-BKl z2@7SOHoQ;VP#J_zif>M&8+SVJ|L)BB7T~p`xBWuM$bL_w%N~paIr;kfE0YkM3x^XG zYM33Tj0D^m2`Vt)qftABbo$CAl9lgtC~xaW+0h$PSt-$jw*Wuc1H#E7tAx^wB8aEb zgYL33`8V%xIh30BB);TErz>P>o-p{wjyWYuV(K=xPH(qNop;%Azu%>LtuJK8%F?nS z@AHJ!?w)&Y&c3D-6OgZQu$4Y{pXiRp#B{g!#QSaaQFhpT1w8pmV7(JXlm7H*DD^N$ zn=1;KEj2kr)$v{z`l<3a_%t`a$07hM*k1iL|5nU3=Cd6uXpw}M34QHYceccxy8VqL zS0{*#r7`uZ&484ny*BAOBj*oe`a1>aarsmwHu;FQy)=N9( zFu5!CNlx`q+|*9>k)I|IPW7>-%rw8DH7`71ExAhqX;9V&%81PEpcrY84q!Klg;%h98YsO2RuJ$&XRLX;pZ}??Gq55h{39@v(W+{Jh7l zBi|!^(cV)No9(2>!wMG+s*}i$;V))vV$;jX&B5kJ@v*k&2mA1u?Tc#ZrK(G%{)QY% zR6y)c?5cyEUK}xpF2OzSiw{ZC*NYE#vNbu)E98}+a)1;+#o*aJsnnT+bB0;1?>EBIlQ**31E=78 z`KLWl0a*ZuK==OGkQkfex~|-tHn#jmuDmxx>u#Qze%C|Csry-g-KTQ&R>S+g=;3o* z1MGFWX{HdY>ZUp2rWrwr(7Qgu8@3TI*`YpSrG6$8soy9<(c5|9*8yTycvgn{mTgZg z=yP~_lnqoodB$e88S@?%DfgtG{C4+%-*LBU$HYN#cv0+~PoIqSIgT zFR$@c3jw8gAGCUPysKfTt>}9m`onPQGpY%$!4ZEGBt(4@6 zbO!XPx65z?T_wfMgAdroaHZOY&H7KxI1E7kw<*i*#n^X4#APeoKK2c@t(5Eu%uap7 zsgFkNSbDzz0Nzayu};Y#|wX`$(M_uBfE4v z89^OnzT8&dM8QzPG@f9WRGcZHZZUj4nh`946(oVh+aM1SAfXO89UwakAwuG9*olA0 zlbapQ43|(J1N`=Mt{cVsvB~A}lru~csjxvp%M=xMydM{QdXzX?1cUIm@0)0+Y{Y5( z%iS&1O}rEdabm$FJFIquJ@g5l<%S*>fH8EIS+LtOZsx}hY5~cMtWl6R@iy`8kY=|o z{J#E*`$8cxC?utDA4m*|2o)7>;Nl!~UUe47CsQ4zegnAm8cp9n}td2K#@F}o!rf*A7IaNvbF2#aw6yddCxy+R08 zUvzN)>DHGjjT`lqD+l!TL_%Ps5Xe%&5$4OaT~#BtTdTtK@C={QVa>Zi&|3M%krRuW3|;C^wEECo+frJUZW_}P+To+j&zjD4 zD=MiFI+|-YRI7`GoBgc!QK#v15hgCYF+7;Lphggz`o7TO`}azK*X!nXA`|%vQt>Qa z&g$W=wi8Psw)vT`sKZ=aa3R7~)6V!eG^+S-%{+Z=m!nHJX(7S2bqbLMtQAb6Odq7< zq~<>w3Y*kK0-c>_z8rO^e8+O@a@i$|jU0Skolh$VT?0QLQFm@PDgT!3&WcQqaN}^g z#c{bHWcirI&#uh%ws%b#Uacd5AH_pW8;8j2?w?X4W=S9m8SHG(kBTB@Z3D9+U#|); zG7GCX&%CFwUb8$vb3URc=ah2&G z=6#d6qmhjsUnG63x%;W@NaCBIOBOAS$2;vKC3Ocn%Yk_B(T#Y263RbwBuF&7g6(r6 zE=v+%>rfKP2X`(9?#1um-}U(?ahx}Iu+c~lWFJ;=i~DUjHM6Qcq5jVqp|$5Rd_Z@2 zUTlY;zTbV<*WHD-!!sFpjsvnd$8Rh;rOkc7$iJ^&<`2 zlO(N_=uUV$eMJcBBOO3-(hN89++wNKMX`gS-zs=ok39XQu={?+UE(_ZWw@_eh^Fmu z^fhV^xfcEQoe4oK>nrGv>kFCzbziQ$`R=P`XyC;!@9xW<_`)vHct!=*?K2kPUl)7t zeqsQ9kM5rv$PuO;hDPUKULlz3;JpOx67D5R$fAx>S>NW97ey_?Bi>0y^N77Nzvu5x2`@_vh zg)bc4`rxRnu;>n?kI1G)Rs=G^cr2kvE(M*UVi{x1<_SN$`3=)##r%Gc0BjA_0jax7 z_CkBY66{TAqdmYiGfL)zplo`-hXA9_OoykQSiM(C15R4G9^X~g8v|8-D4J)i>$Xk= znx}N?>{%A5vmd;soH)G6Iemyl__mJ_`o=KMUICKpv%PuTe7V`7sH3!66A3sjn5kX!EM{ zL#Y<_2*=wLg1ty+zFCg(l_;5#1@?=>IWSHZoO$xt@V<43XApiVPWa%xlZ8b0i{stK z;vmh10@KK)T|REl3W_S#ZVR`xFcddy0l!c3Q64r+1N&i?VwyxrI39%Z{XYc0t@{~C zx(_8r%78BP0w;z9f0A1+%u85ggamg&tow4+sCl5b(I~)VUCkjqdC2|Q1&NLCGr!|a z^%=YHF+S#<712xmUF2^m)u&AYFSQtIombrnGfMLoWxwEp1pRkAw^ zwwgss1uMMR8sBxGkMSH@afQB{D~9u2O7cawuoUXYeqE|VI@$1v{HwUnIf9)Jp#b4s zl}VD!Kv4oAWUDGgn1C)gB7esWckaRc-35-7>(YY?QULXG6$|?5$9|5@n`8j!)2kDs z0vYrE8IFbLIhnz>=${dzIt7VGu>k(_yZZa`>G>nf(#&OPt-+Jfn);GZL3EfbD6s7K zm>t19d(39Zb zn%ayIK4?(tzhF!v4JQ99xH~w(pSxkU)o2n5NGfSvaIj)pzpEoCv@xAuG9r)!l?C^O zBMojf)-&3xgYteh)AL}a*_9nMZ0>-ubBk91PMHFn66QH@n=Lx z8V5d^OC>}Xk+Psr; zaUAPV=;KdXhb`4VZ>o^O}o-m^}Lzear z!Zbs=n2>VxiZVIipx=pJTUqA*6Q&9TpfHt0(gfi(%-+Ljz+lCg=9ewa>;0!&!YnvM z<3+;7xR4aXz>vIM4Lmp<`ipO>d=!Ll3-Kcf|9sczd!X-H8`OVpvU{Kqp%-Z=Ek1N! zRR&FNEmr$AT>I7OIY{|BKO=1_debI4)q?$zbHLj!Sy|aO*R+m}M76#plMlvlAcuEz z#etVD4!bvWHz!i1JL^SO1^PfwFO8oWfAqn_qN{7Nw9uu4j4Q0+OLy9`74^d|1Z;_M zsIPY63+f7Y^s%<&Fr&uw7Z#7BE_A2zTk_Urn|p+`k-vSDId)X3(g^KI?1)WUnNEe-{r02P9tR8ff?!C&;iOrN@X<%b!&$|#?YtoI#b zGftN%EQ-pa--J#g8I%h#r~-!G#-Jt%v)%wJX-d;nn)>(Qvfx1axUWj(SoboCrM#^#yt`I&9%r-&Ow zgE|+IOgD@~LdT}Vz1*IWH&=vv78@Q7Fq{0iY}OrY*1z9-^wdiA=&GtjWJ1n@@_D+! z`as{8$cZ5wdsQjKPSgqptc33aIFY=ie@xce<3A_ekJc&{v?;i#%_C-usj|AS?Z56- zr6$RT1=gta5rkrnfozPK60D4d4vLcSB*U$$`JpHd)QBXFF*6E&EQd4AJQ#2me7n<8 zAZtZk2f14`{1u+xMZ|3wX+&M0P8iD9H{(1q{ad_Zsry{$y=%eL#s5Ea>Y!IBm7@BD1!QRzLO&LX;0)ODe0 zg9qP{7ujHj2LeHP&Rjz5TzZDIiJUBk?=aL++m{kuf{j33`geA>y)oyw3LHZ7EQ)8t zofn|gEugq=fS!YNZq=bPwZ1VAv=c<+%0svPJzx1fDna$6%o(@jQ*n57XLq&F|m1lOtX%VmEsBA99??nM z@*9R_SN@cm)EOedQTV*41ag+E&{cHiD?kGAzdEp!zH0*i3>nuJb|U4nzLS3+sP=Lm zYduc?SM5nC$DhKtN%?X@Ix`#j{l99j`@d>$+`Y-`Wrd*}ab$HRSdX-O!r@iaxVv|3 z0)4i^xaqX9)ha^W2jZIubduC&|5r-U+-&;d0NIZL^S%GkeFeQi!~jg=$`{kVJLbd} zlEQar6`7m`CQb5#hqQ0=yy>pucQ*@}ZjAgN#(y5Z4~_6@a^Uux?Ef}hbosfkufN_c zXCj&6@FcrOV$5tT>FUsfuxH3oW~^Qxwz#9jIyiUIM_@jxi&uHPN;8c<{mN^2+`*|( zcJI-T1XL^ll7CV1p?F}FJj;C0L;T-iI0(KB;Rx3u=f*IT={ahem7zzCY{heo2>M$n z;ZI&4c;xrp*@@WoBAIY<;nGjqT|g(}b@i)5tZ?|&40=;)>s1WS-lK({-(Krx_=-So z$2Xq?=`z)ec2MyRFGCZ5(RlOk&y{m0H;)OWD)UV&U%0`cTRh@1FqAcW5{7npzzQB!B};TbdHcf0b9 z?)t}MV2s!wv(B>BFQv4-ek1=b)g&6NDlf$Nt@CRvxUshSF&4w&Ffx3Qz1uhp)}x5gs1@>z<^F@n^{&lLmxijTMnk__n&o`8YN7h z?@o;jgRs-wO~H_4HFb(_mw*u|rTxcrdt?o1E^h*3EJg0(=SG?C5@fO~z4fWIy_{8p zH(O$&R?RnR?VI)J+9d_4@$3eKbsQHX!?$MluR-BR<{1ZsyO%MsjNYhC$wh!!>KM)I zqW4vg^NWey`_yL|<#qyQ&yL%A!^PE`avIO}ryk@KP1q|vRzTWi?vf@Y7%<) zPR_;0jIZa|AwLA3_-kT~PO_($1HW$Hr-JPq5&WUeST+J5gwUF&6>Pih2>EWV^bxKf zevLBQyiMjz7S$irsqUQ&C(Blb0-Fh!tEu*x=HcWU3^HxH06S=51_}jOt_gbtuDD8m zu30$8LlfesgCRRR{U@U=Q>MFe+^3g^^%ce*i;(ucE+@~l#wf4u=2zpIRV6J|4$|=o z&K+R9zcDAtZLs0{jqOjo(RL5>nRK^b-18o8J3e+>e!d@;y>H##o_8ZewE`zl8rEk1 zY!Q4VN^SMo$~ybYFw@D`!HqcpTYDdAQ(=%07t&)CI4-^(#ZNX!Ugd5guz;d;8 zu`SM1EbrCWwqUp&9}Gc{SM>hMgo_4DD30|+oh*ufM#s6#6-$XwZna7RP*^i?Zm?kCC~A0VMUDwsp!+yuh3GTW%xuuiZ zS*C@(j`METh)s#Qb6rm&vPIc14qnUz9>tc}ta~vcatq%wnRWTLe!Z;_IX@XR{A_lE zovF2Eb((PB@)Fva{hid{CX^06~BH5czcXQ`O-%TjG?hoNNNq+(Nllug4o` zUatF54u3I+v{YxZxxzji%FttZsx2@>dJ z@rCmHJm1-$s+KPA&or{B6=DS5EPUQ1@+CPhWsd#KOf1)P;%JQ;7wp2>z=$NpR>tYzuk|P#wGo9-7RqUM|JRF) z&~2!enpUE%ubcB8J@40xskeclt;4y|($LjJ02%rY7iKFS(3nRYn$? z3JVQ~s|Cwa7}f4hb)eR8{VNz-T^y3}2coyTx9RQVEqvT< zDQUjW(Dis!E}Ugcc|OUv&hR*O|83eCU}$6D{>`Uh^{m>t%~$zx#b=#)rN+MVXLUnG z-vfY?x58tma8KxQ*VegI$<(Jn!UuePNSKli|LS(9Qt=dz-97fv>+S% z%<<;-k;b>93L38Q>aGx#KN+C;$+l13sq>SeHuBfp(qA=UM#qls8y^cluQXvlt%I1M zYPDMWC;7KjaHdL*j22V31+JEHIKu4XwHve<&d=S7wkNWs&|;$Dm$y*PnkA3EuU10@#M{_U zA(J5Pm0`YU4%useHydA5Fr?Zl zy3uj-;3Y01J0{^m|AyD4X)+%?L=ztksJy#K-MOd(AZXWeVQ?VDrOX#=cxH_^L8B6e zs3a%~b(o~l3S~3nId@dK3uT$$q7tUdblvRxsDP)+!AkNL%>4&5g>?TKX3AQ43y$^B)9dWPhgn{gjy=js76-O!#{~ml6k?ceCb@$fjSN@@%Yf(9xhASU&SVs zDaHlXUV1qqmoia>pOZXXWur7-0XA`>+*7!@YExQ}CQh2a+%>x&x?D9&2{q0Nh|o95 zy5X8mmLgn1tJNSgSuRME%wCouZ%A~8LA*qFqzWoY9eJ7^ObJqX7*rGp;Ph=N;p9A7Pk2efgh%rIKPcPQIQ0Od@8uVQFpz{>60^Fw5-E- zYqQoL)1WwzKx~0A%J>7UE}>ZpbNm-3cvVsLTYCuh+JkqBws|mSp;-Ih395d zrsDnz{ROgjV?MC7gy3=w(h_0tw1i*fy-vKB!6mA)HXKXn5zil~{&d7L{0**M10W3; zqUuzvg{0pFQ@)#ckeCi4X2@Gk2rg%oEG=3knpat&q!|SO#;+?b@c0Fm*?KEARgf>jpId)c{GM0mcl>Iw;BmFux`EyNoR)83jV>l@C?wt{9ATK)JKY=;bFR z|KQQ)Aa#(Hg>+wf7s!JvQ|_H?Il+X2uD}pg+Xqo=lr=47FBVs=bsH2#t5{At(ClMw z2dl@JFtOta^{aC7*J#Yr$*)NMVHDiG`~15bwVpa$<7@4<0HU^+cF29nIXaB!3~y(N z&Lh~7Wd1!3jP*y>pVYC+tVWZ80lGIhvj9yiT$bj|0jS2_Dv3$q0~F24f}FGGqV)aY z6kannwAdq(Z@mQOhsiPY-s(ZsTD6?e>qesfT%icv=~9;B_z)fiq)X6>7bRdd)!vH z8Dj}TDpJRdZau<6DVD>~kfN(n2$I99y5cL6!DKx29KYvva5+IL2dJLLS*=jN8)t(R zWssNC#YwAEX z51_dnPadPiz)BgSoqf%)dB``$~Bih{o>$?5)>+QORr;H;Nqmw z%8h6eRjFpFrha92u$u=cxsBgt)Jb@#H=h^$(?x=yif|e=96o(VBd=f}(k zu<@=b5uGW!ad?UW4(fusw?B$y^csrxtx@29Des`DE#M-!Ry!F&2BR<;7qKPnN4G-jiv?$i05nE^8FeU(R$|&XtM%Ee|SKtsHE+Yw0zwoY@ zZq+Y zK^!CER06bB%e=Kz$te?Q#$6_0}9KJqS=bx zaD5c%_@SN_*0d3Ba2U1`^d5Y%@}lfgBc=US7fo=FUme++a}~(V5>88^OUO)4cS9^zGGJyZ1OgvL?L6T-l9Zp})1Hk{2pjNeoBzfMhL)x;&3qM&8 zLYoY?-1-p+s-9*{G9{cWM`y%5V==82d^BaCPid)A0w;yFlZdCSZUd-`b%DILOp(H( zc>W%#5OczOnW_9@5~#3~=*`cj+qbua{tUriuKYOgofj#qM8)&yKm}{b1--EBl{H2+ zK+Osh#Ih5TZ<)Tgf{U>HFO~**q#8R($i>=t9o!vFoiwO=^JYItB{1Pq8dZH2HQK21 zMg{q!v4Li@?yq%&mZ3RN&VDI&PVW$%ArLRp0X`Mwm9X*=@OWzaGMy}@M4wi$_yHG>Pv?C?PL9S1cqxdeO#T|U4k{Ue4BH^yi z%Vsh@AIZC3g31XgPn{?|=L-9!kqT0JI9g5xQfl&|1VQ5Vvr=>2;3!+X+TFP?RgQb8 zMwpLLbBY$o39sB6UvPp;!2^6dTFq~2%5p%Vw+t4@>TUgK>s#`eP_=1TJE=trqd!yu zNkVfG$mpIu#K~t#wz{J(PshOUPiUq;P$}$3;1S4k%n&tH$Cxk@shwX-!{Ry>OeWP< zwE_A?n2w7?KAhkcCduz?#%Qnd+4m#otc5hu4KDCBf^c!lMe}y+L_kXdG%ka@h*VHo zJw0}`rkkmn-Xfh0S-CQb&mD9SxTuv~&$%MKX&iyno1n^^VqwyFOR|;{GvDy_kSu%1 zS;ButmrfKYL*u_eR$w@lTX+TgQ~`iXB=2M7D`A7;f#0#A}E0zLsNT3x4`ER;@ zD^hk4789)CN{H}q*l{w;%~eIruCYLp4^WYIuv#HU0NQRWtZ3RIh4a1u zO65XFz19t!1n?k>_#X?#ME(h8QmBqbZI>^gOIXhqOpyEm3N-FYKXm&baxwN*&I`Lo z=+4N+ksf@s`yoyvYPxT|(}AH5Y>h+kVhrlUKdvy71$C28?pVPr;a$|tUqeAeC^vxz zW6YbYU2g5vcc#%Kly$-!OgUEtOWNWyx%G7Pl{t?S1D(Eir{xkv96cB_!Pk%Q)t8TQ z&t^jnJ|z--a*tpuaN$$9@VRcj%XHc{E0#B}Zy_b9vD^Z8oiJ|w?u^oQK9ciPhTgKj zPO+*ibKZAq6O0-Ql4ZYy#Yyr!=sI^y@0>PQf3k-C49KpwTEoWXz51FWil$T7B!~K9 zz4m+iSc>d!jd}8UeS&e&O6RO2c{A_f>}_t- zhR$<~tClSzzP1E?YgWA0<&@GmJcEnHrO>oml9LtF=!=4*E&aVV2M2aYE3FmrCV z!dC2JmDTR;WC82Zs@ROmhZ@XijsZ<3sc7Wc!t=>V&J(|iuHv27m+W6QTAX$GDG71Q zPo~d*ba8Ku4$-d?e=@dcL9mY=k+YRYklpGU8aAh%Odoi6vo|KKII z;?OQMo<^Udw`QK~R#6{|oW#UNVgsm5`INngE^bi1hQA0N<-FA70koz~Pu&p+0Lmi- z@U-+QV;atK3M0)}K@fY(TKG<8M$&OKh8{ z{IG;ohD~2QeRAQGB%p|v`h*bb7+ng`gcWjd%q8e%xXGeA-)4BIbfTyOJ>PT%%6O3jK^Y27fVvZUqhT01Muqo)1(Tu{cwt=eIY zu#I))QL<%5#zJH(IqAt?aO(+SQ@5aaCNgChB!F#M!L3B(iF6m++oQhN<2y46#V?hP zg83Nw#oS^(4V-`w`4hr;3uHkk9{1=f1Wt`K`!fXYHTv|Mfk zAIO{oa&yOd{Q+Z^K}dzX=GdKS7A0>ow??R2M?rs#G7h>_OgX0VgbU7!=;N!RVb8v$ zwCO3g_u|sx0}S|Mc+qfNupKIa&*D_P_-PG~wx+&Hih1y2GR|{(CG|P}Vdopvxouv4 zU1vbZh}>o(I|HSS!C@!LT`fJM$#Nb1Zh1{vl|mJ#+QpWGHN?wWd;DVOg-e2`i3w!gbs&246ut;gOkbeuENACA zhNl+e)-gI}xwQ@0|2&rJMM&JVYFg^^{D45oL``$bnv`(n(q$F-!=XvQpB{?JWLdS) zla7oE`5j31c;iych_I5A7>J4ULT4Y%SvwYbg9Hm>V<n^E|cz_aLw_UUCr5bQu_F zB{8ruEqwC?!!U$Ojh^KY^897iA5^Kfkj-h50LPohzyKg7|EjpG_Dwa^}+&r16amYlVcWPzDEuq^v zhOht*7~sY|>}MG!WXs4503?}z8=GLbRsg8XQ0ja$wl#L1q2w+p&gCxlVhM1twbFxU zkehg{nroPBUtDy4E(OZWr2oPte2?C)amvJ?ntY+ur8DOjE@`fr9w~Y~j6Pi8isJ?Y;X`BW zw6dTyEAd+3)%Y!=wjr)2g`B>79K)Hj@ZZqqD@e?;RpHsh66Vj??!G6~vh(VPtaGOP zJVN`|g_@hv)n9Y9R;-ZHP1myRl=fwYj}0JP&^>S$$}>ZnjuEd9Q&*1u$v(+qJKYa4 znYYea)o}#RI^TL)X{@-ErXN#Ri4QsN$m@Os@yESANlS|PXLURlLkt^_*bHmA5fYg* z+t3Cj${im(eN3TYIK0dummkYU?-2e;7Edce>T6t&EPW_+M}`)mfkC$&t*UJJxD$5x z@(e^5o_eefi`yuEGOrBd?axecG)w}lV=EeNm$(fUVA^4Uv2CPz?1T;TVT-dK9}`Xc zu@1zY6WbF0L4Ik%qERdS(V9&#-sfnrlbbESPNiMt#bF>tIZ(7;fNRh+Lew-REB8vB zVEn>_rCDxPVmp0X)d|HB_R_OXLDs;njuMvy?3|AWeM_aGUgSX<_iIbrAOR~saFJ!@ z5IXYEo(@!R6>)VrhWR|QlJ@$wC;BFSYNXRVligrpb&|=$Z$6h@*%Z2drnO?qP(FaH zD`$8lsh=gw&{4UE7u8PuIQlM@I;r*tuoRa)q2hwX>MW+l_p3r-chEw&b!5e{?y>`? z3VGrFFU$J(_`!PaP;1dcmBJCCw_W5XFq-&yQ{H!$le{;qdXemW@l>LfMOmJy7Iz2jq$H!|V?Gq&Iq z891`T$I>*OCT)uMd=a);+(k9}FuJz$69#tJGdNtrPlqiW8MbMn^q~a6KgzaG*ey3D zGbJRFzU1WOxcyjztW`7`SK8x-O|#mBp|uxXS4l`BWJ2^7D=7HvxOD@KE-PLw^1Yo4 z)a3toVUjFjz-L-TbVMt?cB_bYSLgRcURZ0M_J2!n;p9--wl5!}w-*Dbj1h2l$_}g+ z7sM78Qg>Xf?j>!snw9NO6ci~x;7=c0owi3Fr1*Hs;}cATcf3YVP6Z1MBTXHpRQ}V0 zfsC2t&a2JGoCv^K>bi)P9Z}~6Z*)p^z9k7iY+$<-$)2uCi;d*wELO}rm@y%`;mo(P zFekV2t(}~^bLq~{#zTpLQC(9KFcFrbT2M9cT~|)?N$K8*RE&`Z3squdaY%32$SW3W z%7&S*R0_jPtey^7H(OpHDE25-M84WXfGT6{M9dxga4BIfOy|}7%L<*2~h=y)pv_pQ=T>w#v4H?4-TgO{F17sdS{|S}fY6!_=i{h}GxJL^Uib^9uFt^>%S=o0;*ygF@M}(M zz?HtF7Q2GafDkhOPh-~}4&~PN$2o+OL{3v8Z816IP#9|O5H@W@ig6kwOwQvtiTE-k z_I7GANY0E?MhQcXMU8Sc&Ws7;&^V4U^StA`zWwg^yT1K?*Sps5zSjEP_qx};{#fh! z{r5aE&uo`Dr==)7&V9b`$cY0MiW)A*iJS zI%rpgEID^>5~S(j5q^s+Be~dBY}D?`j$hS#(S6K$jPIv&W@w7BTKLE@1DJ;$YT=_% z&N$%O&~<=g?YdYizI^*kZhOaFTJy-Le#X^<0ah3E+*z%HkhhG}VHxSZqXoO6awd&O z5wcB?IiB9%7yYr}yUiiT;|66&SOo8{tIn_Kg~%z>0lzoi_8H5w$c!1}vl%3A28o?P zw#*=7W{@@yo2(w{De5?#(~&(T4H1`uXmWSUKc43wF1M<7dV-%pKHi3iRiN^nnSwkk zFeQ87THF39fnkDGHS5VgLvD|^Q}~CWiuOR3GxI+rXzmr*IeXwNdprJNf=M;&7xs3d z6{u8a=Km9#XIBy&hN{{FZ=IR{Awjbbe$gIqWmgg$CfHZAI@y)PD^NA;O8+Z_e8k!w zt4ZowvuCAxl0N&j(_XRY#WH(!g%U4sK3DTLGcD+zDa=vMqX)PPi@PpXq{-*qI_^Z(%L4m6puU)bCHJ*`|r)0$%A zZMrV~lFw9;^?e~r>ZH|XoRG^SU%{uXY< zXnj8wzA|1XkKBWH`*XS?V~nWaYQ5en7O|w|H9Q;p;GOIb{RE(P#EM*;867?A%<$H@ zKIN(48))Na{g5U4Bg@Z@oNphh(kF!U5kk127RVI!-Y^@-4vUtX4$M76=KFI+ILI)0 z&RPtI#{8VSNP*qKJ5^MnQI+DK1y_kFjP)tRFA1pf3DR zDdVhn)QEHLotDOV1+ty7Sf_93Oxuy>9@@e!TL02LTtvQe-CCVHkSEdsPIPx45~ zo`_9}-s{C8%&8}cOIlP`e(U=cBCx(%zTqft+f1v(M$2cTRMP2(1w)AvGPg404MvYb? zVd}8aBrR1~;vQo0L_*5v?nca+Z$9*7n2NUYr#(16@rC5KJd?32 z7Z85^1bk3>hv_7NxAUhmkCq7;K8M>VNLNRx-xngx8%EGSD;rdIr|HvZh~xcPjOLfM z6IYfIX5#UKo5}qI{aTw}^d=LQ@J$ugWiXq^j_yl!BIOHGmI32;xFseFZ3z@R;tS2~ zFNjKtJOpw-{1(yJJa&&D5we|}n>tekl>u~)7v73z+)DE7I9Rc4-*S*RoN*uqM+XT;{Az~rd{zV3}73JMxSG^-!( zlJKwjyzKd*akI?_;r2jHM^i%w^yj)GAb2|3T;QAFn)czMAP`89Js7&XLfl<~TvXj% zSMQkxl5E6UYDKRGuf&HcodUD z&dCC`Pd{41D%^GE64aUu8sPD9=EV)Y36`?`Mp^35H<(tUUC$LuS<|IlrR?ov_56LB z$IAb%d!zhSflC7c2$HvB!Ww&1# zSLWT;w<$l(j~^}|I$)Y)gq$iaVx4p&DLuMVPtQUzPGWAXK}YCZhj#J zzYfF!&*f_e{ERWoKgv~92*B(CO>#cAQ=@BAL~ko~z3H-D`IjLxayI==awQ`E>ysSy z+}!ohw2{gj%vfy*_B$8ZavwE*xd<;WCL|}Nim*7>MrD7%Ox&2>b`hhIE#5ch73VDO z*7g*m*wbLxB1DsUzWz8;WPt&Og6PSvZCNxFr%Tfc$|54RGMQ>;YGA^>4cT-TR58`u)P~CR$;eSZ(R<0pftRFS(;>}oq?uEiKm7n4w z2PD6xdvG{@T%?)}q%SHpelT*J&BHykvePM1mL5DQyez=Ca$9(~vWbI+0q4d>a?lid z_!wH!RMN)L^HwY!i+xLQlJ>W`cu=s_qbo{=GGckc0#(Vi?V}pxkT~{ezPXaI;OMi%%{o!9YSJ>XPif zv))!4^1HT?0Uw=nA(s9~WRc4tOJvX4;MgO&A!w0{BTIz)knG6)6Jjrcf(anI>A}01 z(TINsXX<9_C?%$b$mN#H*JU7*6eTOc(CcSK{R!q#hTH<6uyb;t#rl1D%GDF^w!$x8 z7-&c+$~iLD0~x5(B^IYI)v8^~RyDFq%`5M5#i@tVC-pxjH)>4~d)7+DXZ3PI3TO`X zrP>125rJx$a%*%Yh*8h^ujG|8A!89Zc4R);Gr#4GM1u6C-N4ofB1a&Uua9|1+9rrR zfzVTZ%zIV|j{g_^EXO}F$wxiBClav1n^29MO7&H3e3{)%KrapLm$|Djv_#Hdw()>K zt>Xg0g;&zU%Ew>Z7K`2+zi~sjC)B8gk0!`!oSz$>atEslsVJXy(?Ef1bv5pD9mmKY z{W+-+s*V?IsJG~Fh4>AHOqZC5Rgao~F)I~UzENY(?_grG4UIAE`HEscn3x0hWlbss zGDo{Bwy@*PJ0(>uGM4KOH_rB96K&%HFBMh@YY6)J<$9H1Qk3!r0c@1G4Hb2xKHxCQ&d{eo0|LtRyo zzCM3t|Gkd=mCY%`@!zWUSH|Bf+Fuzzu`~Wf->l4d4uucI#qOo-F;Siaqz|$Pv%X~x zwnGFwaE1H1d4Vku?rk@bc>>K9pdJ*iS?(Oa> F@DFOJt5yI2 literal 0 HcmV?d00001 diff --git a/Datapack/sql/experimental/l2j_full_structure.sql b/Datapack/sql/experimental/l2j_full_structure.sql new file mode 100644 index 00000000..c0383007 --- /dev/null +++ b/Datapack/sql/experimental/l2j_full_structure.sql @@ -0,0 +1,2304 @@ +-- MySQL Script generated by MySQL Workbench +-- Qua 11 Abr 2018 19:05:43 -03 +-- Model: New Model Version: 1.0 +-- MySQL Workbench Forward Engineering + +SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0; +SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0; +SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='TRADITIONAL,ALLOW_INVALID_DATES'; + +-- ----------------------------------------------------- +-- Schema mydb +-- ----------------------------------------------------- +-- ----------------------------------------------------- +-- Schema l2jdb +-- ----------------------------------------------------- +DROP SCHEMA IF EXISTS `l2jdb` ; + +-- ----------------------------------------------------- +-- Schema l2jdb +-- ----------------------------------------------------- +CREATE SCHEMA IF NOT EXISTS `l2jdb` DEFAULT CHARACTER SET latin1 ; +USE `l2jdb` ; + +-- ----------------------------------------------------- +-- Table `accounts` +-- ----------------------------------------------------- +DROP TABLE IF EXISTS `accounts` ; + +CREATE TABLE IF NOT EXISTS `accounts` ( + `login` VARCHAR(45) NOT NULL DEFAULT '', + `password` VARCHAR(45) NULL DEFAULT NULL, + `lastactive` DECIMAL(20,0) NULL DEFAULT NULL, + `access_level` INT(11) NULL DEFAULT NULL, + `lastIP` VARCHAR(20) NULL DEFAULT NULL, + `lastServer` INT(4) NULL DEFAULT '1', + PRIMARY KEY (`login`)) +ENGINE = InnoDB +DEFAULT CHARACTER SET = latin1; + + +-- ----------------------------------------------------- +-- Table `account_data` +-- ----------------------------------------------------- +DROP TABLE IF EXISTS `account_data` ; + +CREATE TABLE IF NOT EXISTS `account_data` ( + `account_name` VARCHAR(45) NOT NULL DEFAULT '', + `var` VARCHAR(20) NOT NULL DEFAULT '', + `value` VARCHAR(255) NULL DEFAULT NULL, + PRIMARY KEY (`account_name`, `var`), + CONSTRAINT `FK_AccountName` + FOREIGN KEY (`account_name`) + REFERENCES `accounts` (`login`)) +ENGINE = InnoDB +DEFAULT CHARACTER SET = latin1; + + +-- ----------------------------------------------------- +-- Table `armor` +-- ----------------------------------------------------- +DROP TABLE IF EXISTS `armor` ; + +CREATE TABLE IF NOT EXISTS `armor` ( + `item_id` INT(11) NOT NULL DEFAULT '0', + `name` VARCHAR(70) NULL DEFAULT NULL, + `bodypart` VARCHAR(15) NOT NULL DEFAULT '', + `crystallizable` VARCHAR(5) NOT NULL DEFAULT '', + `armor_type` VARCHAR(5) NOT NULL DEFAULT '', + `weight` INT(5) NOT NULL DEFAULT '0', + `material` VARCHAR(15) NOT NULL DEFAULT '', + `crystal_type` VARCHAR(4) NOT NULL DEFAULT '', + `avoid_modify` INT(1) NOT NULL DEFAULT '0', + `duration` INT(3) NOT NULL DEFAULT '0', + `p_def` INT(3) NOT NULL DEFAULT '0', + `m_def` INT(2) NOT NULL DEFAULT '0', + `mp_bonus` INT(3) NOT NULL DEFAULT '0', + `price` INT(11) NOT NULL DEFAULT '0', + `crystal_count` INT(4) NULL DEFAULT NULL, + `sellable` VARCHAR(5) NULL DEFAULT NULL, + `dropable` VARCHAR(5) NULL DEFAULT NULL, + `destroyable` VARCHAR(5) NULL DEFAULT NULL, + `tradeable` VARCHAR(5) NULL DEFAULT NULL, + `item_skill_id` DECIMAL(11,0) NOT NULL DEFAULT '0', + `item_skill_lvl` DECIMAL(11,0) NOT NULL DEFAULT '0', + PRIMARY KEY (`item_id`)) +ENGINE = InnoDB +DEFAULT CHARACTER SET = latin1; + + +-- ----------------------------------------------------- +-- Table `weapon` +-- ----------------------------------------------------- +DROP TABLE IF EXISTS `weapon` ; + +CREATE TABLE IF NOT EXISTS `weapon` ( + `item_id` DECIMAL(11,0) NOT NULL DEFAULT '0', + `name` VARCHAR(70) NULL DEFAULT NULL, + `bodypart` VARCHAR(15) NULL DEFAULT NULL, + `crystallizable` VARCHAR(5) NULL DEFAULT NULL, + `weight` DECIMAL(4,0) NULL DEFAULT NULL, + `soulshots` DECIMAL(2,0) NULL DEFAULT NULL, + `spiritshots` DECIMAL(1,0) NULL DEFAULT NULL, + `material` VARCHAR(11) NULL DEFAULT NULL, + `crystal_type` VARCHAR(4) NULL DEFAULT NULL, + `p_dam` DECIMAL(5,0) NULL DEFAULT NULL, + `rnd_dam` DECIMAL(2,0) NULL DEFAULT NULL, + `weaponType` VARCHAR(8) NULL DEFAULT NULL, + `critical` DECIMAL(2,0) NULL DEFAULT NULL, + `hit_modify` DECIMAL(6,5) NULL DEFAULT NULL, + `avoid_modify` DECIMAL(2,0) NULL DEFAULT NULL, + `shield_def` DECIMAL(3,0) NULL DEFAULT NULL, + `shield_def_rate` DECIMAL(2,0) NULL DEFAULT NULL, + `atk_speed` DECIMAL(3,0) NULL DEFAULT NULL, + `mp_consume` DECIMAL(2,0) NULL DEFAULT NULL, + `m_dam` DECIMAL(3,0) NULL DEFAULT NULL, + `duration` DECIMAL(3,0) NULL DEFAULT NULL, + `price` DECIMAL(11,0) NULL DEFAULT NULL, + `crystal_count` INT(4) NULL DEFAULT NULL, + `sellable` VARCHAR(5) NULL DEFAULT NULL, + `dropable` VARCHAR(5) NULL DEFAULT NULL, + `destroyable` VARCHAR(5) NULL DEFAULT NULL, + `tradeable` VARCHAR(5) NULL DEFAULT NULL, + `item_skill_id` DECIMAL(11,0) NOT NULL DEFAULT '0', + `item_skill_lvl` DECIMAL(11,0) NOT NULL DEFAULT '0', + `enchant4_skill_id` DECIMAL(11,0) NOT NULL DEFAULT '0', + `enchant4_skill_lvl` DECIMAL(11,0) NOT NULL DEFAULT '0', + `onCast_skill_id` DECIMAL(11,0) NOT NULL DEFAULT '0', + `onCast_skill_lvl` DECIMAL(11,0) NOT NULL DEFAULT '0', + `onCast_skill_chance` DECIMAL(11,0) NOT NULL DEFAULT '0', + `onCrit_skill_id` DECIMAL(11,0) NOT NULL DEFAULT '0', + `onCrit_skill_lvl` DECIMAL(11,0) NOT NULL DEFAULT '0', + `onCrit_skill_chance` DECIMAL(11,0) NOT NULL DEFAULT '0', + PRIMARY KEY (`item_id`)) +ENGINE = InnoDB +DEFAULT CHARACTER SET = latin1; + + +-- ----------------------------------------------------- +-- Table `armorsets` +-- ----------------------------------------------------- +DROP TABLE IF EXISTS `armorsets` ; + +CREATE TABLE IF NOT EXISTS `armorsets` ( + `id` INT(3) NOT NULL AUTO_INCREMENT, + `chest` DECIMAL(11,0) NOT NULL DEFAULT '0', + `legs` DECIMAL(11,0) NOT NULL DEFAULT '0', + `head` DECIMAL(11,0) NOT NULL DEFAULT '0', + `gloves` DECIMAL(11,0) NOT NULL DEFAULT '0', + `feet` DECIMAL(11,0) NOT NULL DEFAULT '0', + `skill_id` DECIMAL(11,0) NOT NULL DEFAULT '0', + `shield` DECIMAL(11,0) NOT NULL DEFAULT '0', + `shield_skill_id` DECIMAL(11,0) NOT NULL DEFAULT '0', + `enchant6skill` DECIMAL(11,0) NOT NULL DEFAULT '0', + PRIMARY KEY (`id`, `chest`), + INDEX `fk_armorsets_armor1_idx` (`chest` ASC), + INDEX `fk_armorsets_armor2_idx` (`legs` ASC), + INDEX `fk_armorsets_armor3_idx` (`head` ASC), + INDEX `fk_armorsets_armor4_idx` (`gloves` ASC), + INDEX `fk_armorsets_armor5_idx` (`feet` ASC), + INDEX `fk_armorsets_weapon1_idx` (`shield` ASC), + CONSTRAINT `fk_armorsets_armor1` + FOREIGN KEY (`chest`) + REFERENCES `armor` (`item_id`) + ON DELETE NO ACTION + ON UPDATE NO ACTION, + CONSTRAINT `fk_armorsets_armor2` + FOREIGN KEY (`legs`) + REFERENCES `armor` (`item_id`) + ON DELETE NO ACTION + ON UPDATE NO ACTION, + CONSTRAINT `fk_armorsets_armor3` + FOREIGN KEY (`head`) + REFERENCES `armor` (`item_id`) + ON DELETE NO ACTION + ON UPDATE NO ACTION, + CONSTRAINT `fk_armorsets_armor4` + FOREIGN KEY (`gloves`) + REFERENCES `armor` (`item_id`) + ON DELETE NO ACTION + ON UPDATE NO ACTION, + CONSTRAINT `fk_armorsets_armor5` + FOREIGN KEY (`feet`) + REFERENCES `armor` (`item_id`) + ON DELETE NO ACTION + ON UPDATE NO ACTION, + CONSTRAINT `fk_armorsets_weapon1` + FOREIGN KEY (`shield`) + REFERENCES `weapon` (`item_id`) + ON DELETE NO ACTION + ON UPDATE NO ACTION) +ENGINE = InnoDB +AUTO_INCREMENT = 52 +DEFAULT CHARACTER SET = latin1; + + +-- ----------------------------------------------------- +-- Table `char_templates` +-- ----------------------------------------------------- +DROP TABLE IF EXISTS `char_templates` ; + +CREATE TABLE IF NOT EXISTS `char_templates` ( + `ClassId` INT(11) NOT NULL DEFAULT '0', + `ClassName` VARCHAR(20) NOT NULL DEFAULT '', + `RaceId` INT(1) NOT NULL DEFAULT '0', + `STR` INT(2) NOT NULL DEFAULT '0', + `CON` INT(2) NOT NULL DEFAULT '0', + `DEX` INT(2) NOT NULL DEFAULT '0', + `_INT` INT(2) NOT NULL DEFAULT '0', + `WIT` INT(2) NOT NULL DEFAULT '0', + `MEN` INT(2) NOT NULL DEFAULT '0', + `P_ATK` INT(3) NOT NULL DEFAULT '0', + `P_DEF` INT(3) NOT NULL DEFAULT '0', + `M_ATK` INT(3) NOT NULL DEFAULT '0', + `M_DEF` INT(2) NOT NULL DEFAULT '0', + `P_SPD` INT(3) NOT NULL DEFAULT '0', + `M_SPD` INT(3) NOT NULL DEFAULT '0', + `ACC` INT(3) NOT NULL DEFAULT '0', + `CRITICAL` INT(3) NOT NULL DEFAULT '0', + `EVASION` INT(3) NOT NULL DEFAULT '0', + `MOVE_SPD` INT(3) NOT NULL DEFAULT '0', + `_LOAD` INT(11) NOT NULL DEFAULT '0', + `x` INT(9) NOT NULL DEFAULT '0', + `y` INT(9) NOT NULL DEFAULT '0', + `z` INT(9) NOT NULL DEFAULT '0', + `canCraft` INT(1) NOT NULL DEFAULT '0', + `M_UNK1` DECIMAL(4,2) NOT NULL DEFAULT '0.00', + `M_UNK2` DECIMAL(8,6) NOT NULL DEFAULT '0.000000', + `M_COL_R` DECIMAL(3,1) NOT NULL DEFAULT '0.0', + `M_COL_H` DECIMAL(4,1) NOT NULL DEFAULT '0.0', + `F_UNK1` DECIMAL(4,2) NOT NULL DEFAULT '0.00', + `F_UNK2` DECIMAL(8,6) NOT NULL DEFAULT '0.000000', + `F_COL_R` DECIMAL(3,1) NOT NULL DEFAULT '0.0', + `F_COL_H` DECIMAL(4,1) NOT NULL DEFAULT '0.0', + `items1` INT(4) NOT NULL DEFAULT '0', + `items2` INT(4) NOT NULL DEFAULT '0', + `items3` INT(4) NOT NULL DEFAULT '0', + `items4` INT(4) NOT NULL DEFAULT '0', + `items5` INT(10) NOT NULL DEFAULT '0', + PRIMARY KEY (`ClassId`)) +ENGINE = InnoDB +DEFAULT CHARACTER SET = latin1; + + +-- ----------------------------------------------------- +-- Table `characters` +-- ----------------------------------------------------- +DROP TABLE IF EXISTS `characters` ; + +CREATE TABLE IF NOT EXISTS `characters` ( + `account_name` VARCHAR(45) NULL DEFAULT NULL, + `obj_Id` DECIMAL(11,0) NOT NULL DEFAULT '0', + `char_name` VARCHAR(35) NOT NULL, + `level` DECIMAL(11,0) NULL DEFAULT NULL, + `maxHp` DECIMAL(11,0) NULL DEFAULT NULL, + `curHp` DECIMAL(18,0) NULL DEFAULT NULL, + `maxCp` DECIMAL(11,0) NULL DEFAULT NULL, + `curCp` DECIMAL(18,0) NULL DEFAULT NULL, + `maxMp` DECIMAL(11,0) NULL DEFAULT NULL, + `curMp` DECIMAL(18,0) NULL DEFAULT NULL, + `acc` DECIMAL(11,0) NULL DEFAULT NULL, + `crit` DECIMAL(10,0) NULL DEFAULT NULL, + `evasion` DECIMAL(11,0) NULL DEFAULT NULL, + `mAtk` DECIMAL(11,0) NULL DEFAULT NULL, + `mDef` DECIMAL(11,0) NULL DEFAULT NULL, + `mSpd` DECIMAL(11,0) NULL DEFAULT NULL, + `pAtk` DECIMAL(11,0) NULL DEFAULT NULL, + `pDef` DECIMAL(11,0) NULL DEFAULT NULL, + `pSpd` DECIMAL(11,0) NULL DEFAULT NULL, + `runSpd` DECIMAL(11,0) NULL DEFAULT NULL, + `walkSpd` DECIMAL(11,0) NULL DEFAULT NULL, + `str` DECIMAL(11,0) NULL DEFAULT NULL, + `con` DECIMAL(11,0) NULL DEFAULT NULL, + `dex` DECIMAL(11,0) NULL DEFAULT NULL, + `_int` DECIMAL(11,0) NULL DEFAULT NULL, + `men` DECIMAL(11,0) NULL DEFAULT NULL, + `wit` DECIMAL(11,0) NULL DEFAULT NULL, + `face` DECIMAL(11,0) NULL DEFAULT NULL, + `hairStyle` DECIMAL(11,0) NULL DEFAULT NULL, + `hairColor` DECIMAL(11,0) NULL DEFAULT NULL, + `sex` DECIMAL(11,0) NULL DEFAULT NULL, + `heading` DECIMAL(11,0) NULL DEFAULT NULL, + `x` DECIMAL(11,0) NULL DEFAULT NULL, + `y` DECIMAL(11,0) NULL DEFAULT NULL, + `z` DECIMAL(11,0) NULL DEFAULT NULL, + `movement_multiplier` DECIMAL(9,8) NULL DEFAULT NULL, + `attack_speed_multiplier` DECIMAL(10,9) NULL DEFAULT NULL, + `colRad` DECIMAL(10,3) NULL DEFAULT NULL, + `colHeight` DECIMAL(10,3) NULL DEFAULT NULL, + `exp` DECIMAL(20,0) NULL DEFAULT NULL, + `expBeforeDeath` DECIMAL(20,0) NULL DEFAULT '0', + `sp` DECIMAL(11,0) NULL DEFAULT NULL, + `karma` DECIMAL(11,0) NULL DEFAULT NULL, + `pvpkills` DECIMAL(11,0) NULL DEFAULT NULL, + `pkkills` DECIMAL(11,0) NULL DEFAULT NULL, + `clanid` DECIMAL(11,0) NULL DEFAULT NULL, + `maxload` DECIMAL(11,0) NULL DEFAULT NULL, + `race` DECIMAL(11,0) NULL DEFAULT NULL, + `classid` DECIMAL(11,0) NULL DEFAULT NULL, + `base_class` INT(2) NOT NULL DEFAULT '0', + `deletetime` DECIMAL(20,0) NULL DEFAULT NULL, + `cancraft` DECIMAL(11,0) NULL DEFAULT NULL, + `title` VARCHAR(16) NULL DEFAULT NULL, + `rec_have` INT(3) NOT NULL DEFAULT '0', + `rec_left` INT(3) NOT NULL DEFAULT '0', + `accesslevel` DECIMAL(4,0) NULL DEFAULT NULL, + `online` DECIMAL(1,0) NULL DEFAULT NULL, + `onlinetime` DECIMAL(20,0) NULL DEFAULT NULL, + `char_slot` DECIMAL(1,0) NULL DEFAULT NULL, + `newbie` DECIMAL(1,0) NULL DEFAULT '1', + `lastAccess` DECIMAL(20,0) NULL DEFAULT NULL, + `clan_privs` INT(11) NULL DEFAULT '0', + `wantspeace` DECIMAL(1,0) NULL DEFAULT '0', + `isin7sdungeon` DECIMAL(1,0) NOT NULL DEFAULT '0', + `in_jail` DECIMAL(1,0) NULL DEFAULT '0', + `jail_timer` DECIMAL(20,0) NULL DEFAULT '0', + `power_grade` DECIMAL(11,0) NULL DEFAULT NULL, + `nobless` DECIMAL(1,0) NOT NULL DEFAULT '0', + `subpledge` INT(1) NOT NULL DEFAULT '0', + `last_recom_date` DECIMAL(20,0) NOT NULL DEFAULT '0', + `lvl_joined_academy` INT(1) NOT NULL DEFAULT '0', + `apprentice` INT(1) NOT NULL DEFAULT '0', + `sponsor` INT(1) NOT NULL DEFAULT '0', + `varka_ketra_ally` INT(1) NOT NULL DEFAULT '0', + `clan_join_expiry_time` DECIMAL(20,0) NOT NULL DEFAULT '0', + `clan_create_expiry_time` DECIMAL(20,0) NOT NULL DEFAULT '0', + `death_penalty_level` INT(2) NOT NULL DEFAULT '0', + PRIMARY KEY (`obj_Id`), + INDEX `clanid` (`clanid` ASC), + INDEX `fk_characters_accounts1_idx` (`account_name` ASC), + INDEX `fk_characters_char_templates1_idx` (`classid` ASC), + CONSTRAINT `fk_characters_accounts1` + FOREIGN KEY (`account_name`) + REFERENCES `accounts` (`login`) + ON DELETE NO ACTION + ON UPDATE NO ACTION, + CONSTRAINT `fk_characters_char_templates1` + FOREIGN KEY (`classid`) + REFERENCES `char_templates` (`ClassId`) + ON DELETE NO ACTION + ON UPDATE NO ACTION) +ENGINE = InnoDB +DEFAULT CHARACTER SET = latin1; + + +-- ----------------------------------------------------- +-- Table `clan_data` +-- ----------------------------------------------------- +DROP TABLE IF EXISTS `clan_data` ; + +CREATE TABLE IF NOT EXISTS `clan_data` ( + `clan_id` INT(11) NOT NULL DEFAULT '0', + `clan_name` VARCHAR(45) NULL DEFAULT NULL, + `clan_level` INT(11) NULL DEFAULT NULL, + `reputation_score` INT(11) NOT NULL DEFAULT '0', + `hasCastle` INT(11) NULL DEFAULT NULL, + `ally_id` INT(11) NULL DEFAULT NULL, + `ally_name` VARCHAR(45) NULL DEFAULT NULL, + `leader_id` INT(11) NULL DEFAULT NULL, + `crest_id` INT(11) NULL DEFAULT NULL, + `crest_large_id` INT(11) NULL DEFAULT NULL, + `ally_crest_id` INT(11) NULL DEFAULT NULL, + `auction_bid_at` INT(11) NOT NULL DEFAULT '0', + `ally_penalty_expiry_time` DECIMAL(20,0) NOT NULL DEFAULT '0', + `ally_penalty_type` DECIMAL(1,0) NOT NULL DEFAULT '0', + `char_penalty_expiry_time` DECIMAL(20,0) NOT NULL DEFAULT '0', + `dissolving_expiry_time` DECIMAL(20,0) NOT NULL DEFAULT '0', + PRIMARY KEY (`clan_id`), + INDEX `leader_id` (`leader_id` ASC), + INDEX `ally_id` (`ally_id` ASC), + CONSTRAINT `fk_clan_data_characters1` + FOREIGN KEY (`leader_id`) + REFERENCES `characters` (`obj_Id`) + ON DELETE NO ACTION + ON UPDATE NO ACTION) +ENGINE = InnoDB +DEFAULT CHARACTER SET = latin1; + + +-- ----------------------------------------------------- +-- Table `clanhall` +-- ----------------------------------------------------- +DROP TABLE IF EXISTS `clanhall` ; + +CREATE TABLE IF NOT EXISTS `clanhall` ( + `id` INT(11) NOT NULL DEFAULT '0', + `name` VARCHAR(40) NOT NULL DEFAULT '', + `ownerId` INT(11) NOT NULL DEFAULT '0', + `lease` INT(10) NOT NULL DEFAULT '0', + `desc` TEXT NOT NULL, + `location` VARCHAR(15) NOT NULL DEFAULT '', + `paidUntil` DECIMAL(20,0) NOT NULL DEFAULT '0', + `Grade` DECIMAL(1,0) NOT NULL DEFAULT '0', + `paid` INT(1) NOT NULL DEFAULT '0', + PRIMARY KEY (`id`), + INDEX `fk_clanhall_clan_data1_idx` (`ownerId` ASC), + CONSTRAINT `fk_clanhall_clan_data1` + FOREIGN KEY (`ownerId`) + REFERENCES `clan_data` (`clan_id`) + ON DELETE NO ACTION + ON UPDATE NO ACTION) +ENGINE = InnoDB +DEFAULT CHARACTER SET = latin1; + + +-- ----------------------------------------------------- +-- Table `auction` +-- ----------------------------------------------------- +DROP TABLE IF EXISTS `auction` ; + +CREATE TABLE IF NOT EXISTS `auction` ( + `id` INT(11) NOT NULL DEFAULT '0', + `sellerId` INT(11) NOT NULL DEFAULT '0', + `sellerName` VARCHAR(50) NOT NULL DEFAULT 'NPC', + `sellerClanName` VARCHAR(50) NOT NULL DEFAULT '', + `itemType` VARCHAR(25) NOT NULL DEFAULT '', + `itemId` INT(11) NOT NULL DEFAULT '0', + `itemObjectId` INT(11) NOT NULL DEFAULT '0', + `itemName` VARCHAR(40) NOT NULL DEFAULT '', + `itemQuantity` INT(11) NOT NULL DEFAULT '0', + `startingBid` INT(11) NOT NULL DEFAULT '0', + `currentBid` INT(11) NOT NULL DEFAULT '0', + `endDate` DECIMAL(20,0) NOT NULL DEFAULT '0', + PRIMARY KEY (`itemType`, `itemId`, `itemObjectId`), + INDEX `id` (`id` ASC), + INDEX `fk_auction_clanhall1_idx` (`itemId` ASC), + CONSTRAINT `fk_auction_clanhall1` + FOREIGN KEY (`itemId`) + REFERENCES `clanhall` (`id`) + ON DELETE NO ACTION + ON UPDATE NO ACTION) +ENGINE = InnoDB +DEFAULT CHARACTER SET = latin1; + + +-- ----------------------------------------------------- +-- Table `auction_bid` +-- ----------------------------------------------------- +DROP TABLE IF EXISTS `auction_bid` ; + +CREATE TABLE IF NOT EXISTS `auction_bid` ( + `id` INT(11) NOT NULL DEFAULT '0', + `auctionId` INT(11) NOT NULL DEFAULT '0', + `bidderId` INT(11) NOT NULL DEFAULT '0', + `bidderName` VARCHAR(50) NOT NULL, + `clan_name` VARCHAR(50) NOT NULL, + `maxBid` INT(11) NOT NULL DEFAULT '0', + `time_bid` DECIMAL(20,0) NOT NULL DEFAULT '0', + PRIMARY KEY (`auctionId`, `bidderId`), + INDEX `id` (`id` ASC), + INDEX `fk_auction_bid_clan_data1_idx` (`bidderId` ASC), + CONSTRAINT `fk_auction_bid_auction1` + FOREIGN KEY (`auctionId`) + REFERENCES `auction` (`id`) + ON DELETE NO ACTION + ON UPDATE NO ACTION, + CONSTRAINT `fk_auction_bid_clan_data1` + FOREIGN KEY (`bidderId`) + REFERENCES `clan_data` (`clan_id`) + ON DELETE NO ACTION + ON UPDATE NO ACTION) +ENGINE = InnoDB +DEFAULT CHARACTER SET = latin1; + + +-- ----------------------------------------------------- +-- Table `auction_watch` +-- ----------------------------------------------------- +DROP TABLE IF EXISTS `auction_watch` ; + +CREATE TABLE IF NOT EXISTS `auction_watch` ( + `charObjId` INT(11) NOT NULL DEFAULT '0', + `auctionId` INT(11) NOT NULL DEFAULT '0', + PRIMARY KEY (`charObjId`, `auctionId`), + INDEX `fk_auction_watch_auction1_idx` (`auctionId` ASC), + CONSTRAINT `fk_auction_watch_auction1` + FOREIGN KEY (`auctionId`) + REFERENCES `auction` (`id`) + ON DELETE NO ACTION + ON UPDATE NO ACTION, + CONSTRAINT `fk_auction_watch_characters1` + FOREIGN KEY (`charObjId`) + REFERENCES `characters` (`obj_Id`) + ON DELETE NO ACTION + ON UPDATE NO ACTION) +ENGINE = InnoDB +DEFAULT CHARACTER SET = latin1; + + +-- ----------------------------------------------------- +-- Table `augmentations` +-- ----------------------------------------------------- +DROP TABLE IF EXISTS `augmentations` ; + +CREATE TABLE IF NOT EXISTS `augmentations` ( + `item_id` INT(11) NOT NULL DEFAULT '0', + `attributes` INT(11) NULL DEFAULT '0', + `skill` INT(11) NULL DEFAULT '0', + `level` INT(11) NULL DEFAULT '0', + PRIMARY KEY (`item_id`), + CONSTRAINT `fk_augmentations_weapon1` + FOREIGN KEY (`item_id`) + REFERENCES `weapon` (`item_id`) + ON DELETE NO ACTION + ON UPDATE NO ACTION) +ENGINE = InnoDB +DEFAULT CHARACTER SET = latin1; + + +-- ----------------------------------------------------- +-- Table `npc` +-- ----------------------------------------------------- +DROP TABLE IF EXISTS `npc` ; + +CREATE TABLE IF NOT EXISTS `npc` ( + `id` DECIMAL(11,0) NOT NULL DEFAULT '0', + `idTemplate` INT(11) NOT NULL DEFAULT '0', + `name` VARCHAR(200) NULL DEFAULT NULL, + `serverSideName` INT(1) NULL DEFAULT '0', + `title` VARCHAR(45) NULL DEFAULT '', + `serverSideTitle` INT(1) NULL DEFAULT '0', + `class` VARCHAR(200) NULL DEFAULT NULL, + `collision_radius` DECIMAL(5,2) NULL DEFAULT NULL, + `collision_height` DECIMAL(5,2) NULL DEFAULT NULL, + `level` DECIMAL(2,0) NULL DEFAULT NULL, + `sex` VARCHAR(6) NULL DEFAULT NULL, + `type` VARCHAR(20) NULL DEFAULT NULL, + `attackrange` INT(11) NULL DEFAULT NULL, + `hp` DECIMAL(8,0) NULL DEFAULT NULL, + `mp` DECIMAL(5,0) NULL DEFAULT NULL, + `hpreg` DECIMAL(8,2) NULL DEFAULT NULL, + `mpreg` DECIMAL(5,2) NULL DEFAULT NULL, + `str` DECIMAL(7,0) NULL DEFAULT NULL, + `con` DECIMAL(7,0) NULL DEFAULT NULL, + `dex` DECIMAL(7,0) NULL DEFAULT NULL, + `int` DECIMAL(7,0) NULL DEFAULT NULL, + `wit` DECIMAL(7,0) NULL DEFAULT NULL, + `men` DECIMAL(7,0) NULL DEFAULT NULL, + `exp` DECIMAL(9,0) NULL DEFAULT NULL, + `sp` DECIMAL(8,0) NULL DEFAULT NULL, + `patk` DECIMAL(5,0) NULL DEFAULT NULL, + `pdef` DECIMAL(5,0) NULL DEFAULT NULL, + `matk` DECIMAL(5,0) NULL DEFAULT NULL, + `mdef` DECIMAL(5,0) NULL DEFAULT NULL, + `atkspd` DECIMAL(3,0) NULL DEFAULT NULL, + `aggro` DECIMAL(6,0) NULL DEFAULT NULL, + `matkspd` DECIMAL(4,0) NULL DEFAULT NULL, + `rhand` DECIMAL(4,0) NULL DEFAULT NULL, + `lhand` DECIMAL(4,0) NULL DEFAULT NULL, + `armor` DECIMAL(1,0) NULL DEFAULT NULL, + `walkspd` DECIMAL(3,0) NULL DEFAULT NULL, + `runspd` DECIMAL(3,0) NULL DEFAULT NULL, + `faction_id` VARCHAR(40) NULL DEFAULT NULL, + `faction_range` DECIMAL(4,0) NULL DEFAULT NULL, + `isUndead` INT(11) NULL DEFAULT '0', + `absorb_level` DECIMAL(2,0) NULL DEFAULT '0', + `absorb_type` ENUM('FULL_PARTY', 'LAST_HIT', 'PARTY_ONE_RANDOM') NOT NULL DEFAULT 'LAST_HIT', + PRIMARY KEY (`id`)) +ENGINE = InnoDB +DEFAULT CHARACTER SET = latin1; + + +-- ----------------------------------------------------- +-- Table `auto_chat` +-- ----------------------------------------------------- +DROP TABLE IF EXISTS `auto_chat` ; + +CREATE TABLE IF NOT EXISTS `auto_chat` ( + `groupId` INT(11) NOT NULL DEFAULT '0', + `npcId` INT(11) NOT NULL DEFAULT '0', + `chatDelay` BIGINT(20) NOT NULL DEFAULT '-1', + PRIMARY KEY (`groupId`), + INDEX `fk_auto_chat_npc1_idx` (`npcId` ASC), + CONSTRAINT `fk_auto_chat_npc1` + FOREIGN KEY (`npcId`) + REFERENCES `npc` (`id`) + ON DELETE NO ACTION + ON UPDATE NO ACTION) +ENGINE = InnoDB +DEFAULT CHARACTER SET = latin1; + + +-- ----------------------------------------------------- +-- Table `auto_chat_text` +-- ----------------------------------------------------- +DROP TABLE IF EXISTS `auto_chat_text` ; + +CREATE TABLE IF NOT EXISTS `auto_chat_text` ( + `groupId` INT(11) NOT NULL DEFAULT '0', + `chatText` VARCHAR(255) NOT NULL DEFAULT '', + PRIMARY KEY (`groupId`, `chatText`), + CONSTRAINT `fk_auto_chat_text_auto_chat1` + FOREIGN KEY (`groupId`) + REFERENCES `auto_chat` (`groupId`) + ON DELETE NO ACTION + ON UPDATE NO ACTION) +ENGINE = InnoDB +DEFAULT CHARACTER SET = latin1; + + +-- ----------------------------------------------------- +-- Table `boxaccess` +-- ----------------------------------------------------- +DROP TABLE IF EXISTS `boxaccess` ; + +CREATE TABLE IF NOT EXISTS `boxaccess` ( + `spawn` DECIMAL(11,0) NULL DEFAULT NULL, + `charname` VARCHAR(32) NULL DEFAULT NULL) +ENGINE = InnoDB +DEFAULT CHARACTER SET = latin1; + + +-- ----------------------------------------------------- +-- Table `boxes` +-- ----------------------------------------------------- +DROP TABLE IF EXISTS `boxes` ; + +CREATE TABLE IF NOT EXISTS `boxes` ( + `id` INT(11) NOT NULL AUTO_INCREMENT, + `spawn` DECIMAL(11,0) NULL DEFAULT NULL, + `npcid` DECIMAL(11,0) NULL DEFAULT NULL, + `drawer` VARCHAR(32) NULL DEFAULT NULL, + `itemid` DECIMAL(11,0) NULL DEFAULT NULL, + `name` VARCHAR(32) NULL DEFAULT '', + `count` DECIMAL(11,0) NULL DEFAULT NULL, + `enchant` DECIMAL(2,0) NULL DEFAULT NULL, + PRIMARY KEY (`id`)) +ENGINE = InnoDB +DEFAULT CHARACTER SET = latin1; + + +-- ----------------------------------------------------- +-- Table `castle` +-- ----------------------------------------------------- +DROP TABLE IF EXISTS `castle` ; + +CREATE TABLE IF NOT EXISTS `castle` ( + `id` INT(11) NOT NULL DEFAULT '0', + `name` VARCHAR(25) NOT NULL, + `taxPercent` INT(11) NOT NULL DEFAULT '15', + `treasury` INT(11) NOT NULL DEFAULT '0', + `siegeDate` DECIMAL(20,0) NOT NULL DEFAULT '0', + `siegeDayOfWeek` INT(11) NOT NULL DEFAULT '7', + `siegeHourOfDay` INT(11) NOT NULL DEFAULT '20', + PRIMARY KEY (`name`), + INDEX `id` (`id` ASC)) +ENGINE = InnoDB +DEFAULT CHARACTER SET = latin1; + + +-- ----------------------------------------------------- +-- Table `castle_door` +-- ----------------------------------------------------- +DROP TABLE IF EXISTS `castle_door` ; + +CREATE TABLE IF NOT EXISTS `castle_door` ( + `castleId` INT(11) NOT NULL DEFAULT '0', + `id` INT(11) NOT NULL DEFAULT '0', + `name` VARCHAR(30) NOT NULL, + `x` INT(11) NOT NULL DEFAULT '0', + `y` INT(11) NOT NULL DEFAULT '0', + `z` INT(11) NOT NULL DEFAULT '0', + `range_xmin` INT(11) NOT NULL DEFAULT '0', + `range_ymin` INT(11) NOT NULL DEFAULT '0', + `range_zmin` INT(11) NOT NULL DEFAULT '0', + `range_xmax` INT(11) NOT NULL DEFAULT '0', + `range_ymax` INT(11) NOT NULL DEFAULT '0', + `range_zmax` INT(11) NOT NULL DEFAULT '0', + `hp` INT(11) NOT NULL DEFAULT '0', + `pDef` INT(11) NOT NULL DEFAULT '0', + `mDef` INT(11) NOT NULL DEFAULT '0', + PRIMARY KEY (`id`), + INDEX `id` (`castleId` ASC), + CONSTRAINT `fk_castle_door_castle1` + FOREIGN KEY (`castleId`) + REFERENCES `castle` (`id`) + ON DELETE NO ACTION + ON UPDATE NO ACTION) +ENGINE = InnoDB +DEFAULT CHARACTER SET = latin1; + + +-- ----------------------------------------------------- +-- Table `castle_doorupgrade` +-- ----------------------------------------------------- +DROP TABLE IF EXISTS `castle_doorupgrade` ; + +CREATE TABLE IF NOT EXISTS `castle_doorupgrade` ( + `doorId` INT(11) NOT NULL DEFAULT '0', + `hp` INT(11) NOT NULL DEFAULT '0', + `pDef` INT(11) NOT NULL DEFAULT '0', + `mDef` INT(11) NOT NULL DEFAULT '0', + PRIMARY KEY (`doorId`), + CONSTRAINT `fk_castle_doorupgrade_castle_door1` + FOREIGN KEY (`doorId`) + REFERENCES `castle_door` (`id`) + ON DELETE NO ACTION + ON UPDATE NO ACTION) +ENGINE = InnoDB +DEFAULT CHARACTER SET = latin1; + + +-- ----------------------------------------------------- +-- Table `castle_manor_procure` +-- ----------------------------------------------------- +DROP TABLE IF EXISTS `castle_manor_procure` ; + +CREATE TABLE IF NOT EXISTS `castle_manor_procure` ( + `castle_id` INT(11) NOT NULL DEFAULT '0', + `crop_id` INT(11) NOT NULL DEFAULT '0', + `can_buy` INT(11) NOT NULL DEFAULT '0', + `start_buy` INT(11) NOT NULL DEFAULT '0', + `price` INT(11) NOT NULL DEFAULT '0', + `reward_type` INT(11) NOT NULL DEFAULT '0', + `period` INT(11) NOT NULL DEFAULT '1', + PRIMARY KEY (`castle_id`, `crop_id`, `period`), + CONSTRAINT `fk_castle_manor_procure_castle1` + FOREIGN KEY (`castle_id`) + REFERENCES `castle` (`id`) + ON DELETE NO ACTION + ON UPDATE NO ACTION) +ENGINE = InnoDB +DEFAULT CHARACTER SET = latin1; + + +-- ----------------------------------------------------- +-- Table `castle_manor_production` +-- ----------------------------------------------------- +DROP TABLE IF EXISTS `castle_manor_production` ; + +CREATE TABLE IF NOT EXISTS `castle_manor_production` ( + `castle_id` INT(11) NOT NULL DEFAULT '0', + `seed_id` INT(11) NOT NULL DEFAULT '0', + `can_produce` INT(11) NOT NULL DEFAULT '0', + `start_produce` INT(11) NOT NULL DEFAULT '0', + `seed_price` INT(11) NOT NULL DEFAULT '0', + `period` INT(11) NOT NULL DEFAULT '1', + PRIMARY KEY (`castle_id`, `seed_id`, `period`), + CONSTRAINT `fk_castle_manor_production_castle1` + FOREIGN KEY (`castle_id`) + REFERENCES `castle` (`id`) + ON DELETE NO ACTION + ON UPDATE NO ACTION) +ENGINE = InnoDB +DEFAULT CHARACTER SET = latin1; + + +-- ----------------------------------------------------- +-- Table `castle_siege_guards` +-- ----------------------------------------------------- +DROP TABLE IF EXISTS `castle_siege_guards` ; + +CREATE TABLE IF NOT EXISTS `castle_siege_guards` ( + `castleId` INT(11) NOT NULL DEFAULT '0', + `id` INT(11) NOT NULL AUTO_INCREMENT, + `npcId` INT(11) NOT NULL DEFAULT '0', + `x` INT(11) NOT NULL DEFAULT '0', + `y` INT(11) NOT NULL DEFAULT '0', + `z` INT(11) NOT NULL DEFAULT '0', + `heading` INT(11) NOT NULL DEFAULT '0', + `respawnDelay` INT(11) NOT NULL DEFAULT '0', + `isHired` INT(11) NOT NULL DEFAULT '1', + PRIMARY KEY (`id`), + INDEX `id` (`castleId` ASC), + INDEX `fk_castle_siege_guards_npc1_idx` (`npcId` ASC), + CONSTRAINT `fk_castle_siege_guards_castle1` + FOREIGN KEY (`castleId`) + REFERENCES `castle` (`id`) + ON DELETE NO ACTION + ON UPDATE NO ACTION, + CONSTRAINT `fk_castle_siege_guards_npc1` + FOREIGN KEY (`npcId`) + REFERENCES `npc` (`id`) + ON DELETE NO ACTION + ON UPDATE NO ACTION) +ENGINE = InnoDB +AUTO_INCREMENT = 3448 +DEFAULT CHARACTER SET = latin1; + + +-- ----------------------------------------------------- +-- Table `character_friends` +-- ----------------------------------------------------- +DROP TABLE IF EXISTS `character_friends` ; + +CREATE TABLE IF NOT EXISTS `character_friends` ( + `char_id` INT(11) NOT NULL DEFAULT '0', + `friend_id` INT(11) NOT NULL DEFAULT '0', + `friend_name` VARCHAR(35) NOT NULL DEFAULT '', + PRIMARY KEY (`char_id`, `friend_name`), + INDEX `fk_character_friends_characters2_idx` (`friend_id` ASC), + CONSTRAINT `fk_character_friends_characters1` + FOREIGN KEY (`char_id`) + REFERENCES `characters` (`obj_Id`) + ON DELETE NO ACTION + ON UPDATE NO ACTION, + CONSTRAINT `fk_character_friends_characters2` + FOREIGN KEY (`friend_id`) + REFERENCES `characters` (`obj_Id`) + ON DELETE NO ACTION + ON UPDATE NO ACTION) +ENGINE = InnoDB +DEFAULT CHARACTER SET = latin1; + + +-- ----------------------------------------------------- +-- Table `etcitem` +-- ----------------------------------------------------- +DROP TABLE IF EXISTS `etcitem` ; + +CREATE TABLE IF NOT EXISTS `etcitem` ( + `item_id` DECIMAL(11,0) NOT NULL DEFAULT '0', + `name` VARCHAR(100) NULL DEFAULT NULL, + `crystallizable` VARCHAR(5) NULL DEFAULT NULL, + `item_type` VARCHAR(15) NULL DEFAULT NULL, + `weight` DECIMAL(4,0) NULL DEFAULT NULL, + `consume_type` VARCHAR(9) NULL DEFAULT NULL, + `material` VARCHAR(11) NULL DEFAULT NULL, + `crystal_type` VARCHAR(4) NULL DEFAULT NULL, + `duration` DECIMAL(3,0) NULL DEFAULT NULL, + `price` DECIMAL(11,0) NULL DEFAULT NULL, + `crystal_count` INT(4) NULL DEFAULT NULL, + `sellable` VARCHAR(5) NULL DEFAULT NULL, + `dropable` VARCHAR(5) NULL DEFAULT NULL, + `destroyable` VARCHAR(5) NULL DEFAULT NULL, + `tradeable` VARCHAR(5) NULL DEFAULT NULL, + `oldname` VARCHAR(100) NOT NULL DEFAULT '', + `oldtype` VARCHAR(100) NOT NULL DEFAULT '', + PRIMARY KEY (`item_id`)) +ENGINE = InnoDB +DEFAULT CHARACTER SET = latin1; + + +-- ----------------------------------------------------- +-- Table `henna` +-- ----------------------------------------------------- +DROP TABLE IF EXISTS `henna` ; + +CREATE TABLE IF NOT EXISTS `henna` ( + `symbol_id` INT(11) NOT NULL DEFAULT '0', + `symbol_name` VARCHAR(45) NULL DEFAULT NULL, + `dye_id` INT(11) NULL DEFAULT NULL, + `dye_amount` INT(11) NULL DEFAULT NULL, + `price` INT(11) NULL DEFAULT NULL, + `stat_INT` DECIMAL(11,0) NULL DEFAULT NULL, + `stat_STR` DECIMAL(11,0) NULL DEFAULT NULL, + `stat_CON` DECIMAL(11,0) NULL DEFAULT NULL, + `stat_MEM` DECIMAL(11,0) NULL DEFAULT NULL, + `stat_DEX` DECIMAL(11,0) NULL DEFAULT NULL, + `stat_WIT` DECIMAL(11,0) NULL DEFAULT NULL, + PRIMARY KEY (`symbol_id`), + INDEX `fk_henna_etcitem1_idx` (`dye_id` ASC), + CONSTRAINT `fk_henna_etcitem1` + FOREIGN KEY (`dye_id`) + REFERENCES `etcitem` (`item_id`) + ON DELETE NO ACTION + ON UPDATE NO ACTION) +ENGINE = InnoDB +DEFAULT CHARACTER SET = latin1; + + +-- ----------------------------------------------------- +-- Table `character_hennas` +-- ----------------------------------------------------- +DROP TABLE IF EXISTS `character_hennas` ; + +CREATE TABLE IF NOT EXISTS `character_hennas` ( + `char_obj_id` INT(11) NOT NULL DEFAULT '0', + `symbol_id` INT(11) NULL DEFAULT NULL, + `slot` INT(11) NOT NULL DEFAULT '0', + `class_index` INT(1) NOT NULL DEFAULT '0', + PRIMARY KEY (`char_obj_id`, `slot`, `class_index`), + INDEX `fk_character_hennas_henna1_idx` (`symbol_id` ASC), + CONSTRAINT `fk_character_hennas_characters1` + FOREIGN KEY (`char_obj_id`) + REFERENCES `characters` (`obj_Id`) + ON DELETE NO ACTION + ON UPDATE NO ACTION, + CONSTRAINT `fk_character_hennas_henna1` + FOREIGN KEY (`symbol_id`) + REFERENCES `henna` (`symbol_id`) + ON DELETE NO ACTION + ON UPDATE NO ACTION) +ENGINE = InnoDB +DEFAULT CHARACTER SET = latin1; + + +-- ----------------------------------------------------- +-- Table `character_macroses` +-- ----------------------------------------------------- +DROP TABLE IF EXISTS `character_macroses` ; + +CREATE TABLE IF NOT EXISTS `character_macroses` ( + `char_obj_id` INT(11) NOT NULL DEFAULT '0', + `id` INT(11) NOT NULL DEFAULT '0', + `icon` INT(11) NULL DEFAULT NULL, + `name` VARCHAR(40) NULL DEFAULT NULL, + `descr` VARCHAR(80) NULL DEFAULT NULL, + `acronym` VARCHAR(4) NULL DEFAULT NULL, + `commands` VARCHAR(255) NULL DEFAULT NULL, + PRIMARY KEY (`char_obj_id`, `id`), + CONSTRAINT `fk_character_macroses_characters1` + FOREIGN KEY (`char_obj_id`) + REFERENCES `characters` (`obj_Id`) + ON DELETE NO ACTION + ON UPDATE NO ACTION) +ENGINE = InnoDB +DEFAULT CHARACTER SET = latin1; + + +-- ----------------------------------------------------- +-- Table `character_quests` +-- ----------------------------------------------------- +DROP TABLE IF EXISTS `character_quests` ; + +CREATE TABLE IF NOT EXISTS `character_quests` ( + `char_id` INT(11) NOT NULL DEFAULT '0', + `name` VARCHAR(40) NOT NULL DEFAULT '', + `var` VARCHAR(20) NOT NULL DEFAULT '', + `value` VARCHAR(255) NULL DEFAULT NULL, + `class_index` INT(1) NOT NULL DEFAULT '0', + PRIMARY KEY (`char_id`, `name`, `var`, `class_index`), + CONSTRAINT `fk_character_quests_characters1` + FOREIGN KEY (`char_id`) + REFERENCES `characters` (`obj_Id`) + ON DELETE NO ACTION + ON UPDATE NO ACTION) +ENGINE = InnoDB +DEFAULT CHARACTER SET = latin1; + + +-- ----------------------------------------------------- +-- Table `character_recipebook` +-- ----------------------------------------------------- +DROP TABLE IF EXISTS `character_recipebook` ; + +CREATE TABLE IF NOT EXISTS `character_recipebook` ( + `char_id` DECIMAL(11,0) NOT NULL DEFAULT '0', + `id` DECIMAL(11,0) NOT NULL DEFAULT '0', + `type` INT(11) NOT NULL DEFAULT '0', + PRIMARY KEY (`id`, `char_id`), + INDEX `fk_character_recipebook_characters1_idx` (`char_id` ASC), + CONSTRAINT `fk_character_recipebook_characters1` + FOREIGN KEY (`char_id`) + REFERENCES `characters` (`obj_Id`) + ON DELETE NO ACTION + ON UPDATE NO ACTION) +ENGINE = InnoDB +DEFAULT CHARACTER SET = latin1; + + +-- ----------------------------------------------------- +-- Table `character_recommends` +-- ----------------------------------------------------- +DROP TABLE IF EXISTS `character_recommends` ; + +CREATE TABLE IF NOT EXISTS `character_recommends` ( + `char_id` INT(11) NOT NULL DEFAULT '0', + `target_id` INT(11) NOT NULL DEFAULT '0', + PRIMARY KEY (`char_id`, `target_id`), + INDEX `fk_character_recommends_characters2_idx` (`target_id` ASC), + CONSTRAINT `fk_character_recommends_characters1` + FOREIGN KEY (`char_id`) + REFERENCES `characters` (`obj_Id`) + ON DELETE NO ACTION + ON UPDATE NO ACTION, + CONSTRAINT `fk_character_recommends_characters2` + FOREIGN KEY (`target_id`) + REFERENCES `characters` (`obj_Id`) + ON DELETE NO ACTION + ON UPDATE NO ACTION) +ENGINE = InnoDB +DEFAULT CHARACTER SET = latin1; + + +-- ----------------------------------------------------- +-- Table `character_shortcuts` +-- ----------------------------------------------------- +DROP TABLE IF EXISTS `character_shortcuts` ; + +CREATE TABLE IF NOT EXISTS `character_shortcuts` ( + `char_obj_id` DECIMAL(11,0) NOT NULL DEFAULT '0', + `slot` DECIMAL(3,0) NOT NULL DEFAULT '0', + `page` DECIMAL(3,0) NOT NULL DEFAULT '0', + `type` DECIMAL(3,0) NULL DEFAULT NULL, + `shortcut_id` DECIMAL(16,0) NULL DEFAULT NULL, + `level` VARCHAR(4) NULL DEFAULT NULL, + `class_index` INT(1) NOT NULL DEFAULT '0', + PRIMARY KEY (`char_obj_id`, `slot`, `page`, `class_index`), + INDEX `shortcut_id` (`shortcut_id` ASC), + CONSTRAINT `fk_character_shortcuts_characters1` + FOREIGN KEY (`char_obj_id`) + REFERENCES `characters` (`obj_Id`) + ON DELETE NO ACTION + ON UPDATE NO ACTION) +ENGINE = InnoDB +DEFAULT CHARACTER SET = latin1; + + +-- ----------------------------------------------------- +-- Table `character_skills` +-- ----------------------------------------------------- +DROP TABLE IF EXISTS `character_skills` ; + +CREATE TABLE IF NOT EXISTS `character_skills` ( + `char_obj_id` INT(11) NOT NULL DEFAULT '0', + `skill_id` INT(11) NOT NULL DEFAULT '0', + `skill_level` VARCHAR(5) NULL DEFAULT NULL, + `skill_name` VARCHAR(40) NULL DEFAULT NULL, + `class_index` INT(1) NOT NULL DEFAULT '0', + PRIMARY KEY (`char_obj_id`, `skill_id`, `class_index`), + CONSTRAINT `fk_character_skills_characters1` + FOREIGN KEY (`char_obj_id`) + REFERENCES `characters` (`obj_Id`) + ON DELETE NO ACTION + ON UPDATE NO ACTION) +ENGINE = InnoDB +DEFAULT CHARACTER SET = latin1; + + +-- ----------------------------------------------------- +-- Table `character_skills_save` +-- ----------------------------------------------------- +DROP TABLE IF EXISTS `character_skills_save` ; + +CREATE TABLE IF NOT EXISTS `character_skills_save` ( + `char_obj_id` INT(11) NOT NULL DEFAULT '0', + `skill_id` INT(11) NOT NULL DEFAULT '0', + `skill_level` INT(11) NOT NULL DEFAULT '0', + `effect_count` INT(11) NOT NULL DEFAULT '0', + `effect_cur_time` INT(11) NOT NULL DEFAULT '0', + `reuse_delay` INT(8) NOT NULL DEFAULT '0', + `restore_type` INT(1) NOT NULL DEFAULT '0', + `class_index` INT(1) NOT NULL DEFAULT '0', + `buff_index` INT(2) NOT NULL DEFAULT '0', + PRIMARY KEY (`char_obj_id`, `skill_id`, `class_index`), + CONSTRAINT `fk_character_skills_save_characters1` + FOREIGN KEY (`char_obj_id`) + REFERENCES `characters` (`obj_Id`) + ON DELETE NO ACTION + ON UPDATE NO ACTION) +ENGINE = InnoDB +DEFAULT CHARACTER SET = latin1; + + +-- ----------------------------------------------------- +-- Table `character_subclasses` +-- ----------------------------------------------------- +DROP TABLE IF EXISTS `character_subclasses` ; + +CREATE TABLE IF NOT EXISTS `character_subclasses` ( + `char_obj_id` DECIMAL(11,0) NOT NULL DEFAULT '0', + `class_id` INT(2) NOT NULL DEFAULT '0', + `exp` DECIMAL(20,0) NOT NULL DEFAULT '0', + `sp` DECIMAL(11,0) NOT NULL DEFAULT '0', + `level` INT(2) NOT NULL DEFAULT '40', + `class_index` INT(1) NOT NULL DEFAULT '0', + PRIMARY KEY (`char_obj_id`, `class_id`), + INDEX `fk_character_subclasses_char_templates1_idx` (`class_id` ASC), + CONSTRAINT `fk_character_subclasses_characters1` + FOREIGN KEY (`char_obj_id`) + REFERENCES `characters` (`obj_Id`) + ON DELETE NO ACTION + ON UPDATE NO ACTION, + CONSTRAINT `fk_character_subclasses_char_templates1` + FOREIGN KEY (`class_id`) + REFERENCES `char_templates` (`ClassId`) + ON DELETE NO ACTION + ON UPDATE NO ACTION) +ENGINE = InnoDB +DEFAULT CHARACTER SET = latin1; + + +-- ----------------------------------------------------- +-- Table `clan_privs` +-- ----------------------------------------------------- +DROP TABLE IF EXISTS `clan_privs` ; + +CREATE TABLE IF NOT EXISTS `clan_privs` ( + `clan_id` INT(11) NOT NULL DEFAULT '0', + `rank` INT(11) NOT NULL DEFAULT '0', + `party` INT(11) NOT NULL DEFAULT '0', + `privs` INT(11) NOT NULL DEFAULT '0', + PRIMARY KEY (`clan_id`, `rank`, `party`), + CONSTRAINT `fk_clan_privs_clan_data1` + FOREIGN KEY (`clan_id`) + REFERENCES `clan_data` (`clan_id`) + ON DELETE NO ACTION + ON UPDATE NO ACTION) +ENGINE = InnoDB +DEFAULT CHARACTER SET = latin1; + + +-- ----------------------------------------------------- +-- Table `clan_skills` +-- ----------------------------------------------------- +DROP TABLE IF EXISTS `clan_skills` ; + +CREATE TABLE IF NOT EXISTS `clan_skills` ( + `clan_id` INT(11) NOT NULL DEFAULT '0', + `skill_id` INT(11) NOT NULL DEFAULT '0', + `skill_level` INT(5) NOT NULL DEFAULT '0', + `skill_name` VARCHAR(26) NULL DEFAULT NULL, + PRIMARY KEY (`clan_id`, `skill_id`), + CONSTRAINT `fk_clan_skills_clan_data1` + FOREIGN KEY (`clan_id`) + REFERENCES `clan_data` (`clan_id`) + ON DELETE NO ACTION + ON UPDATE NO ACTION) +ENGINE = InnoDB +DEFAULT CHARACTER SET = latin1; + + +-- ----------------------------------------------------- +-- Table `clan_subpledges` +-- ----------------------------------------------------- +DROP TABLE IF EXISTS `clan_subpledges` ; + +CREATE TABLE IF NOT EXISTS `clan_subpledges` ( + `clan_id` INT(11) NOT NULL DEFAULT '0', + `sub_pledge_id` INT(11) NOT NULL DEFAULT '0', + `name` VARCHAR(45) NULL DEFAULT NULL, + `leader_name` VARCHAR(35) NULL DEFAULT NULL, + PRIMARY KEY (`clan_id`, `sub_pledge_id`), + CONSTRAINT `fk_clan_subpledges_clan_data1` + FOREIGN KEY (`clan_id`) + REFERENCES `clan_data` (`clan_id`) + ON DELETE NO ACTION + ON UPDATE NO ACTION) +ENGINE = InnoDB +DEFAULT CHARACTER SET = latin1; + + +-- ----------------------------------------------------- +-- Table `clan_wars` +-- ----------------------------------------------------- +DROP TABLE IF EXISTS `clan_wars` ; + +CREATE TABLE IF NOT EXISTS `clan_wars` ( + `clan1` VARCHAR(35) NOT NULL DEFAULT '', + `clan2` VARCHAR(35) NOT NULL DEFAULT '', + `wantspeace1` DECIMAL(1,0) NOT NULL DEFAULT '0', + `wantspeace2` DECIMAL(1,0) NOT NULL DEFAULT '0', + INDEX `fk_clan_wars_clan_data1_idx` (`clan1` ASC), + INDEX `fk_clan_wars_clan_data2_idx` (`clan2` ASC), + CONSTRAINT `fk_clan_wars_clan_data1` + FOREIGN KEY (`clan1`) + REFERENCES `clan_data` (`clan_id`) + ON DELETE NO ACTION + ON UPDATE NO ACTION, + CONSTRAINT `fk_clan_wars_clan_data2` + FOREIGN KEY (`clan2`) + REFERENCES `clan_data` (`clan_id`) + ON DELETE NO ACTION + ON UPDATE NO ACTION) +ENGINE = InnoDB +DEFAULT CHARACTER SET = latin1; + + +-- ----------------------------------------------------- +-- Table `clanhall_functions` +-- ----------------------------------------------------- +DROP TABLE IF EXISTS `clanhall_functions` ; + +CREATE TABLE IF NOT EXISTS `clanhall_functions` ( + `hall_id` INT(2) NOT NULL DEFAULT '0', + `type` INT(1) NOT NULL DEFAULT '0', + `lvl` INT(3) NOT NULL DEFAULT '0', + `lease` INT(10) NOT NULL DEFAULT '0', + `rate` DECIMAL(20,0) NOT NULL DEFAULT '0', + `endTime` DECIMAL(20,0) NOT NULL DEFAULT '0', + PRIMARY KEY (`hall_id`, `type`), + CONSTRAINT `fk_clanhall_functions_clanhall1` + FOREIGN KEY (`hall_id`) + REFERENCES `clanhall` (`id`) + ON DELETE NO ACTION + ON UPDATE NO ACTION) +ENGINE = InnoDB +DEFAULT CHARACTER SET = latin1; + + +-- ----------------------------------------------------- +-- Table `class_list` +-- ----------------------------------------------------- +DROP TABLE IF EXISTS `class_list` ; + +CREATE TABLE IF NOT EXISTS `class_list` ( + `class_name` VARCHAR(19) NOT NULL DEFAULT '', + `id` INT(10) UNSIGNED NOT NULL DEFAULT '0', + `parent_id` INT(11) NOT NULL DEFAULT '0', + PRIMARY KEY (`id`), + CONSTRAINT `fk_class_list_char_templates1` + FOREIGN KEY (`id`) + REFERENCES `char_templates` (`ClassId`) + ON DELETE NO ACTION + ON UPDATE NO ACTION) +ENGINE = InnoDB +DEFAULT CHARACTER SET = latin1; + + +-- ----------------------------------------------------- +-- Table `cursed_weapons` +-- ----------------------------------------------------- +DROP TABLE IF EXISTS `cursed_weapons` ; + +CREATE TABLE IF NOT EXISTS `cursed_weapons` ( + `itemId` INT(11) NOT NULL, + `playerId` INT(11) NULL DEFAULT '0', + `playerKarma` INT(11) NULL DEFAULT '0', + `playerPkKills` INT(11) NULL DEFAULT '0', + `nbKills` INT(11) NULL DEFAULT '0', + `endTime` DECIMAL(20,0) NULL DEFAULT '0', + PRIMARY KEY (`itemId`), + CONSTRAINT `fk_cursed_weapons_weapon1` + FOREIGN KEY (`itemId`) + REFERENCES `weapon` (`item_id`) + ON DELETE NO ACTION + ON UPDATE NO ACTION) +ENGINE = InnoDB +DEFAULT CHARACTER SET = latin1; + + +-- ----------------------------------------------------- +-- Table `dimensional_rift` +-- ----------------------------------------------------- +DROP TABLE IF EXISTS `dimensional_rift` ; + +CREATE TABLE IF NOT EXISTS `dimensional_rift` ( + `type` TINYINT(1) NOT NULL, + `room_id` TINYINT(1) NOT NULL, + `xMin` INT(11) NOT NULL, + `xMax` INT(11) NOT NULL, + `yMin` INT(11) NOT NULL, + `yMax` INT(11) NOT NULL, + `zMin` INT(11) NOT NULL, + `zMax` INT(11) NOT NULL, + `xT` INT(11) NOT NULL, + `yT` INT(11) NOT NULL, + `zT` INT(11) NOT NULL, + `boss` TINYINT(1) NOT NULL DEFAULT '0', + PRIMARY KEY (`type`, `room_id`)) +ENGINE = InnoDB +DEFAULT CHARACTER SET = latin1; + + +-- ----------------------------------------------------- +-- Table `droplist` +-- ----------------------------------------------------- +DROP TABLE IF EXISTS `droplist` ; + +CREATE TABLE IF NOT EXISTS `droplist` ( + `mobId` INT(11) NOT NULL DEFAULT '0', + `itemId` INT(11) NOT NULL DEFAULT '0', + `min` INT(11) NOT NULL DEFAULT '0', + `max` INT(11) NOT NULL DEFAULT '0', + `category` INT(11) NOT NULL DEFAULT '0', + `chance` INT(11) NOT NULL DEFAULT '0', + PRIMARY KEY (`mobId`, `itemId`, `category`), + INDEX `key_mobId` (`mobId` ASC), + CONSTRAINT `fk_droplist_npc1` + FOREIGN KEY (`mobId`) + REFERENCES `npc` (`id`) + ON DELETE NO ACTION + ON UPDATE NO ACTION) +ENGINE = InnoDB +DEFAULT CHARACTER SET = latin1; + + +-- ----------------------------------------------------- +-- Table `enchant_skill_trees` +-- ----------------------------------------------------- +DROP TABLE IF EXISTS `enchant_skill_trees` ; + +CREATE TABLE IF NOT EXISTS `enchant_skill_trees` ( + `skill_id` INT(10) NOT NULL DEFAULT '0', + `level` INT(10) NOT NULL DEFAULT '0', + `name` VARCHAR(25) NOT NULL DEFAULT '', + `base_lvl` INT(2) NOT NULL DEFAULT '0', + `enchant_type` VARCHAR(25) NULL DEFAULT NULL, + `sp` INT(10) NOT NULL DEFAULT '0', + `exp` INT(20) NULL DEFAULT NULL, + `min_skill_lvl` INT(2) NOT NULL DEFAULT '0', + `success_rate76` INT(3) UNSIGNED NOT NULL DEFAULT '0', + `success_rate77` INT(3) NOT NULL DEFAULT '0', + `success_rate78` INT(3) NOT NULL DEFAULT '0', + PRIMARY KEY (`skill_id`, `level`)) +ENGINE = InnoDB +DEFAULT CHARACTER SET = latin1; + + +-- ----------------------------------------------------- +-- Table `fish` +-- ----------------------------------------------------- +DROP TABLE IF EXISTS `fish` ; + +CREATE TABLE IF NOT EXISTS `fish` ( + `id` INT(5) NOT NULL DEFAULT '0', + `level` INT(5) NOT NULL DEFAULT '0', + `name` VARCHAR(40) NOT NULL DEFAULT '', + `hp` INT(5) NOT NULL DEFAULT '0', + `hpregen` INT(3) NOT NULL DEFAULT '5', + `fish_type` INT(1) NOT NULL DEFAULT '0', + `fish_group` INT(1) NOT NULL DEFAULT '0', + `fish_guts` INT(4) NOT NULL DEFAULT '0', + `guts_check_time` INT(4) NOT NULL DEFAULT '0', + `wait_time` INT(5) NOT NULL DEFAULT '0', + `combat_time` INT(5) NOT NULL DEFAULT '0', + PRIMARY KEY (`id`, `level`)) +ENGINE = InnoDB +DEFAULT CHARACTER SET = latin1; + + +-- ----------------------------------------------------- +-- Table `fishing_skill_trees` +-- ----------------------------------------------------- +DROP TABLE IF EXISTS `fishing_skill_trees` ; + +CREATE TABLE IF NOT EXISTS `fishing_skill_trees` ( + `skill_id` INT(10) NOT NULL DEFAULT '0', + `level` INT(10) NOT NULL DEFAULT '0', + `name` VARCHAR(25) NOT NULL DEFAULT '', + `sp` INT(10) NOT NULL DEFAULT '0', + `min_level` INT(10) NOT NULL DEFAULT '0', + `costid` INT(10) NOT NULL DEFAULT '0', + `cost` INT(10) NOT NULL DEFAULT '0', + `isfordwarf` INT(1) NOT NULL DEFAULT '0', + PRIMARY KEY (`skill_id`, `level`)) +ENGINE = InnoDB +DEFAULT CHARACTER SET = latin1; + + +-- ----------------------------------------------------- +-- Table `forums` +-- ----------------------------------------------------- +DROP TABLE IF EXISTS `forums` ; + +CREATE TABLE IF NOT EXISTS `forums` ( + `forum_id` INT(8) NOT NULL DEFAULT '0', + `forum_name` VARCHAR(255) NOT NULL DEFAULT '', + `forum_parent` INT(8) NOT NULL DEFAULT '0', + `forum_post` INT(8) NOT NULL DEFAULT '0', + `forum_type` INT(8) NOT NULL DEFAULT '0', + `forum_perm` INT(8) NOT NULL DEFAULT '0', + `forum_owner_id` INT(8) NOT NULL DEFAULT '0', + UNIQUE INDEX `forum_id` (`forum_id` ASC)) +ENGINE = InnoDB +DEFAULT CHARACTER SET = latin1; + + +-- ----------------------------------------------------- +-- Table `games` +-- ----------------------------------------------------- +DROP TABLE IF EXISTS `games` ; + +CREATE TABLE IF NOT EXISTS `games` ( + `id` INT(11) NOT NULL DEFAULT '0', + `idnr` INT(11) NOT NULL DEFAULT '0', + `number1` INT(11) NOT NULL DEFAULT '0', + `number2` INT(11) NOT NULL DEFAULT '0', + `prize` INT(11) NOT NULL DEFAULT '0', + `newprize` INT(11) NOT NULL DEFAULT '0', + `prize1` INT(11) NOT NULL DEFAULT '0', + `prize2` INT(11) NOT NULL DEFAULT '0', + `prize3` INT(11) NOT NULL DEFAULT '0', + `enddate` DECIMAL(20,0) NOT NULL DEFAULT '0', + `finished` INT(11) NOT NULL DEFAULT '0', + PRIMARY KEY (`id`, `idnr`)) +ENGINE = InnoDB +DEFAULT CHARACTER SET = latin1; + + +-- ----------------------------------------------------- +-- Table `gameservers` +-- ----------------------------------------------------- +DROP TABLE IF EXISTS `gameservers` ; + +CREATE TABLE IF NOT EXISTS `gameservers` ( + `server_id` INT(11) NOT NULL DEFAULT '0', + `hexid` VARCHAR(50) NOT NULL DEFAULT '', + `host` VARCHAR(50) NOT NULL DEFAULT '', + PRIMARY KEY (`server_id`)) +ENGINE = InnoDB +DEFAULT CHARACTER SET = latin1; + + +-- ----------------------------------------------------- +-- Table `global_tasks` +-- ----------------------------------------------------- +DROP TABLE IF EXISTS `global_tasks` ; + +CREATE TABLE IF NOT EXISTS `global_tasks` ( + `id` INT(11) NOT NULL AUTO_INCREMENT, + `task` VARCHAR(50) NOT NULL DEFAULT '', + `type` VARCHAR(50) NOT NULL DEFAULT '', + `last_activation` DECIMAL(20,0) NOT NULL DEFAULT '0', + `param1` VARCHAR(100) NOT NULL DEFAULT '', + `param2` VARCHAR(100) NOT NULL DEFAULT '', + `param3` VARCHAR(255) NOT NULL DEFAULT '', + PRIMARY KEY (`id`)) +ENGINE = InnoDB +DEFAULT CHARACTER SET = latin1; + + +-- ----------------------------------------------------- +-- Table `helper_buff_list` +-- ----------------------------------------------------- +DROP TABLE IF EXISTS `helper_buff_list` ; + +CREATE TABLE IF NOT EXISTS `helper_buff_list` ( + `id` INT(11) NOT NULL DEFAULT '0', + `skill_id` INT(10) UNSIGNED NOT NULL DEFAULT '0', + `name` VARCHAR(25) NOT NULL DEFAULT '', + `skill_level` INT(10) UNSIGNED NOT NULL DEFAULT '0', + `lower_level` INT(10) UNSIGNED NOT NULL DEFAULT '0', + `upper_level` INT(10) UNSIGNED NOT NULL DEFAULT '0', + `is_magic_class` VARCHAR(5) NULL DEFAULT NULL, + PRIMARY KEY (`id`)) +ENGINE = InnoDB +DEFAULT CHARACTER SET = latin1; + + +-- ----------------------------------------------------- +-- Table `henna_trees` +-- ----------------------------------------------------- +DROP TABLE IF EXISTS `henna_trees` ; + +CREATE TABLE IF NOT EXISTS `henna_trees` ( + `class_id` DECIMAL(10,0) NOT NULL DEFAULT '0', + `symbol_id` DECIMAL(10,0) NOT NULL DEFAULT '0', + PRIMARY KEY (`class_id`, `symbol_id`), + INDEX `fk_henna_trees_henna1_idx` (`symbol_id` ASC), + CONSTRAINT `fk_henna_trees_char_templates1` + FOREIGN KEY (`class_id`) + REFERENCES `char_templates` (`ClassId`) + ON DELETE NO ACTION + ON UPDATE NO ACTION, + CONSTRAINT `fk_henna_trees_henna1` + FOREIGN KEY (`symbol_id`) + REFERENCES `henna` (`symbol_id`) + ON DELETE NO ACTION + ON UPDATE NO ACTION) +ENGINE = InnoDB +DEFAULT CHARACTER SET = latin1; + + +-- ----------------------------------------------------- +-- Table `heroes` +-- ----------------------------------------------------- +DROP TABLE IF EXISTS `heroes` ; + +CREATE TABLE IF NOT EXISTS `heroes` ( + `char_id` DECIMAL(11,0) NOT NULL DEFAULT '0', + `char_name` VARCHAR(45) NOT NULL DEFAULT '', + `class_id` DECIMAL(3,0) NOT NULL DEFAULT '0', + `count` DECIMAL(3,0) NOT NULL DEFAULT '0', + `played` DECIMAL(1,0) NOT NULL DEFAULT '0', + PRIMARY KEY (`char_id`), + INDEX `fk_heroes_char_templates1_idx` (`class_id` ASC), + CONSTRAINT `fk_heroes_characters1` + FOREIGN KEY (`char_id`) + REFERENCES `characters` (`obj_Id`) + ON DELETE NO ACTION + ON UPDATE NO ACTION, + CONSTRAINT `fk_heroes_char_templates1` + FOREIGN KEY (`class_id`) + REFERENCES `char_templates` (`ClassId`) + ON DELETE NO ACTION + ON UPDATE NO ACTION) +ENGINE = InnoDB +DEFAULT CHARACTER SET = latin1; + + +-- ----------------------------------------------------- +-- Table `items` +-- ----------------------------------------------------- +DROP TABLE IF EXISTS `items` ; + +CREATE TABLE IF NOT EXISTS `items` ( + `owner_id` INT(11) NULL DEFAULT NULL, + `object_id` INT(11) NOT NULL DEFAULT '0', + `item_id` INT(11) NULL DEFAULT NULL, + `count` INT(11) NULL DEFAULT NULL, + `enchant_level` INT(11) NULL DEFAULT NULL, + `loc` VARCHAR(10) NULL DEFAULT NULL, + `loc_data` INT(11) NULL DEFAULT NULL, + `price_sell` INT(11) NULL DEFAULT NULL, + `price_buy` INT(11) NULL DEFAULT NULL, + `time_of_use` INT(11) NULL DEFAULT NULL, + `custom_type1` INT(11) NULL DEFAULT '0', + `custom_type2` INT(11) NULL DEFAULT '0', + `mana_left` DECIMAL(3,0) NOT NULL DEFAULT '-1', + PRIMARY KEY (`object_id`), + INDEX `key_owner_id` (`owner_id` ASC), + INDEX `key_loc` (`loc` ASC), + INDEX `key_item_id` (`item_id` ASC), + INDEX `key_time_of_use` (`time_of_use` ASC)) +ENGINE = InnoDB +DEFAULT CHARACTER SET = latin1; + + +-- ----------------------------------------------------- +-- Table `itemsonground` +-- ----------------------------------------------------- +DROP TABLE IF EXISTS `itemsonground` ; + +CREATE TABLE IF NOT EXISTS `itemsonground` ( + `object_id` INT(11) NOT NULL DEFAULT '0', + `item_id` INT(11) NULL DEFAULT NULL, + `count` INT(11) NULL DEFAULT NULL, + `enchant_level` INT(11) NULL DEFAULT NULL, + `x` INT(11) NULL DEFAULT NULL, + `y` INT(11) NULL DEFAULT NULL, + `z` INT(11) NULL DEFAULT NULL, + `drop_time` DECIMAL(20,0) NULL DEFAULT NULL, + `equipable` INT(1) NULL DEFAULT '0', + PRIMARY KEY (`object_id`), + CONSTRAINT `fk_itemsonground_items1` + FOREIGN KEY (`object_id`) + REFERENCES `items` (`object_id`) + ON DELETE NO ACTION + ON UPDATE NO ACTION) +ENGINE = InnoDB +DEFAULT CHARACTER SET = latin1; + + +-- ----------------------------------------------------- +-- Table `locations` +-- ----------------------------------------------------- +DROP TABLE IF EXISTS `locations` ; + +CREATE TABLE IF NOT EXISTS `locations` ( + `loc_id` INT(9) NOT NULL DEFAULT '0', + `loc_x` INT(9) NOT NULL DEFAULT '0', + `loc_y` INT(9) NOT NULL DEFAULT '0', + `loc_zmin` INT(9) NOT NULL DEFAULT '0', + `loc_zmax` INT(9) NOT NULL DEFAULT '0', + `proc` INT(3) NOT NULL DEFAULT '0', + PRIMARY KEY (`loc_id`, `loc_x`, `loc_y`), + INDEX `proc` (`proc` ASC)) +ENGINE = InnoDB +DEFAULT CHARACTER SET = latin1; + + +-- ----------------------------------------------------- +-- Table `lvlupgain` +-- ----------------------------------------------------- +DROP TABLE IF EXISTS `lvlupgain` ; + +CREATE TABLE IF NOT EXISTS `lvlupgain` ( + `classid` INT(3) NOT NULL DEFAULT '0', + `defaulthpbase` DECIMAL(5,1) NOT NULL DEFAULT '0.0', + `defaulthpadd` DECIMAL(4,2) NOT NULL DEFAULT '0.00', + `defaulthpmod` DECIMAL(4,2) NOT NULL DEFAULT '0.00', + `defaultcpbase` DECIMAL(5,1) NOT NULL DEFAULT '0.0', + `defaultcpadd` DECIMAL(4,2) NOT NULL DEFAULT '0.00', + `defaultcpmod` DECIMAL(4,2) NOT NULL DEFAULT '0.00', + `defaultmpbase` DECIMAL(5,1) NOT NULL DEFAULT '0.0', + `defaultmpadd` DECIMAL(4,2) NOT NULL DEFAULT '0.00', + `defaultmpmod` DECIMAL(4,2) NOT NULL DEFAULT '0.00', + `class_lvl` INT(3) NOT NULL DEFAULT '0', + PRIMARY KEY (`classid`), + CONSTRAINT `fk_lvlupgain_char_templates1` + FOREIGN KEY (`classid`) + REFERENCES `char_templates` (`ClassId`) + ON DELETE NO ACTION + ON UPDATE NO ACTION) +ENGINE = InnoDB +DEFAULT CHARACTER SET = latin1; + + +-- ----------------------------------------------------- +-- Table `mapregion` +-- ----------------------------------------------------- +DROP TABLE IF EXISTS `mapregion` ; + +CREATE TABLE IF NOT EXISTS `mapregion` ( + `region` INT(11) NOT NULL DEFAULT '0', + `sec0` INT(2) NOT NULL DEFAULT '0', + `sec1` INT(2) NOT NULL DEFAULT '0', + `sec2` INT(2) NOT NULL DEFAULT '0', + `sec3` INT(2) NOT NULL DEFAULT '0', + `sec4` INT(2) NOT NULL DEFAULT '0', + `sec5` INT(2) NOT NULL DEFAULT '0', + `sec6` INT(2) NOT NULL DEFAULT '0', + `sec7` INT(2) NOT NULL DEFAULT '0', + `sec8` INT(2) NOT NULL DEFAULT '0', + `sec9` INT(2) NOT NULL DEFAULT '0', + PRIMARY KEY (`region`)) +ENGINE = InnoDB +DEFAULT CHARACTER SET = latin1; + + +-- ----------------------------------------------------- +-- Table `merchant_areas_list` +-- ----------------------------------------------------- +DROP TABLE IF EXISTS `merchant_areas_list` ; + +CREATE TABLE IF NOT EXISTS `merchant_areas_list` ( + `merchant_area_id` INT(10) UNSIGNED NOT NULL DEFAULT '0', + `merchant_area_name` VARCHAR(25) NOT NULL DEFAULT '', + `tax` DOUBLE(3,2) UNSIGNED NOT NULL DEFAULT '0.00', + `Chaotic` INT(11) NOT NULL DEFAULT '0', + PRIMARY KEY (`merchant_area_id`)) +ENGINE = InnoDB +DEFAULT CHARACTER SET = latin1; + + +-- ----------------------------------------------------- +-- Table `merchants` +-- ----------------------------------------------------- +DROP TABLE IF EXISTS `merchants` ; + +CREATE TABLE IF NOT EXISTS `merchants` ( + `npc_id` INT(11) NOT NULL DEFAULT '0', + `merchant_area_id` TINYINT(4) NULL DEFAULT NULL, + PRIMARY KEY (`npc_id`), + INDEX `fk_merchants_merchant_areas_list1_idx` (`merchant_area_id` ASC), + CONSTRAINT `fk_merchants_npc1` + FOREIGN KEY (`npc_id`) + REFERENCES `npc` (`id`) + ON DELETE NO ACTION + ON UPDATE NO ACTION, + CONSTRAINT `fk_merchants_merchant_areas_list1` + FOREIGN KEY (`merchant_area_id`) + REFERENCES `merchant_areas_list` (`merchant_area_id`) + ON DELETE NO ACTION + ON UPDATE NO ACTION) +ENGINE = InnoDB +DEFAULT CHARACTER SET = latin1; + + +-- ----------------------------------------------------- +-- Table `merchant_shopids` +-- ----------------------------------------------------- +DROP TABLE IF EXISTS `merchant_shopids` ; + +CREATE TABLE IF NOT EXISTS `merchant_shopids` ( + `shop_id` DECIMAL(9,0) NOT NULL DEFAULT '0', + `npc_id` VARCHAR(9) NULL DEFAULT NULL, + PRIMARY KEY (`shop_id`), + INDEX `fk_merchant_shopids_merchants1_idx` (`npc_id` ASC), + CONSTRAINT `fk_merchant_shopids_merchants1` + FOREIGN KEY (`npc_id`) + REFERENCES `merchants` (`npc_id`) + ON DELETE NO ACTION + ON UPDATE NO ACTION) +ENGINE = InnoDB +DEFAULT CHARACTER SET = latin1; + + +-- ----------------------------------------------------- +-- Table `merchant_buylists` +-- ----------------------------------------------------- +DROP TABLE IF EXISTS `merchant_buylists` ; + +CREATE TABLE IF NOT EXISTS `merchant_buylists` ( + `item_id` DECIMAL(9,0) NOT NULL DEFAULT '0', + `price` DECIMAL(11,0) NOT NULL DEFAULT '0', + `shop_id` DECIMAL(9,0) NOT NULL DEFAULT '0', + `order` DECIMAL(4,0) NOT NULL DEFAULT '0', + `count` INT(11) NOT NULL DEFAULT '-1', + `currentCount` INT(11) NOT NULL DEFAULT '-1', + `time` INT(11) NOT NULL DEFAULT '0', + `savetimer` DECIMAL(20,0) NOT NULL DEFAULT '0', + PRIMARY KEY (`shop_id`, `order`), + CONSTRAINT `fk_merchant_buylists_merchant_shopids1` + FOREIGN KEY (`shop_id`) + REFERENCES `merchant_shopids` (`shop_id`) + ON DELETE NO ACTION + ON UPDATE NO ACTION) +ENGINE = InnoDB +DEFAULT CHARACTER SET = latin1; + + +-- ----------------------------------------------------- +-- Table `merchant_lease` +-- ----------------------------------------------------- +DROP TABLE IF EXISTS `merchant_lease` ; + +CREATE TABLE IF NOT EXISTS `merchant_lease` ( + `merchant_id` INT(11) NOT NULL DEFAULT '0', + `player_id` INT(11) NOT NULL DEFAULT '0', + `bid` INT(11) NULL DEFAULT NULL, + `type` INT(11) NOT NULL DEFAULT '0', + `player_name` VARCHAR(35) NULL DEFAULT NULL, + PRIMARY KEY (`merchant_id`, `player_id`, `type`), + INDEX `fk_merchant_lease_characters1_idx` (`player_id` ASC), + CONSTRAINT `fk_merchant_lease_characters1` + FOREIGN KEY (`player_id`) + REFERENCES `characters` (`obj_Id`) + ON DELETE NO ACTION + ON UPDATE NO ACTION, + CONSTRAINT `fk_merchant_lease_merchants1` + FOREIGN KEY (`merchant_id`) + REFERENCES `merchants` (`npc_id`) + ON DELETE NO ACTION + ON UPDATE NO ACTION) +ENGINE = InnoDB +DEFAULT CHARACTER SET = latin1; + + +-- ----------------------------------------------------- +-- Table `minions` +-- ----------------------------------------------------- +DROP TABLE IF EXISTS `minions` ; + +CREATE TABLE IF NOT EXISTS `minions` ( + `boss_id` INT(11) NOT NULL DEFAULT '0', + `minion_id` INT(11) NOT NULL DEFAULT '0', + `amount_min` INT(4) NOT NULL DEFAULT '0', + `amount_max` INT(4) NOT NULL DEFAULT '0', + PRIMARY KEY (`boss_id`, `minion_id`), + INDEX `fk_minions_npc2_idx` (`minion_id` ASC), + CONSTRAINT `fk_minions_npc1` + FOREIGN KEY (`boss_id`) + REFERENCES `npc` (`id`) + ON DELETE NO ACTION + ON UPDATE NO ACTION, + CONSTRAINT `fk_minions_npc2` + FOREIGN KEY (`minion_id`) + REFERENCES `npc` (`id`) + ON DELETE NO ACTION + ON UPDATE NO ACTION) +ENGINE = InnoDB +DEFAULT CHARACTER SET = latin1; + + +-- ----------------------------------------------------- +-- Table `mods_wedding` +-- ----------------------------------------------------- +DROP TABLE IF EXISTS `mods_wedding` ; + +CREATE TABLE IF NOT EXISTS `mods_wedding` ( + `id` INT(11) NOT NULL AUTO_INCREMENT, + `player1Id` INT(11) NOT NULL DEFAULT '0', + `player2Id` INT(11) NOT NULL DEFAULT '0', + `married` VARCHAR(5) NULL DEFAULT NULL, + `affianceDate` DECIMAL(20,0) NULL DEFAULT '0', + `weddingDate` DECIMAL(20,0) NULL DEFAULT '0', + PRIMARY KEY (`id`), + INDEX `fk_mods_wedding_characters1_idx` (`player1Id` ASC), + INDEX `fk_mods_wedding_characters2_idx` (`player2Id` ASC), + CONSTRAINT `fk_mods_wedding_characters1` + FOREIGN KEY (`player1Id`) + REFERENCES `characters` (`obj_Id`) + ON DELETE NO ACTION + ON UPDATE NO ACTION, + CONSTRAINT `fk_mods_wedding_characters2` + FOREIGN KEY (`player2Id`) + REFERENCES `characters` (`obj_Id`) + ON DELETE NO ACTION + ON UPDATE NO ACTION) +ENGINE = InnoDB +DEFAULT CHARACTER SET = latin1; + + +-- ----------------------------------------------------- +-- Table `npcskills` +-- ----------------------------------------------------- +DROP TABLE IF EXISTS `npcskills` ; + +CREATE TABLE IF NOT EXISTS `npcskills` ( + `npcid` INT(11) NOT NULL DEFAULT '0', + `skillid` INT(11) NOT NULL DEFAULT '0', + `level` INT(11) NOT NULL DEFAULT '0', + PRIMARY KEY (`npcid`, `skillid`, `level`), + CONSTRAINT `fk_npcskills_npc1` + FOREIGN KEY (`npcid`) + REFERENCES `npc` (`id`) + ON DELETE NO ACTION + ON UPDATE NO ACTION) +ENGINE = InnoDB +DEFAULT CHARACTER SET = latin1; + + +-- ----------------------------------------------------- +-- Table `olympiad_nobles` +-- ----------------------------------------------------- +DROP TABLE IF EXISTS `olympiad_nobles` ; + +CREATE TABLE IF NOT EXISTS `olympiad_nobles` ( + `char_id` DECIMAL(11,0) NOT NULL DEFAULT '0', + `class_id` DECIMAL(3,0) NOT NULL DEFAULT '0', + `char_name` VARCHAR(45) NOT NULL DEFAULT '', + `olympiad_points` DECIMAL(10,0) NOT NULL DEFAULT '0', + `competitions_done` DECIMAL(3,0) NOT NULL DEFAULT '0', + PRIMARY KEY (`char_id`), + INDEX `fk_olympiad_nobles_char_templates1_idx` (`class_id` ASC), + CONSTRAINT `fk_olympiad_nobles_characters1` + FOREIGN KEY (`char_id`) + REFERENCES `characters` (`obj_Id`) + ON DELETE NO ACTION + ON UPDATE NO ACTION, + CONSTRAINT `fk_olympiad_nobles_char_templates1` + FOREIGN KEY (`class_id`) + REFERENCES `char_templates` (`ClassId`) + ON DELETE NO ACTION + ON UPDATE NO ACTION) +ENGINE = InnoDB +DEFAULT CHARACTER SET = latin1; + + +-- ----------------------------------------------------- +-- Table `pets` +-- ----------------------------------------------------- +DROP TABLE IF EXISTS `pets` ; + +CREATE TABLE IF NOT EXISTS `pets` ( + `item_obj_id` DECIMAL(11,0) NOT NULL DEFAULT '0', + `name` VARCHAR(16) NULL DEFAULT NULL, + `level` DECIMAL(11,0) NULL DEFAULT NULL, + `curHp` DECIMAL(18,0) NULL DEFAULT NULL, + `curMp` DECIMAL(18,0) NULL DEFAULT NULL, + `exp` DECIMAL(20,0) NULL DEFAULT NULL, + `sp` DECIMAL(11,0) NULL DEFAULT NULL, + `karma` DECIMAL(11,0) NULL DEFAULT NULL, + `pkkills` DECIMAL(11,0) NULL DEFAULT NULL, + `fed` DECIMAL(11,0) NULL DEFAULT NULL, + PRIMARY KEY (`item_obj_id`), + CONSTRAINT `fk_pets_items1` + FOREIGN KEY (`item_obj_id`) + REFERENCES `items` (`object_id`) + ON DELETE NO ACTION + ON UPDATE NO ACTION) +ENGINE = InnoDB +DEFAULT CHARACTER SET = latin1; + + +-- ----------------------------------------------------- +-- Table `pets_stats` +-- ----------------------------------------------------- +DROP TABLE IF EXISTS `pets_stats` ; + +CREATE TABLE IF NOT EXISTS `pets_stats` ( + `type` VARCHAR(25) NOT NULL DEFAULT '', + `typeID` INT(5) NOT NULL DEFAULT '0', + `level` INT(11) NOT NULL DEFAULT '0', + `expMax` INT(20) NOT NULL DEFAULT '0', + `hpMax` INT(11) NOT NULL DEFAULT '0', + `mpMax` INT(11) NOT NULL DEFAULT '0', + `patk` INT(11) NOT NULL DEFAULT '0', + `pdef` INT(11) NOT NULL DEFAULT '0', + `matk` INT(11) NOT NULL DEFAULT '0', + `mdef` INT(11) NOT NULL DEFAULT '0', + `acc` INT(11) NOT NULL DEFAULT '0', + `evasion` INT(11) NOT NULL DEFAULT '0', + `crit` INT(11) NOT NULL DEFAULT '0', + `speed` INT(11) NOT NULL DEFAULT '0', + `atk_speed` INT(11) NOT NULL DEFAULT '0', + `cast_speed` INT(11) NOT NULL DEFAULT '0', + `feedMax` INT(11) NOT NULL DEFAULT '0', + `feedbattle` INT(11) NOT NULL DEFAULT '0', + `feednormal` INT(11) NOT NULL DEFAULT '0', + `loadMax` INT(11) NOT NULL DEFAULT '0', + `hpregen` INT(11) NOT NULL DEFAULT '0', + `mpregen` INT(11) NOT NULL DEFAULT '0', + `owner_exp_taken` DECIMAL(3,2) NOT NULL DEFAULT '0.00', + PRIMARY KEY (`typeID`, `level`)) +ENGINE = InnoDB +DEFAULT CHARACTER SET = latin1; + + +-- ----------------------------------------------------- +-- Table `pledge_skill_trees` +-- ----------------------------------------------------- +DROP TABLE IF EXISTS `pledge_skill_trees` ; + +CREATE TABLE IF NOT EXISTS `pledge_skill_trees` ( + `skill_id` INT(11) NULL DEFAULT NULL, + `level` INT(11) NULL DEFAULT NULL, + `name` VARCHAR(25) NULL DEFAULT NULL, + `clan_lvl` INT(11) NULL DEFAULT NULL, + `Description` VARCHAR(255) NULL DEFAULT NULL, + `repCost` INT(11) NULL DEFAULT NULL, + `itemId` INT(11) NULL DEFAULT NULL, + INDEX `fk_pledge_skill_trees_etcitem1_idx` (`itemId` ASC), + CONSTRAINT `fk_pledge_skill_trees_etcitem1` + FOREIGN KEY (`itemId`) + REFERENCES `etcitem` (`item_id`) + ON DELETE NO ACTION + ON UPDATE NO ACTION) +ENGINE = InnoDB +DEFAULT CHARACTER SET = latin1; + + +-- ----------------------------------------------------- +-- Table `topic` +-- ----------------------------------------------------- +DROP TABLE IF EXISTS `topic` ; + +CREATE TABLE IF NOT EXISTS `topic` ( + `topic_id` INT(8) NOT NULL DEFAULT '0', + `topic_forum_id` INT(8) NOT NULL DEFAULT '0', + `topic_name` VARCHAR(255) NOT NULL DEFAULT '', + `topic_date` DECIMAL(20,0) NOT NULL DEFAULT '0', + `topic_ownername` VARCHAR(255) NOT NULL DEFAULT '0', + `topic_ownerid` INT(8) NOT NULL DEFAULT '0', + `topic_type` INT(8) NOT NULL DEFAULT '0', + `topic_reply` INT(8) NOT NULL DEFAULT '0', + INDEX `fk_topic_forums1_idx` (`topic_forum_id` ASC), + CONSTRAINT `fk_topic_forums1` + FOREIGN KEY (`topic_forum_id`) + REFERENCES `forums` (`forum_id`) + ON DELETE NO ACTION + ON UPDATE NO ACTION) +ENGINE = InnoDB +DEFAULT CHARACTER SET = latin1; + + +-- ----------------------------------------------------- +-- Table `posts` +-- ----------------------------------------------------- +DROP TABLE IF EXISTS `posts` ; + +CREATE TABLE IF NOT EXISTS `posts` ( + `post_id` INT(8) NOT NULL DEFAULT '0', + `post_owner_name` VARCHAR(255) NOT NULL DEFAULT '', + `post_ownerid` INT(8) NOT NULL DEFAULT '0', + `post_date` DECIMAL(20,0) NOT NULL DEFAULT '0', + `post_topic_id` INT(8) NOT NULL DEFAULT '0', + `post_forum_id` INT(8) NOT NULL DEFAULT '0', + `post_txt` TEXT NOT NULL, + INDEX `fk_posts_forums1_idx` (`post_forum_id` ASC), + INDEX `fk_posts_topic1_idx` (`post_topic_id` ASC), + CONSTRAINT `fk_posts_forums1` + FOREIGN KEY (`post_forum_id`) + REFERENCES `forums` (`forum_id`) + ON DELETE NO ACTION + ON UPDATE NO ACTION, + CONSTRAINT `fk_posts_topic1` + FOREIGN KEY (`post_topic_id`) + REFERENCES `topic` (`topic_id`) + ON DELETE NO ACTION + ON UPDATE NO ACTION) +ENGINE = InnoDB +DEFAULT CHARACTER SET = latin1; + + +-- ----------------------------------------------------- +-- Table `quest_global_data` +-- ----------------------------------------------------- +DROP TABLE IF EXISTS `quest_global_data` ; + +CREATE TABLE IF NOT EXISTS `quest_global_data` ( + `quest_name` VARCHAR(40) NOT NULL DEFAULT '', + `var` VARCHAR(20) NOT NULL DEFAULT '', + `value` VARCHAR(255) NULL DEFAULT NULL, + PRIMARY KEY (`quest_name`, `var`)) +ENGINE = InnoDB +DEFAULT CHARACTER SET = latin1; + + +-- ----------------------------------------------------- +-- Table `raidboss_spawnlist` +-- ----------------------------------------------------- +DROP TABLE IF EXISTS `raidboss_spawnlist` ; + +CREATE TABLE IF NOT EXISTS `raidboss_spawnlist` ( + `boss_id` INT(11) NOT NULL DEFAULT '0', + `amount` INT(11) NOT NULL DEFAULT '0', + `loc_x` INT(11) NOT NULL DEFAULT '0', + `loc_y` INT(11) NOT NULL DEFAULT '0', + `loc_z` INT(11) NOT NULL DEFAULT '0', + `heading` INT(11) NOT NULL DEFAULT '0', + `respawn_min_delay` INT(11) NOT NULL DEFAULT '43200', + `respawn_max_delay` INT(11) NOT NULL DEFAULT '129600', + `respawn_time` BIGINT(20) NOT NULL DEFAULT '0', + `currentHp` DECIMAL(8,0) NULL DEFAULT NULL, + `currentMp` DECIMAL(8,0) NULL DEFAULT NULL, + PRIMARY KEY (`boss_id`, `loc_x`, `loc_y`, `loc_z`), + CONSTRAINT `fk_raidboss_spawnlist_npc1` + FOREIGN KEY (`boss_id`) + REFERENCES `npc` (`id`) + ON DELETE NO ACTION + ON UPDATE NO ACTION) +ENGINE = InnoDB +DEFAULT CHARACTER SET = latin1; + + +-- ----------------------------------------------------- +-- Table `random_spawn` +-- ----------------------------------------------------- +DROP TABLE IF EXISTS `random_spawn` ; + +CREATE TABLE IF NOT EXISTS `random_spawn` ( + `groupId` INT(11) NOT NULL DEFAULT '0', + `npcId` INT(11) NOT NULL DEFAULT '0', + `count` INT(11) NOT NULL DEFAULT '0', + `initialDelay` BIGINT(20) NOT NULL DEFAULT '-1', + `respawnDelay` BIGINT(20) NOT NULL DEFAULT '-1', + `despawnDelay` BIGINT(20) NOT NULL DEFAULT '-1', + `broadcastSpawn` VARCHAR(5) NOT NULL DEFAULT 'false', + `randomSpawn` VARCHAR(5) NOT NULL DEFAULT 'true', + PRIMARY KEY (`groupId`), + INDEX `fk_random_spawn_npc1_idx` (`npcId` ASC), + CONSTRAINT `fk_random_spawn_npc1` + FOREIGN KEY (`npcId`) + REFERENCES `npc` (`id`) + ON DELETE NO ACTION + ON UPDATE NO ACTION) +ENGINE = InnoDB +DEFAULT CHARACTER SET = latin1; + + +-- ----------------------------------------------------- +-- Table `random_spawn_loc` +-- ----------------------------------------------------- +DROP TABLE IF EXISTS `random_spawn_loc` ; + +CREATE TABLE IF NOT EXISTS `random_spawn_loc` ( + `groupId` INT(11) NOT NULL DEFAULT '0', + `x` INT(11) NOT NULL DEFAULT '0', + `y` INT(11) NOT NULL DEFAULT '0', + `z` INT(11) NOT NULL DEFAULT '0', + `heading` INT(11) NOT NULL DEFAULT '-1', + PRIMARY KEY (`groupId`, `x`, `y`, `z`, `heading`), + CONSTRAINT `fk_random_spawn_loc_random_spawn1` + FOREIGN KEY (`groupId`) + REFERENCES `random_spawn` (`groupId`) + ON DELETE NO ACTION + ON UPDATE NO ACTION) +ENGINE = InnoDB +DEFAULT CHARACTER SET = latin1; + + +-- ----------------------------------------------------- +-- Table `seven_signs` +-- ----------------------------------------------------- +DROP TABLE IF EXISTS `seven_signs` ; + +CREATE TABLE IF NOT EXISTS `seven_signs` ( + `char_obj_id` INT(11) NOT NULL DEFAULT '0', + `cabal` VARCHAR(4) NOT NULL DEFAULT '', + `seal` INT(1) NOT NULL DEFAULT '0', + `red_stones` INT(11) NOT NULL DEFAULT '0', + `green_stones` INT(11) NOT NULL DEFAULT '0', + `blue_stones` INT(11) NOT NULL DEFAULT '0', + `ancient_adena_amount` DECIMAL(20,0) NOT NULL DEFAULT '0', + `contribution_score` DECIMAL(20,0) NOT NULL DEFAULT '0', + PRIMARY KEY (`char_obj_id`), + CONSTRAINT `fk_seven_signs_characters1` + FOREIGN KEY (`char_obj_id`) + REFERENCES `characters` (`obj_Id`) + ON DELETE NO ACTION + ON UPDATE NO ACTION) +ENGINE = InnoDB +DEFAULT CHARACTER SET = latin1; + + +-- ----------------------------------------------------- +-- Table `seven_signs_festival` +-- ----------------------------------------------------- +DROP TABLE IF EXISTS `seven_signs_festival` ; + +CREATE TABLE IF NOT EXISTS `seven_signs_festival` ( + `festivalId` INT(1) NOT NULL DEFAULT '0', + `cabal` VARCHAR(4) NOT NULL DEFAULT '', + `cycle` INT(4) NOT NULL DEFAULT '0', + `date` BIGINT(50) NULL DEFAULT '0', + `score` INT(5) NOT NULL DEFAULT '0', + `members` VARCHAR(255) NOT NULL DEFAULT '', + PRIMARY KEY (`festivalId`, `cabal`, `cycle`)) +ENGINE = InnoDB +DEFAULT CHARACTER SET = latin1; + + +-- ----------------------------------------------------- +-- Table `seven_signs_status` +-- ----------------------------------------------------- +DROP TABLE IF EXISTS `seven_signs_status` ; + +CREATE TABLE IF NOT EXISTS `seven_signs_status` ( + `id` INT(3) NOT NULL DEFAULT '0', + `current_cycle` INT(10) NOT NULL DEFAULT '1', + `festival_cycle` INT(10) NOT NULL DEFAULT '1', + `active_period` INT(10) NOT NULL DEFAULT '1', + `date` INT(10) NOT NULL DEFAULT '1', + `previous_winner` INT(10) NOT NULL DEFAULT '0', + `dawn_stone_score` DECIMAL(20,0) NOT NULL DEFAULT '0', + `dawn_festival_score` INT(10) NOT NULL DEFAULT '0', + `dusk_stone_score` DECIMAL(20,0) NOT NULL DEFAULT '0', + `dusk_festival_score` INT(10) NOT NULL DEFAULT '0', + `avarice_owner` INT(10) NOT NULL DEFAULT '0', + `gnosis_owner` INT(10) NOT NULL DEFAULT '0', + `strife_owner` INT(10) NOT NULL DEFAULT '0', + `avarice_dawn_score` INT(10) NOT NULL DEFAULT '0', + `gnosis_dawn_score` INT(10) NOT NULL DEFAULT '0', + `strife_dawn_score` INT(10) NOT NULL DEFAULT '0', + `avarice_dusk_score` INT(10) NOT NULL DEFAULT '0', + `gnosis_dusk_score` INT(10) NOT NULL DEFAULT '0', + `strife_dusk_score` INT(10) NOT NULL DEFAULT '0', + `accumulated_bonus0` INT(10) NOT NULL DEFAULT '0', + `accumulated_bonus1` INT(10) NOT NULL DEFAULT '0', + `accumulated_bonus2` INT(10) NOT NULL DEFAULT '0', + `accumulated_bonus3` INT(10) NOT NULL DEFAULT '0', + `accumulated_bonus4` INT(10) NOT NULL DEFAULT '0', + PRIMARY KEY (`id`)) +ENGINE = InnoDB +DEFAULT CHARACTER SET = latin1; + + +-- ----------------------------------------------------- +-- Table `siege_clans` +-- ----------------------------------------------------- +DROP TABLE IF EXISTS `siege_clans` ; + +CREATE TABLE IF NOT EXISTS `siege_clans` ( + `castle_id` INT(1) NOT NULL DEFAULT '0', + `clan_id` INT(11) NOT NULL DEFAULT '0', + `type` INT(1) NULL DEFAULT NULL, + `castle_owner` INT(1) NULL DEFAULT NULL, + PRIMARY KEY (`clan_id`, `castle_id`), + INDEX `fk_siege_clans_castle1_idx` (`castle_id` ASC), + CONSTRAINT `fk_siege_clans_castle1` + FOREIGN KEY (`castle_id`) + REFERENCES `castle` (`id`) + ON DELETE NO ACTION + ON UPDATE NO ACTION, + CONSTRAINT `fk_siege_clans_clan_data1` + FOREIGN KEY (`clan_id`) + REFERENCES `clan_data` (`clan_id`) + ON DELETE NO ACTION + ON UPDATE NO ACTION) +ENGINE = InnoDB +DEFAULT CHARACTER SET = latin1; + + +-- ----------------------------------------------------- +-- Table `skill_learn` +-- ----------------------------------------------------- +DROP TABLE IF EXISTS `skill_learn` ; + +CREATE TABLE IF NOT EXISTS `skill_learn` ( + `npc_id` INT(11) NOT NULL DEFAULT '0', + `class_id` INT(11) NOT NULL DEFAULT '0', + PRIMARY KEY (`npc_id`, `class_id`), + INDEX `fk_skill_learn_char_templates1_idx` (`class_id` ASC), + CONSTRAINT `fk_skill_learn_npc1` + FOREIGN KEY (`npc_id`) + REFERENCES `npc` (`id`) + ON DELETE NO ACTION + ON UPDATE NO ACTION, + CONSTRAINT `fk_skill_learn_char_templates1` + FOREIGN KEY (`class_id`) + REFERENCES `char_templates` (`ClassId`) + ON DELETE NO ACTION + ON UPDATE NO ACTION) +ENGINE = InnoDB +DEFAULT CHARACTER SET = latin1; + + +-- ----------------------------------------------------- +-- Table `skill_spellbooks` +-- ----------------------------------------------------- +DROP TABLE IF EXISTS `skill_spellbooks` ; + +CREATE TABLE IF NOT EXISTS `skill_spellbooks` ( + `skill_id` INT(11) NOT NULL DEFAULT '-1', + `item_id` INT(11) NOT NULL DEFAULT '-1', + INDEX `skill_id` (`skill_id` ASC, `item_id` ASC), + INDEX `fk_skill_spellbooks_etcitem1_idx` (`item_id` ASC), + CONSTRAINT `fk_skill_spellbooks_etcitem1` + FOREIGN KEY (`item_id`) + REFERENCES `etcitem` (`item_id`) + ON DELETE NO ACTION + ON UPDATE NO ACTION) +ENGINE = InnoDB +DEFAULT CHARACTER SET = latin1; + + +-- ----------------------------------------------------- +-- Table `skill_trees` +-- ----------------------------------------------------- +DROP TABLE IF EXISTS `skill_trees` ; + +CREATE TABLE IF NOT EXISTS `skill_trees` ( + `class_id` INT(10) UNSIGNED NOT NULL DEFAULT '0', + `skill_id` INT(10) UNSIGNED NOT NULL DEFAULT '0', + `level` INT(10) UNSIGNED NOT NULL DEFAULT '0', + `name` VARCHAR(40) NOT NULL DEFAULT '', + `sp` INT(10) UNSIGNED NOT NULL DEFAULT '0', + `min_level` INT(10) UNSIGNED NOT NULL DEFAULT '0', + PRIMARY KEY (`class_id`, `skill_id`, `level`), + CONSTRAINT `fk_skill_trees_char_templates1` + FOREIGN KEY (`class_id`) + REFERENCES `char_templates` (`ClassId`) + ON DELETE NO ACTION + ON UPDATE NO ACTION) +ENGINE = InnoDB +DEFAULT CHARACTER SET = latin1; + + +-- ----------------------------------------------------- +-- Table `spawnlist` +-- ----------------------------------------------------- +DROP TABLE IF EXISTS `spawnlist` ; + +CREATE TABLE IF NOT EXISTS `spawnlist` ( + `id` INT(11) NOT NULL AUTO_INCREMENT, + `location` VARCHAR(40) NOT NULL DEFAULT '', + `count` INT(9) NOT NULL DEFAULT '0', + `npc_templateid` INT(9) NOT NULL DEFAULT '0', + `locx` INT(9) NOT NULL DEFAULT '0', + `locy` INT(9) NOT NULL DEFAULT '0', + `locz` INT(9) NOT NULL DEFAULT '0', + `randomx` INT(9) NOT NULL DEFAULT '0', + `randomy` INT(9) NOT NULL DEFAULT '0', + `heading` INT(9) NOT NULL DEFAULT '0', + `respawn_delay` INT(9) NOT NULL DEFAULT '0', + `loc_id` INT(9) NOT NULL DEFAULT '0', + `periodOfDay` DECIMAL(2,0) NULL DEFAULT '0', + PRIMARY KEY (`id`), + INDEX `key_npc_templateid` (`npc_templateid` ASC), + CONSTRAINT `fk_spawnlist_npc1` + FOREIGN KEY (`npc_templateid`) + REFERENCES `npc` (`idTemplate`) + ON DELETE NO ACTION + ON UPDATE NO ACTION) +ENGINE = InnoDB +AUTO_INCREMENT = 76235 +DEFAULT CHARACTER SET = latin1; + + +-- ----------------------------------------------------- +-- Table `teleport` +-- ----------------------------------------------------- +DROP TABLE IF EXISTS `teleport` ; + +CREATE TABLE IF NOT EXISTS `teleport` ( + `Description` VARCHAR(75) NULL DEFAULT NULL, + `id` DECIMAL(11,0) NOT NULL DEFAULT '0', + `loc_x` DECIMAL(9,0) NULL DEFAULT NULL, + `loc_y` DECIMAL(9,0) NULL DEFAULT NULL, + `loc_z` DECIMAL(9,0) NULL DEFAULT NULL, + `price` DECIMAL(6,0) NULL DEFAULT NULL, + `fornoble` INT(1) NOT NULL DEFAULT '0', + PRIMARY KEY (`id`)) +ENGINE = InnoDB +DEFAULT CHARACTER SET = latin1; + + +-- ----------------------------------------------------- +-- Table `walker_routes` +-- ----------------------------------------------------- +DROP TABLE IF EXISTS `walker_routes` ; + +CREATE TABLE IF NOT EXISTS `walker_routes` ( + `route_id` INT(11) NOT NULL DEFAULT '0', + `npc_id` INT(11) NOT NULL DEFAULT '0', + `move_point` INT(9) NOT NULL, + `chatText` VARCHAR(255) NULL DEFAULT NULL, + `move_x` INT(9) NOT NULL DEFAULT '0', + `move_y` INT(9) NOT NULL DEFAULT '0', + `move_z` INT(9) NOT NULL DEFAULT '0', + `delay` INT(9) NOT NULL DEFAULT '0', + `running` TINYINT(1) NOT NULL DEFAULT '0', + PRIMARY KEY (`route_id`, `npc_id`, `move_point`), + INDEX `fk_walker_routes_npc1_idx` (`npc_id` ASC), + CONSTRAINT `fk_walker_routes_npc1` + FOREIGN KEY (`npc_id`) + REFERENCES `npc` (`id`) + ON DELETE NO ACTION + ON UPDATE NO ACTION) +ENGINE = InnoDB +DEFAULT CHARACTER SET = latin1; + + +-- ----------------------------------------------------- +-- Table `zone` +-- ----------------------------------------------------- +DROP TABLE IF EXISTS `zone` ; + +CREATE TABLE IF NOT EXISTS `zone` ( + `id` INT(11) NOT NULL DEFAULT '0', + `type` VARCHAR(25) NOT NULL, + `name` VARCHAR(40) NOT NULL, + `x1` INT(11) NOT NULL DEFAULT '0', + `y1` INT(11) NOT NULL DEFAULT '0', + `x2` INT(11) NOT NULL DEFAULT '0', + `y2` INT(11) NOT NULL DEFAULT '0', + `z` INT(11) NOT NULL DEFAULT '0', + `z2` INT(11) NOT NULL DEFAULT '0', + `taxById` INT(11) NOT NULL DEFAULT '0') +ENGINE = InnoDB +DEFAULT CHARACTER SET = latin1; + + +-- ----------------------------------------------------- +-- Table `zone_vertices` +-- ----------------------------------------------------- +DROP TABLE IF EXISTS `zone_vertices` ; + +CREATE TABLE IF NOT EXISTS `zone_vertices` ( + `id` INT(11) NOT NULL, + `order` INT(11) NOT NULL, + `x` INT(11) NOT NULL, + `y` INT(11) NOT NULL, + PRIMARY KEY (`id`, `order`)) +ENGINE = InnoDB +DEFAULT CHARACTER SET = latin1; + + +SET SQL_MODE=@OLD_SQL_MODE; +SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS; +SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS; diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/GlobalTasks.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/GlobalTasks.java new file mode 100644 index 00000000..f1c2326e --- /dev/null +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/GlobalTasks.java @@ -0,0 +1,14 @@ +package com.l2jbr.gameserver.model.dao; + +import com.l2jbr.commons.database.dao.DAO; + +public class GlobalTasks implements DAO { + + private int id; + private String task; + private String type; + private long last_activation; + private String param1; + private String param2; + private String param3; +} diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/HelperBuffList.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/HelperBuffList.java new file mode 100644 index 00000000..356d6574 --- /dev/null +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/HelperBuffList.java @@ -0,0 +1,13 @@ +package com.l2jbr.gameserver.model.dao; + +import com.l2jbr.commons.database.dao.DAO; + +public class HelperBuffList implements DAO { + private int id; + private int skill_id; + private String name; + private int skill_level; + private int lower_level; + private int upper_level; + private String is_magic_class; +} diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/Henna.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/Henna.java new file mode 100644 index 00000000..236e9ef8 --- /dev/null +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/Henna.java @@ -0,0 +1,18 @@ +package com.l2jbr.gameserver.model.dao; + +import com.l2jbr.commons.database.dao.DAO; + +public class Henna implements DAO { + + private int symbol_id; + private String symbol_name; + private int dye_id; + private int dye_amount; + private int price; + private int stat_; + private int stat_STR; + private int stat_CON; + private int stat_MEM; + private int stat_DEX; + private int stat_WIT; +} diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/HennaTrees.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/HennaTrees.java new file mode 100644 index 00000000..e4060821 --- /dev/null +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/HennaTrees.java @@ -0,0 +1,8 @@ +package com.l2jbr.gameserver.model.dao; + +import com.l2jbr.commons.database.dao.DAO; + +public class HennaTrees implements DAO { + private int class_id; + private int symbol_id; +} diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/Heroes.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/Heroes.java new file mode 100644 index 00000000..5312a450 --- /dev/null +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/Heroes.java @@ -0,0 +1,11 @@ +package com.l2jbr.gameserver.model.dao; + +import com.l2jbr.commons.database.dao.DAO; + +public class Heroes implements DAO { + private int char_id; + private String char_name; + private int class_id; + private int count; + private int played; +} diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/Items.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/Items.java new file mode 100644 index 00000000..5ca0f2f9 --- /dev/null +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/Items.java @@ -0,0 +1,20 @@ +package com.l2jbr.gameserver.model.dao; + +import com.l2jbr.commons.database.dao.DAO; + +public class Items implements DAO { + + private int owner_id; + private int object_id; + private int item_id; + private int count; + private int enchant_level; + private String loc; + private int loc_data; + private int price_sell; + private int price_buy; + private int time_of_use; + private int custom_type1; + private int custom_type2; + private int mana_left; +} diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/ItemsOnGround.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/ItemsOnGround.java new file mode 100644 index 00000000..5990ab58 --- /dev/null +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/ItemsOnGround.java @@ -0,0 +1,16 @@ +package com.l2jbr.gameserver.model.dao; + +import com.l2jbr.commons.database.dao.DAO; + +public class ItemsOnGround implements DAO { + private int object_id; + private int item_id; + private int count; + private int enchant_level; + private int x; + private int y; + private int z; + private long drop_time; + private int equipable; + +} diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/LevelUpGain.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/LevelUpGain.java new file mode 100644 index 00000000..71b7fa5e --- /dev/null +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/LevelUpGain.java @@ -0,0 +1,17 @@ +package com.l2jbr.gameserver.model.dao; + +import com.l2jbr.commons.database.dao.DAO; + +public class LevelUpGain implements DAO { + private int classid; + private int defaulthpbase; + private int defaulthpadd; + private int defaulthpmod; + private int defaultcpbase; + private int defaultcpadd; + private int defaultcpmod; + private int defaultmpbase; + private int defaultmpadd; + private int defaultmpmod; + private int class_lvl; +} diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/Locations.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/Locations.java new file mode 100644 index 00000000..a859bd68 --- /dev/null +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/Locations.java @@ -0,0 +1,13 @@ +package com.l2jbr.gameserver.model.dao; + +import com.l2jbr.commons.database.dao.DAO; + +public class Locations implements DAO { + + private int loc_id; + private int loc_x; + private int loc_y; + private int loc_zmin; + private int loc_zmax; + private int proc; +} diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/MapRegion.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/MapRegion.java new file mode 100644 index 00000000..c45d62df --- /dev/null +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/MapRegion.java @@ -0,0 +1,17 @@ +package com.l2jbr.gameserver.model.dao; + +import com.l2jbr.commons.database.dao.DAO; + +public class MapRegion implements DAO { + private int region; + private int sec0; + private int sec1; + private int sec2; + private int sec3; + private int sec4; + private int sec5; + private int sec6; + private int sec7; + private int sec8; + private int sec9; +} diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/MerchantAreasList.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/MerchantAreasList.java new file mode 100644 index 00000000..61f5d4bb --- /dev/null +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/MerchantAreasList.java @@ -0,0 +1,10 @@ +package com.l2jbr.gameserver.model.dao; + +import com.l2jbr.commons.database.dao.DAO; + +public class MerchantAreasList implements DAO { + private int merchant_area_id; + private String merchant_area_name; + private float tax; + private int chaotic; +} diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/MerchantBuyList.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/MerchantBuyList.java new file mode 100644 index 00000000..44af461f --- /dev/null +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/MerchantBuyList.java @@ -0,0 +1,15 @@ +package com.l2jbr.gameserver.model.dao; + +import com.l2jbr.commons.database.dao.DAO; + +public class MerchantBuyList implements DAO { + + private int item_id; + private int price; + private int shop_id; + private int order; + private int count; + private int currentCount; + private int time; + private long savetimer; +} diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/MerchantLease.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/MerchantLease.java new file mode 100644 index 00000000..0c7231be --- /dev/null +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/MerchantLease.java @@ -0,0 +1,11 @@ +package com.l2jbr.gameserver.model.dao; + +import com.l2jbr.commons.database.dao.DAO; + +public class MerchantLease implements DAO { + private int merchant_id; + private int player_id; + private int bid; + private int type; + private String player_name; +} diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/MerchantShopIds.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/MerchantShopIds.java new file mode 100644 index 00000000..cd2cbe6d --- /dev/null +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/MerchantShopIds.java @@ -0,0 +1,9 @@ +package com.l2jbr.gameserver.model.dao; + +import com.l2jbr.commons.database.dao.DAO; + +public class MerchantShopIds implements DAO { + private int shop_id; + private String npc_id; + +} diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/Merchants.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/Merchants.java new file mode 100644 index 00000000..66c9c0b2 --- /dev/null +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/Merchants.java @@ -0,0 +1,8 @@ +package com.l2jbr.gameserver.model.dao; + +import com.l2jbr.commons.database.dao.DAO; + +public class Merchants implements DAO { + private int npc_id; + private int merchant_area_id; +} diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/Minions.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/Minions.java new file mode 100644 index 00000000..06b2091a --- /dev/null +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/Minions.java @@ -0,0 +1,10 @@ +package com.l2jbr.gameserver.model.dao; + +import com.l2jbr.commons.database.dao.DAO; + +public class Minions implements DAO { + private int boss_id; + private int minion_id; + private int amount_min; + private int amount_max; +} diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/ModsWedding.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/ModsWedding.java new file mode 100644 index 00000000..fd8c7bfb --- /dev/null +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/ModsWedding.java @@ -0,0 +1,13 @@ +package com.l2jbr.gameserver.model.dao; + +import com.l2jbr.commons.database.dao.DAO; + +public class ModsWedding implements DAO { + + private int id; + private int player1Id; + private int player2Id; + private String married; + private long affianceDate; + private long weddingDate; +} diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/Npc.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/Npc.java new file mode 100644 index 00000000..a18b89b3 --- /dev/null +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/Npc.java @@ -0,0 +1,49 @@ +package com.l2jbr.gameserver.model.dao; + +import com.l2jbr.commons.database.dao.DAO; + +public class Npc implements DAO { + + private int id; + private int idTemplate; + private String name; + private int serverSideName; + private String title; + private int serverSideTitle; + private String _class; + private int collision_radius; + private int collision_height; + private int level; + private String sex; + private String type; + private int attackrange; + private int hp; + private int mp; + private int hpreg; + private int mpreg; + private int str; + private int con; + private int dex; + private int _int; + private int wit; + private int men; + private int exp; + private int sp; + private int patk; + private int pdef; + private int matk; + private int mdef; + private int atkspd; + private int aggro; + private int matkspd; + private int rhand; + private int lhand; + private int armor; + private int walkspd; + private int runspd; + private String faction_id; + private int faction_range; + private int isUndead; + private int absorb_level; + private String absorb_type; //enum('FULL_PARTY','LAST_HIT','PARTY_ONE_RANDOM') DEFAULT 'LAST_HIT' NOT NULL, +} diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/NpcSkills.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/NpcSkills.java new file mode 100644 index 00000000..4653d9cd --- /dev/null +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/NpcSkills.java @@ -0,0 +1,7 @@ +package com.l2jbr.gameserver.model.dao; + +public class NpcSkills { + private int npcid; + private int skillid; + private int level; +} diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/OlympiadNobles.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/OlympiadNobles.java new file mode 100644 index 00000000..9b26e003 --- /dev/null +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/OlympiadNobles.java @@ -0,0 +1,12 @@ +package com.l2jbr.gameserver.model.dao; + +import com.l2jbr.commons.database.dao.DAO; + +public class OlympiadNobles implements DAO { + + private int char_id; + private int class_id; + private String char_name; + private int olympiad_points; + private int competitions_done; +} diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/Pets.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/Pets.java new file mode 100644 index 00000000..2c5894db --- /dev/null +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/Pets.java @@ -0,0 +1,17 @@ +package com.l2jbr.gameserver.model.dao; + +import com.l2jbr.commons.database.dao.DAO; + +public class Pets implements DAO { + + private int item_obj_id; + private String name; + private int level; + private int curHp; + private int curMp; + private long exp; + private int sp; + private int karma; + private int pkkills; + private int fed; +} diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/PetsStats.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/PetsStats.java new file mode 100644 index 00000000..433dd1b9 --- /dev/null +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/PetsStats.java @@ -0,0 +1,31 @@ +package com.l2jbr.gameserver.model.dao; + +import com.l2jbr.commons.database.dao.DAO; + +public class PetsStats implements DAO { + + private String type; + private int typeID; + private int level; + private int expMax; + private int hpMax; + private int mpMax; + private int patk; + private int pdef; + private int matk; + private int mdef; + private int acc; + private int evasion; + private int crit; + private int speed; + private int atk_speed; + private int cast_speed; + private int feedMax; + private int feedbattle; + private int feednormal; + private int loadMax; + private int hpregen; + private int mpregen; + private int owner_exp_taken; + +} diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/PledgeSkillTrees.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/PledgeSkillTrees.java new file mode 100644 index 00000000..db7bbe34 --- /dev/null +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/PledgeSkillTrees.java @@ -0,0 +1,14 @@ +package com.l2jbr.gameserver.model.dao; + +import com.l2jbr.commons.database.dao.DAO; + +public class PledgeSkillTrees implements DAO { + + private int skill_id; + private int level; + private String name; + private int clan_lvl; + private String Description; + private int repCost; + private int itemId; +} diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/Posts.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/Posts.java new file mode 100644 index 00000000..7b4f4cf0 --- /dev/null +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/Posts.java @@ -0,0 +1,14 @@ +package com.l2jbr.gameserver.model.dao; + +import com.l2jbr.commons.database.dao.DAO; + +public class Posts implements DAO { + private int post_id; + private String post_owner_name; + private int post_ownerid; + private long post_date; + private int post_topic_id; + private int post_forum_id; + private String post_txt; + +} diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/QuestGlobalData.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/QuestGlobalData.java new file mode 100644 index 00000000..f902aa14 --- /dev/null +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/QuestGlobalData.java @@ -0,0 +1,10 @@ +package com.l2jbr.gameserver.model.dao; + +import com.l2jbr.commons.database.dao.DAO; + +public class QuestGlobalData implements DAO { + + private String quest_name; + private String var; + private String value; +} diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/RaidbossSpawnList.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/RaidbossSpawnList.java new file mode 100644 index 00000000..b4c56ade --- /dev/null +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/RaidbossSpawnList.java @@ -0,0 +1,17 @@ +package com.l2jbr.gameserver.model.dao; + +import com.l2jbr.commons.database.dao.DAO; + +public class RaidbossSpawnList implements DAO { + private int boss_id; + private int amount; + private int loc_x; + private int loc_y; + private int loc_z; + private int heading; + private int respawn_min_delay; + private int respawn_max_delay; + private int respawn_time; + private int currentHp; + private int currentMp; +} diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/RandomSpawn.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/RandomSpawn.java new file mode 100644 index 00000000..32b7ab75 --- /dev/null +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/RandomSpawn.java @@ -0,0 +1,15 @@ +package com.l2jbr.gameserver.model.dao; + +import com.l2jbr.commons.database.dao.DAO; + +public class RandomSpawn implements DAO { + + private int groupId; + private int npcId; + private int count; + private int initialDelay; + private int respawnDelay; + private int despawnDelay; + private String broadcastSpawn; + private String randomSpawn; +} diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/RandomSpawnLoc.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/RandomSpawnLoc.java new file mode 100644 index 00000000..cbeda4c1 --- /dev/null +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/RandomSpawnLoc.java @@ -0,0 +1,12 @@ +package com.l2jbr.gameserver.model.dao; + +import com.l2jbr.commons.database.dao.DAO; + +public class RandomSpawnLoc implements DAO { + + private int groupId; + private int x; + private int y; + private int z; + private int heading; +} diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/SevenSigns.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/SevenSigns.java new file mode 100644 index 00000000..2972f5a8 --- /dev/null +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/SevenSigns.java @@ -0,0 +1,14 @@ +package com.l2jbr.gameserver.model.dao; + +import com.l2jbr.commons.database.dao.DAO; + +public class SevenSigns implements DAO { + private int char_obj_id; + private String cabal; + private int seal; + private int red_stones; + private int green_stones; + private int blue_stones; + private long ancient_adena_amount; + private long contribution_score; +} diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/SevenSignsFestival.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/SevenSignsFestival.java new file mode 100644 index 00000000..f6a07150 --- /dev/null +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/SevenSignsFestival.java @@ -0,0 +1,12 @@ +package com.l2jbr.gameserver.model.dao; + +import com.l2jbr.commons.database.dao.DAO; + +public class SevenSignsFestival implements DAO { + private int festivalId; + private String cabal; + private int cycle; + private int date; + private int score; + private String members; +} diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/SevenSignsStatus.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/SevenSignsStatus.java new file mode 100644 index 00000000..d3f5a17a --- /dev/null +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/SevenSignsStatus.java @@ -0,0 +1,31 @@ +package com.l2jbr.gameserver.model.dao; + +import com.l2jbr.commons.database.dao.DAO; + +public class SevenSignsStatus implements DAO { + + private int id; + private int current_cycle; + private int festival_cycle; + private int active_period; + private int date; + private int previous_winner; + private long dawn_stone_score; + private int dawn_festival_score; + private long dusk_stone_score; + private int dusk_festival_score; + private int avarice_owner; + private int gnosis_owner; + private int strife_owner; + private int avarice_dawn_score; + private int gnosis_dawn_score; + private int strife_dawn_score; + private int avarice_dusk_score; + private int gnosis_dusk_score; + private int strife_dusk_score; + private int accumulated_bonus0; + private int accumulated_bonus1; + private int accumulated_bonus2; + private int accumulated_bonus3; + private int accumulated_bonus4; +} diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/SiegeClan.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/SiegeClan.java new file mode 100644 index 00000000..833f69cd --- /dev/null +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/SiegeClan.java @@ -0,0 +1,10 @@ +package com.l2jbr.gameserver.model.dao; + +import com.l2jbr.commons.database.dao.DAO; + +public class SiegeClan implements DAO { + private int castle_id; + private int clan_id; + private int type; + private int castle_owner; +} diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/SkillLearn.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/SkillLearn.java new file mode 100644 index 00000000..8c89f061 --- /dev/null +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/SkillLearn.java @@ -0,0 +1,9 @@ +package com.l2jbr.gameserver.model.dao; + +import com.l2jbr.commons.database.dao.DAO; + +public class SkillLearn implements DAO { + + private int npc_id; + private int class_id; +} diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/SkillSpellBooks.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/SkillSpellBooks.java new file mode 100644 index 00000000..fec93767 --- /dev/null +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/SkillSpellBooks.java @@ -0,0 +1,8 @@ +package com.l2jbr.gameserver.model.dao; + +import com.l2jbr.commons.database.dao.DAO; + +public class SkillSpellBooks implements DAO { + private int skill_id; + private int item_id; +} diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/SkillTrees.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/SkillTrees.java new file mode 100644 index 00000000..948ef174 --- /dev/null +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/SkillTrees.java @@ -0,0 +1,14 @@ +package com.l2jbr.gameserver.model.dao; + +import com.l2jbr.commons.database.dao.DAO; + +public class SkillTrees implements DAO { + + private int class_id; + private int skill_id; + private int level; + private String name; + private int sp; + private int min_level; + +} diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/Spawnlist.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/Spawnlist.java new file mode 100644 index 00000000..6ed5480a --- /dev/null +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/Spawnlist.java @@ -0,0 +1,19 @@ +package com.l2jbr.gameserver.model.dao; + +import com.l2jbr.commons.database.dao.DAO; + +public class Spawnlist implements DAO { + private int id; + private String location; + private int count; + private int npc_templateid; + private int locx; + private int locy; + private int locz; + private int randomx; + private int randomy; + private int heading; + private int respawn_delay; + private int loc_id; + private int periodOfDay; +} diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/Teleport.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/Teleport.java new file mode 100644 index 00000000..132b6296 --- /dev/null +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/Teleport.java @@ -0,0 +1,13 @@ +package com.l2jbr.gameserver.model.dao; + +import com.l2jbr.commons.database.dao.DAO; + +public class Teleport implements DAO { + private String Description; + private int id; + private int loc_x; + private int loc_y; + private int loc_z; + private int price; + private int fornoble; +} diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/Topic.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/Topic.java new file mode 100644 index 00000000..50b8a3e6 --- /dev/null +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/Topic.java @@ -0,0 +1,15 @@ +package com.l2jbr.gameserver.model.dao; + +import com.l2jbr.commons.database.dao.DAO; + +public class Topic implements DAO { + + private int topic_id; + private int topic_forum_id; + private String topic_name; + private long topic_date; + private String topic_ownername; + private int topic_ownerid; + private int topic_type; + private int topic_reply; +} diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/WalkerRoutes.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/WalkerRoutes.java new file mode 100644 index 00000000..22261911 --- /dev/null +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/WalkerRoutes.java @@ -0,0 +1,15 @@ +package com.l2jbr.gameserver.model.dao; + +import com.l2jbr.commons.database.dao.DAO; + +public class WalkerRoutes implements DAO { + private int route_id; + private int npc_id; + private int move_point; + private String chatText; + private int move_x; + private int move_y; + private int move_z; + private int delay; + private int running; +} diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/Weapon.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/Weapon.java new file mode 100644 index 00000000..a07caa18 --- /dev/null +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/Weapon.java @@ -0,0 +1,43 @@ +package com.l2jbr.gameserver.model.dao; + +import com.l2jbr.commons.database.dao.DAO; + +public class Weapon implements DAO { + private String item_id; + private String name; + private String bodypart; + private String crystallizable; + private String weight; + private String soulshots; + private String spiritshots; + private String material; + private String crystal_type; + private String p_dam; + private String rnd_dam; + private String weaponType; + private String critical; + private String hit_modify; + private String avoid_modify; + private String shield_def; + private String shield_def_rate; + private String atk_speed; + private String mp_consume; + private String m_dam; + private String duration; + private String price; + private String crystal_count; + private String sellable; + private String dropable; + private String destroyable; + private String tradeable; + private String item_skill_id; + private String item_skill_lvl; + private String enchant4_skill_id; + private String enchant4_skill_lvl; + private String onCast_skill_id; + private String onCast_skill_lvl; + private String onCast_skill_chance; + private String onCrit_skill_id; + private String onCrit_skill_lvl; + private String onCrit_skill_chance; +} diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/Zone.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/Zone.java new file mode 100644 index 00000000..ee04fa61 --- /dev/null +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/Zone.java @@ -0,0 +1,16 @@ +package com.l2jbr.gameserver.model.dao; + +import com.l2jbr.commons.database.dao.DAO; + +public class Zone implements DAO { + private int id; + private String type; + private String name; + private int x1; + private int y1; + private int x2; + private int y2; + private int z; + private int z2; + private int taxById; +} diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/ZoneVertices.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/ZoneVertices.java new file mode 100644 index 00000000..045fa568 --- /dev/null +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/ZoneVertices.java @@ -0,0 +1,10 @@ +package com.l2jbr.gameserver.model.dao; + +import com.l2jbr.commons.database.dao.DAO; + +public class ZoneVertices implements DAO { + private int id; + private int order; + private int x; + private int y; +} diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/repository/AccountDataRepository.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/repository/AccountDataRepository.java deleted file mode 100644 index 2512aca1..00000000 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/repository/AccountDataRepository.java +++ /dev/null @@ -1,9 +0,0 @@ -package com.l2jbr.gameserver.model.dao.repository; - -import org.springframework.data.repository.CrudRepository; - -public interface AccountData extends CrudRepository { - - - -} From ff9e684c5c1d6d979fdac15e69a0aa2c6de182c3 Mon Sep 17 00:00:00 2001 From: Alisson Oliveira Date: Thu, 12 Apr 2018 19:09:19 -0300 Subject: [PATCH 005/236] Adiciona Teste para avaliar a viabilidade do spring-data-jdbc --- Gameserver/build.gradle | 3 +- .../gameserver/model/dao/account_data.java | 36 +++++++++++++++++++ .../com.l2jbr.gameserver/module-info.java | 3 ++ .../main/resources/config/options.properties | 4 +-- .../src/test/java/AccountDataRepository.java | 5 +++ Gameserver/src/test/java/ConfigContext.java | 35 ++++++++++++++++++ build.gradle | 6 +++- 7 files changed, 88 insertions(+), 4 deletions(-) create mode 100644 Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/account_data.java create mode 100644 Gameserver/src/test/java/AccountDataRepository.java create mode 100644 Gameserver/src/test/java/ConfigContext.java diff --git a/Gameserver/build.gradle b/Gameserver/build.gradle index f7572505..c000b82a 100644 --- a/Gameserver/build.gradle +++ b/Gameserver/build.gradle @@ -20,7 +20,7 @@ sourceSets { } configurations.all { - transitive = false + transitive = true } dependencies { @@ -29,6 +29,7 @@ dependencies { compile 'org.slf4j:slf4j-api:1.8.0-beta2' compile 'org.python:jython-standalone:2.7.1' + compile 'org.springframework.data:spring-data-jdbc:1.0.0.BUILD-SNAPSHOT' runtime 'org.apache.logging.log4j:log4j-core:2.11.0' runtime 'org.apache.logging.log4j:log4j-api:2.11.0' diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/account_data.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/account_data.java new file mode 100644 index 00000000..ec917aa8 --- /dev/null +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/account_data.java @@ -0,0 +1,36 @@ +package com.l2jbr.gameserver.model.dao; + +import org.springframework.data.annotation.Id; + +public class account_data { + + + @Id String account_name; + private String var; + private String value; + + + public String getAccountName() { + return account_name; + } + + public void setAccountName(String accountName) { + this.account_name = accountName; + } + + public String getVar() { + return var; + } + + public void setVar(String var) { + this.var = var; + } + + public String getValue() { + return value; + } + + public void setValue(String value) { + this.value = value; + } +} diff --git a/Gameserver/src/main/com.l2jbr.gameserver/module-info.java b/Gameserver/src/main/com.l2jbr.gameserver/module-info.java index ecc18a59..5403ed2b 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/module-info.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/module-info.java @@ -7,6 +7,9 @@ requires org.slf4j; requires java.scripting; requires jython.standalone; + requires spring.data.commons; + requires spring.data.jdbc; + requires spring.context; exports com.l2jbr.gameserver; diff --git a/Gameserver/src/main/resources/config/options.properties b/Gameserver/src/main/resources/config/options.properties index 8b25b4ca..36c0cb71 100644 --- a/Gameserver/src/main/resources/config/options.properties +++ b/Gameserver/src/main/resources/config/options.properties @@ -1,5 +1,5 @@ # ================================================================= -# Test server setting, shouldn't be touched for production game servers +# App server setting, shouldn't be touched for production game servers # ================================================================= Debug = False @@ -158,7 +158,7 @@ AllowFreight = True AllowWear = True WearDelay = 10 WearPrice = 10 -# =============== Test features =============== +# =============== App features =============== AllowLottery = False AllowRace = False AllowWater = False diff --git a/Gameserver/src/test/java/AccountDataRepository.java b/Gameserver/src/test/java/AccountDataRepository.java new file mode 100644 index 00000000..8ded6363 --- /dev/null +++ b/Gameserver/src/test/java/AccountDataRepository.java @@ -0,0 +1,5 @@ +import com.l2jbr.gameserver.model.dao.account_data; +import org.springframework.data.repository.CrudRepository; + +public interface AccountDataRepository extends CrudRepository { +} diff --git a/Gameserver/src/test/java/ConfigContext.java b/Gameserver/src/test/java/ConfigContext.java new file mode 100644 index 00000000..2ea447b6 --- /dev/null +++ b/Gameserver/src/test/java/ConfigContext.java @@ -0,0 +1,35 @@ +import com.zaxxer.hikari.HikariConfig; +import com.zaxxer.hikari.HikariDataSource; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.core.env.Environment; +import org.springframework.data.jdbc.repository.config.EnableJdbcRepositories; +import org.springframework.jdbc.core.namedparam.NamedParameterJdbcOperations; +import org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate; + +import javax.sql.DataSource; + +@Configuration +@EnableJdbcRepositories +public class ConfigContext { + + @Bean + public DataSource dataSource(Environment env) { + HikariConfig dataSourceConfig = new HikariConfig(); + dataSourceConfig.setDriverClassName("com.mysql.cj.jdbc.Driver"); + dataSourceConfig.setJdbcUrl("jdbc:mysql://localhost/l2jdb"); + dataSourceConfig.setUsername("root"); + dataSourceConfig.setPassword("root"); + return new HikariDataSource(dataSourceConfig); + } + + @Bean + public NamedParameterJdbcOperations template(DataSource dataSource) { + return new NamedParameterJdbcTemplate(dataSource); + } + + @Bean + public App app() { + return new App(); + } +} diff --git a/build.gradle b/build.gradle index dd312679..50a555b9 100644 --- a/build.gradle +++ b/build.gradle @@ -14,6 +14,10 @@ ext.moduleName = 'com.l2jbr' allprojects { repositories { mavenCentral() + + maven { + url 'https://repo.spring.io/libs-snapshot' + } } sourceCompatibility = JavaVersion.VERSION_1_9 @@ -25,7 +29,7 @@ subprojects { inputs.property("moduleName", moduleName) doFirst { options.compilerArgs = [ - '--module-path', classpath.asPath, + '--module-path', classpath.asPath, ] classpath = files() } From b9d5f7050395954978cccbf9632145724f691d16 Mon Sep 17 00:00:00 2001 From: Alisson Oliveira Date: Mon, 16 Apr 2018 09:25:41 -0300 Subject: [PATCH 006/236] Substitue forma de login baseando-se em repository --- Commons/build.gradle | 7 +- .../commons/database/AccountRepository.java | 7 ++ .../database/AnnotationNamingStrategy.java | 34 ++++++ .../commons/database/DatabaseAccess.java | 33 ++++++ .../DatabaseContextConfiguration.java | 85 ++++++++++++++ .../commons/database/L2DatabaseFactory.java | 44 +++----- .../commons/database/annotation/Column.java | 13 +++ .../commons/database/annotation/Table.java | 14 +++ .../com/l2jbr/commons/database/dao/DAO.java | 4 - .../l2jbr/commons/database/model/Account.java | 58 ++++++++++ .../commons/database/model/AccountData.java | 24 ++-- .../l2jbr/commons/database/model/Model.java | 28 +++++ .../com/l2jbr/commons/util/Util.java | 16 ++- .../main/com.l2jbr.commons/module-info.java | 6 +- Commons/src/test/java/App.java | 14 +++ Gameserver/build.gradle | 2 - .../gameserver/model/dao/AccountData.java | 4 +- .../l2jbr/gameserver/model/dao/Accounts.java | 4 +- .../com/l2jbr/gameserver/model/dao/Armor.java | 4 +- .../l2jbr/gameserver/model/dao/Auction.java | 4 +- .../gameserver/model/dao/AuctionBid.java | 4 +- .../gameserver/model/dao/Augmentations.java | 4 +- .../l2jbr/gameserver/model/dao/AutoChat.java | 4 +- .../gameserver/model/dao/AutoChatText.java | 4 +- .../l2jbr/gameserver/model/dao/BoxAccess.java | 4 +- .../com/l2jbr/gameserver/model/dao/Boxes.java | 4 +- .../l2jbr/gameserver/model/dao/Castle.java | 4 +- .../gameserver/model/dao/CastleDoor.java | 4 +- .../model/dao/CastleDoorUpgrade.java | 4 +- .../model/dao/CastleManorProcure.java | 4 +- .../model/dao/CastleManorProduction.java | 4 +- .../model/dao/CastleSiegeGuard.java | 4 +- .../gameserver/model/dao/CharTemplates.java | 4 +- .../model/dao/CharacterFriends.java | 4 +- .../gameserver/model/dao/CharacterHennas.java | 4 +- .../model/dao/CharacterMacroses.java | 4 +- .../gameserver/model/dao/CharacterQuests.java | 4 +- .../model/dao/CharacterRecipeBook.java | 4 +- .../model/dao/CharacterRecommends.java | 4 +- .../model/dao/CharacterShortcuts.java | 4 +- .../gameserver/model/dao/CharacterSkills.java | 4 +- .../model/dao/CharacterSkillsSave.java | 4 +- .../model/dao/CharacterSubclasses.java | 4 +- .../gameserver/model/dao/Characters.java | 4 +- .../l2jbr/gameserver/model/dao/ClanData.java | 4 +- .../l2jbr/gameserver/model/dao/ClanHall.java | 4 +- .../model/dao/ClanHallFunctions.java | 4 +- .../l2jbr/gameserver/model/dao/ClanPrivs.java | 4 +- .../gameserver/model/dao/ClanSkills.java | 4 +- .../gameserver/model/dao/ClanSubpledges.java | 4 +- .../l2jbr/gameserver/model/dao/ClanWars.java | 4 +- .../gameserver/model/dao/CursedWeapons.java | 4 +- .../gameserver/model/dao/DimensionalRift.java | 4 +- .../l2jbr/gameserver/model/dao/DropList.java | 4 +- .../model/dao/EnchantSkillTrees.java | 4 +- .../l2jbr/gameserver/model/dao/EtcItem.java | 4 +- .../com/l2jbr/gameserver/model/dao/Fish.java | 4 +- .../model/dao/FishingSkillTrees.java | 4 +- .../l2jbr/gameserver/model/dao/Forums.java | 4 +- .../com/l2jbr/gameserver/model/dao/Games.java | 4 +- .../gameserver/model/dao/GlobalTasks.java | 4 +- .../gameserver/model/dao/HelperBuffList.java | 4 +- .../com/l2jbr/gameserver/model/dao/Henna.java | 4 +- .../gameserver/model/dao/HennaTrees.java | 4 +- .../l2jbr/gameserver/model/dao/Heroes.java | 4 +- .../com/l2jbr/gameserver/model/dao/Items.java | 4 +- .../gameserver/model/dao/ItemsOnGround.java | 4 +- .../gameserver/model/dao/LevelUpGain.java | 4 +- .../l2jbr/gameserver/model/dao/Locations.java | 4 +- .../l2jbr/gameserver/model/dao/MapRegion.java | 4 +- .../model/dao/MerchantAreasList.java | 4 +- .../gameserver/model/dao/MerchantBuyList.java | 4 +- .../gameserver/model/dao/MerchantLease.java | 4 +- .../gameserver/model/dao/MerchantShopIds.java | 4 +- .../l2jbr/gameserver/model/dao/Merchants.java | 4 +- .../l2jbr/gameserver/model/dao/Minions.java | 4 +- .../gameserver/model/dao/ModsWedding.java | 4 +- .../com/l2jbr/gameserver/model/dao/Npc.java | 4 +- .../gameserver/model/dao/OlympiadNobles.java | 4 +- .../com/l2jbr/gameserver/model/dao/Pets.java | 4 +- .../l2jbr/gameserver/model/dao/PetsStats.java | 4 +- .../model/dao/PledgeSkillTrees.java | 4 +- .../com/l2jbr/gameserver/model/dao/Posts.java | 4 +- .../gameserver/model/dao/QuestGlobalData.java | 4 +- .../model/dao/RaidbossSpawnList.java | 4 +- .../gameserver/model/dao/RandomSpawn.java | 4 +- .../gameserver/model/dao/RandomSpawnLoc.java | 4 +- .../gameserver/model/dao/SevenSigns.java | 4 +- .../model/dao/SevenSignsFestival.java | 4 +- .../model/dao/SevenSignsStatus.java | 4 +- .../l2jbr/gameserver/model/dao/SiegeClan.java | 4 +- .../gameserver/model/dao/SkillLearn.java | 4 +- .../gameserver/model/dao/SkillSpellBooks.java | 4 +- .../gameserver/model/dao/SkillTrees.java | 4 +- .../l2jbr/gameserver/model/dao/Spawnlist.java | 4 +- .../l2jbr/gameserver/model/dao/Teleport.java | 4 +- .../com/l2jbr/gameserver/model/dao/Topic.java | 4 +- .../gameserver/model/dao/WalkerRoutes.java | 4 +- .../l2jbr/gameserver/model/dao/Weapon.java | 4 +- .../com/l2jbr/gameserver/model/dao/Zone.java | 4 +- .../gameserver/model/dao/ZoneVertices.java | 4 +- .../l2jbr/gameserver/model/dao/classList.java | 4 +- .../src/test/java/AccountDataRepository.java | 5 - Gameserver/src/test/java/ConfigContext.java | 35 ------ Loginserver/build.gradle | 7 +- .../l2jbr/loginserver/LoginController.java | 104 ++++++++---------- .../loginserver/status/LoginStatusThread.java | 7 +- .../com.l2jbr.loginserver/module-info.java | 1 + Tools/build.gradle | 1 - 109 files changed, 555 insertions(+), 338 deletions(-) create mode 100644 Commons/src/main/com.l2jbr.commons/com/l2jbr/commons/database/AccountRepository.java create mode 100644 Commons/src/main/com.l2jbr.commons/com/l2jbr/commons/database/AnnotationNamingStrategy.java create mode 100644 Commons/src/main/com.l2jbr.commons/com/l2jbr/commons/database/DatabaseAccess.java create mode 100644 Commons/src/main/com.l2jbr.commons/com/l2jbr/commons/database/DatabaseContextConfiguration.java create mode 100644 Commons/src/main/com.l2jbr.commons/com/l2jbr/commons/database/annotation/Column.java create mode 100644 Commons/src/main/com.l2jbr.commons/com/l2jbr/commons/database/annotation/Table.java delete mode 100644 Commons/src/main/com.l2jbr.commons/com/l2jbr/commons/database/dao/DAO.java create mode 100644 Commons/src/main/com.l2jbr.commons/com/l2jbr/commons/database/model/Account.java rename Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/account_data.java => Commons/src/main/com.l2jbr.commons/com/l2jbr/commons/database/model/AccountData.java (58%) create mode 100644 Commons/src/main/com.l2jbr.commons/com/l2jbr/commons/database/model/Model.java create mode 100644 Commons/src/test/java/App.java delete mode 100644 Gameserver/src/test/java/AccountDataRepository.java delete mode 100644 Gameserver/src/test/java/ConfigContext.java diff --git a/Commons/build.gradle b/Commons/build.gradle index 22305127..d2afc6a8 100644 --- a/Commons/build.gradle +++ b/Commons/build.gradle @@ -9,7 +9,7 @@ version '1.3.1' ext.moduleName = 'com.l2jbr.commons' configurations.all { - transitive = false + transitive = true } sourceSets { @@ -24,8 +24,11 @@ sourceSets { } dependencies { - compile 'com.zaxxer:HikariCP:3.0.0' compile 'org.slf4j:slf4j-api:1.8.0-beta2' + compile ('org.springframework.data:spring-data-jdbc:1.0.0.BUILD-SNAPSHOT') { changing = true } + compile 'com.zaxxer:HikariCP:3.0.0' + + runtime 'mysql:mysql-connector-java:8.0.9-rc' } jar { diff --git a/Commons/src/main/com.l2jbr.commons/com/l2jbr/commons/database/AccountRepository.java b/Commons/src/main/com.l2jbr.commons/com/l2jbr/commons/database/AccountRepository.java new file mode 100644 index 00000000..35304fff --- /dev/null +++ b/Commons/src/main/com.l2jbr.commons/com/l2jbr/commons/database/AccountRepository.java @@ -0,0 +1,7 @@ +package com.l2jbr.commons.database; + +import com.l2jbr.commons.database.model.Account; +import org.springframework.data.repository.CrudRepository; + +public interface AccountRepository extends CrudRepository { +} diff --git a/Commons/src/main/com.l2jbr.commons/com/l2jbr/commons/database/AnnotationNamingStrategy.java b/Commons/src/main/com.l2jbr.commons/com/l2jbr/commons/database/AnnotationNamingStrategy.java new file mode 100644 index 00000000..9e786198 --- /dev/null +++ b/Commons/src/main/com.l2jbr.commons/com/l2jbr/commons/database/AnnotationNamingStrategy.java @@ -0,0 +1,34 @@ +package com.l2jbr.commons.database; + +import com.l2jbr.commons.database.annotation.Column; +import com.l2jbr.commons.database.annotation.Table; +import com.l2jbr.commons.util.Util; +import org.springframework.data.jdbc.mapping.model.JdbcPersistentProperty; +import org.springframework.data.jdbc.mapping.model.NamingStrategy; + +public class AnnotationNamingStrategy implements NamingStrategy { + + @Override + public String getTableName(Class type) { + Table tableAnnotation = type.getAnnotation(Table.class); + if(Util.isNotNull(tableAnnotation)) { + return tableAnnotation.value(); + } + return type.getSimpleName(); + } + + @Override + public String getColumnName(JdbcPersistentProperty property) { + Column columnAnnotation = property.getField().getAnnotation(Column.class); + if(Util.isNotNull(columnAnnotation)) { + return columnAnnotation.value(); + } + return property.getName(); + } + + @Override + public String getReverseColumnName(JdbcPersistentProperty property) { + return getColumnName(property); + + } +} diff --git a/Commons/src/main/com.l2jbr.commons/com/l2jbr/commons/database/DatabaseAccess.java b/Commons/src/main/com.l2jbr.commons/com/l2jbr/commons/database/DatabaseAccess.java new file mode 100644 index 00000000..07565375 --- /dev/null +++ b/Commons/src/main/com.l2jbr.commons/com/l2jbr/commons/database/DatabaseAccess.java @@ -0,0 +1,33 @@ +package com.l2jbr.commons.database; + +import org.springframework.data.repository.CrudRepository; + +import java.sql.SQLException; +import java.util.Map; +import java.util.WeakHashMap; + +public class DatabaseAccess { + + private static Map objects = new WeakHashMap<>(); + + + public static T getRepository(Class repositoryClass) { + + for (Map.Entry entry: objects.entrySet()) { + if(repositoryClass.equals(entry.getValue())) { + return (T) entry.getKey(); + } + } + T repository = null; + try { + repository = L2DatabaseFactory.getInstance().getRepository(repositoryClass); + objects.put(repository, repositoryClass); + } catch (SQLException e) { + + } + return repository; + } + + + +} diff --git a/Commons/src/main/com.l2jbr.commons/com/l2jbr/commons/database/DatabaseContextConfiguration.java b/Commons/src/main/com.l2jbr.commons/com/l2jbr/commons/database/DatabaseContextConfiguration.java new file mode 100644 index 00000000..ef5d0f21 --- /dev/null +++ b/Commons/src/main/com.l2jbr.commons/com/l2jbr/commons/database/DatabaseContextConfiguration.java @@ -0,0 +1,85 @@ +package com.l2jbr.commons.database; + +import com.l2jbr.commons.Config; +import com.l2jbr.commons.database.model.Model; +import com.zaxxer.hikari.HikariConfig; +import com.zaxxer.hikari.HikariDataSource; +import org.springframework.context.ApplicationListener; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.data.jdbc.mapping.event.AfterLoadEvent; +import org.springframework.data.jdbc.mapping.event.BeforeSaveEvent; +import org.springframework.data.jdbc.mapping.event.WithEntity; +import org.springframework.data.jdbc.mapping.model.NamingStrategy; +import org.springframework.data.jdbc.repository.config.EnableJdbcRepositories; +import org.springframework.jdbc.core.namedparam.NamedParameterJdbcOperations; +import org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate; + +import javax.sql.DataSource; +import java.util.Optional; + +@Configuration +@EnableJdbcRepositories +public class DatabaseContextConfiguration { + + @Bean + public HikariDataSource dataSource() { + HikariConfig dataSourceConfig = new HikariConfig(); + dataSourceConfig.addDataSourceProperty("driverClassName", Config.DATABASE_DRIVER); + dataSourceConfig.setJdbcUrl(Config.DATABASE_URL); + dataSourceConfig.setUsername(Config.DATABASE_LOGIN); + dataSourceConfig.setPassword(Config.DATABASE_PASSWORD); + dataSourceConfig.addDataSourceProperty("maximumPoolSize", Config.DATABASE_MAX_CONNECTIONS); + dataSourceConfig.addDataSourceProperty("idleTimeout", Config.DATABASE_MAX_IDLE_TIME); // 0 = idle connections never expire + dataSourceConfig.addDataSourceProperty("cachePrepStmts", true); + dataSourceConfig.addDataSourceProperty("prepStmtCacheSize", 250); + dataSourceConfig.addDataSourceProperty("prepStmtCacheSqlLimit", 2048); + dataSourceConfig.addDataSourceProperty("useServerPrepStmts", true); + dataSourceConfig.addDataSourceProperty("useLocalSessionState", true); + dataSourceConfig.addDataSourceProperty("useLocalTransactionState", true); + dataSourceConfig.addDataSourceProperty("rewriteBatchedStatements", true); + dataSourceConfig.addDataSourceProperty("cacheServerConfiguration", true); + dataSourceConfig.addDataSourceProperty("cacheResultSetMetadata", true); + dataSourceConfig.addDataSourceProperty("maintainTimeStats", true); + dataSourceConfig.addDataSourceProperty("logger", "com.mysql.cj.core.log.Slf4JLogger"); + dataSourceConfig.addDataSourceProperty("autoCommit", true); + dataSourceConfig.addDataSourceProperty("minimumIdle", 10); + dataSourceConfig.addDataSourceProperty("validationTimeout", 500); // 500 milliseconds wait before try to acquire connection again + dataSourceConfig.addDataSourceProperty("connectionTimeout", 0); // 0 = wait indefinitely for new connection if pool is exhausted + return new HikariDataSource(dataSourceConfig); + } + + @Bean + public NamedParameterJdbcOperations template(DataSource dataSource) { + return new NamedParameterJdbcTemplate(dataSource); + } + + @Bean + public NamingStrategy namingStrategy() { + return new AnnotationNamingStrategy(); + } + + @Bean + public ApplicationListener beforeSaveEventApplicationListener() { + return event -> { + extractModel(event).ifPresent(Model::onSave); + }; + } + + private Optional extractModel(WithEntity event) { + Object entity = event.getEntity(); + if (entity instanceof Model) { + return Optional.of((Model) entity); + } + return Optional.empty(); + } + + @Bean + public ApplicationListener afterLoadEventApplicationListener() { + return event -> { + extractModel(event).ifPresent(Model::onLoad); + }; + } + + +} diff --git a/Commons/src/main/com.l2jbr.commons/com/l2jbr/commons/database/L2DatabaseFactory.java b/Commons/src/main/com.l2jbr.commons/com/l2jbr/commons/database/L2DatabaseFactory.java index 072c52a5..7f793f98 100644 --- a/Commons/src/main/com.l2jbr.commons/com/l2jbr/commons/database/L2DatabaseFactory.java +++ b/Commons/src/main/com.l2jbr.commons/com/l2jbr/commons/database/L2DatabaseFactory.java @@ -19,13 +19,15 @@ package com.l2jbr.commons.database; import com.l2jbr.commons.Config; -import com.zaxxer.hikari.HikariConfig; import com.zaxxer.hikari.HikariDataSource; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import org.springframework.context.ApplicationContext; +import org.springframework.context.annotation.AnnotationConfigApplicationContext; import java.sql.Connection; import java.sql.SQLException; +import java.util.Optional; public class L2DatabaseFactory { @@ -33,36 +35,12 @@ public class L2DatabaseFactory { private static L2DatabaseFactory _instance; private final HikariDataSource _dataSource; + private final ApplicationContext context; public L2DatabaseFactory() throws SQLException { + context = new AnnotationConfigApplicationContext(DatabaseContextConfiguration.class); + _dataSource = context.getBean(HikariDataSource.class); - - HikariConfig config = new HikariConfig(); - config.setJdbcUrl(Config.DATABASE_URL); - config.setUsername(Config.DATABASE_LOGIN); - config.setPassword(Config.DATABASE_PASSWORD); - config.addDataSourceProperty("cachePrepStmts", true); - config.addDataSourceProperty("prepStmtCacheSize", 250); - config.addDataSourceProperty("prepStmtCacheSqlLimit", 2048); - config.addDataSourceProperty("useServerPrepStmts", true); - config.addDataSourceProperty("useLocalSessionState", true); - config.addDataSourceProperty("useLocalTransactionState", true); - config.addDataSourceProperty("rewriteBatchedStatements", true); - config.addDataSourceProperty("cacheServerConfiguration", true); - config.addDataSourceProperty("cacheResultSetMetadata", true); - config.addDataSourceProperty("maintainTimeStats", true); - config.addDataSourceProperty("logger", "com.mysql.cj.core.log.Slf4JLogger"); - config.addDataSourceProperty("autoCommit", true); - config.addDataSourceProperty("minimumIdle", 10); - config.addDataSourceProperty("validationTimeout", 500); // 500 milliseconds wait before try to acquire connection again - config.addDataSourceProperty("connectionTimeout", 0); // 0 = wait indefinitely for new connection if pool is exhausted - config.addDataSourceProperty("maximumPoolSize", Config.DATABASE_MAX_CONNECTIONS); - config.addDataSourceProperty("idleTimeout", Config.DATABASE_MAX_IDLE_TIME); // 0 = idle connections never expire - config.addDataSourceProperty("driverClassName", Config.DATABASE_DRIVER); - _dataSource = new HikariDataSource(config); - - - // Test DB connection try { _dataSource.getConnection().close(); } catch (SQLException e) { @@ -128,4 +106,14 @@ public Connection getConnection() //throws SQLException public static void close(Connection conn) { } + + public T getRepository(Class repositoryClass) { + try { + return context.getBean(repositoryClass); + }catch (Exception e) { + _log.error("could.not.retrieve.repository", e); + throw e; + } + } + } \ No newline at end of file diff --git a/Commons/src/main/com.l2jbr.commons/com/l2jbr/commons/database/annotation/Column.java b/Commons/src/main/com.l2jbr.commons/com/l2jbr/commons/database/annotation/Column.java new file mode 100644 index 00000000..f7e386c6 --- /dev/null +++ b/Commons/src/main/com.l2jbr.commons/com/l2jbr/commons/database/annotation/Column.java @@ -0,0 +1,13 @@ +package com.l2jbr.commons.database.annotation; + +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; + +@Target(ElementType.FIELD) +@Retention(RetentionPolicy.RUNTIME) +public @interface Column { + + String value() default ""; +} diff --git a/Commons/src/main/com.l2jbr.commons/com/l2jbr/commons/database/annotation/Table.java b/Commons/src/main/com.l2jbr.commons/com/l2jbr/commons/database/annotation/Table.java new file mode 100644 index 00000000..eaf8d0e2 --- /dev/null +++ b/Commons/src/main/com.l2jbr.commons/com/l2jbr/commons/database/annotation/Table.java @@ -0,0 +1,14 @@ +package com.l2jbr.commons.database.annotation; + + +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; + +@Target(ElementType.TYPE) +@Retention(RetentionPolicy.RUNTIME) +public @interface Table { + + String value(); +} diff --git a/Commons/src/main/com.l2jbr.commons/com/l2jbr/commons/database/dao/DAO.java b/Commons/src/main/com.l2jbr.commons/com/l2jbr/commons/database/dao/DAO.java deleted file mode 100644 index 985a09a5..00000000 --- a/Commons/src/main/com.l2jbr.commons/com/l2jbr/commons/database/dao/DAO.java +++ /dev/null @@ -1,4 +0,0 @@ -package com.l2jbr.commons.database.dao; - -public interface DAO { -} diff --git a/Commons/src/main/com.l2jbr.commons/com/l2jbr/commons/database/model/Account.java b/Commons/src/main/com.l2jbr.commons/com/l2jbr/commons/database/model/Account.java new file mode 100644 index 00000000..9f3dd9dd --- /dev/null +++ b/Commons/src/main/com.l2jbr.commons/com/l2jbr/commons/database/model/Account.java @@ -0,0 +1,58 @@ +package com.l2jbr.commons.database.model; + +import com.l2jbr.commons.database.annotation.Column; +import com.l2jbr.commons.database.annotation.Table; +import org.springframework.data.annotation.Id; + +@Table("accounts") +public class Account extends Model { + + @Id + private String login; + private String password; + private long lastActive; + @Column("access_level") + private short accessLevel; + private short lastServer; + private String lastIP; + + public Account() { } + + public Account(String login, String password, long lastActive, short accessLevel, short lastServer, String lastIP) { + this.login = login; + this.password = password; + this.lastActive = lastActive; + this.accessLevel = accessLevel; + this.lastIP = lastIP; + this.lastServer = lastServer; + } + + @Override + public String getId() { + return login; + } + + public short getAccessLevel() { + return accessLevel; + } + + public String getPassword() { + return password; + } + + public short getLastServer() { + return lastServer; + } + + public boolean isBanned() { + return accessLevel < 0; + } + + public void setLastActive(long lastActive) { + this.lastActive = lastActive; + } + + public void setLastIP(String lastIP) { + this.lastIP = lastIP; + } +} diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/account_data.java b/Commons/src/main/com.l2jbr.commons/com/l2jbr/commons/database/model/AccountData.java similarity index 58% rename from Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/account_data.java rename to Commons/src/main/com.l2jbr.commons/com/l2jbr/commons/database/model/AccountData.java index ec917aa8..959cadb3 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/account_data.java +++ b/Commons/src/main/com.l2jbr.commons/com/l2jbr/commons/database/model/AccountData.java @@ -1,23 +1,15 @@ -package com.l2jbr.gameserver.model.dao; +package com.l2jbr.commons.database.model; +import com.l2jbr.commons.database.annotation.Table; import org.springframework.data.annotation.Id; -public class account_data { +@Table("account_data") +public class AccountData extends Model { - - @Id String account_name; + @Id private String var; private String value; - - public String getAccountName() { - return account_name; - } - - public void setAccountName(String accountName) { - this.account_name = accountName; - } - public String getVar() { return var; } @@ -33,4 +25,10 @@ public String getValue() { public void setValue(String value) { this.value = value; } + + @Override + public String getId() { + return var; + } + } diff --git a/Commons/src/main/com.l2jbr.commons/com/l2jbr/commons/database/model/Model.java b/Commons/src/main/com.l2jbr.commons/com/l2jbr/commons/database/model/Model.java new file mode 100644 index 00000000..921988e6 --- /dev/null +++ b/Commons/src/main/com.l2jbr.commons/com/l2jbr/commons/database/model/Model.java @@ -0,0 +1,28 @@ +package com.l2jbr.commons.database.model; + +import org.springframework.data.annotation.Transient; +import org.springframework.data.domain.Persistable; + +public abstract class Model implements Persistable { + + @Transient + protected boolean isNew = true; + + @Override + public boolean isNew() { + return isNew; + } + + public void onSave() { + isNew = false; + } + + public void onLoad() { + isNew = false; + } + + public boolean isPersisted() { + return !isNew; + } + +} diff --git a/Commons/src/main/com.l2jbr.commons/com/l2jbr/commons/util/Util.java b/Commons/src/main/com.l2jbr.commons/com/l2jbr/commons/util/Util.java index cb880ecd..39ed4ace 100644 --- a/Commons/src/main/com.l2jbr.commons/com/l2jbr/commons/util/Util.java +++ b/Commons/src/main/com.l2jbr.commons/com/l2jbr/commons/util/Util.java @@ -93,12 +93,20 @@ public static String fillHex(int data, int digits) { return number; } - /** - * @param raw - * @return - */ + public static String printData(byte[] raw) { return printData(raw, raw.length); } + public static boolean isNull(Object obj) { + return obj == null; + } + + public static boolean isNotNull(Object obj) { + return obj != null; + } + + public static boolean isNullOrEmpty(String value) { + return isNull(value) || value.isEmpty(); + } } diff --git a/Commons/src/main/com.l2jbr.commons/module-info.java b/Commons/src/main/com.l2jbr.commons/module-info.java index 4ffa0b74..fdededc7 100644 --- a/Commons/src/main/com.l2jbr.commons/module-info.java +++ b/Commons/src/main/com.l2jbr.commons/module-info.java @@ -4,6 +4,10 @@ requires java.desktop; requires org.slf4j; requires com.zaxxer.hikari; + requires spring.data.commons; + requires spring.data.jdbc; + requires spring.context; + requires spring.jdbc; exports com.l2jbr.commons.util; exports com.l2jbr.commons.xml; @@ -12,6 +16,6 @@ exports com.l2jbr.commons.lib; exports com.l2jbr.commons; exports com.l2jbr.commons.database; - exports com.l2jbr.commons.database.dao; + exports com.l2jbr.commons.database.model; } \ No newline at end of file diff --git a/Commons/src/test/java/App.java b/Commons/src/test/java/App.java new file mode 100644 index 00000000..d7caf231 --- /dev/null +++ b/Commons/src/test/java/App.java @@ -0,0 +1,14 @@ +import com.l2jbr.commons.database.AccountRepository; +import com.l2jbr.commons.database.model.Account; +import org.springframework.context.annotation.AnnotationConfigApplicationContext; + +public class App { + + public static void main(String[] args) { + AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext(ConfigContext.class); + AccountRepository rep = context.getBean(AccountRepository.class); + Iterable result = rep.findAll(); + System.out.println(result); + + } +} diff --git a/Gameserver/build.gradle b/Gameserver/build.gradle index c000b82a..36cf19bd 100644 --- a/Gameserver/build.gradle +++ b/Gameserver/build.gradle @@ -70,8 +70,6 @@ task zip(type: Zip, group: "Archive", description: "Zip Gameserver") { exclude('gameserver-messages*properties') } - - destinationDir project.buildDir } diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/AccountData.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/AccountData.java index 5c97a322..585212dd 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/AccountData.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/AccountData.java @@ -1,8 +1,8 @@ package com.l2jbr.gameserver.model.dao; -import com.l2jbr.commons.database.dao.DAO; -public class AccountData implements DAO { + +public class AccountData { private String accountName; private String var; private String value; diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/Accounts.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/Accounts.java index db781f18..6909ab75 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/Accounts.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/Accounts.java @@ -1,8 +1,8 @@ package com.l2jbr.gameserver.model.dao; -import com.l2jbr.commons.database.dao.DAO; -public class Accounts implements DAO { + +public class Accounts { private String login; private String password; diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/Armor.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/Armor.java index aae53697..d6ba38fd 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/Armor.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/Armor.java @@ -1,8 +1,8 @@ package com.l2jbr.gameserver.model.dao; -import com.l2jbr.commons.database.dao.DAO; -public class Armor implements DAO { + +public class Armor { private int itemId; private String name; diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/Auction.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/Auction.java index 16d710e0..a32c647e 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/Auction.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/Auction.java @@ -1,8 +1,8 @@ package com.l2jbr.gameserver.model.dao; -import com.l2jbr.commons.database.dao.DAO; -public class Auction implements DAO { + +public class Auction { private int id; private int sellerId; diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/AuctionBid.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/AuctionBid.java index 09ef57e6..4c2cee65 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/AuctionBid.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/AuctionBid.java @@ -1,8 +1,8 @@ package com.l2jbr.gameserver.model.dao; -import com.l2jbr.commons.database.dao.DAO; -public class AuctionBid implements DAO { + +public class AuctionBid { private int id; private int auctionId; private int bidderId; diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/Augmentations.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/Augmentations.java index 91b007f1..d0b8d8e1 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/Augmentations.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/Augmentations.java @@ -1,8 +1,8 @@ package com.l2jbr.gameserver.model.dao; -import com.l2jbr.commons.database.dao.DAO; -public class Augmentations implements DAO { + +public class Augmentations { private int itemId; private int attributes; diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/AutoChat.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/AutoChat.java index 48b57018..c4f46ebc 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/AutoChat.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/AutoChat.java @@ -1,8 +1,8 @@ package com.l2jbr.gameserver.model.dao; -import com.l2jbr.commons.database.dao.DAO; -public class AutoChat implements DAO { + +public class AutoChat { private int groupId; private int npcId; diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/AutoChatText.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/AutoChatText.java index 41a31658..a66a9576 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/AutoChatText.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/AutoChatText.java @@ -1,8 +1,8 @@ package com.l2jbr.gameserver.model.dao; -import com.l2jbr.commons.database.dao.DAO; -public class AutoChatText implements DAO { + +public class AutoChatText { private int groupId; private String chatText; diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/BoxAccess.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/BoxAccess.java index ab248649..8313b055 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/BoxAccess.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/BoxAccess.java @@ -1,8 +1,8 @@ package com.l2jbr.gameserver.model.dao; -import com.l2jbr.commons.database.dao.DAO; -public class BoxAccess implements DAO { + +public class BoxAccess { private int spawn; private String charName; } diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/Boxes.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/Boxes.java index 80be4655..b8cdab6d 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/Boxes.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/Boxes.java @@ -1,8 +1,8 @@ package com.l2jbr.gameserver.model.dao; -import com.l2jbr.commons.database.dao.DAO; -public class Boxes implements DAO { + +public class Boxes { private int id; private int spawn; private int npcId; diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/Castle.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/Castle.java index bce0a4b4..b2b1e718 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/Castle.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/Castle.java @@ -1,8 +1,8 @@ package com.l2jbr.gameserver.model.dao; -import com.l2jbr.commons.database.dao.DAO; -public class Castle implements DAO { + +public class Castle { private int id; private String name; private int taxPercent; diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/CastleDoor.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/CastleDoor.java index 3a28d008..ac546a69 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/CastleDoor.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/CastleDoor.java @@ -1,8 +1,8 @@ package com.l2jbr.gameserver.model.dao; -import com.l2jbr.commons.database.dao.DAO; -public class CastleDoor implements DAO { + +public class CastleDoor { private int castleId; private int id; diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/CastleDoorUpgrade.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/CastleDoorUpgrade.java index 15a74cfe..38ab8751 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/CastleDoorUpgrade.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/CastleDoorUpgrade.java @@ -1,8 +1,8 @@ package com.l2jbr.gameserver.model.dao; -import com.l2jbr.commons.database.dao.DAO; -public class CastleDoorUpgrade implements DAO { + +public class CastleDoorUpgrade { private int doorId; private int hp; diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/CastleManorProcure.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/CastleManorProcure.java index f34f7107..28a0e640 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/CastleManorProcure.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/CastleManorProcure.java @@ -1,8 +1,8 @@ package com.l2jbr.gameserver.model.dao; -import com.l2jbr.commons.database.dao.DAO; -public class CastleManorProcure implements DAO { + +public class CastleManorProcure { private int castleId; private int cropId; diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/CastleManorProduction.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/CastleManorProduction.java index 31add91b..28852a1e 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/CastleManorProduction.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/CastleManorProduction.java @@ -1,8 +1,8 @@ package com.l2jbr.gameserver.model.dao; -import com.l2jbr.commons.database.dao.DAO; -public class CastleManorProduction implements DAO { + +public class CastleManorProduction { private int castleId; private int seedd; private int canproduce; diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/CastleSiegeGuard.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/CastleSiegeGuard.java index 364d8eb7..29d543da 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/CastleSiegeGuard.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/CastleSiegeGuard.java @@ -1,8 +1,8 @@ package com.l2jbr.gameserver.model.dao; -import com.l2jbr.commons.database.dao.DAO; -public class CastleSiegeGuard implements DAO { + +public class CastleSiegeGuard { private int castleId; private int id; diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/CharTemplates.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/CharTemplates.java index 968556c6..425c0ad6 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/CharTemplates.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/CharTemplates.java @@ -1,8 +1,8 @@ package com.l2jbr.gameserver.model.dao; -import com.l2jbr.commons.database.dao.DAO; -public class CharTemplates implements DAO { + +public class CharTemplates { private int classId; private String className; diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/CharacterFriends.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/CharacterFriends.java index 9b54c63b..7b20a977 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/CharacterFriends.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/CharacterFriends.java @@ -1,8 +1,8 @@ package com.l2jbr.gameserver.model.dao; -import com.l2jbr.commons.database.dao.DAO; -public class CharacterFriends implements DAO { + +public class CharacterFriends { private int char_id; private int friend_id; diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/CharacterHennas.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/CharacterHennas.java index 72399812..1e3e513e 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/CharacterHennas.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/CharacterHennas.java @@ -1,8 +1,8 @@ package com.l2jbr.gameserver.model.dao; -import com.l2jbr.commons.database.dao.DAO; -public class CharacterHennas implements DAO { + +public class CharacterHennas { private int char_obj_id; private int symbol_id; private int slot; diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/CharacterMacroses.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/CharacterMacroses.java index b30f749a..327e141d 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/CharacterMacroses.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/CharacterMacroses.java @@ -1,8 +1,8 @@ package com.l2jbr.gameserver.model.dao; -import com.l2jbr.commons.database.dao.DAO; -public class CharacterMacroses implements DAO { + +public class CharacterMacroses { private int char_obj_id; private int id; private int icon; diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/CharacterQuests.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/CharacterQuests.java index 9f9ecf75..b458691b 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/CharacterQuests.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/CharacterQuests.java @@ -1,8 +1,8 @@ package com.l2jbr.gameserver.model.dao; -import com.l2jbr.commons.database.dao.DAO; -public class CharacterQuests implements DAO { + +public class CharacterQuests { private int char_id; private String name; private String var; diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/CharacterRecipeBook.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/CharacterRecipeBook.java index d6181df5..3d25ee57 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/CharacterRecipeBook.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/CharacterRecipeBook.java @@ -1,8 +1,8 @@ package com.l2jbr.gameserver.model.dao; -import com.l2jbr.commons.database.dao.DAO; -public class CharacterRecipeBook implements DAO { + +public class CharacterRecipeBook { private int char_id; private int id; private int type; diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/CharacterRecommends.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/CharacterRecommends.java index 57bbe335..7c84e4c2 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/CharacterRecommends.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/CharacterRecommends.java @@ -1,8 +1,8 @@ package com.l2jbr.gameserver.model.dao; -import com.l2jbr.commons.database.dao.DAO; -public class CharacterRecommends implements DAO { + +public class CharacterRecommends { private int char_id; private int target_id; } diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/CharacterShortcuts.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/CharacterShortcuts.java index b8e77863..5604f8e8 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/CharacterShortcuts.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/CharacterShortcuts.java @@ -1,8 +1,8 @@ package com.l2jbr.gameserver.model.dao; -import com.l2jbr.commons.database.dao.DAO; -public class CharacterShortcuts implements DAO { + +public class CharacterShortcuts { private int char_obj_id; private int slot; private int page; diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/CharacterSkills.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/CharacterSkills.java index 8e17fa98..a10c7ee3 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/CharacterSkills.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/CharacterSkills.java @@ -1,8 +1,8 @@ package com.l2jbr.gameserver.model.dao; -import com.l2jbr.commons.database.dao.DAO; -public class CharacterSkills implements DAO { + +public class CharacterSkills { private int char_obj_id; private int skill_id; diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/CharacterSkillsSave.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/CharacterSkillsSave.java index 78cb6381..12553314 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/CharacterSkillsSave.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/CharacterSkillsSave.java @@ -1,8 +1,8 @@ package com.l2jbr.gameserver.model.dao; -import com.l2jbr.commons.database.dao.DAO; -public class CharacterSkillsSave implements DAO { + +public class CharacterSkillsSave { private int char_obj_id; private int skill_id; diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/CharacterSubclasses.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/CharacterSubclasses.java index e03cdaea..b428049a 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/CharacterSubclasses.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/CharacterSubclasses.java @@ -1,8 +1,8 @@ package com.l2jbr.gameserver.model.dao; -import com.l2jbr.commons.database.dao.DAO; -public class CharacterSubclasses implements DAO { + +public class CharacterSubclasses { private int char_obj_id; private int class_id; diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/Characters.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/Characters.java index ad9a840a..72231f6b 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/Characters.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/Characters.java @@ -1,8 +1,8 @@ package com.l2jbr.gameserver.model.dao; -import com.l2jbr.commons.database.dao.DAO; -public class Characters implements DAO { + +public class Characters { private String account_name; private int obj_Id; diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/ClanData.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/ClanData.java index 9aca3ea6..38135dca 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/ClanData.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/ClanData.java @@ -1,8 +1,8 @@ package com.l2jbr.gameserver.model.dao; -import com.l2jbr.commons.database.dao.DAO; -public class ClanData implements DAO { + +public class ClanData { private int clan_id; private String clan_name; diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/ClanHall.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/ClanHall.java index 209e2daa..b2c58ba7 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/ClanHall.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/ClanHall.java @@ -1,8 +1,8 @@ package com.l2jbr.gameserver.model.dao; -import com.l2jbr.commons.database.dao.DAO; -public class ClanHall implements DAO { + +public class ClanHall { private int id; private String name; diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/ClanHallFunctions.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/ClanHallFunctions.java index dc0f6f50..44af9df8 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/ClanHallFunctions.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/ClanHallFunctions.java @@ -1,8 +1,8 @@ package com.l2jbr.gameserver.model.dao; -import com.l2jbr.commons.database.dao.DAO; -public class ClanHallFunctions implements DAO { + +public class ClanHallFunctions { private int hall_id; private int type; diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/ClanPrivs.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/ClanPrivs.java index 77bc0115..43a53032 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/ClanPrivs.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/ClanPrivs.java @@ -1,8 +1,8 @@ package com.l2jbr.gameserver.model.dao; -import com.l2jbr.commons.database.dao.DAO; -public class ClanPrivs implements DAO { + +public class ClanPrivs { private int clan_id; private int rank; diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/ClanSkills.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/ClanSkills.java index 6e15a820..400258a1 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/ClanSkills.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/ClanSkills.java @@ -1,8 +1,8 @@ package com.l2jbr.gameserver.model.dao; -import com.l2jbr.commons.database.dao.DAO; -public class ClanSkills implements DAO { + +public class ClanSkills { private int clan_id; private int skill_id; private int skill_level; diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/ClanSubpledges.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/ClanSubpledges.java index 84e872c4..7119683d 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/ClanSubpledges.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/ClanSubpledges.java @@ -1,8 +1,6 @@ package com.l2jbr.gameserver.model.dao; -import com.l2jbr.commons.database.dao.DAO; - -public class ClanSubpledges implements DAO { +public class ClanSubpledges { private int clan_id; private int sub_pledge_id; diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/ClanWars.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/ClanWars.java index cd3b9ab4..e98e1c0b 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/ClanWars.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/ClanWars.java @@ -1,8 +1,8 @@ package com.l2jbr.gameserver.model.dao; -import com.l2jbr.commons.database.dao.DAO; -public class ClanWars implements DAO { + +public class ClanWars { private String clan1; private String clan2; diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/CursedWeapons.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/CursedWeapons.java index 549f8b0b..ac91d3c6 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/CursedWeapons.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/CursedWeapons.java @@ -1,8 +1,8 @@ package com.l2jbr.gameserver.model.dao; -import com.l2jbr.commons.database.dao.DAO; -public class CursedWeapons implements DAO { + +public class CursedWeapons { private int itemId; private int playerId; private int playerKarma; diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/DimensionalRift.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/DimensionalRift.java index 3557d67a..fca5cd9b 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/DimensionalRift.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/DimensionalRift.java @@ -1,8 +1,8 @@ package com.l2jbr.gameserver.model.dao; -import com.l2jbr.commons.database.dao.DAO; -public class DimensionalRift implements DAO { + +public class DimensionalRift { private int type; private int room_id; private int xMin; diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/DropList.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/DropList.java index db019ddd..3dda3186 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/DropList.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/DropList.java @@ -1,8 +1,8 @@ package com.l2jbr.gameserver.model.dao; -import com.l2jbr.commons.database.dao.DAO; -public class DropList implements DAO { + +public class DropList { private int mobId; private int itemId; private int min; diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/EnchantSkillTrees.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/EnchantSkillTrees.java index 432fcb55..83453c7e 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/EnchantSkillTrees.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/EnchantSkillTrees.java @@ -1,8 +1,8 @@ package com.l2jbr.gameserver.model.dao; -import com.l2jbr.commons.database.dao.DAO; -public class EnchantSkillTrees implements DAO { + +public class EnchantSkillTrees { private int skill_id; private int level; private String name; diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/EtcItem.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/EtcItem.java index d4d7f183..d4cb1e48 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/EtcItem.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/EtcItem.java @@ -1,8 +1,8 @@ package com.l2jbr.gameserver.model.dao; -import com.l2jbr.commons.database.dao.DAO; -public class EtcItem implements DAO { + +public class EtcItem { private int item_id; private String name; private String crystallizable; diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/Fish.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/Fish.java index ff609398..3fd8736a 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/Fish.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/Fish.java @@ -1,8 +1,8 @@ package com.l2jbr.gameserver.model.dao; -import com.l2jbr.commons.database.dao.DAO; -public class Fish implements DAO { + +public class Fish { private int id; private int level; private String name; diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/FishingSkillTrees.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/FishingSkillTrees.java index 09eb0f1a..73f671ca 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/FishingSkillTrees.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/FishingSkillTrees.java @@ -1,8 +1,8 @@ package com.l2jbr.gameserver.model.dao; -import com.l2jbr.commons.database.dao.DAO; -public class FishingSkillTrees implements DAO { + +public class FishingSkillTrees { private int skill_id; private int level; diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/Forums.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/Forums.java index c74194d2..0a067c4c 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/Forums.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/Forums.java @@ -1,8 +1,8 @@ package com.l2jbr.gameserver.model.dao; -import com.l2jbr.commons.database.dao.DAO; -public class Forums implements DAO { + +public class Forums { private int forum_id; private String forum_name; private int forum_parent; diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/Games.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/Games.java index 47b71d26..fa5cbb5e 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/Games.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/Games.java @@ -1,8 +1,8 @@ package com.l2jbr.gameserver.model.dao; -import com.l2jbr.commons.database.dao.DAO; -public class Games implements DAO { + +public class Games { private int id; private int idnr; diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/GlobalTasks.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/GlobalTasks.java index f1c2326e..b4904559 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/GlobalTasks.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/GlobalTasks.java @@ -1,8 +1,8 @@ package com.l2jbr.gameserver.model.dao; -import com.l2jbr.commons.database.dao.DAO; -public class GlobalTasks implements DAO { + +public class GlobalTasks { private int id; private String task; diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/HelperBuffList.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/HelperBuffList.java index 356d6574..57604e2e 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/HelperBuffList.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/HelperBuffList.java @@ -1,8 +1,8 @@ package com.l2jbr.gameserver.model.dao; -import com.l2jbr.commons.database.dao.DAO; -public class HelperBuffList implements DAO { + +public class HelperBuffList { private int id; private int skill_id; private String name; diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/Henna.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/Henna.java index 236e9ef8..445f9fa2 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/Henna.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/Henna.java @@ -1,8 +1,8 @@ package com.l2jbr.gameserver.model.dao; -import com.l2jbr.commons.database.dao.DAO; -public class Henna implements DAO { + +public class Henna { private int symbol_id; private String symbol_name; diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/HennaTrees.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/HennaTrees.java index e4060821..0284e009 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/HennaTrees.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/HennaTrees.java @@ -1,8 +1,8 @@ package com.l2jbr.gameserver.model.dao; -import com.l2jbr.commons.database.dao.DAO; -public class HennaTrees implements DAO { + +public class HennaTrees { private int class_id; private int symbol_id; } diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/Heroes.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/Heroes.java index 5312a450..b63caada 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/Heroes.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/Heroes.java @@ -1,8 +1,8 @@ package com.l2jbr.gameserver.model.dao; -import com.l2jbr.commons.database.dao.DAO; -public class Heroes implements DAO { + +public class Heroes { private int char_id; private String char_name; private int class_id; diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/Items.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/Items.java index 5ca0f2f9..99a16dca 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/Items.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/Items.java @@ -1,8 +1,8 @@ package com.l2jbr.gameserver.model.dao; -import com.l2jbr.commons.database.dao.DAO; -public class Items implements DAO { + +public class Items { private int owner_id; private int object_id; diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/ItemsOnGround.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/ItemsOnGround.java index 5990ab58..7192cec4 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/ItemsOnGround.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/ItemsOnGround.java @@ -1,8 +1,8 @@ package com.l2jbr.gameserver.model.dao; -import com.l2jbr.commons.database.dao.DAO; -public class ItemsOnGround implements DAO { + +public class ItemsOnGround { private int object_id; private int item_id; private int count; diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/LevelUpGain.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/LevelUpGain.java index 71b7fa5e..2289d99b 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/LevelUpGain.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/LevelUpGain.java @@ -1,8 +1,8 @@ package com.l2jbr.gameserver.model.dao; -import com.l2jbr.commons.database.dao.DAO; -public class LevelUpGain implements DAO { + +public class LevelUpGain { private int classid; private int defaulthpbase; private int defaulthpadd; diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/Locations.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/Locations.java index a859bd68..019d94b3 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/Locations.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/Locations.java @@ -1,8 +1,8 @@ package com.l2jbr.gameserver.model.dao; -import com.l2jbr.commons.database.dao.DAO; -public class Locations implements DAO { + +public class Locations { private int loc_id; private int loc_x; diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/MapRegion.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/MapRegion.java index c45d62df..eaa7c70d 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/MapRegion.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/MapRegion.java @@ -1,8 +1,8 @@ package com.l2jbr.gameserver.model.dao; -import com.l2jbr.commons.database.dao.DAO; -public class MapRegion implements DAO { + +public class MapRegion { private int region; private int sec0; private int sec1; diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/MerchantAreasList.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/MerchantAreasList.java index 61f5d4bb..660e80ad 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/MerchantAreasList.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/MerchantAreasList.java @@ -1,8 +1,8 @@ package com.l2jbr.gameserver.model.dao; -import com.l2jbr.commons.database.dao.DAO; -public class MerchantAreasList implements DAO { + +public class MerchantAreasList { private int merchant_area_id; private String merchant_area_name; private float tax; diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/MerchantBuyList.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/MerchantBuyList.java index 44af461f..1cc11bb6 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/MerchantBuyList.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/MerchantBuyList.java @@ -1,8 +1,8 @@ package com.l2jbr.gameserver.model.dao; -import com.l2jbr.commons.database.dao.DAO; -public class MerchantBuyList implements DAO { + +public class MerchantBuyList { private int item_id; private int price; diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/MerchantLease.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/MerchantLease.java index 0c7231be..fd9b5500 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/MerchantLease.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/MerchantLease.java @@ -1,8 +1,8 @@ package com.l2jbr.gameserver.model.dao; -import com.l2jbr.commons.database.dao.DAO; -public class MerchantLease implements DAO { + +public class MerchantLease { private int merchant_id; private int player_id; private int bid; diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/MerchantShopIds.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/MerchantShopIds.java index cd2cbe6d..7ec4d4a0 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/MerchantShopIds.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/MerchantShopIds.java @@ -1,8 +1,8 @@ package com.l2jbr.gameserver.model.dao; -import com.l2jbr.commons.database.dao.DAO; -public class MerchantShopIds implements DAO { + +public class MerchantShopIds { private int shop_id; private String npc_id; diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/Merchants.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/Merchants.java index 66c9c0b2..33beb106 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/Merchants.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/Merchants.java @@ -1,8 +1,8 @@ package com.l2jbr.gameserver.model.dao; -import com.l2jbr.commons.database.dao.DAO; -public class Merchants implements DAO { + +public class Merchants { private int npc_id; private int merchant_area_id; } diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/Minions.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/Minions.java index 06b2091a..c7df56e1 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/Minions.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/Minions.java @@ -1,8 +1,8 @@ package com.l2jbr.gameserver.model.dao; -import com.l2jbr.commons.database.dao.DAO; -public class Minions implements DAO { + +public class Minions { private int boss_id; private int minion_id; private int amount_min; diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/ModsWedding.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/ModsWedding.java index fd8c7bfb..c7021fc2 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/ModsWedding.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/ModsWedding.java @@ -1,8 +1,8 @@ package com.l2jbr.gameserver.model.dao; -import com.l2jbr.commons.database.dao.DAO; -public class ModsWedding implements DAO { + +public class ModsWedding { private int id; private int player1Id; diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/Npc.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/Npc.java index a18b89b3..ffa49632 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/Npc.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/Npc.java @@ -1,8 +1,8 @@ package com.l2jbr.gameserver.model.dao; -import com.l2jbr.commons.database.dao.DAO; -public class Npc implements DAO { + +public class Npc { private int id; private int idTemplate; diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/OlympiadNobles.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/OlympiadNobles.java index 9b26e003..930f9cc0 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/OlympiadNobles.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/OlympiadNobles.java @@ -1,8 +1,8 @@ package com.l2jbr.gameserver.model.dao; -import com.l2jbr.commons.database.dao.DAO; -public class OlympiadNobles implements DAO { + +public class OlympiadNobles { private int char_id; private int class_id; diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/Pets.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/Pets.java index 2c5894db..481f08b0 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/Pets.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/Pets.java @@ -1,8 +1,8 @@ package com.l2jbr.gameserver.model.dao; -import com.l2jbr.commons.database.dao.DAO; -public class Pets implements DAO { + +public class Pets { private int item_obj_id; private String name; diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/PetsStats.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/PetsStats.java index 433dd1b9..71e33412 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/PetsStats.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/PetsStats.java @@ -1,8 +1,8 @@ package com.l2jbr.gameserver.model.dao; -import com.l2jbr.commons.database.dao.DAO; -public class PetsStats implements DAO { + +public class PetsStats { private String type; private int typeID; diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/PledgeSkillTrees.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/PledgeSkillTrees.java index db7bbe34..10bbc8f9 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/PledgeSkillTrees.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/PledgeSkillTrees.java @@ -1,8 +1,8 @@ package com.l2jbr.gameserver.model.dao; -import com.l2jbr.commons.database.dao.DAO; -public class PledgeSkillTrees implements DAO { + +public class PledgeSkillTrees { private int skill_id; private int level; diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/Posts.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/Posts.java index 7b4f4cf0..570fa339 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/Posts.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/Posts.java @@ -1,8 +1,6 @@ package com.l2jbr.gameserver.model.dao; -import com.l2jbr.commons.database.dao.DAO; - -public class Posts implements DAO { +public class Posts { private int post_id; private String post_owner_name; private int post_ownerid; diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/QuestGlobalData.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/QuestGlobalData.java index f902aa14..9b98f687 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/QuestGlobalData.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/QuestGlobalData.java @@ -1,8 +1,8 @@ package com.l2jbr.gameserver.model.dao; -import com.l2jbr.commons.database.dao.DAO; -public class QuestGlobalData implements DAO { + +public class QuestGlobalData { private String quest_name; private String var; diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/RaidbossSpawnList.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/RaidbossSpawnList.java index b4c56ade..23b0dc88 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/RaidbossSpawnList.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/RaidbossSpawnList.java @@ -1,8 +1,8 @@ package com.l2jbr.gameserver.model.dao; -import com.l2jbr.commons.database.dao.DAO; -public class RaidbossSpawnList implements DAO { + +public class RaidbossSpawnList { private int boss_id; private int amount; private int loc_x; diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/RandomSpawn.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/RandomSpawn.java index 32b7ab75..543b01f6 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/RandomSpawn.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/RandomSpawn.java @@ -1,8 +1,8 @@ package com.l2jbr.gameserver.model.dao; -import com.l2jbr.commons.database.dao.DAO; -public class RandomSpawn implements DAO { + +public class RandomSpawn { private int groupId; private int npcId; diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/RandomSpawnLoc.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/RandomSpawnLoc.java index cbeda4c1..5ed7a7a0 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/RandomSpawnLoc.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/RandomSpawnLoc.java @@ -1,8 +1,8 @@ package com.l2jbr.gameserver.model.dao; -import com.l2jbr.commons.database.dao.DAO; -public class RandomSpawnLoc implements DAO { + +public class RandomSpawnLoc { private int groupId; private int x; diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/SevenSigns.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/SevenSigns.java index 2972f5a8..43934467 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/SevenSigns.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/SevenSigns.java @@ -1,8 +1,8 @@ package com.l2jbr.gameserver.model.dao; -import com.l2jbr.commons.database.dao.DAO; -public class SevenSigns implements DAO { + +public class SevenSigns { private int char_obj_id; private String cabal; private int seal; diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/SevenSignsFestival.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/SevenSignsFestival.java index f6a07150..dc580cbe 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/SevenSignsFestival.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/SevenSignsFestival.java @@ -1,8 +1,8 @@ package com.l2jbr.gameserver.model.dao; -import com.l2jbr.commons.database.dao.DAO; -public class SevenSignsFestival implements DAO { + +public class SevenSignsFestival { private int festivalId; private String cabal; private int cycle; diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/SevenSignsStatus.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/SevenSignsStatus.java index d3f5a17a..f28a0e79 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/SevenSignsStatus.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/SevenSignsStatus.java @@ -1,8 +1,8 @@ package com.l2jbr.gameserver.model.dao; -import com.l2jbr.commons.database.dao.DAO; -public class SevenSignsStatus implements DAO { + +public class SevenSignsStatus { private int id; private int current_cycle; diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/SiegeClan.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/SiegeClan.java index 833f69cd..b2233c92 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/SiegeClan.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/SiegeClan.java @@ -1,8 +1,8 @@ package com.l2jbr.gameserver.model.dao; -import com.l2jbr.commons.database.dao.DAO; -public class SiegeClan implements DAO { + +public class SiegeClan { private int castle_id; private int clan_id; private int type; diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/SkillLearn.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/SkillLearn.java index 8c89f061..a636984e 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/SkillLearn.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/SkillLearn.java @@ -1,8 +1,8 @@ package com.l2jbr.gameserver.model.dao; -import com.l2jbr.commons.database.dao.DAO; -public class SkillLearn implements DAO { + +public class SkillLearn { private int npc_id; private int class_id; diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/SkillSpellBooks.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/SkillSpellBooks.java index fec93767..8b6875d6 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/SkillSpellBooks.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/SkillSpellBooks.java @@ -1,8 +1,8 @@ package com.l2jbr.gameserver.model.dao; -import com.l2jbr.commons.database.dao.DAO; -public class SkillSpellBooks implements DAO { + +public class SkillSpellBooks { private int skill_id; private int item_id; } diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/SkillTrees.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/SkillTrees.java index 948ef174..c51f7ed6 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/SkillTrees.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/SkillTrees.java @@ -1,8 +1,8 @@ package com.l2jbr.gameserver.model.dao; -import com.l2jbr.commons.database.dao.DAO; -public class SkillTrees implements DAO { + +public class SkillTrees { private int class_id; private int skill_id; diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/Spawnlist.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/Spawnlist.java index 6ed5480a..83356cef 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/Spawnlist.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/Spawnlist.java @@ -1,8 +1,8 @@ package com.l2jbr.gameserver.model.dao; -import com.l2jbr.commons.database.dao.DAO; -public class Spawnlist implements DAO { + +public class Spawnlist { private int id; private String location; private int count; diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/Teleport.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/Teleport.java index 132b6296..a32babed 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/Teleport.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/Teleport.java @@ -1,8 +1,6 @@ package com.l2jbr.gameserver.model.dao; -import com.l2jbr.commons.database.dao.DAO; - -public class Teleport implements DAO { +public class Teleport { private String Description; private int id; private int loc_x; diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/Topic.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/Topic.java index 50b8a3e6..4de80ca2 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/Topic.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/Topic.java @@ -1,8 +1,8 @@ package com.l2jbr.gameserver.model.dao; -import com.l2jbr.commons.database.dao.DAO; -public class Topic implements DAO { + +public class Topic { private int topic_id; private int topic_forum_id; diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/WalkerRoutes.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/WalkerRoutes.java index 22261911..85c93c84 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/WalkerRoutes.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/WalkerRoutes.java @@ -1,8 +1,8 @@ package com.l2jbr.gameserver.model.dao; -import com.l2jbr.commons.database.dao.DAO; -public class WalkerRoutes implements DAO { + +public class WalkerRoutes { private int route_id; private int npc_id; private int move_point; diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/Weapon.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/Weapon.java index a07caa18..7f5d722c 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/Weapon.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/Weapon.java @@ -1,8 +1,8 @@ package com.l2jbr.gameserver.model.dao; -import com.l2jbr.commons.database.dao.DAO; -public class Weapon implements DAO { + +public class Weapon { private String item_id; private String name; private String bodypart; diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/Zone.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/Zone.java index ee04fa61..e84bf7e4 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/Zone.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/Zone.java @@ -1,8 +1,8 @@ package com.l2jbr.gameserver.model.dao; -import com.l2jbr.commons.database.dao.DAO; -public class Zone implements DAO { + +public class Zone { private int id; private String type; private String name; diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/ZoneVertices.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/ZoneVertices.java index 045fa568..517112dd 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/ZoneVertices.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/ZoneVertices.java @@ -1,8 +1,8 @@ package com.l2jbr.gameserver.model.dao; -import com.l2jbr.commons.database.dao.DAO; -public class ZoneVertices implements DAO { + +public class ZoneVertices { private int id; private int order; private int x; diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/classList.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/classList.java index a5590d35..7c02ab9c 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/classList.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/classList.java @@ -1,8 +1,8 @@ package com.l2jbr.gameserver.model.dao; -import com.l2jbr.commons.database.dao.DAO; -public class classList implements DAO { + +public class classList { private String class_name; private int id; private int parent_id; diff --git a/Gameserver/src/test/java/AccountDataRepository.java b/Gameserver/src/test/java/AccountDataRepository.java deleted file mode 100644 index 8ded6363..00000000 --- a/Gameserver/src/test/java/AccountDataRepository.java +++ /dev/null @@ -1,5 +0,0 @@ -import com.l2jbr.gameserver.model.dao.account_data; -import org.springframework.data.repository.CrudRepository; - -public interface AccountDataRepository extends CrudRepository { -} diff --git a/Gameserver/src/test/java/ConfigContext.java b/Gameserver/src/test/java/ConfigContext.java deleted file mode 100644 index 2ea447b6..00000000 --- a/Gameserver/src/test/java/ConfigContext.java +++ /dev/null @@ -1,35 +0,0 @@ -import com.zaxxer.hikari.HikariConfig; -import com.zaxxer.hikari.HikariDataSource; -import org.springframework.context.annotation.Bean; -import org.springframework.context.annotation.Configuration; -import org.springframework.core.env.Environment; -import org.springframework.data.jdbc.repository.config.EnableJdbcRepositories; -import org.springframework.jdbc.core.namedparam.NamedParameterJdbcOperations; -import org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate; - -import javax.sql.DataSource; - -@Configuration -@EnableJdbcRepositories -public class ConfigContext { - - @Bean - public DataSource dataSource(Environment env) { - HikariConfig dataSourceConfig = new HikariConfig(); - dataSourceConfig.setDriverClassName("com.mysql.cj.jdbc.Driver"); - dataSourceConfig.setJdbcUrl("jdbc:mysql://localhost/l2jdb"); - dataSourceConfig.setUsername("root"); - dataSourceConfig.setPassword("root"); - return new HikariDataSource(dataSourceConfig); - } - - @Bean - public NamedParameterJdbcOperations template(DataSource dataSource) { - return new NamedParameterJdbcTemplate(dataSource); - } - - @Bean - public App app() { - return new App(); - } -} diff --git a/Loginserver/build.gradle b/Loginserver/build.gradle index eae0da79..3329834e 100644 --- a/Loginserver/build.gradle +++ b/Loginserver/build.gradle @@ -2,8 +2,10 @@ plugins { id "java" id "idea" id "eclipse" + id "application" } ext.moduleName = 'com.l2jbr.loginserver' +mainClassName = "com.l2jbr.loginserver.L2LoginServer" version '1.3.1' @@ -19,7 +21,7 @@ sourceSets { } configurations.all { - transitive = false + transitive = true } dependencies { @@ -27,14 +29,13 @@ dependencies { compile project(':Mmocore') compile 'org.slf4j:slf4j-api:1.8.0-beta2' + compile ('org.springframework.data:spring-data-jdbc:1.0.0.BUILD-SNAPSHOT') { changing = true } runtime 'org.apache.logging.log4j:log4j-core:2.11.0' runtime 'org.apache.logging.log4j:log4j-api:2.11.0' runtime 'org.apache.logging.log4j:log4j-slf4j-impl:2.11.0' runtime 'com.zaxxer:HikariCP:3.0.0' runtime 'mysql:mysql-connector-java:8.0.9-rc' - - } diff --git a/Loginserver/src/main/com.l2jbr.loginserver/com/l2jbr/loginserver/LoginController.java b/Loginserver/src/main/com.l2jbr.loginserver/com/l2jbr/loginserver/LoginController.java index e26923a5..81d8f91b 100644 --- a/Loginserver/src/main/com.l2jbr.loginserver/com/l2jbr/loginserver/LoginController.java +++ b/Loginserver/src/main/com.l2jbr.loginserver/com/l2jbr/loginserver/LoginController.java @@ -20,7 +20,10 @@ import com.l2jbr.commons.Base64; import com.l2jbr.commons.Config; +import com.l2jbr.commons.database.AccountRepository; +import com.l2jbr.commons.database.DatabaseAccess; import com.l2jbr.commons.database.L2DatabaseFactory; +import com.l2jbr.commons.database.model.Account; import com.l2jbr.commons.lib.Log; import com.l2jbr.commons.util.Rnd; import com.l2jbr.loginserver.GameServerTable.GameServerInfo; @@ -346,6 +349,7 @@ public boolean isLoginPossible(L2LoginClient client, int serverId) { boolean loginOk = ((gsi.getCurrentPlayerCount() < gsi.getMaxPlayers()) && (gsi.getStatus() != ServerStatus.STATUS_GM_ONLY)) || (access >= Config.GM_MIN); if (loginOk && (client.getLastServer() != serverId)) { + try (Connection con = L2DatabaseFactory.getInstance().getConnection(); PreparedStatement statement = con.prepareStatement("UPDATE accounts SET lastServer = ? WHERE login = ?")) { statement.setInt(1, serverId); @@ -421,81 +425,61 @@ public boolean loginValid(String user, String password, L2LoginClient client) { return false; } - try (Connection con = L2DatabaseFactory.getInstance().getConnection(); - PreparedStatement ps1 = con.prepareStatement("SELECT password, access_level, lastServer FROM accounts WHERE login=?")) { + try { MessageDigest md = MessageDigest.getInstance("SHA"); byte[] raw = password.getBytes("UTF-8"); byte[] hash = md.digest(raw); - byte[] expected = null; - int access = 0; - int lastServer = 1; + AccountRepository repository = DatabaseAccess.getRepository(AccountRepository.class); + Optional optionalAccount = repository.findById(user); - ps1.setString(1, user); - try (ResultSet rset = ps1.executeQuery()) { - if (rset.next()) { - expected = Base64.decode(rset.getString("password")); - access = rset.getInt("access_level"); - lastServer = rset.getInt("lastServer"); - if (lastServer <= 0) { - lastServer = 1; // minServerId is 1 in Interlude - } - if (Config.DEBUG) { - _log.debug("account exists"); - } - } - } + if (optionalAccount.isPresent()) { + _log.debug("account exists"); + Account account = optionalAccount.get(); - // if account doesnt exists - if (expected == null) { - if (Config.AUTO_CREATE_ACCOUNTS) { - if ((user.length() >= 2) && (user.length() <= 14)) { - try (PreparedStatement ps2 = con.prepareStatement("INSERT INTO accounts (login,password,lastactive,access_level,lastIP) values(?,?,?,?,?)")) { - ps2.setString(1, user); - ps2.setString(2, Base64.encodeBytes(hash)); - ps2.setLong(3, System.currentTimeMillis()); - ps2.setInt(4, 0); - ps2.setString(5, address.getHostAddress()); - ps2.execute(); - } + if (account.isBanned()) { + client.setAccessLevel(account.getAccessLevel()); + return false; + } - _log.info("created new account for " + user); - return true; + byte[] expected = Base64.decode(account.getPassword()); + // check password hash + ok = true; + for (int i = 0; i < expected.length; i++) { + if (hash[i] != expected[i]) { + ok = false; + break; } - _log.warn("Invalid username creation/use attempt: " + user); - return false; } - _log.warn("account missing for user " + user); - return false; - } - - // is this account banned? - if (access < 0) { - client.setAccessLevel(access); - return false; - } - // check password hash - ok = true; - for (int i = 0; i < expected.length; i++) { - if (hash[i] != expected[i]) { - ok = false; - break; + if (ok) { + client.setAccessLevel(account.getAccessLevel()); + client.setLastServer(account.getLastServer()); + account.setLastActive(System.currentTimeMillis()); + account.setLastIP(address.getHostAddress()); + repository.save(account); } - } - if (ok) { - client.setAccessLevel(access); - client.setLastServer(lastServer); - try (PreparedStatement ps3 = con.prepareStatement("UPDATE accounts SET lastactive=?, lastIP=? WHERE login=?")) { - ps3.setLong(1, System.currentTimeMillis()); - ps3.setString(2, address.getHostAddress()); - ps3.setString(3, user); - ps3.execute(); + + } else if (Config.AUTO_CREATE_ACCOUNTS) { + if ((user.length() >= 2) && (user.length() <= 14)) { + String pwd = Base64.encodeBytes(hash); + long lastActive = System.currentTimeMillis(); + Account account = new Account(user, pwd, lastActive, (short) 0, (short) 1, address.getHostAddress()); + + if (repository.save(account).isPersisted()) { + _log.debug("created new account for {}", user); + return true; + } + _log.debug("Invalid username creation/use attempt: {}", user); + return false; } + } - } catch (Exception e) { + _log.debug("account missing for user {}", user); + return false; + }catch (Exception e) { _log.warn("Could not check password:" + e); ok = false; } diff --git a/Loginserver/src/main/com.l2jbr.loginserver/com/l2jbr/loginserver/status/LoginStatusThread.java b/Loginserver/src/main/com.l2jbr.loginserver/com/l2jbr/loginserver/status/LoginStatusThread.java index 378ecd25..800b80ad 100644 --- a/Loginserver/src/main/com.l2jbr.loginserver/com/l2jbr/loginserver/status/LoginStatusThread.java +++ b/Loginserver/src/main/com.l2jbr.loginserver/com/l2jbr/loginserver/status/LoginStatusThread.java @@ -245,17 +245,14 @@ private boolean validPassword(String password) return false; } - /** - * @param login - * @return - */ + private boolean validLogin(String login) { if (!LoginController.getInstance().isGM(login)) { return false; } - + try (Connection con = L2DatabaseFactory.getInstance().getConnection(); PreparedStatement statement = con.prepareStatement("SELECT password FROM accounts WHERE login=?")) { diff --git a/Loginserver/src/main/com.l2jbr.loginserver/module-info.java b/Loginserver/src/main/com.l2jbr.loginserver/module-info.java index c4ea4e2e..9ee3e879 100644 --- a/Loginserver/src/main/com.l2jbr.loginserver/module-info.java +++ b/Loginserver/src/main/com.l2jbr.loginserver/module-info.java @@ -5,6 +5,7 @@ requires java.xml; requires java.sql; requires org.slf4j; + requires spring.data.commons; exports com.l2jbr.loginserver; } \ No newline at end of file diff --git a/Tools/build.gradle b/Tools/build.gradle index 396cb42e..7501b801 100644 --- a/Tools/build.gradle +++ b/Tools/build.gradle @@ -19,7 +19,6 @@ sourceSets { } } - dependencies { compile project(':Commons') compile project(":Loginserver") From 58d835be568a8c8f303c582c61c7e5d60f9ef832 Mon Sep 17 00:00:00 2001 From: Alisson Oliveira Date: Mon, 16 Apr 2018 19:14:58 -0300 Subject: [PATCH 007/236] remove unchecked --- .../commons/database/AccountRepository.java | 7 + .../commons/database/DatabaseAccess.java | 32 +- .../l2jbr/commons/database/model/Account.java | 6 +- .../sql/experimental/l2j_full_structure.sql | 10 +- Tools/bin/RegisterGameServer.sh | 2 +- Tools/bin/startSQLAccountManager.sh | 2 +- Tools/build.gradle | 13 +- .../accountmanager/SQLAccountManager.java | 599 ++++++++---------- .../src/main/com.l2jbr.tools/module-info.java | 4 +- 9 files changed, 303 insertions(+), 372 deletions(-) diff --git a/Commons/src/main/com.l2jbr.commons/com/l2jbr/commons/database/AccountRepository.java b/Commons/src/main/com.l2jbr.commons/com/l2jbr/commons/database/AccountRepository.java index 35304fff..325f0224 100644 --- a/Commons/src/main/com.l2jbr.commons/com/l2jbr/commons/database/AccountRepository.java +++ b/Commons/src/main/com.l2jbr.commons/com/l2jbr/commons/database/AccountRepository.java @@ -1,7 +1,14 @@ package com.l2jbr.commons.database; import com.l2jbr.commons.database.model.Account; +import org.springframework.data.jdbc.repository.query.Modifying; +import org.springframework.data.jdbc.repository.query.Query; import org.springframework.data.repository.CrudRepository; +import org.springframework.data.repository.query.Param; public interface AccountRepository extends CrudRepository { + + @Modifying + @Query("REPLACE accounts (login, password, access_level) values (:login, :password, :accessLevel)") + int replaceAccount(@Param("login") String login, @Param("password") String password, @Param("accessLevel") short accessLevel); } diff --git a/Commons/src/main/com.l2jbr.commons/com/l2jbr/commons/database/DatabaseAccess.java b/Commons/src/main/com.l2jbr.commons/com/l2jbr/commons/database/DatabaseAccess.java index 07565375..c35022a2 100644 --- a/Commons/src/main/com.l2jbr.commons/com/l2jbr/commons/database/DatabaseAccess.java +++ b/Commons/src/main/com.l2jbr.commons/com/l2jbr/commons/database/DatabaseAccess.java @@ -10,24 +10,24 @@ public class DatabaseAccess { private static Map objects = new WeakHashMap<>(); + public static T getRepository(Class repositoryClass) { - public static T getRepository(Class repositoryClass) { - - for (Map.Entry entry: objects.entrySet()) { - if(repositoryClass.equals(entry.getValue())) { - return (T) entry.getKey(); + for (Map.Entry entry : objects.entrySet()) { + if (repositoryClass.equals(entry.getValue())) { + if(entry.getKey().getClass().isAssignableFrom(repositoryClass)) { + return repositoryClass.cast(entry.getKey()); + } } - } - T repository = null; - try { - repository = L2DatabaseFactory.getInstance().getRepository(repositoryClass); - objects.put(repository, repositoryClass); - } catch (SQLException e) { - - } - return repository; - } - + } + T repository = null; + try { + repository = L2DatabaseFactory.getInstance().getRepository(repositoryClass); + objects.put(repository, repositoryClass); + } catch (SQLException e) { + + } + return repository; + } } diff --git a/Commons/src/main/com.l2jbr.commons/com/l2jbr/commons/database/model/Account.java b/Commons/src/main/com.l2jbr.commons/com/l2jbr/commons/database/model/Account.java index 9f3dd9dd..e355f50b 100644 --- a/Commons/src/main/com.l2jbr.commons/com/l2jbr/commons/database/model/Account.java +++ b/Commons/src/main/com.l2jbr.commons/com/l2jbr/commons/database/model/Account.java @@ -10,7 +10,7 @@ public class Account extends Model { @Id private String login; private String password; - private long lastActive; + private Long lastActive; @Column("access_level") private short accessLevel; private short lastServer; @@ -55,4 +55,8 @@ public void setLastActive(long lastActive) { public void setLastIP(String lastIP) { this.lastIP = lastIP; } + + public void setAccessLevel(Short accessLevel) { + this.accessLevel = accessLevel; + } } diff --git a/Datapack/sql/experimental/l2j_full_structure.sql b/Datapack/sql/experimental/l2j_full_structure.sql index c0383007..a5613371 100644 --- a/Datapack/sql/experimental/l2j_full_structure.sql +++ b/Datapack/sql/experimental/l2j_full_structure.sql @@ -28,11 +28,11 @@ DROP TABLE IF EXISTS `accounts` ; CREATE TABLE IF NOT EXISTS `accounts` ( `login` VARCHAR(45) NOT NULL DEFAULT '', - `password` VARCHAR(45) NULL DEFAULT NULL, - `lastactive` DECIMAL(20,0) NULL DEFAULT NULL, - `access_level` INT(11) NULL DEFAULT NULL, - `lastIP` VARCHAR(20) NULL DEFAULT NULL, - `lastServer` INT(4) NULL DEFAULT '1', + `password` VARCHAR(45) DEFAULT NULL, + `lastactive` DECIMAL(20,0) DEFAULT NULL, + `access_level` INT(11) DEFAULT NULL, + `lastIP` VARCHAR(20) DEFAULT NULL, + `lastServer` INT(4) NOT NULL DEFAULT '1', PRIMARY KEY (`login`)) ENGINE = InnoDB DEFAULT CHARACTER SET = latin1; diff --git a/Tools/bin/RegisterGameServer.sh b/Tools/bin/RegisterGameServer.sh index b76634c6..965e7868 100644 --- a/Tools/bin/RegisterGameServer.sh +++ b/Tools/bin/RegisterGameServer.sh @@ -1,2 +1,2 @@ #!/bin/sh -java -Djava.util.logging.config.file=console.cfg -cp './lib/*' com.l2jbr.tools.gsregistering.GameServerRegister +java -cp './lib/*' com.l2jbr.tools.gsregistering.GameServerRegister diff --git a/Tools/bin/startSQLAccountManager.sh b/Tools/bin/startSQLAccountManager.sh index e40e82b4..aa07f242 100644 --- a/Tools/bin/startSQLAccountManager.sh +++ b/Tools/bin/startSQLAccountManager.sh @@ -1,2 +1,2 @@ #!/bin/sh -java -Djava.util.logging.config.file=console.cfg -cp './lib/*' com.l2jbr.tools.gsregistering.accountmanager.SQLAccountManager +java -cp './lib/*' com.l2jbr.tools.accountmanager.SQLAccountManager diff --git a/Tools/build.gradle b/Tools/build.gradle index 7501b801..1bc6f607 100644 --- a/Tools/build.gradle +++ b/Tools/build.gradle @@ -2,11 +2,13 @@ plugins { id "java" id "idea" id "eclipse" + id "application" } version '1.3.1' ext.moduleName = 'com.l2jbr.tools' +mainClassName = "com.l2jbr.tools.accountmanager.SQLAccountManager" sourceSets { main { @@ -19,21 +21,22 @@ sourceSets { } } +configurations.all { + transitive = true +} + dependencies { compile project(':Commons') compile project(":Loginserver") compile project(":Gameserver") - runtime project(':Mmocore') + runtime ('org.springframework.data:spring-data-jdbc:1.0.0.BUILD-SNAPSHOT') { changing = true } + runtime project(':Mmocore') runtime 'com.zaxxer:HikariCP:3.0.0' runtime 'mysql:mysql-connector-java:8.0.9-rc' } -configurations.all { - transitive = false -} - jar { baseName 'l2j-tools' diff --git a/Tools/src/main/com.l2jbr.tools/com/l2jbr/tools/accountmanager/SQLAccountManager.java b/Tools/src/main/com.l2jbr.tools/com/l2jbr/tools/accountmanager/SQLAccountManager.java index 7d168ae6..0a9e919b 100644 --- a/Tools/src/main/com.l2jbr.tools/com/l2jbr/tools/accountmanager/SQLAccountManager.java +++ b/Tools/src/main/com.l2jbr.tools/com/l2jbr/tools/accountmanager/SQLAccountManager.java @@ -20,8 +20,11 @@ import com.l2jbr.commons.Base64; import com.l2jbr.commons.Config; -import com.l2jbr.commons.database.L2DatabaseFactory; import com.l2jbr.commons.Server; +import com.l2jbr.commons.database.AccountRepository; +import com.l2jbr.commons.database.DatabaseAccess; +import com.l2jbr.commons.database.L2DatabaseFactory; +import com.l2jbr.commons.database.model.Account; import java.io.IOException; import java.io.InputStreamReader; @@ -31,352 +34,264 @@ import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.SQLException; +import java.util.Optional; +import java.util.regex.Pattern; /** * This class SQL Account Manager + * * @author netimperia * @version $Revision: 2.3.2.1.2.3 $ $Date: 2005/08/08 22:47:12 $ */ -public class SQLAccountManager -{ - private static String _uname = ""; - private static String _pass = ""; - private static String _level = ""; - private static String _mode = ""; - - public static void main(String[] args) throws SQLException, IOException, NoSuchAlgorithmException - { - Server.serverMode = Server.MODE_LOGINSERVER; - Config.load(); - System.out.println("Please choose an option:"); - System.out.println(""); - System.out.println("1 - Create new account or update existing one (change pass and access level)."); - System.out.println("2 - Change access level."); - System.out.println("3 - Delete existing account."); - System.out.println("4 - List accounts & access levels."); - System.out.println("5 - Exit."); - LineNumberReader _in = new LineNumberReader(new InputStreamReader(System.in)); - while (!(_mode.equals("1") || _mode.equals("2") || _mode.equals("3") || _mode.equals("4") || _mode.equals("5"))) - { - System.out.print("Your choice: "); - _mode = _in.readLine(); - } - - if (_mode.equals("1") || _mode.equals("2") || _mode.equals("3")) - { - if (_mode.equals("1") || _mode.equals("2") || _mode.equals("3")) - { - while (_uname.length() == 0) - { - System.out.print("Username: "); - String line = _in.readLine(); - if ((line != null) && !line.isEmpty()) - { - _uname = line.toLowerCase(); - } - else - { - // TODO: Handle null pointer exception. - } - } - } - - if (_mode.equals("1")) - { - while (_pass.length() == 0) - { - System.out.print("Password: "); - _pass = _in.readLine(); - } - } - - if (_mode.equals("1") || _mode.equals("2")) - { - while (_level.length() == 0) - { - System.out.print("Access level: "); - _level = _in.readLine(); - } - } - - } - - if (_mode.equals("1")) - { - // Add or Update - addOrUpdateAccount(_uname, _pass, _level); - } - else if (_mode.equals("2")) - { - // Change Level - changeAccountLevel(_uname, _level); - } - else if (_mode.equals("3")) - { - // Delete - System.out.print("Do you really want to delete this account ? Y/N : "); - String yesno = _in.readLine(); - if ((yesno != null) && yesno.equals("Y")) - { - // Yes - deleteAccount(_uname); - } - - } - else if (_mode.equals("4")) - { - // List - printAccInfo(); - } - - return; - } - - private static void printAccInfo() throws SQLException - { - int count = 0; - java.sql.Connection con = null; - con = L2DatabaseFactory.getInstance().getConnection(); - PreparedStatement statement = con.prepareStatement("SELECT login, access_level FROM accounts ORDER BY login ASC"); - ResultSet rset = statement.executeQuery(); - while (rset.next()) - { - System.out.println(rset.getString("login") + " -> " + rset.getInt("access_level")); - count++; - } - rset.close(); - statement.close(); - System.out.println("Number of accounts: " + count + "."); - } - - private static void addOrUpdateAccount(String account, String password, String level) throws IOException, SQLException, NoSuchAlgorithmException - { - // Encode Password - MessageDigest md = MessageDigest.getInstance("SHA"); - byte[] newpass; - newpass = password.getBytes("UTF-8"); - newpass = md.digest(newpass); - - // Add to Base - java.sql.Connection con = null; - con = L2DatabaseFactory.getInstance().getConnection(); - PreparedStatement statement = con.prepareStatement("REPLACE accounts (login, password, access_level) VALUES (?,?,?)"); - statement.setString(1, account); - statement.setString(2, Base64.encodeBytes(newpass)); - statement.setString(3, level); - statement.executeUpdate(); - statement.close(); - } - - private static void changeAccountLevel(String account, String level) throws SQLException - { - java.sql.Connection con = null; - con = L2DatabaseFactory.getInstance().getConnection(); - - // Check Account Exist - PreparedStatement statement = con.prepareStatement("SELECT COUNT(*) FROM accounts WHERE login=?;"); - statement.setString(1, account); - ResultSet rset = statement.executeQuery(); - if (rset.next() == false) - { - System.out.println("False"); - - } - else if (rset.getInt(1) > 0) - { - - // Exist - - // Update - statement = con.prepareStatement("UPDATE accounts SET access_level=? WHERE login=?;"); - statement.setEscapeProcessing(true); - statement.setString(1, level); - statement.setString(2, account); - statement.executeUpdate(); - - System.out.println("Account " + account + " has been updated."); - } - else - { - // Not Exist - System.out.println("Account " + account + " does not exist."); - } - rset.close(); - - // Close Connection - statement.close(); - } - - private static void deleteAccount(String account) throws SQLException - { - java.sql.Connection con = null; - con = L2DatabaseFactory.getInstance().getConnection(); - - // Check Account Exist - PreparedStatement statement = con.prepareStatement("SELECT COUNT(*) FROM accounts WHERE login=?;"); - statement.setString(1, account); - ResultSet rset = statement.executeQuery(); - if (rset.next() == false) - { - System.out.println("False"); - rset.close(); - } - else if (rset.getInt(1) > 0) - { - rset.close(); - // Account exist - - // Get Accounts ID - ResultSet rcln; - statement = con.prepareStatement("SELECT obj_Id, char_name, clanid FROM characters WHERE account_name=?;"); - statement.setEscapeProcessing(true); - statement.setString(1, account); - rset = statement.executeQuery(); - - while (rset.next()) - { - System.out.println("Deleting character " + rset.getString("char_name") + "."); - - // Check If clan leader Remove Clan and remove all from it - statement.close(); - statement = con.prepareStatement("SELECT COUNT(*) FROM clan_data WHERE leader_id=?;"); - statement.setString(1, rset.getString("clanid")); - rcln = statement.executeQuery(); - rcln.next(); - if (rcln.getInt(1) > 0) - { - rcln.close(); - // Clan Leader - - // Get Clan Name - statement.close(); - statement = con.prepareStatement("SELECT clan_name FROM clan_data WHERE leader_id=?;"); - statement.setString(1, rset.getString("clanid")); - rcln = statement.executeQuery(); - rcln.next(); - - System.out.println("Deleting clan " + rcln.getString("clan_name") + "."); - - // Delete Clan Wars - statement.close(); - statement = con.prepareStatement("DELETE FROM clan_wars WHERE clan1=? OR clan2=?;"); - statement.setEscapeProcessing(true); - statement.setString(1, rcln.getString("clan_name")); - statement.setString(2, rcln.getString("clan_name")); - statement.executeUpdate(); - - rcln.close(); - - // Remove All From clan - statement.close(); - statement = con.prepareStatement("UPDATE characters SET clanid=0 WHERE clanid=?;"); - statement.setString(1, rset.getString("clanid")); - statement.executeUpdate(); - - // Delete Clan - statement.close(); - statement = con.prepareStatement("DELETE FROM clan_data WHERE clan_id=?;"); - statement.setString(1, rset.getString("clanid")); - statement.executeUpdate(); - - statement.close(); - statement = con.prepareStatement("DELETE FROM clan_privs WHERE clan_id=?;"); - statement.setString(1, rset.getString("clanid")); - statement.executeUpdate(); - - statement.close(); - statement = con.prepareStatement("DELETE FROM clan_subpledges WHERE clan_id=?;"); - statement.setString(1, rset.getString("clanid")); - statement.executeUpdate(); - - } - else - { - rcln.close(); - } - - // skills - statement.close(); - statement = con.prepareStatement("DELETE FROM character_skills WHERE char_obj_id=?;"); - statement.setString(1, rset.getString("obj_Id")); - statement.executeUpdate(); - - // shortcuts - statement.close(); - statement = con.prepareStatement("DELETE FROM character_shortcuts WHERE char_obj_id=?;"); - statement.setString(1, rset.getString("obj_Id")); - statement.executeUpdate(); - - // items - statement.close(); - statement = con.prepareStatement("DELETE FROM items WHERE owner_id=?;"); - statement.setString(1, rset.getString("obj_Id")); - statement.executeUpdate(); - - // recipebook - statement.close(); - statement = con.prepareStatement("DELETE FROM character_recipebook WHERE char_id=?;"); - statement.setString(1, rset.getString("obj_Id")); - statement.executeUpdate(); - - // quests - statement.close(); - statement = con.prepareStatement("DELETE FROM character_quests WHERE char_id=?;"); - statement.setString(1, rset.getString("obj_Id")); - statement.executeUpdate(); - - // macroses - statement.close(); - statement = con.prepareStatement("DELETE FROM character_macroses WHERE char_obj_id=?;"); - statement.setString(1, rset.getString("obj_Id")); - statement.executeUpdate(); - - // friends - statement.close(); - statement = con.prepareStatement("DELETE FROM character_friends WHERE char_id=?;"); - statement.setString(1, rset.getString("obj_Id")); - statement.executeUpdate(); - - // merchant_lease - statement.close(); - statement = con.prepareStatement("DELETE FROM merchant_lease WHERE player_id=?;"); - statement.setString(1, rset.getString("obj_Id")); - statement.executeUpdate(); - - // boxaccess - statement.close(); - statement = con.prepareStatement("DELETE FROM boxaccess WHERE charname=?;"); - statement.setString(1, rset.getString("char_name")); - statement.executeUpdate(); - - // characters - statement.close(); - statement = con.prepareStatement("DELETE FROM characters WHERE obj_Id=?;"); - statement.setString(1, rset.getString("obj_Id")); - statement.executeUpdate(); - - } - - // Delete Account - statement.close(); - statement = con.prepareStatement("DELETE FROM accounts WHERE login=?;"); - statement.setEscapeProcessing(true); - statement.setString(1, account); - statement.executeUpdate(); - - System.out.println("Account " + account + " has been deleted."); - } - else - { - // Not Exist - System.out.println("Account " + account + " does not exist."); - } - - // Close Connection - rset.close(); - statement.close(); - con.close(); - } - +public class SQLAccountManager { + private static String _uname = ""; + private static String _pass = ""; + private static String _level = ""; + private static String _mode = ""; + + public static void main(String[] args) throws SQLException, IOException, NoSuchAlgorithmException { + Server.serverMode = Server.MODE_LOGINSERVER; + Config.load(); + + System.out.println("Please choose an option:"); + System.out.println(""); + System.out.println("1 - Create new account or update existing one (change pass and access level)."); + System.out.println("2 - Change access level."); + System.out.println("3 - Delete existing account."); + System.out.println("4 - List accounts & access levels."); + System.out.println("5 - Exit."); + LineNumberReader _in = new LineNumberReader(new InputStreamReader(System.in)); + + do { + System.out.print("Your choice: "); + _mode = _in.readLine(); + } while(!Pattern.matches("^[1-5]$", _mode)); + + if (Pattern.matches("^[1-3]$", _mode)) { + do { + System.out.print("Username: "); + String line = _in.readLine(); + if ((line != null) && !line.isEmpty()) { + _uname = line.toLowerCase(); + } + } while (_uname.isEmpty()); + } + + if (_mode.equals("1")) { + do { + System.out.print("Password: "); + _pass = _in.readLine(); + } while (_pass.isEmpty()); + } + + if (Pattern.matches("^[1-2]$", _mode)) { + do { + System.out.print("Access level: "); + _level = _in.readLine(); + } while (_level.isEmpty()); + } + + + if (_mode.equals("1")) { + addOrUpdateAccount(_uname, _pass, _level); + } else if (_mode.equals("2")) { + changeAccountLevel(_uname, _level); + } else if (_mode.equals("3")) { + System.out.print("Do you really want to delete this account ? Y/N : "); + String yesno = _in.readLine(); + if ((yesno != null) && yesno.equals("Y")) { + deleteAccount(_uname); + } + } else if (_mode.equals("4")) { + printAccInfo(); + } + return; + } + + private static void printAccInfo() { + int count = 0; + AccountRepository repository = DatabaseAccess.getRepository(AccountRepository.class); + + for (Account account : repository.findAll()) { + System.out.println(String.format("%s -> %d", account.getId(), account.getAccessLevel())); + count++; + } + System.out.println("Number of accounts: " + count + "."); + } + + private static void addOrUpdateAccount(String login, String password, String level) throws IOException, NoSuchAlgorithmException { + MessageDigest md = MessageDigest.getInstance("SHA"); + byte[] newpass = password.getBytes("UTF-8"); + newpass = md.digest(newpass); + + AccountRepository repository = DatabaseAccess.getRepository(AccountRepository.class); + repository.replaceAccount(login, Base64.encodeBytes(newpass), Short.valueOf(level)); + } + + private static void changeAccountLevel(String login, String level) { + AccountRepository repository = DatabaseAccess.getRepository(AccountRepository.class); + + repository.findById(login).ifPresentOrElse( account -> { + account.setAccessLevel(Short.valueOf(level)); + repository.save(account); + System.out.println("Account " + login + " has been updated."); + }, + () -> System.out.println("Account " + login + " does not exist.") + ); + } + + private static void deleteAccount(String login) throws SQLException { + AccountRepository repository = DatabaseAccess.getRepository(AccountRepository.class); + Optional optionalAccount = repository.findById(login); + + if(optionalAccount.isPresent()) { + java.sql.Connection con = null; + con = L2DatabaseFactory.getInstance().getConnection(); + + // Get Accounts ID + ResultSet rcln; + PreparedStatement statement = con.prepareStatement("SELECT obj_Id, char_name, clanid FROM characters WHERE account_name=?;"); + statement.setEscapeProcessing(true); + statement.setString(1, login); + ResultSet rset = statement.executeQuery(); + + while (rset.next()) { + System.out.println("Deleting character " + rset.getString("char_name") + "."); + + // Check If clan leader Remove Clan and remove all from it + statement.close(); + statement = con.prepareStatement("SELECT COUNT(*) FROM clan_data WHERE leader_id=?;"); + statement.setString(1, rset.getString("clanid")); + rcln = statement.executeQuery(); + rcln.next(); + if (rcln.getInt(1) > 0) { + rcln.close(); + // Clan Leader + + // Get Clan Name + statement.close(); + statement = con.prepareStatement("SELECT clan_name FROM clan_data WHERE leader_id=?;"); + statement.setString(1, rset.getString("clanid")); + rcln = statement.executeQuery(); + rcln.next(); + + System.out.println("Deleting clan " + rcln.getString("clan_name") + "."); + + // Delete Clan Wars + statement.close(); + statement = con.prepareStatement("DELETE FROM clan_wars WHERE clan1=? OR clan2=?;"); + statement.setEscapeProcessing(true); + statement.setString(1, rcln.getString("clan_name")); + statement.setString(2, rcln.getString("clan_name")); + statement.executeUpdate(); + + rcln.close(); + + // Remove All From clan + statement.close(); + statement = con.prepareStatement("UPDATE characters SET clanid=0 WHERE clanid=?;"); + statement.setString(1, rset.getString("clanid")); + statement.executeUpdate(); + + // Delete Clan + statement.close(); + statement = con.prepareStatement("DELETE FROM clan_data WHERE clan_id=?;"); + statement.setString(1, rset.getString("clanid")); + statement.executeUpdate(); + + statement.close(); + statement = con.prepareStatement("DELETE FROM clan_privs WHERE clan_id=?;"); + statement.setString(1, rset.getString("clanid")); + statement.executeUpdate(); + + statement.close(); + statement = con.prepareStatement("DELETE FROM clan_subpledges WHERE clan_id=?;"); + statement.setString(1, rset.getString("clanid")); + statement.executeUpdate(); + + } else { + rcln.close(); + } + + // skills + statement.close(); + statement = con.prepareStatement("DELETE FROM character_skills WHERE char_obj_id=?;"); + statement.setString(1, rset.getString("obj_Id")); + statement.executeUpdate(); + + // shortcuts + statement.close(); + statement = con.prepareStatement("DELETE FROM character_shortcuts WHERE char_obj_id=?;"); + statement.setString(1, rset.getString("obj_Id")); + statement.executeUpdate(); + + // items + statement.close(); + statement = con.prepareStatement("DELETE FROM items WHERE owner_id=?;"); + statement.setString(1, rset.getString("obj_Id")); + statement.executeUpdate(); + + // recipebook + statement.close(); + statement = con.prepareStatement("DELETE FROM character_recipebook WHERE char_id=?;"); + statement.setString(1, rset.getString("obj_Id")); + statement.executeUpdate(); + + // quests + statement.close(); + statement = con.prepareStatement("DELETE FROM character_quests WHERE char_id=?;"); + statement.setString(1, rset.getString("obj_Id")); + statement.executeUpdate(); + + // macroses + statement.close(); + statement = con.prepareStatement("DELETE FROM character_macroses WHERE char_obj_id=?;"); + statement.setString(1, rset.getString("obj_Id")); + statement.executeUpdate(); + + // friends + statement.close(); + statement = con.prepareStatement("DELETE FROM character_friends WHERE char_id=?;"); + statement.setString(1, rset.getString("obj_Id")); + statement.executeUpdate(); + + // merchant_lease + statement.close(); + statement = con.prepareStatement("DELETE FROM merchant_lease WHERE player_id=?;"); + statement.setString(1, rset.getString("obj_Id")); + statement.executeUpdate(); + + // boxaccess + statement.close(); + statement = con.prepareStatement("DELETE FROM boxaccess WHERE charname=?;"); + statement.setString(1, rset.getString("char_name")); + statement.executeUpdate(); + + // characters + statement.close(); + statement = con.prepareStatement("DELETE FROM characters WHERE obj_Id=?;"); + statement.setString(1, rset.getString("obj_Id")); + statement.executeUpdate(); + + } + + // Delete Account + statement.close(); + statement = con.prepareStatement("DELETE FROM accounts WHERE login=?;"); + statement.setEscapeProcessing(true); + statement.setString(1, login); + statement.executeUpdate(); + + System.out.println("Account " + login + " has been deleted."); + rset.close(); + statement.close(); + con.close(); + + } else { + System.out.println("Account " + login + " does not exist."); + } + + } + } diff --git a/Tools/src/main/com.l2jbr.tools/module-info.java b/Tools/src/main/com.l2jbr.tools/module-info.java index 56ffe0df..b1170582 100644 --- a/Tools/src/main/com.l2jbr.tools/module-info.java +++ b/Tools/src/main/com.l2jbr.tools/module-info.java @@ -1,6 +1,8 @@ module com.l2jbr.tools { - requires com.l2jbr.commons; requires java.sql; requires com.l2jbr.gameserver; requires com.l2jbr.loginserver; + requires com.l2jbr.commons; + + requires spring.data.commons; } \ No newline at end of file From b854eeab3ca8fe1abfbbd29abc5d03e9c5b6dc66 Mon Sep 17 00:00:00 2001 From: Alisson Oliveira Date: Tue, 17 Apr 2018 08:00:27 -0300 Subject: [PATCH 008/236] =?UTF-8?q?Remove=20refer=C3=AAncias=20diretas=20a?= =?UTF-8?q?=20tabela=20accounts.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../commons/database/AccountRepository.java | 11 +- .../l2jbr/commons/database/model/Account.java | 5 + Commons/src/test/java/ConfigContext.java | 86 +++ Commons/src/test/java/MyAccessStrategy.java | 10 + .../l2jbr/loginserver/GameServerThread.java | 2 +- .../l2jbr/loginserver/LoginController.java | 71 +- .../loginserver/status/LoginStatusThread.java | 611 ++++++++---------- .../accountmanager/SQLAccountManager.java | 10 +- 8 files changed, 384 insertions(+), 422 deletions(-) create mode 100644 Commons/src/test/java/ConfigContext.java create mode 100644 Commons/src/test/java/MyAccessStrategy.java diff --git a/Commons/src/main/com.l2jbr.commons/com/l2jbr/commons/database/AccountRepository.java b/Commons/src/main/com.l2jbr.commons/com/l2jbr/commons/database/AccountRepository.java index 325f0224..ca5d312f 100644 --- a/Commons/src/main/com.l2jbr.commons/com/l2jbr/commons/database/AccountRepository.java +++ b/Commons/src/main/com.l2jbr.commons/com/l2jbr/commons/database/AccountRepository.java @@ -10,5 +10,14 @@ public interface AccountRepository extends CrudRepository { @Modifying @Query("REPLACE accounts (login, password, access_level) values (:login, :password, :accessLevel)") - int replaceAccount(@Param("login") String login, @Param("password") String password, @Param("accessLevel") short accessLevel); + int createOrUpdateAccount(@Param("login") String login, @Param("password") String password, @Param("accessLevel") short accessLevel); + + @Modifying + @Query("UPDATE accounts SET access_level=:accessLevel WHERE login=:login") + int updateAcessLevel(@Param("login") String login, @Param("accessLevel") short acessLevel); + + @Modifying + @Query("UPDATE accounts SET lastServer=:server WHERE login=:login") + int updateLastServer(@Param("login") String login, @Param("server") short server); } + diff --git a/Commons/src/main/com.l2jbr.commons/com/l2jbr/commons/database/model/Account.java b/Commons/src/main/com.l2jbr.commons/com/l2jbr/commons/database/model/Account.java index e355f50b..d1315bf2 100644 --- a/Commons/src/main/com.l2jbr.commons/com/l2jbr/commons/database/model/Account.java +++ b/Commons/src/main/com.l2jbr.commons/com/l2jbr/commons/database/model/Account.java @@ -1,5 +1,6 @@ package com.l2jbr.commons.database.model; +import com.l2jbr.commons.Config; import com.l2jbr.commons.database.annotation.Column; import com.l2jbr.commons.database.annotation.Table; import org.springframework.data.annotation.Id; @@ -59,4 +60,8 @@ public void setLastIP(String lastIP) { public void setAccessLevel(Short accessLevel) { this.accessLevel = accessLevel; } + + public boolean isGM() { + return accessLevel >= Config.GM_MIN; + } } diff --git a/Commons/src/test/java/ConfigContext.java b/Commons/src/test/java/ConfigContext.java new file mode 100644 index 00000000..a61cbccd --- /dev/null +++ b/Commons/src/test/java/ConfigContext.java @@ -0,0 +1,86 @@ +import com.l2jbr.commons.database.AnnotationNamingStrategy; +import com.l2jbr.commons.database.model.Model; +import com.l2jbr.commons.util.Util; +import com.zaxxer.hikari.HikariConfig; +import com.zaxxer.hikari.HikariDataSource; +import org.springframework.context.ApplicationListener; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.data.jdbc.core.DefaultDataAccessStrategy; +import org.springframework.data.jdbc.core.SqlGeneratorSource; +import org.springframework.data.jdbc.mapping.event.AfterLoadEvent; +import org.springframework.data.jdbc.mapping.event.BeforeSaveEvent; +import org.springframework.data.jdbc.mapping.event.WithEntity; +import org.springframework.data.jdbc.mapping.model.JdbcMappingContext; +import org.springframework.data.jdbc.mapping.model.NamingStrategy; +import org.springframework.data.jdbc.repository.config.EnableJdbcRepositories; +import org.springframework.jdbc.core.namedparam.NamedParameterJdbcOperations; +import org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate; + +import javax.sql.DataSource; +import java.util.Optional; + +@Configuration +@EnableJdbcRepositories +public class ConfigContext { + + private HikariDataSource dataSource; + + @Bean + public HikariDataSource dataSource() { + System.out.println("Call datasource"); + if(Util.isNull(dataSource) || dataSource.isClosed()) { + HikariConfig dataSourceConfig = new HikariConfig(); + dataSourceConfig.setDriverClassName("com.mysql.cj.jdbc.Driver"); + dataSourceConfig.setJdbcUrl("jdbc:mysql://localhost/l2jdb"); + dataSourceConfig.setUsername("root"); + dataSourceConfig.setPassword("joealisson"); + dataSource = new HikariDataSource(dataSourceConfig); + } + return dataSource; + } + + @Bean + public NamedParameterJdbcOperations template(DataSource dataSource) { + System.out.println("call template"); + return new NamedParameterJdbcTemplate(dataSource); + } + + @Bean + public DefaultDataAccessStrategy dataAccessStrategy(JdbcMappingContext mappingContext){ + return new MyAccessStrategy(new SqlGeneratorSource(mappingContext), mappingContext); + } + + @Bean + public NamingStrategy namingStrategy() { + System.out.println("call strategy"); + return new AnnotationNamingStrategy(); + } + + @Bean + public App app() { + return new App(); + } + + @Bean + public ApplicationListener beforeSaveEventApplicationListener() { + return event -> { + extractModel(event).ifPresent(Model::onSave); + }; + } + + private Optional extractModel(WithEntity event) { + Object entity = event.getEntity(); + if (entity instanceof Model) { + return Optional.of((Model) entity); + } + return Optional.empty(); + } + + @Bean + public ApplicationListener afterLoadEventApplicationListener() { + return event -> { + extractModel(event).ifPresent(Model::onLoad); + }; + } +} diff --git a/Commons/src/test/java/MyAccessStrategy.java b/Commons/src/test/java/MyAccessStrategy.java new file mode 100644 index 00000000..9638bfe7 --- /dev/null +++ b/Commons/src/test/java/MyAccessStrategy.java @@ -0,0 +1,10 @@ +import org.springframework.data.jdbc.core.DefaultDataAccessStrategy; +import org.springframework.data.jdbc.core.SqlGeneratorSource; +import org.springframework.data.jdbc.mapping.model.JdbcMappingContext; + +public class MyAccessStrategy extends DefaultDataAccessStrategy { + + public MyAccessStrategy(SqlGeneratorSource sqlGeneratorSource, JdbcMappingContext context) { + super(sqlGeneratorSource, context); + } +} diff --git a/Loginserver/src/main/com.l2jbr.loginserver/com/l2jbr/loginserver/GameServerThread.java b/Loginserver/src/main/com.l2jbr.loginserver/com/l2jbr/loginserver/GameServerThread.java index 8ab1c9c1..bdde2791 100644 --- a/Loginserver/src/main/com.l2jbr.loginserver/com/l2jbr/loginserver/GameServerThread.java +++ b/Loginserver/src/main/com.l2jbr.loginserver/com/l2jbr/loginserver/GameServerThread.java @@ -233,7 +233,7 @@ private void onReceivePlayerLogOut(byte[] data) { private void onReceiveChangeAccessLevel(byte[] data) { if (isAuthed()) { ChangeAccessLevel cal = new ChangeAccessLevel(data); - LoginController.getInstance().setAccountAccessLevel(cal.getAccount(), cal.getLevel()); + LoginController.getInstance().setAccountAccessLevel(cal.getAccount(), (short) cal.getLevel()); _log.info("Changed " + cal.getAccount() + " access level to " + cal.getLevel()); } else { forceClose(LoginServerFail.NOT_AUTHED); diff --git a/Loginserver/src/main/com.l2jbr.loginserver/com/l2jbr/loginserver/LoginController.java b/Loginserver/src/main/com.l2jbr.loginserver/com/l2jbr/loginserver/LoginController.java index 81d8f91b..56427848 100644 --- a/Loginserver/src/main/com.l2jbr.loginserver/com/l2jbr/loginserver/LoginController.java +++ b/Loginserver/src/main/com.l2jbr.loginserver/com/l2jbr/loginserver/LoginController.java @@ -22,7 +22,6 @@ import com.l2jbr.commons.Config; import com.l2jbr.commons.database.AccountRepository; import com.l2jbr.commons.database.DatabaseAccess; -import com.l2jbr.commons.database.L2DatabaseFactory; import com.l2jbr.commons.database.model.Account; import com.l2jbr.commons.lib.Log; import com.l2jbr.commons.util.Rnd; @@ -41,9 +40,6 @@ import java.security.MessageDigest; import java.security.interfaces.RSAPrivateKey; import java.security.spec.RSAKeyGenParameterSpec; -import java.sql.Connection; -import java.sql.PreparedStatement; -import java.sql.ResultSet; import java.util.*; @@ -342,21 +338,16 @@ public int getMaxAllowedOnlinePlayers(int id) { * @param serverId * @return */ - public boolean isLoginPossible(L2LoginClient client, int serverId) { + public boolean isLoginPossible(L2LoginClient client, short serverId) { GameServerInfo gsi = GameServerTable.getInstance().getRegisteredGameServerById(serverId); int access = client.getAccessLevel(); if ((gsi != null) && gsi.isAuthed()) { boolean loginOk = ((gsi.getCurrentPlayerCount() < gsi.getMaxPlayers()) && (gsi.getStatus() != ServerStatus.STATUS_GM_ONLY)) || (access >= Config.GM_MIN); if (loginOk && (client.getLastServer() != serverId)) { - - try (Connection con = L2DatabaseFactory.getInstance().getConnection(); - PreparedStatement statement = con.prepareStatement("UPDATE accounts SET lastServer = ? WHERE login = ?")) { - statement.setInt(1, serverId); - statement.setString(2, client.getAccount()); - statement.executeUpdate(); - } catch (Exception e) { - _log.warn("Could not set lastServer: " + e); + AccountRepository accountRepository = DatabaseAccess.getRepository(AccountRepository.class); + if(accountRepository.updateLastServer(client.getAccount(), serverId) < 1) { + _log.warn("Could not set lastServer of account {} ", client.getAccount()); } } return loginOk; @@ -364,35 +355,11 @@ public boolean isLoginPossible(L2LoginClient client, int serverId) { return false; } - public void setAccountAccessLevel(String account, int banLevel) { - try (Connection con = L2DatabaseFactory.getInstance().getConnection(); - PreparedStatement statement = con.prepareStatement("UPDATE accounts SET access_level=? WHERE login=?")) { - statement.setInt(1, banLevel); - statement.setString(2, account); - statement.executeUpdate(); - } catch (Exception e) { - _log.warn("Could not set accessLevel: " + e); - } - } - - public boolean isGM(String user) { - boolean ok = false; - try (Connection con = L2DatabaseFactory.getInstance().getConnection(); - PreparedStatement statement = con.prepareStatement("SELECT access_level FROM accounts WHERE login=?")) { - statement.setString(1, user); - try (ResultSet rset = statement.executeQuery()) { - if (rset.next()) { - int accessLevel = rset.getInt(1); - if (accessLevel >= Config.GM_MIN) { - ok = true; - } - } - } - } catch (Exception e) { - _log.warn("could not check gm state:" + e); - ok = false; + public void setAccountAccessLevel(String login, short acessLevel) { + AccountRepository repository = DatabaseAccess.getRepository(AccountRepository.class); + if(repository.updateAcessLevel(login, acessLevel) < 1) { + _log.warn("Could not set accessLevel of account {}", login); } - return ok; } /** @@ -509,28 +476,6 @@ public boolean loginValid(String user, String password, L2LoginClient client) { return ok; } - public boolean loginBanned(String user) { - boolean ok = false; - try (Connection con = L2DatabaseFactory.getInstance().getConnection(); - PreparedStatement statement = con.prepareStatement("SELECT access_level FROM accounts WHERE login=?")) { - statement.setString(1, user); - try (ResultSet rset = statement.executeQuery()) { - if (rset.next()) { - int accessLevel = rset.getInt(1); - if (accessLevel < 0) { - ok = true; - } - } - } - } catch (Exception e) { - // digest algo not found ?? - // out of bounds should not be possible - _log.warn("could not check ban state:" + e); - ok = false; - } - return ok; - } - class FailedLoginAttempt { // private InetAddress _ipAddress; private int _count; diff --git a/Loginserver/src/main/com.l2jbr.loginserver/com/l2jbr/loginserver/status/LoginStatusThread.java b/Loginserver/src/main/com.l2jbr.loginserver/com/l2jbr/loginserver/status/LoginStatusThread.java index 800b80ad..e22d7452 100644 --- a/Loginserver/src/main/com.l2jbr.loginserver/com/l2jbr/loginserver/status/LoginStatusThread.java +++ b/Loginserver/src/main/com.l2jbr.loginserver/com/l2jbr/loginserver/status/LoginStatusThread.java @@ -19,7 +19,9 @@ import com.l2jbr.commons.Base64; import com.l2jbr.commons.Config; -import com.l2jbr.commons.database.L2DatabaseFactory; +import com.l2jbr.commons.database.AccountRepository; +import com.l2jbr.commons.database.DatabaseAccess; +import com.l2jbr.commons.database.model.Account; import com.l2jbr.loginserver.GameServerTable; import com.l2jbr.loginserver.L2LoginServer; import com.l2jbr.loginserver.LoginController; @@ -31,358 +33,267 @@ import java.net.Socket; import java.security.MessageDigest; import java.security.NoSuchAlgorithmException; -import java.sql.Connection; -import java.sql.PreparedStatement; -import java.sql.ResultSet; -import java.sql.SQLException; +import java.util.Optional; import java.util.Properties; -public class LoginStatusThread extends Thread -{ - private static final Logger _log = LoggerFactory.getLogger(LoginStatusThread.class.getName()); - - private Socket _cSocket; - - private PrintWriter _print; - private BufferedReader _read; - - private boolean _redirectLogger; - - private String _pass; - - private void telnetOutput(int type, String text) - { - if (type == 1) - { - System.out.println("TELNET | " + text); - } - else if (type == 2) - { - System.out.print("TELNET | " + text); - } - else if (type == 3) - { - System.out.print(text); - } - else if (type == 4) - { - System.out.println(text); - } - else - { - System.out.println("TELNET | " + text); - } - } - - private boolean isValidIP(Socket client) - { - boolean result = false; - InetAddress ClientIP = client.getInetAddress(); - - // convert IP to String, and compare with list - String clientStringIP = ClientIP.getHostAddress(); - - telnetOutput(1, "Connection from: " + clientStringIP); - - // read and loop thru list of IPs, compare with newIP - if (Config.DEVELOPER) - { - telnetOutput(2, ""); - } - - try - { - Properties telnetSettings = new Properties(); - InputStream telnetIS = new FileInputStream(new File(Config.TELNET_FILE)); - telnetSettings.load(telnetIS); - telnetIS.close(); - - String HostList = telnetSettings.getProperty("ListOfHosts", "127.0.0.1,localhost"); - - if (Config.DEVELOPER) - { - telnetOutput(3, "Comparing ip to list..."); - } - - // compare - String ipToCompare = null; - for (String ip : HostList.split(",")) - { - if (!result) - { - ipToCompare = InetAddress.getByName(ip).getHostAddress(); - if (clientStringIP.equals(ipToCompare)) - { - result = true; - } - if (Config.DEVELOPER) - { - telnetOutput(3, clientStringIP + " = " + ipToCompare + "(" + ip + ") = " + result); - } - } - } - } - catch (IOException e) - { - if (Config.DEVELOPER) - { - telnetOutput(4, ""); - } - telnetOutput(1, "Error: " + e); - } - - if (Config.DEVELOPER) - { - telnetOutput(4, "Allow IP: " + result); - } - return result; - } - - public LoginStatusThread(Socket client, int uptime) throws IOException - { - _cSocket = client; - - _print = new PrintWriter(_cSocket.getOutputStream()); - _read = new BufferedReader(new InputStreamReader(_cSocket.getInputStream())); - - if (isValidIP(client)) - { - telnetOutput(1, client.getInetAddress().getHostAddress() + " accepted."); - _print.println("Welcome To The L2J Telnet Session."); - _print.println("Please Insert Your Login!"); - _print.print("Login: "); - _print.flush(); - String tmpLine = _read.readLine(); - if (tmpLine == null) - { - _print.println("Error."); - _print.println("Disconnected..."); - _print.flush(); - _cSocket.close(); - return; - } - - if (!validLogin(tmpLine)) - { - _print.println("Incorrect Login!"); - _print.println("Disconnected..."); - _print.flush(); - _cSocket.close(); - return; - } - - _print.println("Login Correct!"); - _print.flush(); - _print.println("Please Insert Your Password!"); - _print.print("Password: "); - _print.flush(); - tmpLine = _read.readLine(); - if (tmpLine == null) - { - _print.println("Error."); - _print.println("Disconnected..."); - _print.flush(); - _cSocket.close(); - } - else - { - if (!validPassword(tmpLine)) - { - _print.println("Incorrect Password!"); - _print.println("Disconnected..."); - _print.flush(); - _cSocket.close(); - } - else - { - _print.println("Password Correct!"); - _print.println("[L2J]"); - _print.print(""); - _print.flush(); - start(); - } - } - } - else - { - telnetOutput(1, "Connection attempt from " + client.getInetAddress().getHostAddress() + " rejected."); - _cSocket.close(); - } - } - - /** - * @param password - * @return - */ - private boolean validPassword(String password) - { - byte[] expectedPass = Base64.decode(_pass); - MessageDigest md; - try - { - md = MessageDigest.getInstance("SHA"); - byte[] raw = password.getBytes("UTF-8"); - byte[] hash = md.digest(raw); - for (int i = 0; i < expectedPass.length; i++) - { - if (hash[i] != expectedPass[i]) - { - return false; - } - } - return true; - } - catch (NoSuchAlgorithmException e) - { - // TODO Auto-generated catch block - e.printStackTrace(); - } - catch (UnsupportedEncodingException uee) - { - - } - return false; - } - +public class LoginStatusThread extends Thread { + private static final Logger _log = LoggerFactory.getLogger(LoginStatusThread.class.getName()); - private boolean validLogin(String login) - { - if (!LoginController.getInstance().isGM(login)) - { - return false; - } + private Socket _cSocket; - try (Connection con = L2DatabaseFactory.getInstance().getConnection(); - PreparedStatement statement = con.prepareStatement("SELECT password FROM accounts WHERE login=?")) - { - statement.setString(1, login); - try (ResultSet rset = statement.executeQuery()) - { - if (rset.next()) - { - _pass = rset.getString("password"); - return true; - } - } - } - catch (SQLException sqle) - { - sqle.printStackTrace(); - } - return false; - } - - @Override - public void run() - { - String _usrCommand = ""; - try - { - while ((_usrCommand.compareTo("quit") != 0) && (_usrCommand.compareTo("exit") != 0)) - { - _usrCommand = _read.readLine(); - if (_usrCommand == null) - { - _cSocket.close(); - break; - } - if (_usrCommand.equals("help")) - { - _print.println("The following is a list of all available commands: "); - _print.println("help - shows this help."); - _print.println("status - displays basic server statistics."); - _print.println("unblock - removes from banlist."); - _print.println("shutdown - shuts down server."); - _print.println("restart - restarts the server."); - _print.println("RedirectLogger - Telnet will give you some info about server in real time."); - _print.println("quit - closes telnet session."); - _print.println(""); - } - else if (_usrCommand.equals("status")) - { - // TODO enhance the output - _print.println("Registered Server Count: " + GameServerTable.getInstance().getRegisteredGameServers().size()); - } - else if (_usrCommand.startsWith("unblock")) - { - try - { - _usrCommand = _usrCommand.substring(8); - if (LoginController.getInstance().removeBanForAddress(_usrCommand)) - { - _log.warn("IP removed via TELNET by host: " + _cSocket.getInetAddress().getHostAddress()); - _print.println("The IP " + _usrCommand + " has been removed from the hack protection list!"); - } - else - { - _print.println("IP not found in hack protection list..."); - } - } - catch (StringIndexOutOfBoundsException e) - { - _print.println("Please Enter the IP to Unblock!"); - } - } - else if (_usrCommand.startsWith("shutdown")) - { - L2LoginServer.getInstance().shutdown(false); - _print.println("Bye Bye!"); - _print.flush(); - _cSocket.close(); - } - else if (_usrCommand.startsWith("restart")) - { - L2LoginServer.getInstance().shutdown(true); - _print.println("Bye Bye!"); - _print.flush(); - _cSocket.close(); - } - else if (_usrCommand.equals("RedirectLogger")) - { - _redirectLogger = true; - } - else if (_usrCommand.equals("quit")) - { /* Do Nothing :p - Just here to save us from the "Command Not Understood" Text */ - } - else if (_usrCommand.length() == 0) - { /* Do Nothing Again - Same reason as the quit part */ - } - else - { - _print.println("Invalid Command"); - } - _print.print(""); - _print.flush(); - } - if (!_cSocket.isClosed()) - { - _print.println("Bye Bye!"); - _print.flush(); - _cSocket.close(); - } - telnetOutput(1, "Connection from " + _cSocket.getInetAddress().getHostAddress() + " was closed by client."); - } - catch (IOException e) - { - e.printStackTrace(); - } - } - - public void printToTelnet(String msg) - { - synchronized (_print) - { - _print.println(msg); - _print.flush(); - } - } - - /** - * @return Returns the redirectLogger. - */ - public boolean isRedirectLogger() - { - return _redirectLogger; - } + private PrintWriter _print; + private BufferedReader _read; + + private boolean _redirectLogger; + + private String _pass; + + private void telnetOutput(int type, String text) { + if (type == 1) { + System.out.println("TELNET | " + text); + } else if (type == 2) { + System.out.print("TELNET | " + text); + } else if (type == 3) { + System.out.print(text); + } else if (type == 4) { + System.out.println(text); + } else { + System.out.println("TELNET | " + text); + } + } + + private boolean isValidIP(Socket client) { + boolean result = false; + InetAddress ClientIP = client.getInetAddress(); + + // convert IP to String, and compare with list + String clientStringIP = ClientIP.getHostAddress(); + + telnetOutput(1, "Connection from: " + clientStringIP); + + // read and loop thru list of IPs, compare with newIP + if (Config.DEVELOPER) { + telnetOutput(2, ""); + } + + try { + Properties telnetSettings = new Properties(); + InputStream telnetIS = new FileInputStream(new File(Config.TELNET_FILE)); + telnetSettings.load(telnetIS); + telnetIS.close(); + + String HostList = telnetSettings.getProperty("ListOfHosts", "127.0.0.1,localhost"); + + if (Config.DEVELOPER) { + telnetOutput(3, "Comparing ip to list..."); + } + + // compare + String ipToCompare = null; + for (String ip : HostList.split(",")) { + if (!result) { + ipToCompare = InetAddress.getByName(ip).getHostAddress(); + if (clientStringIP.equals(ipToCompare)) { + result = true; + } + if (Config.DEVELOPER) { + telnetOutput(3, clientStringIP + " = " + ipToCompare + "(" + ip + ") = " + result); + } + } + } + } catch (IOException e) { + if (Config.DEVELOPER) { + telnetOutput(4, ""); + } + telnetOutput(1, "Error: " + e); + } + + if (Config.DEVELOPER) { + telnetOutput(4, "Allow IP: " + result); + } + return result; + } + + public LoginStatusThread(Socket client, int uptime) throws IOException { + _cSocket = client; + + _print = new PrintWriter(_cSocket.getOutputStream()); + _read = new BufferedReader(new InputStreamReader(_cSocket.getInputStream())); + + if (isValidIP(client)) { + telnetOutput(1, client.getInetAddress().getHostAddress() + " accepted."); + _print.println("Welcome To The L2J Telnet Session."); + _print.println("Please Insert Your Login!"); + _print.print("Login: "); + _print.flush(); + String tmpLine = _read.readLine(); + if (tmpLine == null) { + _print.println("Error."); + _print.println("Disconnected..."); + _print.flush(); + _cSocket.close(); + return; + } + + if (!validLogin(tmpLine)) { + _print.println("Incorrect Login!"); + _print.println("Disconnected..."); + _print.flush(); + _cSocket.close(); + return; + } + + _print.println("Login Correct!"); + _print.flush(); + _print.println("Please Insert Your Password!"); + _print.print("Password: "); + _print.flush(); + tmpLine = _read.readLine(); + if (tmpLine == null) { + _print.println("Error."); + _print.println("Disconnected..."); + _print.flush(); + _cSocket.close(); + } else { + if (!validPassword(tmpLine)) { + _print.println("Incorrect Password!"); + _print.println("Disconnected..."); + _print.flush(); + _cSocket.close(); + } else { + _print.println("Password Correct!"); + _print.println("[L2J]"); + _print.print(""); + _print.flush(); + start(); + } + } + } else { + telnetOutput(1, "Connection attempt from " + client.getInetAddress().getHostAddress() + " rejected."); + _cSocket.close(); + } + } + + /** + * @param password + * @return + */ + private boolean validPassword(String password) { + byte[] expectedPass = Base64.decode(_pass); + MessageDigest md; + try { + md = MessageDigest.getInstance("SHA"); + byte[] raw = password.getBytes("UTF-8"); + byte[] hash = md.digest(raw); + for (int i = 0; i < expectedPass.length; i++) { + if (hash[i] != expectedPass[i]) { + return false; + } + } + return true; + } catch (NoSuchAlgorithmException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } catch (UnsupportedEncodingException uee) { + + } + return false; + } + + + private boolean validLogin(String login) { + AccountRepository repository = DatabaseAccess.getRepository(AccountRepository.class); + Optional optionalAccount = repository.findById(login); + if(optionalAccount.isPresent()) { + Account account = optionalAccount.get(); + if(!account.isGM()) { + return false; + } + + _pass = optionalAccount.get().getPassword(); + return true; + } + return false; + } + + @Override + public void run() { + String _usrCommand = ""; + try { + while ((_usrCommand.compareTo("quit") != 0) && (_usrCommand.compareTo("exit") != 0)) { + _usrCommand = _read.readLine(); + if (_usrCommand == null) { + _cSocket.close(); + break; + } + if (_usrCommand.equals("help")) { + _print.println("The following is a list of all available commands: "); + _print.println("help - shows this help."); + _print.println("status - displays basic server statistics."); + _print.println("unblock - removes from banlist."); + _print.println("shutdown - shuts down server."); + _print.println("restart - restarts the server."); + _print.println("RedirectLogger - Telnet will give you some info about server in real time."); + _print.println("quit - closes telnet session."); + _print.println(""); + } else if (_usrCommand.equals("status")) { + // TODO enhance the output + _print.println("Registered Server Count: " + GameServerTable.getInstance().getRegisteredGameServers().size()); + } else if (_usrCommand.startsWith("unblock")) { + try { + _usrCommand = _usrCommand.substring(8); + if (LoginController.getInstance().removeBanForAddress(_usrCommand)) { + _log.warn("IP removed via TELNET by host: " + _cSocket.getInetAddress().getHostAddress()); + _print.println("The IP " + _usrCommand + " has been removed from the hack protection list!"); + } else { + _print.println("IP not found in hack protection list..."); + } + } catch (StringIndexOutOfBoundsException e) { + _print.println("Please Enter the IP to Unblock!"); + } + } else if (_usrCommand.startsWith("shutdown")) { + L2LoginServer.getInstance().shutdown(false); + _print.println("Bye Bye!"); + _print.flush(); + _cSocket.close(); + } else if (_usrCommand.startsWith("restart")) { + L2LoginServer.getInstance().shutdown(true); + _print.println("Bye Bye!"); + _print.flush(); + _cSocket.close(); + } else if (_usrCommand.equals("RedirectLogger")) { + _redirectLogger = true; + } else if (_usrCommand.equals("quit")) { /* Do Nothing :p - Just here to save us from the "Command Not Understood" Text */ + } else if (_usrCommand.length() == 0) { /* Do Nothing Again - Same reason as the quit part */ + } else { + _print.println("Invalid Command"); + } + _print.print(""); + _print.flush(); + } + if (!_cSocket.isClosed()) { + _print.println("Bye Bye!"); + _print.flush(); + _cSocket.close(); + } + telnetOutput(1, "Connection from " + _cSocket.getInetAddress().getHostAddress() + " was closed by client."); + } catch (IOException e) { + e.printStackTrace(); + } + } + + public void printToTelnet(String msg) { + synchronized (_print) { + _print.println(msg); + _print.flush(); + } + } + + /** + * @return Returns the redirectLogger. + */ + public boolean isRedirectLogger() { + return _redirectLogger; + } } diff --git a/Tools/src/main/com.l2jbr.tools/com/l2jbr/tools/accountmanager/SQLAccountManager.java b/Tools/src/main/com.l2jbr.tools/com/l2jbr/tools/accountmanager/SQLAccountManager.java index 0a9e919b..167bde1d 100644 --- a/Tools/src/main/com.l2jbr.tools/com/l2jbr/tools/accountmanager/SQLAccountManager.java +++ b/Tools/src/main/com.l2jbr.tools/com/l2jbr/tools/accountmanager/SQLAccountManager.java @@ -126,7 +126,7 @@ private static void addOrUpdateAccount(String login, String password, String lev newpass = md.digest(newpass); AccountRepository repository = DatabaseAccess.getRepository(AccountRepository.class); - repository.replaceAccount(login, Base64.encodeBytes(newpass), Short.valueOf(level)); + repository.createOrUpdateAccount(login, Base64.encodeBytes(newpass), Short.valueOf(level)); } private static void changeAccountLevel(String login, String level) { @@ -143,7 +143,7 @@ private static void changeAccountLevel(String login, String level) { private static void deleteAccount(String login) throws SQLException { AccountRepository repository = DatabaseAccess.getRepository(AccountRepository.class); - Optional optionalAccount = repository.findById(login); + Optional optionalAccount = repository.findById(login); if(optionalAccount.isPresent()) { java.sql.Connection con = null; @@ -277,11 +277,7 @@ private static void deleteAccount(String login) throws SQLException { } // Delete Account - statement.close(); - statement = con.prepareStatement("DELETE FROM accounts WHERE login=?;"); - statement.setEscapeProcessing(true); - statement.setString(1, login); - statement.executeUpdate(); + repository.delete(optionalAccount.get()); System.out.println("Account " + login + " has been deleted."); rset.close(); From 98d45776b8bce2b4ea87fce9322d0c9a0b090a61 Mon Sep 17 00:00:00 2001 From: Alisson Oliveira Date: Tue, 17 Apr 2018 08:05:30 -0300 Subject: [PATCH 009/236] =?UTF-8?q?Corrige=20erros=20de=20convers=C3=A3o?= =?UTF-8?q?=20de=20dados.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../commons/database/AccountRepository.java | 4 +- .../l2jbr/commons/database/model/Account.java | 24 +++--- Commons/src/test/java/ConfigContext.java | 86 ------------------- Commons/src/test/java/MyAccessStrategy.java | 10 --- .../l2jbr/loginserver/LoginController.java | 2 +- 5 files changed, 13 insertions(+), 113 deletions(-) delete mode 100644 Commons/src/test/java/ConfigContext.java delete mode 100644 Commons/src/test/java/MyAccessStrategy.java diff --git a/Commons/src/main/com.l2jbr.commons/com/l2jbr/commons/database/AccountRepository.java b/Commons/src/main/com.l2jbr.commons/com/l2jbr/commons/database/AccountRepository.java index ca5d312f..a91ddf3b 100644 --- a/Commons/src/main/com.l2jbr.commons/com/l2jbr/commons/database/AccountRepository.java +++ b/Commons/src/main/com.l2jbr.commons/com/l2jbr/commons/database/AccountRepository.java @@ -14,10 +14,10 @@ public interface AccountRepository extends CrudRepository { @Modifying @Query("UPDATE accounts SET access_level=:accessLevel WHERE login=:login") - int updateAcessLevel(@Param("login") String login, @Param("accessLevel") short acessLevel); + int updateAcessLevel(@Param("login") String login, @Param("accessLevel") int acessLevel); @Modifying @Query("UPDATE accounts SET lastServer=:server WHERE login=:login") - int updateLastServer(@Param("login") String login, @Param("server") short server); + int updateLastServer(@Param("login") String login, @Param("server") int server); } diff --git a/Commons/src/main/com.l2jbr.commons/com/l2jbr/commons/database/model/Account.java b/Commons/src/main/com.l2jbr.commons/com/l2jbr/commons/database/model/Account.java index d1315bf2..60fdf3c1 100644 --- a/Commons/src/main/com.l2jbr.commons/com/l2jbr/commons/database/model/Account.java +++ b/Commons/src/main/com.l2jbr.commons/com/l2jbr/commons/database/model/Account.java @@ -6,20 +6,20 @@ import org.springframework.data.annotation.Id; @Table("accounts") -public class Account extends Model { +public class Account extends Model { @Id private String login; private String password; private Long lastActive; @Column("access_level") - private short accessLevel; - private short lastServer; + private Integer accessLevel; + private Integer lastServer; private String lastIP; - public Account() { } + public Account() { } - public Account(String login, String password, long lastActive, short accessLevel, short lastServer, String lastIP) { + public Account(String login, String password, long lastActive, int accessLevel, int lastServer, String lastIP) { this.login = login; this.password = password; this.lastActive = lastActive; @@ -33,7 +33,7 @@ public String getId() { return login; } - public short getAccessLevel() { + public int getAccessLevel() { return accessLevel; } @@ -41,7 +41,7 @@ public String getPassword() { return password; } - public short getLastServer() { + public int getLastServer() { return lastServer; } @@ -49,19 +49,15 @@ public boolean isBanned() { return accessLevel < 0; } - public void setLastActive(long lastActive) { - this.lastActive = lastActive; - } + public void setLastActive(long lastActive) { this.lastActive = lastActive; } public void setLastIP(String lastIP) { this.lastIP = lastIP; } - public void setAccessLevel(Short accessLevel) { + public void setAccessLevel(int accessLevel) { this.accessLevel = accessLevel; } - public boolean isGM() { - return accessLevel >= Config.GM_MIN; - } + public boolean isGM() { return accessLevel >= Config.GM_MIN; } } diff --git a/Commons/src/test/java/ConfigContext.java b/Commons/src/test/java/ConfigContext.java deleted file mode 100644 index a61cbccd..00000000 --- a/Commons/src/test/java/ConfigContext.java +++ /dev/null @@ -1,86 +0,0 @@ -import com.l2jbr.commons.database.AnnotationNamingStrategy; -import com.l2jbr.commons.database.model.Model; -import com.l2jbr.commons.util.Util; -import com.zaxxer.hikari.HikariConfig; -import com.zaxxer.hikari.HikariDataSource; -import org.springframework.context.ApplicationListener; -import org.springframework.context.annotation.Bean; -import org.springframework.context.annotation.Configuration; -import org.springframework.data.jdbc.core.DefaultDataAccessStrategy; -import org.springframework.data.jdbc.core.SqlGeneratorSource; -import org.springframework.data.jdbc.mapping.event.AfterLoadEvent; -import org.springframework.data.jdbc.mapping.event.BeforeSaveEvent; -import org.springframework.data.jdbc.mapping.event.WithEntity; -import org.springframework.data.jdbc.mapping.model.JdbcMappingContext; -import org.springframework.data.jdbc.mapping.model.NamingStrategy; -import org.springframework.data.jdbc.repository.config.EnableJdbcRepositories; -import org.springframework.jdbc.core.namedparam.NamedParameterJdbcOperations; -import org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate; - -import javax.sql.DataSource; -import java.util.Optional; - -@Configuration -@EnableJdbcRepositories -public class ConfigContext { - - private HikariDataSource dataSource; - - @Bean - public HikariDataSource dataSource() { - System.out.println("Call datasource"); - if(Util.isNull(dataSource) || dataSource.isClosed()) { - HikariConfig dataSourceConfig = new HikariConfig(); - dataSourceConfig.setDriverClassName("com.mysql.cj.jdbc.Driver"); - dataSourceConfig.setJdbcUrl("jdbc:mysql://localhost/l2jdb"); - dataSourceConfig.setUsername("root"); - dataSourceConfig.setPassword("joealisson"); - dataSource = new HikariDataSource(dataSourceConfig); - } - return dataSource; - } - - @Bean - public NamedParameterJdbcOperations template(DataSource dataSource) { - System.out.println("call template"); - return new NamedParameterJdbcTemplate(dataSource); - } - - @Bean - public DefaultDataAccessStrategy dataAccessStrategy(JdbcMappingContext mappingContext){ - return new MyAccessStrategy(new SqlGeneratorSource(mappingContext), mappingContext); - } - - @Bean - public NamingStrategy namingStrategy() { - System.out.println("call strategy"); - return new AnnotationNamingStrategy(); - } - - @Bean - public App app() { - return new App(); - } - - @Bean - public ApplicationListener beforeSaveEventApplicationListener() { - return event -> { - extractModel(event).ifPresent(Model::onSave); - }; - } - - private Optional extractModel(WithEntity event) { - Object entity = event.getEntity(); - if (entity instanceof Model) { - return Optional.of((Model) entity); - } - return Optional.empty(); - } - - @Bean - public ApplicationListener afterLoadEventApplicationListener() { - return event -> { - extractModel(event).ifPresent(Model::onLoad); - }; - } -} diff --git a/Commons/src/test/java/MyAccessStrategy.java b/Commons/src/test/java/MyAccessStrategy.java deleted file mode 100644 index 9638bfe7..00000000 --- a/Commons/src/test/java/MyAccessStrategy.java +++ /dev/null @@ -1,10 +0,0 @@ -import org.springframework.data.jdbc.core.DefaultDataAccessStrategy; -import org.springframework.data.jdbc.core.SqlGeneratorSource; -import org.springframework.data.jdbc.mapping.model.JdbcMappingContext; - -public class MyAccessStrategy extends DefaultDataAccessStrategy { - - public MyAccessStrategy(SqlGeneratorSource sqlGeneratorSource, JdbcMappingContext context) { - super(sqlGeneratorSource, context); - } -} diff --git a/Loginserver/src/main/com.l2jbr.loginserver/com/l2jbr/loginserver/LoginController.java b/Loginserver/src/main/com.l2jbr.loginserver/com/l2jbr/loginserver/LoginController.java index 56427848..80d99340 100644 --- a/Loginserver/src/main/com.l2jbr.loginserver/com/l2jbr/loginserver/LoginController.java +++ b/Loginserver/src/main/com.l2jbr.loginserver/com/l2jbr/loginserver/LoginController.java @@ -338,7 +338,7 @@ public int getMaxAllowedOnlinePlayers(int id) { * @param serverId * @return */ - public boolean isLoginPossible(L2LoginClient client, short serverId) { + public boolean isLoginPossible(L2LoginClient client, int serverId) { GameServerInfo gsi = GameServerTable.getInstance().getRegisteredGameServerById(serverId); int access = client.getAccessLevel(); if ((gsi != null) && gsi.isAuthed()) { From ed76236ad7dd274b112a885bf6480c101b4cfe61 Mon Sep 17 00:00:00 2001 From: Alisson Oliveira Date: Tue, 17 Apr 2018 14:43:25 -0300 Subject: [PATCH 010/236] =?UTF-8?q?incorpora=20a=20tabela=20account=5Fdata?= =?UTF-8?q?=20=C3=A0=20accounts.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../l2jbr/commons/database/model/Account.java | 21 ++++- .../commons/database/model/AccountData.java | 34 ------- Datapack/sql/account_data.sql | 10 -- .../sql/experimental/l2j_full_structure.sql | 23 +---- Datapack/tools/database_installer.bat | 1 - Datapack/tools/database_installer.sh | 1 - Datapack/tools/full_install.sql | 1 - .../gameserver/model/actor/stat/PcStat.java | 93 +++++++------------ .../l2jbr/loginserver/LoginController.java | 2 +- 9 files changed, 51 insertions(+), 135 deletions(-) delete mode 100644 Commons/src/main/com.l2jbr.commons/com/l2jbr/commons/database/model/AccountData.java delete mode 100644 Datapack/sql/account_data.sql diff --git a/Commons/src/main/com.l2jbr.commons/com/l2jbr/commons/database/model/Account.java b/Commons/src/main/com.l2jbr.commons/com/l2jbr/commons/database/model/Account.java index 60fdf3c1..f5cc1bda 100644 --- a/Commons/src/main/com.l2jbr.commons/com/l2jbr/commons/database/model/Account.java +++ b/Commons/src/main/com.l2jbr.commons/com/l2jbr/commons/database/model/Account.java @@ -16,16 +16,15 @@ public class Account extends Model { private Integer accessLevel; private Integer lastServer; private String lastIP; + private Integer newbieCharacterId; public Account() { } - public Account(String login, String password, long lastActive, int accessLevel, int lastServer, String lastIP) { + public Account(String login, String password, long lastActive, String lastIP) { this.login = login; this.password = password; this.lastActive = lastActive; - this.accessLevel = accessLevel; this.lastIP = lastIP; - this.lastServer = lastServer; } @Override @@ -49,7 +48,9 @@ public boolean isBanned() { return accessLevel < 0; } - public void setLastActive(long lastActive) { this.lastActive = lastActive; } + public void setLastActive(long lastActive) { + this.lastActive = lastActive; + } public void setLastIP(String lastIP) { this.lastIP = lastIP; @@ -59,5 +60,15 @@ public void setAccessLevel(int accessLevel) { this.accessLevel = accessLevel; } - public boolean isGM() { return accessLevel >= Config.GM_MIN; } + public boolean isGM() { + return accessLevel >= Config.GM_MIN; + } + + public int getNewbieCharacterId() { + return newbieCharacterId; + } + + public void setNewbieCharacterId(int newbieCharacterId) { + this.newbieCharacterId = newbieCharacterId; + } } diff --git a/Commons/src/main/com.l2jbr.commons/com/l2jbr/commons/database/model/AccountData.java b/Commons/src/main/com.l2jbr.commons/com/l2jbr/commons/database/model/AccountData.java deleted file mode 100644 index 959cadb3..00000000 --- a/Commons/src/main/com.l2jbr.commons/com/l2jbr/commons/database/model/AccountData.java +++ /dev/null @@ -1,34 +0,0 @@ -package com.l2jbr.commons.database.model; - -import com.l2jbr.commons.database.annotation.Table; -import org.springframework.data.annotation.Id; - -@Table("account_data") -public class AccountData extends Model { - - @Id - private String var; - private String value; - - public String getVar() { - return var; - } - - public void setVar(String var) { - this.var = var; - } - - public String getValue() { - return value; - } - - public void setValue(String value) { - this.value = value; - } - - @Override - public String getId() { - return var; - } - -} diff --git a/Datapack/sql/account_data.sql b/Datapack/sql/account_data.sql deleted file mode 100644 index 5f2e1dfe..00000000 --- a/Datapack/sql/account_data.sql +++ /dev/null @@ -1,10 +0,0 @@ --- --------------------------- --- Table structure for `account_data` --- --------------------------- -CREATE TABLE IF NOT EXISTS `account_data` ( - account_name VARCHAR(45) NOT NULL DEFAULT '', - var VARCHAR(20) NOT NULL DEFAULT '', - value VARCHAR(255) , - PRIMARY KEY (account_name,var), - CONSTRAINT FK_AccountName FOREIGN KEY (account_name) REFERENCES accounts(login) -); \ No newline at end of file diff --git a/Datapack/sql/experimental/l2j_full_structure.sql b/Datapack/sql/experimental/l2j_full_structure.sql index a5613371..662f2f15 100644 --- a/Datapack/sql/experimental/l2j_full_structure.sql +++ b/Datapack/sql/experimental/l2j_full_structure.sql @@ -30,31 +30,14 @@ CREATE TABLE IF NOT EXISTS `accounts` ( `login` VARCHAR(45) NOT NULL DEFAULT '', `password` VARCHAR(45) DEFAULT NULL, `lastactive` DECIMAL(20,0) DEFAULT NULL, - `access_level` INT(11) DEFAULT NULL, + `access_level` INT DEFAULT 0, `lastIP` VARCHAR(20) DEFAULT NULL, - `lastServer` INT(4) NOT NULL DEFAULT '1', + `lastServer` INT NOT NULL DEFAULT 1, + `newbieCharacterId` DECIMAL(11,0) NULL, PRIMARY KEY (`login`)) ENGINE = InnoDB DEFAULT CHARACTER SET = latin1; - --- ----------------------------------------------------- --- Table `account_data` --- ----------------------------------------------------- -DROP TABLE IF EXISTS `account_data` ; - -CREATE TABLE IF NOT EXISTS `account_data` ( - `account_name` VARCHAR(45) NOT NULL DEFAULT '', - `var` VARCHAR(20) NOT NULL DEFAULT '', - `value` VARCHAR(255) NULL DEFAULT NULL, - PRIMARY KEY (`account_name`, `var`), - CONSTRAINT `FK_AccountName` - FOREIGN KEY (`account_name`) - REFERENCES `accounts` (`login`)) -ENGINE = InnoDB -DEFAULT CHARACTER SET = latin1; - - -- ----------------------------------------------------- -- Table `armor` -- ----------------------------------------------------- diff --git a/Datapack/tools/database_installer.bat b/Datapack/tools/database_installer.bat index bd5b4d2b..47e7aaf8 100644 --- a/Datapack/tools/database_installer.bat +++ b/Datapack/tools/database_installer.bat @@ -514,7 +514,6 @@ gameservers.sql ) do call :dump %%i set dest=gs for %%i in ( -account_data.sql armor.sql armorsets.sql auction.sql diff --git a/Datapack/tools/database_installer.sh b/Datapack/tools/database_installer.sh index 004334e4..f66866f2 100644 --- a/Datapack/tools/database_installer.sh +++ b/Datapack/tools/database_installer.sh @@ -254,7 +254,6 @@ echo "Installling new gameserver content." else echo "Upgrading gameserver content" fi -$MYG < ../sql/account_data.sql &> /dev/null $MYG < ../sql/armor.sql &> /dev/null $MYG < ../sql/armorsets.sql &> /dev/null $MYG < ../sql/auction.sql &> /dev/null diff --git a/Datapack/tools/full_install.sql b/Datapack/tools/full_install.sql index 29f963ae..940db1a1 100644 --- a/Datapack/tools/full_install.sql +++ b/Datapack/tools/full_install.sql @@ -1,4 +1,3 @@ -DROP TABLE IF EXISTS account_data; DROP TABLE IF EXISTS armor; DROP TABLE IF EXISTS armorsets; DROP TABLE IF EXISTS auction; diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/actor/stat/PcStat.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/actor/stat/PcStat.java index f2ac24fc..f181b7b5 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/actor/stat/PcStat.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/actor/stat/PcStat.java @@ -18,7 +18,8 @@ package com.l2jbr.gameserver.model.actor.stat; import com.l2jbr.commons.Config; -import com.l2jbr.commons.database.L2DatabaseFactory; +import com.l2jbr.commons.database.AccountRepository; +import com.l2jbr.commons.database.DatabaseAccess; import com.l2jbr.gameserver.model.L2Character; import com.l2jbr.gameserver.model.actor.instance.L2PcInstance; import com.l2jbr.gameserver.model.actor.instance.L2PetInstance; @@ -28,10 +29,6 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import java.sql.PreparedStatement; -import java.sql.ResultSet; -import java.sql.SQLException; - public class PcStat extends PlayableStat { @@ -171,66 +168,38 @@ public final boolean addLevel(byte value) boolean levelIncreased = super.addLevel(value); - if (levelIncreased) - { + if (levelIncreased) { /** - * If there are no characters on the server, the bonuses will be applied to the first character that becomes level 6 and end if this character reaches level 25 or above. If the first character that becomes level 6 is deleted, the rest of the characters may not receive the new character - * bonus If the first character to become level 6 loses a level, and the player makes another character level 6, the bonus will be applied to only the first character to achieve level 6. If the character loses a level after reaching level 25, the character may not receive the bonus. + * If there are no characters on the server, the bonuses will be applied to the first character that becomes level 6 + * and end if this character reaches level 25 or above; + * + * If the first character that becomes level 6 is deleted, the rest of the characters may not receive the new character bonus; + * + * If the first character to become level 6 loses a level, and the player makes another character level 6, + * the bonus will be applied to only the first character to achieve level 6; + * + * If the character loses a level after reaching level 25, the character may not receive the bonus; + * + * */ - if (!Config.ALT_GAME_NEW_CHAR_ALWAYS_IS_NEWBIE) - { - if ((getActiveChar().getLevel() >= Experience.MIN_NEWBIE_LEVEL) && (getActiveChar().getLevel() < Experience.MAX_NEWBIE_LEVEL) && !getActiveChar().isNewbie()) - { - java.sql.Connection con = null; - try - { - con = L2DatabaseFactory.getInstance().getConnection(); - PreparedStatement statement; - - statement = con.prepareStatement("SELECT value FROM account_data WHERE (account_name=?) AND (var='newbie_char')"); - statement.setString(1, getActiveChar().getAccountName()); - ResultSet rset = statement.executeQuery(); - - if (!rset.next()) - { - PreparedStatement statement1; - statement1 = con.prepareStatement("INSERT INTO account_data (account_name, var, value) VALUES (?, 'newbie_char', ?)"); - statement1.setString(1, getActiveChar().getAccountName()); - statement1.setInt(2, getActiveChar().getObjectId()); - statement1.executeUpdate(); - statement1.close(); - - getActiveChar().setNewbie(true); - if (Config.DEBUG) - { - _log.info("New newbie character: " + getActiveChar().getCharId()); - } - } - rset.close(); - statement.close(); - } - catch (SQLException e) - { - _log.warn("Could not check character for newbie: " + e); - } - finally - { - try - { - con.close(); - } - catch (Exception e) - { - } - } + if (!Config.ALT_GAME_NEW_CHAR_ALWAYS_IS_NEWBIE) { + L2PcInstance activeChar = getActiveChar(); + if ((activeChar.getLevel() >= Experience.MIN_NEWBIE_LEVEL) && (activeChar.getLevel() < Experience.MAX_NEWBIE_LEVEL) + && !activeChar.isNewbie()) { + + AccountRepository repository = DatabaseAccess.getRepository(AccountRepository.class); + repository.findById(activeChar.getAccountName()).ifPresent( account -> { + if(account.getNewbieCharacterId() == 0) { + account.setNewbieCharacterId(activeChar.getObjectId()); + repository.save(account); + } + }); } - - if ((getActiveChar().getLevel() >= 25) && getActiveChar().isNewbie()) - { - getActiveChar().setNewbie(false); - if (Config.DEBUG) - { - _log.info("Newbie character ended: " + getActiveChar().getCharId()); + + if ((activeChar.getLevel() >= 25) && activeChar.isNewbie()) { + activeChar.setNewbie(false); + if (Config.DEBUG) { + _log.info("Newbie character ended: {}", getActiveChar().getObjectId()); } } } diff --git a/Loginserver/src/main/com.l2jbr.loginserver/com/l2jbr/loginserver/LoginController.java b/Loginserver/src/main/com.l2jbr.loginserver/com/l2jbr/loginserver/LoginController.java index 80d99340..f63c0022 100644 --- a/Loginserver/src/main/com.l2jbr.loginserver/com/l2jbr/loginserver/LoginController.java +++ b/Loginserver/src/main/com.l2jbr.loginserver/com/l2jbr/loginserver/LoginController.java @@ -433,7 +433,7 @@ public boolean loginValid(String user, String password, L2LoginClient client) { if ((user.length() >= 2) && (user.length() <= 14)) { String pwd = Base64.encodeBytes(hash); long lastActive = System.currentTimeMillis(); - Account account = new Account(user, pwd, lastActive, (short) 0, (short) 1, address.getHostAddress()); + Account account = new Account(user, pwd, lastActive, address.getHostAddress()); if (repository.save(account).isPersisted()) { _log.debug("created new account for {}", user); From 9c1181fbe2367f161d7a2c60840602f7649bc953 Mon Sep 17 00:00:00 2001 From: Alisson Oliveira Date: Tue, 17 Apr 2018 18:53:51 -0300 Subject: [PATCH 011/236] =?UTF-8?q?remove=20refer=C3=AAcias=20diretas=20?= =?UTF-8?q?=C3=A0=20tabela=20armor?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../DatabaseContextConfiguration.java | 12 +- .../l2jbr/commons/database/model/Account.java | 2 +- .../model/{Model.java => Entity.java} | 2 +- .../main/com.l2jbr.commons/module-info.java | 1 + .../gameserver/datatables/ItemTable.java | 66 +++++----- .../com/l2jbr/gameserver/model/dao/Armor.java | 28 ---- .../gameserver/model/database/Armor.java | 123 ++++++++++++++++++ .../model/{dao => database}/ArmorSet.java | 2 +- .../model/{dao => database}/Auction.java | 2 +- .../model/{dao => database}/AuctionBid.java | 2 +- .../model/{dao => database}/AuctionWatch.java | 2 +- .../{dao => database}/Augmentations.java | 2 +- .../model/{dao => database}/AutoChat.java | 2 +- .../model/{dao => database}/AutoChatText.java | 2 +- .../model/{dao => database}/BoxAccess.java | 2 +- .../model/{dao => database}/Boxes.java | 2 +- .../model/{dao => database}/Castle.java | 2 +- .../model/{dao => database}/CastleDoor.java | 2 +- .../{dao => database}/CastleDoorUpgrade.java | 2 +- .../{dao => database}/CastleManorProcure.java | 2 +- .../CastleManorProduction.java | 2 +- .../{dao => database}/CastleSiegeGuard.java | 2 +- .../{dao => database}/CharTemplates.java | 2 +- .../{dao => database}/CharacterFriends.java | 2 +- .../{dao => database}/CharacterHennas.java | 2 +- .../{dao => database}/CharacterMacroses.java | 2 +- .../{dao => database}/CharacterQuests.java | 2 +- .../CharacterRecipeBook.java | 2 +- .../CharacterRecommends.java | 2 +- .../{dao => database}/CharacterShortcuts.java | 2 +- .../{dao => database}/CharacterSkills.java | 2 +- .../CharacterSkillsSave.java | 2 +- .../CharacterSubclasses.java | 2 +- .../model/{dao => database}/Characters.java | 2 +- .../model/{dao => database}/ClanData.java | 2 +- .../model/{dao => database}/ClanHall.java | 2 +- .../{dao => database}/ClanHallFunctions.java | 2 +- .../model/{dao => database}/ClanPrivs.java | 2 +- .../model/{dao => database}/ClanSkills.java | 2 +- .../{dao => database}/ClanSubpledges.java | 2 +- .../model/{dao => database}/ClanWars.java | 2 +- .../{dao => database}/CursedWeapons.java | 2 +- .../{dao => database}/DimensionalRift.java | 2 +- .../model/{dao => database}/DropList.java | 2 +- .../{dao => database}/EnchantSkillTrees.java | 2 +- .../model/{dao => database}/EtcItem.java | 2 +- .../model/{dao => database}/Fish.java | 2 +- .../{dao => database}/FishingSkillTrees.java | 2 +- .../model/{dao => database}/Forums.java | 2 +- .../model/{dao => database}/GameServers.java | 2 +- .../model/{dao => database}/Games.java | 2 +- .../model/{dao => database}/GlobalTasks.java | 2 +- .../{dao => database}/HelperBuffList.java | 2 +- .../model/{dao => database}/Henna.java | 2 +- .../model/{dao => database}/HennaTrees.java | 2 +- .../model/{dao => database}/Heroes.java | 2 +- .../model/{dao => database}/Items.java | 2 +- .../{dao => database}/ItemsOnGround.java | 2 +- .../model/{dao => database}/LevelUpGain.java | 2 +- .../model/{dao => database}/Locations.java | 2 +- .../model/{dao => database}/MapRegion.java | 2 +- .../{dao => database}/MerchantAreasList.java | 2 +- .../{dao => database}/MerchantBuyList.java | 2 +- .../{dao => database}/MerchantLease.java | 2 +- .../{dao => database}/MerchantShopIds.java | 2 +- .../model/{dao => database}/Merchants.java | 2 +- .../model/{dao => database}/Minions.java | 2 +- .../model/{dao => database}/ModsWedding.java | 2 +- .../model/{dao => database}/Npc.java | 2 +- .../model/{dao => database}/NpcSkills.java | 2 +- .../{dao => database}/OlympiadNobles.java | 2 +- .../model/{dao => database}/Pets.java | 2 +- .../model/{dao => database}/PetsStats.java | 2 +- .../{dao => database}/PledgeSkillTrees.java | 2 +- .../model/{dao => database}/Posts.java | 2 +- .../{dao => database}/QuestGlobalData.java | 2 +- .../{dao => database}/RaidbossSpawnList.java | 2 +- .../model/{dao => database}/RandomSpawn.java | 2 +- .../{dao => database}/RandomSpawnLoc.java | 2 +- .../model/{dao => database}/SevenSigns.java | 2 +- .../{dao => database}/SevenSignsFestival.java | 2 +- .../{dao => database}/SevenSignsStatus.java | 2 +- .../model/{dao => database}/SiegeClan.java | 2 +- .../model/{dao => database}/SkillLearn.java | 2 +- .../{dao => database}/SkillSpellBooks.java | 2 +- .../model/{dao => database}/SkillTrees.java | 2 +- .../model/{dao => database}/Spawnlist.java | 2 +- .../model/{dao => database}/Teleport.java | 2 +- .../model/{dao => database}/Topic.java | 2 +- .../model/{dao => database}/WalkerRoutes.java | 2 +- .../model/{dao => database}/Weapon.java | 2 +- .../model/{dao => database}/Zone.java | 2 +- .../model/{dao => database}/ZoneVertices.java | 2 +- .../model/{dao => database}/classList.java | 2 +- .../database/repository/ArmorRepository.java | 7 + 95 files changed, 261 insertions(+), 154 deletions(-) rename Commons/src/main/com.l2jbr.commons/com/l2jbr/commons/database/model/{Model.java => Entity.java} (88%) delete mode 100644 Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/Armor.java create mode 100644 Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/Armor.java rename Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/{dao => database}/ArmorSet.java (85%) rename Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/{dao => database}/Auction.java (89%) rename Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/{dao => database}/AuctionBid.java (82%) rename Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/{dao => database}/AuctionWatch.java (65%) rename Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/{dao => database}/Augmentations.java (74%) rename Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/{dao => database}/AutoChat.java (70%) rename Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/{dao => database}/AutoChatText.java (66%) rename Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/{dao => database}/BoxAccess.java (64%) rename Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/{dao => database}/Boxes.java (82%) rename Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/{dao => database}/Castle.java (82%) rename Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/{dao => database}/CastleDoor.java (89%) rename Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/{dao => database}/CastleDoorUpgrade.java (73%) rename Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/{dao => database}/CastleManorProcure.java (82%) rename Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/{dao => database}/CastleManorProduction.java (81%) rename Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/{dao => database}/CastleSiegeGuard.java (84%) rename Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/{dao => database}/CharTemplates.java (95%) rename Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/{dao => database}/CharacterFriends.java (74%) rename Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/{dao => database}/CharacterHennas.java (76%) rename Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/{dao => database}/CharacterMacroses.java (82%) rename Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/{dao => database}/CharacterQuests.java (78%) rename Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/{dao => database}/CharacterRecipeBook.java (70%) rename Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/{dao => database}/CharacterRecommends.java (67%) rename Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/{dao => database}/CharacterShortcuts.java (82%) rename Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/{dao => database}/CharacterSkills.java (80%) rename Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/{dao => database}/CharacterSkillsSave.java (87%) rename Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/{dao => database}/CharacterSubclasses.java (81%) rename Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/{dao => database}/Characters.java (97%) rename Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/{dao => database}/ClanData.java (92%) rename Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/{dao => database}/ClanHall.java (85%) rename Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/{dao => database}/ClanHallFunctions.java (80%) rename Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/{dao => database}/ClanPrivs.java (73%) rename Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/{dao => database}/ClanSkills.java (76%) rename Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/{dao => database}/ClanSubpledges.java (76%) rename Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/{dao => database}/ClanWars.java (75%) rename Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/{dao => database}/CursedWeapons.java (81%) rename Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/{dao => database}/DimensionalRift.java (86%) rename Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/{dao => database}/DropList.java (78%) rename Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/{dao => database}/EnchantSkillTrees.java (88%) rename Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/{dao => database}/EtcItem.java (92%) rename Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/{dao => database}/Fish.java (87%) rename Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/{dao => database}/FishingSkillTrees.java (83%) rename Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/{dao => database}/Forums.java (83%) rename Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/{dao => database}/GameServers.java (70%) rename Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/{dao => database}/Games.java (86%) rename Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/{dao => database}/GlobalTasks.java (82%) rename Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/{dao => database}/HelperBuffList.java (83%) rename Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/{dao => database}/Henna.java (87%) rename Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/{dao => database}/HennaTrees.java (65%) rename Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/{dao => database}/Heroes.java (77%) rename Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/{dao => database}/Items.java (89%) rename Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/{dao => database}/ItemsOnGround.java (84%) rename Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/{dao => database}/LevelUpGain.java (88%) rename Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/{dao => database}/Locations.java (79%) rename Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/{dao => database}/MapRegion.java (85%) rename Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/{dao => database}/MerchantAreasList.java (78%) rename Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/{dao => database}/MerchantBuyList.java (84%) rename Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/{dao => database}/MerchantLease.java (78%) rename Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/{dao => database}/MerchantShopIds.java (66%) rename Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/{dao => database}/Merchants.java (66%) rename Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/{dao => database}/Minions.java (75%) rename Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/{dao => database}/ModsWedding.java (81%) rename Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/{dao => database}/Npc.java (96%) rename Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/{dao => database}/NpcSkills.java (68%) rename Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/{dao => database}/OlympiadNobles.java (80%) rename Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/{dao => database}/Pets.java (85%) rename Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/{dao => database}/PetsStats.java (93%) rename Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/{dao => database}/PledgeSkillTrees.java (83%) rename Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/{dao => database}/Posts.java (83%) rename Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/{dao => database}/QuestGlobalData.java (72%) rename Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/{dao => database}/RaidbossSpawnList.java (88%) rename Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/{dao => database}/RandomSpawn.java (85%) rename Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/{dao => database}/RandomSpawnLoc.java (76%) rename Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/{dao => database}/SevenSigns.java (85%) rename Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/{dao => database}/SevenSignsFestival.java (80%) rename Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/{dao => database}/SevenSignsStatus.java (94%) rename Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/{dao => database}/SiegeClan.java (75%) rename Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/{dao => database}/SkillLearn.java (64%) rename Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/{dao => database}/SkillSpellBooks.java (66%) rename Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/{dao => database}/SkillTrees.java (80%) rename Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/{dao => database}/Spawnlist.java (88%) rename Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/{dao => database}/Teleport.java (81%) rename Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/{dao => database}/Topic.java (85%) rename Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/{dao => database}/WalkerRoutes.java (85%) rename Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/{dao => database}/Weapon.java (96%) rename Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/{dao => database}/Zone.java (84%) rename Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/{dao => database}/ZoneVertices.java (71%) rename Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/{dao => database}/classList.java (70%) create mode 100644 Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/repository/ArmorRepository.java diff --git a/Commons/src/main/com.l2jbr.commons/com/l2jbr/commons/database/DatabaseContextConfiguration.java b/Commons/src/main/com.l2jbr.commons/com/l2jbr/commons/database/DatabaseContextConfiguration.java index ef5d0f21..c0087aea 100644 --- a/Commons/src/main/com.l2jbr.commons/com/l2jbr/commons/database/DatabaseContextConfiguration.java +++ b/Commons/src/main/com.l2jbr.commons/com/l2jbr/commons/database/DatabaseContextConfiguration.java @@ -1,7 +1,7 @@ package com.l2jbr.commons.database; import com.l2jbr.commons.Config; -import com.l2jbr.commons.database.model.Model; +import com.l2jbr.commons.database.model.Entity; import com.zaxxer.hikari.HikariConfig; import com.zaxxer.hikari.HikariDataSource; import org.springframework.context.ApplicationListener; @@ -62,14 +62,14 @@ public NamingStrategy namingStrategy() { @Bean public ApplicationListener beforeSaveEventApplicationListener() { return event -> { - extractModel(event).ifPresent(Model::onSave); + extractModel(event).ifPresent(Entity::onSave); }; } - private Optional extractModel(WithEntity event) { + private Optional extractModel(WithEntity event) { Object entity = event.getEntity(); - if (entity instanceof Model) { - return Optional.of((Model) entity); + if (entity instanceof Entity) { + return Optional.of((Entity) entity); } return Optional.empty(); } @@ -77,7 +77,7 @@ private Optional extractModel(WithEntity event) { @Bean public ApplicationListener afterLoadEventApplicationListener() { return event -> { - extractModel(event).ifPresent(Model::onLoad); + extractModel(event).ifPresent(Entity::onLoad); }; } diff --git a/Commons/src/main/com.l2jbr.commons/com/l2jbr/commons/database/model/Account.java b/Commons/src/main/com.l2jbr.commons/com/l2jbr/commons/database/model/Account.java index f5cc1bda..4fb01bdd 100644 --- a/Commons/src/main/com.l2jbr.commons/com/l2jbr/commons/database/model/Account.java +++ b/Commons/src/main/com.l2jbr.commons/com/l2jbr/commons/database/model/Account.java @@ -6,7 +6,7 @@ import org.springframework.data.annotation.Id; @Table("accounts") -public class Account extends Model { +public class Account extends Entity { @Id private String login; diff --git a/Commons/src/main/com.l2jbr.commons/com/l2jbr/commons/database/model/Model.java b/Commons/src/main/com.l2jbr.commons/com/l2jbr/commons/database/model/Entity.java similarity index 88% rename from Commons/src/main/com.l2jbr.commons/com/l2jbr/commons/database/model/Model.java rename to Commons/src/main/com.l2jbr.commons/com/l2jbr/commons/database/model/Entity.java index 921988e6..12e16da0 100644 --- a/Commons/src/main/com.l2jbr.commons/com/l2jbr/commons/database/model/Model.java +++ b/Commons/src/main/com.l2jbr.commons/com/l2jbr/commons/database/model/Entity.java @@ -3,7 +3,7 @@ import org.springframework.data.annotation.Transient; import org.springframework.data.domain.Persistable; -public abstract class Model implements Persistable { +public abstract class Entity implements Persistable { @Transient protected boolean isNew = true; diff --git a/Commons/src/main/com.l2jbr.commons/module-info.java b/Commons/src/main/com.l2jbr.commons/module-info.java index fdededc7..8525711c 100644 --- a/Commons/src/main/com.l2jbr.commons/module-info.java +++ b/Commons/src/main/com.l2jbr.commons/module-info.java @@ -17,5 +17,6 @@ exports com.l2jbr.commons; exports com.l2jbr.commons.database; exports com.l2jbr.commons.database.model; + exports com.l2jbr.commons.database.annotation; } \ No newline at end of file diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/datatables/ItemTable.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/datatables/ItemTable.java index 46e280f6..fd477058 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/datatables/ItemTable.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/datatables/ItemTable.java @@ -19,6 +19,7 @@ package com.l2jbr.gameserver.datatables; import com.l2jbr.commons.Config; +import com.l2jbr.commons.database.DatabaseAccess; import com.l2jbr.commons.database.L2DatabaseFactory; import com.l2jbr.gameserver.Item; import com.l2jbr.gameserver.ThreadPoolManager; @@ -28,6 +29,8 @@ import com.l2jbr.gameserver.model.actor.instance.L2BossInstance; import com.l2jbr.gameserver.model.actor.instance.L2PcInstance; import com.l2jbr.gameserver.model.actor.instance.L2RaidBossInstance; +import com.l2jbr.gameserver.model.database.Armor; +import com.l2jbr.gameserver.model.database.repository.ArmorRepository; import com.l2jbr.gameserver.skills.SkillsEngine; import com.l2jbr.gameserver.templates.*; import org.slf4j.Logger; @@ -146,14 +149,12 @@ public class ItemTable { /** * Table of SQL request in order to obtain items from tables [etcitem], [armor], [weapon] */ - private static final String[] SQL_ITEM_SELECTS = - { - "SELECT item_id, name, crystallizable, item_type, weight, consume_type, material, crystal_type, duration, price, crystal_count, sellable, dropable, destroyable, tradeable FROM etcitem", + private static final String[] SQL_ITEM_SELECTS = { + "SELECT item_id, name, crystallizable, item_type, weight, consume_type, material, crystal_type, duration, price, crystal_count, sellable, dropable, destroyable, tradeable FROM etcitem", - "SELECT item_id, name, bodypart, crystallizable, armor_type, weight," + " material, crystal_type, avoid_modify, duration, p_def, m_def, mp_bonus," + " price, crystal_count, sellable, dropable, destroyable, tradeable, item_skill_id, item_skill_lvl FROM armor", + "SELECT item_id, name, bodypart, crystallizable, weight, soulshots, spiritshots," + " material, crystal_type, p_dam, rnd_dam, weaponType, critical, hit_modify, avoid_modify," + " shield_def, shield_def_rate, atk_speed, mp_consume, m_dam, duration, price, crystal_count," + " sellable, dropable, destroyable, tradeable, item_skill_id, item_skill_lvl,enchant4_skill_id,enchant4_skill_lvl, onCast_skill_id, onCast_skill_lvl," + " onCast_skill_chance, onCrit_skill_id, onCrit_skill_lvl, onCrit_skill_chance FROM weapon" + }; - "SELECT item_id, name, bodypart, crystallizable, weight, soulshots, spiritshots," + " material, crystal_type, p_dam, rnd_dam, weaponType, critical, hit_modify, avoid_modify," + " shield_def, shield_def_rate, atk_speed, mp_consume, m_dam, duration, price, crystal_count," + " sellable, dropable, destroyable, tradeable, item_skill_id, item_skill_lvl,enchant4_skill_id,enchant4_skill_lvl, onCast_skill_id, onCast_skill_lvl," + " onCast_skill_chance, onCrit_skill_id, onCrit_skill_lvl, onCrit_skill_chance FROM weapon" - }; /** * List of etcItem */ @@ -196,6 +197,12 @@ public ItemTable() { _armors = new LinkedHashMap<>(); _weapons = new LinkedHashMap<>(); + ArmorRepository repository = DatabaseAccess.getRepository(ArmorRepository.class); + repository.findAll().forEach( armor -> { + Item newItem = readArmor(armor); + armorData.put(newItem.id, newItem); + }); + java.sql.Connection con = null; try { con = L2DatabaseFactory.getInstance().getConnection(); @@ -208,9 +215,6 @@ public ItemTable() { if (selectQuery.endsWith("etcitem")) { Item newItem = readItem(rset); itemData.put(newItem.id, newItem); - } else if (selectQuery.endsWith("armor")) { - Item newItem = readArmor(rset); - armorData.put(newItem.id, newItem); } else if (selectQuery.endsWith("weapon")) { Item newItem = readWeapon(rset); weaponData.put(newItem.id, newItem); @@ -340,25 +344,25 @@ private Item readWeapon(ResultSet rset) throws SQLException { * @return Item : object created from the database record * @throws SQLException */ - private Item readArmor(ResultSet rset) throws SQLException { + private Item readArmor(Armor rset) { Item item = new Item(); item.set = new StatsSet(); - item.type = _armorTypes.get(rset.getString("armor_type")); - item.id = rset.getInt("item_id"); - item.name = rset.getString("name"); + item.type = _armorTypes.get(rset.getArmorType()); + item.id = rset.getId(); + item.name = rset.getName(); item.set.set("item_id", item.id); item.set.set("name", item.name); - int bodypart = _slots.get(rset.getString("bodypart")); + int bodypart = _slots.get(rset.getBodyPart()); item.set.set("bodypart", bodypart); - item.set.set("crystallizable", Boolean.valueOf(rset.getString("crystallizable"))); - item.set.set("crystal_count", rset.getInt("crystal_count")); - item.set.set("sellable", Boolean.valueOf(rset.getString("sellable"))); - item.set.set("dropable", Boolean.valueOf(rset.getString("dropable"))); - item.set.set("destroyable", Boolean.valueOf(rset.getString("destroyable"))); - item.set.set("tradeable", Boolean.valueOf(rset.getString("tradeable"))); - item.set.set("item_skill_id", rset.getInt("item_skill_id")); - item.set.set("item_skill_lvl", rset.getInt("item_skill_lvl")); + item.set.set("crystallizable", Boolean.valueOf(rset.getCrystallizable())); + item.set.set("crystal_count", rset.getCrystalCount()); + item.set.set("sellable", Boolean.valueOf(rset.getSellable())); + item.set.set("dropable", Boolean.valueOf(rset.getDropable())); + item.set.set("destroyable", Boolean.valueOf(rset.getDestroyable())); + item.set.set("tradeable", Boolean.valueOf(rset.getTradeable())); + item.set.set("item_skill_id", rset.getItemSkillId()); + item.set.set("item_skill_lvl", rset.getItemSkillLevel()); if ((bodypart == L2Item.SLOT_NECK) || (bodypart == L2Item.SLOT_HAIR) || (bodypart == L2Item.SLOT_FACE) || (bodypart == L2Item.SLOT_DHAIR) || ((bodypart & L2Item.SLOT_L_EAR) != 0) || ((bodypart & L2Item.SLOT_L_FINGER) != 0)) { item.set.set("type1", L2Item.TYPE1_WEAPON_RING_EARRING_NECKLACE); @@ -368,15 +372,15 @@ private Item readArmor(ResultSet rset) throws SQLException { item.set.set("type2", L2Item.TYPE2_SHIELD_ARMOR); } - item.set.set("weight", rset.getInt("weight")); - item.set.set("material", _materials.get(rset.getString("material"))); - item.set.set("crystal_type", _crystalTypes.get(rset.getString("crystal_type"))); - item.set.set("avoid_modify", rset.getInt("avoid_modify")); - item.set.set("duration", rset.getInt("duration")); - item.set.set("p_def", rset.getInt("p_def")); - item.set.set("m_def", rset.getInt("m_def")); - item.set.set("mp_bonus", rset.getInt("mp_bonus")); - item.set.set("price", rset.getInt("price")); + item.set.set("weight", rset.getWeight()); + item.set.set("material", _materials.get(rset.getMaterial())); + item.set.set("crystal_type", _crystalTypes.get(rset.getCrystalType())); + item.set.set("avoid_modify", rset.getAvoidModify()); + item.set.set("duration", rset.getDuration()); + item.set.set("p_def", rset.getPdef()); + item.set.set("m_def", rset.getMdef()); + item.set.set("mp_bonus", rset.getMpBonus()); + item.set.set("price", rset.getPrice()); if (item.type == L2ArmorType.PET) { item.set.set("type1", L2Item.TYPE1_SHIELD_ARMOR); diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/Armor.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/Armor.java deleted file mode 100644 index d6ba38fd..00000000 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/Armor.java +++ /dev/null @@ -1,28 +0,0 @@ -package com.l2jbr.gameserver.model.dao; - - - -public class Armor { - - private int itemId; - private String name; - private String bodyPart; - private String crystallizable; - private String armorType; - private int weight; - private String material; - private String crystalType; - private int avoidModify; - private int duration; - private int pDef; - private int mDef; - private int MpBonus; - private int price; - private int crystalCount; - private String sellable; - private String dropable; - private String destroyable; - private String tradeable; - private int item_skill_id; - private int item_skill_lvl; -} diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/Armor.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/Armor.java new file mode 100644 index 00000000..6eafcdaa --- /dev/null +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/Armor.java @@ -0,0 +1,123 @@ +package com.l2jbr.gameserver.model.database; + + +import com.l2jbr.commons.database.annotation.Column; +import com.l2jbr.commons.database.model.Entity; + +public class Armor extends Entity { + + private int itemId; + private String name; + private String bodyPart; + private String crystallizable; + private String armorType; + private int weight; + private String material; + @Column("crystal_type") + private String crystalType; + @Column("avoid_modify") + private int avoidModify; + private int duration; + @Column("p_def") + private int pDef; + @Column("m_def") + private int mDef; + @Column("mp_bonus") + private int mpBonus; + private int price; + @Column("crystal_count") + private int crystalCount; + private String sellable; + private String dropable; + private String destroyable; + private String tradeable; + @Column("item_skill_id") + private int itemSkillId; + @Column("item_skill_lvl") + private int itemSkillLvl; + + public String getArmorType() { + return armorType; + } + + @Override + public Integer getId() { + return itemId; + } + + public String getName() { + return name; + } + + public String getBodyPart() { + return bodyPart; + } + + public String getCrystallizable() { + return crystallizable; + } + + public int getCrystalCount() { + return crystalCount; + } + + public String getSellable() { + return sellable; + } + + public String getDropable() { + return dropable; + } + + public String getDestroyable() { + return destroyable; + } + + public String getTradeable() { + return tradeable; + } + + public int getItemSkillId() { + return itemSkillId; + } + + public int getItemSkillLevel() { + return itemSkillLvl; + } + + public int getWeight() { + return weight; + } + + public String getMaterial() { + return material; + } + + public String getCrystalType() { + return crystalType; + } + + public int getAvoidModify() { + return avoidModify; + } + + public int getDuration() { + return duration; + } + + public int getPdef() { + return pDef; + } + + public int getMdef() { + return mDef; + } + + public int getMpBonus() { + return mpBonus; + } + + public int getPrice() { + return price; + } +} diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/ArmorSet.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/ArmorSet.java similarity index 85% rename from Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/ArmorSet.java rename to Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/ArmorSet.java index 588d7a8c..b98457ac 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/ArmorSet.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/ArmorSet.java @@ -1,4 +1,4 @@ -package com.l2jbr.gameserver.model.dao; +package com.l2jbr.gameserver.model.database; public class ArmorSet { diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/Auction.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/Auction.java similarity index 89% rename from Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/Auction.java rename to Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/Auction.java index a32c647e..151007be 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/Auction.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/Auction.java @@ -1,4 +1,4 @@ -package com.l2jbr.gameserver.model.dao; +package com.l2jbr.gameserver.model.database; diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/AuctionBid.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/AuctionBid.java similarity index 82% rename from Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/AuctionBid.java rename to Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/AuctionBid.java index 4c2cee65..ce90afdd 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/AuctionBid.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/AuctionBid.java @@ -1,4 +1,4 @@ -package com.l2jbr.gameserver.model.dao; +package com.l2jbr.gameserver.model.database; diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/AuctionWatch.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/AuctionWatch.java similarity index 65% rename from Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/AuctionWatch.java rename to Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/AuctionWatch.java index 6d82c9f1..bdeb6b03 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/AuctionWatch.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/AuctionWatch.java @@ -1,4 +1,4 @@ -package com.l2jbr.gameserver.model.dao; +package com.l2jbr.gameserver.model.database; public class AuctionWatch { private int charObjId; diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/Augmentations.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/Augmentations.java similarity index 74% rename from Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/Augmentations.java rename to Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/Augmentations.java index d0b8d8e1..ffd42156 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/Augmentations.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/Augmentations.java @@ -1,4 +1,4 @@ -package com.l2jbr.gameserver.model.dao; +package com.l2jbr.gameserver.model.database; diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/AutoChat.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/AutoChat.java similarity index 70% rename from Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/AutoChat.java rename to Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/AutoChat.java index c4f46ebc..3367aa1b 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/AutoChat.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/AutoChat.java @@ -1,4 +1,4 @@ -package com.l2jbr.gameserver.model.dao; +package com.l2jbr.gameserver.model.database; diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/AutoChatText.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/AutoChatText.java similarity index 66% rename from Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/AutoChatText.java rename to Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/AutoChatText.java index a66a9576..eda70cae 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/AutoChatText.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/AutoChatText.java @@ -1,4 +1,4 @@ -package com.l2jbr.gameserver.model.dao; +package com.l2jbr.gameserver.model.database; diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/BoxAccess.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/BoxAccess.java similarity index 64% rename from Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/BoxAccess.java rename to Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/BoxAccess.java index 8313b055..aa5b4f58 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/BoxAccess.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/BoxAccess.java @@ -1,4 +1,4 @@ -package com.l2jbr.gameserver.model.dao; +package com.l2jbr.gameserver.model.database; diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/Boxes.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/Boxes.java similarity index 82% rename from Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/Boxes.java rename to Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/Boxes.java index b8cdab6d..3dadf84e 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/Boxes.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/Boxes.java @@ -1,4 +1,4 @@ -package com.l2jbr.gameserver.model.dao; +package com.l2jbr.gameserver.model.database; diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/Castle.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/Castle.java similarity index 82% rename from Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/Castle.java rename to Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/Castle.java index b2b1e718..98424a2c 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/Castle.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/Castle.java @@ -1,4 +1,4 @@ -package com.l2jbr.gameserver.model.dao; +package com.l2jbr.gameserver.model.database; diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/CastleDoor.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/CastleDoor.java similarity index 89% rename from Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/CastleDoor.java rename to Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/CastleDoor.java index ac546a69..61981e83 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/CastleDoor.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/CastleDoor.java @@ -1,4 +1,4 @@ -package com.l2jbr.gameserver.model.dao; +package com.l2jbr.gameserver.model.database; diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/CastleDoorUpgrade.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/CastleDoorUpgrade.java similarity index 73% rename from Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/CastleDoorUpgrade.java rename to Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/CastleDoorUpgrade.java index 38ab8751..53f60a11 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/CastleDoorUpgrade.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/CastleDoorUpgrade.java @@ -1,4 +1,4 @@ -package com.l2jbr.gameserver.model.dao; +package com.l2jbr.gameserver.model.database; diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/CastleManorProcure.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/CastleManorProcure.java similarity index 82% rename from Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/CastleManorProcure.java rename to Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/CastleManorProcure.java index 28a0e640..afc59619 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/CastleManorProcure.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/CastleManorProcure.java @@ -1,4 +1,4 @@ -package com.l2jbr.gameserver.model.dao; +package com.l2jbr.gameserver.model.database; diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/CastleManorProduction.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/CastleManorProduction.java similarity index 81% rename from Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/CastleManorProduction.java rename to Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/CastleManorProduction.java index 28852a1e..edf7cc39 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/CastleManorProduction.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/CastleManorProduction.java @@ -1,4 +1,4 @@ -package com.l2jbr.gameserver.model.dao; +package com.l2jbr.gameserver.model.database; diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/CastleSiegeGuard.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/CastleSiegeGuard.java similarity index 84% rename from Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/CastleSiegeGuard.java rename to Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/CastleSiegeGuard.java index 29d543da..0b745407 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/CastleSiegeGuard.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/CastleSiegeGuard.java @@ -1,4 +1,4 @@ -package com.l2jbr.gameserver.model.dao; +package com.l2jbr.gameserver.model.database; diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/CharTemplates.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/CharTemplates.java similarity index 95% rename from Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/CharTemplates.java rename to Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/CharTemplates.java index 425c0ad6..e7e78d5a 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/CharTemplates.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/CharTemplates.java @@ -1,4 +1,4 @@ -package com.l2jbr.gameserver.model.dao; +package com.l2jbr.gameserver.model.database; diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/CharacterFriends.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/CharacterFriends.java similarity index 74% rename from Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/CharacterFriends.java rename to Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/CharacterFriends.java index 7b20a977..249aa5be 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/CharacterFriends.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/CharacterFriends.java @@ -1,4 +1,4 @@ -package com.l2jbr.gameserver.model.dao; +package com.l2jbr.gameserver.model.database; diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/CharacterHennas.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/CharacterHennas.java similarity index 76% rename from Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/CharacterHennas.java rename to Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/CharacterHennas.java index 1e3e513e..87c36616 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/CharacterHennas.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/CharacterHennas.java @@ -1,4 +1,4 @@ -package com.l2jbr.gameserver.model.dao; +package com.l2jbr.gameserver.model.database; diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/CharacterMacroses.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/CharacterMacroses.java similarity index 82% rename from Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/CharacterMacroses.java rename to Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/CharacterMacroses.java index 327e141d..76a44a97 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/CharacterMacroses.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/CharacterMacroses.java @@ -1,4 +1,4 @@ -package com.l2jbr.gameserver.model.dao; +package com.l2jbr.gameserver.model.database; diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/CharacterQuests.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/CharacterQuests.java similarity index 78% rename from Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/CharacterQuests.java rename to Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/CharacterQuests.java index b458691b..e48dff43 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/CharacterQuests.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/CharacterQuests.java @@ -1,4 +1,4 @@ -package com.l2jbr.gameserver.model.dao; +package com.l2jbr.gameserver.model.database; diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/CharacterRecipeBook.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/CharacterRecipeBook.java similarity index 70% rename from Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/CharacterRecipeBook.java rename to Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/CharacterRecipeBook.java index 3d25ee57..bf9e8b2c 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/CharacterRecipeBook.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/CharacterRecipeBook.java @@ -1,4 +1,4 @@ -package com.l2jbr.gameserver.model.dao; +package com.l2jbr.gameserver.model.database; diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/CharacterRecommends.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/CharacterRecommends.java similarity index 67% rename from Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/CharacterRecommends.java rename to Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/CharacterRecommends.java index 7c84e4c2..bf4a112b 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/CharacterRecommends.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/CharacterRecommends.java @@ -1,4 +1,4 @@ -package com.l2jbr.gameserver.model.dao; +package com.l2jbr.gameserver.model.database; diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/CharacterShortcuts.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/CharacterShortcuts.java similarity index 82% rename from Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/CharacterShortcuts.java rename to Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/CharacterShortcuts.java index 5604f8e8..6f9d2386 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/CharacterShortcuts.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/CharacterShortcuts.java @@ -1,4 +1,4 @@ -package com.l2jbr.gameserver.model.dao; +package com.l2jbr.gameserver.model.database; diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/CharacterSkills.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/CharacterSkills.java similarity index 80% rename from Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/CharacterSkills.java rename to Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/CharacterSkills.java index a10c7ee3..e6fa0f9c 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/CharacterSkills.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/CharacterSkills.java @@ -1,4 +1,4 @@ -package com.l2jbr.gameserver.model.dao; +package com.l2jbr.gameserver.model.database; diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/CharacterSkillsSave.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/CharacterSkillsSave.java similarity index 87% rename from Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/CharacterSkillsSave.java rename to Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/CharacterSkillsSave.java index 12553314..6ecc8ad7 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/CharacterSkillsSave.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/CharacterSkillsSave.java @@ -1,4 +1,4 @@ -package com.l2jbr.gameserver.model.dao; +package com.l2jbr.gameserver.model.database; diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/CharacterSubclasses.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/CharacterSubclasses.java similarity index 81% rename from Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/CharacterSubclasses.java rename to Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/CharacterSubclasses.java index b428049a..c342ab87 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/CharacterSubclasses.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/CharacterSubclasses.java @@ -1,4 +1,4 @@ -package com.l2jbr.gameserver.model.dao; +package com.l2jbr.gameserver.model.database; diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/Characters.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/Characters.java similarity index 97% rename from Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/Characters.java rename to Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/Characters.java index 72231f6b..ea5729b7 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/Characters.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/Characters.java @@ -1,4 +1,4 @@ -package com.l2jbr.gameserver.model.dao; +package com.l2jbr.gameserver.model.database; diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/ClanData.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/ClanData.java similarity index 92% rename from Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/ClanData.java rename to Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/ClanData.java index 38135dca..6b1cc374 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/ClanData.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/ClanData.java @@ -1,4 +1,4 @@ -package com.l2jbr.gameserver.model.dao; +package com.l2jbr.gameserver.model.database; diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/ClanHall.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/ClanHall.java similarity index 85% rename from Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/ClanHall.java rename to Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/ClanHall.java index b2c58ba7..fac6286a 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/ClanHall.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/ClanHall.java @@ -1,4 +1,4 @@ -package com.l2jbr.gameserver.model.dao; +package com.l2jbr.gameserver.model.database; diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/ClanHallFunctions.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/ClanHallFunctions.java similarity index 80% rename from Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/ClanHallFunctions.java rename to Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/ClanHallFunctions.java index 44af9df8..41356017 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/ClanHallFunctions.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/ClanHallFunctions.java @@ -1,4 +1,4 @@ -package com.l2jbr.gameserver.model.dao; +package com.l2jbr.gameserver.model.database; diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/ClanPrivs.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/ClanPrivs.java similarity index 73% rename from Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/ClanPrivs.java rename to Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/ClanPrivs.java index 43a53032..3249652a 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/ClanPrivs.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/ClanPrivs.java @@ -1,4 +1,4 @@ -package com.l2jbr.gameserver.model.dao; +package com.l2jbr.gameserver.model.database; diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/ClanSkills.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/ClanSkills.java similarity index 76% rename from Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/ClanSkills.java rename to Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/ClanSkills.java index 400258a1..e6e025a4 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/ClanSkills.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/ClanSkills.java @@ -1,4 +1,4 @@ -package com.l2jbr.gameserver.model.dao; +package com.l2jbr.gameserver.model.database; diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/ClanSubpledges.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/ClanSubpledges.java similarity index 76% rename from Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/ClanSubpledges.java rename to Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/ClanSubpledges.java index 7119683d..46fcdea5 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/ClanSubpledges.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/ClanSubpledges.java @@ -1,4 +1,4 @@ -package com.l2jbr.gameserver.model.dao; +package com.l2jbr.gameserver.model.database; public class ClanSubpledges { diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/ClanWars.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/ClanWars.java similarity index 75% rename from Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/ClanWars.java rename to Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/ClanWars.java index e98e1c0b..80a921b6 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/ClanWars.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/ClanWars.java @@ -1,4 +1,4 @@ -package com.l2jbr.gameserver.model.dao; +package com.l2jbr.gameserver.model.database; diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/CursedWeapons.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/CursedWeapons.java similarity index 81% rename from Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/CursedWeapons.java rename to Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/CursedWeapons.java index ac91d3c6..65439ad6 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/CursedWeapons.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/CursedWeapons.java @@ -1,4 +1,4 @@ -package com.l2jbr.gameserver.model.dao; +package com.l2jbr.gameserver.model.database; diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/DimensionalRift.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/DimensionalRift.java similarity index 86% rename from Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/DimensionalRift.java rename to Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/DimensionalRift.java index fca5cd9b..70b8fd6a 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/DimensionalRift.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/DimensionalRift.java @@ -1,4 +1,4 @@ -package com.l2jbr.gameserver.model.dao; +package com.l2jbr.gameserver.model.database; diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/DropList.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/DropList.java similarity index 78% rename from Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/DropList.java rename to Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/DropList.java index 3dda3186..4b3db0c7 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/DropList.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/DropList.java @@ -1,4 +1,4 @@ -package com.l2jbr.gameserver.model.dao; +package com.l2jbr.gameserver.model.database; diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/EnchantSkillTrees.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/EnchantSkillTrees.java similarity index 88% rename from Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/EnchantSkillTrees.java rename to Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/EnchantSkillTrees.java index 83453c7e..4ec192bc 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/EnchantSkillTrees.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/EnchantSkillTrees.java @@ -1,4 +1,4 @@ -package com.l2jbr.gameserver.model.dao; +package com.l2jbr.gameserver.model.database; diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/EtcItem.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/EtcItem.java similarity index 92% rename from Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/EtcItem.java rename to Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/EtcItem.java index d4cb1e48..adcc8b81 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/EtcItem.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/EtcItem.java @@ -1,4 +1,4 @@ -package com.l2jbr.gameserver.model.dao; +package com.l2jbr.gameserver.model.database; diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/Fish.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/Fish.java similarity index 87% rename from Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/Fish.java rename to Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/Fish.java index 3fd8736a..c7c6dd34 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/Fish.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/Fish.java @@ -1,4 +1,4 @@ -package com.l2jbr.gameserver.model.dao; +package com.l2jbr.gameserver.model.database; diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/FishingSkillTrees.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/FishingSkillTrees.java similarity index 83% rename from Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/FishingSkillTrees.java rename to Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/FishingSkillTrees.java index 73f671ca..50544f35 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/FishingSkillTrees.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/FishingSkillTrees.java @@ -1,4 +1,4 @@ -package com.l2jbr.gameserver.model.dao; +package com.l2jbr.gameserver.model.database; diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/Forums.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/Forums.java similarity index 83% rename from Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/Forums.java rename to Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/Forums.java index 0a067c4c..9306d2c1 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/Forums.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/Forums.java @@ -1,4 +1,4 @@ -package com.l2jbr.gameserver.model.dao; +package com.l2jbr.gameserver.model.database; diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/GameServers.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/GameServers.java similarity index 70% rename from Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/GameServers.java rename to Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/GameServers.java index 8705dc38..f70dfff7 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/GameServers.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/GameServers.java @@ -1,4 +1,4 @@ -package com.l2jbr.gameserver.model.dao; +package com.l2jbr.gameserver.model.database; public class GameServers { private int server_id; diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/Games.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/Games.java similarity index 86% rename from Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/Games.java rename to Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/Games.java index fa5cbb5e..2ff0c06f 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/Games.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/Games.java @@ -1,4 +1,4 @@ -package com.l2jbr.gameserver.model.dao; +package com.l2jbr.gameserver.model.database; diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/GlobalTasks.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/GlobalTasks.java similarity index 82% rename from Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/GlobalTasks.java rename to Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/GlobalTasks.java index b4904559..c9b785f2 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/GlobalTasks.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/GlobalTasks.java @@ -1,4 +1,4 @@ -package com.l2jbr.gameserver.model.dao; +package com.l2jbr.gameserver.model.database; diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/HelperBuffList.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/HelperBuffList.java similarity index 83% rename from Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/HelperBuffList.java rename to Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/HelperBuffList.java index 57604e2e..dbb82653 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/HelperBuffList.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/HelperBuffList.java @@ -1,4 +1,4 @@ -package com.l2jbr.gameserver.model.dao; +package com.l2jbr.gameserver.model.database; diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/Henna.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/Henna.java similarity index 87% rename from Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/Henna.java rename to Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/Henna.java index 445f9fa2..18bfa913 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/Henna.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/Henna.java @@ -1,4 +1,4 @@ -package com.l2jbr.gameserver.model.dao; +package com.l2jbr.gameserver.model.database; diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/HennaTrees.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/HennaTrees.java similarity index 65% rename from Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/HennaTrees.java rename to Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/HennaTrees.java index 0284e009..c4118bda 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/HennaTrees.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/HennaTrees.java @@ -1,4 +1,4 @@ -package com.l2jbr.gameserver.model.dao; +package com.l2jbr.gameserver.model.database; diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/Heroes.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/Heroes.java similarity index 77% rename from Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/Heroes.java rename to Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/Heroes.java index b63caada..58b93aa3 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/Heroes.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/Heroes.java @@ -1,4 +1,4 @@ -package com.l2jbr.gameserver.model.dao; +package com.l2jbr.gameserver.model.database; diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/Items.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/Items.java similarity index 89% rename from Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/Items.java rename to Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/Items.java index 99a16dca..0745fe9b 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/Items.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/Items.java @@ -1,4 +1,4 @@ -package com.l2jbr.gameserver.model.dao; +package com.l2jbr.gameserver.model.database; diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/ItemsOnGround.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/ItemsOnGround.java similarity index 84% rename from Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/ItemsOnGround.java rename to Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/ItemsOnGround.java index 7192cec4..a58dfc8e 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/ItemsOnGround.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/ItemsOnGround.java @@ -1,4 +1,4 @@ -package com.l2jbr.gameserver.model.dao; +package com.l2jbr.gameserver.model.database; diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/LevelUpGain.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/LevelUpGain.java similarity index 88% rename from Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/LevelUpGain.java rename to Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/LevelUpGain.java index 2289d99b..d087567f 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/LevelUpGain.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/LevelUpGain.java @@ -1,4 +1,4 @@ -package com.l2jbr.gameserver.model.dao; +package com.l2jbr.gameserver.model.database; diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/Locations.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/Locations.java similarity index 79% rename from Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/Locations.java rename to Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/Locations.java index 019d94b3..6c0ddd3f 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/Locations.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/Locations.java @@ -1,4 +1,4 @@ -package com.l2jbr.gameserver.model.dao; +package com.l2jbr.gameserver.model.database; diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/MapRegion.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/MapRegion.java similarity index 85% rename from Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/MapRegion.java rename to Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/MapRegion.java index eaa7c70d..c283f4c1 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/MapRegion.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/MapRegion.java @@ -1,4 +1,4 @@ -package com.l2jbr.gameserver.model.dao; +package com.l2jbr.gameserver.model.database; diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/MerchantAreasList.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/MerchantAreasList.java similarity index 78% rename from Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/MerchantAreasList.java rename to Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/MerchantAreasList.java index 660e80ad..88bfd149 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/MerchantAreasList.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/MerchantAreasList.java @@ -1,4 +1,4 @@ -package com.l2jbr.gameserver.model.dao; +package com.l2jbr.gameserver.model.database; diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/MerchantBuyList.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/MerchantBuyList.java similarity index 84% rename from Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/MerchantBuyList.java rename to Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/MerchantBuyList.java index 1cc11bb6..91414b91 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/MerchantBuyList.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/MerchantBuyList.java @@ -1,4 +1,4 @@ -package com.l2jbr.gameserver.model.dao; +package com.l2jbr.gameserver.model.database; diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/MerchantLease.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/MerchantLease.java similarity index 78% rename from Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/MerchantLease.java rename to Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/MerchantLease.java index fd9b5500..978cbbe2 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/MerchantLease.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/MerchantLease.java @@ -1,4 +1,4 @@ -package com.l2jbr.gameserver.model.dao; +package com.l2jbr.gameserver.model.database; diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/MerchantShopIds.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/MerchantShopIds.java similarity index 66% rename from Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/MerchantShopIds.java rename to Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/MerchantShopIds.java index 7ec4d4a0..cff2787f 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/MerchantShopIds.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/MerchantShopIds.java @@ -1,4 +1,4 @@ -package com.l2jbr.gameserver.model.dao; +package com.l2jbr.gameserver.model.database; diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/Merchants.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/Merchants.java similarity index 66% rename from Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/Merchants.java rename to Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/Merchants.java index 33beb106..d3ec7a5c 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/Merchants.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/Merchants.java @@ -1,4 +1,4 @@ -package com.l2jbr.gameserver.model.dao; +package com.l2jbr.gameserver.model.database; diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/Minions.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/Minions.java similarity index 75% rename from Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/Minions.java rename to Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/Minions.java index c7df56e1..25c7af48 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/Minions.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/Minions.java @@ -1,4 +1,4 @@ -package com.l2jbr.gameserver.model.dao; +package com.l2jbr.gameserver.model.database; diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/ModsWedding.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/ModsWedding.java similarity index 81% rename from Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/ModsWedding.java rename to Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/ModsWedding.java index c7021fc2..9983fe40 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/ModsWedding.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/ModsWedding.java @@ -1,4 +1,4 @@ -package com.l2jbr.gameserver.model.dao; +package com.l2jbr.gameserver.model.database; diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/Npc.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/Npc.java similarity index 96% rename from Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/Npc.java rename to Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/Npc.java index ffa49632..ec40f4fd 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/Npc.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/Npc.java @@ -1,4 +1,4 @@ -package com.l2jbr.gameserver.model.dao; +package com.l2jbr.gameserver.model.database; diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/NpcSkills.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/NpcSkills.java similarity index 68% rename from Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/NpcSkills.java rename to Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/NpcSkills.java index 4653d9cd..184c5170 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/NpcSkills.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/NpcSkills.java @@ -1,4 +1,4 @@ -package com.l2jbr.gameserver.model.dao; +package com.l2jbr.gameserver.model.database; public class NpcSkills { private int npcid; diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/OlympiadNobles.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/OlympiadNobles.java similarity index 80% rename from Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/OlympiadNobles.java rename to Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/OlympiadNobles.java index 930f9cc0..b1ce0322 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/OlympiadNobles.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/OlympiadNobles.java @@ -1,4 +1,4 @@ -package com.l2jbr.gameserver.model.dao; +package com.l2jbr.gameserver.model.database; diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/Pets.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/Pets.java similarity index 85% rename from Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/Pets.java rename to Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/Pets.java index 481f08b0..b992525b 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/Pets.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/Pets.java @@ -1,4 +1,4 @@ -package com.l2jbr.gameserver.model.dao; +package com.l2jbr.gameserver.model.database; diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/PetsStats.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/PetsStats.java similarity index 93% rename from Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/PetsStats.java rename to Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/PetsStats.java index 71e33412..7edc27d8 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/PetsStats.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/PetsStats.java @@ -1,4 +1,4 @@ -package com.l2jbr.gameserver.model.dao; +package com.l2jbr.gameserver.model.database; diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/PledgeSkillTrees.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/PledgeSkillTrees.java similarity index 83% rename from Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/PledgeSkillTrees.java rename to Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/PledgeSkillTrees.java index 10bbc8f9..5ad2b111 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/PledgeSkillTrees.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/PledgeSkillTrees.java @@ -1,4 +1,4 @@ -package com.l2jbr.gameserver.model.dao; +package com.l2jbr.gameserver.model.database; diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/Posts.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/Posts.java similarity index 83% rename from Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/Posts.java rename to Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/Posts.java index 570fa339..a5e34600 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/Posts.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/Posts.java @@ -1,4 +1,4 @@ -package com.l2jbr.gameserver.model.dao; +package com.l2jbr.gameserver.model.database; public class Posts { private int post_id; diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/QuestGlobalData.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/QuestGlobalData.java similarity index 72% rename from Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/QuestGlobalData.java rename to Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/QuestGlobalData.java index 9b98f687..5ccb67e6 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/QuestGlobalData.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/QuestGlobalData.java @@ -1,4 +1,4 @@ -package com.l2jbr.gameserver.model.dao; +package com.l2jbr.gameserver.model.database; diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/RaidbossSpawnList.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/RaidbossSpawnList.java similarity index 88% rename from Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/RaidbossSpawnList.java rename to Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/RaidbossSpawnList.java index 23b0dc88..1706ca82 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/RaidbossSpawnList.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/RaidbossSpawnList.java @@ -1,4 +1,4 @@ -package com.l2jbr.gameserver.model.dao; +package com.l2jbr.gameserver.model.database; diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/RandomSpawn.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/RandomSpawn.java similarity index 85% rename from Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/RandomSpawn.java rename to Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/RandomSpawn.java index 543b01f6..75ea9d0a 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/RandomSpawn.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/RandomSpawn.java @@ -1,4 +1,4 @@ -package com.l2jbr.gameserver.model.dao; +package com.l2jbr.gameserver.model.database; diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/RandomSpawnLoc.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/RandomSpawnLoc.java similarity index 76% rename from Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/RandomSpawnLoc.java rename to Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/RandomSpawnLoc.java index 5ed7a7a0..593cd517 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/RandomSpawnLoc.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/RandomSpawnLoc.java @@ -1,4 +1,4 @@ -package com.l2jbr.gameserver.model.dao; +package com.l2jbr.gameserver.model.database; diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/SevenSigns.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/SevenSigns.java similarity index 85% rename from Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/SevenSigns.java rename to Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/SevenSigns.java index 43934467..7c26296c 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/SevenSigns.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/SevenSigns.java @@ -1,4 +1,4 @@ -package com.l2jbr.gameserver.model.dao; +package com.l2jbr.gameserver.model.database; diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/SevenSignsFestival.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/SevenSignsFestival.java similarity index 80% rename from Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/SevenSignsFestival.java rename to Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/SevenSignsFestival.java index dc580cbe..7b58f4bf 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/SevenSignsFestival.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/SevenSignsFestival.java @@ -1,4 +1,4 @@ -package com.l2jbr.gameserver.model.dao; +package com.l2jbr.gameserver.model.database; diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/SevenSignsStatus.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/SevenSignsStatus.java similarity index 94% rename from Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/SevenSignsStatus.java rename to Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/SevenSignsStatus.java index f28a0e79..4042ec84 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/SevenSignsStatus.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/SevenSignsStatus.java @@ -1,4 +1,4 @@ -package com.l2jbr.gameserver.model.dao; +package com.l2jbr.gameserver.model.database; diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/SiegeClan.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/SiegeClan.java similarity index 75% rename from Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/SiegeClan.java rename to Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/SiegeClan.java index b2233c92..27cd13b1 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/SiegeClan.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/SiegeClan.java @@ -1,4 +1,4 @@ -package com.l2jbr.gameserver.model.dao; +package com.l2jbr.gameserver.model.database; diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/SkillLearn.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/SkillLearn.java similarity index 64% rename from Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/SkillLearn.java rename to Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/SkillLearn.java index a636984e..813a9b81 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/SkillLearn.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/SkillLearn.java @@ -1,4 +1,4 @@ -package com.l2jbr.gameserver.model.dao; +package com.l2jbr.gameserver.model.database; diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/SkillSpellBooks.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/SkillSpellBooks.java similarity index 66% rename from Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/SkillSpellBooks.java rename to Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/SkillSpellBooks.java index 8b6875d6..fca23686 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/SkillSpellBooks.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/SkillSpellBooks.java @@ -1,4 +1,4 @@ -package com.l2jbr.gameserver.model.dao; +package com.l2jbr.gameserver.model.database; diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/SkillTrees.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/SkillTrees.java similarity index 80% rename from Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/SkillTrees.java rename to Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/SkillTrees.java index c51f7ed6..742c4a98 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/SkillTrees.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/SkillTrees.java @@ -1,4 +1,4 @@ -package com.l2jbr.gameserver.model.dao; +package com.l2jbr.gameserver.model.database; diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/Spawnlist.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/Spawnlist.java similarity index 88% rename from Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/Spawnlist.java rename to Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/Spawnlist.java index 83356cef..f037da19 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/Spawnlist.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/Spawnlist.java @@ -1,4 +1,4 @@ -package com.l2jbr.gameserver.model.dao; +package com.l2jbr.gameserver.model.database; diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/Teleport.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/Teleport.java similarity index 81% rename from Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/Teleport.java rename to Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/Teleport.java index a32babed..7400323c 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/Teleport.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/Teleport.java @@ -1,4 +1,4 @@ -package com.l2jbr.gameserver.model.dao; +package com.l2jbr.gameserver.model.database; public class Teleport { private String Description; diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/Topic.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/Topic.java similarity index 85% rename from Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/Topic.java rename to Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/Topic.java index 4de80ca2..c2b2a297 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/Topic.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/Topic.java @@ -1,4 +1,4 @@ -package com.l2jbr.gameserver.model.dao; +package com.l2jbr.gameserver.model.database; diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/WalkerRoutes.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/WalkerRoutes.java similarity index 85% rename from Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/WalkerRoutes.java rename to Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/WalkerRoutes.java index 85c93c84..1e2e1794 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/WalkerRoutes.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/WalkerRoutes.java @@ -1,4 +1,4 @@ -package com.l2jbr.gameserver.model.dao; +package com.l2jbr.gameserver.model.database; diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/Weapon.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/Weapon.java similarity index 96% rename from Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/Weapon.java rename to Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/Weapon.java index 7f5d722c..fc8c5fd6 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/Weapon.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/Weapon.java @@ -1,4 +1,4 @@ -package com.l2jbr.gameserver.model.dao; +package com.l2jbr.gameserver.model.database; diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/Zone.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/Zone.java similarity index 84% rename from Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/Zone.java rename to Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/Zone.java index e84bf7e4..6d7ad504 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/Zone.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/Zone.java @@ -1,4 +1,4 @@ -package com.l2jbr.gameserver.model.dao; +package com.l2jbr.gameserver.model.database; diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/ZoneVertices.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/ZoneVertices.java similarity index 71% rename from Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/ZoneVertices.java rename to Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/ZoneVertices.java index 517112dd..69f22210 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/ZoneVertices.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/ZoneVertices.java @@ -1,4 +1,4 @@ -package com.l2jbr.gameserver.model.dao; +package com.l2jbr.gameserver.model.database; diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/classList.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/classList.java similarity index 70% rename from Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/classList.java rename to Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/classList.java index 7c02ab9c..7166e7d4 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/dao/classList.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/classList.java @@ -1,4 +1,4 @@ -package com.l2jbr.gameserver.model.dao; +package com.l2jbr.gameserver.model.database; diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/repository/ArmorRepository.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/repository/ArmorRepository.java new file mode 100644 index 00000000..c1536824 --- /dev/null +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/repository/ArmorRepository.java @@ -0,0 +1,7 @@ +package com.l2jbr.gameserver.model.database.repository; + +import com.l2jbr.gameserver.model.database.Armor; +import org.springframework.data.repository.CrudRepository; + +public interface ArmorRepository extends CrudRepository { +} From 437608c6eefe8f7eb51a285f10ab54aea316c6c1 Mon Sep 17 00:00:00 2001 From: Alisson Oliveira Date: Tue, 17 Apr 2018 22:25:16 -0300 Subject: [PATCH 012/236] =?UTF-8?q?Remove=20refer=C3=AAncias=20diretas=20a?= =?UTF-8?q?=20tabela=20weapon.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../gameserver/datatables/ItemTable.java | 103 ++++---- .../gameserver/model/database/Weapon.java | 234 +++++++++++++++--- .../database/repository/WeaponRepository.java | 6 + 3 files changed, 263 insertions(+), 80 deletions(-) create mode 100644 Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/repository/WeaponRepository.java diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/datatables/ItemTable.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/datatables/ItemTable.java index fd477058..1262ba7a 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/datatables/ItemTable.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/datatables/ItemTable.java @@ -30,7 +30,9 @@ import com.l2jbr.gameserver.model.actor.instance.L2PcInstance; import com.l2jbr.gameserver.model.actor.instance.L2RaidBossInstance; import com.l2jbr.gameserver.model.database.Armor; +import com.l2jbr.gameserver.model.database.Weapon; import com.l2jbr.gameserver.model.database.repository.ArmorRepository; +import com.l2jbr.gameserver.model.database.repository.WeaponRepository; import com.l2jbr.gameserver.skills.SkillsEngine; import com.l2jbr.gameserver.templates.*; import org.slf4j.Logger; @@ -151,8 +153,6 @@ public class ItemTable { */ private static final String[] SQL_ITEM_SELECTS = { "SELECT item_id, name, crystallizable, item_type, weight, consume_type, material, crystal_type, duration, price, crystal_count, sellable, dropable, destroyable, tradeable FROM etcitem", - - "SELECT item_id, name, bodypart, crystallizable, weight, soulshots, spiritshots," + " material, crystal_type, p_dam, rnd_dam, weaponType, critical, hit_modify, avoid_modify," + " shield_def, shield_def_rate, atk_speed, mp_consume, m_dam, duration, price, crystal_count," + " sellable, dropable, destroyable, tradeable, item_skill_id, item_skill_lvl,enchant4_skill_id,enchant4_skill_lvl, onCast_skill_id, onCast_skill_lvl," + " onCast_skill_chance, onCrit_skill_id, onCrit_skill_lvl, onCrit_skill_chance FROM weapon" }; /** @@ -197,12 +197,18 @@ public ItemTable() { _armors = new LinkedHashMap<>(); _weapons = new LinkedHashMap<>(); - ArmorRepository repository = DatabaseAccess.getRepository(ArmorRepository.class); - repository.findAll().forEach( armor -> { + ArmorRepository armorRepository = DatabaseAccess.getRepository(ArmorRepository.class); + armorRepository.findAll().forEach( armor -> { Item newItem = readArmor(armor); armorData.put(newItem.id, newItem); }); + WeaponRepository weaponRepository = DatabaseAccess.getRepository(WeaponRepository.class); + weaponRepository.findAll().forEach(weapon -> { + Item newItem = readWeapon(weapon); + weaponData.put(newItem.id, newItem); + }); + java.sql.Connection con = null; try { con = L2DatabaseFactory.getInstance().getConnection(); @@ -215,9 +221,6 @@ public ItemTable() { if (selectQuery.endsWith("etcitem")) { Item newItem = readItem(rset); itemData.put(newItem.id, newItem); - } else if (selectQuery.endsWith("weapon")) { - Item newItem = readWeapon(rset); - weaponData.put(newItem.id, newItem); } } @@ -257,16 +260,16 @@ public ItemTable() { /** * Returns object Item from the record of the database * - * @param rset : ResultSet designating a record of the [weapon] table of database + * @param weapon : ResultSet designating a record of the [weapon] table of database * @return Item : object created from the database record * @throws SQLException */ - private Item readWeapon(ResultSet rset) throws SQLException { + private Item readWeapon(Weapon weapon) { Item item = new Item(); item.set = new StatsSet(); - item.type = _weaponTypes.get(rset.getString("weaponType")); - item.id = rset.getInt("item_id"); - item.name = rset.getString("name"); + item.type = _weaponTypes.get(weapon.getType()); + item.id = weapon.getId(); + item.name = weapon.getName(); item.set.set("item_id", item.id); item.set.set("name", item.name); @@ -280,44 +283,44 @@ private Item readWeapon(ResultSet rset) throws SQLException { item.set.set("type2", L2Item.TYPE2_WEAPON); } - item.set.set("bodypart", _slots.get(rset.getString("bodypart"))); - item.set.set("material", _materials.get(rset.getString("material"))); - item.set.set("crystal_type", _crystalTypes.get(rset.getString("crystal_type"))); - item.set.set("crystallizable", Boolean.valueOf(rset.getString("crystallizable")).booleanValue()); - item.set.set("weight", rset.getInt("weight")); - item.set.set("soulshots", rset.getInt("soulshots")); - item.set.set("spiritshots", rset.getInt("spiritshots")); - item.set.set("p_dam", rset.getInt("p_dam")); - item.set.set("rnd_dam", rset.getInt("rnd_dam")); - item.set.set("critical", rset.getInt("critical")); - item.set.set("hit_modify", rset.getDouble("hit_modify")); - item.set.set("avoid_modify", rset.getInt("avoid_modify")); - item.set.set("shield_def", rset.getInt("shield_def")); - item.set.set("shield_def_rate", rset.getInt("shield_def_rate")); - item.set.set("atk_speed", rset.getInt("atk_speed")); - item.set.set("mp_consume", rset.getInt("mp_consume")); - item.set.set("m_dam", rset.getInt("m_dam")); - item.set.set("duration", rset.getInt("duration")); - item.set.set("price", rset.getInt("price")); - item.set.set("crystal_count", rset.getInt("crystal_count")); - item.set.set("sellable", Boolean.valueOf(rset.getString("sellable"))); - item.set.set("dropable", Boolean.valueOf(rset.getString("dropable"))); - item.set.set("destroyable", Boolean.valueOf(rset.getString("destroyable"))); - item.set.set("tradeable", Boolean.valueOf(rset.getString("tradeable"))); - - item.set.set("item_skill_id", rset.getInt("item_skill_id")); - item.set.set("item_skill_lvl", rset.getInt("item_skill_lvl")); - - item.set.set("enchant4_skill_id", rset.getInt("enchant4_skill_id")); - item.set.set("enchant4_skill_lvl", rset.getInt("enchant4_skill_lvl")); - - item.set.set("onCast_skill_id", rset.getInt("onCast_skill_id")); - item.set.set("onCast_skill_lvl", rset.getInt("onCast_skill_lvl")); - item.set.set("onCast_skill_chance", rset.getInt("onCast_skill_chance")); - - item.set.set("onCrit_skill_id", rset.getInt("onCrit_skill_id")); - item.set.set("onCrit_skill_lvl", rset.getInt("onCrit_skill_lvl")); - item.set.set("onCrit_skill_chance", rset.getInt("onCrit_skill_chance")); + item.set.set("bodypart", _slots.get(weapon.getBodyPart())); + item.set.set("material", _materials.get(weapon.getMaterial())); + item.set.set("crystal_type", _crystalTypes.get(weapon.getCrystalType())); + item.set.set("crystallizable", Boolean.valueOf(weapon.getCrystallizable())); + item.set.set("weight", weapon.getWeight()); + item.set.set("soulshots", weapon.getSoulshots()); + item.set.set("spiritshots", weapon.getSpiritshots()); + item.set.set("p_dam", weapon.getPDam()); + item.set.set("rnd_dam", weapon.getRndDam()); + item.set.set("critical", weapon.getCritical()); + item.set.set("hit_modify", weapon.getHitModify()); + item.set.set("avoid_modify", weapon.getAvoidModify()); + item.set.set("shield_def", weapon.getShieldDef()); + item.set.set("shield_def_rate", weapon.getShieldDefRate()); + item.set.set("atk_speed", weapon.getAtkSpeed()); + item.set.set("mp_consume", weapon.getMpConsume()); + item.set.set("m_dam", weapon.getMDam()); + item.set.set("duration", weapon.getDuration()); + item.set.set("price", weapon.getPrice()); + item.set.set("crystal_count", weapon.getCrystalCount()); + item.set.set("sellable", Boolean.valueOf(weapon.getSellable())); + item.set.set("dropable", Boolean.valueOf(weapon.getDropable())); + item.set.set("destroyable", Boolean.valueOf(weapon.getDestroyable())); + item.set.set("tradeable", Boolean.valueOf(weapon.getTradeable())); + + item.set.set("item_skill_id", weapon.getItemSkillId()); + item.set.set("item_skill_lvl", weapon.getItemSkillLevel()); + + item.set.set("enchant4_skill_id", weapon.getEnchant4SkillId()); + item.set.set("enchant4_skill_lvl", weapon.getEnchant4SkillLevel()); + + item.set.set("onCast_skill_id", weapon.getOnCastSkillId()); + item.set.set("onCast_skill_lvl", weapon.getOnCastSkillLevel()); + item.set.set("onCast_skill_chance", weapon.getOnCastSkillChance()); + + item.set.set("onCrit_skill_id", weapon.getOnCritSkillId()); + item.set.set("onCrit_skill_lvl", weapon.getOnCritSkillLevel()); + item.set.set("onCrit_skill_chance", weapon.getOnCritSkillChance()); if (item.type == L2WeaponType.PET) { item.set.set("type1", L2Item.TYPE1_WEAPON_RING_EARRING_NECKLACE); diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/Weapon.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/Weapon.java index fc8c5fd6..618e0fb6 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/Weapon.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/Weapon.java @@ -1,43 +1,217 @@ package com.l2jbr.gameserver.model.database; +import com.l2jbr.commons.database.annotation.Column; +import com.l2jbr.commons.database.model.Entity; +public class Weapon extends Entity { -public class Weapon { - private String item_id; + @Column("item_id") + private Integer itemId; private String name; private String bodypart; private String crystallizable; - private String weight; - private String soulshots; - private String spiritshots; + private Integer weight; + private Integer soulshots; + private Integer spiritshots; private String material; - private String crystal_type; - private String p_dam; - private String rnd_dam; - private String weaponType; - private String critical; - private String hit_modify; - private String avoid_modify; - private String shield_def; - private String shield_def_rate; - private String atk_speed; - private String mp_consume; - private String m_dam; - private String duration; - private String price; - private String crystal_count; + @Column("crystal_type") + private String crystalType; + @Column("p_dam") + private Integer pDam; + @Column("rnd_dam") + private Integer rndDam; + @Column("weaponType") + private String type; + private Integer critical; + @Column("hit_modify") + private Double hitModify; + @Column("avoid_modify") + private Integer avoidModify; + @Column("shield_def") + private Integer shieldDef; + @Column("shield_def_rate") + private Integer shieldDefRate; + @Column("atk_speed") + private Integer atkSpeed; + @Column("mp_consume") + private Integer mpConsume; + @Column("m_dam") + private Integer mDam; + private Integer duration; + private Integer price; + @Column("crystal_count") + private Integer crystal_count; private String sellable; private String dropable; private String destroyable; private String tradeable; - private String item_skill_id; - private String item_skill_lvl; - private String enchant4_skill_id; - private String enchant4_skill_lvl; - private String onCast_skill_id; - private String onCast_skill_lvl; - private String onCast_skill_chance; - private String onCrit_skill_id; - private String onCrit_skill_lvl; - private String onCrit_skill_chance; + @Column("item_skill_id") + private Integer itemSkillId; + @Column("item_skill_lvl") + private Integer itemSkillLvl; + @Column("enchant4_skill_id") + private Integer enchant4SkillId; + @Column("enchant4_skill_lvl") + private Integer enchant4SkillLvl; + @Column("onCast_skill_id") + private Integer onCastSkillId; + @Column("onCast_skill_lvl") + private Integer onCastSkillLvl; + @Column("onCast_skill_chance") + private Integer onCastSkillChance; + @Column("onCrit_skill_id") + private Integer onCritSkillId; + @Column("onCrit_skill_lvl") + private Integer onCritSkillLvl; + @Column("onCrit_skill_chance") + private Integer onCritSkillChance; + + @Override + public Integer getId() { + return itemId; + } + + public String getType() { + return type; + } + + public String getName() { + return name; + } + + public String getBodyPart() { + return bodypart; + } + + public String getMaterial() { + return material; + } + + public String getCrystalType() { + return crystalType; + } + + public String getCrystallizable() { + return crystallizable; + } + + public int getWeight() { + return weight; + } + + public int getSoulshots() { + return soulshots; + } + + public int getSpiritshots() { + return spiritshots; + } + + public int getPDam() { + return pDam; + } + + public int getRndDam() { + return rndDam; + } + + public int getCritical() { + return critical; + } + + public double getHitModify() { + return hitModify; + } + + public int getAvoidModify() { + return avoidModify; + } + + public int getShieldDef() { + return shieldDef; + } + + public int getShieldDefRate() { + return shieldDefRate; + } + + public int getAtkSpeed() { + return atkSpeed; + } + + public int getMpConsume() { + return mpConsume; + } + + public int getMDam() { + return mDam; + } + + public int getDuration() { + return duration; + } + + public int getPrice() { + return price; + } + + public int getCrystalCount() { + return crystal_count; + } + + public String getSellable() { + return sellable; + } + + public String getDropable() { + return dropable; + } + + public String getDestroyable() { + return destroyable; + } + + public String getTradeable() { + return tradeable; + } + + public int getItemSkillId() { + return itemSkillId; + } + + public int getItemSkillLevel() { + return itemSkillLvl; + } + + public int getEnchant4SkillId() { + return enchant4SkillId; + } + + public int getEnchant4SkillLevel() { + return enchant4SkillLvl; + } + + public int getOnCastSkillId() { + return onCastSkillId; + } + + public int getOnCastSkillLevel() { + return onCastSkillLvl; + } + + public int getOnCastSkillChance() { + return onCastSkillChance; + } + + public int getOnCritSkillId() { + return onCritSkillId; + } + + public int getOnCritSkillLevel() { + return onCritSkillLvl; + } + + public int getOnCritSkillChance() { + return onCritSkillChance; + } } diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/repository/WeaponRepository.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/repository/WeaponRepository.java new file mode 100644 index 00000000..52efd2fd --- /dev/null +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/repository/WeaponRepository.java @@ -0,0 +1,6 @@ +package com.l2jbr.gameserver.model.database.repository; + +import com.l2jbr.gameserver.model.database.Weapon; +import org.springframework.data.repository.CrudRepository; + +public interface WeaponRepository extends CrudRepository { } From 591e424796323cf594b0e92ab515c4c25dd07684 Mon Sep 17 00:00:00 2001 From: Alisson Oliveira Date: Tue, 17 Apr 2018 23:04:53 -0300 Subject: [PATCH 013/236] =?UTF-8?q?Remove=20refer=C3=AAncias=20diretas=20a?= =?UTF-8?q?=20tabela=20armorsets.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../gameserver/datatables/ArmorSetsTable.java | 115 +++++++----------- .../gameserver/model/database/ArmorSet.java | 50 +++++++- .../repository/ArmorSetRepository.java | 7 ++ 3 files changed, 96 insertions(+), 76 deletions(-) create mode 100644 Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/repository/ArmorSetRepository.java diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/datatables/ArmorSetsTable.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/datatables/ArmorSetsTable.java index 4d0de2c4..af627240 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/datatables/ArmorSetsTable.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/datatables/ArmorSetsTable.java @@ -23,85 +23,54 @@ package com.l2jbr.gameserver.datatables; -import com.l2jbr.commons.database.L2DatabaseFactory; +import com.l2jbr.commons.database.DatabaseAccess; import com.l2jbr.gameserver.model.L2ArmorSet; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; +import com.l2jbr.gameserver.model.database.repository.ArmorSetRepository; -import java.sql.Connection; -import java.sql.PreparedStatement; -import java.sql.ResultSet; import java.util.LinkedHashMap; import java.util.Map; - /** * @author Luno */ -public class ArmorSetsTable -{ - private static Logger _log = LoggerFactory.getLogger(ArmorSetsTable.class.getName()); - private static ArmorSetsTable _instance; - - private final Map _armorSets; - - public static ArmorSetsTable getInstance() - { - if (_instance == null) - { - _instance = new ArmorSetsTable(); - } - return _instance; - } - - private ArmorSetsTable() - { - _armorSets = new LinkedHashMap<>(); - loadData(); - } - - private void loadData() - { - Connection con; - try - { - con = L2DatabaseFactory.getInstance().getConnection(); - PreparedStatement statement = con.prepareStatement("SELECT chest, legs, head, gloves, feet, skill_id, shield, shield_skill_id, enchant6skill FROM armorsets"); - ResultSet rset = statement.executeQuery(); - - while (rset.next()) - { - int chest = rset.getInt("chest"); - int legs = rset.getInt("legs"); - int head = rset.getInt("head"); - int gloves = rset.getInt("gloves"); - int feet = rset.getInt("feet"); - int skill_id = rset.getInt("skill_id"); - int shield = rset.getInt("shield"); - int shield_skill_id = rset.getInt("shield_skill_id"); - int enchant6skill = rset.getInt("enchant6skill"); - _armorSets.put(chest, new L2ArmorSet(chest, legs, head, gloves, feet, skill_id, shield, shield_skill_id, enchant6skill)); - } - - _log.info("ArmorSetsTable: Loaded " + _armorSets.size() + " armor sets."); - - rset.close(); - statement.close(); - con.close(); - } - catch (Exception e) - { - _log.error("ArmorSetsTable: Error reading ArmorSets table: " + e); - } - } - - public boolean setExists(int chestId) - { - return _armorSets.containsKey(chestId); - } - - public L2ArmorSet getSet(int chestId) - { - return _armorSets.get(chestId); - } +public class ArmorSetsTable { + private static ArmorSetsTable _instance; + private final Map _armorSets; + + public static ArmorSetsTable getInstance() { + if (_instance == null) { + _instance = new ArmorSetsTable(); + } + return _instance; + } + + private ArmorSetsTable() { + _armorSets = new LinkedHashMap<>(); + loadData(); + } + + private void loadData() { + ArmorSetRepository repository = DatabaseAccess.getRepository(ArmorSetRepository.class); + repository.findAll().forEach(armorSet -> { + int chest = armorSet.getChest(); + int legs = armorSet.getLegs(); + int head = armorSet.getHead(); + int gloves = armorSet.getGloves(); + int feet = armorSet.getFeet(); + int skill_id = armorSet.getSkillId(); + int shield = armorSet.getShield(); + int shield_skill_id = armorSet.getShieldSkillId(); + int enchant6skill = armorSet.getEnchant6Skill(); + _armorSets.put(chest, new L2ArmorSet(chest, legs, head, gloves, feet, skill_id, shield, shield_skill_id, enchant6skill)); + + }); + } + + public boolean setExists(int chestId) { + return _armorSets.containsKey(chestId); + } + + public L2ArmorSet getSet(int chestId) { + return _armorSets.get(chestId); + } } diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/ArmorSet.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/ArmorSet.java index b98457ac..21914fb8 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/ArmorSet.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/ArmorSet.java @@ -1,15 +1,59 @@ package com.l2jbr.gameserver.model.database; +import com.l2jbr.commons.database.annotation.Column; +import com.l2jbr.commons.database.annotation.Table; +import org.springframework.data.annotation.Id; + +@Table("armorsets") public class ArmorSet { - private int id; + @Id + private Integer id; private int chest; private int legs; private int head; private int gloves; private int feet; - private int skill_id; + @Column("skill_id") + private int skillId; private int shield; - private int shield_skill_id; + @Column("shield_skill_id") + private int shieldSkillId; private int enchant6skill; + + public int getChest() { + return chest; + } + + public int getLegs() { + return legs; + } + + public int getHead() { + return head; + } + + public int getGloves() { + return gloves; + } + + public int getFeet() { + return feet; + } + + public int getSkillId() { + return skillId; + } + + public int getShield() { + return shield; + } + + public int getShieldSkillId() { + return shieldSkillId; + } + + public int getEnchant6Skill() { + return enchant6skill; + } } diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/repository/ArmorSetRepository.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/repository/ArmorSetRepository.java new file mode 100644 index 00000000..2133716e --- /dev/null +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/repository/ArmorSetRepository.java @@ -0,0 +1,7 @@ +package com.l2jbr.gameserver.model.database.repository; + +import com.l2jbr.gameserver.model.database.ArmorSet; +import org.springframework.data.repository.CrudRepository; + +public interface ArmorSetRepository extends CrudRepository { +} From a650a11089c9780e79107e704c0e6921bda4afcb Mon Sep 17 00:00:00 2001 From: Alisson Oliveira Date: Wed, 18 Apr 2018 17:04:20 -0300 Subject: [PATCH 014/236] =?UTF-8?q?incorpora=20as=20tabelas=20lvlupgain=20?= =?UTF-8?q?e=20class=5Flist=20=C3=A0=20char=5Ftemplate.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Commons/src/test/java/App.java | 14 + Commons/src/test/java/ConfigContext.java | 69 ++++ .../sql/experimental/l2j_full_structure.sql | 56 +-- .../datatables/CharTemplateTable.java | 363 +++++++++--------- .../gameserver/datatables/HennaTreeTable.java | 71 +--- .../gameserver/datatables/LevelUpData.java | 72 +--- .../gameserver/datatables/SkillTreeTable.java | 78 ++-- .../model/database/CharTemplate.java | 262 +++++++++++++ .../model/database/CharTemplates.java | 44 --- .../model/database/LevelUpGain.java | 17 - .../gameserver/model/database/classList.java | 9 - .../repository/CharTemplateRepository.java | 7 + 12 files changed, 600 insertions(+), 462 deletions(-) create mode 100644 Commons/src/test/java/App.java create mode 100644 Commons/src/test/java/ConfigContext.java create mode 100644 Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/CharTemplate.java delete mode 100644 Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/CharTemplates.java delete mode 100644 Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/LevelUpGain.java delete mode 100644 Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/classList.java create mode 100644 Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/repository/CharTemplateRepository.java diff --git a/Commons/src/test/java/App.java b/Commons/src/test/java/App.java new file mode 100644 index 00000000..d7caf231 --- /dev/null +++ b/Commons/src/test/java/App.java @@ -0,0 +1,14 @@ +import com.l2jbr.commons.database.AccountRepository; +import com.l2jbr.commons.database.model.Account; +import org.springframework.context.annotation.AnnotationConfigApplicationContext; + +public class App { + + public static void main(String[] args) { + AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext(ConfigContext.class); + AccountRepository rep = context.getBean(AccountRepository.class); + Iterable result = rep.findAll(); + System.out.println(result); + + } +} diff --git a/Commons/src/test/java/ConfigContext.java b/Commons/src/test/java/ConfigContext.java new file mode 100644 index 00000000..67358151 --- /dev/null +++ b/Commons/src/test/java/ConfigContext.java @@ -0,0 +1,69 @@ +import com.l2jbr.commons.database.AnnotationNamingStrategy; +import com.l2jbr.commons.database.model.Entity; +import com.zaxxer.hikari.HikariConfig; +import com.zaxxer.hikari.HikariDataSource; +import org.springframework.context.ApplicationListener; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.data.jdbc.mapping.event.AfterLoadEvent; +import org.springframework.data.jdbc.mapping.event.BeforeSaveEvent; +import org.springframework.data.jdbc.mapping.event.WithEntity; +import org.springframework.data.jdbc.mapping.model.NamingStrategy; +import org.springframework.data.jdbc.repository.config.EnableJdbcRepositories; +import org.springframework.jdbc.core.namedparam.NamedParameterJdbcOperations; +import org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate; + +import javax.sql.DataSource; +import java.util.Optional; + +@Configuration +@EnableJdbcRepositories +public class ConfigContext { + + @Bean + public DataSource dataSource() { + HikariConfig dataSourceConfig = new HikariConfig(); + dataSourceConfig.setDriverClassName("com.mysql.cj.jdbc.Driver"); + dataSourceConfig.setJdbcUrl("jdbc:mysql://localhost/l2jdb"); + dataSourceConfig.setUsername("root"); + dataSourceConfig.setPassword("root"); + return new HikariDataSource(dataSourceConfig); + } + + @Bean + public NamedParameterJdbcOperations template(DataSource dataSource) { + return new NamedParameterJdbcTemplate(dataSource); + } + + @Bean + public NamingStrategy namingStrategy() { + return new AnnotationNamingStrategy(); + } + + @Bean + public ApplicationListener beforeSaveEventApplicationListener() { + return event -> { + extractModel(event).ifPresent(Entity::onSave); + }; + } + + private Optional extractModel(WithEntity event) { + Object entity = event.getEntity(); + if (entity instanceof Entity) { + return Optional.of((Entity) entity); + } + return Optional.empty(); + } + + @Bean + public ApplicationListener afterLoadEventApplicationListener() { + return event -> { + extractModel(event).ifPresent(Entity::onLoad); + }; + } + + @Bean + public App app() { + return new App(); + } +} diff --git a/Datapack/sql/experimental/l2j_full_structure.sql b/Datapack/sql/experimental/l2j_full_structure.sql index 662f2f15..26bab218 100644 --- a/Datapack/sql/experimental/l2j_full_structure.sql +++ b/Datapack/sql/experimental/l2j_full_structure.sql @@ -184,7 +184,9 @@ DROP TABLE IF EXISTS `char_templates` ; CREATE TABLE IF NOT EXISTS `char_templates` ( `ClassId` INT(11) NOT NULL DEFAULT '0', `ClassName` VARCHAR(20) NOT NULL DEFAULT '', + `class_lvl` INT(3) NOT NULL DEFAULT '0', `RaceId` INT(1) NOT NULL DEFAULT '0', + `parent_id` INT(11) NOT NULL DEFAULT '0', `STR` INT(2) NOT NULL DEFAULT '0', `CON` INT(2) NOT NULL DEFAULT '0', `DEX` INT(2) NOT NULL DEFAULT '0', @@ -202,6 +204,15 @@ CREATE TABLE IF NOT EXISTS `char_templates` ( `EVASION` INT(3) NOT NULL DEFAULT '0', `MOVE_SPD` INT(3) NOT NULL DEFAULT '0', `_LOAD` INT(11) NOT NULL DEFAULT '0', + `defaulthpbase` DECIMAL(5,1) NOT NULL DEFAULT '0.0', + `defaulthpadd` DECIMAL(4,2) NOT NULL DEFAULT '0.00', + `defaulthpmod` DECIMAL(4,2) NOT NULL DEFAULT '0.00', + `defaultcpbase` DECIMAL(5,1) NOT NULL DEFAULT '0.0', + `defaultcpadd` DECIMAL(4,2) NOT NULL DEFAULT '0.00', + `defaultcpmod` DECIMAL(4,2) NOT NULL DEFAULT '0.00', + `defaultmpbase` DECIMAL(5,1) NOT NULL DEFAULT '0.0', + `defaultmpadd` DECIMAL(4,2) NOT NULL DEFAULT '0.00', + `defaultmpmod` DECIMAL(4,2) NOT NULL DEFAULT '0.00', `x` INT(9) NOT NULL DEFAULT '0', `y` INT(9) NOT NULL DEFAULT '0', `z` INT(9) NOT NULL DEFAULT '0', @@ -220,6 +231,9 @@ CREATE TABLE IF NOT EXISTS `char_templates` ( `items4` INT(4) NOT NULL DEFAULT '0', `items5` INT(10) NOT NULL DEFAULT '0', PRIMARY KEY (`ClassId`)) + CONSTRAINT `fk_char_template_parent_id` + FOREIGN KEY (`parent_id`) + REFERENCES `char_template` (`ClassId`) ENGINE = InnoDB DEFAULT CHARACTER SET = latin1; @@ -1161,24 +1175,6 @@ ENGINE = InnoDB DEFAULT CHARACTER SET = latin1; --- ----------------------------------------------------- --- Table `class_list` --- ----------------------------------------------------- -DROP TABLE IF EXISTS `class_list` ; - -CREATE TABLE IF NOT EXISTS `class_list` ( - `class_name` VARCHAR(19) NOT NULL DEFAULT '', - `id` INT(10) UNSIGNED NOT NULL DEFAULT '0', - `parent_id` INT(11) NOT NULL DEFAULT '0', - PRIMARY KEY (`id`), - CONSTRAINT `fk_class_list_char_templates1` - FOREIGN KEY (`id`) - REFERENCES `char_templates` (`ClassId`) - ON DELETE NO ACTION - ON UPDATE NO ACTION) -ENGINE = InnoDB -DEFAULT CHARACTER SET = latin1; - -- ----------------------------------------------------- -- Table `cursed_weapons` @@ -1523,31 +1519,7 @@ ENGINE = InnoDB DEFAULT CHARACTER SET = latin1; --- ----------------------------------------------------- --- Table `lvlupgain` --- ----------------------------------------------------- -DROP TABLE IF EXISTS `lvlupgain` ; -CREATE TABLE IF NOT EXISTS `lvlupgain` ( - `classid` INT(3) NOT NULL DEFAULT '0', - `defaulthpbase` DECIMAL(5,1) NOT NULL DEFAULT '0.0', - `defaulthpadd` DECIMAL(4,2) NOT NULL DEFAULT '0.00', - `defaulthpmod` DECIMAL(4,2) NOT NULL DEFAULT '0.00', - `defaultcpbase` DECIMAL(5,1) NOT NULL DEFAULT '0.0', - `defaultcpadd` DECIMAL(4,2) NOT NULL DEFAULT '0.00', - `defaultcpmod` DECIMAL(4,2) NOT NULL DEFAULT '0.00', - `defaultmpbase` DECIMAL(5,1) NOT NULL DEFAULT '0.0', - `defaultmpadd` DECIMAL(4,2) NOT NULL DEFAULT '0.00', - `defaultmpmod` DECIMAL(4,2) NOT NULL DEFAULT '0.00', - `class_lvl` INT(3) NOT NULL DEFAULT '0', - PRIMARY KEY (`classid`), - CONSTRAINT `fk_lvlupgain_char_templates1` - FOREIGN KEY (`classid`) - REFERENCES `char_templates` (`ClassId`) - ON DELETE NO ACTION - ON UPDATE NO ACTION) -ENGINE = InnoDB -DEFAULT CHARACTER SET = latin1; -- ----------------------------------------------------- diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/datatables/CharTemplateTable.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/datatables/CharTemplateTable.java index 18d17ebf..08672a27 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/datatables/CharTemplateTable.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/datatables/CharTemplateTable.java @@ -18,16 +18,14 @@ */ package com.l2jbr.gameserver.datatables; -import com.l2jbr.commons.database.L2DatabaseFactory; +import com.l2jbr.commons.database.DatabaseAccess; import com.l2jbr.gameserver.model.base.ClassId; +import com.l2jbr.gameserver.model.database.repository.CharTemplateRepository; import com.l2jbr.gameserver.templates.L2PcTemplate; import com.l2jbr.gameserver.templates.StatsSet; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import java.sql.PreparedStatement; -import java.sql.ResultSet; -import java.sql.SQLException; import java.util.LinkedHashMap; import java.util.Map; @@ -42,128 +40,127 @@ public class CharTemplateTable { private static CharTemplateTable _instance; - private static final String[] CHAR_CLASSES = - { - "Human Fighter", - "Warrior", - "Gladiator", - "Warlord", - "Human Knight", - "Paladin", - "Dark Avenger", - "Rogue", - "Treasure Hunter", - "Hawkeye", - "Human Mystic", - "Human Wizard", - "Sorceror", - "Necromancer", - "Warlock", - "Cleric", - "Bishop", - "Prophet", - "Elven Fighter", - "Elven Knight", - "Temple Knight", - "Swordsinger", - "Elven Scout", - "Plainswalker", - "Silver Ranger", - "Elven Mystic", - "Elven Wizard", - "Spellsinger", - "Elemental Summoner", - "Elven Oracle", - "Elven Elder", - "Dark Fighter", - "Palus Knight", - "Shillien Knight", - "Bladedancer", - "Assassin", - "Abyss Walker", - "Phantom Ranger", - "Dark Elven Mystic", - "Dark Elven Wizard", - "Spellhowler", - "Phantom Summoner", - "Shillien Oracle", - "Shillien Elder", - "Orc Fighter", - "Orc Raider", - "Destroyer", - "Orc Monk", - "Tyrant", - "Orc Mystic", - "Orc Shaman", - "Overlord", - "Warcryer", - "Dwarven Fighter", - "Dwarven Scavenger", - "Bounty Hunter", - "Dwarven Artisan", - "Warsmith", - "dummyEntry1", - "dummyEntry2", - "dummyEntry3", - "dummyEntry4", - "dummyEntry5", - "dummyEntry6", - "dummyEntry7", - "dummyEntry8", - "dummyEntry9", - "dummyEntry10", - "dummyEntry11", - "dummyEntry12", - "dummyEntry13", - "dummyEntry14", - "dummyEntry15", - "dummyEntry16", - "dummyEntry17", - "dummyEntry18", - "dummyEntry19", - "dummyEntry20", - "dummyEntry21", - "dummyEntry22", - "dummyEntry23", - "dummyEntry24", - "dummyEntry25", - "dummyEntry26", - "dummyEntry27", - "dummyEntry28", - "dummyEntry29", - "dummyEntry30", - "Duelist", - "DreadNought", - "Phoenix Knight", - "Hell Knight", - "Sagittarius", - "Adventurer", - "Archmage", - "Soultaker", - "Arcana Lord", - "Cardinal", - "Hierophant", - "Eva Templar", - "Sword Muse", - "Wind Rider", - "Moonlight Sentinel", - "Mystic Muse", - "Elemental Master", - "Eva's Saint", - "Shillien Templar", - "Spectral Dancer", - "Ghost Hunter", - "Ghost Sentinel", - "Storm Screamer", - "Spectral Master", - "Shillien Saint", - "Titan", - "Grand Khauatari", - "Dominator", - "Doomcryer", - "Fortune Seeker", - "Maestro" - }; + private static final String[] CHAR_CLASSES = { + "Human Fighter", + "Warrior", + "Gladiator", + "Warlord", + "Human Knight", + "Paladin", + "Dark Avenger", + "Rogue", + "Treasure Hunter", + "Hawkeye", + "Human Mystic", + "Human Wizard", + "Sorceror", + "Necromancer", + "Warlock", + "Cleric", + "Bishop", + "Prophet", + "Elven Fighter", + "Elven Knight", + "Temple Knight", + "Swordsinger", + "Elven Scout", + "Plainswalker", + "Silver Ranger", + "Elven Mystic", + "Elven Wizard", + "Spellsinger", + "Elemental Summoner", + "Elven Oracle", + "Elven Elder", + "Dark Fighter", + "Palus Knight", + "Shillien Knight", + "Bladedancer", + "Assassin", + "Abyss Walker", + "Phantom Ranger", + "Dark Elven Mystic", + "Dark Elven Wizard", + "Spellhowler", + "Phantom Summoner", + "Shillien Oracle", + "Shillien Elder", + "Orc Fighter", + "Orc Raider", + "Destroyer", + "Orc Monk", + "Tyrant", + "Orc Mystic", + "Orc Shaman", + "Overlord", + "Warcryer", + "Dwarven Fighter", + "Dwarven Scavenger", + "Bounty Hunter", + "Dwarven Artisan", + "Warsmith", + "dummyEntry1", + "dummyEntry2", + "dummyEntry3", + "dummyEntry4", + "dummyEntry5", + "dummyEntry6", + "dummyEntry7", + "dummyEntry8", + "dummyEntry9", + "dummyEntry10", + "dummyEntry11", + "dummyEntry12", + "dummyEntry13", + "dummyEntry14", + "dummyEntry15", + "dummyEntry16", + "dummyEntry17", + "dummyEntry18", + "dummyEntry19", + "dummyEntry20", + "dummyEntry21", + "dummyEntry22", + "dummyEntry23", + "dummyEntry24", + "dummyEntry25", + "dummyEntry26", + "dummyEntry27", + "dummyEntry28", + "dummyEntry29", + "dummyEntry30", + "Duelist", + "DreadNought", + "Phoenix Knight", + "Hell Knight", + "Sagittarius", + "Adventurer", + "Archmage", + "Soultaker", + "Arcana Lord", + "Cardinal", + "Hierophant", + "Eva Templar", + "Sword Muse", + "Wind Rider", + "Moonlight Sentinel", + "Mystic Muse", + "Elemental Master", + "Eva's Saint", + "Shillien Templar", + "Spectral Dancer", + "Ghost Hunter", + "Ghost Sentinel", + "Storm Screamer", + "Spectral Master", + "Shillien Saint", + "Titan", + "Grand Khauatari", + "Dominator", + "Doomcryer", + "Fortune Seeker", + "Maestro" + }; private final Map _templates; @@ -178,76 +175,60 @@ private CharTemplateTable() { _templates = new LinkedHashMap<>(); java.sql.Connection con = null; - try { - con = L2DatabaseFactory.getInstance().getConnection(); - PreparedStatement statement = con.prepareStatement("SELECT * FROM class_list, char_templates, lvlupgain" + " WHERE class_list.id = char_templates.classId" + " AND class_list.id = lvlupgain.classId" + " ORDER BY class_list.id"); - ResultSet rset = statement.executeQuery(); + CharTemplateRepository repository = DatabaseAccess.getRepository(CharTemplateRepository.class); + repository.findAll().forEach(charTemplate -> { + StatsSet set = new StatsSet(); + set.set("classId", charTemplate.getId()); + set.set("className", charTemplate.getClassName()); + set.set("raceId", charTemplate.getRaceId()); + set.set("baseSTR", charTemplate.getSTR()); + set.set("baseCON", charTemplate.getCON()); + set.set("baseDEX", charTemplate.getDEX()); + set.set("baseINT", charTemplate.getINT()); + set.set("baseWIT", charTemplate.getWIT()); + set.set("baseMEN", charTemplate.getMEN()); + set.set("baseHpMax", charTemplate.getDefaultHpBase()); + set.set("lvlHpAdd", charTemplate.getDefaultHpAdd()); + set.set("lvlHpMod", charTemplate.getDefaultHpMod()); + set.set("baseMpMax", charTemplate.getDefaultMpBase()); + set.set("baseCpMax", charTemplate.getDefaultCpBase()); + set.set("lvlCpAdd", charTemplate.getDefaultCpAdd()); + set.set("lvlCpMod", charTemplate.getDefaultCpMod()); + set.set("lvlMpAdd", charTemplate.getDefaultMpAdd()); + set.set("lvlMpMod", charTemplate.getDefaultMpMod()); + set.set("baseHpReg", 1.5); + set.set("baseMpReg", 0.9); + set.set("basePAtk", charTemplate.getpAtk()); + set.set("basePDef", charTemplate.getpDef()); + set.set("baseMAtk", charTemplate.getmAtk()); + set.set("baseMDef", charTemplate.getmDef()); + set.set("classBaseLevel", charTemplate.getClassLevel()); + set.set("basePAtkSpd", charTemplate.getpSpd()); + set.set("baseMAtkSpd", charTemplate.getmSpd()); + set.set("baseCritRate", charTemplate.getCritical() / 10); + set.set("baseRunSpd", charTemplate.getMoveSpeed()); + set.set("baseWalkSpd", 0); + set.set("baseShldDef", 0); + set.set("baseShldRate", 0); + set.set("baseAtkRange", 40); - while (rset.next()) { - StatsSet set = new StatsSet(); - // ClassId classId = ClassId.values()[rset.getInt("id")]; - set.set("classId", rset.getInt("id")); - set.set("className", rset.getString("className")); - set.set("raceId", rset.getInt("raceId")); - set.set("baseSTR", rset.getInt("STR")); - set.set("baseCON", rset.getInt("CON")); - set.set("baseDEX", rset.getInt("DEX")); - set.set("baseINT", rset.getInt("_INT")); - set.set("baseWIT", rset.getInt("WIT")); - set.set("baseMEN", rset.getInt("MEN")); - set.set("baseHpMax", rset.getFloat("defaultHpBase")); - set.set("lvlHpAdd", rset.getFloat("defaultHpAdd")); - set.set("lvlHpMod", rset.getFloat("defaultHpMod")); - set.set("baseMpMax", rset.getFloat("defaultMpBase")); - set.set("baseCpMax", rset.getFloat("defaultCpBase")); - set.set("lvlCpAdd", rset.getFloat("defaultCpAdd")); - set.set("lvlCpMod", rset.getFloat("defaultCpMod")); - set.set("lvlMpAdd", rset.getFloat("defaultMpAdd")); - set.set("lvlMpMod", rset.getFloat("defaultMpMod")); - set.set("baseHpReg", 1.5); - set.set("baseMpReg", 0.9); - set.set("basePAtk", rset.getInt("p_atk")); - set.set("basePDef", /* classId.isMage()? 77 : 129 */rset.getInt("p_def")); - set.set("baseMAtk", rset.getInt("m_atk")); - set.set("baseMDef", rset.getInt("char_templates.m_def")); - set.set("classBaseLevel", rset.getInt("class_lvl")); - set.set("basePAtkSpd", rset.getInt("p_spd")); - set.set("baseMAtkSpd", /* classId.isMage()? 166 : 333 */rset.getInt("char_templates.m_spd")); - set.set("baseCritRate", rset.getInt("char_templates.critical") / 10); - set.set("baseRunSpd", rset.getInt("move_spd")); - set.set("baseWalkSpd", 0); - set.set("baseShldDef", 0); - set.set("baseShldRate", 0); - set.set("baseAtkRange", 40); + set.set("spawnX", charTemplate.getX()); + set.set("spawnY", charTemplate.getY()); + set.set("spawnZ", charTemplate.getZ()); - set.set("spawnX", rset.getInt("x")); - set.set("spawnY", rset.getInt("y")); - set.set("spawnZ", rset.getInt("z")); - L2PcTemplate ct; + set.set("collision_radius", charTemplate.getM_COL_R()); + set.set("collision_height", charTemplate.getM_COL_H()); - set.set("collision_radius", rset.getDouble("m_col_r")); - set.set("collision_height", rset.getDouble("m_col_h")); - ct = new L2PcTemplate(set); - // 5items must go here - for (int x = 1; x < 6; x++) { - if (rset.getInt("items" + x) != 0) { - ct.addItem(rset.getInt("items" + x)); - } - } - _templates.put(ct.classId.getId(), ct); - } + L2PcTemplate ct = new L2PcTemplate(set); - rset.close(); - statement.close(); - } catch (SQLException e) { - _log.warn("error while loading char templates " + e.getMessage()); - } finally { - try { - con.close(); - } catch (Exception e) { - } - } + ct.addItem(charTemplate.getItems1()); + ct.addItem(charTemplate.getItems2()); + ct.addItem(charTemplate.getItems3()); + ct.addItem(charTemplate.getItems4()); + ct.addItem(charTemplate.getItems5()); + _templates.put(ct.classId.getId(), ct); + }); _log.info("CharTemplateTable: Loaded " + _templates.size() + " Character Templates."); } diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/datatables/HennaTreeTable.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/datatables/HennaTreeTable.java index 87050e37..be147889 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/datatables/HennaTreeTable.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/datatables/HennaTreeTable.java @@ -25,6 +25,7 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import java.sql.Connection; import java.sql.PreparedStatement; import java.sql.ResultSet; import java.util.LinkedHashMap; @@ -50,66 +51,26 @@ public static HennaTreeTable getInstance() { private HennaTreeTable() { _hennaTrees = new LinkedHashMap<>(); - int classId = 0; + int count = 0; - java.sql.Connection con = null; - try { - con = L2DatabaseFactory.getInstance().getConnection(); - PreparedStatement statement = con.prepareStatement("SELECT class_name, id, parent_id FROM class_list ORDER BY id"); - ResultSet classlist = statement.executeQuery(); + try(Connection con = L2DatabaseFactory.getInstance().getConnection(); + PreparedStatement statement2 = con.prepareStatement("SELECT class_id, symbol_id FROM henna_trees ORDER BY symbol_id"); + ResultSet hennatree = statement2.executeQuery()){ List list; - // int parentClassId; - // L2Henna henna; - while (classlist.next()) { - list = new LinkedList<>(); - classId = classlist.getInt("id"); - PreparedStatement statement2 = con.prepareStatement("SELECT class_id, symbol_id FROM henna_trees where class_id=? ORDER BY symbol_id"); - statement2.setInt(1, classId); - ResultSet hennatree = statement2.executeQuery(); - - while (hennatree.next()) { - int id = hennatree.getInt("symbol_id"); - // String name = hennatree.getString("name"); - L2Henna template = HennaTable.getInstance().getTemplate(id); - if (template == null) { - hennatree.close(); - statement2.close(); - classlist.close(); - statement.close(); - return; - } - L2HennaInstance temp = new L2HennaInstance(template); - temp.setSymbolId(id); - temp.setItemIdDye(template.getDyeId()); - temp.setAmountDyeRequire(template.getAmountDyeRequire()); - temp.setPrice(template.getPrice()); - temp.setStatINT(template.getStatINT()); - temp.setStatSTR(template.getStatSTR()); - temp.setStatCON(template.getStatCON()); - temp.setStatMEM(template.getStatMEM()); - temp.setStatDEX(template.getStatDEX()); - temp.setStatWIT(template.getStatWIT()); + while (hennatree.next()) { + int id = hennatree.getInt("symbol_id"); + int classId = hennatree.getInt("class_id"); - list.add(temp); + L2Henna template = HennaTable.getInstance().getTemplate(id); + if (template == null) { + continue; } - _hennaTrees.put(ClassId.values()[classId], list); - hennatree.close(); - statement2.close(); - count += list.size(); - _log.debug("Henna Tree for Class: " + classId + " has " + list.size() + " Henna Templates."); - } - - classlist.close(); - statement.close(); - - } catch (Exception e) { - _log.warn("error while creating henna tree for classId " + classId + " " + e); - e.printStackTrace(); - } finally { - try { - con.close(); - } catch (Exception e) { + list = _hennaTrees.getOrDefault(ClassId.values()[classId], new LinkedList<>()); + list.add(new L2HennaInstance(template)); + count++; } + }catch (Exception e){ + _log.error("error while creating henna tree", e); } _log.info("HennaTreeTable: Loaded " + count + " Henna Tree Templates."); diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/datatables/LevelUpData.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/datatables/LevelUpData.java index 420cd2d3..31d046b4 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/datatables/LevelUpData.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/datatables/LevelUpData.java @@ -18,14 +18,11 @@ */ package com.l2jbr.gameserver.datatables; -import com.l2jbr.commons.database.L2DatabaseFactory; +import com.l2jbr.commons.database.DatabaseAccess; import com.l2jbr.gameserver.model.L2LvlupData; import com.l2jbr.gameserver.model.base.ClassId; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; +import com.l2jbr.gameserver.model.database.repository.CharTemplateRepository; -import java.sql.PreparedStatement; -import java.sql.ResultSet; import java.util.LinkedHashMap; import java.util.Map; @@ -37,20 +34,6 @@ * @version $Revision: 1.3.2.4.2.3 $ $Date: 2005/03/27 15:29:18 $ */ public class LevelUpData { - private static final String SELECT_ALL = "SELECT classid, defaulthpbase, defaulthpadd, defaulthpmod, defaultcpbase, defaultcpadd, defaultcpmod, defaultmpbase, defaultmpadd, defaultmpmod, class_lvl FROM lvlupgain"; - private static final String CLASS_LVL = "class_lvl"; - private static final String MP_MOD = "defaultmpmod"; - private static final String MP_ADD = "defaultmpadd"; - private static final String MP_BASE = "defaultmpbase"; - private static final String HP_MOD = "defaulthpmod"; - private static final String HP_ADD = "defaulthpadd"; - private static final String HP_BASE = "defaulthpbase"; - private static final String CP_MOD = "defaultcpmod"; - private static final String CP_ADD = "defaultcpadd"; - private static final String CP_BASE = "defaultcpbase"; - private static final String CLASS_ID = "classid"; - - private static Logger _log = LoggerFactory.getLogger(LevelUpData.class.getName()); private static LevelUpData _instance; @@ -65,42 +48,23 @@ public static LevelUpData getInstance() { private LevelUpData() { _lvlTable = new LinkedHashMap<>(); - java.sql.Connection con = null; - try { - con = L2DatabaseFactory.getInstance().getConnection(); - PreparedStatement statement = con.prepareStatement(SELECT_ALL); - ResultSet rset = statement.executeQuery(); - L2LvlupData lvlDat; - - while (rset.next()) { - lvlDat = new L2LvlupData(); - lvlDat.setClassid(rset.getInt(CLASS_ID)); - lvlDat.setClassLvl(rset.getInt(CLASS_LVL)); - lvlDat.setClassHpBase(rset.getFloat(HP_BASE)); - lvlDat.setClassHpAdd(rset.getFloat(HP_ADD)); - lvlDat.setClassHpModifier(rset.getFloat(HP_MOD)); - lvlDat.setClassCpBase(rset.getFloat(CP_BASE)); - lvlDat.setClassCpAdd(rset.getFloat(CP_ADD)); - lvlDat.setClassCpModifier(rset.getFloat(CP_MOD)); - lvlDat.setClassMpBase(rset.getFloat(MP_BASE)); - lvlDat.setClassMpAdd(rset.getFloat(MP_ADD)); - lvlDat.setClassMpModifier(rset.getFloat(MP_MOD)); - - _lvlTable.put(lvlDat.getClassid(), lvlDat); - } + CharTemplateRepository repository = DatabaseAccess.getRepository(CharTemplateRepository.class); + repository.findAll().forEach(charTemplate -> { + L2LvlupData lvlDat = new L2LvlupData(); + lvlDat.setClassid(charTemplate.getId()); + lvlDat.setClassLvl(charTemplate.getClassLevel()); + lvlDat.setClassHpBase(charTemplate.getDefaultHpBase()); + lvlDat.setClassHpAdd(charTemplate.getDefaultHpAdd()); + lvlDat.setClassHpModifier(charTemplate.getDefaultHpMod()); + lvlDat.setClassCpBase(charTemplate.getDefaultCpBase()); + lvlDat.setClassCpAdd(charTemplate.getDefaultCpAdd()); + lvlDat.setClassCpModifier(charTemplate.getDefaultCpMod()); + lvlDat.setClassMpBase(charTemplate.getDefaultMpBase()); + lvlDat.setClassMpAdd(charTemplate.getDefaultMpAdd()); + lvlDat.setClassMpModifier(charTemplate.getDefaultMpMod()); - rset.close(); - statement.close(); - - _log.info("LevelUpData: Loaded " + _lvlTable.size() + " Character Level Up Templates."); - } catch (Exception e) { - _log.warn("error while creating Lvl up data table " + e); - } finally { - try { - con.close(); - } catch (Exception e) { - } - } + _lvlTable.put(lvlDat.getClassid(), lvlDat); + }); } /** diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/datatables/SkillTreeTable.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/datatables/SkillTreeTable.java index 86a079df..b710a5d6 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/datatables/SkillTreeTable.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/datatables/SkillTreeTable.java @@ -18,6 +18,7 @@ */ package com.l2jbr.gameserver.datatables; +import com.l2jbr.commons.database.DatabaseAccess; import com.l2jbr.commons.database.L2DatabaseFactory; import com.l2jbr.gameserver.model.L2EnchantSkillLearn; import com.l2jbr.gameserver.model.L2PledgeSkillLearn; @@ -25,9 +26,12 @@ import com.l2jbr.gameserver.model.L2SkillLearn; import com.l2jbr.gameserver.model.actor.instance.L2PcInstance; import com.l2jbr.gameserver.model.base.ClassId; +import com.l2jbr.gameserver.model.database.CharTemplate; +import com.l2jbr.gameserver.model.database.repository.CharTemplateRepository; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import java.sql.Connection; import java.sql.PreparedStatement; import java.sql.ResultSet; import java.util.*; @@ -111,25 +115,20 @@ public int getMinSkillLevel(int skillId, int skillLvl) { } private SkillTreeTable() { - int classId = 0; int count = 0; + CharTemplateRepository repository = DatabaseAccess.getRepository(CharTemplateRepository.class); + Map map; + int parentClassId; + int classId; + L2SkillLearn skillLearn; + for (CharTemplate charTemplate : repository.findAll()) { + map = new LinkedHashMap<>(); + parentClassId = charTemplate.getParentId(); + classId = charTemplate.getId(); + + try(Connection con = L2DatabaseFactory.getInstance().getConnection(); + PreparedStatement statement2 = con.prepareStatement("SELECT class_id, skill_id, level, name, sp, min_level FROM skill_trees where class_id=? ORDER BY skill_id, level")) { - java.sql.Connection con = null; - - try { - con = L2DatabaseFactory.getInstance().getConnection(); - PreparedStatement statement = con.prepareStatement("SELECT * FROM class_list ORDER BY id"); - ResultSet classlist = statement.executeQuery(); - - Map map; - int parentClassId; - L2SkillLearn skillLearn; - - while (classlist.next()) { - map = new LinkedHashMap<>(); - parentClassId = classlist.getInt("parent_id"); - classId = classlist.getInt("id"); - PreparedStatement statement2 = con.prepareStatement("SELECT class_id, skill_id, level, name, sp, min_level FROM skill_trees where class_id=? ORDER BY skill_id, level"); statement2.setInt(1, classId); ResultSet skilltree = statement2.executeQuery(); @@ -156,17 +155,12 @@ private SkillTreeTable() { } getSkillTrees().put(ClassId.values()[classId], map); - skilltree.close(); - statement2.close(); - count += map.size(); + _log.debug("SkillTreeTable: skill tree for class " + classId + " has " + map.size() + " skills"); + } catch (Exception e) { + _log.error("Error while creating skill tree (Class ID " + classId + "):" + e); } - - classlist.close(); - statement.close(); - } catch (Exception e) { - _log.error("Error while creating skill tree (Class ID " + classId + "):" + e); } _log.info("SkillTreeTable: Loaded " + count + " skills."); @@ -174,14 +168,12 @@ private SkillTreeTable() { // Skill tree for fishing skill (from Fisherman) int count2 = 0; int count3 = 0; - - try { + try(Connection con = L2DatabaseFactory.getInstance().getConnection(); + PreparedStatement statement = con.prepareStatement("SELECT skill_id, level, name, sp, min_level, costid, cost, isfordwarf FROM fishing_skill_trees ORDER BY skill_id, level"); + ResultSet skilltree2 = statement.executeQuery();) { _fishingSkillTrees = new LinkedList<>(); _expandDwarfCraftSkillTrees = new LinkedList<>(); - PreparedStatement statement = con.prepareStatement("SELECT skill_id, level, name, sp, min_level, costid, cost, isfordwarf FROM fishing_skill_trees ORDER BY skill_id, level"); - ResultSet skilltree2 = statement.executeQuery(); - int prevSkillId = -1; while (skilltree2.next()) { @@ -207,9 +199,6 @@ private SkillTreeTable() { } } - skilltree2.close(); - statement.close(); - count2 = _fishingSkillTrees.size(); count3 = _expandDwarfCraftSkillTrees.size(); } catch (Exception e) { @@ -217,11 +206,10 @@ private SkillTreeTable() { } int count4 = 0; - try { - _enchantSkillTrees = new LinkedList<>(); - + try(Connection con = L2DatabaseFactory.getInstance().getConnection(); PreparedStatement statement = con.prepareStatement("SELECT skill_id, level, name, base_lvl, sp, min_skill_lvl, exp, success_rate76, success_rate77, success_rate78 FROM enchant_skill_trees ORDER BY skill_id, level"); - ResultSet skilltree3 = statement.executeQuery(); + ResultSet skilltree3 = statement.executeQuery();) { + _enchantSkillTrees = new LinkedList<>(); int prevSkillId = -1; @@ -246,8 +234,6 @@ private SkillTreeTable() { _enchantSkillTrees.add(skill); } - skilltree3.close(); - statement.close(); count4 = _enchantSkillTrees.size(); } catch (Exception e) { @@ -255,11 +241,10 @@ private SkillTreeTable() { } int count5 = 0; - try { - _pledgeSkillTrees = new LinkedList<>(); - + try(Connection con = L2DatabaseFactory.getInstance().getConnection(); PreparedStatement statement = con.prepareStatement("SELECT skill_id, level, name, clan_lvl, repCost, itemId FROM pledge_skill_trees ORDER BY skill_id, level"); - ResultSet skilltree4 = statement.executeQuery(); + ResultSet skilltree4 = statement.executeQuery();) { + _pledgeSkillTrees = new LinkedList<>(); int prevSkillId = -1; @@ -280,17 +265,10 @@ private SkillTreeTable() { _pledgeSkillTrees.add(skill); } - skilltree4.close(); - statement.close(); count5 = _pledgeSkillTrees.size(); } catch (Exception e) { _log.error("Error while creating fishing skill table: " + e); - } finally { - try { - con.close(); - } catch (Exception e) { - } } _log.info("FishingSkillTreeTable: Loaded " + count2 + " general skills."); diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/CharTemplate.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/CharTemplate.java new file mode 100644 index 00000000..c22d0900 --- /dev/null +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/CharTemplate.java @@ -0,0 +1,262 @@ +package com.l2jbr.gameserver.model.database; + +import com.l2jbr.commons.database.annotation.Column; +import com.l2jbr.commons.database.annotation.Table; +import com.l2jbr.commons.database.model.Entity; +import org.springframework.data.annotation.Id; + +@Table("char_templates") +public class CharTemplate extends Entity { + + @Id + private Integer classId; + private String className; + @Column("class_lvl") + private Integer classLevel; + private Integer RaceId; + @Column("parent_id") + private Integer parentId; + private Integer STR; + private Integer CON; + private Integer DEX; + private Integer _INT; + private Integer WIT; + private Integer MEN; + @Column("p_atk") + private Integer pAtk; + @Column("p_def") + private Integer pDef; + @Column("m_atk") + private Integer mAtk; + @Column("M_DEF") + private Integer mDef; + @Column("P_SPD") + private Integer pSpd; + @Column("M_SPD") + private Integer mSpd; + private Integer acc; + private Integer critical; + private Integer evasion; + @Column("move_spd") + private Integer moveSpeed; + private Integer _load; + private Float defaultHpBase; + private Float defaultHpAdd; + private Float defaultHpMod; + private Float defaultCpBase; + private Float defaultCpAdd; + private Float defaultCpMod; + private Float defaultMpBase; + private Float defaultMpAdd; + private Float defaultMpMod; + private Integer x; + private Integer y; + private Integer z; + private Integer canCraft; + private Float M_UNK1; + private Float M_UNK2; + private Float M_COL_R; + private Float M_COL_H; + private Float F_UNK1; + private Float F_UNK2; + private Float F_COL_R; + private Float F_COL_H; + private Integer items1; + private Integer items2; + private Integer items3; + private Integer items4; + private Integer items5; + + @Override + public Integer getId() { + return classId; + } + + public String getClassName() { + return className; + } + + public int getRaceId() { + return RaceId; + } + + public int getSTR() { + return STR; + } + + public Integer getClassLevel() { + return classLevel; + } + + public Integer getParentId() { + return parentId; + } + + public Integer getCON() { + return CON; + } + + public Integer getDEX() { + return DEX; + } + + public Integer getINT() { + return _INT; + } + + public Integer getWIT() { + return WIT; + } + + public Integer getMEN() { + return MEN; + } + + public Integer getpAtk() { + return pAtk; + } + + public Integer getpDef() { + return pDef; + } + + public Integer getmAtk() { + return mAtk; + } + + public Integer getmDef() { + return mDef; + } + + public Integer getpSpd() { + return pSpd; + } + + public Integer getmSpd() { + return mSpd; + } + + public Integer getAcc() { + return acc; + } + + public Integer getCritical() { + return critical; + } + + public Integer getEvasion() { + return evasion; + } + + public Integer getMoveSpeed() { + return moveSpeed; + } + + public Integer get_load() { + return _load; + } + + public float getDefaultHpBase() { + return defaultHpBase; + } + + public float getDefaultHpAdd() { + return defaultHpAdd; + } + + public float getDefaultHpMod() { + return defaultHpMod; + } + + public float getDefaultCpBase() { + return defaultCpBase; + } + + public float getDefaultCpAdd() { + return defaultCpAdd; + } + + public float getDefaultCpMod() { + return defaultCpMod; + } + + public float getDefaultMpBase() { + return defaultMpBase; + } + + public float getDefaultMpAdd() { + return defaultMpAdd; + } + + public float getDefaultMpMod() { + return defaultMpMod; + } + + public Integer getX() { + return x; + } + + public Integer getY() { + return y; + } + + public Integer getZ() { + return z; + } + + public Integer getCanCraft() { + return canCraft; + } + + public float getM_UNK1() { + return M_UNK1; + } + + public float getM_UNK2() { + return M_UNK2; + } + + public float getM_COL_R() { + return M_COL_R; + } + + public float getM_COL_H() { + return M_COL_H; + } + + public float getF_UNK1() { + return F_UNK1; + } + + public float getF_UNK2() { + return F_UNK2; + } + + public float getF_COL_R() { + return F_COL_R; + } + + public float getF_COL_H() { + return F_COL_H; + } + + public Integer getItems1() { + return items1; + } + + public Integer getItems2() { + return items2; + } + + public Integer getItems3() { + return items3; + } + + public Integer getItems4() { + return items4; + } + + public Integer getItems5() { + return items5; + } +} diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/CharTemplates.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/CharTemplates.java deleted file mode 100644 index e7e78d5a..00000000 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/CharTemplates.java +++ /dev/null @@ -1,44 +0,0 @@ -package com.l2jbr.gameserver.model.database; - - - -public class CharTemplates { - - private int classId; - private String className; - private int raceId; - private int STR; - private int CON; - private int DEX; - private int INT; - private int WIT; - private int MEN; - private int P_ATK; - private int P_DEF; - private int M_ATK; - private int M_DEF; - private int P_SPD; - private int M_SPD; - private int ACC; - private int CRITICAL; - private int EVASION; - private int MOVE_SPD; - private int _LOAD; - private int x; - private int y; - private int z; - private int canCraft; - private int M_UNK1; - private int M_UNK2; - private int M_COL_R; - private int M_COL_H; - private int F_UNK1; - private int F_UNK2; - private int F_COL_R; - private int F_COL_H; - private int items1; - private int items2; - private int items3; - private int items4; - private int items5; -} diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/LevelUpGain.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/LevelUpGain.java deleted file mode 100644 index d087567f..00000000 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/LevelUpGain.java +++ /dev/null @@ -1,17 +0,0 @@ -package com.l2jbr.gameserver.model.database; - - - -public class LevelUpGain { - private int classid; - private int defaulthpbase; - private int defaulthpadd; - private int defaulthpmod; - private int defaultcpbase; - private int defaultcpadd; - private int defaultcpmod; - private int defaultmpbase; - private int defaultmpadd; - private int defaultmpmod; - private int class_lvl; -} diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/classList.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/classList.java deleted file mode 100644 index 7166e7d4..00000000 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/classList.java +++ /dev/null @@ -1,9 +0,0 @@ -package com.l2jbr.gameserver.model.database; - - - -public class classList { - private String class_name; - private int id; - private int parent_id; -} diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/repository/CharTemplateRepository.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/repository/CharTemplateRepository.java new file mode 100644 index 00000000..93c68681 --- /dev/null +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/repository/CharTemplateRepository.java @@ -0,0 +1,7 @@ +package com.l2jbr.gameserver.model.database.repository; + +import com.l2jbr.gameserver.model.database.CharTemplate; +import org.springframework.data.repository.CrudRepository; + +public interface CharTemplateRepository extends CrudRepository { +} From 1e42a1c7187b4e4efb7580f5496b48a40081949a Mon Sep 17 00:00:00 2001 From: Alisson Oliveira Date: Wed, 18 Apr 2018 18:54:54 -0300 Subject: [PATCH 015/236] Adiciona CharacterRepository --- .../com/l2jbr/commons/database/AccountRepository.java | 1 + Datapack/sql/experimental/l2j_full_structure.sql | 3 +-- .../gameserver/clientpackets/RequestFriendDel.java | 2 +- .../l2jbr/gameserver/model/database/Characters.java | 11 +++++++++-- .../database/repository/CharacterRepository.java | 7 +++++++ 5 files changed, 19 insertions(+), 5 deletions(-) create mode 100644 Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/repository/CharacterRepository.java diff --git a/Commons/src/main/com.l2jbr.commons/com/l2jbr/commons/database/AccountRepository.java b/Commons/src/main/com.l2jbr.commons/com/l2jbr/commons/database/AccountRepository.java index a91ddf3b..1550fe2a 100644 --- a/Commons/src/main/com.l2jbr.commons/com/l2jbr/commons/database/AccountRepository.java +++ b/Commons/src/main/com.l2jbr.commons/com/l2jbr/commons/database/AccountRepository.java @@ -19,5 +19,6 @@ public interface AccountRepository extends CrudRepository { @Modifying @Query("UPDATE accounts SET lastServer=:server WHERE login=:login") int updateLastServer(@Param("login") String login, @Param("server") int server); + } diff --git a/Datapack/sql/experimental/l2j_full_structure.sql b/Datapack/sql/experimental/l2j_full_structure.sql index 26bab218..46b966a0 100644 --- a/Datapack/sql/experimental/l2j_full_structure.sql +++ b/Datapack/sql/experimental/l2j_full_structure.sql @@ -175,7 +175,6 @@ ENGINE = InnoDB AUTO_INCREMENT = 52 DEFAULT CHARACTER SET = latin1; - -- ----------------------------------------------------- -- Table `char_templates` -- ----------------------------------------------------- @@ -246,7 +245,7 @@ DROP TABLE IF EXISTS `characters` ; CREATE TABLE IF NOT EXISTS `characters` ( `account_name` VARCHAR(45) NULL DEFAULT NULL, `obj_Id` DECIMAL(11,0) NOT NULL DEFAULT '0', - `char_name` VARCHAR(35) NOT NULL, + `char_name` VARCHAR(35) NOT NULL, -- must be unique `level` DECIMAL(11,0) NULL DEFAULT NULL, `maxHp` DECIMAL(11,0) NULL DEFAULT NULL, `curHp` DECIMAL(18,0) NULL DEFAULT NULL, diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/clientpackets/RequestFriendDel.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/clientpackets/RequestFriendDel.java index dfa3578b..52f5f7ac 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/clientpackets/RequestFriendDel.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/clientpackets/RequestFriendDel.java @@ -84,7 +84,7 @@ protected void runImpl() } else { - statement = con.prepareStatement("SELECT friend_id FROM character_friends, characters WHERE char_id=? AND friend_id=obj_id AND char_name=?"); + statement = con.prepareStatement("SELECT friend_id FROM character_friends WHERE char_id=? AND friend_name=?"); statement.setInt(1, activeChar.getObjectId()); statement.setString(2, _name); rset = statement.executeQuery(); diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/Characters.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/Characters.java index ea5729b7..42457682 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/Characters.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/Characters.java @@ -1,10 +1,12 @@ package com.l2jbr.gameserver.model.database; +import com.l2jbr.commons.database.model.Entity; +import org.springframework.data.annotation.Id; - -public class Characters { +public class Characters extends Entity { private String account_name; + @Id private int obj_Id; private String char_name; private int level; @@ -81,4 +83,9 @@ public class Characters { private long clan_join_expiry_time; private long clan_create_expiry_time; private int death_penalty_level; + + @Override + public Integer getId() { + return obj_Id; + } } diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/repository/CharacterRepository.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/repository/CharacterRepository.java new file mode 100644 index 00000000..78f77b6b --- /dev/null +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/repository/CharacterRepository.java @@ -0,0 +1,7 @@ +package com.l2jbr.gameserver.model.database.repository; + +import com.l2jbr.gameserver.model.database.Characters; +import org.springframework.data.repository.CrudRepository; + +public interface CharacterRepository extends CrudRepository { +} From 894257b53263457c8775222ff16ee2ce86acdb19 Mon Sep 17 00:00:00 2001 From: Alisson Oliveira Date: Thu, 19 Apr 2018 18:58:38 -0300 Subject: [PATCH 016/236] =?UTF-8?q?Remove=20algumas=20refer=C3=AAncias=20d?= =?UTF-8?q?iretas=20=C3=A0=20tabela=20characters?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .travis.yml | 5 - .../commons/database/AccountRepository.java | 7 +- Commons/src/test/java/App.java | 4 + Datapack/sql/characters.sql | 2 +- .../sql/experimental/l2j_full_structure.sql | 2 +- Datapack/sql/updates/20060527-[2012].sql | 2 +- .../gameserver/datatables/CharNameTable.java | 90 +-- .../AdminChangeAccessLevel.java | 53 +- .../admincommandhandlers/AdminMenu.java | 67 +- .../admincommandhandlers/AdminRepairChar.java | 98 +-- .../gameserver/idfactory/BitSetIDFactory.java | 2 +- .../l2jbr/gameserver/idfactory/IdFactory.java | 11 +- .../com/l2jbr/gameserver/model/L2Clan.java | 20 +- .../model/actor/instance/L2PcInstance.java | 338 ++++---- .../gameserver/model/database/Character.java | 734 ++++++++++++++++++ .../gameserver/model/database/Characters.java | 91 --- .../repository/CharacterRepository.java | 42 +- .../gameserver/network/L2GameClient.java | 100 +-- .../serverpackets/CharSelectInfo.java | 86 +- .../com.l2jbr.gameserver/module-info.java | 2 + .../l2jbr/loginserver/LoginController.java | 2 +- .../accountmanager/SQLAccountManager.java | 205 +++-- 22 files changed, 1186 insertions(+), 777 deletions(-) create mode 100644 Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/Character.java delete mode 100644 Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/Characters.java diff --git a/.travis.yml b/.travis.yml index 5107062f..02e497ab 100644 --- a/.travis.yml +++ b/.travis.yml @@ -3,11 +3,6 @@ language: java jdk: - oraclejdk9 -addons: - apt: - packages: - - oracle-java9-installer - script: ./gradlew build --daemon before_cache: diff --git a/Commons/src/main/com.l2jbr.commons/com/l2jbr/commons/database/AccountRepository.java b/Commons/src/main/com.l2jbr.commons/com/l2jbr/commons/database/AccountRepository.java index 1550fe2a..003d9992 100644 --- a/Commons/src/main/com.l2jbr.commons/com/l2jbr/commons/database/AccountRepository.java +++ b/Commons/src/main/com.l2jbr.commons/com/l2jbr/commons/database/AccountRepository.java @@ -6,6 +6,8 @@ import org.springframework.data.repository.CrudRepository; import org.springframework.data.repository.query.Param; +import java.util.Optional; + public interface AccountRepository extends CrudRepository { @Modifying @@ -14,11 +16,14 @@ public interface AccountRepository extends CrudRepository { @Modifying @Query("UPDATE accounts SET access_level=:accessLevel WHERE login=:login") - int updateAcessLevel(@Param("login") String login, @Param("accessLevel") int acessLevel); + int updateAccessLevel(@Param("login") String login, @Param("accessLevel") int acessLevel); @Modifying @Query("UPDATE accounts SET lastServer=:server WHERE login=:login") int updateLastServer(@Param("login") String login, @Param("server") int server); + @Query("SELECT * FROM accounts WHERE login=:login") + Optional findByLogin(@Param("login") String login); + } diff --git a/Commons/src/test/java/App.java b/Commons/src/test/java/App.java index d7caf231..6b93a7be 100644 --- a/Commons/src/test/java/App.java +++ b/Commons/src/test/java/App.java @@ -2,6 +2,8 @@ import com.l2jbr.commons.database.model.Account; import org.springframework.context.annotation.AnnotationConfigApplicationContext; +import java.util.Optional; + public class App { public static void main(String[] args) { @@ -9,6 +11,8 @@ public static void main(String[] args) { AccountRepository rep = context.getBean(AccountRepository.class); Iterable result = rep.findAll(); System.out.println(result); + Optional op = rep.findByLogin("admin"); + System.out.println(op); } } diff --git a/Datapack/sql/characters.sql b/Datapack/sql/characters.sql index 80e90962..2e0fc39d 100644 --- a/Datapack/sql/characters.sql +++ b/Datapack/sql/characters.sql @@ -67,7 +67,7 @@ CREATE TABLE IF NOT EXISTS characters ( wantspeace decimal(1,0) DEFAULT 0, isin7sdungeon decimal(1,0) NOT NULL default 0, in_jail decimal(1,0) DEFAULT 0, - jail_timer decimal(20,0) DEFAULT 0, + jailTimer decimal(20,0) DEFAULT 0, power_grade decimal(11,0) DEFAULT NULL, nobless decimal(1,0) NOT NULL DEFAULT 0, subpledge int(1) NOT NULL DEFAULT 0, diff --git a/Datapack/sql/experimental/l2j_full_structure.sql b/Datapack/sql/experimental/l2j_full_structure.sql index 46b966a0..7e148ddf 100644 --- a/Datapack/sql/experimental/l2j_full_structure.sql +++ b/Datapack/sql/experimental/l2j_full_structure.sql @@ -308,7 +308,7 @@ CREATE TABLE IF NOT EXISTS `characters` ( `wantspeace` DECIMAL(1,0) NULL DEFAULT '0', `isin7sdungeon` DECIMAL(1,0) NOT NULL DEFAULT '0', `in_jail` DECIMAL(1,0) NULL DEFAULT '0', - `jail_timer` DECIMAL(20,0) NULL DEFAULT '0', + `jailTimer` DECIMAL(20,0) NULL DEFAULT '0', `power_grade` DECIMAL(11,0) NULL DEFAULT NULL, `nobless` DECIMAL(1,0) NOT NULL DEFAULT '0', `subpledge` INT(1) NOT NULL DEFAULT '0', diff --git a/Datapack/sql/updates/20060527-[2012].sql b/Datapack/sql/updates/20060527-[2012].sql index cda46b46..e72d06fb 100644 --- a/Datapack/sql/updates/20060527-[2012].sql +++ b/Datapack/sql/updates/20060527-[2012].sql @@ -2,7 +2,7 @@ -- Alter `characters` table -- ALTER TABLE `characters` ADD COLUMN in_jail decimal(1,0) DEFAULT 0; -ALTER TABLE `characters` ADD COLUMN jail_timer decimal(20,0) DEFAULT 0; +ALTER TABLE `characters` ADD COLUMN jailTimer decimal(20,0) DEFAULT 0; -- diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/datatables/CharNameTable.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/datatables/CharNameTable.java index 7474bedd..e0dd8341 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/datatables/CharNameTable.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/datatables/CharNameTable.java @@ -18,99 +18,31 @@ */ package com.l2jbr.gameserver.datatables; -import com.l2jbr.commons.database.L2DatabaseFactory; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import java.sql.PreparedStatement; -import java.sql.ResultSet; -import java.sql.SQLException; - +import com.l2jbr.commons.database.DatabaseAccess; +import com.l2jbr.gameserver.model.database.repository.CharacterRepository; /** * This class ... * @version $Revision: 1.3.2.2.2.1 $ $Date: 2005/03/27 15:29:18 $ */ -public class CharNameTable -{ - private static Logger _log = LoggerFactory.getLogger(CharNameTable.class.getName()); +public class CharNameTable { private static CharNameTable _instance; - public static CharNameTable getInstance() - { - if (_instance == null) - { + public static CharNameTable getInstance() { + if (_instance == null) { _instance = new CharNameTable(); } return _instance; } - public boolean doesCharNameExist(String name) - { - boolean result = true; - java.sql.Connection con = null; - - try - { - con = L2DatabaseFactory.getInstance().getConnection(); - PreparedStatement statement = con.prepareStatement("SELECT account_name FROM characters WHERE char_name=?"); - statement.setString(1, name); - ResultSet rset = statement.executeQuery(); - result = rset.next(); - rset.close(); - statement.close(); - } - catch (SQLException e) - { - _log.warn("could not check existing charname:" + e.getMessage()); - } - finally - { - try - { - con.close(); - } - catch (Exception e) - { - } - } - return result; + public boolean doesCharNameExist(String name) { + CharacterRepository repository = DatabaseAccess.getRepository(CharacterRepository.class); + return repository.existsByName(name); } - public int accountCharNumber(String account) - { - java.sql.Connection con = null; - int number = 0; - - try - { - con = L2DatabaseFactory.getInstance().getConnection(); - PreparedStatement statement = con.prepareStatement("SELECT COUNT(char_name) FROM characters WHERE account_name=?"); - statement.setString(1, account); - ResultSet rset = statement.executeQuery(); - while (rset.next()) - { - number = rset.getInt(1); - } - rset.close(); - statement.close(); - } - catch (SQLException e) - { - _log.warn("could not check existing char number:" + e.getMessage()); - } - finally - { - try - { - con.close(); - } - catch (Exception e) - { - } - } - - return number; + public int accountCharNumber(String account) { + CharacterRepository repository = DatabaseAccess.getRepository(CharacterRepository.class); + return repository.countByAccount(account); } } diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/handler/admincommandhandlers/AdminChangeAccessLevel.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/handler/admincommandhandlers/AdminChangeAccessLevel.java index 9aee668b..4d43e7d1 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/handler/admincommandhandlers/AdminChangeAccessLevel.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/handler/admincommandhandlers/AdminChangeAccessLevel.java @@ -19,18 +19,15 @@ package com.l2jbr.gameserver.handler.admincommandhandlers; import com.l2jbr.commons.Config; -import com.l2jbr.commons.database.L2DatabaseFactory; +import com.l2jbr.commons.database.DatabaseAccess; import com.l2jbr.gameserver.handler.IAdminCommandHandler; import com.l2jbr.gameserver.model.GMAudit; import com.l2jbr.gameserver.model.L2World; import com.l2jbr.gameserver.model.actor.instance.L2PcInstance; +import com.l2jbr.gameserver.model.database.repository.CharacterRepository; import com.l2jbr.gameserver.network.SystemMessageId; import com.l2jbr.gameserver.serverpackets.SystemMessage; -import java.sql.Connection; -import java.sql.PreparedStatement; -import java.sql.SQLException; - /** * This class handles following admin commands: - changelvl = change a character's access level Can be used for character ban (as opposed to regular //ban that affects accounts) or to grant mod/GM privileges ingame @@ -110,45 +107,13 @@ else if (parts.length == 3) { onLineChange(activeChar, player, lvl); } - else - { - Connection con = null; - try - { - con = L2DatabaseFactory.getInstance().getConnection(); - PreparedStatement statement = con.prepareStatement("UPDATE characters SET accesslevel=? WHERE char_name=?"); - statement.setInt(1, lvl); - statement.setString(2, name); - statement.execute(); - int count = statement.getUpdateCount(); - statement.close(); - if (count == 0) - { - activeChar.sendMessage("Character not found or access level unaltered."); - } - else - { - activeChar.sendMessage("Character's access level is now set to " + lvl); - } - } - catch (SQLException se) - { - activeChar.sendMessage("SQLException while changing character's access level"); - if (Config.DEBUG) - { - se.printStackTrace(); - } - } - finally - { - try - { - con.close(); - } - catch (Exception e) - { - } - } + else { + CharacterRepository repository = DatabaseAccess.getRepository(CharacterRepository.class); + if(repository.updateAccessLevelByCharName(name, lvl) == 0) { + activeChar.sendMessage("Character not found or access level unaltered."); + } else { + activeChar.sendMessage("Character's access level is now set to " + lvl); + } } } } diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/handler/admincommandhandlers/AdminMenu.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/handler/admincommandhandlers/AdminMenu.java index d5350394..6e06cbe4 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/handler/admincommandhandlers/AdminMenu.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/handler/admincommandhandlers/AdminMenu.java @@ -19,18 +19,18 @@ package com.l2jbr.gameserver.handler.admincommandhandlers; import com.l2jbr.commons.Config; -import com.l2jbr.commons.database.L2DatabaseFactory; +import com.l2jbr.commons.database.DatabaseAccess; +import com.l2jbr.commons.util.Util; import com.l2jbr.gameserver.LoginServerThread; import com.l2jbr.gameserver.handler.IAdminCommandHandler; import com.l2jbr.gameserver.model.*; import com.l2jbr.gameserver.model.actor.instance.L2PcInstance; +import com.l2jbr.gameserver.model.database.repository.CharacterRepository; import com.l2jbr.gameserver.network.SystemMessageId; import com.l2jbr.gameserver.serverpackets.SystemMessage; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import java.sql.PreparedStatement; -import java.sql.ResultSet; import java.util.StringTokenizer; @@ -320,54 +320,17 @@ private void showMainPage(L2PcInstance activeChar) AdminHelpPage.showHelpPage(activeChar, "charmanage.htm"); } - private void setAccountAccessLevel(String player, L2PcInstance activeChar, int banLevel) - { - java.sql.Connection con = null; - try - { - con = L2DatabaseFactory.getInstance().getConnection(); - String stmt = "SELECT account_name FROM characters WHERE char_name = ?"; - PreparedStatement statement = con.prepareStatement(stmt); - statement.setString(1, player); - ResultSet result = statement.executeQuery(); - if (result.next()) - { - String acc_name = result.getString(1); - SystemMessage sm = new SystemMessage(SystemMessageId.S1_S2); - if (acc_name.length() > 0) - { - LoginServerThread.getInstance().sendAccessLevel(acc_name, banLevel); - sm.addString("Account Access Level for " + player + " set to " + banLevel + "."); - } - else - { - sm.addString("Couldn't find player: " + player + "."); - } - activeChar.sendPacket(sm); - } - else - { - activeChar.sendMessage("Specified player name didn't lead to a valid account."); - } - statement.close(); - } - catch (Exception e) - { - _log.warn("Could not set accessLevel:" + e); - if (Config.DEBUG) - { - e.printStackTrace(); - } - } - finally - { - try - { - con.close(); - } - catch (Exception e) - { - } - } + private void setAccountAccessLevel(String player, L2PcInstance activeChar, int banLevel) { + CharacterRepository repository = DatabaseAccess.getRepository(CharacterRepository.class); + String acc_name = repository.findAccountByName(player); + if(Util.isNullOrEmpty(acc_name)) { + activeChar.sendMessage("Specified player name didn't lead to a valid account."); + } + else { + SystemMessage sm = new SystemMessage(SystemMessageId.S1_S2); + LoginServerThread.getInstance().sendAccessLevel(acc_name, banLevel); + sm.addString("Account Access Level for " + player + " set to " + banLevel + "."); + activeChar.sendPacket(sm); + } } } diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/handler/admincommandhandlers/AdminRepairChar.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/handler/admincommandhandlers/AdminRepairChar.java index 15d55d1d..6abeebe9 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/handler/admincommandhandlers/AdminRepairChar.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/handler/admincommandhandlers/AdminRepairChar.java @@ -19,15 +19,20 @@ package com.l2jbr.gameserver.handler.admincommandhandlers; import com.l2jbr.commons.Config; +import com.l2jbr.commons.database.DatabaseAccess; import com.l2jbr.commons.database.L2DatabaseFactory; import com.l2jbr.gameserver.handler.IAdminCommandHandler; import com.l2jbr.gameserver.model.GMAudit; import com.l2jbr.gameserver.model.actor.instance.L2PcInstance; +import com.l2jbr.gameserver.model.database.Character; +import com.l2jbr.gameserver.model.database.repository.CharacterRepository; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import java.sql.Connection; import java.sql.PreparedStatement; -import java.sql.ResultSet; +import java.sql.SQLException; +import java.util.Optional; /** @@ -75,68 +80,39 @@ private boolean checkLevel(int level) return (level >= REQUIRED_LEVEL); } - private void handleRepair(String command) - { + private void handleRepair(String command) { String[] parts = command.split(" "); - if (parts.length != 2) - { + if (parts.length != 2) { return; } - - String cmd = "UPDATE characters SET x=-84318, y=244579, z=-3730 WHERE char_name=?"; - java.sql.Connection connection = null; - try - { - connection = L2DatabaseFactory.getInstance().getConnection(); - PreparedStatement statement = connection.prepareStatement(cmd); - statement.setString(1, parts[1]); - statement.execute(); - statement.close(); - - statement = connection.prepareStatement("SELECT obj_id FROM characters where char_name=?"); - statement.setString(1, parts[1]); - ResultSet rset = statement.executeQuery(); - int objId = 0; - if (rset.next()) - { - objId = rset.getInt(1); - } - - rset.close(); - statement.close(); - - if (objId == 0) - { - connection.close(); - return; - } - - // connection = L2DatabaseFactory.getInstance().getConnection(); - statement = connection.prepareStatement("DELETE FROM character_shortcuts WHERE char_obj_id=?"); - statement.setInt(1, objId); - statement.execute(); - statement.close(); - - // connection = L2DatabaseFactory.getInstance().getConnection(); - statement = connection.prepareStatement("UPDATE items SET loc=\"INVENTORY\" WHERE owner_id=?"); - statement.setInt(1, objId); - statement.execute(); - statement.close(); - connection.close(); - } - catch (Exception e) - { - _log.warn( "could not repair char:", e); - } - finally - { - try - { - connection.close(); - } - catch (Exception e) - { - } - } + + CharacterRepository repository = DatabaseAccess.getRepository(CharacterRepository.class); + Optional optionalCharacter = repository.findByCharName(parts[1]); + + optionalCharacter.ifPresent(character -> { + character.updateLocation(-84318, 244579, -3730); + PreparedStatement statement = null; + try(Connection connection = L2DatabaseFactory.getInstance().getConnection();){ + statement = connection.prepareStatement("DELETE FROM character_shortcuts WHERE char_obj_id=?"); + statement.setInt(1, character.getId()); + statement.execute(); + statement.close(); + + statement = connection.prepareStatement("UPDATE items SET loc=\"INVENTORY\" WHERE owner_id=?"); + statement.setInt(1, character.getId()); + statement.execute(); + statement.close(); + + } catch (SQLException e) { + _log.warn( "could not repair char:", e); + } finally { + try { + statement.close(); + } catch (SQLException e) { + } + } + repository.save(character); + }); + } } diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/idfactory/BitSetIDFactory.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/idfactory/BitSetIDFactory.java index a1ed3b05..0cfd9e6d 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/idfactory/BitSetIDFactory.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/idfactory/BitSetIDFactory.java @@ -77,7 +77,7 @@ public synchronized void initialize() _log.warn("Object ID " + usedObjectId + " in DB is less than minimum ID of " + FIRST_OID); continue; } - _freeIds.set(usedObjectId - FIRST_OID); + _freeIds.set(objectID); _freeIdCount.decrementAndGet(); } diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/idfactory/IdFactory.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/idfactory/IdFactory.java index b2549f3b..37f36c9f 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/idfactory/IdFactory.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/idfactory/IdFactory.java @@ -236,14 +236,15 @@ protected int[] extractUsedObjectIDTable() throws SQLException catch (SQLException e) { } + // TODO verify if we must delete itemsonground here. s.executeUpdate("delete from itemsonground where object_id in (select object_id from items)"); - s.executeUpdate("create table temporaryObjectTable" + " (object_id int NOT NULL PRIMARY KEY)"); + s.executeUpdate("create table temporaryObjectTable (object_id int NOT NULL PRIMARY KEY)"); - s.executeUpdate("insert into temporaryObjectTable (object_id)" + " select obj_id from characters"); - s.executeUpdate("insert into temporaryObjectTable (object_id)" + " select object_id from items"); - s.executeUpdate("insert into temporaryObjectTable (object_id)" + " select clan_id from clan_data"); + s.executeUpdate("insert into temporaryObjectTable (object_id) select obj_id from characters"); + s.executeUpdate("insert into temporaryObjectTable (object_id) select object_id from items"); + s.executeUpdate("insert into temporaryObjectTable (object_id) select clan_id from clan_data"); // s.executeUpdate("insert into temporaryObjectTable (object_id)" + " select crest_id from clan_data where crest_id > 0"); - s.executeUpdate("insert into temporaryObjectTable (object_id)" + " select object_id from itemsonground"); + s.executeUpdate("insert into temporaryObjectTable (object_id) select object_id from itemsonground"); ResultSet result = s.executeQuery("select count(object_id) from temporaryObjectTable"); diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/L2Clan.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/L2Clan.java index cb3e271f..b6287d46 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/L2Clan.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/L2Clan.java @@ -19,6 +19,7 @@ package com.l2jbr.gameserver.model; import com.l2jbr.commons.Config; +import com.l2jbr.commons.database.DatabaseAccess; import com.l2jbr.commons.database.L2DatabaseFactory; import com.l2jbr.gameserver.communitybbs.BB.Forum; import com.l2jbr.gameserver.communitybbs.Manager.ForumsBBSManager; @@ -27,6 +28,7 @@ import com.l2jbr.gameserver.instancemanager.CastleManager; import com.l2jbr.gameserver.instancemanager.SiegeManager; import com.l2jbr.gameserver.model.actor.instance.L2PcInstance; +import com.l2jbr.gameserver.model.database.repository.CharacterRepository; import com.l2jbr.gameserver.network.SystemMessageId; import com.l2jbr.gameserver.serverpackets.*; import com.l2jbr.gameserver.util.Util; @@ -700,8 +702,6 @@ private void restore() { // restorewars(); java.sql.Connection con = null; try { - L2ClanMember member; - con = L2DatabaseFactory.getInstance().getConnection(); PreparedStatement statement = con.prepareStatement("SELECT clan_name,clan_level,hasCastle,ally_id,ally_name,leader_id,crest_id,crest_large_id,ally_crest_id,reputation_score,auction_bid_at,ally_penalty_expiry_time,ally_penalty_type,char_penalty_expiry_time,dissolving_expiry_time FROM clan_data where clan_id=?"); statement.setInt(1, getClanId()); @@ -740,21 +740,19 @@ private void restore() { int leaderId = (clanData.getInt("leader_id")); - PreparedStatement statement2 = con.prepareStatement("SELECT char_name,level,classid,obj_Id,title,power_grade,subpledge,apprentice,sponsor FROM characters WHERE clanid=?"); - statement2.setInt(1, getClanId()); - ResultSet clanMembers = statement2.executeQuery(); + CharacterRepository repository = DatabaseAccess.getRepository(CharacterRepository.class); + repository.findAllByClanId(getClanId()).forEach( character -> { + + L2ClanMember member = new L2ClanMember(this, character.getCharName(), character.getLevel(), character.getClassId(), + character.getObjectId(), character.getSubpledge(), character.getPowerGrade(), character.getTitle()); - while (clanMembers.next()) { - member = new L2ClanMember(this, clanMembers.getString("char_name"), clanMembers.getInt("level"), clanMembers.getInt("classid"), clanMembers.getInt("obj_id"), clanMembers.getInt("subpledge"), clanMembers.getInt("power_grade"), clanMembers.getString("title")); if (member.getObjectId() == leaderId) { setLeader(member); } else { addClanMember(member); } - member.initApprenticeAndSponsor(clanMembers.getInt("apprentice"), clanMembers.getInt("sponsor")); - } - clanMembers.close(); - statement2.close(); + member.initApprenticeAndSponsor(character.getApprentice(), character.getSponsor()); + }); } clanData.close(); diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/actor/instance/L2PcInstance.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/actor/instance/L2PcInstance.java index 79950257..fe426905 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/actor/instance/L2PcInstance.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/actor/instance/L2PcInstance.java @@ -19,6 +19,7 @@ package com.l2jbr.gameserver.model.actor.instance; import com.l2jbr.commons.Config; +import com.l2jbr.commons.database.DatabaseAccess; import com.l2jbr.commons.database.L2DatabaseFactory; import com.l2jbr.commons.util.Rnd; import com.l2jbr.gameserver.*; @@ -46,6 +47,8 @@ import com.l2jbr.gameserver.model.actor.stat.PcStat; import com.l2jbr.gameserver.model.actor.status.PcStatus; import com.l2jbr.gameserver.model.base.*; +import com.l2jbr.gameserver.model.database.Character; +import com.l2jbr.gameserver.model.database.repository.CharacterRepository; import com.l2jbr.gameserver.model.entity.*; import com.l2jbr.gameserver.model.quest.Quest; import com.l2jbr.gameserver.model.quest.QuestState; @@ -107,27 +110,43 @@ public final class L2PcInstance extends L2PlayableInstance { /** * The table containing all minimum level needed for each Expertise (None, D, C, B, A, S). */ - private static final int[] EXPERTISE_LEVELS = - { - SkillTreeTable.getInstance().getExpertiseLevel(0), // NONE - SkillTreeTable.getInstance().getExpertiseLevel(1), // D - SkillTreeTable.getInstance().getExpertiseLevel(2), // C - SkillTreeTable.getInstance().getExpertiseLevel(3), // B - SkillTreeTable.getInstance().getExpertiseLevel(4), // A - SkillTreeTable.getInstance().getExpertiseLevel(5), // S - }; - - private static final int[] COMMON_CRAFT_LEVELS = - { - 5, - 20, - 28, - 36, - 43, - 49, - 55, - 62 - }; + private static final int[] EXPERTISE_LEVELS = { + SkillTreeTable.getInstance().getExpertiseLevel(0), // NONE + SkillTreeTable.getInstance().getExpertiseLevel(1), // D + SkillTreeTable.getInstance().getExpertiseLevel(2), // C + SkillTreeTable.getInstance().getExpertiseLevel(3), // B + SkillTreeTable.getInstance().getExpertiseLevel(4), // A + SkillTreeTable.getInstance().getExpertiseLevel(5), // S + }; + + private static final int[] COMMON_CRAFT_LEVELS = { + 5, + 20, + 28, + 36, + 43, + 49, + 55, + 62 + }; + + + private L2GameClient _client; + private Character character; + + private String _accountName; + private long _deleteTimer; + private boolean _isOnline = false; + private long _onlineTime; + private long _onlineBeginTime; + private long _lastAccess; + private long _uptime; + protected int _baseClass; + protected int _activeClass; + protected int _classIndex = 0; + private Map _subClasses; + private PcAppearance _appearance; + private int _charId = 0x00030b7a; /** * The Class AIAccessor. @@ -225,21 +244,6 @@ public void startForceBuff(L2Character target, L2Skill skill) { } } - private L2GameClient _client; - private String _accountName; - private long _deleteTimer; - private boolean _isOnline = false; - private long _onlineTime; - private long _onlineBeginTime; - private long _lastAccess; - private long _uptime; - protected int _baseClass; - protected int _activeClass; - protected int _classIndex = 0; - private Map _subClasses; - private PcAppearance _appearance; - private int _charId = 0x00030b7a; - /** * The Experience of the L2PcInstance before the last Death Penalty. */ @@ -6311,183 +6315,130 @@ private boolean createDb() { * @return The L2PcInstance loaded from the database */ private static L2PcInstance restore(int objectId) { - L2PcInstance player = null; - java.sql.Connection con = null; - - try { - // Retrieve the L2PcInstance from the characters table of the database - con = L2DatabaseFactory.getInstance().getConnection(); - - PreparedStatement statement = con.prepareStatement(RESTORE_CHARACTER); - statement.setInt(1, objectId); - ResultSet rset = statement.executeQuery(); - - double currentCp = 0; - double currentHp = 0; - double currentMp = 0; - - while (rset.next()) { - final int activeClassId = rset.getInt("classid"); - final boolean female = rset.getInt("sex") != 0; - final L2PcTemplate template = CharTemplateTable.getInstance().getTemplate(activeClassId); - PcAppearance app = new PcAppearance(rset.getByte("face"), rset.getByte("hairColor"), rset.getByte("hairStyle"), female); - - player = new L2PcInstance(objectId, template, rset.getString("account_name"), app); - player.setName(rset.getString("char_name")); - player._lastAccess = rset.getLong("lastAccess"); - - player.getStat().setExp(rset.getLong("exp")); - player.setExpBeforeDeath(rset.getLong("expBeforeDeath")); - player.getStat().setLevel(rset.getByte("level")); - player.getStat().setSp(rset.getInt("sp")); - - player.setWantsPeace(rset.getInt("wantspeace")); - - player.setHeading(rset.getInt("heading")); - - player.setKarma(rset.getInt("karma")); - player.setPvpKills(rset.getInt("pvpkills")); - player.setPkKills(rset.getInt("pkkills")); - player.setOnlineTime(rset.getLong("onlinetime")); - player.setNewbie(rset.getInt("newbie") == 1); - player.setNoble(rset.getInt("nobless") == 1); - - player.setClanJoinExpiryTime(rset.getLong("clan_join_expiry_time")); - if (player.getClanJoinExpiryTime() < System.currentTimeMillis()) { - player.setClanJoinExpiryTime(0); - } - player.setClanCreateExpiryTime(rset.getLong("clan_create_expiry_time")); - if (player.getClanCreateExpiryTime() < System.currentTimeMillis()) { - player.setClanCreateExpiryTime(0); - } + CharacterRepository repository = DatabaseAccess.getRepository(CharacterRepository.class); + Optional optionalCharacter = repository.findById(objectId); + if(optionalCharacter.isPresent()) { + Character character = optionalCharacter.get(); + final int activeClassId = character.getClassId(); + final boolean female = character.getSex() != 0; + final L2PcTemplate template = CharTemplateTable.getInstance().getTemplate(activeClassId); + PcAppearance app = new PcAppearance(character.getFace(), character.getHairColor(), character.getHairStyle(), female); - int clanId = rset.getInt("clanid"); - player.setPowerGrade((int) rset.getLong("power_grade")); - player.setPledgeType(rset.getInt("subpledge")); - player.setLastRecomUpdate(rset.getLong("last_recom_date")); - // player.setApprentice(rset.getInt("apprentice")); + L2PcInstance player = new L2PcInstance(objectId, template, character.getAccountName(), app); + player.setName(character.getCharName()); + player._lastAccess = character.getLastAccess(); - if (clanId > 0) { - player.setClan(ClanTable.getInstance().getClan(clanId)); - } + player.getStat().setExp(character.getExperience()); + player.setExpBeforeDeath(character.getExpBeforeDeath()); + player.getStat().setLevel(character.getLevel()); + player.getStat().setSp(character.getSp()); - if (player.getClan() != null) { - if (player.getClan().getLeaderId() != player.getObjectId()) { - if (player.getPowerGrade() == 0) { - player.setPowerGrade(5); - } - player.setClanPrivileges(player.getClan().getRankPrivs(player.getPowerGrade())); - } else { - player.setClanPrivileges(L2Clan.CP_ALL); - player.setPowerGrade(1); - } - } else { - player.setClanPrivileges(L2Clan.CP_NOTHING); - } + player.setWantsPeace(character.getWantspeace()); - player.setDeleteTimer(rset.getLong("deletetime")); - player.setTitle(rset.getString("title")); - player.setAccessLevel(rset.getInt("accesslevel")); - player.setFistsWeaponItem(player.findFistsWeaponItem(activeClassId)); - player.setUptime(System.currentTimeMillis()); + player.setKarma(character.getKarma()); + player.setPvpKills(character.getPvpkills()); + player.setPkKills(character.getPkkills()); + player.setOnlineTime(character.getOnlinetime()); + player.setNewbie(character.getNewbie() == 1); + player.setNoble(character.getNobless() == 1); - currentHp = rset.getDouble("curHp"); - player.setCurrentHp(rset.getDouble("curHp")); - currentCp = rset.getDouble("curCp"); - player.setCurrentCp(rset.getDouble("curCp")); - currentMp = rset.getDouble("curMp"); - player.setCurrentMp(rset.getDouble("curMp")); + player.setClanJoinExpiryTime(character.getClanJoinExpiryTime()); + if (player.getClanJoinExpiryTime() < System.currentTimeMillis()) { + player.setClanJoinExpiryTime(0); + } + player.setClanCreateExpiryTime(character.getClanCreateExpiryTime()); + if (player.getClanCreateExpiryTime() < System.currentTimeMillis()) { + player.setClanCreateExpiryTime(0); + } - // Check recs - player.checkRecom(rset.getInt("rec_have"), rset.getInt("rec_left")); + int clanId = character.getClanId(); + player.setPowerGrade((int) character.getPowerGrade()); + player.setPledgeType(character.getSubpledge()); + player.setLastRecomUpdate(character.getLastRecomDate()); - player._classIndex = 0; - try { - player.setBaseClass(rset.getInt("base_class")); - } catch (Exception e) { - player.setBaseClass(activeClassId); - } + if (clanId > 0) { + player.setClan(ClanTable.getInstance().getClan(clanId)); + } - // Restore Subclass Data (cannot be done earlier in function) - if (restoreSubClassData(player)) { - if (activeClassId != player.getBaseClass()) { - for (SubClass subClass : player.getSubClasses().values()) { - if (subClass.getClassId() == activeClassId) { - player._classIndex = subClass.getClassIndex(); - } - } + if (player.getClan() != null) { + if (player.getClan().getLeaderId() != player.getObjectId()) { + if (player.getPowerGrade() == 0) { + player.setPowerGrade(5); } - } - if ((player.getClassIndex() == 0) && (activeClassId != player.getBaseClass())) { - // Subclass in use but doesn't exist in DB - - // a possible restart-while-modifysubclass cheat has been attempted. - // Switching to use base class - player.setClassId(player.getBaseClass()); - _log.warn("Player " + player.getName() + " reverted to base class. Possibly has tried a relogin exploit while subclassing."); - } else { - player._activeClass = activeClassId; - } - - player.setApprentice(rset.getInt("apprentice")); - player.setSponsor(rset.getInt("sponsor")); - player.setLvlJoinedAcademy(rset.getInt("lvl_joined_academy")); - player.setIsIn7sDungeon((rset.getInt("isin7sdungeon") == 1) ? true : false); - player.setInJail((rset.getInt("in_jail") == 1) ? true : false); - if (player.isInJail()) { - player.setJailTimer(rset.getLong("jail_timer")); + player.setClanPrivileges(player.getClan().getRankPrivs(player.getPowerGrade())); } else { - player.setJailTimer(0); + player.setClanPrivileges(L2Clan.CP_ALL); + player.setPowerGrade(1); } + } else { + player.setClanPrivileges(L2Clan.CP_NOTHING); + } - CursedWeaponsManager.getInstance().checkPlayer(player); - - player.setAllianceWithVarkaKetra(rset.getInt("varka_ketra_ally")); - - player.setDeathPenaltyBuffLevel(rset.getInt("death_penalty_level")); + player.setDeleteTimer(character.getDeleteTime()); + player.setTitle(character.getTitle()); + player.setAccessLevel(character.getAccesslevel()); + player.setFistsWeaponItem(player.findFistsWeaponItem(activeClassId)); + player.setUptime(System.currentTimeMillis()); - // Add the L2PcInstance object in _allObjects - // L2World.getInstance().storeObject(player); + player.setCurrentHp(character.getCurrentHp()); + player.setCurrentCp(character.getCurCp()); + player.setCurrentMp(character.getCurrentMp()); - // Set the x,y,z position of the L2PcInstance and make it invisible - player.setXYZInvisible(rset.getInt("x"), rset.getInt("y"), rset.getInt("z")); + // Check recs + player.checkRecom(character.getRecHave(), character.getRecLeft()); - // Retrieve the name and ID of the other characters assigned to this account. - PreparedStatement stmt = con.prepareStatement("SELECT obj_Id, char_name FROM characters WHERE account_name=? AND obj_Id<>?"); - stmt.setString(1, player._accountName); - stmt.setInt(2, objectId); - ResultSet chars = stmt.executeQuery(); + player._classIndex = 0; + try { + player.setBaseClass(character.getBaseClass()); + } catch (Exception e) { + player.setBaseClass(activeClassId); + } - while (chars.next()) { - Integer charId = chars.getInt("obj_Id"); - String charName = chars.getString("char_name"); - player._chars.put(charId, charName); + // Restore Subclass Data (cannot be done earlier in function) + if (restoreSubClassData(player)) { + if (activeClassId != player.getBaseClass()) { + for (SubClass subClass : player.getSubClasses().values()) { + if (subClass.getClassId() == activeClassId) { + player._classIndex = subClass.getClassIndex(); + } + } } + } + if ((player.getClassIndex() == 0) && (activeClassId != player.getBaseClass())) { + // Subclass in use but doesn't exist in DB - + // a possible restart-while-modifysubclass cheat has been attempted. + // Switching to use base class + player.setClassId(player.getBaseClass()); + _log.warn("Player " + player.getName() + " reverted to base class. Possibly has tried a relogin exploit while subclassing."); + } else { + player._activeClass = activeClassId; + } - chars.close(); - stmt.close(); - break; + player.setApprentice(character.getApprentice()); + player.setSponsor(character.getSponsor()); + player.setLvlJoinedAcademy(character.getLvlJoinedAcademy()); + player.setIsIn7sDungeon((character.getIsin7sdungeon() == 1) ? true : false); + player.setInJail((character.getInJail() == 1) ? true : false); + if (player.isInJail()) { + player.setJailTimer(character.getJailTimer()); + } else { + player.setJailTimer(0); } - rset.close(); - statement.close(); + CursedWeaponsManager.getInstance().checkPlayer(player); + player.setAllianceWithVarkaKetra(character.getVarkaKetraAlly()); + player.setDeathPenaltyBuffLevel(character.getDeathPenaltyLevel()); + player.setXYZInvisible(character.getX(), character.getY(), character.getZ()); + player.setHeading(character.getHeading()); - if (player == null) { - _log.warn("Couldn't restore player from database!!!"); - return null; - } + repository.findOthersCharactersOnAccount(player.getAccountName(), player.getObjectId()).forEach(other -> { + player.getAccountChars().put(other.getObjectId(), other.getCharName()); + }); - // Retrieve from the database all secondary data of this L2PcInstance - // and reward expertise/lucky skills if necessary. - // Note that Clan, Noblesse and Hero skills are given separately and not here. player.restoreCharData(); player.rewardSkills(); - // Restore current Cp, HP and MP values - player.setCurrentCp(currentCp); - player.setCurrentHp(currentHp); - player.setCurrentMp(currentMp); - // Restore pet if exists in the world player.setPet(L2World.getInstance().getPet(player.getObjectId())); if (player.getPet() != null) { @@ -6496,16 +6447,11 @@ private static L2PcInstance restore(int objectId) { // Update the overloaded status of the L2PcInstance player.refreshOverloaded(); - } catch (Exception e) { - _log.error("Could not restore char data: " + e); - } finally { - try { - con.close(); - } catch (Exception e) { - } + return player; + } else{ + _log.warn("Couldn't restore player from database!!!"); + return null; } - - return player; } /** diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/Character.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/Character.java new file mode 100644 index 00000000..fb20f24b --- /dev/null +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/Character.java @@ -0,0 +1,734 @@ +package com.l2jbr.gameserver.model.database; + +import com.l2jbr.commons.database.annotation.Column; +import com.l2jbr.commons.database.model.Entity; +import org.springframework.data.annotation.Id; + +public class Character extends Entity { + + @Id + private int objId; + @Column("account_name") + private String accountName; + @Column("char_name") + private String name; + private Byte level; + private int maxHp; + private long curHp; + private int maxCp; + private long curCp; + private int maxMp; + private long curMp; + private int acc; + private int crit; + private int evasion; + private int mAtk; + private int mDef; + private int mSpd; + private int pAtk; + private int pDef; + private int pSpd; + private int runSpd; + private int walkSpd; + private int str; + private int con; + private int dex; + @Column("_int") + private int intelligence; + private int men; + private int wit; + private Byte face; + private Byte hairStyle; + private Byte hairColor; + private int sex; + private int heading; + private int x; + private int y; + private int z; + @Column("movement_multiplier") + private int movementMultiplier; + @Column("attack_speed_multiplier") + private int attackSpeedMultiplier; + private int colRad; + private int colHeight; + private long exp; + private long expBeforeDeath; + private int sp; + private int karma; + private int pvpkills; + private int pkkills; + private int clanid; + private int maxload; + private int race; + private int classid; + @Column("base_class") + private int baseClass; + private long deletetime; + private int cancraft; + private String title; + @Column("rec_have") + private int recHave; + @Column("rec_left") + private int recLeft; + private int accesslevel; + private int online; + private long onlinetime; + @Column("char_slot") + private int slot; + private int newbie; + private long lastAccess; + @Column("clan_privs") + private int clanPrivs; + private int wantspeace; + private int isin7sdungeon; + @Column("in_jail") + private int inJail; + @Column("jailTimer") + private long jailTimer; + @Column("power_grade") + private int powerGrade; + private int nobless; + private int subpledge; + @Column("last_recom_date") + private long lastRecomDate; + @Column("lvl_joined_academy") + private int lvlJoinedAcademy; + private int apprentice; + private int sponsor; + @Column("varka_ketra_ally") + private int varkaKetraAlly; + @Column("clan_join_expiry_time") + private long clanJoinExpiryTime; + @Column("clan_create_expiry_time") + private long clanCreateExpiryTime; + @Column("death_penalty_level") + private int deathPenaltyLevel; + + + @Override + public Integer getId() { + return objId; + } + + public String getAccountName() { + return accountName; + } + + public void setAccountName(String accountName) { + this.accountName = accountName; + } + + public int getObjectId() { + return objId; + } + + public void setObjId(int objId) { + this.objId = objId; + } + + public String getCharName() { + return name; + } + + public void setCharName(String char_name) { + this.name = char_name; + } + + public byte getLevel() { + return level; + } + + public void setLevel(byte level) { + this.level = level; + } + + public int getMaxHp() { + return maxHp; + } + + public void setMaxHp(int maxHp) { + this.maxHp = maxHp; + } + + public long getCurrentHp() { + return curHp; + } + + public void setCurHp(long curHp) { + this.curHp = curHp; + } + + public int getMaxCp() { + return maxCp; + } + + public void setMaxCp(int maxCp) { + this.maxCp = maxCp; + } + + public long getCurCp() { + return curCp; + } + + public void setCurCp(long curCp) { + this.curCp = curCp; + } + + public int getMaxMp() { + return maxMp; + } + + public void setMaxMp(int maxMp) { + this.maxMp = maxMp; + } + + public long getCurrentMp() { + return curMp; + } + + public void setCurMp(long curMp) { + this.curMp = curMp; + } + + public int getAcc() { + return acc; + } + + public void setAcc(int acc) { + this.acc = acc; + } + + public int getCrit() { + return crit; + } + + public void setCrit(int crit) { + this.crit = crit; + } + + public int getEvasion() { + return evasion; + } + + public void setEvasion(int evasion) { + this.evasion = evasion; + } + + public int getmAtk() { + return mAtk; + } + + public void setmAtk(int mAtk) { + this.mAtk = mAtk; + } + + public int getmDef() { + return mDef; + } + + public void setmDef(int mDef) { + this.mDef = mDef; + } + + public int getmSpd() { + return mSpd; + } + + public void setmSpd(int mSpd) { + this.mSpd = mSpd; + } + + public int getpAtk() { + return pAtk; + } + + public void setpAtk(int pAtk) { + this.pAtk = pAtk; + } + + public int getpDef() { + return pDef; + } + + public void setpDef(int pDef) { + this.pDef = pDef; + } + + public int getpSpd() { + return pSpd; + } + + public void setpSpd(int pSpd) { + this.pSpd = pSpd; + } + + public int getRunSpd() { + return runSpd; + } + + public void setRunSpd(int runSpd) { + this.runSpd = runSpd; + } + + public int getWalkSpd() { + return walkSpd; + } + + public void setWalkSpd(int walkSpd) { + this.walkSpd = walkSpd; + } + + public int getStr() { + return str; + } + + public void setStr(int str) { + this.str = str; + } + + public int getCon() { + return con; + } + + public void setCon(int con) { + this.con = con; + } + + public int getDex() { + return dex; + } + + public void setDex(int dex) { + this.dex = dex; + } + + public int getIntelligence() { + return intelligence; + } + + public void setIntelligence(int intelligence) { + this.intelligence = intelligence; + } + + public int getMen() { + return men; + } + + public void setMen(int men) { + this.men = men; + } + + public int getWit() { + return wit; + } + + public void setWit(int wit) { + this.wit = wit; + } + + public byte getFace() { + return face; + } + + public void setFace(byte face) { + this.face = face; + } + + public byte getHairStyle() { + return hairStyle; + } + + public void setHairStyle(byte hairStyle) { + this.hairStyle = hairStyle; + } + + public byte getHairColor() { + return hairColor; + } + + public void setHairColor(byte hairColor) { + this.hairColor = hairColor; + } + + public int getSex() { + return sex; + } + + public void setSex(int sex) { + this.sex = sex; + } + + public int getHeading() { + return heading; + } + + public void setHeading(int heading) { + this.heading = heading; + } + + public int getX() { + return x; + } + + public int getY() { + return y; + } + + public int getZ() { + return z; + } + + public int getMovementMultiplier() { + return movementMultiplier; + } + + public void setMovementMultiplier(int movementMultiplier) { + this.movementMultiplier = movementMultiplier; + } + + public int getAttackSpeedMultiplier() { + return attackSpeedMultiplier; + } + + public void setAttackSpeedMultiplier(int attackSpeedMultiplier) { + this.attackSpeedMultiplier = attackSpeedMultiplier; + } + + public int getColRad() { + return colRad; + } + + public void setColRad(int colRad) { + this.colRad = colRad; + } + + public int getColHeight() { + return colHeight; + } + + public void setColHeight(int colHeight) { + this.colHeight = colHeight; + } + + public long getExperience() { + return exp; + } + + public void setExp(long exp) { + this.exp = exp; + } + + public long getExpBeforeDeath() { + return expBeforeDeath; + } + + public void setExpBeforeDeath(long expBeforeDeath) { + this.expBeforeDeath = expBeforeDeath; + } + + public int getSp() { + return sp; + } + + public void setSp(int sp) { + this.sp = sp; + } + + public int getKarma() { + return karma; + } + + public void setKarma(int karma) { + this.karma = karma; + } + + public int getPvpkills() { + return pvpkills; + } + + public void setPvpkills(int pvpkills) { + this.pvpkills = pvpkills; + } + + public int getPkkills() { + return pkkills; + } + + public void setPkkills(int pkkills) { + this.pkkills = pkkills; + } + + public int getClanId() { + return clanid; + } + + public void setClanid(int clanid) { + this.clanid = clanid; + } + + public int getMaxload() { + return maxload; + } + + public void setMaxload(int maxload) { + this.maxload = maxload; + } + + public int getRace() { + return race; + } + + public void setRace(int race) { + this.race = race; + } + + public int getClassId() { + return classid; + } + + public void setClassid(int classid) { + this.classid = classid; + } + + public int getBaseClass() { + return baseClass; + } + + public void setBaseClass(int baseClass) { + this.baseClass = baseClass; + } + + public long getDeleteTime() { + return deletetime; + } + + public void setDeletetime(long deletetime) { + this.deletetime = deletetime; + } + + public int getCancraft() { + return cancraft; + } + + public void setCancraft(int cancraft) { + this.cancraft = cancraft; + } + + public String getTitle() { + return title; + } + + public void setTitle(String title) { + this.title = title; + } + + public int getRecHave() { + return recHave; + } + + public void setRecHave(int recHave) { + this.recHave = recHave; + } + + public int getRecLeft() { + return recLeft; + } + + public void setRecLeft(int recLeft) { + this.recLeft = recLeft; + } + + public int getAccesslevel() { + return accesslevel; + } + + public void setAccesslevel(int accesslevel) { + this.accesslevel = accesslevel; + } + + public int getOnline() { + return online; + } + + public void setOnline(int online) { + this.online = online; + } + + public long getOnlinetime() { + return onlinetime; + } + + public void setOnlinetime(long onlinetime) { + this.onlinetime = onlinetime; + } + + public int getSlot() { + return slot; + } + + public void setSlot(int slot) { + this.slot = slot; + } + + public int getNewbie() { + return newbie; + } + + public void setNewbie(int newbie) { + this.newbie = newbie; + } + + public long getLastAccess() { + return lastAccess; + } + + public void setLastAccess(long lastAccess) { + this.lastAccess = lastAccess; + } + + public int getClanPrivs() { + return clanPrivs; + } + + public void setClanPrivs(int clanPrivs) { + this.clanPrivs = clanPrivs; + } + + public int getWantspeace() { + return wantspeace; + } + + public void setWantspeace(int wantspeace) { + this.wantspeace = wantspeace; + } + + public int getIsin7sdungeon() { + return isin7sdungeon; + } + + public void setIsin7sdungeon(int isin7sdungeon) { + this.isin7sdungeon = isin7sdungeon; + } + + public int getInJail() { + return inJail; + } + + public void setInJail(int inJail) { + this.inJail = inJail; + } + + public long getJailTimer() { + return jailTimer; + } + + public void setJailTimer(long jailTimer) { + this.jailTimer = jailTimer; + } + + public int getPowerGrade() { + return powerGrade; + } + + public void setPowerGrade(int powerGrade) { + this.powerGrade = powerGrade; + } + + public int getNobless() { + return nobless; + } + + public void setNobless(int nobless) { + this.nobless = nobless; + } + + public int getSubpledge() { + return subpledge; + } + + public void setSubpledge(int subpledge) { + this.subpledge = subpledge; + } + + public long getLastRecomDate() { + return lastRecomDate; + } + + public void setLastRecomDate(long lastRecomDate) { + this.lastRecomDate = lastRecomDate; + } + + public int getLvlJoinedAcademy() { + return lvlJoinedAcademy; + } + + public void setLvlJoinedAcademy(int lvlJoinedAcademy) { + this.lvlJoinedAcademy = lvlJoinedAcademy; + } + + public int getApprentice() { + return apprentice; + } + + public void setApprentice(int apprentice) { + this.apprentice = apprentice; + } + + public int getSponsor() { + return sponsor; + } + + public void setSponsor(int sponsor) { + this.sponsor = sponsor; + } + + public int getVarkaKetraAlly() { + return varkaKetraAlly; + } + + public void setVarkaKetraAlly(int varkaKetraAlly) { + this.varkaKetraAlly = varkaKetraAlly; + } + + public long getClanJoinExpiryTime() { + return clanJoinExpiryTime; + } + + public void setClanJoinExpiryTime(long clanJoinExpiryTime) { + this.clanJoinExpiryTime = clanJoinExpiryTime; + } + + public long getClanCreateExpiryTime() { + return clanCreateExpiryTime; + } + + public void setClanCreateExpiryTime(long clanCreateExpiryTime) { + this.clanCreateExpiryTime = clanCreateExpiryTime; + } + + public int getDeathPenaltyLevel() { + return deathPenaltyLevel; + } + + public void setDeathPenaltyLevel(int deathPenaltyLevel) { + this.deathPenaltyLevel = deathPenaltyLevel; + } + + public void updateLocation(int x, int y, int z) { + this.x = x; + this.y = y; + this.z = z; + } + + public void setX(int x) { + this.x = x; + } + + public void setY(int y) { + this.y = y; + } + + public void setZ(int z) { + this.z = z; + } +} diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/Characters.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/Characters.java deleted file mode 100644 index 42457682..00000000 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/Characters.java +++ /dev/null @@ -1,91 +0,0 @@ -package com.l2jbr.gameserver.model.database; - -import com.l2jbr.commons.database.model.Entity; -import org.springframework.data.annotation.Id; - -public class Characters extends Entity { - - private String account_name; - @Id - private int obj_Id; - private String char_name; - private int level; - private int maxHp; - private long curHp; - private int maxCp; - private long curCp; - private int maxMp; - private long curMp; - private int acc; - private int crit; - private int evasion; - private int mAtk; - private int mDef; - private int mSpd; - private int pAtk; - private int pDef; - private int pSpd; - private int runSpd; - private int walkSpd; - private int str; - private int con; - private int dex; - private int _int; - private int men; - private int wit; - private int face; - private int hairStyle; - private int hairColor; - private int sex; - private int heading; - private int x; - private int y; - private int z; - private int movement_multiplier; - private int attack_speed_multiplier; - private int colRad; - private int colHeight; - private long exp; - private long expBeforeDeath; - private int sp; - private int karma; - private int pvpkills; - private int pkkills; - private int clanid; - private int maxload; - private int race; - private int classid; - private int base_class; - private long deletetime; - private int cancraft; - private String title; - private int rec_have; - private int rec_left; - private int accesslevel; - private int online; - private long onlinetime; - private int char_slot; - private int newbie; - private long lastAccess; - private int clan_privs; - private int wantspeace; - private int isin7sdungeon; - private int in_jail; - private long jail_timer; - private int power_grade; - private int nobless; - private int subpledge; - private long last_recom_date; - private int lvl_joined_academy; - private int apprentice; - private int sponsor; - private int varka_ketra_ally; - private long clan_join_expiry_time; - private long clan_create_expiry_time; - private int death_penalty_level; - - @Override - public Integer getId() { - return obj_Id; - } -} diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/repository/CharacterRepository.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/repository/CharacterRepository.java index 78f77b6b..83f5e35b 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/repository/CharacterRepository.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/repository/CharacterRepository.java @@ -1,7 +1,45 @@ package com.l2jbr.gameserver.model.database.repository; -import com.l2jbr.gameserver.model.database.Characters; +import com.l2jbr.gameserver.model.database.Character; +import org.springframework.data.jdbc.repository.query.Modifying; +import org.springframework.data.jdbc.repository.query.Query; import org.springframework.data.repository.CrudRepository; +import org.springframework.data.repository.query.Param; -public interface CharacterRepository extends CrudRepository { +import java.util.Optional; + +public interface CharacterRepository extends CrudRepository { + + @Query("SELECT * FROM characters WHERE char_name=:charName") + Optional findByCharName(@Param("charName") String charName); + + @Modifying + @Query("UPDATE characters SET accesslevel=:accessLevel WHERE char_name=:name") + int updateAccessLevelByCharName(@Param("name") String charName, @Param("accessLevel") int accessLevel); + + @Query("SELECT * FROM characters WHERE account_name=:account AND obj_Id<>:objectId") + Iterable findOthersCharactersOnAccount(@Param("account") String accountName, @Param("objectId") int objectId); + + @Modifying + @Query("UPDATE characters SET deletetime=:deleteTime WHERE obj_id=:objectId") + int updateDeleteTime(@Param("objectId") int objectId, @Param("deleteTime") long deleteTime); + + @Query("SELECT * FROM characters WHERE account_name=:account") + Iterable findAllByAccountName(@Param("account") String account); + + @Modifying + @Query("UPDATE characters SET clanid=0 WHERE clanid=:clanId") + int removeClanId(@Param("clanId") int clanId); + + @Query("SELECT * FROM characters WHERE clanId=:clanId") + Iterable findAllByClanId(@Param("clanId") int clanId); + + @Query("SELECT account_name FROM characters WHERE char_name=:name") + String findAccountByName(@Param("name") String charName); + + @Query("SELECT EXISTS (SELECT 1 FROM characters WHERE char_name=:name LIMIT 1)") + boolean existsByName(@Param("name") String name); + + @Query("SELECT COUNT(1) FROM characters WHERE account_name=:account") + int countByAccount(@Param("account") String account); } diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/network/L2GameClient.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/network/L2GameClient.java index a043a13b..b91e0dd4 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/network/L2GameClient.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/network/L2GameClient.java @@ -18,6 +18,7 @@ package com.l2jbr.gameserver.network; import com.l2jbr.commons.Config; +import com.l2jbr.commons.database.DatabaseAccess; import com.l2jbr.commons.database.L2DatabaseFactory; import com.l2jbr.gameserver.LoginServerThread; import com.l2jbr.gameserver.LoginServerThread.SessionKey; @@ -27,6 +28,7 @@ import com.l2jbr.gameserver.model.CharSelectInfoPackage; import com.l2jbr.gameserver.model.L2World; import com.l2jbr.gameserver.model.actor.instance.L2PcInstance; +import com.l2jbr.gameserver.model.database.repository.CharacterRepository; import com.l2jbr.gameserver.model.entity.L2Event; import com.l2jbr.gameserver.serverpackets.L2GameServerPacket; import com.l2jbr.gameserver.serverpackets.ServerClose; @@ -174,32 +176,19 @@ public L2PcInstance markToDeleteChar(int charslot) { * if (getActiveChar() != null) { saveCharToDisk(getActiveChar()); if (Config.DEBUG) { _log.debug("active Char saved"); } this.setActiveChar(null); } */ - int objid = getObjectIdForSlot(charslot); - if (objid < 0) { + int objectId = getObjectIdForSlot(charslot); + if (objectId < 0) { return null; } - L2PcInstance character = L2PcInstance.load(objid); + L2PcInstance character = L2PcInstance.load(objectId); if (character.getClanId() != 0) { return character; } - java.sql.Connection con = null; - try { - con = L2DatabaseFactory.getInstance().getConnection(); - PreparedStatement statement = con.prepareStatement("UPDATE characters SET deletetime=? WHERE obj_id=?"); - statement.setLong(1, System.currentTimeMillis() + (Config.DELETE_DAYS * 86400000L)); // 24*60*60*1000 = 86400000 - statement.setInt(2, objid); - statement.execute(); - statement.close(); - } catch (Exception e) { - _log.warn("Data error on update delete time of char: " + e); - } finally { - try { - con.close(); - } catch (Exception e) { - } - } + long deleteTime = System.currentTimeMillis() + (Config.DELETE_DAYS * 86400000L); + CharacterRepository repository = DatabaseAccess.getRepository(CharacterRepository.class); + repository.updateDeleteTime(objectId, deleteTime); return null; } @@ -236,35 +225,18 @@ public static void saveCharToDisk(L2PcInstance cha) { } } - public void markRestoredChar(int charslot) { - // have to make sure active character must be nulled - /* - * if (getActiveChar() != null) { saveCharToDisk (getActiveChar()); if (Config.DEBUG) _log.debug("active Char saved"); this.setActiveChar(null); } - */ - - int objid = getObjectIdForSlot(charslot); - if (objid < 0) { + public void markRestoredChar(int charSlot) { + int objId = getObjectIdForSlot(charSlot); + if (objId < 0) { return; } - java.sql.Connection con = null; - try { - con = L2DatabaseFactory.getInstance().getConnection(); - PreparedStatement statement = con.prepareStatement("UPDATE characters SET deletetime=0 WHERE obj_id=?"); - statement.setInt(1, objid); - statement.execute(); - statement.close(); - } catch (Exception e) { - _log.error("Data error on restoring char: " + e); - } finally { - try { - con.close(); - } catch (Exception e) { - } - } + + CharacterRepository repository = DatabaseAccess.getRepository(CharacterRepository.class); + repository.updateDeleteTime(objId, 0); } - public static void deleteCharByObjId(int objid) { - if (objid < 0) { + public static void deleteCharByObjId(int objId) { + if (objId < 0) { return; } @@ -275,90 +247,88 @@ public static void deleteCharByObjId(int objid) { PreparedStatement statement; statement = con.prepareStatement("DELETE FROM character_friends WHERE char_id=? OR friend_id=?"); - statement.setInt(1, objid); - statement.setInt(2, objid); + statement.setInt(1, objId); + statement.setInt(2, objId); statement.execute(); statement.close(); statement = con.prepareStatement("DELETE FROM character_hennas WHERE char_obj_id=?"); - statement.setInt(1, objid); + statement.setInt(1, objId); statement.execute(); statement.close(); statement = con.prepareStatement("DELETE FROM character_macroses WHERE char_obj_id=?"); - statement.setInt(1, objid); + statement.setInt(1, objId); statement.execute(); statement.close(); statement = con.prepareStatement("DELETE FROM character_quests WHERE char_id=?"); - statement.setInt(1, objid); + statement.setInt(1, objId); statement.execute(); statement.close(); statement = con.prepareStatement("DELETE FROM character_recipebook WHERE char_id=?"); - statement.setInt(1, objid); + statement.setInt(1, objId); statement.execute(); statement.close(); statement = con.prepareStatement("DELETE FROM character_shortcuts WHERE char_obj_id=?"); - statement.setInt(1, objid); + statement.setInt(1, objId); statement.execute(); statement.close(); statement = con.prepareStatement("DELETE FROM character_skills WHERE char_obj_id=?"); - statement.setInt(1, objid); + statement.setInt(1, objId); statement.execute(); statement.close(); statement = con.prepareStatement("DELETE FROM character_skills_save WHERE char_obj_id=?"); - statement.setInt(1, objid); + statement.setInt(1, objId); statement.execute(); statement.close(); statement = con.prepareStatement("DELETE FROM character_subclasses WHERE char_obj_id=?"); - statement.setInt(1, objid); + statement.setInt(1, objId); statement.execute(); statement.close(); statement = con.prepareStatement("DELETE FROM heroes WHERE char_id=?"); - statement.setInt(1, objid); + statement.setInt(1, objId); statement.execute(); statement.close(); statement = con.prepareStatement("DELETE FROM olympiad_nobles WHERE char_id=?"); - statement.setInt(1, objid); + statement.setInt(1, objId); statement.execute(); statement.close(); statement = con.prepareStatement("DELETE FROM seven_signs WHERE char_obj_id=?"); - statement.setInt(1, objid); + statement.setInt(1, objId); statement.execute(); statement.close(); statement = con.prepareStatement("DELETE FROM pets WHERE item_obj_id IN (SELECT object_id FROM items WHERE items.owner_id=?)"); - statement.setInt(1, objid); + statement.setInt(1, objId); statement.execute(); statement.close(); statement = con.prepareStatement("DELETE FROM augmentations WHERE item_id IN (SELECT object_id FROM items WHERE items.owner_id=?)"); - statement.setInt(1, objid); + statement.setInt(1, objId); statement.execute(); statement.close(); statement = con.prepareStatement("DELETE FROM items WHERE owner_id=?"); - statement.setInt(1, objid); + statement.setInt(1, objId); statement.execute(); statement.close(); statement = con.prepareStatement("DELETE FROM merchant_lease WHERE player_id=?"); - statement.setInt(1, objid); + statement.setInt(1, objId); statement.execute(); statement.close(); - statement = con.prepareStatement("DELETE FROM characters WHERE obj_Id=?"); - statement.setInt(1, objid); - statement.execute(); - statement.close(); + CharacterRepository repository = DatabaseAccess.getRepository(CharacterRepository.class); + repository.deleteById(objId); } catch (Exception e) { _log.warn("Data error on deleting char: " + e); } finally { diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/serverpackets/CharSelectInfo.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/serverpackets/CharSelectInfo.java index afc9f7c5..651b4f82 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/serverpackets/CharSelectInfo.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/serverpackets/CharSelectInfo.java @@ -18,11 +18,14 @@ */ package com.l2jbr.gameserver.serverpackets; +import com.l2jbr.commons.database.DatabaseAccess; import com.l2jbr.commons.database.L2DatabaseFactory; import com.l2jbr.gameserver.model.CharSelectInfoPackage; import com.l2jbr.gameserver.model.Inventory; import com.l2jbr.gameserver.model.L2Clan; import com.l2jbr.gameserver.model.actor.instance.L2PcInstance; +import com.l2jbr.gameserver.model.database.Character; +import com.l2jbr.gameserver.model.database.repository.CharacterRepository; import com.l2jbr.gameserver.network.L2GameClient; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -199,39 +202,18 @@ protected final void writeImpl() { } private CharSelectInfoPackage[] loadCharacterSelectInfo() { - CharSelectInfoPackage charInfopackage; List characterList = new LinkedList<>(); - java.sql.Connection con = null; - - try { - con = L2DatabaseFactory.getInstance().getConnection(); - PreparedStatement statement = con.prepareStatement("SELECT account_name, obj_Id, char_name, level, maxHp, curHp, maxMp, curMp, acc, crit, evasion, mAtk, mDef, mSpd, pAtk, pDef, pSpd, runSpd, walkSpd, str, con, dex, _int, men, wit, face, hairStyle, hairColor, sex, heading, x, y, z, movement_multiplier, attack_speed_multiplier, colRad, colHeight, exp, sp, karma, pvpkills, pkkills, clanid, maxload, race, classid, deletetime, cancraft, title, rec_have, rec_left, accesslevel, online, char_slot, lastAccess, base_class FROM characters WHERE account_name=?"); - statement.setString(1, _loginName); - ResultSet charList = statement.executeQuery(); - - while (charList.next())// fills the package - { - charInfopackage = restoreChar(charList); - if (charInfopackage != null) { - characterList.add(charInfopackage); - } + CharacterRepository repository = DatabaseAccess.getRepository(CharacterRepository.class); + repository.findAllByAccountName(_loginName).forEach(character -> { + CharSelectInfoPackage charInfoPackage = restoreChar(character); + if (charInfoPackage != null) { + characterList.add(charInfoPackage); } + }); - charList.close(); - statement.close(); - - return characterList.toArray(new CharSelectInfoPackage[characterList.size()]); - } catch (Exception e) { - _log.warn("Could not restore char info: " + e); - } finally { - try { - con.close(); - } catch (Exception e) { - } - } + return characterList.toArray(new CharSelectInfoPackage[characterList.size()]); - return new CharSelectInfoPackage[0]; } private void loadCharacterSubclassInfo(CharSelectInfoPackage charInfopackage, int ObjectId, int activeClassId) { @@ -264,13 +246,13 @@ private void loadCharacterSubclassInfo(CharSelectInfoPackage charInfopackage, in } - private CharSelectInfoPackage restoreChar(ResultSet chardata) throws Exception { - int objectId = chardata.getInt("obj_id"); + private CharSelectInfoPackage restoreChar(Character character) { + int objectId = character.getObjectId(); // See if the char must be deleted - long deletetime = chardata.getLong("deletetime"); - if (deletetime > 0) { - if (System.currentTimeMillis() > deletetime) { + long deleteTime = character.getDeleteTime(); + if (deleteTime > 0) { + if (System.currentTimeMillis() > deleteTime) { L2PcInstance cha = L2PcInstance.load(objectId); L2Clan clan = cha.getClan(); if (clan != null) { @@ -282,29 +264,29 @@ private CharSelectInfoPackage restoreChar(ResultSet chardata) throws Exception { } } - String name = chardata.getString("char_name"); + String name = character.getCharName(); CharSelectInfoPackage charInfopackage = new CharSelectInfoPackage(objectId, name); - charInfopackage.setLevel(chardata.getInt("level")); - charInfopackage.setMaxHp(chardata.getInt("maxhp")); - charInfopackage.setCurrentHp(chardata.getDouble("curhp")); - charInfopackage.setMaxMp(chardata.getInt("maxmp")); - charInfopackage.setCurrentMp(chardata.getDouble("curmp")); - charInfopackage.setKarma(chardata.getInt("karma")); + charInfopackage.setLevel(character.getLevel()); + charInfopackage.setMaxHp(character.getMaxHp()); + charInfopackage.setCurrentHp(character.getCurrentHp()); + charInfopackage.setMaxMp(character.getMaxMp()); + charInfopackage.setCurrentMp(character.getCurrentMp()); + charInfopackage.setKarma(character.getKarma()); - charInfopackage.setFace(chardata.getInt("face")); - charInfopackage.setHairStyle(chardata.getInt("hairstyle")); - charInfopackage.setHairColor(chardata.getInt("haircolor")); - charInfopackage.setSex(chardata.getInt("sex")); + charInfopackage.setFace(character.getFace()); + charInfopackage.setHairStyle(character.getHairStyle()); + charInfopackage.setHairColor(character.getHairColor()); + charInfopackage.setSex(character.getSex()); - charInfopackage.setExp(chardata.getLong("exp")); - charInfopackage.setSp(chardata.getInt("sp")); - charInfopackage.setClanId(chardata.getInt("clanid")); + charInfopackage.setExp(character.getExperience()); + charInfopackage.setSp(character.getSp()); + charInfopackage.setClanId(character.getClanId()); - charInfopackage.setRace(chardata.getInt("race")); + charInfopackage.setRace(character.getRace()); - final int baseClassId = chardata.getInt("base_class"); - final int activeClassId = chardata.getInt("classid"); + final int baseClassId = character.getBaseClass(); + final int activeClassId = character.getClassId(); // if is in subclass, load subclass exp, sp, lvl info if (baseClassId != activeClassId) { @@ -352,8 +334,8 @@ private CharSelectInfoPackage restoreChar(ResultSet chardata) throws Exception { charInfopackage.setBaseClassId(baseClassId); } - charInfopackage.setDeleteTimer(deletetime); - charInfopackage.setLastAccess(chardata.getLong("lastAccess")); + charInfopackage.setDeleteTimer(deleteTime); + charInfopackage.setLastAccess(character.getLastAccess()); return charInfopackage; } diff --git a/Gameserver/src/main/com.l2jbr.gameserver/module-info.java b/Gameserver/src/main/com.l2jbr.gameserver/module-info.java index 5403ed2b..da62d231 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/module-info.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/module-info.java @@ -12,5 +12,7 @@ requires spring.context; exports com.l2jbr.gameserver; + exports com.l2jbr.gameserver.model.database.repository; + exports com.l2jbr.gameserver.model.database; } \ No newline at end of file diff --git a/Loginserver/src/main/com.l2jbr.loginserver/com/l2jbr/loginserver/LoginController.java b/Loginserver/src/main/com.l2jbr.loginserver/com/l2jbr/loginserver/LoginController.java index f63c0022..a28d494d 100644 --- a/Loginserver/src/main/com.l2jbr.loginserver/com/l2jbr/loginserver/LoginController.java +++ b/Loginserver/src/main/com.l2jbr.loginserver/com/l2jbr/loginserver/LoginController.java @@ -357,7 +357,7 @@ public boolean isLoginPossible(L2LoginClient client, int serverId) { public void setAccountAccessLevel(String login, short acessLevel) { AccountRepository repository = DatabaseAccess.getRepository(AccountRepository.class); - if(repository.updateAcessLevel(login, acessLevel) < 1) { + if(repository.updateAccessLevel(login, acessLevel) < 1) { _log.warn("Could not set accessLevel of account {}", login); } } diff --git a/Tools/src/main/com.l2jbr.tools/com/l2jbr/tools/accountmanager/SQLAccountManager.java b/Tools/src/main/com.l2jbr.tools/com/l2jbr/tools/accountmanager/SQLAccountManager.java index 167bde1d..766bbe6f 100644 --- a/Tools/src/main/com.l2jbr.tools/com/l2jbr/tools/accountmanager/SQLAccountManager.java +++ b/Tools/src/main/com.l2jbr.tools/com/l2jbr/tools/accountmanager/SQLAccountManager.java @@ -25,12 +25,14 @@ import com.l2jbr.commons.database.DatabaseAccess; import com.l2jbr.commons.database.L2DatabaseFactory; import com.l2jbr.commons.database.model.Account; +import com.l2jbr.gameserver.model.database.repository.CharacterRepository; import java.io.IOException; import java.io.InputStreamReader; import java.io.LineNumberReader; import java.security.MessageDigest; import java.security.NoSuchAlgorithmException; +import java.sql.Connection; import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.SQLException; @@ -146,143 +148,130 @@ private static void deleteAccount(String login) throws SQLException { Optional optionalAccount = repository.findById(login); if(optionalAccount.isPresent()) { - java.sql.Connection con = null; - con = L2DatabaseFactory.getInstance().getConnection(); + final Connection con = L2DatabaseFactory.getInstance().getConnection(); - // Get Accounts ID - ResultSet rcln; - PreparedStatement statement = con.prepareStatement("SELECT obj_Id, char_name, clanid FROM characters WHERE account_name=?;"); - statement.setEscapeProcessing(true); - statement.setString(1, login); - ResultSet rset = statement.executeQuery(); - - while (rset.next()) { - System.out.println("Deleting character " + rset.getString("char_name") + "."); - - // Check If clan leader Remove Clan and remove all from it - statement.close(); - statement = con.prepareStatement("SELECT COUNT(*) FROM clan_data WHERE leader_id=?;"); - statement.setString(1, rset.getString("clanid")); - rcln = statement.executeQuery(); - rcln.next(); - if (rcln.getInt(1) > 0) { - rcln.close(); - // Clan Leader + CharacterRepository characterRepository = DatabaseAccess.getRepository(CharacterRepository.class); + characterRepository.findAllByAccountName(login).forEach(character -> { - // Get Clan Name - statement.close(); + System.out.println("Deleting character " + character.getCharName()); + PreparedStatement statement = null; + ResultSet rcln = null; + try { statement = con.prepareStatement("SELECT clan_name FROM clan_data WHERE leader_id=?;"); - statement.setString(1, rset.getString("clanid")); + statement.setInt(1, character.getObjectId()); rcln = statement.executeQuery(); - rcln.next(); + if (rcln.next()) { + // Clan Leader + System.out.println("Deleting clan " + rcln.getString("clan_name") + "."); + + // Delete Clan Wars + statement.close(); + statement = con.prepareStatement("DELETE FROM clan_wars WHERE clan1=? OR clan2=?;"); + statement.setEscapeProcessing(true); + statement.setString(1, rcln.getString("clan_name")); + statement.setString(2, rcln.getString("clan_name")); + statement.executeUpdate(); + + final int clanId = character.getClanId(); + // Remove All From clan + + characterRepository.removeClanId(clanId); + + // Delete Clan + statement.close(); + statement = con.prepareStatement("DELETE FROM clan_data WHERE clan_id=?;"); + statement.setInt(1, clanId); + statement.executeUpdate(); + + statement.close(); + statement = con.prepareStatement("DELETE FROM clan_privs WHERE clan_id=?;"); + statement.setInt(1, clanId); + statement.executeUpdate(); + + statement.close(); + statement = con.prepareStatement("DELETE FROM clan_subpledges WHERE clan_id=?;"); + statement.setInt(1, clanId); + statement.executeUpdate(); + + } + rcln.close(); - System.out.println("Deleting clan " + rcln.getString("clan_name") + "."); + // skills + statement.close(); + statement = con.prepareStatement("DELETE FROM character_skills WHERE char_obj_id=?;"); + statement.setInt(1, character.getObjectId()); + statement.executeUpdate(); - // Delete Clan Wars + // shortcuts statement.close(); - statement = con.prepareStatement("DELETE FROM clan_wars WHERE clan1=? OR clan2=?;"); - statement.setEscapeProcessing(true); - statement.setString(1, rcln.getString("clan_name")); - statement.setString(2, rcln.getString("clan_name")); + statement = con.prepareStatement("DELETE FROM character_shortcuts WHERE char_obj_id=?;"); + statement.setInt(1, character.getObjectId()); statement.executeUpdate(); - rcln.close(); + // items + statement.close(); + statement = con.prepareStatement("DELETE FROM items WHERE owner_id=?;"); + statement.setInt(1, character.getObjectId()); + statement.executeUpdate(); - // Remove All From clan + // recipebook statement.close(); - statement = con.prepareStatement("UPDATE characters SET clanid=0 WHERE clanid=?;"); - statement.setString(1, rset.getString("clanid")); + statement = con.prepareStatement("DELETE FROM character_recipebook WHERE char_id=?;"); + statement.setInt(1, character.getObjectId()); statement.executeUpdate(); - // Delete Clan + // quests statement.close(); - statement = con.prepareStatement("DELETE FROM clan_data WHERE clan_id=?;"); - statement.setString(1, rset.getString("clanid")); + statement = con.prepareStatement("DELETE FROM character_quests WHERE char_id=?;"); + statement.setInt(1, character.getObjectId()); statement.executeUpdate(); + // macroses statement.close(); - statement = con.prepareStatement("DELETE FROM clan_privs WHERE clan_id=?;"); - statement.setString(1, rset.getString("clanid")); + statement = con.prepareStatement("DELETE FROM character_macroses WHERE char_obj_id=?;"); + statement.setInt(1, character.getObjectId()); statement.executeUpdate(); + // friends statement.close(); - statement = con.prepareStatement("DELETE FROM clan_subpledges WHERE clan_id=?;"); - statement.setString(1, rset.getString("clanid")); + statement = con.prepareStatement("DELETE FROM character_friends WHERE char_id=?;"); + statement.setInt(1, character.getObjectId()); statement.executeUpdate(); - } else { - rcln.close(); - } + // merchant_lease + statement.close(); + statement = con.prepareStatement("DELETE FROM merchant_lease WHERE player_id=?;"); + statement.setInt(1, character.getObjectId()); + statement.executeUpdate(); + + // boxaccess + statement.close(); + statement = con.prepareStatement("DELETE FROM boxaccess WHERE charname=?;"); + statement.setString(1, character.getCharName()); + statement.executeUpdate(); - // skills - statement.close(); - statement = con.prepareStatement("DELETE FROM character_skills WHERE char_obj_id=?;"); - statement.setString(1, rset.getString("obj_Id")); - statement.executeUpdate(); - - // shortcuts - statement.close(); - statement = con.prepareStatement("DELETE FROM character_shortcuts WHERE char_obj_id=?;"); - statement.setString(1, rset.getString("obj_Id")); - statement.executeUpdate(); - - // items - statement.close(); - statement = con.prepareStatement("DELETE FROM items WHERE owner_id=?;"); - statement.setString(1, rset.getString("obj_Id")); - statement.executeUpdate(); - - // recipebook - statement.close(); - statement = con.prepareStatement("DELETE FROM character_recipebook WHERE char_id=?;"); - statement.setString(1, rset.getString("obj_Id")); - statement.executeUpdate(); - - // quests - statement.close(); - statement = con.prepareStatement("DELETE FROM character_quests WHERE char_id=?;"); - statement.setString(1, rset.getString("obj_Id")); - statement.executeUpdate(); - - // macroses - statement.close(); - statement = con.prepareStatement("DELETE FROM character_macroses WHERE char_obj_id=?;"); - statement.setString(1, rset.getString("obj_Id")); - statement.executeUpdate(); - - // friends - statement.close(); - statement = con.prepareStatement("DELETE FROM character_friends WHERE char_id=?;"); - statement.setString(1, rset.getString("obj_Id")); - statement.executeUpdate(); - - // merchant_lease - statement.close(); - statement = con.prepareStatement("DELETE FROM merchant_lease WHERE player_id=?;"); - statement.setString(1, rset.getString("obj_Id")); - statement.executeUpdate(); - - // boxaccess - statement.close(); - statement = con.prepareStatement("DELETE FROM boxaccess WHERE charname=?;"); - statement.setString(1, rset.getString("char_name")); - statement.executeUpdate(); - - // characters - statement.close(); - statement = con.prepareStatement("DELETE FROM characters WHERE obj_Id=?;"); - statement.setString(1, rset.getString("obj_Id")); - statement.executeUpdate(); + // characters + characterRepository.delete(character); + } catch (Exception e) { + e.printStackTrace(); + } finally { + try { + rcln.close(); + statement.close(); + con.close(); + } catch (SQLException e) { + e.printStackTrace(); + } + } - } + }); + // Get Accounts ID // Delete Account repository.delete(optionalAccount.get()); System.out.println("Account " + login + " has been deleted."); - rset.close(); - statement.close(); - con.close(); + } else { System.out.println("Account " + login + " does not exist."); From 54cd5f2b3605a9ca48e910e60c7fe68ad36c8cd6 Mon Sep 17 00:00:00 2001 From: Alisson Oliveira Date: Fri, 20 Apr 2018 17:53:10 -0300 Subject: [PATCH 017/236] =?UTF-8?q?Remove=20refer=C3=AAncias=20=C3=A0=20ta?= =?UTF-8?q?bela=20characters?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../commons/database/DatabaseAccess.java | 11 +- .../l2jbr/commons/database/model/Entity.java | 2 + .../admincommandhandlers/AdminBan.java | 115 +---- .../instancemanager/CursedWeaponsManager.java | 19 +- .../l2jbr/gameserver/model/CursedWeapon.java | 52 +-- .../com/l2jbr/gameserver/model/L2Clan.java | 39 +- .../l2jbr/gameserver/model/L2ClanMember.java | 62 +-- .../model/actor/instance/L2PcInstance.java | 405 +++++++++--------- .../gameserver/model/database/Character.java | 71 +-- .../repository/CharacterRepository.java | 36 ++ .../l2jbr/gameserver/model/entity/Hero.java | 371 +++++----------- .../gameserver/status/GameStatusThread.java | 80 +--- 12 files changed, 448 insertions(+), 815 deletions(-) diff --git a/Commons/src/main/com.l2jbr.commons/com/l2jbr/commons/database/DatabaseAccess.java b/Commons/src/main/com.l2jbr.commons/com/l2jbr/commons/database/DatabaseAccess.java index c35022a2..406b1bfc 100644 --- a/Commons/src/main/com.l2jbr.commons/com/l2jbr/commons/database/DatabaseAccess.java +++ b/Commons/src/main/com.l2jbr.commons/com/l2jbr/commons/database/DatabaseAccess.java @@ -11,18 +11,13 @@ public class DatabaseAccess { private static Map objects = new WeakHashMap<>(); public static T getRepository(Class repositoryClass) { - - for (Map.Entry entry : objects.entrySet()) { - if (repositoryClass.equals(entry.getValue())) { - if(entry.getKey().getClass().isAssignableFrom(repositoryClass)) { - return repositoryClass.cast(entry.getKey()); - } - } + if(objects.containsKey(repositoryClass)) { + return repositoryClass.cast(objects.get(repositoryClass)); } T repository = null; try { repository = L2DatabaseFactory.getInstance().getRepository(repositoryClass); - objects.put(repository, repositoryClass); + objects.put(repositoryClass, repository); } catch (SQLException e) { } diff --git a/Commons/src/main/com.l2jbr.commons/com/l2jbr/commons/database/model/Entity.java b/Commons/src/main/com.l2jbr.commons/com/l2jbr/commons/database/model/Entity.java index 12e16da0..fb075004 100644 --- a/Commons/src/main/com.l2jbr.commons/com/l2jbr/commons/database/model/Entity.java +++ b/Commons/src/main/com.l2jbr.commons/com/l2jbr/commons/database/model/Entity.java @@ -25,4 +25,6 @@ public boolean isPersisted() { return !isNew; } + public void setPersisted() { isNew = false;} + } diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/handler/admincommandhandlers/AdminBan.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/handler/admincommandhandlers/AdminBan.java index 23cc2e8f..00f57b93 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/handler/admincommandhandlers/AdminBan.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/handler/admincommandhandlers/AdminBan.java @@ -19,7 +19,7 @@ package com.l2jbr.gameserver.handler.admincommandhandlers; import com.l2jbr.commons.Config; -import com.l2jbr.commons.database.L2DatabaseFactory; +import com.l2jbr.commons.database.DatabaseAccess; import com.l2jbr.gameserver.LoginServerThread; import com.l2jbr.gameserver.communitybbs.Manager.RegionBBSManager; import com.l2jbr.gameserver.handler.IAdminCommandHandler; @@ -27,12 +27,10 @@ import com.l2jbr.gameserver.model.L2Object; import com.l2jbr.gameserver.model.L2World; import com.l2jbr.gameserver.model.actor.instance.L2PcInstance; +import com.l2jbr.gameserver.model.database.repository.CharacterRepository; import com.l2jbr.gameserver.network.SystemMessageId; import com.l2jbr.gameserver.serverpackets.SystemMessage; -import java.sql.Connection; -import java.sql.PreparedStatement; -import java.sql.SQLException; import java.util.NoSuchElementException; import java.util.StringTokenizer; @@ -196,105 +194,22 @@ else if (command.startsWith("admin_unjail")) return true; } - private void jailOfflinePlayer(L2PcInstance activeChar, String name, int delay) - { - Connection con = null; - try - { - con = L2DatabaseFactory.getInstance().getConnection(); - - PreparedStatement statement = con.prepareStatement("UPDATE characters SET x=?, y=?, z=?, in_jail=?, jail_timer=? WHERE char_name=?"); - statement.setInt(1, -114356); - statement.setInt(2, -249645); - statement.setInt(3, -2984); - statement.setInt(4, 1); - statement.setLong(5, delay * 60000L); - statement.setString(6, name); - - statement.execute(); - int count = statement.getUpdateCount(); - statement.close(); - - if (count == 0) - { - activeChar.sendMessage("Character not found!"); - } - else - { - activeChar.sendMessage("Character " + name + " jailed for " + (delay > 0 ? delay + " minutes." : "ever!")); - } - } - catch (SQLException se) - { - activeChar.sendMessage("SQLException while jailing player"); - if (Config.DEBUG) - { - se.printStackTrace(); - } - } - finally - { - try - { - con.close(); - } - catch (Exception e) - { - if (Config.DEBUG) - { - e.printStackTrace(); - } - } + private void jailOfflinePlayer(L2PcInstance activeChar, String name, int delay) { + CharacterRepository repository = DatabaseAccess.getRepository(CharacterRepository.class); + if(repository.updateJailStatusByName(name, -114356, -249645, -2984, 1, delay * 60000L) > 0) { + activeChar.sendMessage("Character " + name + " jailed for " + (delay > 0 ? delay + " minutes." : "ever!")); + } else { + activeChar.sendMessage("Character not found!"); } } - private void unjailOfflinePlayer(L2PcInstance activeChar, String name) - { - Connection con = null; - try - { - con = L2DatabaseFactory.getInstance().getConnection(); - PreparedStatement statement = con.prepareStatement("UPDATE characters SET x=?, y=?, z=?, in_jail=?, jail_timer=? WHERE char_name=?"); - statement.setInt(1, 17836); - statement.setInt(2, 170178); - statement.setInt(3, -3507); - statement.setInt(4, 0); - statement.setLong(5, 0); - statement.setString(6, name); - statement.execute(); - int count = statement.getUpdateCount(); - statement.close(); - if (count == 0) - { - activeChar.sendMessage("Character not found!"); - } - else - { - activeChar.sendMessage("Character " + name + " removed from jail"); - } - } - catch (SQLException se) - { - activeChar.sendMessage("SQLException while jailing player"); - if (Config.DEBUG) - { - se.printStackTrace(); - } - } - finally - { - try - { - con.close(); - } - catch (Exception e) - { - if (Config.DEBUG) - { - e.printStackTrace(); - } - } - } + private void unjailOfflinePlayer(L2PcInstance activeChar, String name) { + CharacterRepository repository = DatabaseAccess.getRepository(CharacterRepository.class); + if(repository.updateJailStatusByName(name, 17836, 170178, -3507, 0, 0) > 0) { + activeChar.sendMessage("Character " + name + " removed from jail"); + } else { + activeChar.sendMessage("Character not found!"); + } } @Override diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/instancemanager/CursedWeaponsManager.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/instancemanager/CursedWeaponsManager.java index bef48c66..fd244014 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/instancemanager/CursedWeaponsManager.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/instancemanager/CursedWeaponsManager.java @@ -18,12 +18,14 @@ package com.l2jbr.gameserver.instancemanager; import com.l2jbr.commons.Config; +import com.l2jbr.commons.database.DatabaseAccess; import com.l2jbr.commons.database.L2DatabaseFactory; import com.l2jbr.gameserver.model.*; import com.l2jbr.gameserver.model.actor.instance.L2FestivalMonsterInstance; import com.l2jbr.gameserver.model.actor.instance.L2PcInstance; import com.l2jbr.gameserver.model.actor.instance.L2RiftInvaderInstance; import com.l2jbr.gameserver.model.actor.instance.L2SiegeGuardInstance; +import com.l2jbr.gameserver.model.database.repository.CharacterRepository; import com.l2jbr.gameserver.network.SystemMessageId; import com.l2jbr.gameserver.serverpackets.SystemMessage; import org.slf4j.Logger; @@ -223,6 +225,8 @@ private final void controlPlayers() { PreparedStatement statement = null; ResultSet rset = null; + + CharacterRepository repository = DatabaseAccess.getRepository(CharacterRepository.class); // TODO: See comments below... // This entire for loop should NOT be necessary, since it is already handled by // CursedWeapon.endOfLife(). However, if we indeed *need* to duplicate it for safety, @@ -255,19 +259,10 @@ private final void controlPlayers() { } statement.close(); - // Delete the skill - /* - * statement = con.prepareStatement("DELETE FROM character_skills WHERE char_obj_id=? AND skill_id="); statement.setInt(1, playerId); statement.setInt(2, cw.getSkillId()); if (statement.executeUpdate() != 1) { - * _log.warn("Error while deleting cursed weapon "+itemId+" skill from userId "+playerId); } - */ - // Restore the player's old karma and pk count - statement = con.prepareStatement("UPDATE characters SET karma=?, pkkills=? WHERE obj_id=?"); - statement.setInt(1, cw.getPlayerKarma()); - statement.setInt(2, cw.getPlayerPkKills()); - statement.setInt(3, playerId); - if (statement.executeUpdate() != 1) { - _log.warn("Error while updating karma & pkkills for userId " + cw.getPlayerId()); + if(repository.updatePKAndKarma(playerId, cw.getPlayerPkKills(), cw.getPlayerKarma()) < 1){ + _log.warn("Error while updating karma & pkkills for userId {}", cw.getPlayerId()); } + // clean up the cursedweapons table. removeFromDb(itemId); } diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/CursedWeapon.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/CursedWeapon.java index 736fe9a0..604c4e58 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/CursedWeapon.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/CursedWeapon.java @@ -18,12 +18,14 @@ package com.l2jbr.gameserver.model; import com.l2jbr.commons.Config; +import com.l2jbr.commons.database.DatabaseAccess; import com.l2jbr.commons.database.L2DatabaseFactory; import com.l2jbr.commons.util.Rnd; import com.l2jbr.gameserver.ThreadPoolManager; import com.l2jbr.gameserver.datatables.SkillTable; import com.l2jbr.gameserver.instancemanager.CursedWeaponsManager; import com.l2jbr.gameserver.model.actor.instance.L2PcInstance; +import com.l2jbr.gameserver.model.database.repository.CharacterRepository; import com.l2jbr.gameserver.network.SystemMessageId; import com.l2jbr.gameserver.serverpackets.*; import com.l2jbr.gameserver.templates.L2Item; @@ -119,55 +121,25 @@ public void endOfLife() _player.broadcastUserInfo(); } - else - { + else { // Remove from Db _log.info(_name + " being removed offline."); - - Connection con = null; - try - { - con = L2DatabaseFactory.getInstance().getConnection(); - - // Delete the item - PreparedStatement statement = con.prepareStatement("DELETE FROM items WHERE owner_id=? AND item_id=?"); + CharacterRepository repository = DatabaseAccess.getRepository(CharacterRepository.class); + if(repository.updatePKAndKarma(_playerId, _playerPkKills, _playerKarma) < 1) { + _log.warn("Error while updating karma & pkkills for userId {}", _playerId); + } + + try(Connection con = L2DatabaseFactory.getInstance().getConnection(); + PreparedStatement statement = con.prepareStatement("DELETE FROM items WHERE owner_id=? AND item_id=?")) { statement.setInt(1, _playerId); statement.setInt(2, _itemId); - if (statement.executeUpdate() != 1) - { + if (statement.executeUpdate() != 1) { _log.warn("Error while deleting itemId " + _itemId + " from userId " + _playerId); } - statement.close(); - /* - * Yesod: Skill is not stored into database any more. // Delete the skill statement = con.prepareStatement("DELETE FROM character_skills WHERE char_obj_id=? AND skill_id=?"); statement.setInt(1, _playerId); statement.setInt(2, _skillId); if (statement.executeUpdate() != 1) { - * _log.warn("Error while deleting skillId "+ _skillId +" from userId "+_playerId); } - */ - // Restore the karma - statement = con.prepareStatement("UPDATE characters SET karma=?, pkkills=? WHERE obj_id=?"); - statement.setInt(1, _playerKarma); - statement.setInt(2, _playerPkKills); - statement.setInt(3, _playerId); - if (statement.executeUpdate() != 1) - { - _log.warn("Error while updating karma & pkkills for userId " + _playerId); - } - - statement.close(); } - catch (Exception e) - { + catch (Exception e) { _log.warn("Could not delete : " + e); } - finally - { - try - { - con.close(); - } - catch (Exception e) - { - } - } } } else diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/L2Clan.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/L2Clan.java index b6287d46..9bc3811b 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/L2Clan.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/L2Clan.java @@ -665,41 +665,18 @@ public void store() { } private void removeMemberInDatabase(L2ClanMember member, long clanJoinExpiryTime, long clanCreateExpiryTime) { - java.sql.Connection con = null; - try { - con = L2DatabaseFactory.getInstance().getConnection(); - PreparedStatement statement = con.prepareStatement("UPDATE characters SET clanid=0, title=?, clan_join_expiry_time=?, clan_create_expiry_time=?, clan_privs=0, wantspeace=0, subpledge=0, lvl_joined_academy=0, apprentice=0, sponsor=0 WHERE obj_Id=?"); - statement.setString(1, ""); - statement.setLong(2, clanJoinExpiryTime); - statement.setLong(3, clanCreateExpiryTime); - statement.setInt(4, member.getObjectId()); - statement.execute(); - statement.close(); - if (Config.DEBUG) { - _log.debug("clan member removed in db: " + getClanId()); - } - - statement = con.prepareStatement("UPDATE characters SET apprentice=0 WHERE apprentice=?"); - statement.setInt(1, member.getObjectId()); - statement.execute(); - statement.close(); + //TODO verify if we really need to update like this. can't we only remove on runtime when player is online? + CharacterRepository repository = DatabaseAccess.getRepository(CharacterRepository.class); + repository.findById(member.getObjectId()).ifPresent( character -> { + character.clearClanData(clanJoinExpiryTime, clanCreateExpiryTime); + repository.save(character); + }); - statement = con.prepareStatement("UPDATE characters SET sponsor=0 WHERE sponsor=?"); - statement.setInt(1, member.getObjectId()); - statement.execute(); - statement.close(); - } catch (Exception e) { - _log.warn("error while removing clan member in db " + e); - } finally { - try { - con.close(); - } catch (Exception e) { - } - } + repository.removeApprentice(member.getObjectId()); + repository.removeSponsor(member.getObjectId()); } private void restore() { - // restorewars(); java.sql.Connection con = null; try { con = L2DatabaseFactory.getInstance().getConnection(); diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/L2ClanMember.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/L2ClanMember.java index 7601b6f6..54befa77 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/L2ClanMember.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/L2ClanMember.java @@ -18,9 +18,11 @@ */ package com.l2jbr.gameserver.model; +import com.l2jbr.commons.database.DatabaseAccess; import com.l2jbr.commons.database.L2DatabaseFactory; import com.l2jbr.gameserver.instancemanager.SiegeManager; import com.l2jbr.gameserver.model.actor.instance.L2PcInstance; +import com.l2jbr.gameserver.model.database.repository.CharacterRepository; import java.sql.PreparedStatement; import java.sql.SQLException; @@ -211,33 +213,9 @@ public void setPledgeType(int pledgeType) } } - public void updatePledgeType() - { - java.sql.Connection con = null; - - try - { - con = L2DatabaseFactory.getInstance().getConnection(); - PreparedStatement statement = con.prepareStatement("UPDATE characters SET subpledge=? WHERE obj_id=?"); - statement.setLong(1, _pledgeType); - statement.setInt(2, getObjectId()); - statement.execute(); - statement.close(); - } - catch (Exception e) - { - // _log.warn("could not set char power_grade:"+e); - } - finally - { - try - { - con.close(); - } - catch (Exception e) - { - } - } + public void updatePledgeType() { + CharacterRepository repository = DatabaseAccess.getRepository(CharacterRepository.class); + repository.updateSubpledge(getObjectId(), _pledgeType); } public int getPowerGrade() @@ -270,33 +248,9 @@ public void setPowerGrade(int powerGrade) * Update the characters table of the database with power grade.
*
*/ - public void updatePowerGrade() - { - java.sql.Connection con = null; - - try - { - con = L2DatabaseFactory.getInstance().getConnection(); - PreparedStatement statement = con.prepareStatement("UPDATE characters SET power_grade=? WHERE obj_id=?"); - statement.setLong(1, _powerGrade); - statement.setInt(2, getObjectId()); - statement.execute(); - statement.close(); - } - catch (Exception e) - { - // _log.warn("could not set char power_grade:"+e); - } - finally - { - try - { - con.close(); - } - catch (Exception e) - { - } - } + public void updatePowerGrade() { + CharacterRepository repository = DatabaseAccess.getRepository(CharacterRepository.class); + repository.updatePowerGrade(getObjectId(), _powerGrade); } public void initApprenticeAndSponsor(int apprenticeID, int sponsorID) diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/actor/instance/L2PcInstance.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/actor/instance/L2PcInstance.java index fe426905..e760f1fd 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/actor/instance/L2PcInstance.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/actor/instance/L2PcInstance.java @@ -85,8 +85,6 @@ public final class L2PcInstance extends L2PlayableInstance { private static final String ADD_SKILL_SAVE = "INSERT INTO character_skills_save (char_obj_id,skill_id,skill_level,effect_count,effect_cur_time,reuse_delay,restore_type,class_index,buff_index) VALUES (?,?,?,?,?,?,?,?,?)"; private static final String RESTORE_SKILL_SAVE = "SELECT skill_id,skill_level,effect_count,effect_cur_time, reuse_delay FROM character_skills_save WHERE char_obj_id=? AND class_index=? AND restore_type=? ORDER BY buff_index ASC"; private static final String DELETE_SKILL_SAVE = "DELETE FROM character_skills_save WHERE char_obj_id=? AND class_index=?"; - private static final String UPDATE_CHARACTER = "UPDATE characters SET level=?,maxHp=?,curHp=?,maxCp=?,curCp=?,maxMp=?,curMp=?,str=?,con=?,dex=?,_int=?,men=?,wit=?,face=?,hairStyle=?,hairColor=?,heading=?,x=?,y=?,z=?,exp=?,expBeforeDeath=?,sp=?,karma=?,pvpkills=?,pkkills=?,rec_have=?,rec_left=?,clanid=?,maxload=?,race=?,classid=?,deletetime=?,title=?,accesslevel=?,online=?,isin7sdungeon=?,clan_privs=?,wantspeace=?,base_class=?,onlinetime=?,in_jail=?,jail_timer=?,newbie=?,nobless=?,power_grade=?,subpledge=?,last_recom_date=?,lvl_joined_academy=?,apprentice=?,sponsor=?,varka_ketra_ally=?,clan_join_expiry_time=?,clan_create_expiry_time=?,char_name=?,death_penalty_level=? WHERE obj_id=?"; - private static final String RESTORE_CHARACTER = "SELECT account_name, obj_Id, char_name, level, maxHp, curHp, maxCp, curCp, maxMp, curMp, acc, crit, evasion, mAtk, mDef, mSpd, pAtk, pDef, pSpd, runSpd, walkSpd, str, con, dex, _int, men, wit, face, hairStyle, hairColor, sex, heading, x, y, z, movement_multiplier, attack_speed_multiplier, colRad, colHeight, exp, expBeforeDeath, sp, karma, pvpkills, pkkills, clanid, maxload, race, classid, deletetime, cancraft, title, rec_have, rec_left, accesslevel, online, char_slot, lastAccess, clan_privs, wantspeace, base_class, onlinetime, isin7sdungeon, in_jail, jail_timer, newbie, nobless, power_grade, subpledge, last_recom_date, lvl_joined_academy, apprentice, sponsor, varka_ketra_ally,clan_join_expiry_time,clan_create_expiry_time,death_penalty_level FROM characters WHERE obj_id=?"; private static final String RESTORE_CHAR_SUBCLASSES = "SELECT class_id,exp,sp,level,class_index FROM character_subclasses WHERE char_obj_id=? ORDER BY class_index ASC"; private static final String ADD_CHAR_SUBCLASS = "INSERT INTO character_subclasses (char_obj_id,class_id,exp,sp,level,class_index) VALUES (?,?,?,?,?,?)"; private static final String UPDATE_CHAR_SUBCLASS = "UPDATE character_subclasses SET exp=?,sp=?,level=?,class_id=? WHERE char_obj_id=? AND class_index =?"; @@ -6180,48 +6178,16 @@ public void setIsIn7sDungeon(boolean isIn7sDungeon) { * Update the characters table of the database with online status and lastAccess of this L2PcInstance (called when login and logout). */ public void updateOnlineStatus() { - java.sql.Connection con = null; - - try { - con = L2DatabaseFactory.getInstance().getConnection(); - PreparedStatement statement = con.prepareStatement("UPDATE characters SET online=?, lastAccess=? WHERE obj_id=?"); - statement.setInt(1, isOnline()); - statement.setLong(2, System.currentTimeMillis()); - statement.setInt(3, getObjectId()); - statement.execute(); - statement.close(); - } catch (Exception e) { - _log.warn("could not set char online status:" + e); - } finally { - try { - con.close(); - } catch (Exception e) { - } - } + CharacterRepository repository = DatabaseAccess.getRepository(CharacterRepository.class); + repository.updateOnlineStatus(getObjectId(), isOnline(), System.currentTimeMillis()); } /** * Update is in7s dungeon status. */ public void updateIsIn7sDungeonStatus() { - java.sql.Connection con = null; - - try { - con = L2DatabaseFactory.getInstance().getConnection(); - PreparedStatement statement = con.prepareStatement("UPDATE characters SET isIn7sDungeon=?, lastAccess=? WHERE obj_id=?"); - statement.setInt(1, isIn7sDungeon() ? 1 : 0); - statement.setLong(2, System.currentTimeMillis()); - statement.setInt(3, getObjectId()); - statement.execute(); - statement.close(); - } catch (Exception e) { - _log.warn("could not set char isIn7sDungeon status:" + e); - } finally { - try { - con.close(); - } catch (Exception e) { - } - } + CharacterRepository repository = DatabaseAccess.getRepository(CharacterRepository.class); + repository.updateSevenSignsDungeonStatus(getObjectId(), isIn7sDungeon() ? 1 : 0); } /** @@ -6230,80 +6196,113 @@ public void updateIsIn7sDungeonStatus() { * @return true, if successful */ private boolean createDb() { - java.sql.Connection con = null; - try { - con = L2DatabaseFactory.getInstance().getConnection(); - PreparedStatement statement; - statement = con.prepareStatement("INSERT INTO characters " + "(account_name,obj_Id,char_name,level,maxHp,curHp,maxCp,curCp,maxMp,curMp," + "acc,crit,evasion,mAtk,mDef,mSpd,pAtk,pDef,pSpd,runSpd,walkSpd," + "str,con,dex,_int,men,wit,face,hairStyle,hairColor,sex," + "movement_multiplier,attack_speed_multiplier,colRad,colHeight," + "exp,sp,karma,pvpkills,pkkills,clanid,maxload,race,classid,deletetime," + "cancraft,title,accesslevel,online,isin7sdungeon,clan_privs,wantspeace," + "base_class,newbie,nobless,power_grade,last_recom_date) " + "values (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)"); - statement.setString(1, _accountName); - statement.setInt(2, getObjectId()); - statement.setString(3, getName()); - statement.setInt(4, getLevel()); - statement.setInt(5, getMaxHp()); - statement.setDouble(6, getCurrentHp()); - statement.setInt(7, getMaxCp()); - statement.setDouble(8, getCurrentCp()); - statement.setInt(9, getMaxMp()); - statement.setDouble(10, getCurrentMp()); - statement.setInt(11, getAccuracy()); - statement.setInt(12, getCriticalHit(null, null)); - statement.setInt(13, getEvasionRate(null)); - statement.setInt(14, getMAtk(null, null)); - statement.setInt(15, getMDef(null, null)); - statement.setInt(16, getMAtkSpd()); - statement.setInt(17, getPAtk(null)); - statement.setInt(18, getPDef(null)); - statement.setInt(19, getPAtkSpd()); - statement.setInt(20, getRunSpeed()); - statement.setInt(21, getWalkSpeed()); - statement.setInt(22, getSTR()); - statement.setInt(23, getCON()); - statement.setInt(24, getDEX()); - statement.setInt(25, getINT()); - statement.setInt(26, getMEN()); - statement.setInt(27, getWIT()); - statement.setInt(28, getAppearance().getFace()); - statement.setInt(29, getAppearance().getHairStyle()); - statement.setInt(30, getAppearance().getHairColor()); - statement.setInt(31, getAppearance().getSex() ? 1 : 0); - statement.setDouble(32, 1/* getMovementMultiplier() */); - statement.setDouble(33, 1/* getAttackSpeedMultiplier() */); - statement.setDouble(34, getTemplate().collisionRadius/* getCollisionRadius() */); - statement.setDouble(35, getTemplate().collisionHeight/* getCollisionHeight() */); - statement.setLong(36, getExp()); - statement.setInt(37, getSp()); - statement.setInt(38, getKarma()); - statement.setInt(39, getPvpKills()); - statement.setInt(40, getPkKills()); - statement.setInt(41, getClanId()); - statement.setInt(42, getMaxLoad()); - statement.setInt(43, getRace().ordinal()); - statement.setInt(44, getClassId().getId()); - statement.setLong(45, getDeleteTimer()); - statement.setInt(46, hasDwarvenCraft() ? 1 : 0); - statement.setString(47, getTitle()); - statement.setInt(48, getAccessLevel()); - statement.setInt(49, isOnline()); - statement.setInt(50, isIn7sDungeon() ? 1 : 0); - statement.setInt(51, getClanPrivileges()); - statement.setInt(52, getWantsPeace()); - statement.setInt(53, getBaseClass()); - statement.setInt(54, isNewbie() ? 1 : 0); - statement.setInt(55, isNoble() ? 1 : 0); - statement.setLong(56, 0); - statement.setLong(57, System.currentTimeMillis()); - statement.executeUpdate(); - statement.close(); - } catch (Exception e) { - _log.error("Could not insert char data: " + e); - return false; - } finally { - try { - con.close(); - } catch (Exception e) { - } + Character character = new Character(); + + character.setObjId(getObjectId()); + character.setAccountName(_accountName); + + character.setLevel((byte) getLevel()); + character.setExperience(getExp()); + character.setExpBeforeDeath(_expBeforeDeath); + character.setSkillPoint(getSp()); + + character.setMaxHp(getMaxHp()); + character.setCurrentHp((long) getCurrentHp()); + character.setMaxCp(getMaxCp()); + character.setCurrentCp((long) getCurrentCp()); + character.setMaxMp(getMaxMp()); + character.setCurrentMp((long) getCurrentMp()); + + character.setAccuracy(getAccuracy()); + character.setCritical(getCriticalHit(null, null)); + character.setEvasion(getEvasionRate(null)); + character.setMagicalAttack(getMAtk(null, null)); + character.setMagicalDefense(getMDef(null, null)); + character.setMagicalSpeed(getMAtkSpd()); + character.setPhysicalAttack(getPAtk(null)); + character.setPhysicalDefense(getPDef(null)); + character.setPhysicalSpeed(getPAtkSpd()); + character.setRunSpeed(getRunSpeed()); + character.setWalkSpeed(getWalkSpeed()); + character.setMovementMultiplier(1); + character.setAttackSpeedMultiplier(1); + character.setMaxload(getMaxLoad()); + + character.setStrength(getSTR()); + character.setConstitution(getCON()); + character.setDexterity(getDEX()); + character.setIntelligence(getINT()); + character.setMentality(getMEN()); + character.setWitness(getWIT()); + + PcAppearance appearance = getAppearance(); + + character.setFace(appearance.getFace()); + character.setHairStyle(appearance.getHairStyle()); + character.setHairColor(appearance.getHairColor()); + character.setSex(appearance.getSex() ? 1 : 0); + character.setTitle(getTitle()); + character.setCharName(getName()); + + character.setCollisionRadius(getTemplate().collisionRadius); + character.setCollisionHeight(getTemplate().collisionHeight); + + character.setHeading(getHeading()); + setCharacterPosition(character); + + character.setKarma(_karma); + character.setPvpkills(_pvpKills); + character.setPkkills(_pkKills); + + character.setRecommendHave(_recomHave); + character.setRecommendLeft(_recomLeft); + character.setLastRecommendDate(System.currentTimeMillis()); + character.setAccesslevel(getAccessLevel()); + + character.setClanid(_clanId); + character.setClanPrivileges(getClanPrivileges()); + character.setWantspeace(_wantsPeace); + character.setLvlJoinedAcademy(getLvlJoinedAcademy()); + character.setApprentice(getApprentice()); + character.setSponsor(getSponsor()); + character.setClanJoinExpiryTime(getClanJoinExpiryTime()); + character.setClanCreateExpiryTime(getClanCreateExpiryTime()); + character.setPowerGrade(0); + character.setSubpledge(getPledgeType()); + + character.setRace(getRace().ordinal()); + character.setClassid(getClassId().getId()); + character.setBaseClass(getBaseClass()); + + character.setDeletetime(getDeleteTimer()); + character.setOnline(isOnline()); + character.setIsin7sdungeon(isIn7sDungeon() ? 1 : 0); + + character.setOnlinetime(0); + character.setInJail(isInJail() ? 1 : 0); + character.setJailTimer(getJailTimer()); + character.setNewbie(isNewbie() ? 1 : 0); + character.setNobless(isNoble() ? 1 : 0); + character.setVarkaKetraAlly(getAllianceWithVarkaKetra()); + character.setDeathPenaltyLevel(getDeathPenaltyBuffLevel()); + character.setCancraft(hasDwarvenCraft() ? 1 : 0); + + CharacterRepository repository = DatabaseAccess.getRepository(CharacterRepository.class); + repository.save(character); + + return character.isPersisted(); + } + + private void setCharacterPosition(Character character) { + if(_observerMode) { + character.setX( _obsX ); + character.setY( _obsY ); + character.setZ( _obsZ ); + } else { + character.setX( getX() ); + character.setY( getY() ); + character.setZ( getZ() ); } - return true; } /** @@ -6680,103 +6679,95 @@ public synchronized void store() { * Store char base. */ private void storeCharBase() { - java.sql.Connection con = null; + // Get the exp, level, and sp of base class to store in base table + int currentClassIndex = getClassIndex(); + _classIndex = 0; + long exp = getStat().getExp(); + byte level = getStat().getLevel(); + int sp = getStat().getSp(); + _classIndex = currentClassIndex; + + Character character = new Character(); + + character.setObjId(getObjectId()); + + character.setLevel(level); + character.setExperience(exp); + character.setExpBeforeDeath(_expBeforeDeath); + character.setSkillPoint(sp); + + character.setMaxHp(getMaxHp()); + character.setCurrentHp((long) getCurrentHp()); + character.setMaxCp(getMaxCp()); + character.setCurrentCp((long) getCurrentCp()); + character.setMaxMp(getMaxMp()); + character.setCurrentMp((long) getCurrentMp()); + + character.setStrength(getSTR()); + character.setConstitution(getCON()); + character.setDexterity(getDEX()); + character.setIntelligence(getINT()); + character.setMentality(getMEN()); + character.setWitness(getWIT()); + character.setMaxload(getMaxLoad()); + + PcAppearance appearance = getAppearance(); + + character.setFace(appearance.getFace()); + character.setHairStyle(appearance.getHairStyle()); + character.setHairColor(appearance.getHairColor()); + character.setTitle(getTitle()); + character.setCharName(getName()); + + character.setHeading(getHeading()); + setCharacterPosition(character); + + character.setKarma(_karma); + character.setPvpkills(_pvpKills); + character.setPkkills(_pkKills); + + character.setRecommendHave(_recomHave); + character.setRecommendLeft(_recomLeft); + character.setLastRecommendDate(getLastRecomUpdate()); + character.setAccesslevel(getAccessLevel()); + + character.setClanid(_clanId); + character.setClanPrivileges(getClanPrivileges()); + character.setWantspeace(_wantsPeace); + character.setLvlJoinedAcademy(getLvlJoinedAcademy()); + character.setApprentice(getApprentice()); + character.setSponsor(getSponsor()); + character.setClanJoinExpiryTime(getClanJoinExpiryTime()); + character.setClanCreateExpiryTime(getClanCreateExpiryTime()); + character.setPowerGrade(getPowerGrade()); + character.setSubpledge(getPledgeType()); + + character.setRace(getRace().ordinal()); + character.setClassid(getClassId().getId()); + character.setBaseClass(getBaseClass()); + + character.setDeletetime(getDeleteTimer()); + character.setOnline(isOnline()); + character.setIsin7sdungeon(isIn7sDungeon() ? 1 : 0); + + long totalOnlineTime = _onlineTime; + + if (_onlineBeginTime > 0) { + totalOnlineTime += (System.currentTimeMillis() - _onlineBeginTime) / 1000; + } + + character.setOnlinetime(totalOnlineTime); + character.setInJail(isInJail() ? 1 : 0); + character.setJailTimer(getJailTimer()); + character.setNewbie(isNewbie() ? 1 : 0); + character.setNobless(isNoble() ? 1 : 0); + character.setVarkaKetraAlly(getAllianceWithVarkaKetra()); + character.setDeathPenaltyLevel(getDeathPenaltyBuffLevel()); + + character.setPersisted(); - try { - // Get the exp, level, and sp of base class to store in base table - int currentClassIndex = getClassIndex(); - _classIndex = 0; - long exp = getStat().getExp(); - int level = getStat().getLevel(); - int sp = getStat().getSp(); - _classIndex = currentClassIndex; - - con = L2DatabaseFactory.getInstance().getConnection(); - PreparedStatement statement; - - // Update base class - statement = con.prepareStatement(UPDATE_CHARACTER); - statement.setInt(1, level); - statement.setInt(2, getMaxHp()); - statement.setDouble(3, getCurrentHp()); - statement.setInt(4, getMaxCp()); - statement.setDouble(5, getCurrentCp()); - statement.setInt(6, getMaxMp()); - statement.setDouble(7, getCurrentMp()); - statement.setInt(8, getSTR()); - statement.setInt(9, getCON()); - statement.setInt(10, getDEX()); - statement.setInt(11, getINT()); - statement.setInt(12, getMEN()); - statement.setInt(13, getWIT()); - statement.setInt(14, getAppearance().getFace()); - statement.setInt(15, getAppearance().getHairStyle()); - statement.setInt(16, getAppearance().getHairColor()); - statement.setInt(17, getHeading()); - statement.setInt(18, _observerMode ? _obsX : getX()); - statement.setInt(19, _observerMode ? _obsY : getY()); - statement.setInt(20, _observerMode ? _obsZ : getZ()); - statement.setLong(21, exp); - statement.setLong(22, getExpBeforeDeath()); - statement.setInt(23, sp); - statement.setInt(24, getKarma()); - statement.setInt(25, getPvpKills()); - statement.setInt(26, getPkKills()); - statement.setInt(27, getRecomHave()); - statement.setInt(28, getRecomLeft()); - statement.setInt(29, getClanId()); - statement.setInt(30, getMaxLoad()); - statement.setInt(31, getRace().ordinal()); - - // if (!isSubClassActive()) - - // else - // statement.setInt(30, getBaseTemplate().race.ordinal()); - - statement.setInt(32, getClassId().getId()); - statement.setLong(33, getDeleteTimer()); - statement.setString(34, getTitle()); - statement.setInt(35, getAccessLevel()); - statement.setInt(36, isOnline()); - statement.setInt(37, isIn7sDungeon() ? 1 : 0); - statement.setInt(38, getClanPrivileges()); - statement.setInt(39, getWantsPeace()); - statement.setInt(40, getBaseClass()); - - long totalOnlineTime = _onlineTime; - - if (_onlineBeginTime > 0) { - totalOnlineTime += (System.currentTimeMillis() - _onlineBeginTime) / 1000; - } - - statement.setLong(41, totalOnlineTime); - statement.setInt(42, isInJail() ? 1 : 0); - statement.setLong(43, getJailTimer()); - statement.setInt(44, isNewbie() ? 1 : 0); - statement.setInt(45, isNoble() ? 1 : 0); - statement.setLong(46, getPowerGrade()); - statement.setInt(47, getPledgeType()); - statement.setLong(48, getLastRecomUpdate()); - statement.setInt(49, getLvlJoinedAcademy()); - statement.setLong(50, getApprentice()); - statement.setLong(51, getSponsor()); - statement.setInt(52, getAllianceWithVarkaKetra()); - statement.setLong(53, getClanJoinExpiryTime()); - statement.setLong(54, getClanCreateExpiryTime()); - statement.setString(55, getName()); - statement.setLong(56, getDeathPenaltyBuffLevel()); - statement.setInt(57, getObjectId()); - - statement.execute(); - statement.close(); - } catch (Exception e) { - _log.warn("Could not store char base data: " + e); - } finally { - try { - con.close(); - } catch (Exception e) { - } - } + CharacterRepository repository = DatabaseAccess.getRepository(CharacterRepository.class); + repository.save(character); } /** diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/Character.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/Character.java index fb20f24b..e91d1e8d 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/Character.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/Character.java @@ -15,7 +15,7 @@ public class Character extends Entity { private Byte level; private int maxHp; private long curHp; - private int maxCp; + private long maxCp; private long curCp; private int maxMp; private long curMp; @@ -154,15 +154,15 @@ public long getCurrentHp() { return curHp; } - public void setCurHp(long curHp) { + public void setCurrentHp(long curHp) { this.curHp = curHp; } - public int getMaxCp() { + public long getMaxCp() { return maxCp; } - public void setMaxCp(int maxCp) { + public void setMaxCp(long maxCp) { this.maxCp = maxCp; } @@ -170,7 +170,7 @@ public long getCurCp() { return curCp; } - public void setCurCp(long curCp) { + public void setCurrentCp(long curCp) { this.curCp = curCp; } @@ -186,7 +186,7 @@ public long getCurrentMp() { return curMp; } - public void setCurMp(long curMp) { + public void setCurrentMp(long curMp) { this.curMp = curMp; } @@ -194,7 +194,7 @@ public int getAcc() { return acc; } - public void setAcc(int acc) { + public void setAccuracy(int acc) { this.acc = acc; } @@ -202,7 +202,7 @@ public int getCrit() { return crit; } - public void setCrit(int crit) { + public void setCritical(int crit) { this.crit = crit; } @@ -218,7 +218,7 @@ public int getmAtk() { return mAtk; } - public void setmAtk(int mAtk) { + public void setMagicalAttack(int mAtk) { this.mAtk = mAtk; } @@ -226,7 +226,7 @@ public int getmDef() { return mDef; } - public void setmDef(int mDef) { + public void setMagicalDefense(int mDef) { this.mDef = mDef; } @@ -234,7 +234,7 @@ public int getmSpd() { return mSpd; } - public void setmSpd(int mSpd) { + public void setMagicalSpeed(int mSpd) { this.mSpd = mSpd; } @@ -242,7 +242,7 @@ public int getpAtk() { return pAtk; } - public void setpAtk(int pAtk) { + public void setPhysicalAttack(int pAtk) { this.pAtk = pAtk; } @@ -250,7 +250,7 @@ public int getpDef() { return pDef; } - public void setpDef(int pDef) { + public void setPhysicalDefense(int pDef) { this.pDef = pDef; } @@ -258,7 +258,7 @@ public int getpSpd() { return pSpd; } - public void setpSpd(int pSpd) { + public void setPhysicalSpeed(int pSpd) { this.pSpd = pSpd; } @@ -266,7 +266,7 @@ public int getRunSpd() { return runSpd; } - public void setRunSpd(int runSpd) { + public void setRunSpeed(int runSpd) { this.runSpd = runSpd; } @@ -274,7 +274,7 @@ public int getWalkSpd() { return walkSpd; } - public void setWalkSpd(int walkSpd) { + public void setWalkSpeed(int walkSpd) { this.walkSpd = walkSpd; } @@ -282,7 +282,7 @@ public int getStr() { return str; } - public void setStr(int str) { + public void setStrength(int str) { this.str = str; } @@ -290,7 +290,7 @@ public int getCon() { return con; } - public void setCon(int con) { + public void setConstitution(int con) { this.con = con; } @@ -298,7 +298,7 @@ public int getDex() { return dex; } - public void setDex(int dex) { + public void setDexterity(int dex) { this.dex = dex; } @@ -314,7 +314,7 @@ public int getMen() { return men; } - public void setMen(int men) { + public void setMentality(int men) { this.men = men; } @@ -322,7 +322,7 @@ public int getWit() { return wit; } - public void setWit(int wit) { + public void setWitness(int wit) { this.wit = wit; } @@ -398,7 +398,7 @@ public int getColRad() { return colRad; } - public void setColRad(int colRad) { + public void setCollisionRadius(int colRad) { this.colRad = colRad; } @@ -406,7 +406,7 @@ public int getColHeight() { return colHeight; } - public void setColHeight(int colHeight) { + public void setCollisionHeight(int colHeight) { this.colHeight = colHeight; } @@ -414,7 +414,7 @@ public long getExperience() { return exp; } - public void setExp(long exp) { + public void setExperience(long exp) { this.exp = exp; } @@ -430,7 +430,7 @@ public int getSp() { return sp; } - public void setSp(int sp) { + public void setSkillPoint(int sp) { this.sp = sp; } @@ -526,7 +526,7 @@ public int getRecHave() { return recHave; } - public void setRecHave(int recHave) { + public void setRecommendHave(int recHave) { this.recHave = recHave; } @@ -534,7 +534,7 @@ public int getRecLeft() { return recLeft; } - public void setRecLeft(int recLeft) { + public void setRecommendLeft(int recLeft) { this.recLeft = recLeft; } @@ -590,7 +590,7 @@ public int getClanPrivs() { return clanPrivs; } - public void setClanPrivs(int clanPrivs) { + public void setClanPrivileges(int clanPrivs) { this.clanPrivs = clanPrivs; } @@ -654,7 +654,7 @@ public long getLastRecomDate() { return lastRecomDate; } - public void setLastRecomDate(long lastRecomDate) { + public void setLastRecommendDate(long lastRecomDate) { this.lastRecomDate = lastRecomDate; } @@ -731,4 +731,17 @@ public void setY(int y) { public void setZ(int z) { this.z = z; } + + public void clearClanData(long clanJoinExpiryTime, long clanCreateExpiryTime) { + clanid = 0; + title = ""; + this.clanJoinExpiryTime = clanJoinExpiryTime; + this.clanCreateExpiryTime = clanCreateExpiryTime; + clanPrivs = 0; + wantspeace = 0; + subpledge = 0; + lvlJoinedAcademy = 0; + apprentice = 0; + sponsor = 0; + } } diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/repository/CharacterRepository.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/repository/CharacterRepository.java index 83f5e35b..2a545a80 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/repository/CharacterRepository.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/repository/CharacterRepository.java @@ -42,4 +42,40 @@ public interface CharacterRepository extends CrudRepository @Query("SELECT COUNT(1) FROM characters WHERE account_name=:account") int countByAccount(@Param("account") String account); + + @Query("SELECT clanid FROM characters WHERE characters.obj_Id =:objectId") + int findClanIdById(@Param("objectId") int charId); + + @Modifying + @Query("UPDATE characters SET x=:x, y=:y, z=:z, in_jail=:inJail, jail_timer=:jailTime WHERE char_name=:name") + int updateJailStatusByName(@Param("name") String charName, @Param("x") int x, @Param("y") int y, @Param("z") int z, + @Param("inJail") int inJail, @Param("jailTime") long jailTime); + + @Modifying + @Query("UPDATE characters SET apprentice=0 WHERE apprentice=:apprenticeId") + int removeApprentice(@Param("apprenticeId") int apprenticeId); + + @Modifying + @Query("UPDATE characters SET sponsor=0 WHERE sponsor=:sponsorId") + int removeSponsor(@Param("sponsorId") int sponsorId); + + @Modifying + @Query("UPDATE characters SET karma=:karma, pkkills=:pkKills WHERE obj_id=:objectId") + int updatePKAndKarma(@Param("objectId") int objectId, @Param("pkKills") int playerPkKills, @Param("karma") int playerKarma); + + @Modifying + @Query("UPDATE characters SET subpledge=:subpledge WHERE obj_id=:objectId") + void updateSubpledge(@Param("objectId") int objectId, @Param("subpledge") int subpledge); + + @Modifying + @Query("UPDATE characters SET online=:online, lastAccess=:lastAccess WHERE obj_id=:objectId") + int updateOnlineStatus(@Param("objectId") int objectId, @Param("online") int online, @Param("lastAccess") long lastAccess); + + @Modifying + @Query("UPDATE characters SET isIn7sDungeon=? WHERE obj_id=?") + int updateSevenSignsDungeonStatus(@Param("objectId") int objectId, @Param("inDungeon") int isInDungeon); + + @Modifying + @Query("UPDATE characters SET power_grade=:powerGrade WHERE obj_id=:objectId") + int updatePowerGrade(@Param("objectId") int objectId, @Param("powerGrade") int powerGrade); } diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/entity/Hero.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/entity/Hero.java index f40bddd2..fbd5eb4c 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/entity/Hero.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/entity/Hero.java @@ -24,13 +24,16 @@ package com.l2jbr.gameserver.model.entity; import com.l2jbr.commons.Config; +import com.l2jbr.commons.database.DatabaseAccess; import com.l2jbr.commons.database.L2DatabaseFactory; +import com.l2jbr.commons.util.Util; import com.l2jbr.gameserver.Olympiad; import com.l2jbr.gameserver.datatables.ClanTable; import com.l2jbr.gameserver.model.L2Clan; import com.l2jbr.gameserver.model.L2ItemInstance; import com.l2jbr.gameserver.model.L2World; import com.l2jbr.gameserver.model.actor.instance.L2PcInstance; +import com.l2jbr.gameserver.model.database.repository.CharacterRepository; import com.l2jbr.gameserver.network.SystemMessageId; import com.l2jbr.gameserver.serverpackets.InventoryUpdate; import com.l2jbr.gameserver.serverpackets.PledgeShowInfoUpdate; @@ -56,13 +59,10 @@ public class Hero private static Logger _log = LoggerFactory.getLogger(Hero.class.getName()); private static Hero _instance; - private static final String GET_HEROES = "SELECT * FROM heroes WHERE played = 1"; private static final String GET_ALL_HEROES = "SELECT * FROM heroes"; private static final String UPDATE_ALL = "UPDATE heroes SET played = 0"; private static final String INSERT_HERO = "INSERT INTO heroes VALUES (?,?,?,?,?)"; private static final String UPDATE_HERO = "UPDATE heroes SET count = ?, played = ?" + " WHERE char_id = ?"; - private static final String GET_CLAN_ALLY = "SELECT characters.clanid AS clanid, coalesce(clan_data.ally_Id, 0) AS allyId FROM characters LEFT JOIN clan_data ON clan_data.clan_id = characters.clanid " + " WHERE characters.obj_Id = ?"; - private static final String GET_CLAN_NAME = "SELECT clan_name FROM clan_data WHERE clan_id = (SELECT clanid FROM characters WHERE char_name = ?)"; private static final String DELETE_ITEMS = "DELETE FROM items WHERE item_id IN " + "(6842, 6611, 6612, 6613, 6614, 6615, 6616, 6617, 6618, 6619, 6620, 6621) " + "AND owner_id NOT IN (SELECT obj_id FROM characters WHERE accesslevel > 0)"; private static final List _heroItems = new ArrayList<>(); @@ -107,144 +107,70 @@ public Hero() init(); } - private void init() - { + private void init() { _heroes = new LinkedHashMap<>(); _completeHeroes = new LinkedHashMap<>(); - - PreparedStatement statement; - PreparedStatement statement2; - - ResultSet rset; - ResultSet rset2; - - try - { - Connection con = L2DatabaseFactory.getInstance().getConnection(); - Connection con2 = L2DatabaseFactory.getInstance().getConnection(); - statement = con.prepareStatement(GET_HEROES); - rset = statement.executeQuery(); - - while (rset.next()) - { - StatsSet hero = new StatsSet(); - int charId = rset.getInt(Olympiad.CHAR_ID); - hero.set(Olympiad.CHAR_NAME, rset.getString(Olympiad.CHAR_NAME)); - hero.set(Olympiad.CLASS_ID, rset.getInt(Olympiad.CLASS_ID)); - hero.set(COUNT, rset.getInt(COUNT)); - hero.set(PLAYED, rset.getInt(PLAYED)); - - statement2 = con2.prepareStatement(GET_CLAN_ALLY); - statement2.setInt(1, charId); - rset2 = statement2.executeQuery(); - - if (rset2.next()) - { - int clanId = rset2.getInt("clanid"); - int allyId = rset2.getInt("allyId"); - - String clanName = ""; - String allyName = ""; - int clanCrest = 0; - int allyCrest = 0; - - if (clanId > 0) - { - clanName = ClanTable.getInstance().getClan(clanId).getName(); - clanCrest = ClanTable.getInstance().getClan(clanId).getCrestId(); - - if (allyId > 0) - { - allyName = ClanTable.getInstance().getClan(clanId).getAllyName(); - allyCrest = ClanTable.getInstance().getClan(clanId).getAllyCrestId(); - } - } - - hero.set(CLAN_CREST, clanCrest); - hero.set(CLAN_NAME, clanName); - hero.set(ALLY_CREST, allyCrest); - hero.set(ALLY_NAME, allyName); - } - - rset2.close(); - statement2.close(); - - _heroes.put(charId, hero); - } - - rset.close(); - statement.close(); - - statement = con.prepareStatement(GET_ALL_HEROES); - rset = statement.executeQuery(); - - while (rset.next()) - { - StatsSet hero = new StatsSet(); - int charId = rset.getInt(Olympiad.CHAR_ID); - hero.set(Olympiad.CHAR_NAME, rset.getString(Olympiad.CHAR_NAME)); - hero.set(Olympiad.CLASS_ID, rset.getInt(Olympiad.CLASS_ID)); - hero.set(COUNT, rset.getInt(COUNT)); - hero.set(PLAYED, rset.getInt(PLAYED)); - - statement2 = con2.prepareStatement(GET_CLAN_ALLY); - statement2.setInt(1, charId); - rset2 = statement2.executeQuery(); - - if (rset2.next()) - { - int clanId = rset2.getInt("clanid"); - int allyId = rset2.getInt("allyId"); - - String clanName = ""; - String allyName = ""; - int clanCrest = 0; - int allyCrest = 0; - - if (clanId > 0) - { - clanName = ClanTable.getInstance().getClan(clanId).getName(); - clanCrest = ClanTable.getInstance().getClan(clanId).getCrestId(); - - if (allyId > 0) - { - allyName = ClanTable.getInstance().getClan(clanId).getAllyName(); - allyCrest = ClanTable.getInstance().getClan(clanId).getAllyCrestId(); - } - } - - hero.set(CLAN_CREST, clanCrest); - hero.set(CLAN_NAME, clanName); - hero.set(ALLY_CREST, allyCrest); - hero.set(ALLY_NAME, allyName); - } - - rset2.close(); - statement2.close(); - - _completeHeroes.put(charId, hero); - } - - rset.close(); - statement.close(); - - con.close(); - con2.close(); + + + try(Connection con = L2DatabaseFactory.getInstance().getConnection(); + PreparedStatement statement = con.prepareStatement(GET_ALL_HEROES); + ResultSet rset = statement.executeQuery() ) { + + CharacterRepository repository = DatabaseAccess.getRepository(CharacterRepository.class); + + while (rset.next()) { + StatsSet hero = new StatsSet(); + int charId = rset.getInt(Olympiad.CHAR_ID); + hero.set(Olympiad.CHAR_NAME, rset.getString(Olympiad.CHAR_NAME)); + hero.set(Olympiad.CLASS_ID, rset.getInt(Olympiad.CLASS_ID)); + hero.set(COUNT, rset.getInt(COUNT)); + int played = rset.getInt(PLAYED); + hero.set(PLAYED, played); + + loadClanData(repository, hero, charId); + + if(played > 0) { + _heroes.put(charId, hero); + } + _completeHeroes.put(charId, hero); + + } } - catch (SQLException e) - { + catch (SQLException e) { _log.warn("Hero System: Couldnt load Heroes"); - if (Config.DEBUG) - { - e.printStackTrace(); + if (Config.DEBUG) { + _log.error(e.getMessage(), e); } } - _log.info("Hero System: Loaded " + _heroes.size() + " Heroes."); _log.info("Hero System: Loaded " + _completeHeroes.size() + " all time Heroes."); } - - public Map getHeroes() + + private void loadClanData(CharacterRepository repository, StatsSet hero, int charId) { + String clanName = ""; + String allyName = ""; + int clanCrest = 0; + int allyCrest = 0; + int clanId = repository.findClanIdById(charId); + + if(clanId > 0) { + L2Clan clan = ClanTable.getInstance().getClan(clanId); + clanName = clan.getName(); + clanCrest = clan.getCrestId(); + + if (clan.getAllyId() > 0) { + allyName = clan.getAllyName(); + allyCrest = clan.getAllyCrestId(); + } + } + + hero.set(CLAN_CREST, clanCrest); + hero.set(CLAN_NAME, clanName); + hero.set(ALLY_CREST, allyCrest); + hero.set(ALLY_NAME, allyName); + } + + public Map getHeroes() { return _heroes; } @@ -344,7 +270,8 @@ public synchronized void computeNewHeroes(List newHeroes) } Map heroes = new LinkedHashMap<>(); - + + CharacterRepository repository = DatabaseAccess.getRepository(CharacterRepository.class); for (StatsSet hero : newHeroes) { int charId = hero.getInteger(Olympiad.CHAR_ID); @@ -368,6 +295,8 @@ public synchronized void computeNewHeroes(List newHeroes) heroes.put(charId, newHero); } + loadClanData(repository, heroes.get(charId), charId); + } deleteItemsInDb(); @@ -378,101 +307,55 @@ public synchronized void computeNewHeroes(List newHeroes) updateHeroes(false); - for (StatsSet hero : _heroes.values()) - { + for (StatsSet hero : _heroes.values()) { String name = hero.getString(Olympiad.CHAR_NAME); - L2PcInstance player = L2World.getInstance().getPlayer(name); if (player != null) { player.setHero(true); L2Clan clan = player.getClan(); - if (clan != null) - { - clan.setReputationScore(clan.getReputationScore() + 1000, true); - clan.broadcastToOnlineMembers(new PledgeShowInfoUpdate(clan)); - SystemMessage sm = new SystemMessage(SystemMessageId.CLAN_MEMBER_S1_BECAME_HERO_AND_GAINED_S2_REPUTATION_POINTS); - sm.addString(name); - sm.addNumber(1000); - clan.broadcastToOnlineMembers(sm); - } - player.sendPacket(new UserInfo(player)); + increaseClanReputation(name, clan); + player.sendPacket(new UserInfo(player)); player.broadcastUserInfo(); - } - else - { - Connection con = null; - - try - { - con = L2DatabaseFactory.getInstance().getConnection(); - PreparedStatement statement = con.prepareStatement(GET_CLAN_NAME); - statement.setString(1, name); - ResultSet rset = statement.executeQuery(); - if (rset.next()) - { - String clanName = rset.getString("clan_name"); - if (clanName != null) - { - L2Clan clan = ClanTable.getInstance().getClanByName(clanName); - if (clan != null) - { - clan.setReputationScore(clan.getReputationScore() + 1000, true); - clan.broadcastToOnlineMembers(new PledgeShowInfoUpdate(clan)); - SystemMessage sm = new SystemMessage(SystemMessageId.CLAN_MEMBER_S1_BECAME_HERO_AND_GAINED_S2_REPUTATION_POINTS); - sm.addString(name); - sm.addNumber(1000); - clan.broadcastToOnlineMembers(sm); - } - } - } - - rset.close(); - statement.close(); - } - catch (Exception e) - { - _log.warn("could not get clan name of " + name + ": " + e); - } - finally - { - try - { - con.close(); - } - catch (Exception e) - { - - } - } - } + } else { + String clanName = hero.getString(CLAN_NAME); + if (!Util.isNullOrEmpty(clanName)) { + L2Clan clan = ClanTable.getInstance().getClanByName(clanName); + increaseClanReputation(name, clan); + } + } } } + + private void increaseClanReputation(String name, L2Clan clan) { + if (clan != null) { + clan.setReputationScore(clan.getReputationScore() + 1000, true); + clan.broadcastToOnlineMembers(new PledgeShowInfoUpdate(clan)); + SystemMessage sm = new SystemMessage(SystemMessageId.CLAN_MEMBER_S1_BECAME_HERO_AND_GAINED_S2_REPUTATION_POINTS); + sm.addString(name); + sm.addNumber(1000); + clan.broadcastToOnlineMembers(sm); + } + } + - public void updateHeroes(boolean setDefault) - { - Connection con = null; - try - { - con = L2DatabaseFactory.getInstance().getConnection(); - if (setDefault) - { + public void updateHeroes(boolean setDefault) { + try(Connection con = L2DatabaseFactory.getInstance().getConnection();) { + + if (setDefault) { PreparedStatement statement = con.prepareStatement(UPDATE_ALL); statement.execute(); statement.close(); - } - else - { + } else { PreparedStatement statement; - - for (Integer heroId : _heroes.keySet()) - { + + CharacterRepository repository = DatabaseAccess.getRepository(CharacterRepository.class); + for (Integer heroId : _heroes.keySet()) { StatsSet hero = _heroes.get(heroId); - if ((_completeHeroes == null) || !_completeHeroes.containsKey(heroId)) - { + if ((_completeHeroes == null) || !_completeHeroes.containsKey(heroId)) { statement = con.prepareStatement(INSERT_HERO); statement.setInt(1, heroId); statement.setString(2, hero.getString(Olympiad.CHAR_NAME)); @@ -480,79 +363,27 @@ public void updateHeroes(boolean setDefault) statement.setInt(4, hero.getInteger(COUNT)); statement.setInt(5, hero.getInteger(PLAYED)); statement.execute(); - - Connection con2 = L2DatabaseFactory.getInstance().getConnection(); - PreparedStatement statement2 = con2.prepareStatement(GET_CLAN_ALLY); - statement2.setInt(1, heroId); - ResultSet rset2 = statement2.executeQuery(); - - if (rset2.next()) - { - int clanId = rset2.getInt("clanid"); - int allyId = rset2.getInt("allyId"); - - String clanName = ""; - String allyName = ""; - int clanCrest = 0; - int allyCrest = 0; - - if (clanId > 0) - { - clanName = ClanTable.getInstance().getClan(clanId).getName(); - clanCrest = ClanTable.getInstance().getClan(clanId).getCrestId(); - - if (allyId > 0) - { - allyName = ClanTable.getInstance().getClan(clanId).getAllyName(); - allyCrest = ClanTable.getInstance().getClan(clanId).getAllyCrestId(); - } - } - - hero.set(CLAN_CREST, clanCrest); - hero.set(CLAN_NAME, clanName); - hero.set(ALLY_CREST, allyCrest); - hero.set(ALLY_NAME, allyName); - } - - rset2.close(); - statement2.close(); - con2.close(); - - _heroes.remove(hero); + + loadClanData(repository, hero, heroId); + + _heroes.remove(heroId); _heroes.put(heroId, hero); - _completeHeroes.put(heroId, hero); - } - else - { + } else { statement = con.prepareStatement(UPDATE_HERO); statement.setInt(1, hero.getInteger(COUNT)); statement.setInt(2, hero.getInteger(PLAYED)); statement.setInt(3, heroId); statement.execute(); } - statement.close(); } } } - catch (SQLException e) - { + catch (SQLException e) { _log.warn("Hero System: Couldnt update Heroes"); - if (Config.DEBUG) - { - e.printStackTrace(); - } - } - finally - { - try - { - con.close(); - } - catch (Exception e) - { - e.printStackTrace(); + if (Config.DEBUG) { + _log.error(e.getMessage(), e); } } } diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/status/GameStatusThread.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/status/GameStatusThread.java index fc936052..1a00fd3e 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/status/GameStatusThread.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/status/GameStatusThread.java @@ -18,7 +18,7 @@ package com.l2jbr.gameserver.status; import com.l2jbr.commons.Config; -import com.l2jbr.commons.database.L2DatabaseFactory; +import com.l2jbr.commons.database.DatabaseAccess; import com.l2jbr.gameserver.*; import com.l2jbr.gameserver.Shutdown; import com.l2jbr.gameserver.cache.HtmCache; @@ -33,6 +33,7 @@ import com.l2jbr.gameserver.model.actor.instance.L2MonsterInstance; import com.l2jbr.gameserver.model.actor.instance.L2NpcInstance; import com.l2jbr.gameserver.model.actor.instance.L2PcInstance; +import com.l2jbr.gameserver.model.database.repository.CharacterRepository; import com.l2jbr.gameserver.network.SystemMessageId; import com.l2jbr.gameserver.serverpackets.CreatureSay; import com.l2jbr.gameserver.serverpackets.InventoryUpdate; @@ -43,9 +44,6 @@ import java.io.*; import java.net.InetAddress; import java.net.Socket; -import java.sql.Connection; -import java.sql.PreparedStatement; -import java.sql.SQLException; import java.text.SimpleDateFormat; import java.util.Calendar; import java.util.NoSuchElementException; @@ -912,68 +910,22 @@ else if (_usrCommand.length() == 0) } } - private void jailOfflinePlayer(String name, int delay) - { - try (Connection con = L2DatabaseFactory.getInstance().getConnection(); - PreparedStatement statement = con.prepareStatement("UPDATE characters SET x=?, y=?, z=?, in_jail=?, jail_timer=? WHERE char_name=?")) - { - statement.setInt(1, -114356); - statement.setInt(2, -249645); - statement.setInt(3, -2984); - statement.setInt(4, 1); - statement.setLong(5, delay * 60000L); - statement.setString(6, name); - statement.execute(); - - if (statement.getUpdateCount() == 0) - { - _print.println("Character not found!"); - } - else - { - _print.println("Character " + name + " jailed for " + (delay > 0 ? delay + " minutes." : "ever!")); - } - } - catch (SQLException se) - { - _print.println("SQLException while jailing player"); - if (Config.DEBUG) - { - se.printStackTrace(); - } - } + private void jailOfflinePlayer(String name, int delay) { + CharacterRepository repository = DatabaseAccess.getRepository(CharacterRepository.class); + if(repository.updateJailStatusByName(name, -114356, -249645, -2984, 1, delay * 60000L) > 0) { + _print.println("Character " + name + " jailed for " + (delay > 0 ? delay + " minutes." : "ever!")); + } else { + _print.println("Character not found!"); + } } - private void unjailOfflinePlayer(String name) - { - try (Connection con = L2DatabaseFactory.getInstance().getConnection(); - PreparedStatement statement = con.prepareStatement("UPDATE characters SET x=?, y=?, z=?, in_jail=?, jail_timer=? WHERE char_name=?")) - { - statement.setInt(1, 17836); - statement.setInt(2, 170178); - statement.setInt(3, -3507); - statement.setInt(4, 0); - statement.setLong(5, 0); - statement.setString(6, name); - statement.execute(); - - if (statement.getUpdateCount() == 0) - { - _print.println("Character not found!"); - } - else - { - _print.println("Character " + name + " set free."); - } - } - catch (SQLException se) - { - _print.println("SQLException while jailing player"); - if (Config.DEBUG) - { - se.printStackTrace(); - } - } + private void unjailOfflinePlayer(String name) { + CharacterRepository repository = DatabaseAccess.getRepository(CharacterRepository.class); + if(repository.updateJailStatusByName(name, 17836, 170178, -3507, 0, 0) > 0) { + _print.println("Character " + name + " set free."); + } else { + _print.println("Character not found!"); + } } private int getOnlineGMS() From fbafc07cae2e294f3b489cf504b2f5cb975f552e Mon Sep 17 00:00:00 2001 From: Alisson Oliveira Date: Fri, 20 Apr 2018 19:14:44 -0300 Subject: [PATCH 018/236] =?UTF-8?q?Remove=20algumas=20refer=C3=AAncias=20d?= =?UTF-8?q?iretas=20=C3=A0=20tabela=20clan=5Fdata?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../l2jbr/gameserver/SevenSignsFestival.java | 35 ++- .../l2jbr/gameserver/cache/CrestCache.java | 17 +- .../com/l2jbr/gameserver/model/L2Clan.java | 199 ++++++++---------- .../gameserver/model/database/ClanData.java | 189 +++++++++++++++-- .../repository/CharacterRepository.java | 5 +- .../database/repository/ClanRepository.java | 14 ++ .../accountmanager/SQLAccountManager.java | 47 ++--- 7 files changed, 311 insertions(+), 195 deletions(-) create mode 100644 Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/repository/ClanRepository.java diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/SevenSignsFestival.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/SevenSignsFestival.java index 16d17198..d27ba5d2 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/SevenSignsFestival.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/SevenSignsFestival.java @@ -18,6 +18,7 @@ package com.l2jbr.gameserver; import com.l2jbr.commons.Config; +import com.l2jbr.commons.database.DatabaseAccess; import com.l2jbr.commons.database.L2DatabaseFactory; import com.l2jbr.commons.util.Rnd; import com.l2jbr.gameserver.ai.CtrlIntention; @@ -30,6 +31,7 @@ import com.l2jbr.gameserver.model.actor.instance.L2NpcInstance; import com.l2jbr.gameserver.model.actor.instance.L2PcInstance; import com.l2jbr.gameserver.model.base.Experience; +import com.l2jbr.gameserver.model.database.repository.CharacterRepository; import com.l2jbr.gameserver.network.SystemMessageId; import com.l2jbr.gameserver.serverpackets.CreatureSay; import com.l2jbr.gameserver.serverpackets.MagicSkillUser; @@ -61,8 +63,6 @@ public class SevenSignsFestival implements SpawnListener { protected static final Logger _log = LoggerFactory.getLogger(SevenSignsFestival.class.getName()); private static SevenSignsFestival _instance; - private static final String GET_CLAN_NAME = "SELECT clan_name FROM clan_data WHERE clan_id = (SELECT clanid FROM characters WHERE char_name = ?)"; - /** * These length settings are important! :) All times are relative to the ELAPSED time (in ms) since a festival begins. Festival manager start is the time after the server starts to begin the first festival cycle. The cycle length should ideally be at least 2x longer than the festival length. * This allows ample time for players to sign-up to participate in the festival. The intermission is the time between the festival participants being moved to the "arenas" and the spawning of the first set of mobs. The monster swarm time is the time before the monsters swarm to the center of the @@ -3489,27 +3489,18 @@ private void addReputationPointsForPartyMemberClan(String partyMemberName) { player.getClan().broadcastToOnlineMembers(sm); } } else { - try (Connection con = L2DatabaseFactory.getInstance().getConnection(); - PreparedStatement statement = con.prepareStatement(GET_CLAN_NAME)) { - statement.setString(1, partyMemberName); - try (ResultSet rset = statement.executeQuery()) { - if (rset.next()) { - String clanName = rset.getString("clan_name"); - if (clanName != null) { - L2Clan clan = ClanTable.getInstance().getClanByName(clanName); - if (clan != null) { - clan.setReputationScore(clan.getReputationScore() + 100, true); - clan.broadcastToOnlineMembers(new PledgeShowInfoUpdate(clan)); - SystemMessage sm = new SystemMessage(SystemMessageId.CLAN_MEMBER_S1_WAS_IN_HIGHEST_RANKED_PARTY_IN_FESTIVAL_OF_DARKNESS_AND_GAINED_S2_REPUTATION); - sm.addString(partyMemberName); - sm.addNumber(100); - clan.broadcastToOnlineMembers(sm); - } - } - } + CharacterRepository repository = DatabaseAccess.getRepository(CharacterRepository.class); + int clanId = repository.findClanIdByName(partyMemberName); + if(clanId > 0) { + L2Clan clan = ClanTable.getInstance().getClan(clanId); + if (clan != null) { + clan.setReputationScore(clan.getReputationScore() + 100, true); + clan.broadcastToOnlineMembers(new PledgeShowInfoUpdate(clan)); + SystemMessage sm = new SystemMessage(SystemMessageId.CLAN_MEMBER_S1_WAS_IN_HIGHEST_RANKED_PARTY_IN_FESTIVAL_OF_DARKNESS_AND_GAINED_S2_REPUTATION); + sm.addString(partyMemberName); + sm.addNumber(100); + clan.broadcastToOnlineMembers(sm); } - } catch (Exception e) { - _log.warn("could not get clan name of " + partyMemberName + ": " + e); } } } diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/cache/CrestCache.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/cache/CrestCache.java index 08a3c459..d0072901 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/cache/CrestCache.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/cache/CrestCache.java @@ -19,17 +19,15 @@ package com.l2jbr.gameserver.cache; import com.l2jbr.commons.Config; -import com.l2jbr.commons.database.L2DatabaseFactory; +import com.l2jbr.commons.database.DatabaseAccess; import com.l2jbr.gameserver.datatables.ClanTable; import com.l2jbr.gameserver.idfactory.IdFactory; import com.l2jbr.gameserver.model.L2Clan; +import com.l2jbr.gameserver.model.database.repository.ClanRepository; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import java.io.*; -import java.sql.Connection; -import java.sql.PreparedStatement; -import java.sql.SQLException; import java.util.LinkedHashMap; import java.util.Map; @@ -130,15 +128,8 @@ public void convertOldPedgeFiles() { file.renameTo(new File(Config.DATAPACK_ROOT, "data/crests/Crest_" + newId + ".bmp")); _log.info("Renamed Clan crest to new format: Crest_" + newId + ".bmp"); - try (Connection con = L2DatabaseFactory.getInstance().getConnection(); - PreparedStatement statement = con.prepareStatement("UPDATE clan_data SET crest_id = ? WHERE clan_id = ?")) { - statement.setInt(1, newId); - statement.setInt(2, clan.getClanId()); - statement.executeUpdate(); - } catch (SQLException e) { - _log.warn("could not update the crest id:" + e.getMessage()); - } - + ClanRepository repository = DatabaseAccess.getRepository(ClanRepository.class); + repository.updateClanCrestById(clan.getClanId(), newId); clan.setCrestId(newId); clan.setHasCrest(true); } else { diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/L2Clan.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/L2Clan.java index 9bc3811b..df513ed6 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/L2Clan.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/L2Clan.java @@ -28,7 +28,9 @@ import com.l2jbr.gameserver.instancemanager.CastleManager; import com.l2jbr.gameserver.instancemanager.SiegeManager; import com.l2jbr.gameserver.model.actor.instance.L2PcInstance; +import com.l2jbr.gameserver.model.database.ClanData; import com.l2jbr.gameserver.model.database.repository.CharacterRepository; +import com.l2jbr.gameserver.model.database.repository.ClanRepository; import com.l2jbr.gameserver.network.SystemMessageId; import com.l2jbr.gameserver.serverpackets.*; import com.l2jbr.gameserver.util.Util; @@ -605,63 +607,42 @@ public boolean isMember(String name) { } public void updateClanInDB() { - java.sql.Connection con = null; - try { - con = L2DatabaseFactory.getInstance().getConnection(); - PreparedStatement statement = con.prepareStatement("UPDATE clan_data SET leader_id=?,ally_id=?,ally_name=?,reputation_score=?,ally_penalty_expiry_time=?,ally_penalty_type=?,char_penalty_expiry_time=?,dissolving_expiry_time=? WHERE clan_id=?"); - statement.setInt(1, getLeaderId()); - statement.setInt(2, getAllyId()); - statement.setString(3, getAllyName()); - statement.setInt(4, getReputationScore()); - statement.setLong(5, getAllyPenaltyExpiryTime()); - statement.setInt(6, getAllyPenaltyType()); - statement.setLong(7, getCharPenaltyExpiryTime()); - statement.setLong(8, getDissolvingExpiryTime()); - statement.setInt(9, getClanId()); - statement.execute(); - statement.close(); - if (Config.DEBUG) { - _log.debug("New clan leader saved in db: " + getClanId()); - } - } catch (Exception e) { - _log.warn("error while saving new clan leader to db " + e); - } finally { - try { - con.close(); - } catch (Exception e) { - } - } + ClanData clanData = new ClanData(); + clanData.setLeaderId(getLeaderId()); + clanData.setAllyId(getAllyId()); + clanData.setAllyName(getAllyName()); + clanData.setReputationScore(getReputationScore()); + clanData.setAllyPenaltyExpiryTime(getAllyPenaltyExpiryTime()); + clanData.setAllyPenaltyType(getAllyPenaltyType()); + clanData.setCharPenaltyExpiryTime(getCharPenaltyExpiryTime()); + clanData.setDissolvingExpiryTime(getDissolvingExpiryTime()); + clanData.setClanId(getClanId()); + clanData.setPersisted(); + + ClanRepository repository = DatabaseAccess.getRepository(ClanRepository.class); + repository.save(clanData); } public void store() { - java.sql.Connection con = null; - try { - con = L2DatabaseFactory.getInstance().getConnection(); - PreparedStatement statement = con.prepareStatement("INSERT INTO clan_data (clan_id,clan_name,clan_level,hasCastle,ally_id,ally_name,leader_id,crest_id,crest_large_id,ally_crest_id) values (?,?,?,?,?,?,?,?,?,?)"); - statement.setInt(1, getClanId()); - statement.setString(2, getName()); - statement.setInt(3, getLevel()); - statement.setInt(4, getHasCastle()); - statement.setInt(5, getAllyId()); - statement.setString(6, getAllyName()); - statement.setInt(7, getLeaderId()); - statement.setInt(8, getCrestId()); - statement.setInt(9, getCrestLargeId()); - statement.setInt(10, getAllyCrestId()); - statement.execute(); - statement.close(); - - if (Config.DEBUG) { - _log.debug("New clan saved in db: " + getClanId()); - } - } catch (Exception e) { - _log.warn("error while saving new clan to db " + e); - } finally { - try { - con.close(); - } catch (Exception e) { - } - } + ClanData clanData = new ClanData(); + clanData.setLeaderId(getLeaderId()); + clanData.setAllyId(getAllyId()); + clanData.setAllyName(getAllyName()); + clanData.setReputationScore(getReputationScore()); + clanData.setAllyPenaltyExpiryTime(getAllyPenaltyExpiryTime()); + clanData.setAllyPenaltyType(getAllyPenaltyType()); + clanData.setCharPenaltyExpiryTime(getCharPenaltyExpiryTime()); + clanData.setDissolvingExpiryTime(getDissolvingExpiryTime()); + clanData.setClanId(getClanId()); + clanData.setClanName(getName()); + clanData.setClanLevel(getLevel()); + clanData.setHasCastle(getHasCastle()); + clanData.setCrestId(getCrestId()); + clanData.setCrestLargeId(getCrestLargeId()); + clanData.setAllyCrestId(getAllyCrestId()); + + ClanRepository repository = DatabaseAccess.getRepository(ClanRepository.class); + repository.save(clanData); } private void removeMemberInDatabase(L2ClanMember member, long clanJoinExpiryTime, long clanCreateExpiryTime) { @@ -677,78 +658,66 @@ private void removeMemberInDatabase(L2ClanMember member, long clanJoinExpiryTime } private void restore() { - java.sql.Connection con = null; - try { - con = L2DatabaseFactory.getInstance().getConnection(); - PreparedStatement statement = con.prepareStatement("SELECT clan_name,clan_level,hasCastle,ally_id,ally_name,leader_id,crest_id,crest_large_id,ally_crest_id,reputation_score,auction_bid_at,ally_penalty_expiry_time,ally_penalty_type,char_penalty_expiry_time,dissolving_expiry_time FROM clan_data where clan_id=?"); - statement.setInt(1, getClanId()); - ResultSet clanData = statement.executeQuery(); - - if (clanData.next()) { - setName(clanData.getString("clan_name")); - setLevel(clanData.getInt("clan_level")); - setHasCastle(clanData.getInt("hasCastle")); - setAllyId(clanData.getInt("ally_id")); - setAllyName(clanData.getString("ally_name")); - setAllyPenaltyExpiryTime(clanData.getLong("ally_penalty_expiry_time"), clanData.getInt("ally_penalty_type")); - if (getAllyPenaltyExpiryTime() < System.currentTimeMillis()) { - setAllyPenaltyExpiryTime(0, 0); - } - setCharPenaltyExpiryTime(clanData.getLong("char_penalty_expiry_time")); - if ((getCharPenaltyExpiryTime() + (Config.ALT_CLAN_JOIN_DAYS * 86400000L)) < System.currentTimeMillis()) // 24*60*60*1000 = 86400000 - { - setCharPenaltyExpiryTime(0); - } - setDissolvingExpiryTime(clanData.getLong("dissolving_expiry_time")); + ClanRepository clanRepository = DatabaseAccess.getRepository(ClanRepository.class); + clanRepository.findById(getClanId()).ifPresent(clanData -> { - setCrestId(clanData.getInt("crest_id")); - if (getCrestId() != 0) { - setHasCrest(true); - } + setName(clanData.getClanName()); + setLevel(clanData.getClanLevel()); + setHasCastle(clanData.getHasCastle()); - setCrestLargeId(clanData.getInt("crest_large_id")); - if (getCrestLargeId() != 0) { - setHasCrestLarge(true); - } + setAllyId(clanData.getAllyId()); + setAllyName(clanData.getAllyName()); - setAllyCrestId(clanData.getInt("ally_crest_id")); - setReputationScore(clanData.getInt("reputation_score"), false); - setAuctionBiddedAt(clanData.getInt("auction_bid_at"), false); + if(clanData.getAllyPenaltyExpiryTime() < System.currentTimeMillis()) { + setAllyPenaltyExpiryTime(0, 0); + } else { + setAllyPenaltyExpiryTime(clanData.getAllyPenaltyExpiryTime(), getAllyPenaltyType()); + } - int leaderId = (clanData.getInt("leader_id")); + if((clanData.getCharPenaltyExpiryTime() + (Config.ALT_CLAN_JOIN_DAYS * 86400000L)) < System.currentTimeMillis()) { + setCharPenaltyExpiryTime(0); + } else { + setCharPenaltyExpiryTime(clanData.getCharPenaltyExpiryTime()); + } - CharacterRepository repository = DatabaseAccess.getRepository(CharacterRepository.class); - repository.findAllByClanId(getClanId()).forEach( character -> { + setDissolvingExpiryTime(clanData.getDissolvingExpiryTime()); - L2ClanMember member = new L2ClanMember(this, character.getCharName(), character.getLevel(), character.getClassId(), - character.getObjectId(), character.getSubpledge(), character.getPowerGrade(), character.getTitle()); + setCrestId(clanData.getCrestId()); + if(getCrestId() != 0) { + setHasCrest(true); + } - if (member.getObjectId() == leaderId) { - setLeader(member); - } else { - addClanMember(member); - } - member.initApprenticeAndSponsor(character.getApprentice(), character.getSponsor()); - }); + setCrestLargeId(clanData.getCrestLargeId()); + if(getCrestLargeId() != 0) { + setHasCrestLarge(true); } - clanData.close(); - statement.close(); + setAllyCrestId(clanData.getAllyCrestId()); + setReputationScore(clanData.getReputationScore(), false); + setAuctionBiddedAt(clanData.getAuctionBidAt(), false); - if (Config.DEBUG && (getName() != null)) { - _log.info("Restored clan data for \"" + getName() + "\" from database."); - } - restoreSubPledges(); - restoreRankPrivs(); - restoreSkills(); - } catch (Exception e) { - _log.warn("error while restoring clan " + e); - } finally { - try { - con.close(); - } catch (Exception e) { + CharacterRepository repository = DatabaseAccess.getRepository(CharacterRepository.class); + repository.findAllByClanId(getClanId()).forEach( character -> { + + L2ClanMember member = new L2ClanMember(this, character.getCharName(), character.getLevel(), character.getClassId(), + character.getObjectId(), character.getSubpledge(), character.getPowerGrade(), character.getTitle()); + + if (member.getObjectId() == clanData.getLeaderId()) { + setLeader(member); + } else { + addClanMember(member); + } + member.initApprenticeAndSponsor(character.getApprentice(), character.getSponsor()); + }); + + if (getName() != null) { + _log.debug("Restored clan data for {} from database.", getName()); } - } + }); + + restoreSubPledges(); + restoreRankPrivs(); + restoreSkills(); } private void restoreSkills() { diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/ClanData.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/ClanData.java index 6b1cc374..c072c8d7 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/ClanData.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/ClanData.java @@ -1,23 +1,176 @@ package com.l2jbr.gameserver.model.database; +import com.l2jbr.commons.database.annotation.Column; +import com.l2jbr.commons.database.annotation.Table; +import com.l2jbr.commons.database.model.Entity; +import org.springframework.data.annotation.Id; +@Table("clan_data") +public class ClanData extends Entity { -public class ClanData { - - private int clan_id; - private String clan_name; - private int clan_level; - private int reputation_score; - private int hasCastle; - private int ally_id; - private String ally_name; - private int leader_id; - private int crest_id; - private int crest_large_id; - private int ally_crest_id; - private int auction_bid_at; - private long ally_penalty_expiry_time; - private long ally_penalty_type; - private long char_penalty_expiry_time; - private long dissolving_expiry_time; + @Column("clan_id") + @Id + private Integer clanId; + @Column("clan_name") + private String clanName; + @Column("clan_level") + private Integer clanLevel; + @Column("reputation_score") + private Integer reputationScore; + private Integer hasCastle; + @Column("ally_id") + private Integer allyId; + @Column("ally_name") + private String allyName; + @Column("leader_id") + private Integer leaderId; + @Column("crest_id") + private Integer crestId; + @Column("crest_large_id") + private Integer crestLargeId; + @Column("ally_crest_id") + private Integer allyCrestId; + @Column("auction_bid_at") + private Integer auctionBidAt; + @Column("ally_penalty_expiry_time") + private Long allyPenaltyExpiryTime; + @Column("ally_penalty_type") + private Integer allyPenaltyType; + @Column("char_penalty_expiry_time") + private Long charPenaltyExpiryTime; + @Column("dissolving_expiry_time") + private Long dissolvingExpiryTime; + + @Override + public Integer getId() { + return clanId; + } + + public String getClanName() { + return clanName; + } + + public Integer getClanId() { + return clanId; + } + + public void setClanId(Integer clanId) { + this.clanId = clanId; + } + + public void setClanName(String clanName) { + this.clanName = clanName; + } + + public Integer getClanLevel() { + return clanLevel; + } + + public void setClanLevel(Integer clanLevel) { + this.clanLevel = clanLevel; + } + + public Integer getReputationScore() { + return reputationScore; + } + + public void setReputationScore(Integer reputationScore) { + this.reputationScore = reputationScore; + } + + public Integer getHasCastle() { + return hasCastle; + } + + public void setHasCastle(Integer hasCastle) { + this.hasCastle = hasCastle; + } + + public Integer getAllyId() { + return allyId; + } + + public void setAllyId(Integer allyId) { + this.allyId = allyId; + } + + public String getAllyName() { + return allyName; + } + + public void setAllyName(String allyName) { + this.allyName = allyName; + } + + public Integer getLeaderId() { + return leaderId; + } + + public void setLeaderId(Integer leaderId) { + this.leaderId = leaderId; + } + + public Integer getCrestId() { + return crestId; + } + + public void setCrestId(Integer crestId) { + this.crestId = crestId; + } + + public Integer getCrestLargeId() { + return crestLargeId; + } + + public void setCrestLargeId(Integer crestLargeId) { + this.crestLargeId = crestLargeId; + } + + public Integer getAllyCrestId() { + return allyCrestId; + } + + public void setAllyCrestId(Integer allyCrestId) { + this.allyCrestId = allyCrestId; + } + + public Integer getAuctionBidAt() { + return auctionBidAt; + } + + public void setAuctionBidAt(Integer auctionBidAt) { + this.auctionBidAt = auctionBidAt; + } + + public Long getAllyPenaltyExpiryTime() { + return allyPenaltyExpiryTime; + } + + public void setAllyPenaltyExpiryTime(Long allyPenaltyExpiryTime) { + this.allyPenaltyExpiryTime = allyPenaltyExpiryTime; + } + + public int getAllyPenaltyType() { + return allyPenaltyType; + } + + public void setAllyPenaltyType(int allyPenaltyType) { + this.allyPenaltyType = allyPenaltyType; + } + + public Long getCharPenaltyExpiryTime() { + return charPenaltyExpiryTime; + } + + public void setCharPenaltyExpiryTime(Long charPenaltyExpiryTime) { + this.charPenaltyExpiryTime = charPenaltyExpiryTime; + } + + public Long getDissolvingExpiryTime() { + return dissolvingExpiryTime; + } + + public void setDissolvingExpiryTime(Long dissolvingExpiryTime) { + this.dissolvingExpiryTime = dissolvingExpiryTime; + } } diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/repository/CharacterRepository.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/repository/CharacterRepository.java index 2a545a80..03439273 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/repository/CharacterRepository.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/repository/CharacterRepository.java @@ -43,7 +43,7 @@ public interface CharacterRepository extends CrudRepository @Query("SELECT COUNT(1) FROM characters WHERE account_name=:account") int countByAccount(@Param("account") String account); - @Query("SELECT clanid FROM characters WHERE characters.obj_Id =:objectId") + @Query("SELECT clanid FROM characters WHERE obj_Id =:objectId") int findClanIdById(@Param("objectId") int charId); @Modifying @@ -78,4 +78,7 @@ int updateJailStatusByName(@Param("name") String charName, @Param("x") int x, @P @Modifying @Query("UPDATE characters SET power_grade=:powerGrade WHERE obj_id=:objectId") int updatePowerGrade(@Param("objectId") int objectId, @Param("powerGrade") int powerGrade); + + @Query("SELECT clanid FROM characters WHERE char_name=:name") + int findClanIdByName(@Param("name") String name); } diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/repository/ClanRepository.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/repository/ClanRepository.java new file mode 100644 index 00000000..f98f36c0 --- /dev/null +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/repository/ClanRepository.java @@ -0,0 +1,14 @@ +package com.l2jbr.gameserver.model.database.repository; + +import com.l2jbr.gameserver.model.database.ClanData; +import org.springframework.data.jdbc.repository.query.Modifying; +import org.springframework.data.jdbc.repository.query.Query; +import org.springframework.data.repository.CrudRepository; +import org.springframework.data.repository.query.Param; + +public interface ClanRepository extends CrudRepository { + + @Modifying + @Query("UPDATE clan_data SET crest_id=:crestId WHERE clan_id=:clanId") + int updateClanCrestById(@Param("clanId") int clanId, @Param("crestId") int crestId); +} diff --git a/Tools/src/main/com.l2jbr.tools/com/l2jbr/tools/accountmanager/SQLAccountManager.java b/Tools/src/main/com.l2jbr.tools/com/l2jbr/tools/accountmanager/SQLAccountManager.java index 766bbe6f..e0648665 100644 --- a/Tools/src/main/com.l2jbr.tools/com/l2jbr/tools/accountmanager/SQLAccountManager.java +++ b/Tools/src/main/com.l2jbr.tools/com/l2jbr/tools/accountmanager/SQLAccountManager.java @@ -26,6 +26,7 @@ import com.l2jbr.commons.database.L2DatabaseFactory; import com.l2jbr.commons.database.model.Account; import com.l2jbr.gameserver.model.database.repository.CharacterRepository; +import com.l2jbr.gameserver.model.database.repository.ClanRepository; import java.io.IOException; import java.io.InputStreamReader; @@ -151,38 +152,26 @@ private static void deleteAccount(String login) throws SQLException { final Connection con = L2DatabaseFactory.getInstance().getConnection(); CharacterRepository characterRepository = DatabaseAccess.getRepository(CharacterRepository.class); - characterRepository.findAllByAccountName(login).forEach(character -> { + ClanRepository clanRepository = DatabaseAccess.getRepository(ClanRepository.class); - System.out.println("Deleting character " + character.getCharName()); - PreparedStatement statement = null; - ResultSet rcln = null; - try { - statement = con.prepareStatement("SELECT clan_name FROM clan_data WHERE leader_id=?;"); - statement.setInt(1, character.getObjectId()); - rcln = statement.executeQuery(); - if (rcln.next()) { - // Clan Leader - System.out.println("Deleting clan " + rcln.getString("clan_name") + "."); + characterRepository.findAllByAccountName(login).forEach(character -> { + final int clanId = character.getClanId(); + clanRepository.findById(clanId).ifPresent(clanData -> { - // Delete Clan Wars - statement.close(); - statement = con.prepareStatement("DELETE FROM clan_wars WHERE clan1=? OR clan2=?;"); + // Clan Leader + System.out.println("Deleting clan " + clanData.getClanName() + "."); + try { + PreparedStatement statement = con.prepareStatement("DELETE FROM clan_wars WHERE clan1=? OR clan2=?;"); statement.setEscapeProcessing(true); - statement.setString(1, rcln.getString("clan_name")); - statement.setString(2, rcln.getString("clan_name")); + statement.setString(1, clanData.getClanName()); + statement.setString(2, clanData.getClanName()); statement.executeUpdate(); - final int clanId = character.getClanId(); + // Remove All From clan characterRepository.removeClanId(clanId); - // Delete Clan - statement.close(); - statement = con.prepareStatement("DELETE FROM clan_data WHERE clan_id=?;"); - statement.setInt(1, clanId); - statement.executeUpdate(); - statement.close(); statement = con.prepareStatement("DELETE FROM clan_privs WHERE clan_id=?;"); statement.setInt(1, clanId); @@ -193,11 +182,17 @@ private static void deleteAccount(String login) throws SQLException { statement.setInt(1, clanId); statement.executeUpdate(); + clanRepository.delete(clanData); + } catch (Exception e) { + e.printStackTrace(); } - rcln.close(); + }); + + System.out.println("Deleting character " + character.getCharName()); + PreparedStatement statement = null; + ResultSet rcln = null; + try { - // skills - statement.close(); statement = con.prepareStatement("DELETE FROM character_skills WHERE char_obj_id=?;"); statement.setInt(1, character.getObjectId()); statement.executeUpdate(); From 269421bf7314566996b4291565f48125f6e084ce Mon Sep 17 00:00:00 2001 From: Alisson Oliveira Date: Sun, 22 Apr 2018 08:59:13 -0300 Subject: [PATCH 019/236] =?UTF-8?q?Remove=20refer=C3=AAncias=20diretas=20a?= =?UTF-8?q?=20tabela=20clan=5Fdata.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../RequestExSetPledgeCrestLarge.java | 37 +---- .../clientpackets/RequestSetAllyCrest.java | 35 +---- .../clientpackets/RequestSetPledgeCrest.java | 36 +---- .../gameserver/datatables/ClanTable.java | 65 +++----- .../com/l2jbr/gameserver/model/L2Clan.java | 142 ++++++++---------- .../database/repository/ClanRepository.java | 27 ++++ .../l2jbr/gameserver/model/entity/Castle.java | 58 ++----- .../resources/gameserver-messages.properties | 3 + .../gameserver-messages_pt_BR.properties | 3 + 9 files changed, 144 insertions(+), 262 deletions(-) diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/clientpackets/RequestExSetPledgeCrestLarge.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/clientpackets/RequestExSetPledgeCrestLarge.java index d8e0e875..7228727e 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/clientpackets/RequestExSetPledgeCrestLarge.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/clientpackets/RequestExSetPledgeCrestLarge.java @@ -18,19 +18,17 @@ */ package com.l2jbr.gameserver.clientpackets; -import com.l2jbr.commons.database.L2DatabaseFactory; +import com.l2jbr.commons.database.DatabaseAccess; import com.l2jbr.gameserver.cache.CrestCache; import com.l2jbr.gameserver.idfactory.IdFactory; import com.l2jbr.gameserver.model.L2Clan; import com.l2jbr.gameserver.model.actor.instance.L2PcInstance; +import com.l2jbr.gameserver.model.database.repository.ClanRepository; import com.l2jbr.gameserver.network.SystemMessageId; import com.l2jbr.gameserver.serverpackets.SystemMessage; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import java.sql.PreparedStatement; -import java.sql.SQLException; - /** * Format : chdb c (id) 0xD0 h (subid) 0x11 d data size b raw data (picture i think ;) ) @@ -120,33 +118,10 @@ protected void runImpl() { crestCache.removePledgeCrestLarge(clan.getCrestLargeId()); } - - java.sql.Connection con = null; - - try - { - con = L2DatabaseFactory.getInstance().getConnection(); - PreparedStatement statement = con.prepareStatement("UPDATE clan_data SET crest_large_id = ? WHERE clan_id = ?"); - statement.setInt(1, newId); - statement.setInt(2, clan.getClanId()); - statement.executeUpdate(); - statement.close(); - } - catch (SQLException e) - { - _log.warn("could not update the large crest id:" + e.getMessage()); - } - finally - { - try - { - con.close(); - } - catch (Exception e) - { - } - } - + + ClanRepository repository = DatabaseAccess.getRepository(ClanRepository.class); + repository.updateLargeClanCrestById(clan.getClanId(), newId); + clan.setCrestLargeId(newId); clan.setHasCrestLarge(true); diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/clientpackets/RequestSetAllyCrest.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/clientpackets/RequestSetAllyCrest.java index aa1e2846..5bd0759f 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/clientpackets/RequestSetAllyCrest.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/clientpackets/RequestSetAllyCrest.java @@ -18,18 +18,16 @@ */ package com.l2jbr.gameserver.clientpackets; -import com.l2jbr.commons.database.L2DatabaseFactory; +import com.l2jbr.commons.database.DatabaseAccess; import com.l2jbr.gameserver.cache.CrestCache; import com.l2jbr.gameserver.datatables.ClanTable; import com.l2jbr.gameserver.idfactory.IdFactory; import com.l2jbr.gameserver.model.L2Clan; import com.l2jbr.gameserver.model.actor.instance.L2PcInstance; +import com.l2jbr.gameserver.model.database.repository.ClanRepository; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import java.sql.PreparedStatement; -import java.sql.SQLException; - /** * This class ... @@ -99,32 +97,9 @@ protected void runImpl() { crestCache.removeAllyCrest(leaderclan.getAllyCrestId()); } - - java.sql.Connection con = null; - - try - { - con = L2DatabaseFactory.getInstance().getConnection(); - PreparedStatement statement = con.prepareStatement("UPDATE clan_data SET ally_crest_id = ? WHERE ally_id = ?"); - statement.setInt(1, newId); - statement.setInt(2, leaderclan.getAllyId()); - statement.executeUpdate(); - statement.close(); - } - catch (SQLException e) - { - _log.warn("could not update the ally crest id:" + e.getMessage()); - } - finally - { - try - { - con.close(); - } - catch (Exception e) - { - } - } + + ClanRepository repository = DatabaseAccess.getRepository(ClanRepository.class); + repository.updateAllyCrest(leaderclan.getAllyId(), newId); for (L2Clan clan : ClanTable.getInstance().getClans()) { diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/clientpackets/RequestSetPledgeCrest.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/clientpackets/RequestSetPledgeCrest.java index 65384a3e..171c7806 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/clientpackets/RequestSetPledgeCrest.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/clientpackets/RequestSetPledgeCrest.java @@ -18,19 +18,17 @@ */ package com.l2jbr.gameserver.clientpackets; -import com.l2jbr.commons.database.L2DatabaseFactory; +import com.l2jbr.commons.database.DatabaseAccess; import com.l2jbr.gameserver.cache.CrestCache; import com.l2jbr.gameserver.idfactory.IdFactory; import com.l2jbr.gameserver.model.L2Clan; import com.l2jbr.gameserver.model.actor.instance.L2PcInstance; +import com.l2jbr.gameserver.model.database.repository.ClanRepository; import com.l2jbr.gameserver.network.SystemMessageId; import com.l2jbr.gameserver.serverpackets.SystemMessage; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import java.sql.PreparedStatement; -import java.sql.SQLException; - /** * This class ... @@ -126,33 +124,9 @@ protected void runImpl() _log.info( "Error loading crest of clan:" + clan.getName()); return; } - - java.sql.Connection con = null; - - try - { - con = L2DatabaseFactory.getInstance().getConnection(); - PreparedStatement statement = con.prepareStatement("UPDATE clan_data SET crest_id = ? WHERE clan_id = ?"); - statement.setInt(1, newId); - statement.setInt(2, clan.getClanId()); - statement.executeUpdate(); - statement.close(); - } - catch (SQLException e) - { - _log.warn("could not update the crest id:" + e.getMessage()); - } - finally - { - try - { - con.close(); - } - catch (Exception e) - { - } - } - + + ClanRepository repository = DatabaseAccess.getRepository(ClanRepository.class); + repository.updateClanCrestById(clan.getClanId(), newId); clan.setCrestId(newId); clan.setHasCrest(true); diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/datatables/ClanTable.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/datatables/ClanTable.java index 1e1e4c11..b60fb052 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/datatables/ClanTable.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/datatables/ClanTable.java @@ -19,6 +19,7 @@ package com.l2jbr.gameserver.datatables; import com.l2jbr.commons.Config; +import com.l2jbr.commons.database.DatabaseAccess; import com.l2jbr.commons.database.L2DatabaseFactory; import com.l2jbr.gameserver.ThreadPoolManager; import com.l2jbr.gameserver.idfactory.IdFactory; @@ -26,6 +27,7 @@ import com.l2jbr.gameserver.model.L2Clan; import com.l2jbr.gameserver.model.L2ClanMember; import com.l2jbr.gameserver.model.actor.instance.L2PcInstance; +import com.l2jbr.gameserver.model.database.repository.ClanRepository; import com.l2jbr.gameserver.model.entity.Siege; import com.l2jbr.gameserver.network.SystemMessageId; import com.l2jbr.gameserver.serverpackets.*; @@ -38,6 +40,8 @@ import java.util.LinkedHashMap; import java.util.Map; +import static com.l2jbr.gameserver.util.GameserverMessages.getMessage; + /** * This class ... @@ -64,42 +68,18 @@ public L2Clan[] getClans() { private ClanTable() { _clans = new LinkedHashMap<>(); - L2Clan clan; - java.sql.Connection con = null; - try { - con = L2DatabaseFactory.getInstance().getConnection(); - PreparedStatement statement = con.prepareStatement("SELECT clan_id FROM clan_data"); - ResultSet result = statement.executeQuery(); - - // Count the clans - int clanCount = 0; - - while (result.next()) { - _clans.put(Integer.parseInt(result.getString("clan_id")), new L2Clan(Integer.parseInt(result.getString("clan_id")))); - clan = getClan(Integer.parseInt(result.getString("clan_id"))); - if (clan.getDissolvingExpiryTime() != 0) { - if (clan.getDissolvingExpiryTime() < System.currentTimeMillis()) { - destroyClan(clan.getClanId()); - } else { - scheduleRemoveClan(clan.getClanId()); - } + ClanRepository repository = DatabaseAccess.getRepository(ClanRepository.class); + repository.findAll().forEach(clanData -> { + _clans.put(clanData.getId(), new L2Clan(clanData)); + if(clanData.getDissolvingExpiryTime() !=0) { + if(clanData.getDissolvingExpiryTime() <= System.currentTimeMillis()) { + destroyClan(clanData.getId()); + } else { + scheduleRemoveClan(clanData.getId()); } - clanCount++; } - result.close(); - statement.close(); - - _log.info("Restored " + clanCount + " clans from the database."); - } catch (Exception e) { - _log.warn("data error on ClanTable: " + e); - e.printStackTrace(); - } finally { - try { - con.close(); - } catch (Exception e) { - } - } - + }); + _log.info(getMessage("info.restored.clans"), _clans.size()); restorewars(); } @@ -224,13 +204,12 @@ public synchronized void destroyClan(int clanId) { java.sql.Connection con = null; try { + ClanRepository repository = DatabaseAccess.getRepository(ClanRepository.class); + repository.deleteById(clanId); + con = L2DatabaseFactory.getInstance().getConnection(); - PreparedStatement statement = con.prepareStatement("DELETE FROM clan_data WHERE clan_id=?"); - statement.setInt(1, clanId); - statement.execute(); - statement.close(); - statement = con.prepareStatement("DELETE FROM clan_privs WHERE clan_id=?"); + PreparedStatement statement = con.prepareStatement("DELETE FROM clan_privs WHERE clan_id=?"); statement.setInt(1, clanId); statement.execute(); statement.close(); @@ -253,16 +232,14 @@ public synchronized void destroyClan(int clanId) { if (castleId != 0) { statement = con.prepareStatement("UPDATE castle SET taxPercent = 0 WHERE id = ?"); - statement.setInt(2, castleId); + statement.setInt(1, castleId); statement.execute(); statement.close(); } - if (Config.DEBUG) { - _log.debug("clan removed in db: " + clanId); - } + _log.debug(getMessage("debug.clan.removed"), clanId); } catch (Exception e) { - _log.warn("error while removing clan in db " + e); + _log.warn(getMessage("error.clan.remove"), e); } finally { try { con.close(); diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/L2Clan.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/L2Clan.java index df513ed6..4212defe 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/L2Clan.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/L2Clan.java @@ -192,7 +192,10 @@ public class L2Clan { * Called if a clan is referenced only by id. In this case all other data needs to be fetched from db * * @param clanId A valid clan Id to create and restore + * + * XXX Fetching database on constructors can lead to many issues. */ + @Deprecated(forRemoval = true) public L2Clan(int clanId) { _clanId = clanId; initializePrivs(); @@ -212,6 +215,12 @@ public L2Clan(int clanId, String clanName) { initializePrivs(); } + public L2Clan(ClanData clanData) { + restore(clanData); + initializePrivs(); + getWarehouse().restore(); + } + /** * @return Returns the clanId. */ @@ -658,63 +667,66 @@ private void removeMemberInDatabase(L2ClanMember member, long clanJoinExpiryTime } private void restore() { - ClanRepository clanRepository = DatabaseAccess.getRepository(ClanRepository.class); - clanRepository.findById(getClanId()).ifPresent(clanData -> { - - setName(clanData.getClanName()); - setLevel(clanData.getClanLevel()); - setHasCastle(clanData.getHasCastle()); + ClanRepository repository = DatabaseAccess.getRepository(ClanRepository.class); + repository.findById(_clanId).ifPresent(this::restore); + } - setAllyId(clanData.getAllyId()); - setAllyName(clanData.getAllyName()); + private void restore(ClanData clanData) { + setClanId(clanData.getId()); + setName(clanData.getClanName()); + setLevel(clanData.getClanLevel()); + setHasCastle(clanData.getHasCastle()); - if(clanData.getAllyPenaltyExpiryTime() < System.currentTimeMillis()) { - setAllyPenaltyExpiryTime(0, 0); - } else { - setAllyPenaltyExpiryTime(clanData.getAllyPenaltyExpiryTime(), getAllyPenaltyType()); - } + setAllyId(clanData.getAllyId()); + setAllyName(clanData.getAllyName()); - if((clanData.getCharPenaltyExpiryTime() + (Config.ALT_CLAN_JOIN_DAYS * 86400000L)) < System.currentTimeMillis()) { - setCharPenaltyExpiryTime(0); - } else { - setCharPenaltyExpiryTime(clanData.getCharPenaltyExpiryTime()); - } + if(clanData.getAllyPenaltyExpiryTime() < System.currentTimeMillis()) { + setAllyPenaltyExpiryTime(0, 0); + } else { + setAllyPenaltyExpiryTime(clanData.getAllyPenaltyExpiryTime(), getAllyPenaltyType()); + } - setDissolvingExpiryTime(clanData.getDissolvingExpiryTime()); + if((clanData.getCharPenaltyExpiryTime() + (Config.ALT_CLAN_JOIN_DAYS * 86400000L)) < System.currentTimeMillis()) { + setCharPenaltyExpiryTime(0); + } else { + setCharPenaltyExpiryTime(clanData.getCharPenaltyExpiryTime()); + } - setCrestId(clanData.getCrestId()); - if(getCrestId() != 0) { - setHasCrest(true); - } + setDissolvingExpiryTime(clanData.getDissolvingExpiryTime()); - setCrestLargeId(clanData.getCrestLargeId()); - if(getCrestLargeId() != 0) { - setHasCrestLarge(true); - } + setCrestId(clanData.getCrestId()); + if(getCrestId() != 0) { + setHasCrest(true); + } - setAllyCrestId(clanData.getAllyCrestId()); - setReputationScore(clanData.getReputationScore(), false); - setAuctionBiddedAt(clanData.getAuctionBidAt(), false); + setCrestLargeId(clanData.getCrestLargeId()); + if(getCrestLargeId() != 0) { + setHasCrestLarge(true); + } - CharacterRepository repository = DatabaseAccess.getRepository(CharacterRepository.class); - repository.findAllByClanId(getClanId()).forEach( character -> { + setAllyCrestId(clanData.getAllyCrestId()); + setReputationScore(clanData.getReputationScore(), false); + setAuctionBiddedAt(clanData.getAuctionBidAt(), false); - L2ClanMember member = new L2ClanMember(this, character.getCharName(), character.getLevel(), character.getClassId(), - character.getObjectId(), character.getSubpledge(), character.getPowerGrade(), character.getTitle()); + CharacterRepository repository = DatabaseAccess.getRepository(CharacterRepository.class); + repository.findAllByClanId(getClanId()).forEach( character -> { - if (member.getObjectId() == clanData.getLeaderId()) { - setLeader(member); - } else { - addClanMember(member); - } - member.initApprenticeAndSponsor(character.getApprentice(), character.getSponsor()); - }); + L2ClanMember member = new L2ClanMember(this, character.getCharName(), character.getLevel(), character.getClassId(), + character.getObjectId(), character.getSubpledge(), character.getPowerGrade(), character.getTitle()); - if (getName() != null) { - _log.debug("Restored clan data for {} from database.", getName()); + if (member.getObjectId() == clanData.getLeaderId()) { + setLeader(member); + } else { + addClanMember(member); } + member.initApprenticeAndSponsor(character.getApprentice(), character.getSponsor()); }); + if (getName() != null) { + _log.debug("Restored clan data for {} from database.", getName()); + } + + restoreSubPledges(); restoreRankPrivs(); restoreSkills(); @@ -1471,22 +1483,8 @@ public void setAuctionBiddedAt(int id, boolean storeInDb) { _auctionBiddedAt = id; if (storeInDb) { - java.sql.Connection con = null; - try { - con = L2DatabaseFactory.getInstance().getConnection(); - PreparedStatement statement = con.prepareStatement("UPDATE clan_data SET auction_bid_at=? WHERE clan_id=?"); - statement.setInt(1, id); - statement.setInt(2, getClanId()); - statement.execute(); - statement.close(); - } catch (Exception e) { - _log.warn("Could not store auction for clan: " + e); - } finally { - try { - con.close(); - } catch (Exception e) { - } - } + ClanRepository repository = DatabaseAccess.getRepository(ClanRepository.class); + repository.updateAuctionBidById(getClanId(), id); } } @@ -1924,24 +1922,8 @@ public void levelUpClan(L2PcInstance player) { } public void changeLevel(int level) { - java.sql.Connection con = null; - try { - con = L2DatabaseFactory.getInstance().getConnection(); - PreparedStatement statement = con.prepareStatement("UPDATE clan_data SET clan_level = ? WHERE clan_id = ?"); - statement.setInt(1, level); - statement.setInt(2, getClanId()); - statement.execute(); - statement.close(); - - con.close(); - } catch (Exception e) { - _log.warn("could not increase clan level:" + e); - } finally { - try { - con.close(); - } catch (Exception e) { - } - } + ClanRepository repository = DatabaseAccess.getRepository(ClanRepository.class); + repository.updateLevelById(getClanId(), level); setLevel(level); @@ -1957,13 +1939,7 @@ public void changeLevel(int level) { } } - // notify all the members about it broadcastToOnlineMembers(new SystemMessage(SystemMessageId.CLAN_LEVEL_INCREASED)); broadcastToOnlineMembers(new PledgeShowInfoUpdate(this)); - /* - * Micht : - use PledgeShowInfoUpdate instead of PledgeStatusChanged to update clan level ingame - remove broadcastClanStatus() to avoid members duplication - */ - // clan.broadcastToOnlineMembers(new PledgeStatusChanged(clan)); - // clan.broadcastClanStatus(); } } diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/repository/ClanRepository.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/repository/ClanRepository.java index f98f36c0..e873af6a 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/repository/ClanRepository.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/repository/ClanRepository.java @@ -11,4 +11,31 @@ public interface ClanRepository extends CrudRepository { @Modifying @Query("UPDATE clan_data SET crest_id=:crestId WHERE clan_id=:clanId") int updateClanCrestById(@Param("clanId") int clanId, @Param("crestId") int crestId); + + @Query("SELECT clan_id FROM clan_data WHERE hasCastle=:castle") + Integer findClanIdByCastle(@Param("castle") int castleId); + + @Modifying + @Query("UPDATE clan_data SET hasCastle=0 WHERE hasCastle=:castle") + int removeClastle(@Param("castle") int castleId); + + @Modifying + @Query("UPDATE clan_data SET hasCastle=:castle WHERE clan_id=:objectId") + int updateCastleById(@Param("objectId") int objectId, @Param("castle") int castleId); + + @Modifying + @Query("UPDATE clan_data SET auction_bid_at=:auction WHERE clan_id=objectId") + int updateAuctionBidById(@Param("objectId") int clanId, @Param("auction") int auction); + + @Modifying + @Query("UPDATE clan_data SET clan_level=:level WHERE clan_id=:objectId") + int updateLevelById(@Param("objectId") int clanId, @Param("level") int level); + + @Modifying + @Query("UPDATE clan_data SET ally_crest_id=:crest WHERE ally_id=:ally") + int updateAllyCrest(@Param("ally") int allyId, @Param("crest") int crestId); + + @Modifying + @Query("UPDATE clan_data SET crest_large_id=:crest WHERE clan_id=:objectId") + int updateLargeClanCrestById(@Param("objectId") int objectId, @Param("crest") int crestId); } diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/entity/Castle.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/entity/Castle.java index 396d3b41..8462864c 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/entity/Castle.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/entity/Castle.java @@ -19,6 +19,7 @@ package com.l2jbr.gameserver.model.entity; import com.l2jbr.commons.Config; +import com.l2jbr.commons.database.DatabaseAccess; import com.l2jbr.commons.database.L2DatabaseFactory; import com.l2jbr.gameserver.Announcements; import com.l2jbr.gameserver.CastleUpdater; @@ -35,6 +36,7 @@ import com.l2jbr.gameserver.model.L2Object; import com.l2jbr.gameserver.model.actor.instance.L2DoorInstance; import com.l2jbr.gameserver.model.actor.instance.L2PcInstance; +import com.l2jbr.gameserver.model.database.repository.ClanRepository; import com.l2jbr.gameserver.model.zone.type.L2CastleZone; import com.l2jbr.gameserver.serverpackets.PledgeShowInfoUpdate; import org.slf4j.Logger; @@ -438,15 +440,10 @@ private void load() { _taxRate = _taxPercent / 100.0; - statement = con.prepareStatement("Select clan_id from clan_data where hasCastle = ?"); - statement.setInt(1, getCastleId()); - rs = statement.executeQuery(); - - while (rs.next()) { - _ownerId = rs.getInt("clan_id"); - } - - if (getOwnerId() > 0) { + ClanRepository repository = DatabaseAccess.getRepository(ClanRepository.class); + int castleId = repository.findClanIdByCastle(getCastleId()); + if(castleId != 0) { + _ownerId = castleId; L2Clan clan = ClanTable.getInstance().getClan(getOwnerId()); // Try to find clan instance ThreadPoolManager.getInstance().scheduleGeneral(new CastleUpdater(clan, 1), 3600000); // Schedule owner tasks to start running } @@ -567,42 +564,17 @@ private void updateOwnerInDB(L2Clan clan) { _ownerId = 0; // Remove owner } - java.sql.Connection con = null; - try { - con = L2DatabaseFactory.getInstance().getConnection(); - PreparedStatement statement; + ClanRepository repository = DatabaseAccess.getRepository(ClanRepository.class); + repository.removeClastle(getCastleId()); + repository.updateCastleById(getOwnerId(), getCastleId()); - // ============================================================================ - // NEED TO REMOVE HAS CASTLE FLAG FROM CLAN_DATA - // SHOULD BE CHECKED FROM CASTLE TABLE - statement = con.prepareStatement("UPDATE clan_data SET hasCastle=0 WHERE hasCastle=?"); - statement.setInt(1, getCastleId()); - statement.execute(); - statement.close(); - - statement = con.prepareStatement("UPDATE clan_data SET hasCastle=? WHERE clan_id=?"); - statement.setInt(1, getCastleId()); - statement.setInt(2, getOwnerId()); - statement.execute(); - statement.close(); - // ============================================================================ - - // Announce to clan memebers - if (clan != null) { - clan.setHasCastle(getCastleId()); // Set has castle flag for new owner - new Announcements().announceToAll(clan.getName() + " has taken " + getName() + " castle!"); - clan.broadcastToOnlineMembers(new PledgeShowInfoUpdate(clan)); + // Announce to clan memebers + if (clan != null) { + clan.setHasCastle(getCastleId()); // Set has castle flag for new owner + new Announcements().announceToAll(clan.getName() + " has taken " + getName() + " castle!"); + clan.broadcastToOnlineMembers(new PledgeShowInfoUpdate(clan)); - ThreadPoolManager.getInstance().scheduleGeneral(new CastleUpdater(clan, 1), 3600000); // Schedule owner tasks to start running - } - } catch (Exception e) { - System.out.println("Exception: updateOwnerInDB(L2Clan clan): " + e.getMessage()); - e.printStackTrace(); - } finally { - try { - con.close(); - } catch (Exception e) { - } + ThreadPoolManager.getInstance().scheduleGeneral(new CastleUpdater(clan, 1), 3600000); // Schedule owner tasks to start running } } diff --git a/Gameserver/src/main/resources/gameserver-messages.properties b/Gameserver/src/main/resources/gameserver-messages.properties index 343f367b..99d34954 100644 --- a/Gameserver/src/main/resources/gameserver-messages.properties +++ b/Gameserver/src/main/resources/gameserver-messages.properties @@ -23,3 +23,6 @@ error.script.not.loaded=Script Loading Failed: {0} debug.parsing.event=Parsing {0} Event info.event.passed={0} has passed... Ignored." info.engine.register=Scripting language {0} registered to file extensions {1}. +info.restored.clans=Restored {} clans from the database. +debug.clan.removed=clan removed from database: {} +error.clan.remove=Error while removing clan from database. diff --git a/Gameserver/src/main/resources/gameserver-messages_pt_BR.properties b/Gameserver/src/main/resources/gameserver-messages_pt_BR.properties index 8c7d7510..e90f7c79 100644 --- a/Gameserver/src/main/resources/gameserver-messages_pt_BR.properties +++ b/Gameserver/src/main/resources/gameserver-messages_pt_BR.properties @@ -23,3 +23,6 @@ error.script.not.loaded=Falha ao carregar script: {0} debug.parsing.event=Analizando Evento {0} info.event.passed=O {0} acabou... Ignorado. info.engine.register=Linguagem {0} registrada para arquivos com extens\u00F5es {1}. +info.restored.clans={} clans restaurados do banco de dados. +debug.clan.removed=clan removido do banco de dados: {} +error.clan.remove=Erro removendo clan do banco de dados. From b3d30a71c8f89ee914dedc76359485a2e4b60989 Mon Sep 17 00:00:00 2001 From: Alisson Oliveira Date: Sun, 22 Apr 2018 10:11:06 -0300 Subject: [PATCH 020/236] =?UTF-8?q?Remove=20refer=C3=AAncias=20diretas=20a?= =?UTF-8?q?=20tabela=20clanhall.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../instancemanager/ClanHallManager.java | 69 ++++++++----------- .../gameserver/model/database/ClanHall.java | 16 ----- .../model/database/ClanHallData.java | 56 +++++++++++++++ .../repository/ClanHallRepository.java | 14 ++++ .../gameserver/model/entity/ClanHall.java | 29 ++------ .../resources/gameserver-messages.properties | 2 + .../gameserver-messages_pt_BR.properties | 2 + 7 files changed, 107 insertions(+), 81 deletions(-) delete mode 100644 Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/ClanHall.java create mode 100644 Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/ClanHallData.java create mode 100644 Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/repository/ClanHallRepository.java diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/instancemanager/ClanHallManager.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/instancemanager/ClanHallManager.java index 83b31225..6a0507bd 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/instancemanager/ClanHallManager.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/instancemanager/ClanHallManager.java @@ -17,21 +17,26 @@ */ package com.l2jbr.gameserver.instancemanager; -import com.l2jbr.commons.database.L2DatabaseFactory; +import com.l2jbr.commons.database.DatabaseAccess; import com.l2jbr.gameserver.datatables.ClanTable; import com.l2jbr.gameserver.model.L2Clan; +import com.l2jbr.gameserver.model.database.repository.ClanHallRepository; import com.l2jbr.gameserver.model.entity.ClanHall; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; -import java.sql.PreparedStatement; -import java.sql.ResultSet; import java.util.LinkedHashMap; import java.util.Map; +import static com.l2jbr.gameserver.util.GameserverMessages.getMessage; + /** * @author Steuf */ public class ClanHallManager { + + private Logger logger = LoggerFactory.getLogger(ClanHallManager.class); private static ClanHallManager _instance; private final Map _clanHall; @@ -61,47 +66,29 @@ private ClanHallManager() { * public final void reload() Cant reload atm - would loose zone info { _clanHall.clear(); _freeClanHall.clear(); load(); } */ - /** - * Load All Clan Hall - */ - private final void load() { - java.sql.Connection con = null; - try { - int id; - PreparedStatement statement; - ResultSet rs; - con = L2DatabaseFactory.getInstance().getConnection(); - statement = con.prepareStatement("SELECT * FROM clanhall ORDER BY id"); - rs = statement.executeQuery(); - while (rs.next()) { - id = rs.getInt("id"); - if (rs.getInt("ownerId") == 0) { - _freeClanHall.put(id, new ClanHall(id, rs.getString("name"), rs.getInt("ownerId"), rs.getInt("lease"), rs.getString("desc"), rs.getString("location"), 0, rs.getInt("Grade"), rs.getBoolean("paid"))); + private void load() { + ClanHallRepository repository = DatabaseAccess.getRepository(ClanHallRepository.class); + repository.findAll().forEach(clanHall -> { + int id = clanHall.getId(); + if (clanHall.getOwnerId() == 0) { + _freeClanHall.put(id, new ClanHall(id, clanHall.getName(), clanHall.getOwnerId(), clanHall.getLease(), + clanHall.getDesc(), clanHall.getLocation(), 0, clanHall.getGrade(), clanHall.getPaid() == 1)); + } else { + if (ClanTable.getInstance().getClan(clanHall.getOwnerId()) != null) { + _clanHall.put(id, new ClanHall(id, clanHall.getName(), clanHall.getOwnerId(), clanHall.getLease(), clanHall.getDesc(), + clanHall.getLocation(), clanHall.getPaidUntil(), clanHall.getGrade(), clanHall.getPaid() == 1)); + ClanTable.getInstance().getClan(clanHall.getOwnerId()).setHasHideout(id); } else { - if (ClanTable.getInstance().getClan(rs.getInt("ownerId")) != null) { - _clanHall.put(id, new ClanHall(id, rs.getString("name"), rs.getInt("ownerId"), rs.getInt("lease"), rs.getString("desc"), rs.getString("location"), rs.getLong("paidUntil"), rs.getInt("Grade"), rs.getBoolean("paid"))); - ClanTable.getInstance().getClan(rs.getInt("ownerId")).setHasHideout(id); - } else { - _freeClanHall.put(id, new ClanHall(id, rs.getString("name"), rs.getInt("ownerId"), rs.getInt("lease"), rs.getString("desc"), rs.getString("location"), rs.getLong("paidUntil"), rs.getInt("Grade"), rs.getBoolean("paid"))); - _freeClanHall.get(id).free(); - AuctionManager.getInstance().initNPC(id); - } - + _freeClanHall.put(id, new ClanHall(id, clanHall.getName(), clanHall.getOwnerId(), clanHall.getLease(), + clanHall.getDesc(), clanHall.getLocation(), 0, clanHall.getGrade(), clanHall.getPaid() == 1)); + _freeClanHall.get(id).free(); + AuctionManager.getInstance().initNPC(id); } } - statement.close(); - System.out.println("Loaded: " + getClanHalls().size() + " clan halls"); - System.out.println("Loaded: " + getFreeClanHalls().size() + " free clan halls"); - _loaded = true; - } catch (Exception e) { - System.out.println("Exception: ClanHallManager.load(): " + e.getMessage()); - e.printStackTrace(); - } finally { - try { - con.close(); - } catch (Exception e) { - } - } + }); + logger.info(getMessage("info.loaded.clanhall"), getClanHalls().size()); + logger.info(getMessage("info.loaded.free.clanhall"), getFreeClanHalls().size()); + _loaded = true; } /** diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/ClanHall.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/ClanHall.java deleted file mode 100644 index fac6286a..00000000 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/ClanHall.java +++ /dev/null @@ -1,16 +0,0 @@ -package com.l2jbr.gameserver.model.database; - - - -public class ClanHall { - - private int id; - private String name; - private int ownerId; - private int lease; - private String desctext; - private String location; - private long paidUntil; - private int Grade; - private int paid; -} diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/ClanHallData.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/ClanHallData.java new file mode 100644 index 00000000..c38a1159 --- /dev/null +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/ClanHallData.java @@ -0,0 +1,56 @@ +package com.l2jbr.gameserver.model.database; + + +import com.l2jbr.commons.database.model.Entity; +import org.springframework.data.annotation.Id; + +public class ClanHallData extends Entity { + + @Id + private Integer id; + private String name; + private Integer ownerId; + private Integer lease; + private String desc; + private String location; + private Long paidUntil; + private Integer Grade; + private Integer paid; + + @Override + public Integer getId() { + return id; + } + + public Integer getOwnerId() { + return ownerId; + } + + public String getName() { + return name; + } + + public Integer getLease() { + return lease; + } + + public String getDesc() { + return desc; + } + + public String getLocation() { + return location; + } + + public Long getPaidUntil() { + return paidUntil; + } + + public Integer getGrade() { + return Grade; + } + + public Integer getPaid() { + return paid; + } +} diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/repository/ClanHallRepository.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/repository/ClanHallRepository.java new file mode 100644 index 00000000..7e4bc514 --- /dev/null +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/repository/ClanHallRepository.java @@ -0,0 +1,14 @@ +package com.l2jbr.gameserver.model.database.repository; + +import com.l2jbr.gameserver.model.database.ClanHallData; +import org.springframework.data.jdbc.repository.query.Modifying; +import org.springframework.data.jdbc.repository.query.Query; +import org.springframework.data.repository.CrudRepository; +import org.springframework.data.repository.query.Param; + +public interface ClanHallRepository extends CrudRepository { + + @Modifying + @Query("UPDATE clanhall SET ownerId=:owner, paidUntil=:paidUntil, paid=:paid WHERE id=:id") + int updateOwner(@Param("id") int clanHallId, @Param("owner") int ownerId, @Param("paidUntil") long paidUntil, @Param("paid") int paid); +} diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/entity/ClanHall.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/entity/ClanHall.java index 674d0e6c..f4a31ab2 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/entity/ClanHall.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/entity/ClanHall.java @@ -19,6 +19,7 @@ package com.l2jbr.gameserver.model.entity; import com.l2jbr.commons.Config; +import com.l2jbr.commons.database.DatabaseAccess; import com.l2jbr.commons.database.L2DatabaseFactory; import com.l2jbr.gameserver.GameServer; import com.l2jbr.gameserver.ThreadPoolManager; @@ -29,6 +30,7 @@ import com.l2jbr.gameserver.model.L2Clan; import com.l2jbr.gameserver.model.actor.instance.L2DoorInstance; import com.l2jbr.gameserver.model.actor.instance.L2PcInstance; +import com.l2jbr.gameserver.model.database.repository.ClanHallRepository; import com.l2jbr.gameserver.model.zone.type.L2ClanHallZone; import com.l2jbr.gameserver.network.SystemMessageId; import com.l2jbr.gameserver.serverpackets.PledgeShowInfoUpdate; @@ -585,31 +587,10 @@ public boolean updateFunctions(int type, int lvl, int lease, long rate, boolean return true; } - /** - * Update DB - */ - public void updateDb() { - java.sql.Connection con = null; - try { - con = L2DatabaseFactory.getInstance().getConnection(); - PreparedStatement statement; - statement = con.prepareStatement("UPDATE clanhall SET ownerId=?, paidUntil=?, paid=? WHERE id=?"); - statement.setInt(1, _ownerId); - statement.setLong(2, _paidUntil); - statement.setInt(3, (_paid) ? 1 : 0); - statement.setInt(4, _clanHallId); - statement.execute(); - statement.close(); - } catch (Exception e) { - System.out.println("Exception: updateOwnerInDB(L2Clan clan): " + e.getMessage()); - e.printStackTrace(); - } finally { - try { - con.close(); - } catch (Exception e) { - } - } + public void updateDb() { + ClanHallRepository repository = DatabaseAccess.getRepository(ClanHallRepository.class); + repository.updateOwner(_clanHallId, _ownerId, _paidUntil, _paid ? 1 : 0); } /** diff --git a/Gameserver/src/main/resources/gameserver-messages.properties b/Gameserver/src/main/resources/gameserver-messages.properties index 99d34954..5ac30792 100644 --- a/Gameserver/src/main/resources/gameserver-messages.properties +++ b/Gameserver/src/main/resources/gameserver-messages.properties @@ -26,3 +26,5 @@ info.engine.register=Scripting language {0} registered to file extensions {1}. info.restored.clans=Restored {} clans from the database. debug.clan.removed=clan removed from database: {} error.clan.remove=Error while removing clan from database. +info.loaded.clanhall=Loaded {} clan halls. +info.loaded.free.clanhall=Loaded {} free clan halls. diff --git a/Gameserver/src/main/resources/gameserver-messages_pt_BR.properties b/Gameserver/src/main/resources/gameserver-messages_pt_BR.properties index e90f7c79..56081fe1 100644 --- a/Gameserver/src/main/resources/gameserver-messages_pt_BR.properties +++ b/Gameserver/src/main/resources/gameserver-messages_pt_BR.properties @@ -26,3 +26,5 @@ info.engine.register=Linguagem {0} registrada para arquivos com extens\u00F5es { info.restored.clans={} clans restaurados do banco de dados. debug.clan.removed=clan removido do banco de dados: {} error.clan.remove=Erro removendo clan do banco de dados. +info.loaded.clanhall={} Clan Halls carregados. +info.loaded.free.clanhall={} Clan halls livres carregados. From 4552f42c60148948562fc983f28a80234b6a9e22 Mon Sep 17 00:00:00 2001 From: Alisson Oliveira Date: Sun, 22 Apr 2018 18:49:22 -0300 Subject: [PATCH 021/236] =?UTF-8?q?Remove=20refer=C3=AAncias=20diretas=20?= =?UTF-8?q?=C3=A0=20tabela=20auction.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../instancemanager/AuctionManager.java | 33 +-- .../gameserver/model/database/Auction.java | 19 -- .../model/database/AuctionData.java | 119 ++++++++++ .../repository/AuctionRepository.java | 18 ++ .../gameserver/model/entity/Auction.java | 204 +++++++----------- 5 files changed, 220 insertions(+), 173 deletions(-) delete mode 100644 Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/Auction.java create mode 100644 Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/AuctionData.java create mode 100644 Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/repository/AuctionRepository.java diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/instancemanager/AuctionManager.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/instancemanager/AuctionManager.java index 44ae12d7..a671716e 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/instancemanager/AuctionManager.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/instancemanager/AuctionManager.java @@ -17,7 +17,9 @@ */ package com.l2jbr.gameserver.instancemanager; +import com.l2jbr.commons.database.DatabaseAccess; import com.l2jbr.commons.database.L2DatabaseFactory; +import com.l2jbr.gameserver.model.database.repository.AuctionRepository; import com.l2jbr.gameserver.model.entity.Auction; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -32,6 +34,7 @@ public class AuctionManager { protected static final Logger _log = LoggerFactory.getLogger(AuctionManager.class.getName()); private static AuctionManager _instance; private final List _auctions; + private static final String[] ITEM_INIT_DATA = { "(23, 0, 'NPC', 'NPC Clan', 'ClanHall', 23, 0, 'Onyx Hall', 1, 20000000, 0, 1164841200000)", "(24, 0, 'NPC', 'NPC Clan', 'ClanHall', 24, 0, 'Topaz Hall', 1, 20000000, 0, 1164841200000)", @@ -119,7 +122,7 @@ public static final AuctionManager getInstance() { return _instance; } - public AuctionManager() { + private AuctionManager() { _auctions = new LinkedList<>(); load(); } @@ -130,27 +133,10 @@ public void reload() { } private final void load() { - java.sql.Connection con = null; - try { - PreparedStatement statement; - ResultSet rs; - con = L2DatabaseFactory.getInstance().getConnection(); - statement = con.prepareStatement("SELECT id FROM auction ORDER BY id"); - rs = statement.executeQuery(); - while (rs.next()) { - _auctions.add(new Auction(rs.getInt("id"))); - } - statement.close(); - System.out.println("Loaded: " + getAuctions().size() + " auction(s)"); - } catch (Exception e) { - System.out.println("Exception: AuctionManager.load(): " + e.getMessage()); - e.printStackTrace(); - } finally { - try { - con.close(); - } catch (Exception e) { - } - } + AuctionRepository repository = DatabaseAccess.getRepository(AuctionRepository.class); + repository.findAll().forEach(auctionData -> { + _auctions.add(new Auction(auctionData)); + }); } public final Auction getAuction(int auctionId) { @@ -180,7 +166,10 @@ public final List getAuctions() { * Init Clan NPC auction * * @param id + * + * XXX This doesn't make any sense, since we have these data on Database and all of it is loaded on Constructor. */ + @Deprecated(forRemoval = true) public void initNPC(int id) { java.sql.Connection con = null; int i = 0; diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/Auction.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/Auction.java deleted file mode 100644 index 151007be..00000000 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/Auction.java +++ /dev/null @@ -1,19 +0,0 @@ -package com.l2jbr.gameserver.model.database; - - - -public class Auction { - - private int id; - private int sellerId; - private String sellerName; - private String sellerClanName; - private String itemType; - private int itemId; - private int itemObjectId; - private String itemName; - private int itemQuantity; - private int startingBid; - private int currentBid; - private long endDate; -} diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/AuctionData.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/AuctionData.java new file mode 100644 index 00000000..3675acdc --- /dev/null +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/AuctionData.java @@ -0,0 +1,119 @@ +package com.l2jbr.gameserver.model.database; + + +import com.l2jbr.commons.database.model.Entity; +import org.springframework.data.annotation.Id; + +public class AuctionData extends Entity { + + @Id + private Integer id; + private Integer sellerId; + private String sellerName; + private String sellerClanName; + private String itemType; + private Integer itemId; + private Integer itemObjectId; + private String itemName; + private Integer itemQuantity; + private Integer startingBid; + private Integer currentBid; + private Long endDate; + + @Override + public Integer getId() { + return id; + } + + public void setId(Integer id) { + this.id = id; + } + + public void setSellerId(Integer sellerId) { + this.sellerId = sellerId; + } + + public void setSellerName(String sellerName) { + this.sellerName = sellerName; + } + + public void setSellerClanName(String sellerClanName) { + this.sellerClanName = sellerClanName; + } + + public void setItemType(String itemType) { + this.itemType = itemType; + } + + public void setItemId(Integer itemId) { + this.itemId = itemId; + } + + public void setItemObjectId(Integer itemObjectId) { + this.itemObjectId = itemObjectId; + } + + public void setItemName(String itemName) { + this.itemName = itemName; + } + + public void setItemQuantity(Integer itemQuantity) { + this.itemQuantity = itemQuantity; + } + + public void setStartingBid(Integer startingBid) { + this.startingBid = startingBid; + } + + public void setCurrentBid(Integer currentBid) { + this.currentBid = currentBid; + } + + public void setEndDate(Long endDate) { + this.endDate = endDate; + } + + public Integer getSellerId() { + return sellerId; + } + + public String getSellerName() { + return sellerName; + } + + public String getSellerClanName() { + return sellerClanName; + } + + public String getItemType() { + return itemType; + } + + public Integer getItemId() { + return itemId; + } + + public Integer getItemObjectId() { + return itemObjectId; + } + + public String getItemName() { + return itemName; + } + + public Integer getItemQuantity() { + return itemQuantity; + } + + public Integer getStartingBid() { + return startingBid; + } + + public Integer getCurrentBid() { + return currentBid; + } + + public Long getEndDate() { + return endDate; + } +} diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/repository/AuctionRepository.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/repository/AuctionRepository.java new file mode 100644 index 00000000..d1647904 --- /dev/null +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/repository/AuctionRepository.java @@ -0,0 +1,18 @@ +package com.l2jbr.gameserver.model.database.repository; + +import com.l2jbr.gameserver.model.database.AuctionData; +import org.springframework.data.jdbc.repository.query.Modifying; +import org.springframework.data.jdbc.repository.query.Query; +import org.springframework.data.repository.CrudRepository; +import org.springframework.data.repository.query.Param; + +public interface AuctionRepository extends CrudRepository { + + @Modifying + @Query("UPDATE auction SET endDate=:endDate WHERE id=:id") + int updateEndDateById(@Param("id") int id, @Param("endDate") long endDate); + + @Modifying + @Query("DELETE FROM auction WHERE itemId=:itemId") + int deleteByItemId(@Param("itemId") int itemId); +} diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/entity/Auction.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/entity/Auction.java index 2efbe5f6..e9ff0add 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/entity/Auction.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/entity/Auction.java @@ -18,6 +18,7 @@ */ package com.l2jbr.gameserver.model.entity; +import com.l2jbr.commons.database.DatabaseAccess; import com.l2jbr.commons.database.L2DatabaseFactory; import com.l2jbr.gameserver.GameServer; import com.l2jbr.gameserver.ThreadPoolManager; @@ -28,6 +29,8 @@ import com.l2jbr.gameserver.model.L2Clan; import com.l2jbr.gameserver.model.L2World; import com.l2jbr.gameserver.model.actor.instance.L2PcInstance; +import com.l2jbr.gameserver.model.database.AuctionData; +import com.l2jbr.gameserver.model.database.repository.AuctionRepository; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -63,14 +66,43 @@ public class Auction { "ClanHall" }; + /** + * Constructor + * + * @param auctionId + */ + @Deprecated(forRemoval = true) + public Auction(int auctionId) { + _id = auctionId; + load(); + startAutoTask(); + } + + public Auction(int itemId, L2Clan Clan, long delay, int bid, String name) { + _id = itemId; + _endDate = System.currentTimeMillis() + delay; + _itemId = itemId; + _itemName = name; + _itemType = "ClanHall"; + _sellerId = Clan.getLeaderId(); + _sellerName = Clan.getLeaderName(); + _sellerClanName = Clan.getName(); + _startingBid = bid; + } + + public Auction(AuctionData auctionData) { + load(auctionData); + startAutoTask(); + } public static enum ItemTypeEnum { ClanHall - } + } public class Bidder { private final String _name; private final String _clanName; private int _bid; + private final Calendar _timeBid; public Bidder(String name, String clanName, int bid, long timeBid) { @@ -100,19 +132,18 @@ public Calendar getTimeBid() { public void setTimeBid(long timeBid) { _timeBid.setTimeInMillis(timeBid); } - public void setBid(int bid) { _bid = bid; } - } + } /** * Task Sheduler for endAuction */ public class AutoEndTask implements Runnable { + public AutoEndTask() { } - @Override public void run() { try { @@ -122,67 +153,23 @@ public void run() { } } - /** - * Constructor - * - * @param auctionId - */ - public Auction(int auctionId) { - _id = auctionId; - load(); - startAutoTask(); - } - - public Auction(int itemId, L2Clan Clan, long delay, int bid, String name) { - _id = itemId; - _endDate = System.currentTimeMillis() + delay; - _itemId = itemId; - _itemName = name; - _itemType = "ClanHall"; - _sellerId = Clan.getLeaderId(); - _sellerName = Clan.getLeaderName(); - _sellerClanName = Clan.getName(); - _startingBid = bid; - } - - /** - * Load auctions - */ private void load() { - java.sql.Connection con = null; - try { - PreparedStatement statement; - ResultSet rs; - - con = L2DatabaseFactory.getInstance().getConnection(); - - statement = con.prepareStatement("Select * from auction where id = ?"); - statement.setInt(1, getId()); - rs = statement.executeQuery(); - - while (rs.next()) { - _currentBid = rs.getInt("currentBid"); - _endDate = rs.getLong("endDate"); - _itemId = rs.getInt("itemId"); - _itemName = rs.getString("itemName"); - _itemObjectId = rs.getInt("itemObjectId"); - _itemType = rs.getString("itemType"); - _sellerId = rs.getInt("sellerId"); - _sellerClanName = rs.getString("sellerClanName"); - _sellerName = rs.getString("sellerName"); - _startingBid = rs.getInt("startingBid"); - } - statement.close(); - loadBid(); - } catch (Exception e) { - System.out.println("Exception: Auction.load(): " + e.getMessage()); - e.printStackTrace(); - } finally { - try { - con.close(); - } catch (Exception e) { - } - } + AuctionRepository repository = DatabaseAccess.getRepository(AuctionRepository.class); + repository.findById(getId()).ifPresent(this::load); + } + + private void load(AuctionData auctionData) { + _currentBid = auctionData.getCurrentBid(); + _endDate = auctionData.getEndDate(); + _itemId = auctionData.getItemId(); + _itemName = auctionData.getItemName(); + _itemObjectId = auctionData.getItemObjectId(); + _itemType = auctionData.getItemType(); + _sellerId = auctionData.getSellerId(); + _sellerClanName = auctionData.getSellerClanName(); + _sellerName = auctionData.getSellerName(); + _startingBid = auctionData.getStartingBid(); + loadBid(); } /** @@ -240,27 +227,9 @@ public static String getItemTypeName(ItemTypeEnum value) { return ItemTypeName[value.ordinal()]; } - /** - * Save Auction Data End - */ private void saveAuctionDate() { - java.sql.Connection con = null; - try { - con = L2DatabaseFactory.getInstance().getConnection(); - PreparedStatement statement = con.prepareStatement("Update auction set endDate = ? where id = ?"); - statement.setLong(1, _endDate); - statement.setInt(2, _id); - statement.execute(); - - statement.close(); - } catch (Exception e) { - _log.error( "Exception: saveAuctionDate(): " + e.getMessage(), e); - } finally { - try { - con.close(); - } catch (Exception e) { - } - } + AuctionRepository repository = DatabaseAccess.getRepository(AuctionRepository.class); + repository.updateEndDateById(_id, _endDate); } /** @@ -414,22 +383,8 @@ private void removeBids() { */ public void deleteAuctionFromDB() { AuctionManager.getInstance().getAuctions().remove(this); - java.sql.Connection con = null; - try { - con = L2DatabaseFactory.getInstance().getConnection(); - PreparedStatement statement; - statement = con.prepareStatement("DELETE FROM auction WHERE itemId=?"); - statement.setInt(1, _itemId); - statement.execute(); - statement.close(); - } catch (Exception e) { - _log.error( "Exception: Auction.deleteFromDB(): " + e.getMessage(), e); - } finally { - try { - con.close(); - } catch (Exception e) { - } - } + AuctionRepository repository = DatabaseAccess.getRepository(AuctionRepository.class); + repository.deleteByItemId(_itemId); } /** @@ -504,40 +459,25 @@ public void cancelAuction() { removeBids(); } - /** - * Confirm an auction - */ public void confirmAuction() { AuctionManager.getInstance().getAuctions().add(this); - java.sql.Connection con = null; - try { - PreparedStatement statement; - con = L2DatabaseFactory.getInstance().getConnection(); - - statement = con.prepareStatement("INSERT INTO auction (id, sellerId, sellerName, sellerClanName, itemType, itemId, itemObjectId, itemName, itemQuantity, startingBid, currentBid, endDate) VALUES (?,?,?,?,?,?,?,?,?,?,?,?)"); - statement.setInt(1, getId()); - statement.setInt(2, _sellerId); - statement.setString(3, _sellerName); - statement.setString(4, _sellerClanName); - statement.setString(5, _itemType); - statement.setInt(6, _itemId); - statement.setInt(7, _itemObjectId); - statement.setString(8, _itemName); - statement.setInt(9, _itemQuantity); - statement.setInt(10, _startingBid); - statement.setInt(11, _currentBid); - statement.setLong(12, _endDate); - statement.execute(); - statement.close(); - loadBid(); - } catch (Exception e) { - _log.error( "Exception: Auction.load(): " + e.getMessage(), e); - } finally { - try { - con.close(); - } catch (Exception e) { - } - } + AuctionData auctionData = new AuctionData(); + auctionData.setId(getId()); + auctionData.setSellerId(_sellerId); + auctionData.setSellerName(_sellerName); + auctionData.setSellerClanName(_sellerClanName); + auctionData.setItemType(_itemType); + auctionData.setItemId(_itemId); + auctionData.setItemObjectId(_itemObjectId); + auctionData.setItemName(_itemName); + auctionData.setItemQuantity(_itemQuantity); + auctionData.setStartingBid(_startingBid); + auctionData.setCurrentBid(_currentBid); + auctionData.setEndDate(_endDate); + + AuctionRepository repository = DatabaseAccess.getRepository(AuctionRepository.class); + repository.save(auctionData); + loadBid(); } public final int getId() { From 9862b720402cb9e8bd31efd6489d04e89bcccc3b Mon Sep 17 00:00:00 2001 From: Alisson Oliveira Date: Sun, 22 Apr 2018 20:20:32 -0300 Subject: [PATCH 022/236] =?UTF-8?q?Remove=20refer=C3=AAncias=20diretas=20?= =?UTF-8?q?=C3=A0=20tabela=20auction=5Fbid.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../sql/experimental/l2j_full_structure.sql | 5 - .../gameserver/model/database/AuctionBid.java | 74 +++++++- .../repository/AuctionBidRepository.java | 26 +++ .../gameserver/model/entity/Auction.java | 179 +++++------------- 4 files changed, 143 insertions(+), 141 deletions(-) create mode 100644 Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/repository/AuctionBidRepository.java diff --git a/Datapack/sql/experimental/l2j_full_structure.sql b/Datapack/sql/experimental/l2j_full_structure.sql index 7e148ddf..424cc394 100644 --- a/Datapack/sql/experimental/l2j_full_structure.sql +++ b/Datapack/sql/experimental/l2j_full_structure.sql @@ -449,11 +449,6 @@ CREATE TABLE IF NOT EXISTS `auction_bid` ( REFERENCES `auction` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION, - CONSTRAINT `fk_auction_bid_clan_data1` - FOREIGN KEY (`bidderId`) - REFERENCES `clan_data` (`clan_id`) - ON DELETE NO ACTION - ON UPDATE NO ACTION) ENGINE = InnoDB DEFAULT CHARACTER SET = latin1; diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/AuctionBid.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/AuctionBid.java index ce90afdd..cda695d6 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/AuctionBid.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/AuctionBid.java @@ -1,13 +1,75 @@ package com.l2jbr.gameserver.model.database; +import com.l2jbr.commons.database.annotation.Table; +import com.l2jbr.commons.database.model.Entity; +import org.springframework.data.annotation.Id; +@Table("auction_bid") +public class AuctionBid extends Entity { -public class AuctionBid { - private int id; - private int auctionId; - private int bidderId; + @Id + private Integer id; + private Integer auctionId; + private Integer bidderId; private String bidderName; private String clanName; - private int maxBid; - private long timeBid; + private Integer maxBid; + private Long timeBid; + + @Override + public Integer getId() { + return id; + } + + public void setId(Integer id) { + this.id = id; + } + + public Integer getAuctionId() { + return auctionId; + } + + public void setAuctionId(Integer auctionId) { + this.auctionId = auctionId; + } + + public Integer getBidderId() { + return bidderId; + } + + public void setBidderId(Integer bidderId) { + this.bidderId = bidderId; + } + + public String getBidderName() { + return bidderName; + } + + public void setBidderName(String bidderName) { + this.bidderName = bidderName; + } + + public String getClanName() { + return clanName; + } + + public void setClanName(String clanName) { + this.clanName = clanName; + } + + public Integer getMaxBid() { + return maxBid; + } + + public void setMaxBid(Integer maxBid) { + this.maxBid = maxBid; + } + + public Long getTimeBid() { + return timeBid; + } + + public void setTimeBid(Long timeBid) { + this.timeBid = timeBid; + } } diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/repository/AuctionBidRepository.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/repository/AuctionBidRepository.java new file mode 100644 index 00000000..1222eac1 --- /dev/null +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/repository/AuctionBidRepository.java @@ -0,0 +1,26 @@ +package com.l2jbr.gameserver.model.database.repository; + +import com.l2jbr.gameserver.model.database.AuctionBid; +import org.springframework.data.jdbc.repository.query.Modifying; +import org.springframework.data.jdbc.repository.query.Query; +import org.springframework.data.repository.CrudRepository; +import org.springframework.data.repository.query.Param; + +public interface AuctionBidRepository extends CrudRepository { + + @Query("SELECT * FROM auction_bid WHERE auctionId=:auctionId ORDER BY maxBid DESC") + Iterable findByAuctionId(@Param("auctionId") int auctionId); + + @Modifying + @Query("UPDATE auction_bid SET bidderName=:bidderName, maxBid=:bid, time_bid=:timeBid WHERE auctionId=:auction AND bidderId=:bidder") + int updateByAuctionAndBidder(@Param("auction") int auctionId, @Param("bidder") int bidderId, @Param("bidderName") String leaderName, + @Param("bid") int bid, @Param("timeBid") long timeBid); + + @Modifying + @Query("DELETE FROM auction_bid WHERE auctionId=:auction") + int deleteByAuction(@Param("auction") int auctionId); + + @Modifying + @Query("DELETE FROM auction_bid WHERE auctionId=:auction AND bidderId=:bidder") + int deleteByAuctionAndBidder(@Param("auction") int auctionId, @Param("bidder") int bidderId); +} diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/entity/Auction.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/entity/Auction.java index e9ff0add..6f63a27b 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/entity/Auction.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/entity/Auction.java @@ -19,7 +19,6 @@ package com.l2jbr.gameserver.model.entity; import com.l2jbr.commons.database.DatabaseAccess; -import com.l2jbr.commons.database.L2DatabaseFactory; import com.l2jbr.gameserver.GameServer; import com.l2jbr.gameserver.ThreadPoolManager; import com.l2jbr.gameserver.datatables.ClanTable; @@ -29,13 +28,13 @@ import com.l2jbr.gameserver.model.L2Clan; import com.l2jbr.gameserver.model.L2World; import com.l2jbr.gameserver.model.actor.instance.L2PcInstance; +import com.l2jbr.gameserver.model.database.AuctionBid; import com.l2jbr.gameserver.model.database.AuctionData; +import com.l2jbr.gameserver.model.database.repository.AuctionBidRepository; import com.l2jbr.gameserver.model.database.repository.AuctionRepository; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import java.sql.PreparedStatement; -import java.sql.ResultSet; import java.util.Calendar; import java.util.LinkedHashMap; import java.util.Map; @@ -172,40 +171,19 @@ private void load(AuctionData auctionData) { loadBid(); } - /** - * Load bidders - **/ + private void loadBid() { - java.sql.Connection con = null; - try { - PreparedStatement statement; - ResultSet rs; - - con = L2DatabaseFactory.getInstance().getConnection(); - - statement = con.prepareStatement("SELECT bidderId, bidderName, maxBid, clan_name, time_bid FROM auction_bid WHERE auctionId = ? ORDER BY maxBid DESC"); - statement.setInt(1, getId()); - rs = statement.executeQuery(); - - while (rs.next()) { - if (rs.isFirst()) { - _highestBidderId = rs.getInt("bidderId"); - _highestBidderName = rs.getString("bidderName"); - _highestBidderMaxBid = rs.getInt("maxBid"); - } - _bidders.put(rs.getInt("bidderId"), new Bidder(rs.getString("bidderName"), rs.getString("clan_name"), rs.getInt("maxBid"), rs.getLong("time_bid"))); + AuctionBidRepository repository = DatabaseAccess.getRepository(AuctionBidRepository.class); + repository.findByAuctionId(getId()).forEach(auctionBid -> { + if(_highestBidderId == 0) { + _highestBidderId = auctionBid.getBidderId(); + _highestBidderName = auctionBid.getBidderName(); + _highestBidderMaxBid = auctionBid.getMaxBid(); } + Bidder bidder = new Bidder(auctionBid.getBidderName(), auctionBid.getClanName(), auctionBid.getMaxBid(), auctionBid.getTimeBid()); + _bidders.put(auctionBid.getBidderId(), bidder); - statement.close(); - } catch (Exception e) { - System.out.println("Exception: Auction.loadBid(): " + e.getMessage()); - e.printStackTrace(); - } finally { - try { - con.close(); - } catch (Exception e) { - } - } + }); } /** @@ -292,88 +270,50 @@ private boolean takeItem(L2PcInstance bidder, int itemId, int quantity) { * @param bid */ private void updateInDB(L2PcInstance bidder, int bid) { - java.sql.Connection con = null; - try { - con = L2DatabaseFactory.getInstance().getConnection(); - PreparedStatement statement; - - if (getBidders().get(bidder.getClanId()) != null) { - statement = con.prepareStatement("UPDATE auction_bid SET bidderId=?, bidderName=?, maxBid=?, time_bid=? WHERE auctionId=? AND bidderId=?"); - statement.setInt(1, bidder.getClanId()); - statement.setString(2, bidder.getClan().getLeaderName()); - statement.setInt(3, bid); - statement.setLong(4, System.currentTimeMillis()); - statement.setInt(5, getId()); - statement.setInt(6, bidder.getClanId()); - statement.execute(); - statement.close(); - } else { - statement = con.prepareStatement("INSERT INTO auction_bid (id, auctionId, bidderId, bidderName, maxBid, clan_name, time_bid) VALUES (?, ?, ?, ?, ?, ?, ?)"); - statement.setInt(1, IdFactory.getInstance().getNextId()); - statement.setInt(2, getId()); - statement.setInt(3, bidder.getClanId()); - statement.setString(4, bidder.getName()); - statement.setInt(5, bid); - statement.setString(6, bidder.getClan().getName()); - statement.setLong(7, System.currentTimeMillis()); - statement.execute(); - statement.close(); - if (L2World.getInstance().getPlayer(_highestBidderName) != null) { - L2World.getInstance().getPlayer(_highestBidderName).sendMessage("You have been out bidded"); - } - } - _highestBidderId = bidder.getClanId(); - _highestBidderMaxBid = bid; - _highestBidderName = bidder.getClan().getLeaderName(); - if (_bidders.get(_highestBidderId) == null) { - _bidders.put(_highestBidderId, new Bidder(_highestBidderName, bidder.getClan().getName(), bid, Calendar.getInstance().getTimeInMillis())); - } else { - _bidders.get(_highestBidderId).setBid(bid); - _bidders.get(_highestBidderId).setTimeBid(Calendar.getInstance().getTimeInMillis()); - } - bidder.sendMessage("You have bidded successfully"); - } catch (Exception e) { - _log.error( "Exception: Auction.updateInDB(L2PcInstance bidder, int bid): " + e.getMessage()); - e.printStackTrace(); - } finally { - try { - con.close(); - } catch (Exception e) { + AuctionBidRepository repository = DatabaseAccess.getRepository(AuctionBidRepository.class); + if (getBidders().get(bidder.getClanId()) != null) { + repository.updateByAuctionAndBidder(getId(), bidder.getClanId(), bidder.getClan().getLeaderName(), bid, System.currentTimeMillis()); + } else { + AuctionBid auctionBid = new AuctionBid(); + auctionBid.setId(IdFactory.getInstance().getNextId()); + auctionBid.setAuctionId(getId()); + auctionBid.setBidderId(bidder.getClanId()); + auctionBid.setBidderName(bidder.getName()); + auctionBid.setMaxBid(bid); + auctionBid.setClanName(bidder.getClan().getName()); + auctionBid.setTimeBid(System.currentTimeMillis()); + repository.save(auctionBid); + + if (L2World.getInstance().getPlayer(_highestBidderName) != null) { + L2World.getInstance().getPlayer(_highestBidderName).sendMessage("You have been out bidded"); } } + _highestBidderId = bidder.getClanId(); + _highestBidderMaxBid = bid; + _highestBidderName = bidder.getClan().getLeaderName(); + if (_bidders.get(_highestBidderId) == null) { + _bidders.put(_highestBidderId, new Bidder(_highestBidderName, bidder.getClan().getName(), bid, Calendar.getInstance().getTimeInMillis())); + } else { + _bidders.get(_highestBidderId).setBid(bid); + _bidders.get(_highestBidderId).setTimeBid(Calendar.getInstance().getTimeInMillis()); + } + bidder.sendMessage("You have bidded successfully"); } - /** - * Remove bids - */ private void removeBids() { - java.sql.Connection con = null; - try { - con = L2DatabaseFactory.getInstance().getConnection(); - PreparedStatement statement; - - statement = con.prepareStatement("DELETE FROM auction_bid WHERE auctionId=?"); - statement.setInt(1, getId()); - statement.execute(); - - statement.close(); - } catch (Exception e) { - _log.error( "Exception: Auction.deleteFromDB(): " + e.getMessage(), e); - } finally { - try { - con.close(); - } catch (Exception e) { - } - } + AuctionBidRepository repository = DatabaseAccess.getRepository(AuctionBidRepository.class); + repository.deleteByAuction(getId()); for (Bidder b : _bidders.values()) { - if (ClanTable.getInstance().getClanByName(b.getClanName()).getHasHideout() == 0) { + L2Clan clan = ClanTable.getInstance().getClanByName(b.getClanName()); + if (clan.getHasHideout() == 0) { returnItem(b.getClanName(), 57, (9 * b.getBid()) / 10, false); // 10 % tax } else { - if (L2World.getInstance().getPlayer(b.getName()) != null) { - L2World.getInstance().getPlayer(b.getName()).sendMessage("Congratulation you have won ClanHall!"); + L2PcInstance player = L2World.getInstance().getPlayer(b.getName()); + if (player != null) { + player.sendMessage("Congratulation you have won ClanHall!"); } } - ClanTable.getInstance().getClanByName(b.getClanName()).setAuctionBiddedAt(0, true); + clan.setAuctionBiddedAt(0, true); } _bidders.clear(); } @@ -420,31 +360,10 @@ public void endAuction() { } } - /** - * Cancel bid - * - * @param bidder - */ public void cancelBid(int bidder) { - java.sql.Connection con = null; - try { - con = L2DatabaseFactory.getInstance().getConnection(); - PreparedStatement statement; - - statement = con.prepareStatement("DELETE FROM auction_bid WHERE auctionId=? AND bidderId=?"); - statement.setInt(1, getId()); - statement.setInt(2, bidder); - statement.execute(); - - statement.close(); - } catch (Exception e) { - _log.error( "Exception: Auction.cancelBid(String bidder): " + e.getMessage(), e); - } finally { - try { - con.close(); - } catch (Exception e) { - } - } + AuctionBidRepository repository = DatabaseAccess.getRepository(AuctionBidRepository.class); + repository.deleteByAuctionAndBidder(getId(), bidder); + returnItem(_bidders.get(bidder).getClanName(), 57, _bidders.get(bidder).getBid(), true); ClanTable.getInstance().getClanByName(_bidders.get(bidder).getClanName()).setAuctionBiddedAt(0, true); _bidders.clear(); From 98cfd95085c3381c7a612db2a28ac5c2562e4e9f Mon Sep 17 00:00:00 2001 From: Alisson Oliveira Date: Mon, 23 Apr 2018 11:01:35 -0300 Subject: [PATCH 023/236] Remove tabela auction_watch --- Datapack/sql/auction_watch.sql | 8 ------- .../sql/experimental/l2j_full_structure.sql | 24 ------------------- Datapack/tools/database_installer.bat | 1 - Datapack/tools/database_installer.sh | 1 - Datapack/tools/full_install.sql | 1 - .../l2jbr/gameserver/idfactory/IdFactory.java | 1 - .../model/database/AuctionWatch.java | 6 ----- 7 files changed, 42 deletions(-) delete mode 100644 Datapack/sql/auction_watch.sql delete mode 100644 Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/AuctionWatch.java diff --git a/Datapack/sql/auction_watch.sql b/Datapack/sql/auction_watch.sql deleted file mode 100644 index 84ebc024..00000000 --- a/Datapack/sql/auction_watch.sql +++ /dev/null @@ -1,8 +0,0 @@ --- --------------------------- --- Table structure for auction_watch --- --------------------------- -CREATE TABLE IF NOT EXISTS auction_watch ( - charObjId INT NOT NULL default 0, - auctionId INT NOT NULL default 0, - PRIMARY KEY (charObjId, auctionId) -); diff --git a/Datapack/sql/experimental/l2j_full_structure.sql b/Datapack/sql/experimental/l2j_full_structure.sql index 424cc394..cf277b9f 100644 --- a/Datapack/sql/experimental/l2j_full_structure.sql +++ b/Datapack/sql/experimental/l2j_full_structure.sql @@ -453,30 +453,6 @@ ENGINE = InnoDB DEFAULT CHARACTER SET = latin1; --- ----------------------------------------------------- --- Table `auction_watch` --- ----------------------------------------------------- -DROP TABLE IF EXISTS `auction_watch` ; - -CREATE TABLE IF NOT EXISTS `auction_watch` ( - `charObjId` INT(11) NOT NULL DEFAULT '0', - `auctionId` INT(11) NOT NULL DEFAULT '0', - PRIMARY KEY (`charObjId`, `auctionId`), - INDEX `fk_auction_watch_auction1_idx` (`auctionId` ASC), - CONSTRAINT `fk_auction_watch_auction1` - FOREIGN KEY (`auctionId`) - REFERENCES `auction` (`id`) - ON DELETE NO ACTION - ON UPDATE NO ACTION, - CONSTRAINT `fk_auction_watch_characters1` - FOREIGN KEY (`charObjId`) - REFERENCES `characters` (`obj_Id`) - ON DELETE NO ACTION - ON UPDATE NO ACTION) -ENGINE = InnoDB -DEFAULT CHARACTER SET = latin1; - - -- ----------------------------------------------------- -- Table `augmentations` -- ----------------------------------------------------- diff --git a/Datapack/tools/database_installer.bat b/Datapack/tools/database_installer.bat index 47e7aaf8..9dfb39c9 100644 --- a/Datapack/tools/database_installer.bat +++ b/Datapack/tools/database_installer.bat @@ -518,7 +518,6 @@ armor.sql armorsets.sql auction.sql auction_bid.sql -auction_watch.sql augmentations.sql auto_chat.sql auto_chat_text.sql diff --git a/Datapack/tools/database_installer.sh b/Datapack/tools/database_installer.sh index f66866f2..44be4377 100644 --- a/Datapack/tools/database_installer.sh +++ b/Datapack/tools/database_installer.sh @@ -258,7 +258,6 @@ $MYG < ../sql/armor.sql &> /dev/null $MYG < ../sql/armorsets.sql &> /dev/null $MYG < ../sql/auction.sql &> /dev/null $MYG < ../sql/auction_bid.sql &> /dev/null -$MYG < ../sql/auction_watch.sql &> /dev/null $MYG < ../sql/augmentations.sql &> /dev/null $MYG < ../sql/auto_chat.sql &> /dev/null $MYG < ../sql/auto_chat_text.sql &> /dev/null diff --git a/Datapack/tools/full_install.sql b/Datapack/tools/full_install.sql index 940db1a1..8c314e85 100644 --- a/Datapack/tools/full_install.sql +++ b/Datapack/tools/full_install.sql @@ -2,7 +2,6 @@ DROP TABLE IF EXISTS armor; DROP TABLE IF EXISTS armorsets; DROP TABLE IF EXISTS auction; DROP TABLE IF EXISTS auction_bid; -DROP TABLE IF EXISTS auction_watch; DROP TABLE IF EXISTS augmentations; DROP TABLE IF EXISTS auto_chat; DROP TABLE IF EXISTS auto_chat_text; diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/idfactory/IdFactory.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/idfactory/IdFactory.java index 37f36c9f..2fc0a412 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/idfactory/IdFactory.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/idfactory/IdFactory.java @@ -61,7 +61,6 @@ public abstract class IdFactory "UPDATE character_hennas SET char_obj_id = ? WHERE char_obj_id = ?", "UPDATE itemsonground SET object_id = ? WHERE object_id = ?", "UPDATE auction_bid SET bidderId = ? WHERE bidderId = ?", - "UPDATE auction_watch SET charObjId = ? WHERE charObjId = ?", "UPDATE clanhall SET ownerId = ? WHERE ownerId = ?" }; diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/AuctionWatch.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/AuctionWatch.java deleted file mode 100644 index bdeb6b03..00000000 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/AuctionWatch.java +++ /dev/null @@ -1,6 +0,0 @@ -package com.l2jbr.gameserver.model.database; - -public class AuctionWatch { - private int charObjId; - private int auctionId; -} From 61b721569670f85a649abba00e1814aa7ca95f04 Mon Sep 17 00:00:00 2001 From: Alisson Oliveira Date: Mon, 23 Apr 2018 12:14:56 -0300 Subject: [PATCH 024/236] =?UTF-8?q?Remove=20algumas=20refer=C3=AAncias=20d?= =?UTF-8?q?iretas=20=C3=A0=20tabela=20augmentations?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../gameserver/model/L2Augmentation.java | 51 +++---------------- .../gameserver/model/L2ItemInstance.java | 23 ++++----- .../model/database/Augmentation.java | 43 ++++++++++++++++ .../model/database/Augmentations.java | 11 ---- .../repository/AugmentationsRepository.java | 14 +++++ .../gameserver/network/L2GameClient.java | 11 ++-- .../serverpackets/CharSelectInfo.java | 26 ++-------- 7 files changed, 86 insertions(+), 93 deletions(-) create mode 100644 Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/Augmentation.java delete mode 100644 Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/Augmentations.java create mode 100644 Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/repository/AugmentationsRepository.java diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/L2Augmentation.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/L2Augmentation.java index f8276af7..f215bdf4 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/L2Augmentation.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/L2Augmentation.java @@ -18,17 +18,18 @@ package com.l2jbr.gameserver.model; -import com.l2jbr.commons.database.L2DatabaseFactory; +import com.l2jbr.commons.database.DatabaseAccess; import com.l2jbr.gameserver.datatables.AugmentationData; import com.l2jbr.gameserver.datatables.SkillTable; import com.l2jbr.gameserver.model.actor.instance.L2PcInstance; +import com.l2jbr.gameserver.model.database.Augmentation; +import com.l2jbr.gameserver.model.database.repository.AugmentationsRepository; import com.l2jbr.gameserver.skills.Stats; import com.l2jbr.gameserver.skills.funcs.FuncAdd; import com.l2jbr.gameserver.skills.funcs.LambdaConst; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import java.sql.PreparedStatement; import java.util.List; @@ -110,31 +111,9 @@ public void removeBoni(L2PcInstance player) { } private void saveAugmentationData() { - java.sql.Connection con = null; - try { - con = L2DatabaseFactory.getInstance().getConnection(); - - PreparedStatement statement = con.prepareStatement("INSERT INTO augmentations (item_id,attributes,skill,level) VALUES (?,?,?,?)"); - statement.setInt(1, _item.getObjectId()); - statement.setInt(2, _effectsId); - if (_skill != null) { - statement.setInt(3, _skill.getId()); - statement.setInt(4, _skill.getLevel()); - } else { - statement.setInt(3, 0); - statement.setInt(4, 0); - } - - statement.executeUpdate(); - statement.close(); - } catch (Exception e) { - _log.error( "Could not save augmentation for item: " + _item.getObjectId() + " from DB:", e); - } finally { - try { - con.close(); - } catch (Exception e) { - } - } + Augmentation augmentation = new Augmentation(_item.getObjectId(), _effectsId, _skill); + AugmentationsRepository repository = DatabaseAccess.getRepository(AugmentationsRepository.class); + repository.save(augmentation); } public void deleteAugmentationData() { @@ -142,22 +121,8 @@ public void deleteAugmentationData() { return; } - // delete the augmentation from the database - java.sql.Connection con = null; - try { - con = L2DatabaseFactory.getInstance().getConnection(); - PreparedStatement statement = con.prepareStatement("DELETE FROM augmentations WHERE item_id=?"); - statement.setInt(1, _item.getObjectId()); - statement.executeUpdate(); - statement.close(); - } catch (Exception e) { - _log.error( "Could not delete augmentation for item: " + _item.getObjectId() + " from DB:", e); - } finally { - try { - con.close(); - } catch (Exception e) { - } - } + AugmentationsRepository repository = DatabaseAccess.getRepository(AugmentationsRepository.class); + repository.deleteById(_item.getObjectId()); } /** diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/L2ItemInstance.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/L2ItemInstance.java index cba124b6..53ff3048 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/L2ItemInstance.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/L2ItemInstance.java @@ -19,6 +19,7 @@ package com.l2jbr.gameserver.model; import com.l2jbr.commons.Config; +import com.l2jbr.commons.database.DatabaseAccess; import com.l2jbr.commons.database.L2DatabaseFactory; import com.l2jbr.gameserver.ThreadPoolManager; import com.l2jbr.gameserver.ai.CtrlIntention; @@ -26,6 +27,8 @@ import com.l2jbr.gameserver.instancemanager.ItemsOnGroundManager; import com.l2jbr.gameserver.model.actor.instance.L2PcInstance; import com.l2jbr.gameserver.model.actor.knownlist.NullKnownList; +import com.l2jbr.gameserver.model.database.Augmentation; +import com.l2jbr.gameserver.model.database.repository.AugmentationsRepository; import com.l2jbr.gameserver.network.SystemMessageId; import com.l2jbr.gameserver.serverpackets.ActionFailed; import com.l2jbr.gameserver.serverpackets.InventoryUpdate; @@ -40,6 +43,7 @@ import java.sql.PreparedStatement; import java.sql.ResultSet; +import java.util.Optional; import java.util.concurrent.ScheduledFuture; @@ -1054,18 +1058,13 @@ else if ((inst._mana > 0) && (inst.getLocation() == ItemLocation.PAPERDOLL)) } rs.close(); statement.close(); - - // load augmentation - statement = con.prepareStatement("SELECT attributes,skill,level FROM augmentations WHERE item_id=?"); - statement.setInt(1, objectId); - rs = statement.executeQuery(); - if (rs.next()) - { - inst._augmentation = new L2Augmentation(inst, rs.getInt("attributes"), rs.getInt("skill"), rs.getInt("level"), false); - } - - rs.close(); - statement.close(); + + AugmentationsRepository repository = DatabaseAccess.getRepository(AugmentationsRepository.class); + Optional optionalAugmentation = repository.findById(objectId); + if(optionalAugmentation.isPresent()) { + Augmentation augmentation = optionalAugmentation.get(); + inst._augmentation = new L2Augmentation(inst, augmentation.getAttributes(), augmentation.getSkill(), augmentation.getLevel(), false ); + } } catch (Exception e) diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/Augmentation.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/Augmentation.java new file mode 100644 index 00000000..2a2933d0 --- /dev/null +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/Augmentation.java @@ -0,0 +1,43 @@ +package com.l2jbr.gameserver.model.database; + +import com.l2jbr.commons.database.annotation.Table; +import com.l2jbr.commons.database.model.Entity; +import com.l2jbr.commons.util.Util; +import com.l2jbr.gameserver.model.L2Skill; +import org.springframework.data.annotation.Id; + +@Table("augmentations") +public class Augmentation extends Entity { + + @Id + private Integer itemId; + private Integer attributes; + private Integer skill; + private Integer level; + + public Augmentation(int objectId, int effectsId, L2Skill skill) { + this.itemId = objectId; + this.attributes = effectsId; + if(Util.isNotNull(skill)) { + this.skill = skill.getId(); + this.level = skill.getLevel(); + } + } + + @Override + public Integer getId() { + return itemId; + } + + public int getAttributes() { + return attributes; + } + + public Integer getSkill() { + return skill; + } + + public Integer getLevel() { + return level; + } +} diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/Augmentations.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/Augmentations.java deleted file mode 100644 index ffd42156..00000000 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/Augmentations.java +++ /dev/null @@ -1,11 +0,0 @@ -package com.l2jbr.gameserver.model.database; - - - -public class Augmentations { - - private int itemId; - private int attributes; - private int skill; - private int level; -} diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/repository/AugmentationsRepository.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/repository/AugmentationsRepository.java new file mode 100644 index 00000000..316c9a65 --- /dev/null +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/repository/AugmentationsRepository.java @@ -0,0 +1,14 @@ +package com.l2jbr.gameserver.model.database.repository; + +import com.l2jbr.gameserver.model.database.Augmentation; +import org.springframework.data.jdbc.repository.query.Modifying; +import org.springframework.data.jdbc.repository.query.Query; +import org.springframework.data.repository.CrudRepository; +import org.springframework.data.repository.query.Param; + +public interface AugmentationsRepository extends CrudRepository { + + @Modifying + @Query("DELETE FROM augmentations WHERE item_id IN (SELECT object_id FROM items i WHERE i.owner_id=:owner)") + int deleteByItemOwner(@Param("owner") int itemOwnerId); +} diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/network/L2GameClient.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/network/L2GameClient.java index b91e0dd4..61095ef6 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/network/L2GameClient.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/network/L2GameClient.java @@ -28,6 +28,7 @@ import com.l2jbr.gameserver.model.CharSelectInfoPackage; import com.l2jbr.gameserver.model.L2World; import com.l2jbr.gameserver.model.actor.instance.L2PcInstance; +import com.l2jbr.gameserver.model.database.repository.AugmentationsRepository; import com.l2jbr.gameserver.model.database.repository.CharacterRepository; import com.l2jbr.gameserver.model.entity.L2Event; import com.l2jbr.gameserver.serverpackets.L2GameServerPacket; @@ -312,10 +313,8 @@ public static void deleteCharByObjId(int objId) { statement.execute(); statement.close(); - statement = con.prepareStatement("DELETE FROM augmentations WHERE item_id IN (SELECT object_id FROM items WHERE items.owner_id=?)"); - statement.setInt(1, objId); - statement.execute(); - statement.close(); + AugmentationsRepository augmentationsRepository = DatabaseAccess.getRepository(AugmentationsRepository.class); + augmentationsRepository.deleteByItemOwner(objId); statement = con.prepareStatement("DELETE FROM items WHERE owner_id=?"); statement.setInt(1, objId); @@ -327,8 +326,8 @@ public static void deleteCharByObjId(int objId) { statement.execute(); statement.close(); - CharacterRepository repository = DatabaseAccess.getRepository(CharacterRepository.class); - repository.deleteById(objId); + CharacterRepository characterRepository = DatabaseAccess.getRepository(CharacterRepository.class); + characterRepository.deleteById(objId); } catch (Exception e) { _log.warn("Data error on deleting char: " + e); } finally { diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/serverpackets/CharSelectInfo.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/serverpackets/CharSelectInfo.java index 651b4f82..24520a90 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/serverpackets/CharSelectInfo.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/serverpackets/CharSelectInfo.java @@ -25,6 +25,7 @@ import com.l2jbr.gameserver.model.L2Clan; import com.l2jbr.gameserver.model.actor.instance.L2PcInstance; import com.l2jbr.gameserver.model.database.Character; +import com.l2jbr.gameserver.model.database.repository.AugmentationsRepository; import com.l2jbr.gameserver.model.database.repository.CharacterRepository; import com.l2jbr.gameserver.network.L2GameClient; import org.slf4j.Logger; @@ -302,27 +303,10 @@ private CharSelectInfoPackage restoreChar(Character character) { } if (weaponObjId > 0) { - java.sql.Connection con = null; - try { - con = L2DatabaseFactory.getInstance().getConnection(); - PreparedStatement statement = con.prepareStatement("SELECT attributes FROM augmentations WHERE item_id=?"); - statement.setInt(1, weaponObjId); - ResultSet result = statement.executeQuery(); - - if (result.next()) { - charInfopackage.setAugmentationId(result.getInt("attributes")); - } - - result.close(); - statement.close(); - } catch (Exception e) { - _log.warn("Could not restore augmentation info: " + e); - } finally { - try { - con.close(); - } catch (Exception e) { - } - } + AugmentationsRepository repository = DatabaseAccess.getRepository(AugmentationsRepository.class); + repository.findById(weaponObjId).ifPresent(augmentation -> { + charInfopackage.setAugmentationId(augmentation.getAttributes()); + }); } /* From 7ef67b2e01036f571b0c702853d0e2d9c68feb98 Mon Sep 17 00:00:00 2001 From: Alisson Oliveira Date: Mon, 23 Apr 2018 15:59:51 -0300 Subject: [PATCH 025/236] =?UTF-8?q?Remove=20algumas=20refer=C3=AAncias=20d?= =?UTF-8?q?iretas=20=C3=A0=20tabela=20npc?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../l2jbr/gameserver/datatables/NpcTable.java | 266 ++++++------------ .../l2jbr/gameserver/model/database/Npc.java | 251 ++++++++++++++--- .../database/repository/NpcRepository.java | 7 + .../gameserver/templates/L2NpcTemplate.java | 75 ++--- .../resources/gameserver-messages.properties | 1 + .../gameserver-messages_pt_BR.properties | 1 + 6 files changed, 348 insertions(+), 253 deletions(-) create mode 100644 Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/repository/NpcRepository.java diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/datatables/NpcTable.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/datatables/NpcTable.java index 1274f740..46a38086 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/datatables/NpcTable.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/datatables/NpcTable.java @@ -19,12 +19,15 @@ package com.l2jbr.gameserver.datatables; import com.l2jbr.commons.Config; +import com.l2jbr.commons.database.DatabaseAccess; import com.l2jbr.commons.database.L2DatabaseFactory; import com.l2jbr.gameserver.model.L2DropCategory; import com.l2jbr.gameserver.model.L2DropData; import com.l2jbr.gameserver.model.L2MinionData; import com.l2jbr.gameserver.model.L2Skill; import com.l2jbr.gameserver.model.base.ClassId; +import com.l2jbr.gameserver.model.database.Npc; +import com.l2jbr.gameserver.model.database.repository.NpcRepository; import com.l2jbr.gameserver.skills.Stats; import com.l2jbr.gameserver.templates.L2NpcTemplate; import com.l2jbr.gameserver.templates.StatsSet; @@ -66,63 +69,12 @@ private NpcTable() { } private void restoreNpcData() { - try (Connection con = L2DatabaseFactory.getInstance().getConnection();) { - try { - PreparedStatement statement = con.prepareStatement("SELECT " + L2DatabaseFactory.getInstance().safetyString(new String[] - { - "id", - "idTemplate", - "name", - "serverSideName", - "title", - "serverSideTitle", - "class", - "collision_radius", - "collision_height", - "level", - "sex", - "type", - "attackrange", - "hp", - "mp", - "hpreg", - "mpreg", - "str", - "con", - "dex", - "int", - "wit", - "men", - "exp", - "sp", - "patk", - "pdef", - "matk", - "mdef", - "atkspd", - "aggro", - "matkspd", - "rhand", - "lhand", - "armor", - "walkspd", - "runspd", - "faction_id", - "faction_range", - "isUndead", - "absorb_level", - "absorb_type" - }) + " FROM npc"); - - ResultSet npcdata = statement.executeQuery(); - - fillNpcTable(npcdata); - npcdata.close(); - statement.close(); - } catch (Exception e) { - _log.error("NPCTable: Error creating NPC table: " + e); - } + NpcRepository repository = DatabaseAccess.getRepository(NpcRepository.class); + repository.findAll().forEach(this::addToNpcMap); + _log.info("info.loaded.npc", _npcs.size()); + + try (Connection con = L2DatabaseFactory.getInstance().getConnection();) { try { PreparedStatement statement = con.prepareStatement("SELECT npcid, skillid, level FROM npcskills"); ResultSet npcskills = statement.executeQuery(); @@ -264,83 +216,76 @@ private void restoreNpcData() { _initialized = true; } - private void fillNpcTable(ResultSet NpcData) throws Exception { - while (NpcData.next()) { - StatsSet npcDat = new StatsSet(); - int id = NpcData.getInt("id"); + private StatsSet npcToStatSet(Npc npc) { + StatsSet npcDat = new StatsSet(); + int id = npc.getId(); - if (Config.ASSERT) { - assert id < 1000000; - } - - npcDat.set("npcId", id); - npcDat.set("idTemplate", NpcData.getInt("idTemplate")); - int level = NpcData.getInt("level"); - npcDat.set("level", level); - npcDat.set("jClass", NpcData.getString("class")); - - npcDat.set("baseShldDef", 0); - npcDat.set("baseShldRate", 0); - npcDat.set("baseCritRate", 38); - - npcDat.set("name", NpcData.getString("name")); - npcDat.set("serverSideName", NpcData.getBoolean("serverSideName")); - // npcDat.set("name", ""); - npcDat.set("title", NpcData.getString("title")); - npcDat.set("serverSideTitle", NpcData.getBoolean("serverSideTitle")); - npcDat.set("collision_radius", NpcData.getDouble("collision_radius")); - npcDat.set("collision_height", NpcData.getDouble("collision_height")); - npcDat.set("sex", NpcData.getString("sex")); - npcDat.set("type", NpcData.getString("type")); - npcDat.set("baseAtkRange", NpcData.getInt("attackrange")); - npcDat.set("rewardExp", NpcData.getInt("exp")); - npcDat.set("rewardSp", NpcData.getInt("sp")); - npcDat.set("basePAtkSpd", NpcData.getInt("atkspd")); - npcDat.set("baseMAtkSpd", NpcData.getInt("matkspd")); - npcDat.set("aggroRange", NpcData.getInt("aggro")); - npcDat.set("rhand", NpcData.getInt("rhand")); - npcDat.set("lhand", NpcData.getInt("lhand")); - npcDat.set("armor", NpcData.getInt("armor")); - npcDat.set("baseWalkSpd", NpcData.getInt("walkspd")); - npcDat.set("baseRunSpd", NpcData.getInt("runspd")); - - // constants, until we have stats in DB - npcDat.set("baseSTR", NpcData.getInt("str")); - npcDat.set("baseCON", NpcData.getInt("con")); - npcDat.set("baseDEX", NpcData.getInt("dex")); - npcDat.set("baseINT", NpcData.getInt("int")); - npcDat.set("baseWIT", NpcData.getInt("wit")); - npcDat.set("baseMEN", NpcData.getInt("men")); - - npcDat.set("baseHpMax", NpcData.getInt("hp")); - npcDat.set("baseCpMax", 0); - npcDat.set("baseMpMax", NpcData.getInt("mp")); - npcDat.set("baseHpReg", NpcData.getFloat("hpreg") > 0 ? NpcData.getFloat("hpreg") : 1.5 + ((level - 1) / 10.0)); - npcDat.set("baseMpReg", NpcData.getFloat("mpreg") > 0 ? NpcData.getFloat("mpreg") : 0.9 + (0.3 * ((level - 1) / 10.0))); - npcDat.set("basePAtk", NpcData.getInt("patk")); - npcDat.set("basePDef", NpcData.getInt("pdef")); - npcDat.set("baseMAtk", NpcData.getInt("matk")); - npcDat.set("baseMDef", NpcData.getInt("mdef")); - - npcDat.set("factionId", NpcData.getString("faction_id")); - npcDat.set("factionRange", NpcData.getInt("faction_range")); - - npcDat.set("isUndead", NpcData.getString("isUndead")); - - npcDat.set("absorb_level", NpcData.getString("absorb_level")); - npcDat.set("absorb_type", NpcData.getString("absorb_type")); - - L2NpcTemplate template = new L2NpcTemplate(npcDat); - template.addVulnerability(Stats.BOW_WPN_VULN, 1); - template.addVulnerability(Stats.BLUNT_WPN_VULN, 1); - template.addVulnerability(Stats.DAGGER_WPN_VULN, 1); - - _npcs.put(id, template); + if (Config.ASSERT) { + assert id < 1000000; } - _log.info("NpcTable: Loaded " + _npcs.size() + " Npc Templates."); + npcDat.set("npcId", id); + npcDat.set("idTemplate", npc.getIdTemplate()); + int level = npc.getLevel(); + npcDat.set("level", level); + npcDat.set("jClass", npc.getNpcClass()); + + npcDat.set("baseShldDef", 0); + npcDat.set("baseShldRate", 0); + npcDat.set("baseCritRate", 38); + + npcDat.set("name", npc.getName()); + npcDat.set("serverSideName", npc.getServerSideName() == 1); + // npcDat.set("name", ""); + npcDat.set("title", npc.getTitle()); + npcDat.set("serverSideTitle", npc.getServerSideTitle() == 1); + npcDat.set("collision_radius", npc.getCollision_radius()); + npcDat.set("collision_height", npc.getCollision_height()); + npcDat.set("sex", npc.getSex()); + npcDat.set("type", npc.getType()); + npcDat.set("baseAtkRange", npc.getAttackrange()); + npcDat.set("rewardExp", npc.getExp()); + npcDat.set("rewardSp", npc.getSp()); + npcDat.set("basePAtkSpd", npc.getAtkspd()); + npcDat.set("baseMAtkSpd", npc.getMatkspd()); + npcDat.set("aggroRange", npc.getAggro()); + npcDat.set("rhand", npc.getRhand()); + npcDat.set("lhand", npc.getLhand()); + npcDat.set("armor", npc.getArmor()); + npcDat.set("baseWalkSpd", npc.getWalkspd()); + npcDat.set("baseRunSpd", npc.getRunspd()); + + // constants, until we have stats in DB + npcDat.set("baseSTR", npc.getStr()); + npcDat.set("baseCON", npc.getCon()); + npcDat.set("baseDEX", npc.getDex()); + npcDat.set("baseINT", npc.getInt()); + npcDat.set("baseWIT", npc.getWit()); + npcDat.set("baseMEN", npc.getMen()); + + npcDat.set("baseHpMax", npc.getHp()); + npcDat.set("baseCpMax", 0); + npcDat.set("baseMpMax", npc.getMp()); + float hpReg = npc.getHpreg(); + npcDat.set("baseHpReg", hpReg > 0 ? hpReg : 1.5 + ((level - 1) / 10.0)); + float mpReg = npc.getMpreg(); + npcDat.set("baseMpReg", mpReg > 0 ? mpReg : 0.9 + (0.3 * ((level - 1) / 10.0))); + npcDat.set("basePAtk", npc.getPatk()); + npcDat.set("basePDef", npc.getPdef()); + npcDat.set("baseMAtk", npc.getMatk()); + npcDat.set("baseMDef", npc.getMdef()); + + npcDat.set("factionId", npc.getFactionId()); + npcDat.set("factionRange", npc.getFactionRange()); + + npcDat.set("isUndead", npc.getIsUndead()); + + npcDat.set("absorb_level", npc.getAbsorbLevel()); + npcDat.set("absorb_type", npc.getAbsorbType()); + return npcDat; } + public void reloadNpc(int id) { Connection con = null; @@ -372,57 +317,9 @@ public void reloadNpc(int id) { } // reload the NPC base data - con = L2DatabaseFactory.getInstance().getConnection(); - PreparedStatement st = con.prepareStatement("SELECT " + L2DatabaseFactory.getInstance().safetyString(new String[] - { - "id", - "idTemplate", - "name", - "serverSideName", - "title", - "serverSideTitle", - "class", - "collision_radius", - "collision_height", - "level", - "sex", - "type", - "attackrange", - "hp", - "mp", - "hpreg", - "mpreg", - "str", - "con", - "dex", - "int", - "wit", - "men", - "exp", - "sp", - "patk", - "pdef", - "matk", - "mdef", - "atkspd", - "aggro", - "matkspd", - "rhand", - "lhand", - "armor", - "walkspd", - "runspd", - "faction_id", - "faction_range", - "isUndead", - "absorb_level", - "absorb_type" - }) + " FROM npc WHERE id=?"); - st.setInt(1, id); - ResultSet rs = st.executeQuery(); - fillNpcTable(rs); - rs.close(); - st.close(); + NpcRepository repository = DatabaseAccess.getRepository(NpcRepository.class); + repository.findById(id).ifPresent(this::addToNpcMap); + // restore additional data from saved copy L2NpcTemplate created = getTemplate(id); @@ -450,6 +347,16 @@ public void reloadNpc(int id) { } } + private void addToNpcMap(Npc npc) { + StatsSet npcDat = npcToStatSet(npc); + L2NpcTemplate template = new L2NpcTemplate(npcDat); + template.addVulnerability(Stats.BOW_WPN_VULN, 1); + template.addVulnerability(Stats.BLUNT_WPN_VULN, 1); + template.addVulnerability(Stats.DAGGER_WPN_VULN, 1); + + _npcs.put(npc.getId(), template); + } + // just wrapper public void reloadAllNpc() { restoreNpcData(); @@ -478,6 +385,7 @@ public void saveNpc(StatsSet npc) { } } + //TODO remove this query = "UPDATE npc SET " + values + " WHERE id = ?"; PreparedStatement statement = con.prepareStatement(query); statement.setInt(1, npc.getInteger("npcId")); diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/Npc.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/Npc.java index ec40f4fd..7fbd549b 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/Npc.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/Npc.java @@ -1,49 +1,224 @@ package com.l2jbr.gameserver.model.database; - +import com.l2jbr.commons.database.annotation.Column; +import org.springframework.data.annotation.Id; public class Npc { - private int id; - private int idTemplate; + @Id + private Integer id; + private Integer idTemplate; private String name; - private int serverSideName; + private Integer serverSideName; private String title; - private int serverSideTitle; + private Integer serverSideTitle; private String _class; - private int collision_radius; - private int collision_height; - private int level; + private Double collision_radius; + private Double collision_height; + private Integer level; private String sex; private String type; - private int attackrange; - private int hp; - private int mp; - private int hpreg; - private int mpreg; - private int str; - private int con; - private int dex; - private int _int; - private int wit; - private int men; - private int exp; - private int sp; - private int patk; - private int pdef; - private int matk; - private int mdef; - private int atkspd; - private int aggro; - private int matkspd; - private int rhand; - private int lhand; - private int armor; - private int walkspd; - private int runspd; - private String faction_id; - private int faction_range; - private int isUndead; - private int absorb_level; - private String absorb_type; //enum('FULL_PARTY','LAST_HIT','PARTY_ONE_RANDOM') DEFAULT 'LAST_HIT' NOT NULL, + private Integer attackrange; + private Integer hp; + private Integer mp; + private Float hpreg; + private Integer mpreg; + private Integer str; + private Integer con; + private Integer dex; + @Column("int") + private Integer _int; + private Integer wit; + private Integer men; + private Integer exp; + private Integer sp; + private Integer patk; + private Integer pdef; + private Integer matk; + private Integer mdef; + private Integer atkspd; + private Integer aggro; + private Integer matkspd; + private Integer rhand; + private Integer lhand; + private Integer armor; + private Integer walkspd; + private Integer runspd; + @Column("faction_id") + private String factionId; + @Column("faction_range") + private Integer factionRange; + private Integer isUndead; + @Column("absorb_level") + private Integer absorbLevel; + @Column("absorb_type") + private String absorbType; //enum('FULL_PARTY','LAST_HIT','PARTY_ONE_RANDOM') DEFAULT 'LAST_HIT' NOT NULL, + + public Integer getId() { + return id; + } + + public int getIdTemplate() { + return idTemplate; + } + + public String getName() { + return name; + } + + public int getServerSideName() { + return serverSideName; + } + + public String getTitle() { + return title; + } + + public int getServerSideTitle() { + return serverSideTitle; + } + + public String getNpcClass() { + return _class; + } + + public double getCollision_radius() { + return collision_radius; + } + + public double getCollision_height() { + return collision_height; + } + + public int getLevel() { + return level; + } + + public String getSex() { + return sex; + } + + public String getType() { + return type; + } + + public int getAttackrange() { + return attackrange; + } + + public int getHp() { + return hp; + } + + public int getMp() { + return mp; + } + + public float getHpreg() { + return hpreg; + } + + public int getMpreg() { + return mpreg; + } + + public int getStr() { + return str; + } + + public int getCon() { + return con; + } + + public int getDex() { + return dex; + } + + public int getInt() { + return _int; + } + + public int getWit() { + return wit; + } + + public int getMen() { + return men; + } + + public int getExp() { + return exp; + } + + public int getSp() { + return sp; + } + + public int getPatk() { + return patk; + } + + public int getPdef() { + return pdef; + } + + public int getMatk() { + return matk; + } + + public int getMdef() { + return mdef; + } + + public int getAtkspd() { + return atkspd; + } + + public int getAggro() { + return aggro; + } + + public int getMatkspd() { + return matkspd; + } + + public int getRhand() { + return rhand; + } + + public int getLhand() { + return lhand; + } + + public int getArmor() { + return armor; + } + + public int getWalkspd() { + return walkspd; + } + + public int getRunspd() { + return runspd; + } + + public String getFactionId() { + return factionId; + } + + public int getFactionRange() { + return factionRange; + } + + public int getIsUndead() { + return isUndead; + } + + public int getAbsorbLevel() { + return absorbLevel; + } + + public String getAbsorbType() { + return absorbType; + } } diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/repository/NpcRepository.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/repository/NpcRepository.java new file mode 100644 index 00000000..3bcde503 --- /dev/null +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/repository/NpcRepository.java @@ -0,0 +1,7 @@ +package com.l2jbr.gameserver.model.database.repository; + +import com.l2jbr.gameserver.model.database.Npc; +import org.springframework.data.repository.CrudRepository; + +public interface NpcRepository extends CrudRepository { +} diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/templates/L2NpcTemplate.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/templates/L2NpcTemplate.java index 4a9e58ee..b2e27dd1 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/templates/L2NpcTemplate.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/templates/L2NpcTemplate.java @@ -68,6 +68,44 @@ public final class L2NpcTemplate extends L2CharTemplate { public final AbsorbCrystalType absorbType; public Race race; + + /** + * Constructor of L2Character.
+ *
+ * + * @param set The StatsSet object to transfert data to the method + */ + public L2NpcTemplate(StatsSet set) { + super(set); + npcId = set.getInteger("npcId"); + idTemplate = set.getInteger("idTemplate"); + type = set.getString("type"); + name = set.getString("name"); + serverSideName = set.getBool("serverSideName"); + title = set.getString("title"); + serverSideTitle = set.getBool("serverSideTitle"); + sex = set.getString("sex"); + level = set.getByte("level"); + rewardExp = set.getInteger("rewardExp"); + rewardSp = set.getInteger("rewardSp"); + aggroRange = set.getInteger("aggroRange"); + rhand = set.getInteger("rhand"); + lhand = set.getInteger("lhand"); + armor = set.getInteger("armor"); + String f = set.getString("factionId", null); + if (f == null) { + factionId = null; + } else { + factionId = f.intern(); + } + factionRange = set.getInteger("factionRange"); + absorbLevel = set.getInteger("absorb_level", 0); + absorbType = AbsorbCrystalType.valueOf(set.getString("absorb_type")); + race = null; + _npcStatsSet = set; + _teachInfo = null; + } + public static enum AbsorbCrystalType { LAST_HIT, FULL_PARTY, @@ -119,42 +157,7 @@ public static enum Race { // contains a list of quests for each event type (questStart, questAttack, questKill, etc) private Map _questEvents; - /** - * Constructor of L2Character.
- *
- * - * @param set The StatsSet object to transfert data to the method - */ - public L2NpcTemplate(StatsSet set) { - super(set); - npcId = set.getInteger("npcId"); - idTemplate = set.getInteger("idTemplate"); - type = set.getString("type"); - name = set.getString("name"); - serverSideName = set.getBool("serverSideName"); - title = set.getString("title"); - serverSideTitle = set.getBool("serverSideTitle"); - sex = set.getString("sex"); - level = set.getByte("level"); - rewardExp = set.getInteger("rewardExp"); - rewardSp = set.getInteger("rewardSp"); - aggroRange = set.getInteger("aggroRange"); - rhand = set.getInteger("rhand"); - lhand = set.getInteger("lhand"); - armor = set.getInteger("armor"); - String f = set.getString("factionId", null); - if (f == null) { - factionId = null; - } else { - factionId = f.intern(); - } - factionRange = set.getInteger("factionRange"); - absorbLevel = set.getInteger("absorb_level", 0); - absorbType = AbsorbCrystalType.valueOf(set.getString("absorb_type")); - race = null; - _npcStatsSet = set; - _teachInfo = null; - } + public void addTeachInfo(ClassId classId) { if (_teachInfo == null) { diff --git a/Gameserver/src/main/resources/gameserver-messages.properties b/Gameserver/src/main/resources/gameserver-messages.properties index 5ac30792..98c8b6ac 100644 --- a/Gameserver/src/main/resources/gameserver-messages.properties +++ b/Gameserver/src/main/resources/gameserver-messages.properties @@ -28,3 +28,4 @@ debug.clan.removed=clan removed from database: {} error.clan.remove=Error while removing clan from database. info.loaded.clanhall=Loaded {} clan halls. info.loaded.free.clanhall=Loaded {} free clan halls. +info.npc.loaded=NpcTable: Loaded {} Npc Templates. diff --git a/Gameserver/src/main/resources/gameserver-messages_pt_BR.properties b/Gameserver/src/main/resources/gameserver-messages_pt_BR.properties index 56081fe1..c4f58b03 100644 --- a/Gameserver/src/main/resources/gameserver-messages_pt_BR.properties +++ b/Gameserver/src/main/resources/gameserver-messages_pt_BR.properties @@ -28,3 +28,4 @@ debug.clan.removed=clan removido do banco de dados: {} error.clan.remove=Erro removendo clan do banco de dados. info.loaded.clanhall={} Clan Halls carregados. info.loaded.free.clanhall={} Clan halls livres carregados. +info.npc.loaded=NpcTable: {} modelos de NPCs carregados. From f1d9db3d68bdcd6afd464c3614832b32285249d9 Mon Sep 17 00:00:00 2001 From: Alisson Oliveira Date: Mon, 23 Apr 2018 16:18:59 -0300 Subject: [PATCH 026/236] =?UTF-8?q?Remove=20refer=C3=AAncias=20diretas=20?= =?UTF-8?q?=C3=A0=20tabela=20auto=5Fchat?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../gameserver/model/AutoChatHandler.java | 17 ++++++-------- .../gameserver/model/database/AutoChat.java | 23 +++++++++++++++---- .../repository/AutoChatRepository.java | 7 ++++++ 3 files changed, 33 insertions(+), 14 deletions(-) create mode 100644 Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/repository/AutoChatRepository.java diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/AutoChatHandler.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/AutoChatHandler.java index ccfbc313..04e515bf 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/AutoChatHandler.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/AutoChatHandler.java @@ -19,6 +19,7 @@ package com.l2jbr.gameserver.model; import com.l2jbr.commons.Config; +import com.l2jbr.commons.database.DatabaseAccess; import com.l2jbr.commons.database.L2DatabaseFactory; import com.l2jbr.commons.util.Rnd; import com.l2jbr.gameserver.SevenSigns; @@ -26,6 +27,8 @@ import com.l2jbr.gameserver.model.actor.instance.L2NpcInstance; import com.l2jbr.gameserver.model.actor.instance.L2PcInstance; import com.l2jbr.gameserver.model.actor.instance.L2SiegeGuardInstance; +import com.l2jbr.gameserver.model.database.AutoChat; +import com.l2jbr.gameserver.model.database.repository.AutoChatRepository; import com.l2jbr.gameserver.serverpackets.CreatureSay; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -61,22 +64,18 @@ protected AutoChatHandler() { private void restoreChatData() { int numLoaded = 0; java.sql.Connection con = null; - PreparedStatement statement = null; PreparedStatement statement2 = null; - ResultSet rs = null; ResultSet rs2 = null; try { con = L2DatabaseFactory.getInstance().getConnection(); - statement = con.prepareStatement("SELECT * FROM auto_chat ORDER BY groupId ASC"); - rs = statement.executeQuery(); - - while (rs.next()) { + AutoChatRepository repository = DatabaseAccess.getRepository(AutoChatRepository.class); + for (AutoChat autoChat: repository.findAll()) { numLoaded++; statement2 = con.prepareStatement("SELECT * FROM auto_chat_text WHERE groupId=?"); - statement2.setInt(1, rs.getInt("groupId")); + statement2.setInt(1, autoChat.getGroupId()); rs2 = statement2.executeQuery(); rs2.last(); @@ -89,13 +88,11 @@ private void restoreChatData() { i++; } - registerGlobalChat(rs.getInt("npcId"), chatTexts, rs.getLong("chatDelay")); + registerGlobalChat(autoChat.getNpcId(), chatTexts, autoChat.getChatDelay()); statement2.close(); } - statement.close(); - if (Config.DEBUG) { _log.info("AutoChatHandler: Loaded " + numLoaded + " chat group(s) from the database."); } diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/AutoChat.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/AutoChat.java index 3367aa1b..33bd8061 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/AutoChat.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/AutoChat.java @@ -1,10 +1,25 @@ package com.l2jbr.gameserver.model.database; +import com.l2jbr.commons.database.annotation.Table; +import org.springframework.data.annotation.Id; - +@Table("auto_chat") public class AutoChat { - private int groupId; - private int npcId; - private long chatDelay; + @Id + private Integer groupId; + private Integer npcId; + private Long chatDelay; + + public Integer getGroupId() { + return groupId; + } + + public Integer getNpcId() { + return npcId; + } + + public Long getChatDelay() { + return chatDelay; + } } diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/repository/AutoChatRepository.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/repository/AutoChatRepository.java new file mode 100644 index 00000000..df183903 --- /dev/null +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/repository/AutoChatRepository.java @@ -0,0 +1,7 @@ +package com.l2jbr.gameserver.model.database.repository; + +import com.l2jbr.gameserver.model.database.AutoChat; +import org.springframework.data.repository.CrudRepository; + +public interface AutoChatRepository extends CrudRepository { +} From d2deb9b29dbba0a32b99362cc5b47e297d9743ae Mon Sep 17 00:00:00 2001 From: Alisson Oliveira Date: Mon, 23 Apr 2018 18:38:40 -0300 Subject: [PATCH 027/236] =?UTF-8?q?Remove=20refer=C3=AAncias=20diretas=20?= =?UTF-8?q?=C3=A0=20tabela=20auto=5Fchat=5Ftext?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Commons/src/test/java/App.java | 18 ----- .../instancemanager/MercTicketManager.java | 3 +- .../gameserver/model/AutoChatHandler.java | 80 ++++++------------- .../gameserver/model/database/AutoChat.java | 9 +++ .../model/database/AutoChatText.java | 9 ++- .../resources/gameserver-messages.properties | 1 + .../gameserver-messages_pt_BR.properties | 1 + Gameserver/src/test/java/App.java | 20 +++++ .../src/test/java/ConfigContext.java | 0 9 files changed, 64 insertions(+), 77 deletions(-) delete mode 100644 Commons/src/test/java/App.java create mode 100644 Gameserver/src/test/java/App.java rename {Commons => Gameserver}/src/test/java/ConfigContext.java (100%) diff --git a/Commons/src/test/java/App.java b/Commons/src/test/java/App.java deleted file mode 100644 index 6b93a7be..00000000 --- a/Commons/src/test/java/App.java +++ /dev/null @@ -1,18 +0,0 @@ -import com.l2jbr.commons.database.AccountRepository; -import com.l2jbr.commons.database.model.Account; -import org.springframework.context.annotation.AnnotationConfigApplicationContext; - -import java.util.Optional; - -public class App { - - public static void main(String[] args) { - AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext(ConfigContext.class); - AccountRepository rep = context.getBean(AccountRepository.class); - Iterable result = rep.findAll(); - System.out.println(result); - Optional op = rep.findByLogin("admin"); - System.out.println(op); - - } -} diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/instancemanager/MercTicketManager.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/instancemanager/MercTicketManager.java index 0e7fe7d2..5ca5d80a 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/instancemanager/MercTicketManager.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/instancemanager/MercTicketManager.java @@ -33,6 +33,7 @@ import java.sql.PreparedStatement; import java.sql.ResultSet; +import java.util.Arrays; import java.util.LinkedList; import java.util.List; @@ -868,7 +869,7 @@ private void spawnMercenary(int npcId, int x, int y, int z, int despawnDelay, St npc.spawnMe(x, y, (z + 20)); if ((messages != null) && (messages.length > 0)) { - AutoChatHandler.getInstance().registerChat(npc, messages, chatDelay); + AutoChatHandler.getInstance().registerChat(npc, Arrays.asList(messages), chatDelay); } if (despawnDelay > 0) { diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/AutoChatHandler.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/AutoChatHandler.java index 04e515bf..50c317ed 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/AutoChatHandler.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/AutoChatHandler.java @@ -20,7 +20,6 @@ import com.l2jbr.commons.Config; import com.l2jbr.commons.database.DatabaseAccess; -import com.l2jbr.commons.database.L2DatabaseFactory; import com.l2jbr.commons.util.Rnd; import com.l2jbr.gameserver.SevenSigns; import com.l2jbr.gameserver.ThreadPoolManager; @@ -33,13 +32,12 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import java.sql.PreparedStatement; -import java.sql.ResultSet; import java.util.LinkedHashMap; import java.util.LinkedList; import java.util.List; import java.util.Map; import java.util.concurrent.ScheduledFuture; +import java.util.stream.Collectors; /** @@ -63,47 +61,17 @@ protected AutoChatHandler() { private void restoreChatData() { int numLoaded = 0; - java.sql.Connection con = null; - PreparedStatement statement2 = null; - ResultSet rs2 = null; + AutoChatRepository repository = DatabaseAccess.getRepository(AutoChatRepository.class); - try { - con = L2DatabaseFactory.getInstance().getConnection(); + for (AutoChat autoChat: repository.findAll()) { + numLoaded++; + List chatTexts = autoChat.getTexts().stream().map(autoChatText -> + autoChatText.getChatText()).collect(Collectors.toList()); - AutoChatRepository repository = DatabaseAccess.getRepository(AutoChatRepository.class); - for (AutoChat autoChat: repository.findAll()) { - numLoaded++; - - statement2 = con.prepareStatement("SELECT * FROM auto_chat_text WHERE groupId=?"); - statement2.setInt(1, autoChat.getGroupId()); - rs2 = statement2.executeQuery(); - - rs2.last(); - String[] chatTexts = new String[rs2.getRow()]; - int i = 0; - rs2.first(); - - while (rs2.next()) { - chatTexts[i] = rs2.getString("chatText"); - i++; - } - - registerGlobalChat(autoChat.getNpcId(), chatTexts, autoChat.getChatDelay()); - - statement2.close(); - } - - if (Config.DEBUG) { - _log.info("AutoChatHandler: Loaded " + numLoaded + " chat group(s) from the database."); - } - } catch (Exception e) { - _log.warn("AutoSpawnHandler: Could not restore chat data: " + e); - } finally { - try { - con.close(); - } catch (Exception e) { - } + registerGlobalChat(autoChat.getNpcId(), chatTexts , autoChat.getChatDelay()); } + + _log.info("info.auto.chat.loaded", numLoaded); } public static AutoChatHandler getInstance() { @@ -127,7 +95,7 @@ public int size() { * @param chatDelay (-1 = default delay) * @return AutoChatInstance chatInst */ - public AutoChatInstance registerGlobalChat(int npcId, String[] chatTexts, long chatDelay) { + public AutoChatInstance registerGlobalChat(int npcId, List chatTexts, long chatDelay) { return registerChat(npcId, null, chatTexts, chatDelay); } @@ -139,11 +107,11 @@ public AutoChatInstance registerGlobalChat(int npcId, String[] chatTexts, long c * @param chatDelay (-1 = default delay) * @return AutoChatInstance chatInst */ - public AutoChatInstance registerChat(L2NpcInstance npcInst, String[] chatTexts, long chatDelay) { + public AutoChatInstance registerChat(L2NpcInstance npcInst, List chatTexts, long chatDelay) { return registerChat(npcInst.getNpcId(), npcInst, chatTexts, chatDelay); } - private final AutoChatInstance registerChat(int npcId, L2NpcInstance npcInst, String[] chatTexts, long chatDelay) { + private final AutoChatInstance registerChat(int npcId, L2NpcInstance npcInst, List chatTexts, long chatDelay) { AutoChatInstance chatInst = null; if (chatDelay < 0) { @@ -259,7 +227,7 @@ public void npcSpawned(L2NpcInstance npc) { public class AutoChatInstance { protected int _npcId; private long _defaultDelay = DEFAULT_CHAT_DELAY; - private String[] _defaultTexts; + private List _defaultTexts; private boolean _defaultRandom = false; private boolean _globalChat = false; @@ -268,7 +236,7 @@ public class AutoChatInstance { private final Map _chatDefinitions = new LinkedHashMap<>(); protected ScheduledFuture _chatTask; - protected AutoChatInstance(int npcId, String[] chatTexts, long chatDelay, boolean isGlobal) { + protected AutoChatInstance(int npcId, List chatTexts, long chatDelay, boolean isGlobal) { _defaultTexts = chatTexts; _npcId = npcId; _defaultDelay = chatDelay; @@ -310,7 +278,7 @@ public int addChatDefinition(L2NpcInstance npcInst) { * @param chatDelay * @return int objectId */ - public int addChatDefinition(L2NpcInstance npcInst, String[] chatTexts, long chatDelay) { + public int addChatDefinition(L2NpcInstance npcInst, List chatTexts, long chatDelay) { int objectId = npcInst.getObjectId(); AutoChatDefinition chatDef = new AutoChatDefinition(this, npcInst, chatTexts, chatDelay); if (npcInst instanceof L2SiegeGuardInstance) { @@ -422,7 +390,7 @@ public long getDefaultDelay() { return _defaultDelay; } - public String[] getDefaultTexts() { + public List getDefaultTexts() { return _defaultTexts; } @@ -430,7 +398,7 @@ public void setDefaultChatDelay(long delayValue) { _defaultDelay = delayValue; } - public void setDefaultChatTexts(String[] textsValue) { + public void setDefaultChatTexts(List textsValue) { _defaultTexts = textsValue; } @@ -458,7 +426,7 @@ public void setChatDelay(int objectId, long delayValue) { * @param objectId * @param textsValue */ - public void setChatTexts(int objectId, String[] textsValue) { + public void setChatTexts(int objectId, List textsValue) { AutoChatDefinition chatDef = getChatDefinition(objectId); if (chatDef != null) { @@ -523,11 +491,11 @@ private class AutoChatDefinition { protected AutoChatInstance _chatInstance; private long _chatDelay = 0; - private String[] _chatTexts = null; + private List _chatTexts = null; private boolean _isActiveDefinition; private boolean _randomChat; - protected AutoChatDefinition(AutoChatInstance chatInst, L2NpcInstance npcInst, String[] chatTexts, long chatDelay) { + protected AutoChatDefinition(AutoChatInstance chatInst, L2NpcInstance npcInst, List chatTexts, long chatDelay) { _npcInstance = npcInst; _chatInstance = chatInst; @@ -547,7 +515,7 @@ protected AutoChatDefinition(AutoChatInstance chatInst, L2NpcInstance npcInst, S } } - protected String[] getChatTexts() { + protected List getChatTexts() { if (_chatTexts != null) { return _chatTexts; } @@ -577,7 +545,7 @@ void setChatDelay(long delayValue) { _chatDelay = delayValue; } - void setChatTexts(String[] textsValue) { + void setChatTexts(List textsValue) { _chatTexts = textsValue; } @@ -662,7 +630,7 @@ public synchronized void run() { } } - int maxIndex = chatDef.getChatTexts().length; + int maxIndex = chatDef.getChatTexts().size(); int lastIndex = Rnd.nextInt(maxIndex); String creatureName = chatNpc.getName(); @@ -679,7 +647,7 @@ public synchronized void run() { chatDef._chatIndex = lastIndex; } - text = chatDef.getChatTexts()[lastIndex]; + text = chatDef.getChatTexts().get(lastIndex); if (text == null) { return; diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/AutoChat.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/AutoChat.java index 33bd8061..ddabb150 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/AutoChat.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/AutoChat.java @@ -1,8 +1,11 @@ package com.l2jbr.gameserver.model.database; +import com.l2jbr.commons.database.annotation.Column; import com.l2jbr.commons.database.annotation.Table; import org.springframework.data.annotation.Id; +import java.util.Set; + @Table("auto_chat") public class AutoChat { @@ -10,6 +13,8 @@ public class AutoChat { private Integer groupId; private Integer npcId; private Long chatDelay; + @Column("groupId") + private Set texts; public Integer getGroupId() { return groupId; @@ -22,4 +27,8 @@ public Integer getNpcId() { public Long getChatDelay() { return chatDelay; } + + public Set getTexts() { + return texts; + } } diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/AutoChatText.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/AutoChatText.java index eda70cae..6f0cccb5 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/AutoChatText.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/AutoChatText.java @@ -1,9 +1,14 @@ package com.l2jbr.gameserver.model.database; +import com.l2jbr.commons.database.annotation.Table; - +@Table("auto_chat_text") public class AutoChatText { private int groupId; - private String chatText; + private String chatText; + + public String getChatText() { + return chatText; + } } diff --git a/Gameserver/src/main/resources/gameserver-messages.properties b/Gameserver/src/main/resources/gameserver-messages.properties index 98c8b6ac..3b5ffefc 100644 --- a/Gameserver/src/main/resources/gameserver-messages.properties +++ b/Gameserver/src/main/resources/gameserver-messages.properties @@ -29,3 +29,4 @@ error.clan.remove=Error while removing clan from database. info.loaded.clanhall=Loaded {} clan halls. info.loaded.free.clanhall=Loaded {} free clan halls. info.npc.loaded=NpcTable: Loaded {} Npc Templates. +info.auto.chat.loaded=AutoChatHandler: Loaded {} chat group(s) from the database. diff --git a/Gameserver/src/main/resources/gameserver-messages_pt_BR.properties b/Gameserver/src/main/resources/gameserver-messages_pt_BR.properties index c4f58b03..fc89887d 100644 --- a/Gameserver/src/main/resources/gameserver-messages_pt_BR.properties +++ b/Gameserver/src/main/resources/gameserver-messages_pt_BR.properties @@ -29,3 +29,4 @@ error.clan.remove=Erro removendo clan do banco de dados. info.loaded.clanhall={} Clan Halls carregados. info.loaded.free.clanhall={} Clan halls livres carregados. info.npc.loaded=NpcTable: {} modelos de NPCs carregados. +info.auto.chat.loaded=AutoChatHandler: {} grupos de chat foram carregados do banco de dados. diff --git a/Gameserver/src/test/java/App.java b/Gameserver/src/test/java/App.java new file mode 100644 index 00000000..c4d7f617 --- /dev/null +++ b/Gameserver/src/test/java/App.java @@ -0,0 +1,20 @@ +import com.l2jbr.gameserver.model.database.AutoChat; +import com.l2jbr.gameserver.model.database.repository.AutoChatRepository; +import org.springframework.context.annotation.AnnotationConfigApplicationContext; + +import java.util.Optional; +import java.util.Set; +import java.util.stream.Collectors; + +public class App { + + public static void main(String[] args) { + AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext(ConfigContext.class); + AutoChatRepository rep = context.getBean(AutoChatRepository.class); + Optional result = rep.findById(1); + Set chatTexts = result.get().getTexts().stream().map(autoChatText -> + autoChatText.getChatText()).collect(Collectors.toSet()); + String[] strings = chatTexts.toArray(new String[]{}); + System.out.println(strings); + } +} diff --git a/Commons/src/test/java/ConfigContext.java b/Gameserver/src/test/java/ConfigContext.java similarity index 100% rename from Commons/src/test/java/ConfigContext.java rename to Gameserver/src/test/java/ConfigContext.java From 45f256867059275b1525c8899574e01e8a460c2c Mon Sep 17 00:00:00 2001 From: Alisson Oliveira Date: Tue, 24 Apr 2018 13:02:12 -0300 Subject: [PATCH 028/236] =?UTF-8?q?Remove=20refer=C3=AAncias=20diretas=20?= =?UTF-8?q?=C3=A0=20tabela=20castle?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../gameserver/datatables/ClanTable.java | 11 +- .../instancemanager/CastleManager.java | 38 +----- .../gameserver/model/database/BoxAccess.java | 1 - .../gameserver/model/database/Castle.java | 13 -- .../gameserver/model/database/CastleData.java | 43 ++++++ .../database/repository/CastleRepository.java | 22 +++ .../l2jbr/gameserver/model/entity/Castle.java | 128 +++++------------- .../l2jbr/gameserver/model/entity/Siege.java | 26 +--- .../accountmanager/SQLAccountManager.java | 2 + 9 files changed, 118 insertions(+), 166 deletions(-) delete mode 100644 Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/Castle.java create mode 100644 Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/CastleData.java create mode 100644 Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/repository/CastleRepository.java diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/datatables/ClanTable.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/datatables/ClanTable.java index b60fb052..53b7431e 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/datatables/ClanTable.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/datatables/ClanTable.java @@ -27,6 +27,7 @@ import com.l2jbr.gameserver.model.L2Clan; import com.l2jbr.gameserver.model.L2ClanMember; import com.l2jbr.gameserver.model.actor.instance.L2PcInstance; +import com.l2jbr.gameserver.model.database.repository.CastleRepository; import com.l2jbr.gameserver.model.database.repository.ClanRepository; import com.l2jbr.gameserver.model.entity.Siege; import com.l2jbr.gameserver.network.SystemMessageId; @@ -204,8 +205,8 @@ public synchronized void destroyClan(int clanId) { java.sql.Connection con = null; try { - ClanRepository repository = DatabaseAccess.getRepository(ClanRepository.class); - repository.deleteById(clanId); + ClanRepository clanRepository = DatabaseAccess.getRepository(ClanRepository.class); + clanRepository.deleteById(clanId); con = L2DatabaseFactory.getInstance().getConnection(); @@ -231,10 +232,8 @@ public synchronized void destroyClan(int clanId) { statement.close(); if (castleId != 0) { - statement = con.prepareStatement("UPDATE castle SET taxPercent = 0 WHERE id = ?"); - statement.setInt(1, castleId); - statement.execute(); - statement.close(); + CastleRepository castleRepository = DatabaseAccess.getRepository(CastleRepository.class); + castleRepository.updateTaxById(castleId, 0); } _log.debug(getMessage("debug.clan.removed"), clanId); diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/instancemanager/CastleManager.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/instancemanager/CastleManager.java index 838817e5..4d19a61a 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/instancemanager/CastleManager.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/instancemanager/CastleManager.java @@ -17,6 +17,7 @@ */ package com.l2jbr.gameserver.instancemanager; +import com.l2jbr.commons.database.DatabaseAccess; import com.l2jbr.commons.database.L2DatabaseFactory; import com.l2jbr.gameserver.SevenSigns; import com.l2jbr.gameserver.model.L2Clan; @@ -24,10 +25,10 @@ import com.l2jbr.gameserver.model.L2ItemInstance; import com.l2jbr.gameserver.model.L2Object; import com.l2jbr.gameserver.model.actor.instance.L2PcInstance; +import com.l2jbr.gameserver.model.database.repository.CastleRepository; import com.l2jbr.gameserver.model.entity.Castle; import java.sql.PreparedStatement; -import java.sql.ResultSet; import java.util.LinkedList; import java.util.List; @@ -94,40 +95,13 @@ public final int findNearestCastleIndex(L2Object obj) { return index; } - // ========================================================= - // Method - Private private final void load() { - java.sql.Connection con = null; - try { - PreparedStatement statement; - ResultSet rs; - - con = L2DatabaseFactory.getInstance().getConnection(); - - statement = con.prepareStatement("Select id from castle order by id"); - rs = statement.executeQuery(); - - while (rs.next()) { - getCastles().add(new Castle(rs.getInt("id"))); - } - - statement.close(); - - System.out.println("Loaded: " + getCastles().size() + " castles"); - } catch (Exception e) { - System.out.println("Exception: loadCastleData(): " + e.getMessage()); - e.printStackTrace(); - } finally { - try { - con.close(); - } catch (Exception e) { - } - } + CastleRepository repository = DatabaseAccess.getRepository(CastleRepository.class); + repository.findAll().forEach(castle -> { + getCastles().add(new Castle(castle)); + }); } - // ========================================================= - // Property - Public - public final Castle getCastleById(int castleId) { for (Castle temp : getCastles()) { if (temp.getCastleId() == castleId) { diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/BoxAccess.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/BoxAccess.java index aa5b4f58..e9cf5b02 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/BoxAccess.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/BoxAccess.java @@ -1,7 +1,6 @@ package com.l2jbr.gameserver.model.database; - public class BoxAccess { private int spawn; private String charName; diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/Castle.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/Castle.java deleted file mode 100644 index 98424a2c..00000000 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/Castle.java +++ /dev/null @@ -1,13 +0,0 @@ -package com.l2jbr.gameserver.model.database; - - - -public class Castle { - private int id; - private String name; - private int taxPercent; - private int treasury; - private long siegeDate; - private int siegeDayOfWeek; - private int siegeHourOfDay; -} diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/CastleData.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/CastleData.java new file mode 100644 index 00000000..abba886e --- /dev/null +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/CastleData.java @@ -0,0 +1,43 @@ +package com.l2jbr.gameserver.model.database; + +import org.springframework.data.annotation.Id; + +public class CastleData { + + @Id + private int id; + private String name; + private int taxPercent; + private int treasury; + private long siegeDate; + private int siegeDayOfWeek; + private int siegeHourOfDay; + + public int getId() { + return id; + } + + public String getName() { + return name; + } + + public int getTaxPercent() { + return taxPercent; + } + + public int getTreasury() { + return treasury; + } + + public long getSiegeDate() { + return siegeDate; + } + + public int getSiegeDayOfWeek() { + return siegeDayOfWeek; + } + + public int getSiegeHourOfDay() { + return siegeHourOfDay; + } +} diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/repository/CastleRepository.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/repository/CastleRepository.java new file mode 100644 index 00000000..9f376d83 --- /dev/null +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/repository/CastleRepository.java @@ -0,0 +1,22 @@ +package com.l2jbr.gameserver.model.database.repository; + +import com.l2jbr.gameserver.model.database.CastleData; +import org.springframework.data.jdbc.repository.query.Modifying; +import org.springframework.data.jdbc.repository.query.Query; +import org.springframework.data.repository.CrudRepository; +import org.springframework.data.repository.query.Param; + +public interface CastleRepository extends CrudRepository { + + @Modifying + @Query("UPDATE castle SET siegeDate=:siegeDate WHERE id=:castle") + int updateSiegeDateById(@Param("castle") int castleId, @Param("siegeDate") long timeInMillis); + + @Modifying + @Query("UPDATE castle SET treasury=:treasury WHERE id=:castle") + int updateTreasuryById(@Param("castle") int castleId, @Param("treasury") int treasury); + + @Modifying + @Query("UPDATE castle SET taxPercent=:tax WHERE id=:castle") + int updateTaxById(@Param("castle") int castleId, @Param("tax") int taxPercent); +} diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/entity/Castle.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/entity/Castle.java index 8462864c..9651d090 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/entity/Castle.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/entity/Castle.java @@ -36,6 +36,8 @@ import com.l2jbr.gameserver.model.L2Object; import com.l2jbr.gameserver.model.actor.instance.L2DoorInstance; import com.l2jbr.gameserver.model.actor.instance.L2PcInstance; +import com.l2jbr.gameserver.model.database.CastleData; +import com.l2jbr.gameserver.model.database.repository.CastleRepository; import com.l2jbr.gameserver.model.database.repository.ClanRepository; import com.l2jbr.gameserver.model.zone.type.L2CastleZone; import com.l2jbr.gameserver.serverpackets.PledgeShowInfoUpdate; @@ -81,20 +83,10 @@ public class Castle { private int _nbArtifact = 1; private final Map _engrave = new LinkedHashMap<>(); - // ========================================================= - // Constructor - public Castle(int castleId) { - _castleId = castleId; - if ((_castleId == 7) || (castleId == 9)) { - _nbArtifact = 2; - } - load(); - loadDoor(); + public Castle(CastleData castleData) { + load(castleData); } - // ========================================================= - // Method - Public - public void Engrave(L2Clan clan, int objId) { _engrave.put(objId, clan.getClanId()); if (_engrave.size() == _nbArtifact) { @@ -178,21 +170,8 @@ public boolean addToTreasuryNoTax(int amount) { } } - java.sql.Connection con = null; - try { - con = L2DatabaseFactory.getInstance().getConnection(); - PreparedStatement statement = con.prepareStatement("Update castle set treasury = ? where id = ?"); - statement.setInt(1, getTreasury()); - statement.setInt(2, getCastleId()); - statement.execute(); - statement.close(); - } catch (Exception e) { - } finally { - try { - con.close(); - } catch (Exception e) { - } - } + CastleRepository repository = DatabaseAccess.getRepository(CastleRepository.class); + repository.updateTreasuryById(getCastleId(), getTreasury()); return true; } @@ -337,21 +316,8 @@ public void setTaxPercent(int taxPercent) { _taxPercent = taxPercent; _taxRate = _taxPercent / 100.0; - java.sql.Connection con = null; - try { - con = L2DatabaseFactory.getInstance().getConnection(); - PreparedStatement statement = con.prepareStatement("Update castle set taxPercent = ? where id = ?"); - statement.setInt(1, taxPercent); - statement.setInt(2, getCastleId()); - statement.execute(); - statement.close(); - } catch (Exception e) { - } finally { - try { - con.close(); - } catch (Exception e) { - } - } + CastleRepository repository = DatabaseAccess.getRepository(CastleRepository.class); + repository.updateTaxById(getCastleId(), taxPercent); } /** @@ -400,64 +366,40 @@ public void upgradeDoor(int doorId, int hp, int pDef, int mDef) { } } - // ========================================================= - // Method - Private - // This method loads castle - private void load() { - java.sql.Connection con = null; - try { - PreparedStatement statement; - ResultSet rs; - - con = L2DatabaseFactory.getInstance().getConnection(); - - statement = con.prepareStatement("Select * from castle where id = ?"); - statement.setInt(1, getCastleId()); - rs = statement.executeQuery(); - - while (rs.next()) { - _name = rs.getString("name"); - // _OwnerId = rs.getInt("ownerId"); - - _siegeDate = Calendar.getInstance(); - _siegeDate.setTimeInMillis(rs.getLong("siegeDate")); - - _siegeDayOfWeek = rs.getInt("siegeDayOfWeek"); - if ((_siegeDayOfWeek < 1) || (_siegeDayOfWeek > 7)) { - _siegeDayOfWeek = 7; - } + private void load(CastleData castleData) { + _castleId = castleData.getId(); + if ((_castleId == 7) || (_castleId == 9)) { + _nbArtifact = 2; + } + _name = castleData.getName(); + _siegeDate = Calendar.getInstance(); + _siegeDate.setTimeInMillis(castleData.getSiegeDate()); - _siegeHourOfDay = rs.getInt("siegeHourOfDay"); - if ((_siegeHourOfDay < 0) || (_siegeHourOfDay > 23)) { - _siegeHourOfDay = 20; - } + _siegeDayOfWeek = castleData.getSiegeDayOfWeek(); + if(_siegeDayOfWeek < 1 || _siegeDayOfWeek > 7) { + _siegeDayOfWeek = 7; + } - _taxPercent = rs.getInt("taxPercent"); - _treasury = rs.getInt("treasury"); - } + _siegeHourOfDay = castleData.getSiegeHourOfDay(); + if(_siegeHourOfDay < 0 || _siegeHourOfDay > 23) { + _siegeHourOfDay = 20; + } - statement.close(); + _taxPercent = castleData.getTaxPercent(); + _treasury = castleData.getTreasury(); - _taxRate = _taxPercent / 100.0; - ClanRepository repository = DatabaseAccess.getRepository(ClanRepository.class); - int castleId = repository.findClanIdByCastle(getCastleId()); - if(castleId != 0) { - _ownerId = castleId; - L2Clan clan = ClanTable.getInstance().getClan(getOwnerId()); // Try to find clan instance - ThreadPoolManager.getInstance().scheduleGeneral(new CastleUpdater(clan, 1), 3600000); // Schedule owner tasks to start running - } + _taxRate = _taxPercent / 100.0; - statement.close(); - } catch (Exception e) { - System.out.println("Exception: loadCastleData(): " + e.getMessage()); - e.printStackTrace(); - } finally { - try { - con.close(); - } catch (Exception e) { - } + ClanRepository clanRepository = DatabaseAccess.getRepository(ClanRepository.class); + int clanId = clanRepository.findClanIdByCastle(getCastleId()); + if(clanId != 0) { + _ownerId = clanId; + L2Clan clan = ClanTable.getInstance().getClan(getOwnerId()); // Try to find clan instance + ThreadPoolManager.getInstance().scheduleGeneral(new CastleUpdater(clan, 1), 3600000); // Schedule owner tasks to start running } + + loadDoor(); } // This method loads castle door data from database diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/entity/Siege.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/entity/Siege.java index 185b83c2..23060639 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/entity/Siege.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/entity/Siege.java @@ -18,6 +18,7 @@ */ package com.l2jbr.gameserver.model.entity; +import com.l2jbr.commons.database.DatabaseAccess; import com.l2jbr.commons.database.L2DatabaseFactory; import com.l2jbr.gameserver.Announcements; import com.l2jbr.gameserver.ThreadPoolManager; @@ -35,6 +36,7 @@ import com.l2jbr.gameserver.model.actor.instance.L2ControlTowerInstance; import com.l2jbr.gameserver.model.actor.instance.L2NpcInstance; import com.l2jbr.gameserver.model.actor.instance.L2PcInstance; +import com.l2jbr.gameserver.model.database.repository.CastleRepository; import com.l2jbr.gameserver.network.SystemMessageId; import com.l2jbr.gameserver.serverpackets.RelationChanged; import com.l2jbr.gameserver.serverpackets.SiegeInfo; @@ -1073,28 +1075,10 @@ private void saveCastleSiege() { startAutoTask(); // Prepare auto start siege and end registration } - /** - * Save siege date to database. - */ - private void saveSiegeDate() { - java.sql.Connection con = null; - try { - con = L2DatabaseFactory.getInstance().getConnection(); - PreparedStatement statement = con.prepareStatement("Update castle set siegeDate = ? where id = ?"); - statement.setLong(1, getSiegeDate().getTimeInMillis()); - statement.setInt(2, getCastle().getCastleId()); - statement.execute(); - statement.close(); - } catch (Exception e) { - System.out.println("Exception: saveSiegeDate(): " + e.getMessage()); - e.printStackTrace(); - } finally { - try { - con.close(); - } catch (Exception e) { - } - } + private void saveSiegeDate() { + CastleRepository repository = DatabaseAccess.getRepository(CastleRepository.class); + repository.updateSiegeDateById(getCastle().getCastleId(), getSiegeDate().getTimeInMillis()); } /** diff --git a/Tools/src/main/com.l2jbr.tools/com/l2jbr/tools/accountmanager/SQLAccountManager.java b/Tools/src/main/com.l2jbr.tools/com/l2jbr/tools/accountmanager/SQLAccountManager.java index e0648665..16196483 100644 --- a/Tools/src/main/com.l2jbr.tools/com/l2jbr/tools/accountmanager/SQLAccountManager.java +++ b/Tools/src/main/com.l2jbr.tools/com/l2jbr/tools/accountmanager/SQLAccountManager.java @@ -239,6 +239,8 @@ private static void deleteAccount(String login) throws SQLException { statement.setInt(1, character.getObjectId()); statement.executeUpdate(); + + // boxaccess statement.close(); statement = con.prepareStatement("DELETE FROM boxaccess WHERE charname=?;"); From 2cba1807f06d85e5cd3ad46bf3508f602fb9a953 Mon Sep 17 00:00:00 2001 From: Alisson Oliveira Date: Tue, 24 Apr 2018 14:05:12 -0300 Subject: [PATCH 029/236] Remove tabela castle_doorupgrade --- Datapack/sql/castle_doorupgrade.sql | 10 --- .../sql/experimental/l2j_full_structure.sql | 19 ------ Datapack/tools/database_installer.bat | 1 - Datapack/tools/database_installer.sh | 1 - Datapack/tools/full_install.sql | 1 - .../l2jbr/gameserver/model/entity/Castle.java | 63 ------------------- 6 files changed, 95 deletions(-) delete mode 100644 Datapack/sql/castle_doorupgrade.sql diff --git a/Datapack/sql/castle_doorupgrade.sql b/Datapack/sql/castle_doorupgrade.sql deleted file mode 100644 index ff85efa8..00000000 --- a/Datapack/sql/castle_doorupgrade.sql +++ /dev/null @@ -1,10 +0,0 @@ --- --------------------------- --- Table structure for castle_doorupgrade --- --------------------------- -CREATE TABLE IF NOT EXISTS castle_doorupgrade ( - doorId INT NOT NULL default 0, - hp INT NOT NULL default 0, - pDef INT NOT NULL default 0, - mDef INT NOT NULL default 0, - PRIMARY KEY (doorId ) -); \ No newline at end of file diff --git a/Datapack/sql/experimental/l2j_full_structure.sql b/Datapack/sql/experimental/l2j_full_structure.sql index cf277b9f..c32349b3 100644 --- a/Datapack/sql/experimental/l2j_full_structure.sql +++ b/Datapack/sql/experimental/l2j_full_structure.sql @@ -646,25 +646,6 @@ ENGINE = InnoDB DEFAULT CHARACTER SET = latin1; --- ----------------------------------------------------- --- Table `castle_doorupgrade` --- ----------------------------------------------------- -DROP TABLE IF EXISTS `castle_doorupgrade` ; - -CREATE TABLE IF NOT EXISTS `castle_doorupgrade` ( - `doorId` INT(11) NOT NULL DEFAULT '0', - `hp` INT(11) NOT NULL DEFAULT '0', - `pDef` INT(11) NOT NULL DEFAULT '0', - `mDef` INT(11) NOT NULL DEFAULT '0', - PRIMARY KEY (`doorId`), - CONSTRAINT `fk_castle_doorupgrade_castle_door1` - FOREIGN KEY (`doorId`) - REFERENCES `castle_door` (`id`) - ON DELETE NO ACTION - ON UPDATE NO ACTION) -ENGINE = InnoDB -DEFAULT CHARACTER SET = latin1; - -- ----------------------------------------------------- -- Table `castle_manor_procure` diff --git a/Datapack/tools/database_installer.bat b/Datapack/tools/database_installer.bat index 9dfb39c9..beb4a87c 100644 --- a/Datapack/tools/database_installer.bat +++ b/Datapack/tools/database_installer.bat @@ -525,7 +525,6 @@ boxaccess.sql boxes.sql castle.sql castle_door.sql -castle_doorupgrade.sql castle_siege_guards.sql char_templates.sql character_friends.sql diff --git a/Datapack/tools/database_installer.sh b/Datapack/tools/database_installer.sh index 44be4377..038d4ddd 100644 --- a/Datapack/tools/database_installer.sh +++ b/Datapack/tools/database_installer.sh @@ -265,7 +265,6 @@ $MYG < ../sql/boxaccess.sql &> /dev/null $MYG < ../sql/boxes.sql &> /dev/null $MYG < ../sql/castle.sql &> /dev/null $MYG < ../sql/castle_door.sql &> /dev/null -$MYG < ../sql/castle_doorupgrade.sql &> /dev/null $MYG < ../sql/castle_siege_guards.sql &> /dev/null $MYG < ../sql/char_templates.sql &> /dev/null $MYG < ../sql/character_friends.sql &> /dev/null diff --git a/Datapack/tools/full_install.sql b/Datapack/tools/full_install.sql index 8c314e85..bedaf581 100644 --- a/Datapack/tools/full_install.sql +++ b/Datapack/tools/full_install.sql @@ -9,7 +9,6 @@ DROP TABLE IF EXISTS boxaccess; DROP TABLE IF EXISTS boxes; DROP TABLE IF EXISTS castle; DROP TABLE IF EXISTS castle_door; -DROP TABLE IF EXISTS castle_doorupgrade; DROP TABLE IF EXISTS castle_siege_guards; DROP TABLE IF EXISTS char_templates; DROP TABLE IF EXISTS character_friends; diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/entity/Castle.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/entity/Castle.java index 9651d090..c044cc1e 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/entity/Castle.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/entity/Castle.java @@ -348,22 +348,6 @@ public void spawnDoor(boolean isDoorWeak) { door.closeMe(); } } - loadDoorUpgrade(); // Check for any upgrade the doors may have - } - - // This method upgrade door - public void upgradeDoor(int doorId, int hp, int pDef, int mDef) { - L2DoorInstance door = getDoor(doorId); - if (door == null) { - return; - } - - if (door.getDoorId() == doorId) { - door.setCurrentHp(door.getMaxHp() + hp); - - saveDoorUpgrade(doorId, hp, pDef, mDef); - return; - } } private void load(CastleData castleData) { @@ -433,31 +417,6 @@ private void loadDoor() { } } - // This method loads castle door upgrade data from database - private void loadDoorUpgrade() { - java.sql.Connection con = null; - try { - con = L2DatabaseFactory.getInstance().getConnection(); - PreparedStatement statement = con.prepareStatement("Select * from castle_doorupgrade where doorId in (Select Id from castle_door where castleId = ?)"); - statement.setInt(1, getCastleId()); - ResultSet rs = statement.executeQuery(); - - while (rs.next()) { - upgradeDoor(rs.getInt("id"), rs.getInt("hp"), rs.getInt("pDef"), rs.getInt("mDef")); - } - - statement.close(); - } catch (Exception e) { - System.out.println("Exception: loadCastleDoorUpgrade(): " + e.getMessage()); - e.printStackTrace(); - } finally { - try { - con.close(); - } catch (Exception e) { - } - } - } - private void removeDoorUpgrade() { java.sql.Connection con = null; try { @@ -477,28 +436,6 @@ private void removeDoorUpgrade() { } } - private void saveDoorUpgrade(int doorId, int hp, int pDef, int mDef) { - java.sql.Connection con = null; - try { - con = L2DatabaseFactory.getInstance().getConnection(); - PreparedStatement statement = con.prepareStatement("INSERT INTO castle_doorupgrade (doorId, hp, pDef, mDef) values (?,?,?,?)"); - statement.setInt(1, doorId); - statement.setInt(2, hp); - statement.setInt(3, pDef); - statement.setInt(4, mDef); - statement.execute(); - statement.close(); - } catch (Exception e) { - System.out.println("Exception: saveDoorUpgrade(int doorId, int hp, int pDef, int mDef): " + e.getMessage()); - e.printStackTrace(); - } finally { - try { - con.close(); - } catch (Exception e) { - } - } - } - private void updateOwnerInDB(L2Clan clan) { if (clan != null) { _ownerId = clan.getClanId(); // Update owner id property From ab5c756789afc4f189de32f17cf623853e03303e Mon Sep 17 00:00:00 2001 From: Alisson Oliveira Date: Tue, 24 Apr 2018 18:06:20 -0300 Subject: [PATCH 030/236] =?UTF-8?q?Remove=20refer=C3=AAncias=20diretas=20?= =?UTF-8?q?=C3=A0=20tabela=20castle=5Fdoor?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../gameserver/datatables/DoorTable.java | 92 +++++++++++++++++++ .../gameserver/model/database/CastleData.java | 11 +++ .../gameserver/model/database/CastleDoor.java | 74 ++++++++++++++- .../l2jbr/gameserver/model/entity/Castle.java | 65 ++----------- .../l2jbr/gameserver/model/entity/Siege.java | 1 - 5 files changed, 184 insertions(+), 59 deletions(-) diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/datatables/DoorTable.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/datatables/DoorTable.java index 964c015e..d1500364 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/datatables/DoorTable.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/datatables/DoorTable.java @@ -22,6 +22,7 @@ import com.l2jbr.gameserver.idfactory.IdFactory; import com.l2jbr.gameserver.instancemanager.ClanHallManager; import com.l2jbr.gameserver.model.actor.instance.L2DoorInstance; +import com.l2jbr.gameserver.model.database.CastleDoor; import com.l2jbr.gameserver.model.entity.ClanHall; import com.l2jbr.gameserver.pathfinding.AbstractNodeLoc; import com.l2jbr.gameserver.templates.L2CharTemplate; @@ -55,6 +56,8 @@ public DoorTable() { // parseData(); } + + public void reloadAll() { respawn(); } @@ -108,6 +111,95 @@ public void parseData() { } } + public static L2DoorInstance parseDoor(CastleDoor castleDoor) { + int rangeXMin = castleDoor.getRangeXmin(); + int rangeXMax = castleDoor.getRangeXmax(); + int rangeYMin = castleDoor.getRangeYmin(); + int rangeYMax = castleDoor.getRangeYmax(); + int rangeZMin = castleDoor.getRangeZmin(); + int rangeZMax = castleDoor.getRangeXmax(); + + if (rangeXMin > rangeXMax) { + _log.error("Error in door data, ID: {}", castleDoor.getId() ); + } + if (rangeYMin > rangeYMax) { + _log.error("Error in door data, ID: {}", castleDoor.getId()); + } + if (rangeZMin > rangeZMax) { + _log.error("Error in door data, ID: {}", castleDoor.getId()); + } + + int collisionRadius; // (max) radius for movement checks + if ((rangeXMax - rangeXMin) > (rangeYMax - rangeYMin)) { + collisionRadius = rangeYMax - rangeYMin; + } else { + collisionRadius = rangeXMax - rangeXMin; + } + + StatsSet npcDat = new StatsSet(); + int id = castleDoor.getId(); + npcDat.set("npcId", id); + npcDat.set("level", 0); + npcDat.set("jClass", "door"); + + npcDat.set("baseSTR", 0); + npcDat.set("baseCON", 0); + npcDat.set("baseDEX", 0); + npcDat.set("baseINT", 0); + npcDat.set("baseWIT", 0); + npcDat.set("baseMEN", 0); + + npcDat.set("baseShldDef", 0); + npcDat.set("baseShldRate", 0); + npcDat.set("baseAccCombat", 38); + npcDat.set("baseEvasRate", 38); + npcDat.set("baseCritRate", 38); + + // npcDat.set("name", ""); + npcDat.set("collision_radius", collisionRadius); + npcDat.set("collision_height", rangeZMax - rangeZMin); + npcDat.set("sex", "male"); + npcDat.set("type", ""); + npcDat.set("baseAtkRange", 0); + npcDat.set("baseMpMax", 0); + npcDat.set("baseCpMax", 0); + npcDat.set("rewardExp", 0); + npcDat.set("rewardSp", 0); + npcDat.set("basePAtk", 0); + npcDat.set("baseMAtk", 0); + npcDat.set("basePAtkSpd", 0); + npcDat.set("aggroRange", 0); + npcDat.set("baseMAtkSpd", 0); + npcDat.set("rhand", 0); + npcDat.set("lhand", 0); + npcDat.set("armor", 0); + npcDat.set("baseWalkSpd", 0); + npcDat.set("baseRunSpd", 0); + + String name = castleDoor.getName(); + npcDat.set("name", name); + npcDat.set("baseHpMax", castleDoor.getHp()); + npcDat.set("baseHpReg", 3.e-3f); + npcDat.set("baseMpReg", 3.e-3f); + npcDat.set("basePDef", castleDoor.getpDef()); + npcDat.set("baseMDef", castleDoor.getmDef()); + + L2CharTemplate template = new L2CharTemplate(npcDat); + L2DoorInstance door = new L2DoorInstance(IdFactory.getInstance().getNextId(), template, id, name, false); + door.setRange(rangeXMin, rangeYMin, rangeZMin, rangeXMax, rangeYMax, rangeZMax); + try { + door.setMapRegion(MapRegionTable.getInstance().getMapRegion(castleDoor.getX(), castleDoor.getY())); + } catch (Exception e) { + _log.error("Error in door data, ID:" + id); + } + door.setCurrentHpMp(door.getMaxHp(), door.getMaxMp()); + door.setOpen(1); + door.setXYZInvisible(castleDoor.getX(), castleDoor.getY(), castleDoor.getZ()); + + return door; + } + + @Deprecated(forRemoval = true) public static L2DoorInstance parseList(String line) { StringTokenizer st = new StringTokenizer(line, ";"); diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/CastleData.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/CastleData.java index abba886e..ede39c1a 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/CastleData.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/CastleData.java @@ -1,7 +1,12 @@ package com.l2jbr.gameserver.model.database; +import com.l2jbr.commons.database.annotation.Column; +import com.l2jbr.commons.database.annotation.Table; import org.springframework.data.annotation.Id; +import java.util.Set; + +@Table("castle") public class CastleData { @Id @@ -12,6 +17,8 @@ public class CastleData { private long siegeDate; private int siegeDayOfWeek; private int siegeHourOfDay; + @Column("castleId") + private Set doors; public int getId() { return id; @@ -40,4 +47,8 @@ public int getSiegeDayOfWeek() { public int getSiegeHourOfDay() { return siegeHourOfDay; } + + public Set getDoors() { + return doors; + } } diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/CastleDoor.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/CastleDoor.java index 61981e83..c22afb63 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/CastleDoor.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/CastleDoor.java @@ -1,22 +1,92 @@ package com.l2jbr.gameserver.model.database; +import com.l2jbr.commons.database.annotation.Column; +import com.l2jbr.commons.database.annotation.Table; +import org.springframework.data.annotation.Id; - +@Table("castle_door") public class CastleDoor { - private int castleId; + @Id private int id; + private int castleId; private String name; private int x; private int y; private int z; + @Column("range_xmin") private int rangeXmin; + @Column("range_ymin") private int rangeYmin; + @Column("range_zmin") private int rangeZmin; + @Column("range_xmax") private int rangeXmax; + @Column("range_ymax") private int rangeYmax; + @Column("range_zmax") private int rangeZmax; private int hp; private int pDef; private int mDef; + + public int getCastleId() { + return castleId; + } + + public int getId() { + return id; + } + + public String getName() { + return name; + } + + public int getX() { + return x; + } + + public int getY() { + return y; + } + + public int getZ() { + return z; + } + + public int getRangeXmin() { + return rangeXmin; + } + + public int getRangeYmin() { + return rangeYmin; + } + + public int getRangeZmin() { + return rangeZmin; + } + + public int getRangeXmax() { + return rangeXmax; + } + + public int getRangeYmax() { + return rangeYmax; + } + + public int getRangeZmax() { + return rangeZmax; + } + + public int getHp() { + return hp; + } + + public int getpDef() { + return pDef; + } + + public int getmDef() { + return mDef; + } } diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/entity/Castle.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/entity/Castle.java index c044cc1e..025acdc4 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/entity/Castle.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/entity/Castle.java @@ -37,6 +37,7 @@ import com.l2jbr.gameserver.model.actor.instance.L2DoorInstance; import com.l2jbr.gameserver.model.actor.instance.L2PcInstance; import com.l2jbr.gameserver.model.database.CastleData; +import com.l2jbr.gameserver.model.database.CastleDoor; import com.l2jbr.gameserver.model.database.repository.CastleRepository; import com.l2jbr.gameserver.model.database.repository.ClanRepository; import com.l2jbr.gameserver.model.zone.type.L2CastleZone; @@ -45,7 +46,6 @@ import org.slf4j.LoggerFactory; import java.sql.PreparedStatement; -import java.sql.ResultSet; import java.util.*; @@ -68,7 +68,7 @@ public class Castle { // Data Field private int _castleId = 0; private final List _doors = new LinkedList<>(); - private final List _doorDefault = new LinkedList<>(); + private final List _doorDefault = new LinkedList(); private String _name = ""; private int _ownerId = 0; private Siege _siege = null; @@ -239,11 +239,6 @@ public void openCloseDoor(L2PcInstance activeChar, int doorId, boolean open) { } } - // This method is used to begin removing all castle upgrades - public void removeUpgrade() { - removeDoorUpgrade(); - } - // This method updates the castle tax rate public void setOwner(L2Clan clan) { // Remove old owner @@ -338,7 +333,7 @@ public void spawnDoor(boolean isDoorWeak) { L2DoorInstance door = getDoors().get(i); if (door.getCurrentHp() <= 0) { door.decayMe(); // Kill current if not killed already - door = DoorTable.parseList(_doorDefault.get(i)); + door = DoorTable.parseDoor(_doorDefault.get(i)); if (isDoorWeak) { door.setCurrentHp(door.getMaxHp() / 2); } @@ -383,56 +378,14 @@ private void load(CastleData castleData) { ThreadPoolManager.getInstance().scheduleGeneral(new CastleUpdater(clan, 1), 3600000); // Schedule owner tasks to start running } - loadDoor(); - } + for (CastleDoor castleDoor : castleData.getDoors()) { - // This method loads castle door data from database - private void loadDoor() { - java.sql.Connection con = null; - try { - con = L2DatabaseFactory.getInstance().getConnection(); - PreparedStatement statement = con.prepareStatement("Select * from castle_door where castleId = ?"); - statement.setInt(1, getCastleId()); - ResultSet rs = statement.executeQuery(); + _doorDefault.add(castleDoor); - while (rs.next()) { - // Create list of the door default for use when respawning dead doors - _doorDefault.add(rs.getString("name") + ";" + rs.getInt("id") + ";" + rs.getInt("x") + ";" + rs.getInt("y") + ";" + rs.getInt("z") + ";" + rs.getInt("range_xmin") + ";" + rs.getInt("range_ymin") + ";" + rs.getInt("range_zmin") + ";" + rs.getInt("range_xmax") + ";" + rs.getInt("range_ymax") + ";" + rs.getInt("range_zmax") + ";" + rs.getInt("hp") + ";" + rs.getInt("pDef") + ";" + rs.getInt("mDef")); - - L2DoorInstance door = DoorTable.parseList(_doorDefault.get(_doorDefault.size() - 1)); - door.spawnMe(door.getX(), door.getY(), door.getZ()); - _doors.add(door); - DoorTable.getInstance().putDoor(door); - } - - statement.close(); - } catch (Exception e) { - System.out.println("Exception: loadCastleDoor(): " + e.getMessage()); - e.printStackTrace(); - } finally { - try { - con.close(); - } catch (Exception e) { - } - } - } - - private void removeDoorUpgrade() { - java.sql.Connection con = null; - try { - con = L2DatabaseFactory.getInstance().getConnection(); - PreparedStatement statement = con.prepareStatement("delete from castle_doorupgrade where doorId in (select id from castle_door where castleId=?)"); - statement.setInt(1, getCastleId()); - statement.execute(); - statement.close(); - } catch (Exception e) { - System.out.println("Exception: removeDoorUpgrade(): " + e.getMessage()); - e.printStackTrace(); - } finally { - try { - con.close(); - } catch (Exception e) { - } + L2DoorInstance door = DoorTable.parseDoor(castleDoor); + door.spawnMe(door.getX(), door.getY(), door.getZ()); + _doors.add(door); + DoorTable.getInstance().putDoor(door); } } diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/entity/Siege.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/entity/Siege.java index 23060639..25279591 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/entity/Siege.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/entity/Siege.java @@ -346,7 +346,6 @@ public void midVictory() { teleportPlayer(TeleportWhoType.Spectator, MapRegionTable.TeleportWhereType.Town); // Teleport to the second closest town removeDefenderFlags(); // Removes defenders' flags - getCastle().removeUpgrade(); // Remove all castle upgrade getCastle().spawnDoor(true); // Respawn door to castle but make them weaker (50% hp) updatePlayerSiegeStateFlags(false); } From 52b1a9b186b6688dac40613892b689ef6ab73a03 Mon Sep 17 00:00:00 2001 From: Alisson Oliveira Date: Tue, 24 Apr 2018 18:55:13 -0300 Subject: [PATCH 031/236] =?UTF-8?q?Remove=20refer=C3=AAncias=20diretas=20?= =?UTF-8?q?=C3=A0=20tabela=20castle=5Fmanor=5Fprocure?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/l2jbr/commons/util/Util.java | 6 + .../instancemanager/CastleManorManager.java | 26 ++-- .../model/database/CastleManorProcure.java | 55 ++++++- .../CastleManorProcureRepository.java | 23 +++ .../l2jbr/gameserver/model/entity/Castle.java | 134 +++--------------- Gameserver/src/test/java/App.java | 17 +-- 6 files changed, 119 insertions(+), 142 deletions(-) create mode 100644 Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/repository/CastleManorProcureRepository.java diff --git a/Commons/src/main/com.l2jbr.commons/com/l2jbr/commons/util/Util.java b/Commons/src/main/com.l2jbr.commons/com/l2jbr/commons/util/Util.java index 39ed4ace..50daafef 100644 --- a/Commons/src/main/com.l2jbr.commons/com/l2jbr/commons/util/Util.java +++ b/Commons/src/main/com.l2jbr.commons/com/l2jbr/commons/util/Util.java @@ -15,6 +15,8 @@ package com.l2jbr.commons.util; +import java.util.Collection; + /** * This class ... * @@ -109,4 +111,8 @@ public static boolean isNotNull(Object obj) { public static boolean isNullOrEmpty(String value) { return isNull(value) || value.isEmpty(); } + + public static boolean isNullOrEmpty(Collection collection) { + return collection == null || collection.isEmpty(); + } } diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/instancemanager/CastleManorManager.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/instancemanager/CastleManorManager.java index 1639552f..1c71d1dd 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/instancemanager/CastleManorManager.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/instancemanager/CastleManorManager.java @@ -18,12 +18,14 @@ package com.l2jbr.gameserver.instancemanager; import com.l2jbr.commons.Config; +import com.l2jbr.commons.database.DatabaseAccess; import com.l2jbr.commons.database.L2DatabaseFactory; import com.l2jbr.commons.util.Rnd; import com.l2jbr.gameserver.ThreadPoolManager; import com.l2jbr.gameserver.datatables.ClanTable; import com.l2jbr.gameserver.model.*; import com.l2jbr.gameserver.model.actor.instance.L2PcInstance; +import com.l2jbr.gameserver.model.database.repository.CastleManorProcureRepository; import com.l2jbr.gameserver.model.entity.Castle; import com.l2jbr.gameserver.network.SystemMessageId; import com.l2jbr.gameserver.serverpackets.SystemMessage; @@ -51,7 +53,6 @@ public class CastleManorManager { public static final int PERIOD_CURRENT = 0; public static final int PERIOD_NEXT = 1; - private static final String CASTLE_MANOR_LOAD_PROCURE = "SELECT * FROM castle_manor_procure WHERE castle_id=?"; private static final String CASTLE_MANOR_LOAD_PRODUCTION = "SELECT * FROM castle_manor_production WHERE castle_id=?"; private static final int NEXT_PERIOD_APPROVE = Config.ALT_MANOR_APPROVE_TIME; // 6:00 @@ -213,25 +214,20 @@ private void load() { castle.setSeedProduction(production, PERIOD_CURRENT); castle.setSeedProduction(productionNext, PERIOD_NEXT); - // restore procure info - statement = con.prepareStatement(CASTLE_MANOR_LOAD_PROCURE); - statement.setInt(1, castle.getCastleId()); - rs = statement.executeQuery(); - while (rs.next()) { - int cropId = rs.getInt("crop_id"); - int canBuy = rs.getInt("can_buy"); - int startBuy = rs.getInt("start_buy"); - int rewardType = rs.getInt("reward_type"); - int price = rs.getInt("price"); - int period = rs.getInt("period"); + CastleManorProcureRepository repository = DatabaseAccess.getRepository(CastleManorProcureRepository.class); + repository.findAllByCastleId(castle.getCastleId()).forEach(manorProcure -> { + int cropId = manorProcure.getCropId(); + int canBuy = manorProcure.getCanBuy(); + int startBuy = manorProcure.getStartBuy(); + int rewardType = manorProcure.getRewardType(); + int price = manorProcure.getPrice(); + int period = manorProcure.getPeriod(); if (period == PERIOD_CURRENT) { procure.add(new CropProcure(cropId, canBuy, rewardType, startBuy, price)); } else { procureNext.add(new CropProcure(cropId, canBuy, rewardType, startBuy, price)); } - } - statement.close(); - rs.close(); + }); castle.setCropProcure(procure, PERIOD_CURRENT); castle.setCropProcure(procureNext, PERIOD_NEXT); diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/CastleManorProcure.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/CastleManorProcure.java index afc59619..40efe0bc 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/CastleManorProcure.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/CastleManorProcure.java @@ -1,15 +1,66 @@ package com.l2jbr.gameserver.model.database; +import com.l2jbr.commons.database.annotation.Column; +import com.l2jbr.commons.database.annotation.Table; +import com.l2jbr.commons.database.model.Entity; +import org.springframework.data.annotation.Id; +@Table("castle_manor_procure") +public class CastleManorProcure extends Entity { -public class CastleManorProcure { - + @Id + @Column("castle_id") private int castleId; + @Column("crop_id") private int cropId; + @Column("can_buy") private int canBuy; + @Column("start_buy") private int startBuy; private int price; + @Column("reward_type") private int rewardType; private int period; + CastleManorProcure(){} + + public CastleManorProcure(int castleId, int id, int amount, int startAmount, int price, int reward, int period) { + this.castleId = castleId; + this.cropId= id; + this.canBuy = amount; + this.startBuy = startAmount; + this.price = price; + this.rewardType = reward; + this.period = period; + } + + + @Override + public Integer getId() { + return castleId; + } + + public int getCropId() { + return cropId; + } + + public int getCanBuy() { + return canBuy; + } + + public int getStartBuy() { + return startBuy; + } + + public int getPrice() { + return price; + } + + public int getRewardType() { + return rewardType; + } + + public int getPeriod() { + return period; + } } diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/repository/CastleManorProcureRepository.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/repository/CastleManorProcureRepository.java new file mode 100644 index 00000000..1d3e0ea7 --- /dev/null +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/repository/CastleManorProcureRepository.java @@ -0,0 +1,23 @@ +package com.l2jbr.gameserver.model.database.repository; + +import com.l2jbr.gameserver.model.database.CastleManorProcure; +import org.springframework.data.jdbc.repository.query.Modifying; +import org.springframework.data.jdbc.repository.query.Query; +import org.springframework.data.repository.CrudRepository; +import org.springframework.data.repository.query.Param; + +public interface CastleManorProcureRepository extends CrudRepository { + + @Modifying + @Query("DELETE FROM castle_manor_procure WHERE castle_id=:castle AND period=:period") + int deleteByIdAndPeriod(@Param("castle") int castleId, @Param("period") int period); + + @Modifying + @Query("UPDATE castle_manor_procure SET can_buy=:amount WHERE crop_id=:crop AND castle_id=:castle AND period=:period") + int updateCanBuyCrop(@Param("castle") int castleId, @Param("crop") int cropId, @Param("period") int period, + @Param("amount") int amount); + + + @Query("SELECT * FROM castle_manor_procure WHERE castle_id=:castle") + Iterable findAllByCastleId(@Param("castle") int castleId); +} diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/entity/Castle.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/entity/Castle.java index 025acdc4..8fa8076b 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/entity/Castle.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/entity/Castle.java @@ -21,6 +21,7 @@ import com.l2jbr.commons.Config; import com.l2jbr.commons.database.DatabaseAccess; import com.l2jbr.commons.database.L2DatabaseFactory; +import com.l2jbr.commons.util.Util; import com.l2jbr.gameserver.Announcements; import com.l2jbr.gameserver.CastleUpdater; import com.l2jbr.gameserver.SevenSigns; @@ -38,6 +39,8 @@ import com.l2jbr.gameserver.model.actor.instance.L2PcInstance; import com.l2jbr.gameserver.model.database.CastleData; import com.l2jbr.gameserver.model.database.CastleDoor; +import com.l2jbr.gameserver.model.database.CastleManorProcure; +import com.l2jbr.gameserver.model.database.repository.CastleManorProcureRepository; import com.l2jbr.gameserver.model.database.repository.CastleRepository; import com.l2jbr.gameserver.model.database.repository.ClanRepository; import com.l2jbr.gameserver.model.zone.type.L2CastleZone; @@ -60,9 +63,6 @@ public class Castle { private static final String CASTLE_MANOR_DELETE_PRODUCTION = "DELETE FROM castle_manor_production WHERE castle_id=?;"; private static final String CASTLE_MANOR_DELETE_PRODUCTION_PERIOD = "DELETE FROM castle_manor_production WHERE castle_id=? AND period=?;"; - private static final String CASTLE_MANOR_DELETE_PROCURE = "DELETE FROM castle_manor_procure WHERE castle_id=?;"; - private static final String CASTLE_MANOR_DELETE_PROCURE_PERIOD = "DELETE FROM castle_manor_procure WHERE castle_id=? AND period=?;"; - private static final String CASTLE_UPDATE_CROP = "UPDATE castle_manor_procure SET can_buy=? WHERE crop_id=? AND castle_id=? AND period=?"; private static final String CASTLE_UPDATE_SEED = "UPDATE castle_manor_production SET can_produce=? WHERE seed_id=? AND castle_id=? AND period=?"; // ========================================================= // Data Field @@ -649,129 +649,37 @@ public void saveSeedData(int period) { } } - // save crop procure data public void saveCropData() { - java.sql.Connection con = null; - PreparedStatement statement; - try { - con = L2DatabaseFactory.getInstance().getConnection(); + CastleManorProcureRepository repository = DatabaseAccess.getRepository(CastleManorProcureRepository.class); + repository.deleteById(getCastleId()); - statement = con.prepareStatement(CASTLE_MANOR_DELETE_PROCURE); - statement.setInt(1, getCastleId()); - statement.execute(); - statement.close(); - if (_procure != null) { - int count = 0; - String query = "INSERT INTO castle_manor_procure VALUES "; - String values[] = new String[_procure.size()]; - for (CropProcure cp : _procure) { - values[count] = "(" + getCastleId() + "," + cp.getId() + "," + cp.getAmount() + "," + cp.getStartAmount() + "," + cp.getPrice() + "," + cp.getReward() + "," + CastleManorManager.PERIOD_CURRENT + ")"; - count++; - } - if (values.length > 0) { - query += values[0]; - for (int i = 1; i < values.length; i++) { - query += "," + values[i]; - } - statement = con.prepareStatement(query); - statement.execute(); - statement.close(); - } - } - if (_procureNext != null) { - int count = 0; - String query = "INSERT INTO castle_manor_procure VALUES "; - String values[] = new String[_procureNext.size()]; - for (CropProcure cp : _procureNext) { - values[count] = "(" + getCastleId() + "," + cp.getId() + "," + cp.getAmount() + "," + cp.getStartAmount() + "," + cp.getPrice() + "," + cp.getReward() + "," + CastleManorManager.PERIOD_NEXT + ")"; - count++; - } - if (values.length > 0) { - query += values[0]; - for (int i = 1; i < values.length; i++) { - query += "," + values[i]; - } - statement = con.prepareStatement(query); - statement.execute(); - statement.close(); - } - } - } catch (Exception e) { - _log.info("Error adding crop data for castle " + getName() + ": " + e.getMessage()); - } finally { - try { - con.close(); - } catch (Exception e) { - } - } + saveProcure(_procure, CastleManorManager.PERIOD_CURRENT, repository); + + saveProcure(_procureNext, CastleManorManager.PERIOD_NEXT, repository); } - // save crop procure data for specified period public void saveCropData(int period) { - java.sql.Connection con = null; - PreparedStatement statement; - try { - con = L2DatabaseFactory.getInstance().getConnection(); + CastleManorProcureRepository repository = DatabaseAccess.getRepository(CastleManorProcureRepository.class); + repository.deleteByIdAndPeriod(getCastleId(), period); - statement = con.prepareStatement(CASTLE_MANOR_DELETE_PROCURE_PERIOD); - statement.setInt(1, getCastleId()); - statement.setInt(2, period); - statement.execute(); - statement.close(); + List proc = getCropProcure(period); - List proc = null; - proc = getCropProcure(period); - - if (proc != null) { - int count = 0; - String query = "INSERT INTO castle_manor_procure VALUES "; - String values[] = new String[proc.size()]; + saveProcure(proc, period, repository); + } - for (CropProcure cp : proc) { - values[count] = "(" + getCastleId() + "," + cp.getId() + "," + cp.getAmount() + "," + cp.getStartAmount() + "," + cp.getPrice() + "," + cp.getReward() + "," + period + ")"; - count++; - } - if (values.length > 0) { - query += values[0]; - for (int i = 1; i < values.length; i++) { - query += "," + values[i]; - } - statement = con.prepareStatement(query); - statement.execute(); - statement.close(); - } - } - } catch (Exception e) { - _log.info("Error adding crop data for castle " + getName() + ": " + e.getMessage()); - } finally { - try { - con.close(); - } catch (Exception e) { + private void saveProcure(List procures, int period, CastleManorProcureRepository repository) { + if (!Util.isNullOrEmpty(procures)) { + for (CropProcure cp : procures) { + CastleManorProcure procure = new CastleManorProcure(getCastleId(), cp.getId(), cp.getAmount(), + cp.getStartAmount(), cp.getPrice(), cp.getReward(), period); + repository.save(procure); } } } public void updateCrop(int cropId, int amount, int period) { - java.sql.Connection con = null; - PreparedStatement statement; - try { - con = L2DatabaseFactory.getInstance().getConnection(); - - statement = con.prepareStatement(CASTLE_UPDATE_CROP); - statement.setInt(1, amount); - statement.setInt(2, cropId); - statement.setInt(3, getCastleId()); - statement.setInt(4, period); - statement.execute(); - statement.close(); - } catch (Exception e) { - _log.info("Error adding crop data for castle " + getName() + ": " + e.getMessage()); - } finally { - try { - con.close(); - } catch (Exception e) { - } - } + CastleManorProcureRepository repository = DatabaseAccess.getRepository(CastleManorProcureRepository.class); + repository.updateCanBuyCrop(getCastleId(), cropId, period, amount); } public void updateSeed(int seedId, int amount, int period) { diff --git a/Gameserver/src/test/java/App.java b/Gameserver/src/test/java/App.java index c4d7f617..6138c918 100644 --- a/Gameserver/src/test/java/App.java +++ b/Gameserver/src/test/java/App.java @@ -1,20 +1,13 @@ -import com.l2jbr.gameserver.model.database.AutoChat; -import com.l2jbr.gameserver.model.database.repository.AutoChatRepository; +import com.l2jbr.gameserver.model.database.CastleData; +import com.l2jbr.gameserver.model.database.repository.CastleRepository; import org.springframework.context.annotation.AnnotationConfigApplicationContext; -import java.util.Optional; -import java.util.Set; -import java.util.stream.Collectors; - public class App { public static void main(String[] args) { AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext(ConfigContext.class); - AutoChatRepository rep = context.getBean(AutoChatRepository.class); - Optional result = rep.findById(1); - Set chatTexts = result.get().getTexts().stream().map(autoChatText -> - autoChatText.getChatText()).collect(Collectors.toSet()); - String[] strings = chatTexts.toArray(new String[]{}); - System.out.println(strings); + CastleRepository rep = context.getBean(CastleRepository.class); + Iterable result = rep.findAll(); + System.out.println(result); } } From 8025e5bd06912fa4c3cf6f654224d3df7ded7622 Mon Sep 17 00:00:00 2001 From: Alisson Oliveira Date: Wed, 25 Apr 2018 17:24:04 -0300 Subject: [PATCH 032/236] =?UTF-8?q?Remove=20refer=C3=AAncias=20diretas=20?= =?UTF-8?q?=C3=A0=20tabela=20castle=5Fmanor=5Fproduction?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../instancemanager/CastleManorManager.java | 111 ++++++------- .../model/database/CastleManorProduction.java | 51 +++++- .../CastleManorProductionRepository.java | 22 +++ .../l2jbr/gameserver/model/entity/Castle.java | 154 ++---------------- 4 files changed, 135 insertions(+), 203 deletions(-) create mode 100644 Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/repository/CastleManorProductionRepository.java diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/instancemanager/CastleManorManager.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/instancemanager/CastleManorManager.java index 1c71d1dd..490454ed 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/instancemanager/CastleManorManager.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/instancemanager/CastleManorManager.java @@ -19,21 +19,19 @@ import com.l2jbr.commons.Config; import com.l2jbr.commons.database.DatabaseAccess; -import com.l2jbr.commons.database.L2DatabaseFactory; import com.l2jbr.commons.util.Rnd; import com.l2jbr.gameserver.ThreadPoolManager; import com.l2jbr.gameserver.datatables.ClanTable; import com.l2jbr.gameserver.model.*; import com.l2jbr.gameserver.model.actor.instance.L2PcInstance; import com.l2jbr.gameserver.model.database.repository.CastleManorProcureRepository; +import com.l2jbr.gameserver.model.database.repository.CastleManorProductionRepository; import com.l2jbr.gameserver.model.entity.Castle; import com.l2jbr.gameserver.network.SystemMessageId; import com.l2jbr.gameserver.serverpackets.SystemMessage; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import java.sql.PreparedStatement; -import java.sql.ResultSet; import java.util.Calendar; import java.util.LinkedList; import java.util.List; @@ -53,7 +51,6 @@ public class CastleManorManager { public static final int PERIOD_CURRENT = 0; public static final int PERIOD_NEXT = 1; - private static final String CASTLE_MANOR_LOAD_PRODUCTION = "SELECT * FROM castle_manor_production WHERE castle_id=?"; private static final int NEXT_PERIOD_APPROVE = Config.ALT_MANOR_APPROVE_TIME; // 6:00 private static final int NEXT_PERIOD_APPROVE_MIN = Config.ALT_MANOR_APPROVE_MIN; // @@ -180,70 +177,56 @@ private CastleManorManager() { } private void load() { - java.sql.Connection con = null; - ResultSet rs; - PreparedStatement statement; - try { - // Get Connection - con = L2DatabaseFactory.getInstance().getConnection(); - for (Castle castle : CastleManager.getInstance().getCastles()) { - List production = new LinkedList<>(); - List productionNext = new LinkedList<>(); - List procure = new LinkedList<>(); - List procureNext = new LinkedList<>(); - - // restore seed production info - statement = con.prepareStatement(CASTLE_MANOR_LOAD_PRODUCTION); - statement.setInt(1, castle.getCastleId()); - rs = statement.executeQuery(); - while (rs.next()) { - int seedId = rs.getInt("seed_id"); - int canProduce = rs.getInt("can_produce"); - int startProduce = rs.getInt("start_produce"); - int price = rs.getInt("seed_price"); - int period = rs.getInt("period"); - if (period == PERIOD_CURRENT) { - production.add(new SeedProduction(seedId, canProduce, price, startProduce)); - } else { - productionNext.add(new SeedProduction(seedId, canProduce, price, startProduce)); - } - } - statement.close(); - rs.close(); - - castle.setSeedProduction(production, PERIOD_CURRENT); - castle.setSeedProduction(productionNext, PERIOD_NEXT); - - CastleManorProcureRepository repository = DatabaseAccess.getRepository(CastleManorProcureRepository.class); - repository.findAllByCastleId(castle.getCastleId()).forEach(manorProcure -> { - int cropId = manorProcure.getCropId(); - int canBuy = manorProcure.getCanBuy(); - int startBuy = manorProcure.getStartBuy(); - int rewardType = manorProcure.getRewardType(); - int price = manorProcure.getPrice(); - int period = manorProcure.getPeriod(); - if (period == PERIOD_CURRENT) { - procure.add(new CropProcure(cropId, canBuy, rewardType, startBuy, price)); - } else { - procureNext.add(new CropProcure(cropId, canBuy, rewardType, startBuy, price)); - } - }); + CastleManorProductionRepository productionRepository = DatabaseAccess.getRepository(CastleManorProductionRepository.class); + CastleManorProcureRepository procureRepository = DatabaseAccess.getRepository(CastleManorProcureRepository.class); + for (Castle castle : CastleManager.getInstance().getCastles()) { - castle.setCropProcure(procure, PERIOD_CURRENT); - castle.setCropProcure(procureNext, PERIOD_NEXT); + loadSeedProduction(productionRepository, castle); + loadSeedProcure(procureRepository, castle); - if (!procure.isEmpty() || !procureNext.isEmpty() || !production.isEmpty() || !productionNext.isEmpty()) { - _log.info(castle.getName() + ": Data loaded"); - } + _log.info(castle.getName() + ": Data loaded"); + } + } + + private void loadSeedProcure(CastleManorProcureRepository procureRepository, Castle castle) { + List procure = new LinkedList<>(); + List procureNext = new LinkedList<>(); + procureRepository.findAllByCastleId(castle.getCastleId()).forEach(manorProcure -> { + int cropId = manorProcure.getCropId(); + int canBuy = manorProcure.getCanBuy(); + int startBuy = manorProcure.getStartBuy(); + int rewardType = manorProcure.getRewardType(); + int price = manorProcure.getPrice(); + int period = manorProcure.getPeriod(); + if (period == PERIOD_CURRENT) { + procure.add(new CropProcure(cropId, canBuy, rewardType, startBuy, price)); + } else { + procureNext.add(new CropProcure(cropId, canBuy, rewardType, startBuy, price)); } - } catch (Exception e) { - _log.info("Error restoring manor data: " + e.getMessage()); - } finally { - try { - con.close(); - } catch (Exception e) { + }); + + castle.setCropProcure(procure, PERIOD_CURRENT); + castle.setCropProcure(procureNext, PERIOD_NEXT); + } + + private void loadSeedProduction(CastleManorProductionRepository productionRepository, Castle castle) { + List production = new LinkedList<>(); + List productionNext = new LinkedList<>(); + productionRepository.findAllByCastle(castle.getCastleId()).forEach(manorProduction -> { + int seedId = manorProduction.getSeedId(); + int canProduce = manorProduction.getCanProduce(); + int startProduce = manorProduction.getStartProduce(); + int price = manorProduction.getSeedPrice(); + int period = manorProduction.getPeriod(); + if (period == PERIOD_CURRENT) { + production.add(new SeedProduction(seedId, canProduce, price, startProduce)); + } else { + productionNext.add(new SeedProduction(seedId, canProduce, price, startProduce)); } - } + }); + + castle.setSeedProduction(production, PERIOD_CURRENT); + castle.setSeedProduction(productionNext, PERIOD_NEXT); } protected void init() { diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/CastleManorProduction.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/CastleManorProduction.java index edf7cc39..865af208 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/CastleManorProduction.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/CastleManorProduction.java @@ -1,12 +1,57 @@ package com.l2jbr.gameserver.model.database; +import com.l2jbr.commons.database.annotation.Column; +import com.l2jbr.commons.database.annotation.Table; +import com.l2jbr.commons.database.model.Entity; +import org.springframework.data.annotation.Id; +@Table("castle_manor_production") +public class CastleManorProduction extends Entity { -public class CastleManorProduction { + @Id + @Column("castle_id") private int castleId; - private int seedd; - private int canproduce; + @Column("seed_id") + private int seedId; + @Column("can_produce") + private int canProduce; + @Column("start_produce") private int startProduce; + @Column("seed_price") private int seedPrice; private int period; + + public CastleManorProduction(int castleId, int seedId, int canProduce, int startProduce, int price, int period) { + this.castleId = castleId; + this.seedId = seedId; + this.canProduce = canProduce; + this.startProduce = startProduce; + this.seedPrice = price; + this.period = period; + } + + @Override + public Integer getId() { + return castleId; + } + + public int getSeedId() { + return seedId; + } + + public int getCanProduce() { + return canProduce; + } + + public int getStartProduce() { + return startProduce; + } + + public int getSeedPrice() { + return seedPrice; + } + + public int getPeriod() { + return period; + } } diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/repository/CastleManorProductionRepository.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/repository/CastleManorProductionRepository.java new file mode 100644 index 00000000..891d9b45 --- /dev/null +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/repository/CastleManorProductionRepository.java @@ -0,0 +1,22 @@ +package com.l2jbr.gameserver.model.database.repository; + +import com.l2jbr.gameserver.model.database.CastleManorProduction; +import org.springframework.data.jdbc.repository.query.Modifying; +import org.springframework.data.jdbc.repository.query.Query; +import org.springframework.data.repository.CrudRepository; +import org.springframework.data.repository.query.Param; + +public interface CastleManorProductionRepository extends CrudRepository { + + @Modifying + @Query("DELETE FROM castle_manor_production WHERE castle_id=:castle AND period=:period") + int deleteByIdAndPeriod(@Param("castle") int castleId, @Param("period") int period); + + @Modifying + @Query("UPDATE castle_manor_production SET can_produce=:amount WHERE seed_id=:seed AND castle_id=:castle AND period=:period") + int updateSeedAmountInPeriod(@Param("castle") int castleId, @Param("seed") int seedId, @Param("amount") int amount, + @Param("period") int period); + + @Query("SELECT * FROM castle_manor_production WHERE castle_id=:castle") + Iterable findAllByCastle(@Param("castle") int castleId); +} diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/entity/Castle.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/entity/Castle.java index 8fa8076b..a08b57ea 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/entity/Castle.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/entity/Castle.java @@ -20,7 +20,6 @@ import com.l2jbr.commons.Config; import com.l2jbr.commons.database.DatabaseAccess; -import com.l2jbr.commons.database.L2DatabaseFactory; import com.l2jbr.commons.util.Util; import com.l2jbr.gameserver.Announcements; import com.l2jbr.gameserver.CastleUpdater; @@ -40,7 +39,9 @@ import com.l2jbr.gameserver.model.database.CastleData; import com.l2jbr.gameserver.model.database.CastleDoor; import com.l2jbr.gameserver.model.database.CastleManorProcure; +import com.l2jbr.gameserver.model.database.CastleManorProduction; import com.l2jbr.gameserver.model.database.repository.CastleManorProcureRepository; +import com.l2jbr.gameserver.model.database.repository.CastleManorProductionRepository; import com.l2jbr.gameserver.model.database.repository.CastleRepository; import com.l2jbr.gameserver.model.database.repository.ClanRepository; import com.l2jbr.gameserver.model.zone.type.L2CastleZone; @@ -48,10 +49,8 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import java.sql.PreparedStatement; import java.util.*; - public class Castle { protected static Logger _log = LoggerFactory.getLogger(Castle.class.getName()); @@ -61,11 +60,6 @@ public class Castle { private List _productionNext = new LinkedList<>(); private boolean _isNextPeriodApproved = false; - private static final String CASTLE_MANOR_DELETE_PRODUCTION = "DELETE FROM castle_manor_production WHERE castle_id=?;"; - private static final String CASTLE_MANOR_DELETE_PRODUCTION_PERIOD = "DELETE FROM castle_manor_production WHERE castle_id=? AND period=?;"; - private static final String CASTLE_UPDATE_SEED = "UPDATE castle_manor_production SET can_produce=? WHERE seed_id=? AND castle_id=? AND period=?"; - // ========================================================= - // Data Field private int _castleId = 0; private final List _doors = new LinkedList<>(); private final List _doorDefault = new LinkedList(); @@ -544,130 +538,36 @@ public int getManorCost(int period) { return total; } - // save manor production data public void saveSeedData() { - java.sql.Connection con = null; - PreparedStatement statement; - - try { - con = L2DatabaseFactory.getInstance().getConnection(); - - statement = con.prepareStatement(CASTLE_MANOR_DELETE_PRODUCTION); - statement.setInt(1, getCastleId()); - - statement.execute(); - statement.close(); - - if (_production != null) { - int count = 0; - String query = "INSERT INTO castle_manor_production VALUES "; - String values[] = new String[_production.size()]; - for (SeedProduction s : _production) { - values[count] = "(" + getCastleId() + "," + s.getId() + "," + s.getCanProduce() + "," + s.getStartProduce() + "," + s.getPrice() + "," + CastleManorManager.PERIOD_CURRENT + ")"; - count++; - } - if (values.length > 0) { - query += values[0]; - for (int i = 1; i < values.length; i++) { - query += "," + values[i]; - } - statement = con.prepareStatement(query); - statement.execute(); - statement.close(); - } - } - - if (_productionNext != null) { - int count = 0; - String query = "INSERT INTO castle_manor_production VALUES "; - String values[] = new String[_productionNext.size()]; - for (SeedProduction s : _productionNext) { - values[count] = "(" + getCastleId() + "," + s.getId() + "," + s.getCanProduce() + "," + s.getStartProduce() + "," + s.getPrice() + "," + CastleManorManager.PERIOD_NEXT + ")"; - count++; - } - if (values.length > 0) { - query += values[0]; - for (int i = 1; i < values.length; i++) { - query += "," + values[i]; - } - statement = con.prepareStatement(query); - statement.execute(); - statement.close(); - } - } - } catch (Exception e) { - _log.info("Error adding seed production data for castle " + getName() + ": " + e.getMessage()); - } finally { - try { - con.close(); - } catch (Exception e) { - } - } + saveSeedData(CastleManorManager.PERIOD_CURRENT); + saveSeedData(CastleManorManager.PERIOD_NEXT); } - // save manor production data for specified period public void saveSeedData(int period) { - java.sql.Connection con = null; - PreparedStatement statement; - try { - con = L2DatabaseFactory.getInstance().getConnection(); - - statement = con.prepareStatement(CASTLE_MANOR_DELETE_PRODUCTION_PERIOD); - statement.setInt(1, getCastleId()); - statement.setInt(2, period); - statement.execute(); - statement.close(); - - List prod = null; - prod = getSeedProduction(period); - - if (prod != null) { - int count = 0; - String query = "INSERT INTO castle_manor_production VALUES "; - String values[] = new String[prod.size()]; - for (SeedProduction s : prod) { - values[count] = "(" + getCastleId() + "," + s.getId() + "," + s.getCanProduce() + "," + s.getStartProduce() + "," + s.getPrice() + "," + period + ")"; - count++; - } - if (values.length > 0) { - query += values[0]; - for (int i = 1; i < values.length; i++) { - query += "," + values[i]; - } - statement = con.prepareStatement(query); - statement.execute(); - statement.close(); - } - } - } catch (Exception e) { - _log.info("Error adding seed production data for castle " + getName() + ": " + e.getMessage()); - } finally { - try { - con.close(); - } catch (Exception e) { + CastleManorProductionRepository repository = DatabaseAccess.getRepository(CastleManorProductionRepository.class); + repository.deleteByIdAndPeriod(getCastleId(), period); + + List seedProductions = getSeedProduction(period); + + if (!Util.isNullOrEmpty(seedProductions)) { + for (SeedProduction s : seedProductions) { + CastleManorProduction production = new CastleManorProduction(getCastleId(), s.getId(), s.getCanProduce(), s.getStartProduce(), s.getPrice(), period); + repository.save(production); } } } public void saveCropData() { - CastleManorProcureRepository repository = DatabaseAccess.getRepository(CastleManorProcureRepository.class); - repository.deleteById(getCastleId()); - - saveProcure(_procure, CastleManorManager.PERIOD_CURRENT, repository); - - saveProcure(_procureNext, CastleManorManager.PERIOD_NEXT, repository); + saveCropData(CastleManorManager.PERIOD_CURRENT); + saveCropData(CastleManorManager.PERIOD_NEXT); } public void saveCropData(int period) { CastleManorProcureRepository repository = DatabaseAccess.getRepository(CastleManorProcureRepository.class); repository.deleteByIdAndPeriod(getCastleId(), period); - List proc = getCropProcure(period); + List procures = getCropProcure(period); - saveProcure(proc, period, repository); - } - - private void saveProcure(List procures, int period, CastleManorProcureRepository repository) { if (!Util.isNullOrEmpty(procures)) { for (CropProcure cp : procures) { CastleManorProcure procure = new CastleManorProcure(getCastleId(), cp.getId(), cp.getAmount(), @@ -683,26 +583,8 @@ public void updateCrop(int cropId, int amount, int period) { } public void updateSeed(int seedId, int amount, int period) { - java.sql.Connection con = null; - PreparedStatement statement; - try { - con = L2DatabaseFactory.getInstance().getConnection(); - - statement = con.prepareStatement(CASTLE_UPDATE_SEED); - statement.setInt(1, amount); - statement.setInt(2, seedId); - statement.setInt(3, getCastleId()); - statement.setInt(4, period); - statement.execute(); - statement.close(); - } catch (Exception e) { - _log.info("Error adding seed production data for castle " + getName() + ": " + e.getMessage()); - } finally { - try { - con.close(); - } catch (Exception e) { - } - } + CastleManorProductionRepository repository = DatabaseAccess.getRepository(CastleManorProductionRepository.class); + repository.updateSeedAmountInPeriod(getCastleId(), seedId, amount, period); } public boolean isNextPeriodApproved() { From b6c3f0df1b39a87d67e46b420f43f4ddb4166d7b Mon Sep 17 00:00:00 2001 From: Alisson Oliveira Date: Wed, 25 Apr 2018 18:37:50 -0300 Subject: [PATCH 033/236] =?UTF-8?q?Remove=20refer=C3=AAncias=20diretas=20?= =?UTF-8?q?=C3=A0=20tabela=20castle=5Fsiege=5Fguards?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../instancemanager/MercTicketManager.java | 94 ++++------ .../instancemanager/SiegeGuardManager.java | 162 ++++-------------- .../model/database/CastleSiegeGuard.java | 56 +++++- .../CastleSiegeGuardRepository.java | 24 +++ 4 files changed, 150 insertions(+), 186 deletions(-) create mode 100644 Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/repository/CastleSiegeGuardRepository.java diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/instancemanager/MercTicketManager.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/instancemanager/MercTicketManager.java index 5ca5d80a..c80f4302 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/instancemanager/MercTicketManager.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/instancemanager/MercTicketManager.java @@ -17,7 +17,7 @@ */ package com.l2jbr.gameserver.instancemanager; -import com.l2jbr.commons.database.L2DatabaseFactory; +import com.l2jbr.commons.database.DatabaseAccess; import com.l2jbr.gameserver.ThreadPoolManager; import com.l2jbr.gameserver.datatables.NpcTable; import com.l2jbr.gameserver.idfactory.IdFactory; @@ -26,13 +26,12 @@ import com.l2jbr.gameserver.model.L2World; import com.l2jbr.gameserver.model.actor.instance.L2PcInstance; import com.l2jbr.gameserver.model.actor.instance.L2SiegeGuardInstance; +import com.l2jbr.gameserver.model.database.repository.CastleSiegeGuardRepository; import com.l2jbr.gameserver.model.entity.Castle; import com.l2jbr.gameserver.templates.L2NpcTemplate; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import java.sql.PreparedStatement; -import java.sql.ResultSet; import java.util.Arrays; import java.util.LinkedList; import java.util.List; @@ -682,70 +681,49 @@ public void reload() { load(); } - // ========================================================= - // Method - Private - private final void load() { - java.sql.Connection con = null; - // load merc tickets into the world - try { - PreparedStatement statement; - ResultSet rs; - - con = L2DatabaseFactory.getInstance().getConnection(); - statement = con.prepareStatement("SELECT * FROM castle_siege_guards Where isHired = 1"); - rs = statement.executeQuery(); - - int npcId; + private void load() { + CastleSiegeGuardRepository repository = DatabaseAccess.getRepository(CastleSiegeGuardRepository.class); + repository.findAllMercenary().forEach(castleSiegeGuard -> { + int npcId = castleSiegeGuard.getNpcId(); + int x = castleSiegeGuard.getX(); + int y = castleSiegeGuard.getY(); + int z = castleSiegeGuard.getZ(); int itemId; - int x, y, z; + // start index to begin the search for the itemId corresponding to this NPC // this will help with: // a) skip unnecessary iterations in the search loop // b) avoid finding the wrong itemId whenever tickets of different spawn the same npc! - int startindex = 0; - - while (rs.next()) { - npcId = rs.getInt("npcId"); - x = rs.getInt("x"); - y = rs.getInt("y"); - z = rs.getInt("z"); - Castle castle = CastleManager.getInstance().getCastle(x, y, z); - if (castle != null) { - startindex = 10 * (castle.getCastleId() - 1); - } + int startIndex = 0; + + Castle castle = CastleManager.getInstance().getCastle(x, y, z); + if (castle != null) { + startIndex = 10 * (castle.getCastleId() - 1); + } - // find the FIRST ticket itemId with spawns the saved NPC in the saved location - for (int i = startindex; i < NPC_IDS.length; i++) { - if (NPC_IDS[i] == npcId) // Find the index of the item used - { - // only handle tickets if a siege is not ongoing in this npc's castle - - if ((castle != null) && !(castle.getSiege().getIsInProgress())) { - itemId = ITEM_IDS[i]; - // create the ticket in the gameworld - L2ItemInstance dropticket = new L2ItemInstance(IdFactory.getInstance().getNextId(), itemId); - dropticket.setLocation(L2ItemInstance.ItemLocation.INVENTORY); - dropticket.dropMe(null, x, y, z); - dropticket.setDropTime(0); // avoids it from beeing removed by the auto item destroyer - L2World.getInstance().storeObject(dropticket); - getDroppedTickets().add(dropticket); - } - break; + // find the FIRST ticket itemId with spawns the saved NPC in the saved location + for (int i = startIndex; i < NPC_IDS.length; i++) { + if (NPC_IDS[i] == npcId) // Find the index of the item used + { + // only handle tickets if a siege is not ongoing in this npc's castle + + if ((castle != null) && !(castle.getSiege().getIsInProgress())) { + itemId = ITEM_IDS[i]; + // create the ticket in the gameworld + L2ItemInstance dropticket = new L2ItemInstance(IdFactory.getInstance().getNextId(), itemId); + dropticket.setLocation(L2ItemInstance.ItemLocation.INVENTORY); + dropticket.dropMe(null, x, y, z); + dropticket.setDropTime(0); // avoids it from beeing removed by the auto item destroyer + L2World.getInstance().storeObject(dropticket); + getDroppedTickets().add(dropticket); } + break; } } - statement.close(); - - System.out.println("Loaded: " + getDroppedTickets().size() + " Mercenary Tickets"); - } catch (Exception e) { - System.out.println("Exception: loadMercenaryData(): " + e.getMessage()); - e.printStackTrace(); - } finally { - try { - con.close(); - } catch (Exception e) { - } - } + + }); + + _log.info("Loaded: {} Mercenary Tickets", getDroppedTickets().size()); } // ========================================================= diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/instancemanager/SiegeGuardManager.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/instancemanager/SiegeGuardManager.java index 6a0eaa6d..7daed34d 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/instancemanager/SiegeGuardManager.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/instancemanager/SiegeGuardManager.java @@ -17,17 +17,17 @@ */ package com.l2jbr.gameserver.instancemanager; -import com.l2jbr.commons.database.L2DatabaseFactory; +import com.l2jbr.commons.database.DatabaseAccess; import com.l2jbr.gameserver.datatables.NpcTable; import com.l2jbr.gameserver.model.L2Spawn; import com.l2jbr.gameserver.model.actor.instance.L2PcInstance; +import com.l2jbr.gameserver.model.database.CastleSiegeGuard; +import com.l2jbr.gameserver.model.database.repository.CastleSiegeGuardRepository; import com.l2jbr.gameserver.model.entity.Castle; import com.l2jbr.gameserver.templates.L2NpcTemplate; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import java.sql.PreparedStatement; -import java.sql.ResultSet; import java.util.LinkedList; import java.util.List; @@ -107,7 +107,8 @@ public void hireMerc(int x, int y, int z, int heading, int npcId) { } /** - * Remove a single mercenary, identified by the npcId and location. Presumably, this is used when a castle lord picks up a previously dropped ticket + * Remove a single mercenary, identified by the npcId and location. + * Presumably, this is used when a castle lord picks up a previously dropped ticket * * @param npcId * @param x @@ -115,46 +116,13 @@ public void hireMerc(int x, int y, int z, int heading, int npcId) { * @param z */ public void removeMerc(int npcId, int x, int y, int z) { - java.sql.Connection con = null; - try { - con = L2DatabaseFactory.getInstance().getConnection(); - PreparedStatement statement = con.prepareStatement("Delete From castle_siege_guards Where npcId = ? And x = ? AND y = ? AND z = ? AND isHired = 1"); - statement.setInt(1, npcId); - statement.setInt(2, x); - statement.setInt(3, y); - statement.setInt(4, z); - statement.execute(); - statement.close(); - } catch (Exception e1) { - _log.warn("Error deleting hired siege guard at " + x + ',' + y + ',' + z + ":" + e1); - } finally { - try { - con.close(); - } catch (Exception e) { - } - } + CastleSiegeGuardRepository repository = DatabaseAccess.getRepository(CastleSiegeGuardRepository.class); + repository.deleteMercenaryByNpcAndLocation(npcId, x, y, z); } - /** - * Remove mercs.
- *
- */ public void removeMercs() { - java.sql.Connection con = null; - try { - con = L2DatabaseFactory.getInstance().getConnection(); - PreparedStatement statement = con.prepareStatement("Delete From castle_siege_guards Where castleId = ? And isHired = 1"); - statement.setInt(1, getCastle().getCastleId()); - statement.execute(); - statement.close(); - } catch (Exception e1) { - _log.warn("Error deleting hired siege guard for castle " + getCastle().getName() + ":" + e1); - } finally { - try { - con.close(); - } catch (Exception e) { - } - } + CastleSiegeGuardRepository repository = DatabaseAccess.getRepository(CastleSiegeGuardRepository.class); + repository.deleteMercenaryByCastle(getCastle().getCastleId()); } /** @@ -187,100 +155,44 @@ public void unspawnSiegeGuard() { getSiegeGuardSpawn().clear(); } - // ========================================================= - // Method - Private - - /** - * Load guards.
- *
- */ private void loadSiegeGuard() { - java.sql.Connection con = null; - try { - con = L2DatabaseFactory.getInstance().getConnection(); - PreparedStatement statement = con.prepareStatement("SELECT * FROM castle_siege_guards Where castleId = ? And isHired = ?"); - statement.setInt(1, getCastle().getCastleId()); - if (getCastle().getOwnerId() > 0) { - statement.setInt(2, 1); - } else { - statement.setInt(2, 0); - } - ResultSet rs = statement.executeQuery(); - - L2Spawn spawn1; - L2NpcTemplate template1; - - while (rs.next()) { - template1 = NpcTable.getInstance().getTemplate(rs.getInt("npcId")); - if (template1 != null) { - spawn1 = new L2Spawn(template1); - spawn1.setId(rs.getInt("id")); - spawn1.setAmount(1); - spawn1.setLocx(rs.getInt("x")); - spawn1.setLocy(rs.getInt("y")); - spawn1.setLocz(rs.getInt("z")); - spawn1.setHeading(rs.getInt("heading")); - spawn1.setRespawnDelay(rs.getInt("respawnDelay")); - spawn1.setLocation(0); + CastleSiegeGuardRepository repository = DatabaseAccess.getRepository(CastleSiegeGuardRepository.class); + repository.findAllByCastleAndHired(getCastle().getCastleId(), getCastle().getOwnerId() > 0 ? 1 : 0).forEach( + castleSiegeGuard -> { + L2NpcTemplate template = NpcTable.getInstance().getTemplate(castleSiegeGuard.getNpcId()); + addSiegeGuard(castleSiegeGuard, template); + }); + } - _siegeGuardSpawn.add(spawn1); - } else { - _log.warn("Missing npc data in npc table for id: " + rs.getInt("npcId")); - } - } - statement.close(); - } catch (Exception e1) { - _log.warn("Error loading siege guard for castle " + getCastle().getName() + ":" + e1); - } finally { + private void addSiegeGuard(CastleSiegeGuard castleSiegeGuard, L2NpcTemplate template) { + if (template != null) { try { - con.close(); - } catch (Exception e) { + L2Spawn spawn = new L2Spawn(template); + spawn.setId(castleSiegeGuard.getId()); + spawn.setAmount(1); + spawn.setLocx(castleSiegeGuard.getX()); + spawn.setLocy(castleSiegeGuard.getY()); + spawn.setLocz(castleSiegeGuard.getZ()); + spawn.setHeading(castleSiegeGuard.getHeading()); + spawn.setRespawnDelay(castleSiegeGuard.getRespawnDelay()); + spawn.setLocation(0); + + _siegeGuardSpawn.add(spawn); + } catch (ClassNotFoundException | NoSuchMethodException e) { + _log.error(e.getLocalizedMessage(), e); } + } else { + _log.warn("Missing npc data in npc table for id: {}", castleSiegeGuard.getNpcId()); } } - /** - * Save guards.
- *
- * - * @param x - * @param y - * @param z - * @param heading - * @param npcId - * @param isHire - */ private void saveSiegeGuard(int x, int y, int z, int heading, int npcId, int isHire) { - java.sql.Connection con = null; - try { - con = L2DatabaseFactory.getInstance().getConnection(); - PreparedStatement statement = con.prepareStatement("Insert Into castle_siege_guards (castleId, npcId, x, y, z, heading, respawnDelay, isHired) Values (?, ?, ?, ?, ?, ?, ?, ?)"); - statement.setInt(1, getCastle().getCastleId()); - statement.setInt(2, npcId); - statement.setInt(3, x); - statement.setInt(4, y); - statement.setInt(5, z); - statement.setInt(6, heading); - if (isHire == 1) { - statement.setInt(7, 0); - } else { - statement.setInt(7, 600); - } - statement.setInt(8, isHire); - statement.execute(); - statement.close(); - } catch (Exception e1) { - _log.warn("Error adding siege guard for castle " + getCastle().getName() + ":" + e1); - } finally { - try { - con.close(); - } catch (Exception e) { - } - } + int respawnDelay = isHire == 1 ? 0 : 600; + CastleSiegeGuard guard = new CastleSiegeGuard(getCastle().getCastleId(), npcId, x, y, z, heading, respawnDelay, isHire); + CastleSiegeGuardRepository repository = DatabaseAccess.getRepository(CastleSiegeGuardRepository.class); + repository.save(guard); } - // ========================================================= - // Proeprty public final Castle getCastle() { return _castle; diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/CastleSiegeGuard.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/CastleSiegeGuard.java index 0b745407..4ba5ab19 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/CastleSiegeGuard.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/CastleSiegeGuard.java @@ -1,11 +1,14 @@ package com.l2jbr.gameserver.model.database; +import com.l2jbr.commons.database.annotation.Table; +import org.springframework.data.annotation.Id; +@Table("castle_siege_guards") +public class CastleSiegeGuard { -public class CastleSiegeGuard { - - private int castleId; + @Id private int id; + private int castleId; private int npcId; private int x; private int y; @@ -13,4 +16,51 @@ public class CastleSiegeGuard { private int heading; private int respawnDelay; private int isHired; + + public CastleSiegeGuard(int castleId, int npcId, int x, int y, int z, int heading, int respawnDelay, int isHire) { + this.castleId = castleId; + this.npcId = npcId; + this.x = x; + this.y = y; + this.z = z; + this.heading = heading; + this.respawnDelay = respawnDelay; + this.isHired = isHire; + } + + public int getId() { + return id; + } + + public int getCastleId() { + return castleId; + } + + public int getNpcId() { + return npcId; + } + + public int getX() { + return x; + } + + public int getY() { + return y; + } + + public int getZ() { + return z; + } + + public int getHeading() { + return heading; + } + + public int getRespawnDelay() { + return respawnDelay; + } + + public int getIsHired() { + return isHired; + } } diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/repository/CastleSiegeGuardRepository.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/repository/CastleSiegeGuardRepository.java new file mode 100644 index 00000000..42cf5770 --- /dev/null +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/repository/CastleSiegeGuardRepository.java @@ -0,0 +1,24 @@ +package com.l2jbr.gameserver.model.database.repository; + +import com.l2jbr.gameserver.model.database.CastleSiegeGuard; +import org.springframework.data.jdbc.repository.query.Modifying; +import org.springframework.data.jdbc.repository.query.Query; +import org.springframework.data.repository.CrudRepository; +import org.springframework.data.repository.query.Param; + +public interface CastleSiegeGuardRepository extends CrudRepository { + + @Modifying + @Query("DELETE FROM castle_siege_guards WHERE npcId=:npc AND x=:x AND y=:y AND z=:z AND isHired=1") + int deleteMercenaryByNpcAndLocation(@Param("npc") int npcId, @Param("x") int x, @Param("y") int y, @Param("z") int z); + + @Query("SELECT * FROM castle_siege_guards WHERE isHired=1") + Iterable findAllMercenary(); + + @Modifying + @Query("DELETE FROM castle_siege_guards WHERE castleId=:castle AND isHired=:1") + int deleteMercenaryByCastle(@Param("castle") int castleId); + + @Query("SELECT * FROM castle_siege_guards WHERE castleId=:castle AND isHired=:hired") + Iterable findAllByCastleAndHired(@Param("castle") int castleId, @Param("hired") int hired); +} From 31a13a6f81702b1e0d5b0f558bb7f39a37b8ea41 Mon Sep 17 00:00:00 2001 From: Alisson Oliveira Date: Wed, 25 Apr 2018 19:11:29 -0300 Subject: [PATCH 034/236] =?UTF-8?q?Remove=20algumas=20refer=C3=AAncias=20d?= =?UTF-8?q?iretas=20=C3=A0=20tabela=20character=5Ffriends?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../gameserver/clientpackets/Logout.java | 40 +++++------------ .../voicedcommandhandlers/Wedding.java | 43 +++---------------- .../model/database/CharacterFriends.java | 29 +++++++++++-- .../repository/CharacterFriendRepository.java | 20 +++++++++ .../gameserver/network/L2GameClient.java | 8 ++-- .../accountmanager/SQLAccountManager.java | 10 ++--- 6 files changed, 67 insertions(+), 83 deletions(-) create mode 100644 Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/repository/CharacterFriendRepository.java diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/clientpackets/Logout.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/clientpackets/Logout.java index b141b9e6..967f4070 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/clientpackets/Logout.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/clientpackets/Logout.java @@ -19,7 +19,8 @@ package com.l2jbr.gameserver.clientpackets; import com.l2jbr.commons.Config; -import com.l2jbr.commons.database.L2DatabaseFactory; +import com.l2jbr.commons.database.DatabaseAccess; +import com.l2jbr.commons.util.Util; import com.l2jbr.gameserver.Olympiad; import com.l2jbr.gameserver.SevenSignsFestival; import com.l2jbr.gameserver.communitybbs.Manager.RegionBBSManager; @@ -27,6 +28,7 @@ import com.l2jbr.gameserver.model.L2Party; import com.l2jbr.gameserver.model.L2World; import com.l2jbr.gameserver.model.actor.instance.L2PcInstance; +import com.l2jbr.gameserver.model.database.repository.CharacterFriendRepository; import com.l2jbr.gameserver.model.entity.TvTEvent; import com.l2jbr.gameserver.network.SystemMessageId; import com.l2jbr.gameserver.serverpackets.ActionFailed; @@ -36,10 +38,6 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import java.sql.Connection; -import java.sql.PreparedStatement; -import java.sql.ResultSet; - /** * This class ... @@ -122,30 +120,14 @@ protected void runImpl() notifyFriends(player); } - private void notifyFriends(L2PcInstance cha) - { - try (Connection con = L2DatabaseFactory.getInstance().getConnection(); - PreparedStatement statement = con.prepareStatement("SELECT friend_name FROM character_friends WHERE char_id=?")) - { - statement.setInt(1, cha.getObjectId()); - try (ResultSet rset = statement.executeQuery()) - { - while (rset.next()) - { - String friendName = rset.getString("friend_name"); - L2PcInstance friend = L2World.getInstance().getPlayer(friendName); - - if (friend != null) // friend logged in. - { - friend.sendPacket(new FriendList(friend)); - } - } - } - } - catch (Exception e) - { - _log.warn("could not restore friend data:" + e); - } + private void notifyFriends(L2PcInstance cha) { + CharacterFriendRepository repository = DatabaseAccess.getRepository(CharacterFriendRepository.class); + repository.findAllByCharacterId(cha.getObjectId()).forEach(characterFriends -> { + L2PcInstance friend = L2World.getInstance().getPlayer(characterFriends.getFriendName()); + if(Util.isNotNull(friend)) { + friend.sendPacket(new FriendList(friend)); + } + }); } @Override diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/handler/voicedcommandhandlers/Wedding.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/handler/voicedcommandhandlers/Wedding.java index 4dcdbd69..21eb78e1 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/handler/voicedcommandhandlers/Wedding.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/handler/voicedcommandhandlers/Wedding.java @@ -2,7 +2,7 @@ package com.l2jbr.gameserver.handler.voicedcommandhandlers; import com.l2jbr.commons.Config; -import com.l2jbr.commons.database.L2DatabaseFactory; +import com.l2jbr.commons.database.DatabaseAccess; import com.l2jbr.gameserver.GameTimeController; import com.l2jbr.gameserver.ThreadPoolManager; import com.l2jbr.gameserver.ai.CtrlIntention; @@ -13,6 +13,7 @@ import com.l2jbr.gameserver.model.L2Skill; import com.l2jbr.gameserver.model.L2World; import com.l2jbr.gameserver.model.actor.instance.L2PcInstance; +import com.l2jbr.gameserver.model.database.repository.CharacterFriendRepository; import com.l2jbr.gameserver.model.entity.TvTEvent; import com.l2jbr.gameserver.network.SystemMessageId; import com.l2jbr.gameserver.serverpackets.*; @@ -20,9 +21,6 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import java.sql.PreparedStatement; -import java.sql.ResultSet; - /** * @author evill33t @@ -199,40 +197,9 @@ public boolean Engage(L2PcInstance activeChar) } // check if target has player on friendlist - boolean FoundOnFriendList = false; - int objectId; - java.sql.Connection con = null; - try - { - con = L2DatabaseFactory.getInstance().getConnection(); - PreparedStatement statement; - statement = con.prepareStatement("SELECT friend_id FROM character_friends WHERE char_id=?"); - statement.setInt(1, ptarget.getObjectId()); - ResultSet rset = statement.executeQuery(); - - while (rset.next()) - { - objectId = rset.getInt("friend_id"); - if (objectId == activeChar.getObjectId()) - { - FoundOnFriendList = true; - } - } - } - catch (Exception e) - { - _log.warn("could not read friend data:" + e); - } - finally - { - try - { - con.close(); - } - catch (Exception e) - { - } - } + CharacterFriendRepository repository = DatabaseAccess.getRepository(CharacterFriendRepository.class); + boolean FoundOnFriendList = repository.existsFriends(activeChar.getObjectId(), ptarget.getObjectId()); + if (!FoundOnFriendList) { diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/CharacterFriends.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/CharacterFriends.java index 249aa5be..4df86b76 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/CharacterFriends.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/CharacterFriends.java @@ -1,10 +1,31 @@ package com.l2jbr.gameserver.model.database; +import com.l2jbr.commons.database.annotation.Column; +import com.l2jbr.commons.database.annotation.Table; +import com.l2jbr.commons.database.model.Entity; +import org.springframework.data.annotation.Id; +@Table("character_friends") +public class CharacterFriends extends Entity { -public class CharacterFriends { + @Id + @Column("char_id") + private int charId; + @Column("friend_id") + private int friendId; + @Column("friend_name") + private String friendName; - private int char_id; - private int friend_id; - private String friend_name; + @Override + public Integer getId() { + return charId; + } + + public int getFriendId() { + return friendId; + } + + public String getFriendName() { + return friendName; + } } diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/repository/CharacterFriendRepository.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/repository/CharacterFriendRepository.java new file mode 100644 index 00000000..c8d438e4 --- /dev/null +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/repository/CharacterFriendRepository.java @@ -0,0 +1,20 @@ +package com.l2jbr.gameserver.model.database.repository; + +import com.l2jbr.gameserver.model.database.CharacterFriends; +import org.springframework.data.jdbc.repository.query.Modifying; +import org.springframework.data.jdbc.repository.query.Query; +import org.springframework.data.repository.CrudRepository; +import org.springframework.data.repository.query.Param; + +public interface CharacterFriendRepository extends CrudRepository { + + @Modifying + @Query("DELETE FROM character_friends WHERE char_id=:objectId OR friend_id=:objectId") + int deleteFriend(@Param("objectId") int objectId); + + @Query("SELECT * FROM character_friends WHERE char_id=:objectId") + Iterable findAllByCharacterId(@Param("objectId") int objectId); + + @Query("SELECT EXISTS(SELECT 1 FROM character_friends WHERE (char_id=:character AND friend_id=:friend) OR (char_id=:friend AND friend_id=:character))") + boolean existsFriends(@Param("character") int objectId, @Param("friend") int friendId); +} diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/network/L2GameClient.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/network/L2GameClient.java index 61095ef6..0396fdaf 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/network/L2GameClient.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/network/L2GameClient.java @@ -29,6 +29,7 @@ import com.l2jbr.gameserver.model.L2World; import com.l2jbr.gameserver.model.actor.instance.L2PcInstance; import com.l2jbr.gameserver.model.database.repository.AugmentationsRepository; +import com.l2jbr.gameserver.model.database.repository.CharacterFriendRepository; import com.l2jbr.gameserver.model.database.repository.CharacterRepository; import com.l2jbr.gameserver.model.entity.L2Event; import com.l2jbr.gameserver.serverpackets.L2GameServerPacket; @@ -247,11 +248,8 @@ public static void deleteCharByObjId(int objId) { con = L2DatabaseFactory.getInstance().getConnection(); PreparedStatement statement; - statement = con.prepareStatement("DELETE FROM character_friends WHERE char_id=? OR friend_id=?"); - statement.setInt(1, objId); - statement.setInt(2, objId); - statement.execute(); - statement.close(); + CharacterFriendRepository characterFriendRepository = DatabaseAccess.getRepository(CharacterFriendRepository.class); + characterFriendRepository.deleteFriend(objId); statement = con.prepareStatement("DELETE FROM character_hennas WHERE char_obj_id=?"); statement.setInt(1, objId); diff --git a/Tools/src/main/com.l2jbr.tools/com/l2jbr/tools/accountmanager/SQLAccountManager.java b/Tools/src/main/com.l2jbr.tools/com/l2jbr/tools/accountmanager/SQLAccountManager.java index 16196483..2f772912 100644 --- a/Tools/src/main/com.l2jbr.tools/com/l2jbr/tools/accountmanager/SQLAccountManager.java +++ b/Tools/src/main/com.l2jbr.tools/com/l2jbr/tools/accountmanager/SQLAccountManager.java @@ -25,6 +25,7 @@ import com.l2jbr.commons.database.DatabaseAccess; import com.l2jbr.commons.database.L2DatabaseFactory; import com.l2jbr.commons.database.model.Account; +import com.l2jbr.gameserver.model.database.repository.CharacterFriendRepository; import com.l2jbr.gameserver.model.database.repository.CharacterRepository; import com.l2jbr.gameserver.model.database.repository.ClanRepository; @@ -227,11 +228,8 @@ private static void deleteAccount(String login) throws SQLException { statement.setInt(1, character.getObjectId()); statement.executeUpdate(); - // friends - statement.close(); - statement = con.prepareStatement("DELETE FROM character_friends WHERE char_id=?;"); - statement.setInt(1, character.getObjectId()); - statement.executeUpdate(); + CharacterFriendRepository characterFriendRepository = DatabaseAccess.getRepository(CharacterFriendRepository.class); + characterFriendRepository.deleteById(character.getObjectId()); // merchant_lease statement.close(); @@ -239,8 +237,6 @@ private static void deleteAccount(String login) throws SQLException { statement.setInt(1, character.getObjectId()); statement.executeUpdate(); - - // boxaccess statement.close(); statement = con.prepareStatement("DELETE FROM boxaccess WHERE charname=?;"); From 7e526fa5b01fb7ddc62f2c3b30a76e3451a1693a Mon Sep 17 00:00:00 2001 From: Alisson Oliveira Date: Thu, 26 Apr 2018 13:47:22 -0300 Subject: [PATCH 035/236] =?UTF-8?q?Remove=20refer=C3=AAncias=20diretas=20?= =?UTF-8?q?=C3=A0=20tabela=20character=5Ffriends?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../gameserver/clientpackets/EnterWorld.java | 52 +++----- .../RequestAnswerFriendInvite.java | 53 ++++---- .../clientpackets/RequestFriendDel.java | 102 +++------------ .../clientpackets/RequestFriendInvite.java | 83 ++++-------- .../clientpackets/RequestFriendList.java | 95 +++++--------- .../model/database/CharacterFriends.java | 6 + .../repository/CharacterFriendRepository.java | 12 +- .../repository/CharacterRepository.java | 3 + .../gameserver/network/L2GameClient.java | 2 +- .../gameserver/serverpackets/FriendList.java | 119 +++++------------- 10 files changed, 157 insertions(+), 370 deletions(-) diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/clientpackets/EnterWorld.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/clientpackets/EnterWorld.java index 1649f272..569a7fd0 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/clientpackets/EnterWorld.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/clientpackets/EnterWorld.java @@ -20,7 +20,7 @@ import com.l2jbr.commons.Base64; import com.l2jbr.commons.Config; -import com.l2jbr.commons.database.L2DatabaseFactory; +import com.l2jbr.commons.database.DatabaseAccess; import com.l2jbr.gameserver.*; import com.l2jbr.gameserver.cache.HtmCache; import com.l2jbr.gameserver.communitybbs.Manager.RegionBBSManager; @@ -29,6 +29,7 @@ import com.l2jbr.gameserver.instancemanager.*; import com.l2jbr.gameserver.model.*; import com.l2jbr.gameserver.model.actor.instance.L2PcInstance; +import com.l2jbr.gameserver.model.database.repository.CharacterFriendRepository; import com.l2jbr.gameserver.model.entity.*; import com.l2jbr.gameserver.model.quest.Quest; import com.l2jbr.gameserver.network.SystemMessageId; @@ -38,9 +39,6 @@ import org.slf4j.LoggerFactory; import java.io.UnsupportedEncodingException; -import java.sql.Connection; -import java.sql.PreparedStatement; -import java.sql.ResultSet; /** @@ -396,38 +394,20 @@ private void notifyPartner(L2PcInstance cha, int partnerId) partner = null; } } - - /** - * @param cha - */ - private void notifyFriends(L2PcInstance cha) - { - try (Connection con = L2DatabaseFactory.getInstance().getConnection(); - PreparedStatement statement = con.prepareStatement("SELECT friend_name FROM character_friends WHERE char_id=?")) - { - statement.setInt(1, cha.getObjectId()); - try (ResultSet rset = statement.executeQuery()) - { - SystemMessage sm = new SystemMessage(SystemMessageId.FRIEND_S1_HAS_LOGGED_IN); - sm.addString(cha.getName()); - - while (rset.next()) - { - String friendName = rset.getString("friend_name"); - L2PcInstance friend = L2World.getInstance().getPlayer(friendName); - - if (friend != null) // friend logged in. - { - friend.sendPacket(new FriendList(friend)); - friend.sendPacket(sm); - } - } - } - } - catch (Exception e) - { - _log.warn("could not restore friend data:" + e); - } + + private void notifyFriends(L2PcInstance cha) { + CharacterFriendRepository repository = DatabaseAccess.getRepository(CharacterFriendRepository.class); + SystemMessage sm = new SystemMessage(SystemMessageId.FRIEND_S1_HAS_LOGGED_IN); + sm.addString(cha.getName()); + repository.findAllByCharacterId(cha.getObjectId()).forEach(characterFriends -> { + L2PcInstance friend = L2World.getInstance().getPlayer(characterFriends.getFriendName()); + + if (friend != null) // friend logged in. + { + friend.sendPacket(new FriendList(friend)); + friend.sendPacket(sm); + } + }); } /** diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/clientpackets/RequestAnswerFriendInvite.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/clientpackets/RequestAnswerFriendInvite.java index 4404c709..8952500a 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/clientpackets/RequestAnswerFriendInvite.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/clientpackets/RequestAnswerFriendInvite.java @@ -18,16 +18,15 @@ */ package com.l2jbr.gameserver.clientpackets; -import com.l2jbr.commons.database.L2DatabaseFactory; +import com.l2jbr.commons.database.DatabaseAccess; import com.l2jbr.gameserver.model.actor.instance.L2PcInstance; +import com.l2jbr.gameserver.model.database.CharacterFriends; +import com.l2jbr.gameserver.model.database.repository.CharacterFriendRepository; import com.l2jbr.gameserver.network.SystemMessageId; import com.l2jbr.gameserver.serverpackets.SystemMessage; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import java.sql.Connection; -import java.sql.PreparedStatement; - /** * sample 5F 01 00 00 00 format cdd @@ -60,34 +59,24 @@ protected void runImpl() if (_response == 1) { - try (Connection con = L2DatabaseFactory.getInstance().getConnection(); - PreparedStatement statement = con.prepareStatement("INSERT INTO character_friends (char_id, friend_id, friend_name) VALUES (?, ?, ?), (?, ?, ?)")) - { - statement.setInt(1, requestor.getObjectId()); - statement.setInt(2, player.getObjectId()); - statement.setString(3, player.getName()); - statement.setInt(4, player.getObjectId()); - statement.setInt(5, requestor.getObjectId()); - statement.setString(6, requestor.getName()); - statement.execute(); - - SystemMessage msg = new SystemMessage(SystemMessageId.YOU_HAVE_SUCCEEDED_INVITING_FRIEND); - requestor.sendPacket(msg); - - // Player added to your friendlist - msg = new SystemMessage(SystemMessageId.S1_ADDED_TO_FRIENDS); - msg.addString(player.getName()); - requestor.sendPacket(msg); - - // has joined as friend. - msg = new SystemMessage(SystemMessageId.S1_JOINED_AS_FRIEND); - msg.addString(requestor.getName()); - player.sendPacket(msg); - } - catch (Exception e) - { - _log.warn("could not add friend objectid: " + e); - } + CharacterFriendRepository repository = DatabaseAccess.getRepository(CharacterFriendRepository.class); + CharacterFriends characterFriends = new CharacterFriends(requestor.getObjectId(), player.getObjectId(), player.getName()); + repository.save(characterFriends); + characterFriends = new CharacterFriends(player.getObjectId(), requestor.getObjectId(), requestor.getName()); + repository.save(characterFriends); + + SystemMessage msg = new SystemMessage(SystemMessageId.YOU_HAVE_SUCCEEDED_INVITING_FRIEND); + requestor.sendPacket(msg); + + // Player added to your friendlist + msg = new SystemMessage(SystemMessageId.S1_ADDED_TO_FRIENDS); + msg.addString(player.getName()); + requestor.sendPacket(msg); + + // has joined as friend. + msg = new SystemMessage(SystemMessageId.S1_JOINED_AS_FRIEND); + msg.addString(requestor.getName()); + player.sendPacket(msg); } else { diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/clientpackets/RequestFriendDel.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/clientpackets/RequestFriendDel.java index 52f5f7ac..a23e9c69 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/clientpackets/RequestFriendDel.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/clientpackets/RequestFriendDel.java @@ -18,17 +18,15 @@ */ package com.l2jbr.gameserver.clientpackets; -import com.l2jbr.commons.database.L2DatabaseFactory; -import com.l2jbr.gameserver.model.L2World; +import com.l2jbr.commons.database.DatabaseAccess; import com.l2jbr.gameserver.model.actor.instance.L2PcInstance; +import com.l2jbr.gameserver.model.database.repository.CharacterFriendRepository; +import com.l2jbr.gameserver.model.database.repository.CharacterRepository; import com.l2jbr.gameserver.network.SystemMessageId; import com.l2jbr.gameserver.serverpackets.SystemMessage; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import java.sql.PreparedStatement; -import java.sql.ResultSet; - /** * This class ... @@ -49,88 +47,26 @@ protected void readImpl() } @Override - protected void runImpl() - { + protected void runImpl() { SystemMessage sm; - java.sql.Connection con = null; L2PcInstance activeChar = getClient().getActiveChar(); - if (activeChar == null) - { + if (activeChar == null) { return; } - - try - { - L2PcInstance friend = L2World.getInstance().getPlayer(_name); - con = L2DatabaseFactory.getInstance().getConnection(); - PreparedStatement statement; - ResultSet rset; - if (friend != null) - { - statement = con.prepareStatement("SELECT friend_id FROM character_friends WHERE char_id=? and friend_id=?"); - statement.setInt(1, activeChar.getObjectId()); - statement.setInt(2, friend.getObjectId()); - rset = statement.executeQuery(); - if (!rset.next()) - { - statement.close(); - // Player is not in your friendlist - sm = new SystemMessage(SystemMessageId.S1_NOT_ON_YOUR_FRIENDS_LIST); - sm.addString(_name); - activeChar.sendPacket(sm); - sm = null; - return; - } - } - else - { - statement = con.prepareStatement("SELECT friend_id FROM character_friends WHERE char_id=? AND friend_name=?"); - statement.setInt(1, activeChar.getObjectId()); - statement.setString(2, _name); - rset = statement.executeQuery(); - if (!rset.next()) - { - statement.close(); - // Player is not in your friendlist - sm = new SystemMessage(SystemMessageId.S1_NOT_ON_YOUR_FRIENDS_LIST); - sm.addString(_name); - activeChar.sendPacket(sm); - sm = null; - return; - } - } - - int objectId = rset.getInt("friend_id"); - statement.close(); - rset.close(); - - statement = con.prepareStatement("DELETE FROM character_friends WHERE char_id=? AND friend_id=?"); - statement.setInt(1, activeChar.getObjectId()); - statement.setInt(2, objectId); - statement.execute(); - // Player deleted from your friendlist - sm = new SystemMessage(SystemMessageId.S1_HAS_BEEN_DELETED_FROM_YOUR_FRIENDS_LIST); - sm.addString(_name); - activeChar.sendPacket(sm); - sm = null; - - statement.close(); - } - catch (Exception e) - { - _log.warn( "could not del friend objectid: ", e); - } - finally - { - try - { - con.close(); - } - catch (Exception e) - { - } - } - + + CharacterRepository characterRepository = DatabaseAccess.getRepository(CharacterRepository.class); + int friendId = characterRepository.findIdByName(_name); + + CharacterFriendRepository repository = DatabaseAccess.getRepository(CharacterFriendRepository.class); + if(repository.deleteFriendship(activeChar.getObjectId(), friendId) > 0) { + sm = new SystemMessage(SystemMessageId.S1_HAS_BEEN_DELETED_FROM_YOUR_FRIENDS_LIST); + sm.addString(_name); + activeChar.sendPacket(sm); + } else { + sm = new SystemMessage(SystemMessageId.S1_NOT_ON_YOUR_FRIENDS_LIST); + sm.addString(_name); + activeChar.sendPacket(sm); + } } @Override diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/clientpackets/RequestFriendInvite.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/clientpackets/RequestFriendInvite.java index d0f8b45d..3f7fe254 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/clientpackets/RequestFriendInvite.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/clientpackets/RequestFriendInvite.java @@ -18,9 +18,10 @@ */ package com.l2jbr.gameserver.clientpackets; -import com.l2jbr.commons.database.L2DatabaseFactory; +import com.l2jbr.commons.database.DatabaseAccess; import com.l2jbr.gameserver.model.L2World; import com.l2jbr.gameserver.model.actor.instance.L2PcInstance; +import com.l2jbr.gameserver.model.database.repository.CharacterFriendRepository; import com.l2jbr.gameserver.network.SystemMessageId; import com.l2jbr.gameserver.serverpackets.AskJoinFriend; import com.l2jbr.gameserver.serverpackets.SystemMessage; @@ -28,9 +29,6 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import java.sql.PreparedStatement; -import java.sql.ResultSet; - /** * This class ... @@ -53,7 +51,6 @@ protected void readImpl() protected void runImpl() { SystemMessage sm; - java.sql.Connection con = null; L2PcInstance activeChar = getClient().getActiveChar(); if (activeChar == null) @@ -64,12 +61,10 @@ protected void runImpl() L2PcInstance friend = L2World.getInstance().getPlayer(_name); _name = Util.capitalizeFirst(_name); // FIXME: is it right to capitalize a nickname? - if (friend == null) - { + if (friend == null) { // Target is not found in the game. sm = new SystemMessage(SystemMessageId.THE_USER_YOU_REQUESTED_IS_NOT_IN_GAME); activeChar.sendPacket(sm); - sm = null; return; } else if (friend == activeChar) @@ -77,60 +72,28 @@ else if (friend == activeChar) // You cannot add yourself to your own friend list. sm = new SystemMessage(SystemMessageId.YOU_CANNOT_ADD_YOURSELF_TO_OWN_FRIEND_LIST); activeChar.sendPacket(sm); - sm = null; return; } - - try - { - con = L2DatabaseFactory.getInstance().getConnection(); - PreparedStatement statement = con.prepareStatement("SELECT char_id FROM character_friends WHERE char_id=? AND friend_id=?"); - statement.setInt(1, activeChar.getObjectId()); - statement.setInt(2, friend.getObjectId()); - ResultSet rset = statement.executeQuery(); - - if (rset.next()) - { - // Player already is in your friendlist - sm = new SystemMessage(SystemMessageId.S1_ALREADY_IN_FRIENDS_LIST); - sm.addString(_name); - } - else - { - if (!friend.isProcessingRequest()) - { - // requets to become friend - activeChar.onTransactionRequest(friend); - sm = new SystemMessage(SystemMessageId.S1_REQUESTED_TO_BECOME_FRIENDS); - sm.addString(_name); - AskJoinFriend ajf = new AskJoinFriend(activeChar.getName()); - friend.sendPacket(ajf); - } - else - { - sm = new SystemMessage(SystemMessageId.S1_IS_BUSY_TRY_LATER); - } - } - - friend.sendPacket(sm); - sm = null; - rset.close(); - statement.close(); - } - catch (Exception e) - { - _log.warn( "could not add friend objectid: ", e); - } - finally - { - try - { - con.close(); - } - catch (Exception e) - { - } - } + + CharacterFriendRepository repository = DatabaseAccess.getRepository(CharacterFriendRepository.class); + if(repository.existsFriends(activeChar.getObjectId(), friend.getObjectId())) { + sm = new SystemMessage(SystemMessageId.S1_ALREADY_IN_FRIENDS_LIST); + sm.addString(_name); + activeChar.sendPacket(sm); + } else { + if (!friend.isProcessingRequest()) { + // requets to become friend + activeChar.onTransactionRequest(friend); + sm = new SystemMessage(SystemMessageId.S1_REQUESTED_TO_BECOME_FRIENDS); + sm.addString(_name); + AskJoinFriend ajf = new AskJoinFriend(activeChar.getName()); + friend.sendPacket(ajf); + friend.sendPacket(sm); + } else { + sm = new SystemMessage(SystemMessageId.S1_IS_BUSY_TRY_LATER); + activeChar.sendPacket(sm); + } + } } @Override diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/clientpackets/RequestFriendList.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/clientpackets/RequestFriendList.java index ce3d3897..5274c3a8 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/clientpackets/RequestFriendList.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/clientpackets/RequestFriendList.java @@ -18,17 +18,15 @@ */ package com.l2jbr.gameserver.clientpackets; -import com.l2jbr.commons.database.L2DatabaseFactory; +import com.l2jbr.commons.database.DatabaseAccess; import com.l2jbr.gameserver.model.L2World; import com.l2jbr.gameserver.model.actor.instance.L2PcInstance; +import com.l2jbr.gameserver.model.database.repository.CharacterFriendRepository; import com.l2jbr.gameserver.network.SystemMessageId; import com.l2jbr.gameserver.serverpackets.SystemMessage; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import java.sql.PreparedStatement; -import java.sql.ResultSet; - /** * This class ... @@ -40,8 +38,7 @@ public final class RequestFriendList extends L2GameClientPacket private static final String _C__60_REQUESTFRIENDLIST = "[C] 60 RequestFriendList"; @Override - protected void readImpl() - { + protected void readImpl() { // trigger } @@ -50,68 +47,34 @@ protected void runImpl() { L2PcInstance activeChar = getClient().getActiveChar(); - if (activeChar == null) - { + if (activeChar == null) { return; } - - SystemMessage sm; - java.sql.Connection con = null; - - try - { - con = L2DatabaseFactory.getInstance().getConnection(); - PreparedStatement statement = con.prepareStatement("SELECT friend_id, friend_name FROM character_friends WHERE char_id=?"); - statement.setInt(1, activeChar.getObjectId()); - - ResultSet rset = statement.executeQuery(); - - // ============ - activeChar.sendPacket(new SystemMessage(SystemMessageId.FRIEND_LIST_HEAD)); - - L2PcInstance friend = null; - while (rset.next()) - { - // int friendId = rset.getInt("friend_id"); - String friendName = rset.getString("friend_name"); - friend = L2World.getInstance().getPlayer(friendName); - - if (friend == null) - { - // (Currently: Offline) - sm = new SystemMessage(SystemMessageId.S1_OFFLINE); - sm.addString(friendName); - } - else - { - // (Currently: Online) - sm = new SystemMessage(SystemMessageId.S1_ONLINE); - sm.addString(friendName); - } - - activeChar.sendPacket(sm); - } - - // ========================= - activeChar.sendPacket(new SystemMessage(SystemMessageId.FRIEND_LIST_FOOT)); - sm = null; - rset.close(); - statement.close(); - } - catch (Exception e) - { - _log.warn("Error in /friendlist for " + activeChar + ": " + e); - } - finally - { - try - { - con.close(); - } - catch (Exception e) - { - } - } + + CharacterFriendRepository repository = DatabaseAccess.getRepository(CharacterFriendRepository.class); + + // ============ + activeChar.sendPacket(new SystemMessage(SystemMessageId.FRIEND_LIST_HEAD)); + + repository.findAllByCharacterId(activeChar.getObjectId()).forEach(characterFriends -> { + String friendName = characterFriends.getFriendName(); + L2PcInstance friend = L2World.getInstance().getPlayer(friendName); + + SystemMessage sm; + if (friend == null) { + sm = new SystemMessage(SystemMessageId.S1_OFFLINE); + sm.addString(friendName); + } else { + // (Currently: Online) + sm = new SystemMessage(SystemMessageId.S1_ONLINE); + sm.addString(friendName); + } + + activeChar.sendPacket(sm); + }); + // ========================= + activeChar.sendPacket(new SystemMessage(SystemMessageId.FRIEND_LIST_FOOT)); + } @Override diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/CharacterFriends.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/CharacterFriends.java index 4df86b76..6ae7a77c 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/CharacterFriends.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/CharacterFriends.java @@ -16,6 +16,12 @@ public class CharacterFriends extends Entity { @Column("friend_name") private String friendName; + public CharacterFriends(int objectId, int friendId, String name) { + this.charId = objectId; + this.friendId = friendId; + this.friendName = name; + } + @Override public Integer getId() { return charId; diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/repository/CharacterFriendRepository.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/repository/CharacterFriendRepository.java index c8d438e4..6e385781 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/repository/CharacterFriendRepository.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/repository/CharacterFriendRepository.java @@ -6,15 +6,21 @@ import org.springframework.data.repository.CrudRepository; import org.springframework.data.repository.query.Param; +import java.util.List; + public interface CharacterFriendRepository extends CrudRepository { @Modifying @Query("DELETE FROM character_friends WHERE char_id=:objectId OR friend_id=:objectId") - int deleteFriend(@Param("objectId") int objectId); + int deleteFriends(@Param("objectId") int objectId); @Query("SELECT * FROM character_friends WHERE char_id=:objectId") - Iterable findAllByCharacterId(@Param("objectId") int objectId); + List findAllByCharacterId(@Param("objectId") int objectId); - @Query("SELECT EXISTS(SELECT 1 FROM character_friends WHERE (char_id=:character AND friend_id=:friend) OR (char_id=:friend AND friend_id=:character))") + @Query("SELECT EXISTS(SELECT 1 FROM character_friends WHERE (char_id=:character AND friend_id=:friend))") boolean existsFriends(@Param("character") int objectId, @Param("friend") int friendId); + + @Modifying + @Query("DELETE FROM character_friends WHERE (char_id=:objectId AND friend_Id=:friend) OR (char_id=:friend AND friend_Id=:objectId)") + int deleteFriendship(@Param("objectId") int objectId, @Param("friend") int friendId); } diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/repository/CharacterRepository.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/repository/CharacterRepository.java index 03439273..40d4da15 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/repository/CharacterRepository.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/repository/CharacterRepository.java @@ -81,4 +81,7 @@ int updateJailStatusByName(@Param("name") String charName, @Param("x") int x, @P @Query("SELECT clanid FROM characters WHERE char_name=:name") int findClanIdByName(@Param("name") String name); + + @Query("SELECT obj_Id FROM characters WHERE char_name=:name") + int findIdByName(@Param("name") String name); } diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/network/L2GameClient.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/network/L2GameClient.java index 0396fdaf..1f90cafd 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/network/L2GameClient.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/network/L2GameClient.java @@ -249,7 +249,7 @@ public static void deleteCharByObjId(int objId) { PreparedStatement statement; CharacterFriendRepository characterFriendRepository = DatabaseAccess.getRepository(CharacterFriendRepository.class); - characterFriendRepository.deleteFriend(objId); + characterFriendRepository.deleteFriends(objId); statement = con.prepareStatement("DELETE FROM character_hennas WHERE char_obj_id=?"); statement.setInt(1, objId); diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/serverpackets/FriendList.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/serverpackets/FriendList.java index 2c7ec3bd..b29a031e 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/serverpackets/FriendList.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/serverpackets/FriendList.java @@ -18,114 +18,55 @@ */ package com.l2jbr.gameserver.serverpackets; -import com.l2jbr.commons.database.L2DatabaseFactory; +import com.l2jbr.commons.database.DatabaseAccess; +import com.l2jbr.commons.util.Util; import com.l2jbr.gameserver.model.L2World; import com.l2jbr.gameserver.model.actor.instance.L2PcInstance; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import java.sql.Connection; -import java.sql.PreparedStatement; -import java.sql.ResultSet; +import com.l2jbr.gameserver.model.database.CharacterFriends; +import com.l2jbr.gameserver.model.database.repository.CharacterFriendRepository; +import java.util.List; /** - * Support for "Chat with Friends" dialog. Format: ch (hdSdh) h: Total Friend Count h: Unknown d: Player Object ID S: Friend Name d: Online/Offline h: Unknown + * Support for "Chat with Friends" dialog. + * + * Format: ch (hdSdh) h: Total Friend Count h: Unknown d: Player Object ID S: Friend Name d: Online/Offline h: Unknown * @author Tempy */ -public class FriendList extends L2GameServerPacket -{ - private static Logger _log = LoggerFactory.getLogger(FriendList.class.getName()); +public class FriendList extends L2GameServerPacket { private static final String _S__FA_FRIENDLIST = "[S] FA FriendList"; private final L2PcInstance _activeChar; - public FriendList(L2PcInstance character) - { + public FriendList(L2PcInstance character) { _activeChar = character; } @Override - protected final void writeImpl() - { - if (_activeChar == null) - { + protected final void writeImpl() { + if (_activeChar == null) { return; } - Connection con = null; - - try - { - String sqlQuery = "SELECT friend_id, friend_name FROM character_friends WHERE " + "char_id=" + _activeChar.getObjectId() + " ORDER BY friend_name ASC"; - - con = L2DatabaseFactory.getInstance().getConnection(); - PreparedStatement statement = con.prepareStatement(sqlQuery); - ResultSet rset = statement.executeQuery(sqlQuery); - - // Obtain the total number of friend entries for this player. - rset.last(); - - if (rset.getRow() > 0) - { - - writeC(0xfa); - writeH(rset.getRow()); - - rset.beforeFirst(); - - while (rset.next()) - { - int friendId = rset.getInt("friend_id"); - String friendName = rset.getString("friend_name"); - - if (friendId == _activeChar.getObjectId()) - { - continue; - } - - L2PcInstance friend = L2World.getInstance().getPlayer(friendName); - - writeH(0); // ?? - writeD(friendId); - writeS(friendName); - - if (friend == null) - { - writeD(0); // offline - } - else - { - writeD(1); // online - } - - writeH(0); // ?? - } - } - - rset.close(); - statement.close(); - } - catch (Exception e) - { - _log.warn("Error found in " + _activeChar.getName() + "'s FriendList: " + e); - } - finally - { - try - { - con.close(); - } - catch (Exception e) - { - } - } + CharacterFriendRepository repository = DatabaseAccess.getRepository(CharacterFriendRepository.class); + List friendList = repository.findAllByCharacterId(_activeChar.getObjectId()); + + if(!Util.isNullOrEmpty(friendList)) { + writeC(0xfa); + writeH(friendList.size()); + friendList.forEach(characterFriends -> { + L2PcInstance friend = L2World.getInstance().getPlayer(characterFriends.getFriendName()); + + writeH(0); // ?? + writeD(characterFriends.getFriendId()); + writeS(characterFriends.getFriendName()); + writeD(friend == null ? 0 : 1); // offline : online + writeH(0); // ?? + + }); + } } - - /* - * (non-Javadoc) - * @see com.l2jbr.gameserver.serverpackets.ServerBasePacket#getType() - */ + @Override public String getType() { From e0127d85636e90610e9922864666c5d79ab15784 Mon Sep 17 00:00:00 2001 From: Alisson Oliveira Date: Thu, 26 Apr 2018 17:50:59 -0300 Subject: [PATCH 036/236] =?UTF-8?q?Remove=20refer=C3=AAncias=20diretas=20?= =?UTF-8?q?=C3=A0=20tabela=20etcitem?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../gameserver/datatables/ItemTable.java | 84 ++++++------------- .../gameserver/model/database/EtcItem.java | 71 +++++++++++++++- .../gameserver/model/database/Items.java | 2 - .../repository/EtcItemRepository.java | 7 ++ 4 files changed, 101 insertions(+), 63 deletions(-) create mode 100644 Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/repository/EtcItemRepository.java diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/datatables/ItemTable.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/datatables/ItemTable.java index 1262ba7a..9e8b84ac 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/datatables/ItemTable.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/datatables/ItemTable.java @@ -30,8 +30,10 @@ import com.l2jbr.gameserver.model.actor.instance.L2PcInstance; import com.l2jbr.gameserver.model.actor.instance.L2RaidBossInstance; import com.l2jbr.gameserver.model.database.Armor; +import com.l2jbr.gameserver.model.database.EtcItem; import com.l2jbr.gameserver.model.database.Weapon; import com.l2jbr.gameserver.model.database.repository.ArmorRepository; +import com.l2jbr.gameserver.model.database.repository.EtcItemRepository; import com.l2jbr.gameserver.model.database.repository.WeaponRepository; import com.l2jbr.gameserver.skills.SkillsEngine; import com.l2jbr.gameserver.templates.*; @@ -39,7 +41,6 @@ import org.slf4j.LoggerFactory; import java.sql.PreparedStatement; -import java.sql.ResultSet; import java.sql.SQLException; import java.util.LinkedHashMap; import java.util.Map; @@ -148,13 +149,6 @@ public class ItemTable { private static ItemTable _instance; - /** - * Table of SQL request in order to obtain items from tables [etcitem], [armor], [weapon] - */ - private static final String[] SQL_ITEM_SELECTS = { - "SELECT item_id, name, crystallizable, item_type, weight, consume_type, material, crystal_type, duration, price, crystal_count, sellable, dropable, destroyable, tradeable FROM etcitem", - }; - /** * List of etcItem */ @@ -197,6 +191,12 @@ public ItemTable() { _armors = new LinkedHashMap<>(); _weapons = new LinkedHashMap<>(); + EtcItemRepository etcItemRepository = DatabaseAccess.getRepository(EtcItemRepository.class); + etcItemRepository.findAll().forEach(item -> { + Item newItem = readItem(item); + itemData.put(newItem.id, newItem); + }); + ArmorRepository armorRepository = DatabaseAccess.getRepository(ArmorRepository.class); armorRepository.findAll().forEach( armor -> { Item newItem = readArmor(armor); @@ -209,32 +209,6 @@ public ItemTable() { weaponData.put(newItem.id, newItem); }); - java.sql.Connection con = null; - try { - con = L2DatabaseFactory.getInstance().getConnection(); - for (String selectQuery : SQL_ITEM_SELECTS) { - PreparedStatement statement = con.prepareStatement(selectQuery); - ResultSet rset = statement.executeQuery(); - - // Add item in correct FastMap - while (rset.next()) { - if (selectQuery.endsWith("etcitem")) { - Item newItem = readItem(rset); - itemData.put(newItem.id, newItem); - } - } - - rset.close(); - statement.close(); - } - } catch (Exception e) { - _log.warn( "data error on item: ", e); - } finally { - try { - con.close(); - } catch (Exception e) { - } - } for (L2Armor armor : SkillsEngine.getInstance().loadArmors(armorData)) { _armors.put(armor.getItemId(), armor); @@ -251,9 +225,6 @@ public ItemTable() { } _log.info("ItemTable: Loaded " + _weapons.size() + " Weapons."); - // fillEtcItemsTable(); - // fillArmorsTable(); - // FillWeaponsTable(); buildFastLookupTable(); } @@ -403,29 +374,22 @@ private Item readArmor(Armor rset) { return item; } - /** - * Returns object Item from the record of the database - * - * @param rset : ResultSet designating a record of the [etcitem] table of database - * @return Item : object created from the database record - * @throws SQLException - */ - private Item readItem(ResultSet rset) throws SQLException { + private Item readItem(EtcItem etcItem) { Item item = new Item(); item.set = new StatsSet(); - item.id = rset.getInt("item_id"); + item.id = etcItem.getItemId(); item.set.set("item_id", item.id); - item.set.set("crystallizable", Boolean.valueOf(rset.getString("crystallizable"))); + item.set.set("crystallizable", Boolean.valueOf(etcItem.getCrystallizable())); item.set.set("type1", L2Item.TYPE1_ITEM_QUESTITEM_ADENA); item.set.set("type2", L2Item.TYPE2_OTHER); item.set.set("bodypart", 0); - item.set.set("crystal_count", rset.getInt("crystal_count")); - item.set.set("sellable", Boolean.valueOf(rset.getString("sellable"))); - item.set.set("dropable", Boolean.valueOf(rset.getString("dropable"))); - item.set.set("destroyable", Boolean.valueOf(rset.getString("destroyable"))); - item.set.set("tradeable", Boolean.valueOf(rset.getString("tradeable"))); - String itemType = rset.getString("item_type"); + item.set.set("crystal_count", etcItem.getCrystalCount()); + item.set.set("sellable", Boolean.valueOf(etcItem.getSellable())); + item.set.set("dropable", Boolean.valueOf(etcItem.getDropable())); + item.set.set("destroyable", Boolean.valueOf(etcItem.getDestroyable())); + item.set.set("tradeable", Boolean.valueOf(etcItem.getTradeable())); + String itemType = etcItem.getItemType(); if (itemType.equals("none")) { item.type = L2EtcItemType.OTHER; // only for default } else if (itemType.equals("castle_guard")) { @@ -462,7 +426,7 @@ private Item readItem(ResultSet rset) throws SQLException { item.type = L2EtcItemType.OTHER; } - String consume = rset.getString("consume_type"); + String consume = etcItem.getConsumeType(); if (consume.equals("asset")) { item.type = L2EtcItemType.MONEY; item.set.set("stackable", true); @@ -473,19 +437,19 @@ private Item readItem(ResultSet rset) throws SQLException { item.set.set("stackable", false); } - int material = _materials.get(rset.getString("material")); + int material = _materials.get(etcItem.getMaterial()); item.set.set("material", material); - int crystal = _crystalTypes.get(rset.getString("crystal_type")); + int crystal = _crystalTypes.get(etcItem.getCrystalType()); item.set.set("crystal_type", crystal); - int weight = rset.getInt("weight"); + int weight = etcItem.getWeight(); item.set.set("weight", weight); - item.name = rset.getString("name"); + item.name = etcItem.getName(); item.set.set("name", item.name); - item.set.set("duration", rset.getInt("duration")); - item.set.set("price", rset.getInt("price")); + item.set.set("duration", etcItem.getDuration()); + item.set.set("price", etcItem.getPrice()); return item; } diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/EtcItem.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/EtcItem.java index adcc8b81..a3cdf65e 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/EtcItem.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/EtcItem.java @@ -1,8 +1,9 @@ package com.l2jbr.gameserver.model.database; - +import org.springframework.data.annotation.Id; public class EtcItem { + @Id private int item_id; private String name; private String crystallizable; @@ -20,4 +21,72 @@ public class EtcItem { private String tradeable; private String oldname; private String oldtype; + + public int getItemId() { + return item_id; + } + + public String getName() { + return name; + } + + public String getCrystallizable() { + return crystallizable; + } + + public String getItemType() { + return item_type; + } + + public int getWeight() { + return weight; + } + + public String getConsumeType() { + return consume_type; + } + + public String getMaterial() { + return material; + } + + public String getCrystalType() { + return crystal_type; + } + + public int getDuration() { + return duration; + } + + public int getPrice() { + return price; + } + + public int getCrystalCount() { + return crystal_count; + } + + public String getSellable() { + return sellable; + } + + public String getDropable() { + return dropable; + } + + public String getDestroyable() { + return destroyable; + } + + public String getTradeable() { + return tradeable; + } + + public String getOldname() { + return oldname; + } + + public String getOldtype() { + return oldtype; + } } diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/Items.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/Items.java index 0745fe9b..c3a6a061 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/Items.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/Items.java @@ -1,7 +1,5 @@ package com.l2jbr.gameserver.model.database; - - public class Items { private int owner_id; diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/repository/EtcItemRepository.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/repository/EtcItemRepository.java new file mode 100644 index 00000000..31b48f5a --- /dev/null +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/repository/EtcItemRepository.java @@ -0,0 +1,7 @@ +package com.l2jbr.gameserver.model.database.repository; + +import com.l2jbr.gameserver.model.database.EtcItem; +import org.springframework.data.repository.CrudRepository; + +public interface EtcItemRepository extends CrudRepository { +} From a49db631212eabc1eab414fa735aebc2036bf53a Mon Sep 17 00:00:00 2001 From: Alisson Oliveira Date: Thu, 26 Apr 2018 18:56:55 -0300 Subject: [PATCH 037/236] =?UTF-8?q?Remove=20refer=C3=AAncias=20diretas=20?= =?UTF-8?q?=C3=A0=20tabela=20henna?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../gameserver/datatables/HennaTable.java | 67 +++++-------------- .../gameserver/model/database/Henna.java | 49 +++++++++++++- .../database/repository/HennaRepository.java | 7 ++ .../resources/gameserver-messages.properties | 1 + .../gameserver-messages_pt_BR.properties | 1 + 5 files changed, 73 insertions(+), 52 deletions(-) create mode 100644 Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/repository/HennaRepository.java diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/datatables/HennaTable.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/datatables/HennaTable.java index 453214c7..e035dbc4 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/datatables/HennaTable.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/datatables/HennaTable.java @@ -18,23 +18,17 @@ */ package com.l2jbr.gameserver.datatables; -import com.l2jbr.commons.database.L2DatabaseFactory; +import com.l2jbr.commons.database.DatabaseAccess; +import com.l2jbr.gameserver.model.database.Henna; +import com.l2jbr.gameserver.model.database.repository.HennaRepository; import com.l2jbr.gameserver.templates.L2Henna; import com.l2jbr.gameserver.templates.StatsSet; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import java.sql.PreparedStatement; -import java.sql.ResultSet; import java.util.LinkedHashMap; import java.util.Map; - -/** - * This class ... - * - * @version $Revision$ $Date$ - */ public class HennaTable { private static Logger _log = LoggerFactory.getLogger(HennaTable.class.getName()); @@ -53,58 +47,31 @@ public static HennaTable getInstance() { private HennaTable() { _henna = new LinkedHashMap<>(); restoreHennaData(); - } - /** - * - */ private void restoreHennaData() { - java.sql.Connection con = null; - try { - try { - con = L2DatabaseFactory.getInstance().getConnection(); - PreparedStatement statement = con.prepareStatement("SELECT symbol_id, symbol_name, dye_id, dye_amount, price, stat_INT, stat_STR, stat_CON, stat_MEM, stat_DEX, stat_WIT FROM henna"); - ResultSet hennadata = statement.executeQuery(); - - fillHennaTable(hennadata); - hennadata.close(); - statement.close(); - } catch (Exception e) { - _log.error("error while creating henna table " + e); - e.printStackTrace(); - } - - } finally { - try { - con.close(); - } catch (Exception e) { - } - } + HennaRepository repository = DatabaseAccess.getRepository(HennaRepository.class); + repository.findAll().forEach(this::fillHennaTable); + _log.info("info.henna.loaded", + _henna.size()); } - private void fillHennaTable(ResultSet HennaData) throws Exception { - while (HennaData.next()) { + private void fillHennaTable(Henna henna) { StatsSet hennaDat = new StatsSet(); - int id = HennaData.getInt("symbol_id"); + int id = henna.getSymbolId(); hennaDat.set("symbol_id", id); - // hennaDat.set("symbol_name", HennaData.getString("symbol_name")); - hennaDat.set("dye", HennaData.getInt("dye_id")); - hennaDat.set("price", HennaData.getInt("price")); - // amount of dye required - hennaDat.set("amount", HennaData.getInt("dye_amount")); - hennaDat.set("stat_INT", HennaData.getInt("stat_INT")); - hennaDat.set("stat_STR", HennaData.getInt("stat_STR")); - hennaDat.set("stat_CON", HennaData.getInt("stat_CON")); - hennaDat.set("stat_MEM", HennaData.getInt("stat_MEM")); - hennaDat.set("stat_DEX", HennaData.getInt("stat_DEX")); - hennaDat.set("stat_WIT", HennaData.getInt("stat_WIT")); + hennaDat.set("dye", henna.getDyeId()); + hennaDat.set("price", henna.getPrice()); + hennaDat.set("amount", henna.getDyeAmount()); + hennaDat.set("stat_INT", henna.getStat_INT()); + hennaDat.set("stat_STR", henna.getStat_STR()); + hennaDat.set("stat_CON", henna.getStat_CON()); + hennaDat.set("stat_MEM", henna.getStat_MEM()); + hennaDat.set("stat_DEX", henna.getStat_DEX()); + hennaDat.set("stat_WIT", henna.getStat_WIT()); L2Henna template = new L2Henna(hennaDat); _henna.put(id, template); - } - _log.info("HennaTable: Loaded " + _henna.size() + " Templates."); } public boolean isInitialized() { diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/Henna.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/Henna.java index 18bfa913..7a766c3d 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/Henna.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/Henna.java @@ -1,18 +1,63 @@ package com.l2jbr.gameserver.model.database; - +import org.springframework.data.annotation.Id; public class Henna { + @Id private int symbol_id; private String symbol_name; private int dye_id; private int dye_amount; private int price; - private int stat_; + private int stat_INT; private int stat_STR; private int stat_CON; private int stat_MEM; private int stat_DEX; private int stat_WIT; + + public int getSymbolId() { + return symbol_id; + } + + public String getSymbol_name() { + return symbol_name; + } + + public int getDyeId() { + return dye_id; + } + + public int getDyeAmount() { + return dye_amount; + } + + public int getPrice() { + return price; + } + + public int getStat_INT() { + return stat_INT; + } + + public int getStat_STR() { + return stat_STR; + } + + public int getStat_CON() { + return stat_CON; + } + + public int getStat_MEM() { + return stat_MEM; + } + + public int getStat_DEX() { + return stat_DEX; + } + + public int getStat_WIT() { + return stat_WIT; + } } diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/repository/HennaRepository.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/repository/HennaRepository.java new file mode 100644 index 00000000..41ccac9d --- /dev/null +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/repository/HennaRepository.java @@ -0,0 +1,7 @@ +package com.l2jbr.gameserver.model.database.repository; + +import com.l2jbr.gameserver.model.database.Henna; +import org.springframework.data.repository.CrudRepository; + +public interface HennaRepository extends CrudRepository { +} diff --git a/Gameserver/src/main/resources/gameserver-messages.properties b/Gameserver/src/main/resources/gameserver-messages.properties index 3b5ffefc..309510d3 100644 --- a/Gameserver/src/main/resources/gameserver-messages.properties +++ b/Gameserver/src/main/resources/gameserver-messages.properties @@ -30,3 +30,4 @@ info.loaded.clanhall=Loaded {} clan halls. info.loaded.free.clanhall=Loaded {} free clan halls. info.npc.loaded=NpcTable: Loaded {} Npc Templates. info.auto.chat.loaded=AutoChatHandler: Loaded {} chat group(s) from the database. +info.henna.loaded=HennaTable: Loaded {} Templates. diff --git a/Gameserver/src/main/resources/gameserver-messages_pt_BR.properties b/Gameserver/src/main/resources/gameserver-messages_pt_BR.properties index fc89887d..43619d8e 100644 --- a/Gameserver/src/main/resources/gameserver-messages_pt_BR.properties +++ b/Gameserver/src/main/resources/gameserver-messages_pt_BR.properties @@ -30,3 +30,4 @@ info.loaded.clanhall={} Clan Halls carregados. info.loaded.free.clanhall={} Clan halls livres carregados. info.npc.loaded=NpcTable: {} modelos de NPCs carregados. info.auto.chat.loaded=AutoChatHandler: {} grupos de chat foram carregados do banco de dados. +info.henna.loaded=HennaTable: {} templates carregados. From 6574da5536842c5f148c699d0d0aff2859a57fbb Mon Sep 17 00:00:00 2001 From: Alisson Oliveira Date: Mon, 30 Apr 2018 13:08:24 -0300 Subject: [PATCH 038/236] =?UTF-8?q?Remove=20refer=C3=AAncias=20diretas=20?= =?UTF-8?q?=C3=A0=20tabela=20character=5Fhennas?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../model/actor/instance/L2PcInstance.java | 109 +++++------------- .../model/database/CharacterHennas.java | 41 ++++++- .../repository/CharacterHennasRepository.java | 21 ++++ .../gameserver/network/L2GameClient.java | 7 +- 4 files changed, 87 insertions(+), 91 deletions(-) create mode 100644 Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/repository/CharacterHennasRepository.java diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/actor/instance/L2PcInstance.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/actor/instance/L2PcInstance.java index e760f1fd..484adaec 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/actor/instance/L2PcInstance.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/actor/instance/L2PcInstance.java @@ -48,6 +48,8 @@ import com.l2jbr.gameserver.model.actor.status.PcStatus; import com.l2jbr.gameserver.model.base.*; import com.l2jbr.gameserver.model.database.Character; +import com.l2jbr.gameserver.model.database.CharacterHennas; +import com.l2jbr.gameserver.model.database.repository.CharacterHennasRepository; import com.l2jbr.gameserver.model.database.repository.CharacterRepository; import com.l2jbr.gameserver.model.entity.*; import com.l2jbr.gameserver.model.quest.Quest; @@ -89,10 +91,6 @@ public final class L2PcInstance extends L2PlayableInstance { private static final String ADD_CHAR_SUBCLASS = "INSERT INTO character_subclasses (char_obj_id,class_id,exp,sp,level,class_index) VALUES (?,?,?,?,?,?)"; private static final String UPDATE_CHAR_SUBCLASS = "UPDATE character_subclasses SET exp=?,sp=?,level=?,class_id=? WHERE char_obj_id=? AND class_index =?"; private static final String DELETE_CHAR_SUBCLASS = "DELETE FROM character_subclasses WHERE char_obj_id=? AND class_index=?"; - private static final String RESTORE_CHAR_HENNAS = "SELECT slot,symbol_id FROM character_hennas WHERE char_obj_id=? AND class_index=?"; - private static final String ADD_CHAR_HENNA = "INSERT INTO character_hennas (char_obj_id,symbol_id,slot,class_index) VALUES (?,?,?,?)"; - private static final String DELETE_CHAR_HENNA = "DELETE FROM character_hennas WHERE char_obj_id=? AND slot=? AND class_index=?"; - private static final String DELETE_CHAR_HENNAS = "DELETE FROM character_hennas WHERE char_obj_id=? AND class_index=?"; private static final String DELETE_CHAR_SHORTCUTS = "DELETE FROM character_shortcuts WHERE char_obj_id=? AND class_index=?"; private static final String RESTORE_CHAR_RECOMS = "SELECT char_id,target_id FROM character_recommends WHERE char_id=?"; private static final String ADD_CHAR_RECOM = "INSERT INTO character_recommends (char_id,target_id) VALUES (?,?)"; @@ -7188,52 +7186,30 @@ public void restoreEffects() { * Retrieve from the database all Henna of this L2PcInstance, add them to _henna and calculate stats of the L2PcInstance. */ private void restoreHenna() { - java.sql.Connection con = null; + for (int i = 0; i < 3; i++) { + _henna[i] = null; + } - try { - con = L2DatabaseFactory.getInstance().getConnection(); - PreparedStatement statement = con.prepareStatement(RESTORE_CHAR_HENNAS); - statement.setInt(1, getObjectId()); - statement.setInt(2, getClassIndex()); - ResultSet rset = statement.executeQuery(); + CharacterHennasRepository repository = DatabaseAccess.getRepository(CharacterHennasRepository.class); + repository.findAllByClassIndex(getObjectId(), getClassIndex()).forEach(characterHenna -> { + int slot = characterHenna.getSlot(); - for (int i = 0; i < 3; i++) { - _henna[i] = null; + if ((slot < 1) || (slot > 3)) { + _log.warn("Invalid Henna Slot to character {} on classIndex {}", getName(), getClassIndex()); + return; } - while (rset.next()) { - int slot = rset.getInt("slot"); - - if ((slot < 1) || (slot > 3)) { - continue; - } - - int symbol_id = rset.getInt("symbol_id"); + int symbol_id = characterHenna.getSymbolId(); - L2HennaInstance sym = null; + if (symbol_id != 0) { + L2Henna tpl = HennaTable.getInstance().getTemplate(symbol_id); - if (symbol_id != 0) { - L2Henna tpl = HennaTable.getInstance().getTemplate(symbol_id); - - if (tpl != null) { - sym = new L2HennaInstance(tpl); - _henna[slot - 1] = sym; - } + if (tpl != null) { + _henna[slot - 1] = new L2HennaInstance(tpl); } } + }); - rset.close(); - statement.close(); - } catch (Exception e) { - _log.warn("could not restore henna: " + e); - } finally { - try { - con.close(); - } catch (Exception e) { - } - } - - // Calculate Henna modifiers of this L2PcInstance recalcHennaStats(); } @@ -7307,22 +7283,8 @@ public boolean removeHenna(int slot) { java.sql.Connection con = null; - try { - con = L2DatabaseFactory.getInstance().getConnection(); - PreparedStatement statement = con.prepareStatement(DELETE_CHAR_HENNA); - statement.setInt(1, getObjectId()); - statement.setInt(2, slot + 1); - statement.setInt(3, getClassIndex()); - statement.execute(); - statement.close(); - } catch (Exception e) { - _log.warn("could not remove char henna: " + e); - } finally { - try { - con.close(); - } catch (Exception e) { - } - } + CharacterHennasRepository repository = DatabaseAccess.getRepository(CharacterHennasRepository.class); + repository.deleteByClassindexAndSlot(getObjectId(), getClassIndex(), slot+1); // Calculate Henna modifiers of this L2PcInstance recalcHennaStats(); @@ -7345,7 +7307,8 @@ public boolean removeHenna(int slot) { } /** - * Add a Henna to the L2PcInstance, save update in the character_hennas table of the database and send Server->Client HennaInfo/UserInfo packet to this L2PcInstance. + * Add a Henna to the L2PcInstance, save update in the character_hennas table of the database and + * send Server->Client HennaInfo/UserInfo packet to this L2PcInstance. * * @param henna the henna * @return true, if successful @@ -7364,25 +7327,9 @@ public boolean addHenna(L2HennaInstance henna) { // Calculate Henna modifiers of this L2PcInstance recalcHennaStats(); - java.sql.Connection con = null; - - try { - con = L2DatabaseFactory.getInstance().getConnection(); - PreparedStatement statement = con.prepareStatement(ADD_CHAR_HENNA); - statement.setInt(1, getObjectId()); - statement.setInt(2, henna.getSymbolId()); - statement.setInt(3, i + 1); - statement.setInt(4, getClassIndex()); - statement.execute(); - statement.close(); - } catch (Exception e) { - _log.warn("could not save char henna: " + e); - } finally { - try { - con.close(); - } catch (Exception e) { - } - } + CharacterHennas characterHenna = new CharacterHennas(getObjectId(), henna.getSymbolId(), getClassIndex(), i+1); + CharacterHennasRepository repository = DatabaseAccess.getRepository(CharacterHennasRepository.class); + repository.save(characterHenna); // Send Server->Client HennaInfo packet to this L2PcInstance HennaInfo hi = new HennaInfo(this); @@ -9405,12 +9352,8 @@ public boolean modifySubClass(int classIndex, int newClassId) { con = L2DatabaseFactory.getInstance().getConnection(); PreparedStatement statement; - // Remove all henna info stored for this sub-class. - statement = con.prepareStatement(DELETE_CHAR_HENNAS); - statement.setInt(1, getObjectId()); - statement.setInt(2, classIndex); - statement.execute(); - statement.close(); + CharacterHennasRepository repository = DatabaseAccess.getRepository(CharacterHennasRepository.class); + repository.deleteByClassIndex(getObjectId(), classIndex); // Remove all shortcuts info stored for this sub-class. statement = con.prepareStatement(DELETE_CHAR_SHORTCUTS); diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/CharacterHennas.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/CharacterHennas.java index 87c36616..a31daf51 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/CharacterHennas.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/CharacterHennas.java @@ -1,10 +1,43 @@ package com.l2jbr.gameserver.model.database; +import com.l2jbr.commons.database.annotation.Column; +import com.l2jbr.commons.database.annotation.Table; +import com.l2jbr.commons.database.model.Entity; +import org.springframework.data.annotation.Id; +@Table("character_hennas") +public class CharacterHennas extends Entity { -public class CharacterHennas { - private int char_obj_id; - private int symbol_id; + @Id + @Column("char_obj_id") + private int charObjId; + @Column("symbol_id") + private int symbolId; private int slot; - private int class_index; + @Column("class_index") + private int classIndex; + + public CharacterHennas(int objectId, int symbolId, int classIndex, int slot) { + this.charObjId = objectId; + this.symbolId = symbolId; + this.classIndex = classIndex; + this.slot = slot; + } + + @Override + public Integer getId() { + return charObjId; + } + + public int getSymbolId() { + return symbolId; + } + + public int getSlot() { + return slot; + } + + public int getClassIndex() { + return classIndex; + } } diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/repository/CharacterHennasRepository.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/repository/CharacterHennasRepository.java new file mode 100644 index 00000000..c2d87aea --- /dev/null +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/repository/CharacterHennasRepository.java @@ -0,0 +1,21 @@ +package com.l2jbr.gameserver.model.database.repository; + +import com.l2jbr.gameserver.model.database.CharacterHennas; +import org.springframework.data.jdbc.repository.query.Modifying; +import org.springframework.data.jdbc.repository.query.Query; +import org.springframework.data.repository.CrudRepository; +import org.springframework.data.repository.query.Param; + +public interface CharacterHennasRepository extends CrudRepository { + + @Query("SELECT slot,symbol_id FROM character_hennas WHERE char_obj_id=:objectId AND class_index=:classIndex") + Iterable findAllByClassIndex(@Param("objectId") int objectId, @Param("classIndex") int classIndex); + + @Modifying + @Query("DELETE FROM character_hennas WHERE char_obj_id=:objectId AND class_index=:classIndex") + int deleteByClassIndex(@Param("objectId") int objectId, @Param("classIndex") int classIndex); + + @Modifying + @Query("DELETE FROM character_hennas WHERE char_obj_id=:objectId AND slot=:slot AND class_index=:classIndex") + void deleteByClassindexAndSlot(int objectId, int classIndex, int i); +} diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/network/L2GameClient.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/network/L2GameClient.java index 1f90cafd..09a1d852 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/network/L2GameClient.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/network/L2GameClient.java @@ -30,6 +30,7 @@ import com.l2jbr.gameserver.model.actor.instance.L2PcInstance; import com.l2jbr.gameserver.model.database.repository.AugmentationsRepository; import com.l2jbr.gameserver.model.database.repository.CharacterFriendRepository; +import com.l2jbr.gameserver.model.database.repository.CharacterHennasRepository; import com.l2jbr.gameserver.model.database.repository.CharacterRepository; import com.l2jbr.gameserver.model.entity.L2Event; import com.l2jbr.gameserver.serverpackets.L2GameServerPacket; @@ -251,10 +252,8 @@ public static void deleteCharByObjId(int objId) { CharacterFriendRepository characterFriendRepository = DatabaseAccess.getRepository(CharacterFriendRepository.class); characterFriendRepository.deleteFriends(objId); - statement = con.prepareStatement("DELETE FROM character_hennas WHERE char_obj_id=?"); - statement.setInt(1, objId); - statement.execute(); - statement.close(); + CharacterHennasRepository characterHennasRepository = DatabaseAccess.getRepository(CharacterHennasRepository.class); + characterHennasRepository.deleteById(objId); statement = con.prepareStatement("DELETE FROM character_macroses WHERE char_obj_id=?"); statement.setInt(1, objId); From c6d62560fd2d84c61e68eb78d471b48936af66a0 Mon Sep 17 00:00:00 2001 From: Alisson Oliveira Date: Mon, 30 Apr 2018 14:27:05 -0300 Subject: [PATCH 039/236] =?UTF-8?q?Remove=20refer=C3=AAncias=20diretas=20?= =?UTF-8?q?=C3=A0=20tabela=20character=5Fmacroses?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/l2jbr/gameserver/model/MacroList.java | 128 +++++------------- .../model/database/CharacterMacroses.java | 61 ++++++++- .../CharacterMacrosesRepository.java | 17 +++ .../gameserver/network/L2GameClient.java | 11 +- .../accountmanager/SQLAccountManager.java | 9 +- 5 files changed, 118 insertions(+), 108 deletions(-) create mode 100644 Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/repository/CharacterMacrosesRepository.java diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/MacroList.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/MacroList.java index 6f69f298..791660a3 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/MacroList.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/MacroList.java @@ -18,9 +18,12 @@ */ package com.l2jbr.gameserver.model; +import com.l2jbr.commons.database.DatabaseAccess; import com.l2jbr.commons.database.L2DatabaseFactory; import com.l2jbr.gameserver.model.L2Macro.L2MacroCmd; import com.l2jbr.gameserver.model.actor.instance.L2PcInstance; +import com.l2jbr.gameserver.model.database.CharacterMacroses; +import com.l2jbr.gameserver.model.database.repository.CharacterMacrosesRepository; import com.l2jbr.gameserver.serverpackets.SendMacroList; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -109,107 +112,46 @@ public void sendUpdate() { } private void registerMacroInDb(L2Macro macro) { - java.sql.Connection con = null; - try { - con = L2DatabaseFactory.getInstance().getConnection(); - - PreparedStatement statement = con.prepareStatement("INSERT INTO character_macroses (char_obj_id,id,icon,name,descr,acronym,commands) values(?,?,?,?,?,?,?)"); - statement.setInt(1, _owner.getObjectId()); - statement.setInt(2, macro.id); - statement.setInt(3, macro.icon); - statement.setString(4, macro.name); - statement.setString(5, macro.descr); - statement.setString(6, macro.acronym); - StringBuilder sb = new StringBuilder(); - for (L2MacroCmd cmd : macro.commands) { - sb.append(cmd.type).append(','); - sb.append(cmd.d1).append(','); - sb.append(cmd.d2); - if ((cmd.cmd != null) && (cmd.cmd.length() > 0)) { - sb.append(',').append(cmd.cmd); - } - sb.append(';'); - } - statement.setString(7, sb.toString()); - statement.execute(); - statement.close(); - } catch (Exception e) { - _log.warn( "could not store macro:", e); - } finally { - try { - con.close(); - } catch (Exception e) { - } - } + CharacterMacroses characterMacro = new CharacterMacroses(_owner.getObjectId(), macro); + CharacterMacrosesRepository repository = DatabaseAccess.getRepository(CharacterMacrosesRepository.class); + repository.save(characterMacro); } - /** - * @param macro - */ private void deleteMacroFromDb(L2Macro macro) { - java.sql.Connection con = null; - try { - con = L2DatabaseFactory.getInstance().getConnection(); - - PreparedStatement statement = con.prepareStatement("DELETE FROM character_macroses WHERE char_obj_id=? AND id=?"); - statement.setInt(1, _owner.getObjectId()); - statement.setInt(2, macro.id); - statement.execute(); - statement.close(); - } catch (Exception e) { - _log.warn( "could not delete macro:", e); - } finally { - try { - con.close(); - } catch (Exception e) { - } - } + CharacterMacrosesRepository repository = DatabaseAccess.getRepository(CharacterMacrosesRepository.class); + repository.deleteByMacroId(_owner.getObjectId(), macro.id); } public void restore() { _macroses.clear(); - java.sql.Connection con = null; - try { - con = L2DatabaseFactory.getInstance().getConnection(); - PreparedStatement statement = con.prepareStatement("SELECT char_obj_id, id, icon, name, descr, acronym, commands FROM character_macroses WHERE char_obj_id=?"); - statement.setInt(1, _owner.getObjectId()); - ResultSet rset = statement.executeQuery(); - while (rset.next()) { - int id = rset.getInt("id"); - int icon = rset.getInt("icon"); - String name = rset.getString("name"); - String descr = rset.getString("descr"); - String acronym = rset.getString("acronym"); - List commands = new LinkedList<>(); - StringTokenizer st1 = new StringTokenizer(rset.getString("commands"), ";"); - while (st1.hasMoreTokens()) { - StringTokenizer st = new StringTokenizer(st1.nextToken(), ","); - if (st.countTokens() < 3) { - continue; - } - int type = Integer.parseInt(st.nextToken()); - int d1 = Integer.parseInt(st.nextToken()); - int d2 = Integer.parseInt(st.nextToken()); - String cmd = ""; - if (st.hasMoreTokens()) { - cmd = st.nextToken(); - } - L2MacroCmd mcmd = new L2MacroCmd(commands.size(), type, d1, d2, cmd); - commands.add(mcmd); - } - L2Macro m = new L2Macro(id, icon, name, descr, acronym, commands.toArray(new L2MacroCmd[commands.size()])); - _macroses.put(m.id, m); - } - rset.close(); - statement.close(); - } catch (Exception e) { - _log.warn( "could not store shortcuts:", e); - } finally { - try { - con.close(); - } catch (Exception e) { + CharacterMacrosesRepository repository = DatabaseAccess.getRepository(CharacterMacrosesRepository.class); + repository.findAllByCharacter(_owner.getObjectId()).forEach(macro -> { + int id = macro.getId(); + int icon = macro.getIcon(); + String name = macro.getName(); + String descr = macro.getDescr(); + String acronym = macro.getAcronym(); + List commands = new LinkedList<>(); + StringTokenizer st1 = new StringTokenizer(macro.getCommands(), ";"); + while (st1.hasMoreTokens()) { + StringTokenizer st = new StringTokenizer(st1.nextToken(), ","); + if (st.countTokens() < 3) { + continue; + } + int type = Integer.parseInt(st.nextToken()); + int d1 = Integer.parseInt(st.nextToken()); + int d2 = Integer.parseInt(st.nextToken()); + String cmd = ""; + if (st.hasMoreTokens()) { + cmd = st.nextToken(); + } + L2MacroCmd mcmd = new L2MacroCmd(commands.size(), type, d1, d2, cmd); + commands.add(mcmd); } - } + + L2Macro m = new L2Macro(id, icon, name, descr, acronym, commands.toArray(new L2MacroCmd[commands.size()])); + _macroses.put(m.id, m); + }); } } diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/CharacterMacroses.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/CharacterMacroses.java index 76a44a97..0a07676c 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/CharacterMacroses.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/CharacterMacroses.java @@ -1,13 +1,70 @@ package com.l2jbr.gameserver.model.database; +import com.l2jbr.commons.database.annotation.Column; +import com.l2jbr.commons.database.annotation.Table; +import com.l2jbr.commons.database.model.Entity; +import com.l2jbr.gameserver.model.L2Macro; +import org.springframework.data.annotation.Id; +@Table("character_macroses") +public class CharacterMacroses extends Entity { -public class CharacterMacroses { - private int char_obj_id; + @Id + @Column("char_obj_id") + private int charObjId; private int id; private int icon; private String name; private String descr; private String acronym; private String commands; + + public CharacterMacroses(int objectId, L2Macro macro) { + this.charObjId = objectId; + this.id = macro.id; + this.icon = macro.icon; + this.name = macro.name; + this.acronym = macro.acronym; + buildCommands(macro); + + } + + private void buildCommands(L2Macro macro) { + StringBuilder sb = new StringBuilder(); + for (L2Macro.L2MacroCmd cmd : macro.commands) { + sb.append(cmd.type).append(','); + sb.append(cmd.d1).append(','); + sb.append(cmd.d2); + if ((cmd.cmd != null) && (cmd.cmd.length() > 0)) { + sb.append(',').append(cmd.cmd); + } + sb.append(';'); + } + this.commands = sb.toString(); + } + + @Override + public Integer getId() { + return id; + } + + public int getIcon() { + return icon; + } + + public String getName() { + return name; + } + + public String getDescr() { + return descr; + } + + public String getAcronym() { + return acronym; + } + + public String getCommands() { + return commands; + } } diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/repository/CharacterMacrosesRepository.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/repository/CharacterMacrosesRepository.java new file mode 100644 index 00000000..934723db --- /dev/null +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/repository/CharacterMacrosesRepository.java @@ -0,0 +1,17 @@ +package com.l2jbr.gameserver.model.database.repository; + +import com.l2jbr.gameserver.model.database.CharacterMacroses; +import org.springframework.data.jdbc.repository.query.Modifying; +import org.springframework.data.jdbc.repository.query.Query; +import org.springframework.data.repository.CrudRepository; +import org.springframework.data.repository.query.Param; + +public interface CharacterMacrosesRepository extends CrudRepository { + + @Modifying + @Query("DELETE FROM character_macroses WHERE char_obj_id=:objectId AND id=:id") + int deleteByMacroId(@Param("objectId") int objectId, @Param("id") int id); + + @Query("SELECT * FROM character_macroses WHERE char_obj_id=:objectId") + Iterable findAllByCharacter(@Param("objectId") int objectId); +} diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/network/L2GameClient.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/network/L2GameClient.java index 09a1d852..8f38dd9f 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/network/L2GameClient.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/network/L2GameClient.java @@ -28,10 +28,7 @@ import com.l2jbr.gameserver.model.CharSelectInfoPackage; import com.l2jbr.gameserver.model.L2World; import com.l2jbr.gameserver.model.actor.instance.L2PcInstance; -import com.l2jbr.gameserver.model.database.repository.AugmentationsRepository; -import com.l2jbr.gameserver.model.database.repository.CharacterFriendRepository; -import com.l2jbr.gameserver.model.database.repository.CharacterHennasRepository; -import com.l2jbr.gameserver.model.database.repository.CharacterRepository; +import com.l2jbr.gameserver.model.database.repository.*; import com.l2jbr.gameserver.model.entity.L2Event; import com.l2jbr.gameserver.serverpackets.L2GameServerPacket; import com.l2jbr.gameserver.serverpackets.ServerClose; @@ -255,10 +252,8 @@ public static void deleteCharByObjId(int objId) { CharacterHennasRepository characterHennasRepository = DatabaseAccess.getRepository(CharacterHennasRepository.class); characterHennasRepository.deleteById(objId); - statement = con.prepareStatement("DELETE FROM character_macroses WHERE char_obj_id=?"); - statement.setInt(1, objId); - statement.execute(); - statement.close(); + CharacterMacrosesRepository characterMacrosesRepository = DatabaseAccess.getRepository(CharacterMacrosesRepository.class); + characterMacrosesRepository.deleteById(objId); statement = con.prepareStatement("DELETE FROM character_quests WHERE char_id=?"); statement.setInt(1, objId); diff --git a/Tools/src/main/com.l2jbr.tools/com/l2jbr/tools/accountmanager/SQLAccountManager.java b/Tools/src/main/com.l2jbr.tools/com/l2jbr/tools/accountmanager/SQLAccountManager.java index 2f772912..a34ce18b 100644 --- a/Tools/src/main/com.l2jbr.tools/com/l2jbr/tools/accountmanager/SQLAccountManager.java +++ b/Tools/src/main/com.l2jbr.tools/com/l2jbr/tools/accountmanager/SQLAccountManager.java @@ -26,6 +26,7 @@ import com.l2jbr.commons.database.L2DatabaseFactory; import com.l2jbr.commons.database.model.Account; import com.l2jbr.gameserver.model.database.repository.CharacterFriendRepository; +import com.l2jbr.gameserver.model.database.repository.CharacterMacrosesRepository; import com.l2jbr.gameserver.model.database.repository.CharacterRepository; import com.l2jbr.gameserver.model.database.repository.ClanRepository; @@ -222,11 +223,9 @@ private static void deleteAccount(String login) throws SQLException { statement.setInt(1, character.getObjectId()); statement.executeUpdate(); - // macroses - statement.close(); - statement = con.prepareStatement("DELETE FROM character_macroses WHERE char_obj_id=?;"); - statement.setInt(1, character.getObjectId()); - statement.executeUpdate(); + CharacterMacrosesRepository characterMacrosesRepository = DatabaseAccess.getRepository(CharacterMacrosesRepository.class); + characterMacrosesRepository.deleteById(character.getObjectId()); + CharacterFriendRepository characterFriendRepository = DatabaseAccess.getRepository(CharacterFriendRepository.class); characterFriendRepository.deleteById(character.getObjectId()); From 7ad1b45cfd0e0e59edd1a45e546b681626917fe0 Mon Sep 17 00:00:00 2001 From: Alisson Oliveira Date: Mon, 30 Apr 2018 18:23:30 -0300 Subject: [PATCH 040/236] =?UTF-8?q?Remove=20refer=C3=AAncias=20diretas=20?= =?UTF-8?q?=C3=A0=20tabela=20character=5Fquests?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../503_PursuitClanAmbition/__init__.py | 83 ++---- .../model/database/CharacterMacroses.java | 2 +- .../model/database/CharacterQuests.java | 41 ++- .../repository/CharacterQuestsRepository.java | 35 +++ .../l2jbr/gameserver/model/quest/Quest.java | 243 +++++------------- .../gameserver/network/L2GameClient.java | 8 +- .../accountmanager/SQLAccountManager.java | 12 +- 7 files changed, 164 insertions(+), 260 deletions(-) create mode 100644 Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/repository/CharacterQuestsRepository.java diff --git a/Datapack/data/jscript/quests/503_PursuitClanAmbition/__init__.py b/Datapack/data/jscript/quests/503_PursuitClanAmbition/__init__.py index f89e38f4..4b386d34 100644 --- a/Datapack/data/jscript/quests/503_PursuitClanAmbition/__init__.py +++ b/Datapack/data/jscript/quests/503_PursuitClanAmbition/__init__.py @@ -2,13 +2,16 @@ # questdevs Team import sys -from java.util import Iterator -from com.l2jbr.commons.util import Rnd -from com.l2jbr.gameserver.serverpackets import CreatureSay -from com.l2jbr.gameserver.model.quest import State -from com.l2jbr.gameserver.model.quest import QuestState -from com.l2jbr.gameserver.model.quest.jython import QuestJython as JQuest -from com.l2jbr.commons.database import L2DatabaseFactory +from java.util import Iterator +from com.l2jbr.commons.util import Rnd +from com.l2jbr.gameserver.serverpackets import CreatureSay +from com.l2jbr.gameserver.model.quest import State +from com.l2jbr.gameserver.model.quest import QuestState +from com.l2jbr.gameserver.model.quest.jython import QuestJython as JQuest +from com.l2jbr.commons.database import L2DatabaseFactory +from com.l2jbr.commons.database import DatabaseAccess +from com.l2jbr.gameserver.model.database.repository import CharacterQuestsRepository +from com.l2jbr.gameserver.model.database import CharacterQuests qn = "503_PursuitClanAmbition" qd = "Pursuit Clan Ambition" @@ -64,21 +67,13 @@ def suscribe_members(st) : clan=st.getPlayer().getClan().getClanId() con=L2DatabaseFactory.getInstance().getConnection() offline=con.prepareStatement("SELECT obj_Id FROM characters WHERE clanid=? AND online=0") + repository = DatabaseAccess.getRepository(CharacterQuestsRepository) offline.setInt(1, clan) rs=offline.executeQuery() while (rs.next()) : char_id=rs.getInt("obj_Id") - try : - insertion = con.prepareStatement("INSERT INTO character_quests (char_id,name,var,value) VALUES (?,?,?,?)") - insertion.setInt(1, char_id) - insertion.setString(2, qn) - insertion.setString(3, "") - insertion.setString(4, "Progress") - insertion.executeUpdate() - insertion.close(); - except : - try : insertion.close() - except : pass + characterQuest = CharacterQuests(char_id, qn, "", "Progress") + repository.save(characterQuest) try : con.close() except : @@ -86,17 +81,8 @@ def suscribe_members(st) : def offlineMemberExit(st) : clan=st.getPlayer().getClan().getClanId() - con=L2DatabaseFactory.getInstance().getConnection() - offline=con.prepareStatement("DELETE FROM character_quests WHERE name = ? and char_id IN (SELECT obj_id FROM characters WHERE clanId =? AND online=0") - offline.setString(1, qn) - offline.setInt(2, clan) - try : - offline.executeUpdate() - offline.close() - con.close() - except : - try : con.close() - except : pass + repository = DatabaseAccess.getRepository(CharacterQuestsRepository) + repository.deleteAllByOfflineClanMembers(qn, clan) # returns leaders quest cond, if he is offline will read out of database :) def getLeaderVar(st, var) : @@ -110,23 +96,11 @@ def getLeaderVar(st, var) : except : pass leaderId=st.getPlayer().getClan().getLeaderId() - con=L2DatabaseFactory.getInstance().getConnection() - offline=con.prepareStatement("SELECT value FROM character_quests WHERE char_id=? AND var=? AND name=?") - offline.setInt(1, leaderId) - offline.setString(2, var) - offline.setString(3, qn) - rs=offline.executeQuery() - if rs : - rs.next() - try : - val=rs.getInt("value") - con.close() - except : - val=-1 - try : con.close() - except : pass - else : - val=-1 + repository = DatabaseAccess.getRepository(CharacterQuestsRepository) + characterQuests = repository.findByNameAndVar(leaderId, qn, var); + val = -1 + for characterQuest in characterQuests: + val = characterQuest.getValue() return int(val) # set's leaders quest cond, if he is offline will read out of database :) @@ -140,19 +114,8 @@ def setLeaderVar(st, var, value) : leader.getQuestState(qn).set(var,value) else : leaderId=st.getPlayer().getClan().getLeaderId() - con=L2DatabaseFactory.getInstance().getConnection() - offline=con.prepareStatement("UPDATE character_quests SET value=? WHERE char_id=? AND var=? AND name=?") - offline.setString(1, value) - offline.setInt(2, leaderId) - offline.setString(3, var) - offline.setString(4, qn) - try : - offline.executeUpdate() - offline.close() - con.close() - except : - try : con.close() - except : pass + repository = DatabaseAccess.getRepository(CharacterQuestsRepository) + repository.updateQuestVar(leaderId, qn, var, value) return def checkEggs(st): @@ -224,7 +187,7 @@ def onEvent (self,event,st) : elif event == "30645-03.htm": st.takeItems(G_Let_Martien,-1) st.set("cond","2") - suscribe_members(st) + suscribe_members(st) try: members = st.getPlayer().getClan().getOnlineMembers("")[0] for i in members: diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/CharacterMacroses.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/CharacterMacroses.java index 0a07676c..81449005 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/CharacterMacroses.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/CharacterMacroses.java @@ -45,7 +45,7 @@ private void buildCommands(L2Macro macro) { @Override public Integer getId() { - return id; + return charObjId; } public int getIcon() { diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/CharacterQuests.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/CharacterQuests.java index e48dff43..2a227605 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/CharacterQuests.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/CharacterQuests.java @@ -1,12 +1,47 @@ package com.l2jbr.gameserver.model.database; +import com.l2jbr.commons.database.annotation.Column; +import com.l2jbr.commons.database.annotation.Table; +import com.l2jbr.commons.database.model.Entity; +import org.springframework.data.annotation.Id; +@Table("character_quests") +public class CharacterQuests extends Entity { -public class CharacterQuests { - private int char_id; + @Id + @Column("char_id") + private int charId; private String name; private String var; private String value; - private int class_index; + @Column("class_index") + private int classIndex; + public CharacterQuests(int objectId, String questName, String var, String value) { + this.charId = objectId; + this.name = questName; + this.var = var; + this.value = value; + } + + @Override + public Integer getId() { + return charId; + } + + public String getName() { + return name; + } + + public String getVar() { + return var; + } + + public String getValue() { + return value; + } + + public int getClassIndex() { + return classIndex; + } } diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/repository/CharacterQuestsRepository.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/repository/CharacterQuestsRepository.java new file mode 100644 index 00000000..8e1c1f60 --- /dev/null +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/repository/CharacterQuestsRepository.java @@ -0,0 +1,35 @@ +package com.l2jbr.gameserver.model.database.repository; + +import com.l2jbr.gameserver.model.database.CharacterQuests; +import org.springframework.data.jdbc.repository.query.Modifying; +import org.springframework.data.jdbc.repository.query.Query; +import org.springframework.data.repository.CrudRepository; +import org.springframework.data.repository.query.Param; + +public interface CharacterQuestsRepository extends CrudRepository { + + @Query("SELECT * FROM character_quests WHERE char_id=:objectId AND var=") + Iterable findAllByState(@Param("objectId") int charObjectId); + + @Modifying + @Query("DELETE FROM character_quests WHERE char_id=:objectId and name=:questName") + int deleteByName(@Param("objectId") int charObjectId, @Param("name") String questName); + + @Query("SELECT * FROM character_quests WHERE char_id=:objectId") + Iterable findAllByCharacter(@Param("objectId") int charObjectId); + + @Modifying + @Query("DELETE FROM character_quests WHERE char_id=:objectId AND name=:name AND var=:var") + int deleteByNameAndVar(@Param("objectId") int charObjectId, @Param("name") String questName, @Param("var") String var); + + @Modifying + @Query("UPDATE character_quests SET value=:value WHERE char_id=:objectId AND name=:name AND var=:var") + int updateQuestVar(@Param("objectId") int charObjectId, @Param("name") String questName, @Param("var") String var, @Param("value") String value); + + @Modifying + @Query("DELETE FROM character_quests WHERE name=:name and char_id IN (SELECT obj_id FROM characters WHERE clanId=:clan AND online=0") + int deleteAllByOfflineClanMembers(@Param("name") String questName, @Param("clan") int clanId); + + @Query("SELECT * FROM character_quests WHERE char_id=? AND var=? AND name=?") + Iterable findByNameAndVar(@Param("char") int charObjectId, @Param("name") String questName, @Param("var") String var); +} diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/quest/Quest.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/quest/Quest.java index 98cf33f7..13d6e677 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/quest/Quest.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/quest/Quest.java @@ -19,6 +19,7 @@ package com.l2jbr.gameserver.model.quest; import com.l2jbr.commons.Config; +import com.l2jbr.commons.database.DatabaseAccess; import com.l2jbr.commons.database.L2DatabaseFactory; import com.l2jbr.commons.util.Rnd; import com.l2jbr.gameserver.ThreadPoolManager; @@ -28,10 +29,13 @@ import com.l2jbr.gameserver.model.*; import com.l2jbr.gameserver.model.actor.instance.L2NpcInstance; import com.l2jbr.gameserver.model.actor.instance.L2PcInstance; +import com.l2jbr.gameserver.model.database.CharacterQuests; +import com.l2jbr.gameserver.model.database.repository.CharacterQuestsRepository; import com.l2jbr.gameserver.network.SystemMessageId; import com.l2jbr.gameserver.serverpackets.NpcHtmlMessage; import com.l2jbr.gameserver.serverpackets.SystemMessage; import com.l2jbr.gameserver.templates.L2NpcTemplate; +import org.python.bouncycastle.asn1.dvcs.Data; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -461,99 +465,62 @@ private boolean showResult(L2PcInstance player, String res) { * @param player : Player who is entering the world */ public final static void playerEnter(L2PcInstance player) { + // Get list of quests owned by the player from database - java.sql.Connection con = null; - try { - // Get list of quests owned by the player from database - con = L2DatabaseFactory.getInstance().getConnection(); - PreparedStatement statement; - - PreparedStatement invalidQuestData = con.prepareStatement("DELETE FROM character_quests WHERE char_id=? and name=?"); - PreparedStatement invalidQuestDataVar = con.prepareStatement("delete FROM character_quests WHERE char_id=? and name=? and var=?"); + CharacterQuestsRepository repository = DatabaseAccess.getRepository(CharacterQuestsRepository.class); + repository.findAllByState(player.getObjectId()).forEach(characterQuest -> { - statement = con.prepareStatement("SELECT name,value FROM character_quests WHERE char_id=? AND var=?"); - statement.setInt(1, player.getObjectId()); - statement.setString(2, ""); - ResultSet rs = statement.executeQuery(); - while (rs.next()) { - - // Get ID of the quest and ID of its state - String questId = rs.getString("name"); - String stateId = rs.getString("value"); - - // Search quest associated with the ID - Quest q = QuestManager.getInstance().getQuest(questId); - if (q == null) { - _log.debug("Unknown quest " + questId + " for player " + player.getName()); - if (Config.AUTODELETE_INVALID_QUEST_DATA) { - invalidQuestData.setInt(1, player.getObjectId()); - invalidQuestData.setString(2, questId); - invalidQuestData.executeUpdate(); - } - continue; - } + // Get ID of the quest and ID of its state + String questId = characterQuest.getName(); + String stateId = characterQuest.getValue(); - // Identify the state of the quest for the player - boolean completed = false; - if (stateId.equals("Completed")) { - completed = true; + // Search quest associated with the ID + Quest q = QuestManager.getInstance().getQuest(questId); + if (q == null) { + _log.warn("Unknown quest {} for player {}", questId, player.getName()); + if (Config.AUTODELETE_INVALID_QUEST_DATA) { + repository.deleteByName(player.getObjectId(), questId); } + return; + } - // Create an object State containing the state of the quest - State state = q._states.get(stateId); - if (state == null) { - _log.debug("Unknown state in quest " + questId + " for player " + player.getName()); - if (Config.AUTODELETE_INVALID_QUEST_DATA) { - invalidQuestData.setInt(1, player.getObjectId()); - invalidQuestData.setString(2, questId); - invalidQuestData.executeUpdate(); - } - continue; - } - // Create a new QuestState for the player that will be added to the player's list of quests - new QuestState(q, player, state, completed); + // Identify the state of the quest for the player + boolean completed = false; + if (stateId.equals("Completed")) { + completed = true; } - rs.close(); - invalidQuestData.close(); - statement.close(); - // Get list of quests owned by the player from the DB in order to add variables used in the quest. - statement = con.prepareStatement("SELECT name,var,value FROM character_quests WHERE char_id=?"); - statement.setInt(1, player.getObjectId()); - rs = statement.executeQuery(); - while (rs.next()) { - String questId = rs.getString("name"); - String var = rs.getString("var"); - String value = rs.getString("value"); - // Get the QuestState saved in the loop before - QuestState qs = player.getQuestState(questId); - if (qs == null) { - _log.debug("Lost variable " + var + " in quest " + questId + " for player " + player.getName()); - if (Config.AUTODELETE_INVALID_QUEST_DATA) { - invalidQuestDataVar.setInt(1, player.getObjectId()); - invalidQuestDataVar.setString(2, questId); - invalidQuestDataVar.setString(3, var); - invalidQuestDataVar.executeUpdate(); - } - continue; + // Create an object State containing the state of the quest + State state = q._states.get(stateId); + if (state == null) { + _log.warn("Unknown state in quest {} for player {}", questId, player.getName()); + if (Config.AUTODELETE_INVALID_QUEST_DATA) { + repository.deleteByName(player.getObjectId(), questId); } - // Add parameter to the quest - qs.setInternal(var, value); + return; } - rs.close(); - invalidQuestDataVar.close(); - statement.close(); - - } catch (Exception e) { - _log.warn( "could not insert char quest:", e); - } finally { - try { - con.close(); - } catch (Exception e) { + // Create a new QuestState for the player that will be added to the player's list of quests + new QuestState(q, player, state, completed); + + }); + + + repository.findAllByCharacter(player.getObjectId()).forEach(characterQuest -> { + String questId = characterQuest.getName(); + String var = characterQuest.getVar(); + String value = characterQuest.getValue(); + // Get the QuestState saved in the loop before + QuestState qs = player.getQuestState(questId); + if (qs == null) { + _log.warn("Lost variable {} in quest {} for player {}", var, questId, player.getName()); + if (Config.AUTODELETE_INVALID_QUEST_DATA) { + repository.deleteByNameAndVar(player.getObjectId(), questId, var); + } + return; } - } + qs.setInternal(var, value); + }); - // events for (String name : _allEventsS.keySet()) { player.processQuestEvent(name, "enter"); } @@ -667,119 +634,25 @@ public final void deleteAllGlobalQuestVars() { } } - /** - * Insert in the database the quest for the player. - * - * @param qs : QuestState pointing out the state of the quest - * @param var : String designating the name of the variable for the quest - * @param value : String designating the value of the variable for the quest - */ public static void createQuestVarInDb(QuestState qs, String var, String value) { - java.sql.Connection con = null; - try { - con = L2DatabaseFactory.getInstance().getConnection(); - PreparedStatement statement; - statement = con.prepareStatement("INSERT INTO character_quests (char_id,name,var,value) VALUES (?,?,?,?)"); - statement.setInt(1, qs.getPlayer().getObjectId()); - statement.setString(2, qs.getQuestName()); - statement.setString(3, var); - statement.setString(4, value); - statement.executeUpdate(); - statement.close(); - } catch (Exception e) { - _log.warn( "could not insert char quest:", e); - } finally { - try { - con.close(); - } catch (Exception e) { - } - } + CharacterQuests characterQuests = new CharacterQuests(qs.getPlayer().getObjectId(), qs.getQuestName(), var, value); + CharacterQuestsRepository repository = DatabaseAccess.getRepository(CharacterQuestsRepository.class); + repository.save(characterQuests); } - /** - * Update the value of the variable "var" for the quest.
- *
- * Actions :
- * The selection of the right record is made with :

  • char_id = qs.getPlayer().getObjectID()
  • name = qs.getQuest().getName()
  • var = var

  • - *
    - * The modification made is :
  • value = parameter value
  • - * - * @param qs : Quest State - * @param var : String designating the name of the variable for quest - * @param value : String designating the value of the variable for quest - */ public static void updateQuestVarInDb(QuestState qs, String var, String value) { - java.sql.Connection con = null; - try { - con = L2DatabaseFactory.getInstance().getConnection(); - PreparedStatement statement; - statement = con.prepareStatement("UPDATE character_quests SET value=? WHERE char_id=? AND name=? AND var = ?"); - statement.setString(1, value); - statement.setInt(2, qs.getPlayer().getObjectId()); - statement.setString(3, qs.getQuestName()); - statement.setString(4, var); - statement.executeUpdate(); - statement.close(); - } catch (Exception e) { - _log.warn( "could not update char quest:", e); - } finally { - try { - con.close(); - } catch (Exception e) { - } - } + CharacterQuestsRepository repository = DatabaseAccess.getRepository(CharacterQuestsRepository.class); + repository.updateQuestVar(qs.getPlayer().getObjectId(), qs.getQuestName(), var, value); } - /** - * Delete a variable of player's quest from the database. - * - * @param qs : object QuestState pointing out the player's quest - * @param var : String designating the variable characterizing the quest - */ public static void deleteQuestVarInDb(QuestState qs, String var) { - java.sql.Connection con = null; - try { - con = L2DatabaseFactory.getInstance().getConnection(); - PreparedStatement statement; - statement = con.prepareStatement("DELETE FROM character_quests WHERE char_id=? AND name=? AND var=?"); - statement.setInt(1, qs.getPlayer().getObjectId()); - statement.setString(2, qs.getQuestName()); - statement.setString(3, var); - statement.executeUpdate(); - statement.close(); - } catch (Exception e) { - _log.warn( "could not delete char quest:", e); - } finally { - try { - con.close(); - } catch (Exception e) { - } - } + CharacterQuestsRepository repository = DatabaseAccess.getRepository(CharacterQuestsRepository.class); + repository.deleteByNameAndVar(qs.getPlayer().getObjectId(), qs.getQuestName(), var); } - /** - * Delete the player's quest from database. - * - * @param qs : QuestState pointing out the player's quest - */ public static void deleteQuestInDb(QuestState qs) { - java.sql.Connection con = null; - try { - con = L2DatabaseFactory.getInstance().getConnection(); - PreparedStatement statement; - statement = con.prepareStatement("DELETE FROM character_quests WHERE char_id=? AND name=?"); - statement.setInt(1, qs.getPlayer().getObjectId()); - statement.setString(2, qs.getQuestName()); - statement.executeUpdate(); - statement.close(); - } catch (Exception e) { - _log.warn( "could not delete char quest:", e); - } finally { - try { - con.close(); - } catch (Exception e) { - } - } + CharacterQuestsRepository repository = DatabaseAccess.getRepository(CharacterQuestsRepository.class); + repository.deleteByName(qs.getPlayer().getObjectId(), qs.getQuestName()); } /** diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/network/L2GameClient.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/network/L2GameClient.java index 8f38dd9f..5cb2d139 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/network/L2GameClient.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/network/L2GameClient.java @@ -28,6 +28,8 @@ import com.l2jbr.gameserver.model.CharSelectInfoPackage; import com.l2jbr.gameserver.model.L2World; import com.l2jbr.gameserver.model.actor.instance.L2PcInstance; +import com.l2jbr.gameserver.model.database.Character; +import com.l2jbr.gameserver.model.database.CharacterQuests; import com.l2jbr.gameserver.model.database.repository.*; import com.l2jbr.gameserver.model.entity.L2Event; import com.l2jbr.gameserver.serverpackets.L2GameServerPacket; @@ -255,10 +257,8 @@ public static void deleteCharByObjId(int objId) { CharacterMacrosesRepository characterMacrosesRepository = DatabaseAccess.getRepository(CharacterMacrosesRepository.class); characterMacrosesRepository.deleteById(objId); - statement = con.prepareStatement("DELETE FROM character_quests WHERE char_id=?"); - statement.setInt(1, objId); - statement.execute(); - statement.close(); + CharacterQuestsRepository characterQuestsRepository = DatabaseAccess.getRepository(CharacterQuestsRepository.class); + characterQuestsRepository.deleteById(objId); statement = con.prepareStatement("DELETE FROM character_recipebook WHERE char_id=?"); statement.setInt(1, objId); diff --git a/Tools/src/main/com.l2jbr.tools/com/l2jbr/tools/accountmanager/SQLAccountManager.java b/Tools/src/main/com.l2jbr.tools/com/l2jbr/tools/accountmanager/SQLAccountManager.java index a34ce18b..0a062057 100644 --- a/Tools/src/main/com.l2jbr.tools/com/l2jbr/tools/accountmanager/SQLAccountManager.java +++ b/Tools/src/main/com.l2jbr.tools/com/l2jbr/tools/accountmanager/SQLAccountManager.java @@ -25,10 +25,8 @@ import com.l2jbr.commons.database.DatabaseAccess; import com.l2jbr.commons.database.L2DatabaseFactory; import com.l2jbr.commons.database.model.Account; -import com.l2jbr.gameserver.model.database.repository.CharacterFriendRepository; -import com.l2jbr.gameserver.model.database.repository.CharacterMacrosesRepository; -import com.l2jbr.gameserver.model.database.repository.CharacterRepository; -import com.l2jbr.gameserver.model.database.repository.ClanRepository; +import com.l2jbr.gameserver.model.database.CharacterQuests; +import com.l2jbr.gameserver.model.database.repository.*; import java.io.IOException; import java.io.InputStreamReader; @@ -219,9 +217,9 @@ private static void deleteAccount(String login) throws SQLException { // quests statement.close(); - statement = con.prepareStatement("DELETE FROM character_quests WHERE char_id=?;"); - statement.setInt(1, character.getObjectId()); - statement.executeUpdate(); + + CharacterQuestsRepository characterQuestsRepository = DatabaseAccess.getRepository(CharacterQuestsRepository.class); + characterQuestsRepository.deleteById(character.getObjectId()); CharacterMacrosesRepository characterMacrosesRepository = DatabaseAccess.getRepository(CharacterMacrosesRepository.class); characterMacrosesRepository.deleteById(character.getObjectId()); From 1a1ef654d622b63d3f5b337806b8cf425cd9fdc3 Mon Sep 17 00:00:00 2001 From: Alisson Oliveira Date: Mon, 30 Apr 2018 20:20:56 -0300 Subject: [PATCH 041/236] =?UTF-8?q?Remove=20refer=C3=AAncias=20diretas=20?= =?UTF-8?q?=C3=A0=20tabela=20character=5Frecipebook?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../model/actor/instance/L2PcInstance.java | 83 +++++-------------- .../model/database/CharacterRecipeBook.java | 24 +++++- .../CharacterRecipebookRepository.java | 15 ++++ .../gameserver/network/L2GameClient.java | 6 +- .../accountmanager/SQLAccountManager.java | 11 +-- 5 files changed, 63 insertions(+), 76 deletions(-) create mode 100644 Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/repository/CharacterRecipebookRepository.java diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/actor/instance/L2PcInstance.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/actor/instance/L2PcInstance.java index 484adaec..49dc6bc9 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/actor/instance/L2PcInstance.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/actor/instance/L2PcInstance.java @@ -49,7 +49,9 @@ import com.l2jbr.gameserver.model.base.*; import com.l2jbr.gameserver.model.database.Character; import com.l2jbr.gameserver.model.database.CharacterHennas; +import com.l2jbr.gameserver.model.database.CharacterRecipeBook; import com.l2jbr.gameserver.model.database.repository.CharacterHennasRepository; +import com.l2jbr.gameserver.model.database.repository.CharacterRecipebookRepository; import com.l2jbr.gameserver.model.database.repository.CharacterRepository; import com.l2jbr.gameserver.model.entity.*; import com.l2jbr.gameserver.model.quest.Quest; @@ -63,6 +65,7 @@ import com.l2jbr.gameserver.util.Broadcast; import com.l2jbr.gameserver.util.FloodProtector; import com.l2jbr.gameserver.util.Point3D; +import org.python.bouncycastle.asn1.dvcs.Data; import java.sql.PreparedStatement; import java.sql.ResultSet; @@ -6586,76 +6589,34 @@ private void storeRecipeBook() { return; } - java.sql.Connection con = null; - - try { - con = L2DatabaseFactory.getInstance().getConnection(); - PreparedStatement statement = con.prepareStatement("DELETE FROM character_recipebook WHERE char_id=?"); - statement.setInt(1, getObjectId()); - statement.execute(); - statement.close(); + CharacterRecipebookRepository repository = DatabaseAccess.getRepository(CharacterRecipebookRepository.class); + repository.deleteAllByCharacter(getObjectId()); - L2RecipeList[] recipes = getCommonRecipeBook(); + L2RecipeList[] recipes = getCommonRecipeBook(); - for (L2RecipeList recipe : recipes) { - statement = con.prepareStatement("INSERT INTO character_recipebook (char_id, id, type) values(?,?,0)"); - statement.setInt(1, getObjectId()); - statement.setInt(2, recipe.getId()); - statement.execute(); - statement.close(); - } + for (L2RecipeList recipe : recipes) { + CharacterRecipeBook recipeBook = new CharacterRecipeBook(getObjectId(), recipe.getId(), 0); + repository.save(recipeBook); + } - recipes = getDwarvenRecipeBook(); - for (L2RecipeList recipe : recipes) { - statement = con.prepareStatement("INSERT INTO character_recipebook (char_id, id, type) values(?,?,1)"); - statement.setInt(1, getObjectId()); - statement.setInt(2, recipe.getId()); - statement.execute(); - statement.close(); - } - } catch (Exception e) { - _log.warn("Could not store recipe book data: " + e); - } finally { - try { - con.close(); - } catch (Exception e) { - } + recipes = getDwarvenRecipeBook(); + for (L2RecipeList recipe : recipes) { + CharacterRecipeBook recipeBook = new CharacterRecipeBook(getObjectId(), recipe.getId(), 1); } + } - /** - * Restore recipe book data for this L2PcInstance. - */ private void restoreRecipeBook() { - java.sql.Connection con = null; - - try { - con = L2DatabaseFactory.getInstance().getConnection(); - PreparedStatement statement = con.prepareStatement("SELECT id, type FROM character_recipebook WHERE char_id=?"); - statement.setInt(1, getObjectId()); - ResultSet rset = statement.executeQuery(); - - L2RecipeList recipe; - while (rset.next()) { - recipe = RecipeController.getInstance().getRecipeList(rset.getInt("id") - 1); + CharacterRecipebookRepository repository = DatabaseAccess.getRepository(CharacterRecipebookRepository.class); + repository.findAllByCharacter(getObjectId()).forEach(recipeBook -> { + L2RecipeList recipe = RecipeController.getInstance().getRecipeList(recipeBook.getId() - 1); - if (rset.getInt("type") == 1) { - registerDwarvenRecipeList(recipe); - } else { - registerCommonRecipeList(recipe); - } - } - - rset.close(); - statement.close(); - } catch (Exception e) { - _log.warn("Could not restore recipe book data:" + e); - } finally { - try { - con.close(); - } catch (Exception e) { + if (recipeBook.getType() == 1) { + registerDwarvenRecipeList(recipe); + } else { + registerCommonRecipeList(recipe); } - } + }); } /** diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/CharacterRecipeBook.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/CharacterRecipeBook.java index bf9e8b2c..0028e83d 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/CharacterRecipeBook.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/CharacterRecipeBook.java @@ -1,10 +1,30 @@ package com.l2jbr.gameserver.model.database; +import com.l2jbr.commons.database.annotation.Column; +import com.l2jbr.commons.database.annotation.Table; +import com.l2jbr.commons.database.model.Entity; +@Table("character_recipebook") +public class CharacterRecipeBook extends Entity { -public class CharacterRecipeBook { - private int char_id; + @Column("char_id") + private int charId; private int id; private int type; + + public CharacterRecipeBook(int objectId, int id, int type) { + this.charId = objectId; + this.id = id; + this.type = type; + } + + @Override + public Integer getId() { + return id; + } + + public int getType() { + return type; + } } diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/repository/CharacterRecipebookRepository.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/repository/CharacterRecipebookRepository.java new file mode 100644 index 00000000..c0dfd15e --- /dev/null +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/repository/CharacterRecipebookRepository.java @@ -0,0 +1,15 @@ +package com.l2jbr.gameserver.model.database.repository; + +import com.l2jbr.gameserver.model.database.CharacterRecipeBook; +import org.springframework.data.jdbc.repository.query.Query; +import org.springframework.data.repository.CrudRepository; +import org.springframework.data.repository.query.Param; + +public interface CharacterRecipebookRepository extends CrudRepository { + + @Query("DELETE FROM character_recipebook WHERE char_id=:char") + int deleteAllByCharacter(@Param("char") int charObjectId); + + @Query("SELECT * FROM character_recipebook WHERE char_id=:char") + Iterable findAllByCharacter(@Param("char") int characterObjectId); +} diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/network/L2GameClient.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/network/L2GameClient.java index 5cb2d139..8e6f3816 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/network/L2GameClient.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/network/L2GameClient.java @@ -260,10 +260,8 @@ public static void deleteCharByObjId(int objId) { CharacterQuestsRepository characterQuestsRepository = DatabaseAccess.getRepository(CharacterQuestsRepository.class); characterQuestsRepository.deleteById(objId); - statement = con.prepareStatement("DELETE FROM character_recipebook WHERE char_id=?"); - statement.setInt(1, objId); - statement.execute(); - statement.close(); + CharacterRecipebookRepository recipebookRepository = DatabaseAccess.getRepository(CharacterRecipebookRepository.class); + recipebookRepository.deleteAllByCharacter(objId); statement = con.prepareStatement("DELETE FROM character_shortcuts WHERE char_obj_id=?"); statement.setInt(1, objId); diff --git a/Tools/src/main/com.l2jbr.tools/com/l2jbr/tools/accountmanager/SQLAccountManager.java b/Tools/src/main/com.l2jbr.tools/com/l2jbr/tools/accountmanager/SQLAccountManager.java index 0a062057..99d7efb7 100644 --- a/Tools/src/main/com.l2jbr.tools/com/l2jbr/tools/accountmanager/SQLAccountManager.java +++ b/Tools/src/main/com.l2jbr.tools/com/l2jbr/tools/accountmanager/SQLAccountManager.java @@ -209,14 +209,8 @@ private static void deleteAccount(String login) throws SQLException { statement.setInt(1, character.getObjectId()); statement.executeUpdate(); - // recipebook - statement.close(); - statement = con.prepareStatement("DELETE FROM character_recipebook WHERE char_id=?;"); - statement.setInt(1, character.getObjectId()); - statement.executeUpdate(); - - // quests - statement.close(); + CharacterRecipebookRepository recipebookRepository = DatabaseAccess.getRepository(CharacterRecipebookRepository.class); + recipebookRepository.deleteAllByCharacter(character.getObjectId()); CharacterQuestsRepository characterQuestsRepository = DatabaseAccess.getRepository(CharacterQuestsRepository.class); characterQuestsRepository.deleteById(character.getObjectId()); @@ -224,7 +218,6 @@ private static void deleteAccount(String login) throws SQLException { CharacterMacrosesRepository characterMacrosesRepository = DatabaseAccess.getRepository(CharacterMacrosesRepository.class); characterMacrosesRepository.deleteById(character.getObjectId()); - CharacterFriendRepository characterFriendRepository = DatabaseAccess.getRepository(CharacterFriendRepository.class); characterFriendRepository.deleteById(character.getObjectId()); From 201a7e9c50ab3e2e98ad998a9c878a59ab13ed26 Mon Sep 17 00:00:00 2001 From: Alisson Oliveira Date: Mon, 30 Apr 2018 21:26:18 -0300 Subject: [PATCH 042/236] =?UTF-8?q?Remove=20refer=C3=AAncias=20diretas=20?= =?UTF-8?q?=C3=A0=20tabela=20character=5Frecommends?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../model/actor/instance/L2PcInstance.java | 80 ++++--------------- .../model/database/CharacterRecommends.java | 28 ++++++- .../CharacterRecommendsRepository.java | 12 +++ 3 files changed, 52 insertions(+), 68 deletions(-) create mode 100644 Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/repository/CharacterRecommendsRepository.java diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/actor/instance/L2PcInstance.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/actor/instance/L2PcInstance.java index 49dc6bc9..cc16bc38 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/actor/instance/L2PcInstance.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/actor/instance/L2PcInstance.java @@ -50,8 +50,10 @@ import com.l2jbr.gameserver.model.database.Character; import com.l2jbr.gameserver.model.database.CharacterHennas; import com.l2jbr.gameserver.model.database.CharacterRecipeBook; +import com.l2jbr.gameserver.model.database.CharacterRecommends; import com.l2jbr.gameserver.model.database.repository.CharacterHennasRepository; import com.l2jbr.gameserver.model.database.repository.CharacterRecipebookRepository; +import com.l2jbr.gameserver.model.database.repository.CharacterRecommendsRepository; import com.l2jbr.gameserver.model.database.repository.CharacterRepository; import com.l2jbr.gameserver.model.entity.*; import com.l2jbr.gameserver.model.quest.Quest; @@ -95,9 +97,7 @@ public final class L2PcInstance extends L2PlayableInstance { private static final String UPDATE_CHAR_SUBCLASS = "UPDATE character_subclasses SET exp=?,sp=?,level=?,class_id=? WHERE char_obj_id=? AND class_index =?"; private static final String DELETE_CHAR_SUBCLASS = "DELETE FROM character_subclasses WHERE char_obj_id=? AND class_index=?"; private static final String DELETE_CHAR_SHORTCUTS = "DELETE FROM character_shortcuts WHERE char_obj_id=? AND class_index=?"; - private static final String RESTORE_CHAR_RECOMS = "SELECT char_id,target_id FROM character_recommends WHERE char_id=?"; - private static final String ADD_CHAR_RECOM = "INSERT INTO character_recommends (char_id,target_id) VALUES (?,?)"; - private static final String DELETE_CHAR_RECOMS = "DELETE FROM character_recommends WHERE char_id=?"; + public static final int REQUEST_TIMEOUT = 15; public static final int STORE_PRIVATE_NONE = 0; @@ -2245,29 +2245,11 @@ protected void decRecomLeft() { } } - /** - * Give recom. - * - * @param target the target - */ public void giveRecom(L2PcInstance target) { if (Config.ALT_RECOMMEND) { - java.sql.Connection con = null; - try { - con = L2DatabaseFactory.getInstance().getConnection(); - PreparedStatement statement = con.prepareStatement(ADD_CHAR_RECOM); - statement.setInt(1, getObjectId()); - statement.setInt(2, target.getObjectId()); - statement.execute(); - statement.close(); - } catch (Exception e) { - _log.warn("could not update char recommendations:" + e); - } finally { - try { - con.close(); - } catch (Exception e) { - } - } + CharacterRecommends recommend = new CharacterRecommends(getObjectId(), target.getObjectId()); + CharacterRecommendsRepository repository = DatabaseAccess.getRepository(CharacterRecommendsRepository.class); + repository.save(recommend); } target.incRecomHave(); decRecomLeft(); @@ -7175,30 +7157,15 @@ private void restoreHenna() { } /** - * Retrieve from the database all Recommendation data of this L2PcInstance, add to _recomChars and calculate stats of the L2PcInstance. + * Retrieve from the database all Recommendation data of this L2PcInstance, + * add to _recomChars and calculate stats of the L2PcInstance. */ private void restoreRecom() { java.sql.Connection con = null; - - try { - con = L2DatabaseFactory.getInstance().getConnection(); - PreparedStatement statement = con.prepareStatement(RESTORE_CHAR_RECOMS); - statement.setInt(1, getObjectId()); - ResultSet rset = statement.executeQuery(); - while (rset.next()) { - _recomChars.add(rset.getInt("target_id")); - } - - rset.close(); - statement.close(); - } catch (Exception e) { - _log.warn("could not restore recommendations: " + e); - } finally { - try { - con.close(); - } catch (Exception e) { - } - } + CharacterRecommendsRepository repository = DatabaseAccess.getRepository(CharacterRecommendsRepository.class); + repository.findAllByCharacter(getObjectId()).forEach(recommend -> { + _recomChars.add(recommend.getTargetId()); + }); } /** @@ -9739,28 +9706,11 @@ private void checkRecom(int recsHave, int recsLeft) { restartRecom(); } - /** - * Restart recom. - */ + public void restartRecom() { if (Config.ALT_RECOMMEND) { - java.sql.Connection con = null; - try { - con = L2DatabaseFactory.getInstance().getConnection(); - PreparedStatement statement = con.prepareStatement(DELETE_CHAR_RECOMS); - statement.setInt(1, getObjectId()); - statement.execute(); - statement.close(); - - _recomChars.clear(); - } catch (Exception e) { - _log.warn("could not clear char recommendations: " + e); - } finally { - try { - con.close(); - } catch (Exception e) { - } - } + CharacterRecommendsRepository repository = DatabaseAccess.getRepository(CharacterRecommendsRepository.class); + repository.deleteById(getObjectId()); } if (getStat().getLevel() < 20) { diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/CharacterRecommends.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/CharacterRecommends.java index bf4a112b..288d176f 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/CharacterRecommends.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/CharacterRecommends.java @@ -1,8 +1,30 @@ package com.l2jbr.gameserver.model.database; +import com.l2jbr.commons.database.annotation.Column; +import com.l2jbr.commons.database.annotation.Table; +import com.l2jbr.commons.database.model.Entity; +import org.springframework.data.annotation.Id; +@Table("character_recommends") +public class CharacterRecommends extends Entity { -public class CharacterRecommends { - private int char_id; - private int target_id; + @Id + @Column("char_id") + private int charId; + @Column("target_id") + private int targetId; + + public CharacterRecommends(int charId, int targetId) { + this.charId = charId; + this.targetId = targetId; + } + + @Override + public Integer getId() { + return charId; + } + + public int getTargetId() { + return targetId; + } } diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/repository/CharacterRecommendsRepository.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/repository/CharacterRecommendsRepository.java new file mode 100644 index 00000000..25f6a7f6 --- /dev/null +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/repository/CharacterRecommendsRepository.java @@ -0,0 +1,12 @@ +package com.l2jbr.gameserver.model.database.repository; + +import com.l2jbr.gameserver.model.database.CharacterRecommends; +import org.springframework.data.jdbc.repository.query.Query; +import org.springframework.data.repository.CrudRepository; +import org.springframework.data.repository.query.Param; + +public interface CharacterRecommendsRepository extends CrudRepository { + + @Query("SELECT * FROM character_recommends WHERE char_id=:char") + Iterable findAllByCharacter(@Param("char") int characterObjectId); +} From 4f4eb593e5ae3bd3b150907e047b0bb1e32c19a3 Mon Sep 17 00:00:00 2001 From: Alisson Oliveira Date: Mon, 30 Apr 2018 23:48:14 -0300 Subject: [PATCH 043/236] =?UTF-8?q?Remove=20refer=C3=AAncias=20diretas=20?= =?UTF-8?q?=C3=A0=20tabela=20character=5Fshortcuts?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../admincommandhandlers/AdminRepairChar.java | 16 +-- .../com/l2jbr/gameserver/model/ShortCuts.java | 135 ++++-------------- .../model/actor/instance/L2PcInstance.java | 20 +-- .../model/database/CharacterShortcuts.java | 48 ++++++- .../CharacterShortcutsRepository.java | 27 ++++ .../gameserver/network/L2GameClient.java | 6 +- .../accountmanager/SQLAccountManager.java | 7 +- 7 files changed, 112 insertions(+), 147 deletions(-) create mode 100644 Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/repository/CharacterShortcutsRepository.java diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/handler/admincommandhandlers/AdminRepairChar.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/handler/admincommandhandlers/AdminRepairChar.java index 6abeebe9..962ccd39 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/handler/admincommandhandlers/AdminRepairChar.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/handler/admincommandhandlers/AdminRepairChar.java @@ -26,6 +26,7 @@ import com.l2jbr.gameserver.model.actor.instance.L2PcInstance; import com.l2jbr.gameserver.model.database.Character; import com.l2jbr.gameserver.model.database.repository.CharacterRepository; +import com.l2jbr.gameserver.model.database.repository.CharacterShortcutsRepository; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -86,18 +87,17 @@ private void handleRepair(String command) { return; } - CharacterRepository repository = DatabaseAccess.getRepository(CharacterRepository.class); - Optional optionalCharacter = repository.findByCharName(parts[1]); + CharacterRepository characterRepository = DatabaseAccess.getRepository(CharacterRepository.class); + Optional optionalCharacter = characterRepository.findByCharName(parts[1]); optionalCharacter.ifPresent(character -> { character.updateLocation(-84318, 244579, -3730); PreparedStatement statement = null; - try(Connection connection = L2DatabaseFactory.getInstance().getConnection();){ - statement = connection.prepareStatement("DELETE FROM character_shortcuts WHERE char_obj_id=?"); - statement.setInt(1, character.getId()); - statement.execute(); - statement.close(); + CharacterShortcutsRepository shortcutsRepository = DatabaseAccess.getRepository(CharacterShortcutsRepository.class); + shortcutsRepository.deleteById(character.getObjectId()); + + try(Connection connection = L2DatabaseFactory.getInstance().getConnection();){ statement = connection.prepareStatement("UPDATE items SET loc=\"INVENTORY\" WHERE owner_id=?"); statement.setInt(1, character.getId()); statement.execute(); @@ -111,7 +111,7 @@ private void handleRepair(String command) { } catch (SQLException e) { } } - repository.save(character); + characterRepository.save(character); }); } diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/ShortCuts.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/ShortCuts.java index e1b11dd7..d222bc8f 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/ShortCuts.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/ShortCuts.java @@ -18,8 +18,10 @@ */ package com.l2jbr.gameserver.model; +import com.l2jbr.commons.database.DatabaseAccess; import com.l2jbr.commons.database.L2DatabaseFactory; import com.l2jbr.gameserver.model.actor.instance.L2PcInstance; +import com.l2jbr.gameserver.model.database.repository.CharacterShortcutsRepository; import com.l2jbr.gameserver.serverpackets.ExAutoSoulShot; import com.l2jbr.gameserver.serverpackets.ShortCutInit; import com.l2jbr.gameserver.templates.L2EtcItemType; @@ -76,44 +78,14 @@ public synchronized void registerShortCut(L2ShortCut shortcut) registerShortCutInDb(shortcut, oldShortCut); } - private void registerShortCutInDb(L2ShortCut shortcut, L2ShortCut oldShortCut) - { - if (oldShortCut != null) - { + private void registerShortCutInDb(L2ShortCut shortcut, L2ShortCut oldShortCut) { + if (oldShortCut != null) { deleteShortCutFromDb(oldShortCut); } - - java.sql.Connection con = null; - - try - { - con = L2DatabaseFactory.getInstance().getConnection(); - - PreparedStatement statement = con.prepareStatement("REPLACE INTO character_shortcuts (char_obj_id,slot,page,type,shortcut_id,level,class_index) values(?,?,?,?,?,?,?)"); - statement.setInt(1, _owner.getObjectId()); - statement.setInt(2, shortcut.getSlot()); - statement.setInt(3, shortcut.getPage()); - statement.setInt(4, shortcut.getType()); - statement.setInt(5, shortcut.getId()); - statement.setInt(6, shortcut.getLevel()); - statement.setInt(7, _owner.getClassIndex()); - statement.execute(); - statement.close(); - } - catch (Exception e) - { - _log.warn("Could not store character shortcut: " + e); - } - finally - { - try - { - con.close(); - } - catch (Exception e) - { - } - } + + CharacterShortcutsRepository repository = DatabaseAccess.getRepository(CharacterShortcutsRepository.class); + repository.saveOrUpdate(_owner.getObjectId(), shortcut.getId(), shortcut.getSlot(), shortcut.getPage(), shortcut.getType(), + shortcut.getLevel(), _owner.getClassIndex()); } /** @@ -166,86 +138,27 @@ public synchronized void deleteShortCutByObjectId(int objectId) deleteShortCut(toRemove.getSlot(), toRemove.getPage()); } } - - /** - * @param shortcut - */ - private void deleteShortCutFromDb(L2ShortCut shortcut) - { - java.sql.Connection con = null; - - try - { - con = L2DatabaseFactory.getInstance().getConnection(); - - PreparedStatement statement = con.prepareStatement("DELETE FROM character_shortcuts WHERE char_obj_id=? AND slot=? AND page=? AND class_index=?"); - statement.setInt(1, _owner.getObjectId()); - statement.setInt(2, shortcut.getSlot()); - statement.setInt(3, shortcut.getPage()); - statement.setInt(4, _owner.getClassIndex()); - statement.execute(); - statement.close(); - } - catch (Exception e) - { - _log.warn("Could not delete character shortcut: " + e); - } - finally - { - try - { - con.close(); - } - catch (Exception e) - { - } - } + + private void deleteShortCutFromDb(L2ShortCut shortcut) { + CharacterShortcutsRepository repository = DatabaseAccess.getRepository(CharacterShortcutsRepository.class); + repository.delete(_owner.getObjectId(), shortcut.getSlot(), shortcut.getPage(), _owner.getClassIndex()); } public void restore() { _shortCuts.clear(); - java.sql.Connection con = null; - - try - { - con = L2DatabaseFactory.getInstance().getConnection(); - PreparedStatement statement = con.prepareStatement("SELECT char_obj_id, slot, page, type, shortcut_id, level FROM character_shortcuts WHERE char_obj_id=? AND class_index=?"); - statement.setInt(1, _owner.getObjectId()); - statement.setInt(2, _owner.getClassIndex()); - - ResultSet rset = statement.executeQuery(); - - while (rset.next()) - { - int slot = rset.getInt("slot"); - int page = rset.getInt("page"); - int type = rset.getInt("type"); - int id = rset.getInt("shortcut_id"); - int level = rset.getInt("level"); - - L2ShortCut sc = new L2ShortCut(slot, page, type, id, level, 1); - _shortCuts.put(slot + (page * 12), sc); - } - - rset.close(); - statement.close(); - } - catch (Exception e) - { - _log.warn("Could not restore character shortcuts: " + e); - } - finally - { - try - { - con.close(); - } - catch (Exception e) - { - } - } - + CharacterShortcutsRepository repository = DatabaseAccess.getRepository(CharacterShortcutsRepository.class); + repository.finAllByClassIndex(_owner.getObjectId(), _owner.getClassIndex()).forEach(shortcut -> { + int slot = shortcut.getSlot(); + int page = shortcut.getPage(); + int type = shortcut.getType(); + int id = shortcut.getId(); + int level = shortcut.getLevel(); + + L2ShortCut sc = new L2ShortCut(slot, page, type, id, level, 1); + _shortCuts.put(slot + (page * 12), sc); + }); + // verify shortcuts for (L2ShortCut sc : getAllShortCuts()) { diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/actor/instance/L2PcInstance.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/actor/instance/L2PcInstance.java index cc16bc38..c5cb1ae3 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/actor/instance/L2PcInstance.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/actor/instance/L2PcInstance.java @@ -51,10 +51,7 @@ import com.l2jbr.gameserver.model.database.CharacterHennas; import com.l2jbr.gameserver.model.database.CharacterRecipeBook; import com.l2jbr.gameserver.model.database.CharacterRecommends; -import com.l2jbr.gameserver.model.database.repository.CharacterHennasRepository; -import com.l2jbr.gameserver.model.database.repository.CharacterRecipebookRepository; -import com.l2jbr.gameserver.model.database.repository.CharacterRecommendsRepository; -import com.l2jbr.gameserver.model.database.repository.CharacterRepository; +import com.l2jbr.gameserver.model.database.repository.*; import com.l2jbr.gameserver.model.entity.*; import com.l2jbr.gameserver.model.quest.Quest; import com.l2jbr.gameserver.model.quest.QuestState; @@ -96,8 +93,6 @@ public final class L2PcInstance extends L2PlayableInstance { private static final String ADD_CHAR_SUBCLASS = "INSERT INTO character_subclasses (char_obj_id,class_id,exp,sp,level,class_index) VALUES (?,?,?,?,?,?)"; private static final String UPDATE_CHAR_SUBCLASS = "UPDATE character_subclasses SET exp=?,sp=?,level=?,class_id=? WHERE char_obj_id=? AND class_index =?"; private static final String DELETE_CHAR_SUBCLASS = "DELETE FROM character_subclasses WHERE char_obj_id=? AND class_index=?"; - private static final String DELETE_CHAR_SHORTCUTS = "DELETE FROM character_shortcuts WHERE char_obj_id=? AND class_index=?"; - public static final int REQUEST_TIMEOUT = 15; public static final int STORE_PRIVATE_NONE = 0; @@ -9280,15 +9275,12 @@ public boolean modifySubClass(int classIndex, int newClassId) { con = L2DatabaseFactory.getInstance().getConnection(); PreparedStatement statement; - CharacterHennasRepository repository = DatabaseAccess.getRepository(CharacterHennasRepository.class); - repository.deleteByClassIndex(getObjectId(), classIndex); + CharacterHennasRepository hennasRepository = DatabaseAccess.getRepository(CharacterHennasRepository.class); + hennasRepository.deleteByClassIndex(getObjectId(), classIndex); + + CharacterShortcutsRepository shortcutsRepository = DatabaseAccess.getRepository(CharacterShortcutsRepository.class); + shortcutsRepository.deleteByClassIndex(getObjectId(), classIndex); - // Remove all shortcuts info stored for this sub-class. - statement = con.prepareStatement(DELETE_CHAR_SHORTCUTS); - statement.setInt(1, getObjectId()); - statement.setInt(2, classIndex); - statement.execute(); - statement.close(); // Remove all effects info stored for this sub-class. statement = con.prepareStatement(DELETE_SKILL_SAVE); diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/CharacterShortcuts.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/CharacterShortcuts.java index 6f9d2386..539e0aef 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/CharacterShortcuts.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/CharacterShortcuts.java @@ -1,13 +1,51 @@ package com.l2jbr.gameserver.model.database; +import com.l2jbr.commons.database.annotation.Column; +import com.l2jbr.commons.database.annotation.Table; +import com.l2jbr.commons.database.model.Entity; +import org.springframework.data.annotation.Id; +@Table("character_shortcuts") +public class CharacterShortcuts extends Entity { -public class CharacterShortcuts { - private int char_obj_id; + @Id + @Column("char_obj_id") + private int charObjId; private int slot; private int page; private int type; - private int shortcut_id; - private String level; - private int class_index; + @Column("shortcut_id") + private int shortcutId; + private int level; + @Column("class_index") + private int classIndex; + + @Override + public Integer getId() { + return charObjId; + } + + public int getSlot() { + return slot; + } + + public int getPage() { + return page; + } + + public int getType() { + return type; + } + + public int getShortcutId() { + return shortcutId; + } + + public int getLevel() { + return level; + } + + public int getClassIndex() { + return classIndex; + } } diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/repository/CharacterShortcutsRepository.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/repository/CharacterShortcutsRepository.java new file mode 100644 index 00000000..910e475f --- /dev/null +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/repository/CharacterShortcutsRepository.java @@ -0,0 +1,27 @@ +package com.l2jbr.gameserver.model.database.repository; + +import com.l2jbr.gameserver.model.database.CharacterShortcuts; +import org.springframework.data.jdbc.repository.query.Modifying; +import org.springframework.data.jdbc.repository.query.Query; +import org.springframework.data.repository.CrudRepository; +import org.springframework.data.repository.query.Param; + +public interface CharacterShortcutsRepository extends CrudRepository { + + @Modifying + @Query("DELETE FROM character_shortcuts WHERE char_obj_id=:char AND class_index=:classIndex") + int deleteByClassIndex(@Param("char") int characterObjectId, @Param("classIndex") int classIndex); + + @Modifying + @Query("REPLACE INTO character_shortcuts (char_obj_id,slot,page,type,shortcut_id,level,class_index) " + + "values(:char,:slot,:page,:type,:shortcut,:level,:classIndex)") + int saveOrUpdate(@Param("char") int characterObjectId, @Param("shortcut") int shortcutId, @Param("slot") int slot, + @Param("page") int page, @Param("type") int type, @Param("level") int level, @Param("classIndex") int classIndex); + + @Modifying + @Query("DELETE FROM character_shortcuts WHERE char_obj_id=:char AND slot=:slot AND page=:page AND class_index=:classIndex") + int delete(@Param("char") int characterObjectId, @Param("slot") int slot, @Param("page") int page, @Param("classIndex") int classIndex); + + @Query("SELECT * FROM character_shortcuts WHERE char_obj_id=:char AND class_index=:classIndex") + Iterable finAllByClassIndex(@Param("char") int charObjectId, @Param("classIndex") int classIndex); +} diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/network/L2GameClient.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/network/L2GameClient.java index 8e6f3816..6488bc27 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/network/L2GameClient.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/network/L2GameClient.java @@ -263,10 +263,8 @@ public static void deleteCharByObjId(int objId) { CharacterRecipebookRepository recipebookRepository = DatabaseAccess.getRepository(CharacterRecipebookRepository.class); recipebookRepository.deleteAllByCharacter(objId); - statement = con.prepareStatement("DELETE FROM character_shortcuts WHERE char_obj_id=?"); - statement.setInt(1, objId); - statement.execute(); - statement.close(); + CharacterShortcutsRepository shortcutsRepository = DatabaseAccess.getRepository(CharacterShortcutsRepository.class); + shortcutsRepository.deleteById(objId); statement = con.prepareStatement("DELETE FROM character_skills WHERE char_obj_id=?"); statement.setInt(1, objId); diff --git a/Tools/src/main/com.l2jbr.tools/com/l2jbr/tools/accountmanager/SQLAccountManager.java b/Tools/src/main/com.l2jbr.tools/com/l2jbr/tools/accountmanager/SQLAccountManager.java index 99d7efb7..f843931d 100644 --- a/Tools/src/main/com.l2jbr.tools/com/l2jbr/tools/accountmanager/SQLAccountManager.java +++ b/Tools/src/main/com.l2jbr.tools/com/l2jbr/tools/accountmanager/SQLAccountManager.java @@ -197,11 +197,8 @@ private static void deleteAccount(String login) throws SQLException { statement.setInt(1, character.getObjectId()); statement.executeUpdate(); - // shortcuts - statement.close(); - statement = con.prepareStatement("DELETE FROM character_shortcuts WHERE char_obj_id=?;"); - statement.setInt(1, character.getObjectId()); - statement.executeUpdate(); + CharacterShortcutsRepository shortcutsRepository = DatabaseAccess.getRepository(CharacterShortcutsRepository.class); + shortcutsRepository.deleteById(character.getObjectId()); // items statement.close(); From d25574d917ec0c783601d51f7ada1b601fe8bb7f Mon Sep 17 00:00:00 2001 From: Alisson Oliveira Date: Tue, 1 May 2018 07:54:22 -0300 Subject: [PATCH 044/236] =?UTF-8?q?Remove=20refer=C3=AAncias=20diretas=20?= =?UTF-8?q?=C3=A0=20tabela=20character=5Fskill?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../model/actor/instance/L2PcInstance.java | 136 ++++-------------- .../model/database/CharacterSkills.java | 49 ++++++- .../repository/CharacterSkillsRepository.java | 27 ++++ .../gameserver/network/L2GameClient.java | 6 +- .../accountmanager/SQLAccountManager.java | 5 +- 5 files changed, 103 insertions(+), 120 deletions(-) create mode 100644 Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/repository/CharacterSkillsRepository.java diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/actor/instance/L2PcInstance.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/actor/instance/L2PcInstance.java index c5cb1ae3..d822148b 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/actor/instance/L2PcInstance.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/actor/instance/L2PcInstance.java @@ -23,6 +23,8 @@ import com.l2jbr.commons.database.L2DatabaseFactory; import com.l2jbr.commons.util.Rnd; import com.l2jbr.gameserver.*; +import com.l2jbr.gameserver.SevenSigns; +import com.l2jbr.gameserver.SevenSignsFestival; import com.l2jbr.gameserver.ai.CtrlIntention; import com.l2jbr.gameserver.ai.L2CharacterAI; import com.l2jbr.gameserver.ai.L2PlayerAI; @@ -47,10 +49,8 @@ import com.l2jbr.gameserver.model.actor.stat.PcStat; import com.l2jbr.gameserver.model.actor.status.PcStatus; import com.l2jbr.gameserver.model.base.*; +import com.l2jbr.gameserver.model.database.*; import com.l2jbr.gameserver.model.database.Character; -import com.l2jbr.gameserver.model.database.CharacterHennas; -import com.l2jbr.gameserver.model.database.CharacterRecipeBook; -import com.l2jbr.gameserver.model.database.CharacterRecommends; import com.l2jbr.gameserver.model.database.repository.*; import com.l2jbr.gameserver.model.entity.*; import com.l2jbr.gameserver.model.quest.Quest; @@ -81,11 +81,6 @@ * @version $Revision: 1.66.2.41.2.33 $ $Date: 2005/04/11 10:06:09 $ */ public final class L2PcInstance extends L2PlayableInstance { - private static final String RESTORE_SKILLS_FOR_CHAR = "SELECT skill_id,skill_level FROM character_skills WHERE char_obj_id=? AND class_index=?"; - private static final String ADD_NEW_SKILL = "INSERT INTO character_skills (char_obj_id,skill_id,skill_level,skill_name,class_index) VALUES (?,?,?,?,?)"; - private static final String UPDATE_CHARACTER_SKILL_LEVEL = "UPDATE character_skills SET skill_level=? WHERE skill_id=? AND char_obj_id=? AND class_index=?"; - private static final String DELETE_SKILL_FROM_CHAR = "DELETE FROM character_skills WHERE skill_id=? AND char_obj_id=? AND class_index=?"; - private static final String DELETE_CHAR_SKILLS = "DELETE FROM character_skills WHERE char_obj_id=? AND class_index=?"; private static final String ADD_SKILL_SAVE = "INSERT INTO character_skills_save (char_obj_id,skill_id,skill_level,effect_count,effect_cur_time,reuse_delay,restore_type,class_index,buff_index) VALUES (?,?,?,?,?,?,?,?,?)"; private static final String RESTORE_SKILL_SAVE = "SELECT skill_id,skill_level,effect_count,effect_cur_time, reuse_delay FROM character_skills_save WHERE char_obj_id=? AND class_index=? AND restore_type=? ORDER BY buff_index ASC"; private static final String DELETE_SKILL_SAVE = "DELETE FROM character_skills_save WHERE char_obj_id=? AND class_index=?"; @@ -6890,31 +6885,11 @@ public L2Skill removeSkill(L2Skill skill, boolean store) { */ @Override public L2Skill removeSkill(L2Skill skill) { - // Remove a skill from the L2Character and its Func objects from calculator set of the L2Character L2Skill oldSkill = super.removeSkill(skill); - java.sql.Connection con = null; - - try { - // Remove or update a L2PcInstance skill from the character_skills table of the database - con = L2DatabaseFactory.getInstance().getConnection(); - PreparedStatement statement; - - if (oldSkill != null) { - statement = con.prepareStatement(DELETE_SKILL_FROM_CHAR); - statement.setInt(1, oldSkill.getId()); - statement.setInt(2, getObjectId()); - statement.setInt(3, getClassIndex()); - statement.execute(); - statement.close(); - } - } catch (Exception e) { - _log.warn("Error could not delete skill: " + e); - } finally { - try { - con.close(); - } catch (Exception e) { - } + if (oldSkill != null) { + CharacterSkillsRepository repository = DatabaseAccess.getRepository(CharacterSkillsRepository.class); + repository.deleteSkillByClassIndex(getObjectId(), oldSkill.getId(), getClassIndex()); } L2ShortCut[] allShortCuts = getAllShortCuts(); @@ -6924,7 +6899,6 @@ public L2Skill removeSkill(L2Skill skill) { deleteShortCut(sc.getSlot(), sc.getPage()); } } - return oldSkill; } @@ -6943,82 +6917,34 @@ private void storeSkill(L2Skill newSkill, L2Skill oldSkill, int newClassIndex) { classIndex = newClassIndex; } - java.sql.Connection con = null; - - try { - con = L2DatabaseFactory.getInstance().getConnection(); - PreparedStatement statement; - - if ((oldSkill != null) && (newSkill != null)) { - statement = con.prepareStatement(UPDATE_CHARACTER_SKILL_LEVEL); - statement.setInt(1, newSkill.getLevel()); - statement.setInt(2, oldSkill.getId()); - statement.setInt(3, getObjectId()); - statement.setInt(4, classIndex); - statement.execute(); - statement.close(); - } else if (newSkill != null) { - statement = con.prepareStatement(ADD_NEW_SKILL); - statement.setInt(1, getObjectId()); - statement.setInt(2, newSkill.getId()); - statement.setInt(3, newSkill.getLevel()); - statement.setString(4, newSkill.getName()); - statement.setInt(5, classIndex); - statement.execute(); - statement.close(); - } else { - _log.warn("could not store new skill. its NULL"); - } - } catch (Exception e) { - _log.warn("Error could not store char skills: " + e); - } finally { - try { - con.close(); - } catch (Exception e) { - } + if ((oldSkill != null) && (newSkill != null)) { + CharacterSkillsRepository repository = DatabaseAccess.getRepository(CharacterSkillsRepository.class); + repository.updateSkillLevelByClassIndex(getObjectId(), oldSkill.getId(), newSkill.getLevel(), classIndex); + } else if (newSkill != null) { + CharacterSkills characterSkill = new CharacterSkills(getObjectId(), newSkill.getId(), newSkill.getLevel(), + newSkill.getName(), classIndex); + CharacterSkillsRepository repository = DatabaseAccess.getRepository(CharacterSkillsRepository.class); + repository.save(characterSkill); + } else { + _log.warn("could not store new skill. its NULL"); } } - /** - * Retrieve from the database all skills of this L2PcInstance and add them to _skills. - */ private void restoreSkills() { - java.sql.Connection con = null; + CharacterSkillsRepository repository = DatabaseAccess.getRepository(CharacterSkillsRepository.class); + repository.findAllByClassIndex(getObjectId(), getClassIndex()).forEach(characterSkill -> { + int id = characterSkill.getSkillId(); + int level = characterSkill.getSkillLevel(); - try { - // Retrieve all skills of this L2PcInstance from the database - con = L2DatabaseFactory.getInstance().getConnection(); - PreparedStatement statement = con.prepareStatement(RESTORE_SKILLS_FOR_CHAR); - statement.setInt(1, getObjectId()); - statement.setInt(2, getClassIndex()); - ResultSet rset = statement.executeQuery(); - - // Go though the recordset of this SQL query - while (rset.next()) { - int id = rset.getInt("skill_id"); - int level = rset.getInt("skill_level"); - - if (id > 9000) { - continue; // fake skills for base stats - } - - // Create a L2Skill object for each record - L2Skill skill = SkillTable.getInstance().getInfo(id, level); - - // Add the L2Skill object to the L2Character _skills and its Func objects to the calculator set of the L2Character - super.addSkill(skill); + if (id > 9000) { + return; // fake skills for base stats } - rset.close(); - statement.close(); - } catch (Exception e) { - _log.warn("Could not restore character skills: " + e); - } finally { - try { - con.close(); - } catch (Exception e) { - } - } + L2Skill skill = SkillTable.getInstance().getInfo(id, level); + + // Add the L2Skill object to the L2Character _skills and its Func objects to the calculator set of the L2Character + super.addSkill(skill); + }); } /** @@ -9289,12 +9215,8 @@ public boolean modifySubClass(int classIndex, int newClassId) { statement.execute(); statement.close(); - // Remove all skill info stored for this sub-class. - statement = con.prepareStatement(DELETE_CHAR_SKILLS); - statement.setInt(1, getObjectId()); - statement.setInt(2, classIndex); - statement.execute(); - statement.close(); + CharacterSkillsRepository skillsRepository = DatabaseAccess.getRepository(CharacterSkillsRepository.class); + skillsRepository.deleteAllByClassIndex(getObjectId(), classIndex); // Remove all basic info stored about this sub-class. statement = con.prepareStatement(DELETE_CHAR_SUBCLASS); diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/CharacterSkills.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/CharacterSkills.java index e6fa0f9c..d155fd99 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/CharacterSkills.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/CharacterSkills.java @@ -1,12 +1,49 @@ package com.l2jbr.gameserver.model.database; +import com.l2jbr.commons.database.annotation.Column; +import com.l2jbr.commons.database.annotation.Table; +import com.l2jbr.commons.database.model.Entity; +@Table("character_skills") +public class CharacterSkills extends Entity { -public class CharacterSkills { + @Column("char_obj_id") + private int charObjId; + @Column("skill_id") + private int skillId; + @Column("skill_level") + private int skillLevel; + @Column("skill_name") + private String skillName; + @Column("class_index") + private int classIndex; - private int char_obj_id; - private int skill_id; - private int skill_level; - private String skill_name; - private int class_index; + public CharacterSkills(int charObjectId, int skillId, int skillLevel, String skillName, int classIndex) { + this.charObjId = charObjectId; + this.skillId = skillId; + this.skillLevel = skillLevel; + this.skillName = skillName; + this.classIndex = classIndex; + } + + @Override + public Integer getId() { + return charObjId; + } + + public int getSkillId() { + return skillId; + } + + public int getSkillLevel() { + return skillLevel; + } + + public String getSkillName() { + return skillName; + } + + public int getClassIndex() { + return classIndex; + } } diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/repository/CharacterSkillsRepository.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/repository/CharacterSkillsRepository.java new file mode 100644 index 00000000..639a380a --- /dev/null +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/repository/CharacterSkillsRepository.java @@ -0,0 +1,27 @@ +package com.l2jbr.gameserver.model.database.repository; + +import com.l2jbr.gameserver.model.database.CharacterSkills; +import org.springframework.data.jdbc.repository.query.Modifying; +import org.springframework.data.jdbc.repository.query.Query; +import org.springframework.data.repository.CrudRepository; +import org.springframework.data.repository.query.Param; + +public interface CharacterSkillsRepository extends CrudRepository { + + @Query("SELECT * FROM character_skills WHERE char_obj_id=:char AND class_index=:classIndex") + Iterable findAllByClassIndex(@Param("char") int charObjectId, @Param("classIndex") int classIndex); + + @Modifying + @Query("UPDATE character_skills SET skill_level=:level WHERE skill_id=:skill AND char_obj_id=:char AND class_index=:classIndex") + int updateSkillLevelByClassIndex(@Param("char") int charObjectId, @Param("skill") int skillId, @Param("level") int level, + @Param("classIndex") int classIndex); + + @Modifying + @Query("DELETE FROM character_skills WHERE skill_id=:skill AND char_obj_id=:char AND class_index=:classIndex") + int deleteSkillByClassIndex(@Param("char") int charObjectId, @Param("skill") int skillId, @Param("classIndex") int classIndex); + + @Modifying + @Query("DELETE FROM character_skills WHERE char_obj_id=:char AND class_index=:classIndex") + int deleteAllByClassIndex(@Param("char") int charObjectId, @Param("classIndex") int classIndex); + +} diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/network/L2GameClient.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/network/L2GameClient.java index 6488bc27..276e43eb 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/network/L2GameClient.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/network/L2GameClient.java @@ -266,10 +266,8 @@ public static void deleteCharByObjId(int objId) { CharacterShortcutsRepository shortcutsRepository = DatabaseAccess.getRepository(CharacterShortcutsRepository.class); shortcutsRepository.deleteById(objId); - statement = con.prepareStatement("DELETE FROM character_skills WHERE char_obj_id=?"); - statement.setInt(1, objId); - statement.execute(); - statement.close(); + CharacterSkillsRepository skillsRepository = DatabaseAccess.getRepository(CharacterSkillsRepository.class); + skillsRepository.deleteById(objId); statement = con.prepareStatement("DELETE FROM character_skills_save WHERE char_obj_id=?"); statement.setInt(1, objId); diff --git a/Tools/src/main/com.l2jbr.tools/com/l2jbr/tools/accountmanager/SQLAccountManager.java b/Tools/src/main/com.l2jbr.tools/com/l2jbr/tools/accountmanager/SQLAccountManager.java index f843931d..0e06f1b6 100644 --- a/Tools/src/main/com.l2jbr.tools/com/l2jbr/tools/accountmanager/SQLAccountManager.java +++ b/Tools/src/main/com.l2jbr.tools/com/l2jbr/tools/accountmanager/SQLAccountManager.java @@ -193,9 +193,8 @@ private static void deleteAccount(String login) throws SQLException { ResultSet rcln = null; try { - statement = con.prepareStatement("DELETE FROM character_skills WHERE char_obj_id=?;"); - statement.setInt(1, character.getObjectId()); - statement.executeUpdate(); + CharacterSkillsRepository skillsRepository = DatabaseAccess.getRepository(CharacterSkillsRepository.class); + skillsRepository.deleteById(character.getObjectId()); CharacterShortcutsRepository shortcutsRepository = DatabaseAccess.getRepository(CharacterShortcutsRepository.class); shortcutsRepository.deleteById(character.getObjectId()); From e68cf9faadf2cb1a61dfd8f3ced69f1b31c16ea7 Mon Sep 17 00:00:00 2001 From: Alisson Oliveira Date: Tue, 1 May 2018 08:34:23 -0300 Subject: [PATCH 045/236] =?UTF-8?q?Remove=20refer=C3=AAncias=20diretas=20?= =?UTF-8?q?=C3=A0=20tabela=20character=5Fskill=5Fsave?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../model/actor/instance/L2PcInstance.java | 234 ++++++------------ .../model/database/CharacterSkills.java | 2 + .../model/database/CharacterSkillsSave.java | 84 ++++++- .../repository/CharacterHennasRepository.java | 2 +- .../CharacterShortcutsRepository.java | 2 +- .../CharacterSkillsSaveRepository.java | 19 ++ .../gameserver/network/L2GameClient.java | 6 +- 7 files changed, 176 insertions(+), 173 deletions(-) create mode 100644 Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/repository/CharacterSkillsSaveRepository.java diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/actor/instance/L2PcInstance.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/actor/instance/L2PcInstance.java index d822148b..dbb047a0 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/actor/instance/L2PcInstance.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/actor/instance/L2PcInstance.java @@ -64,8 +64,8 @@ import com.l2jbr.gameserver.util.Broadcast; import com.l2jbr.gameserver.util.FloodProtector; import com.l2jbr.gameserver.util.Point3D; -import org.python.bouncycastle.asn1.dvcs.Data; +import java.io.IOException; import java.sql.PreparedStatement; import java.sql.ResultSet; import java.util.*; @@ -81,9 +81,6 @@ * @version $Revision: 1.66.2.41.2.33 $ $Date: 2005/04/11 10:06:09 $ */ public final class L2PcInstance extends L2PlayableInstance { - private static final String ADD_SKILL_SAVE = "INSERT INTO character_skills_save (char_obj_id,skill_id,skill_level,effect_count,effect_cur_time,reuse_delay,restore_type,class_index,buff_index) VALUES (?,?,?,?,?,?,?,?,?)"; - private static final String RESTORE_SKILL_SAVE = "SELECT skill_id,skill_level,effect_count,effect_cur_time, reuse_delay FROM character_skills_save WHERE char_obj_id=? AND class_index=? AND restore_type=? ORDER BY buff_index ASC"; - private static final String DELETE_SKILL_SAVE = "DELETE FROM character_skills_save WHERE char_obj_id=? AND class_index=?"; private static final String RESTORE_CHAR_SUBCLASSES = "SELECT class_id,exp,sp,level,class_index FROM character_subclasses WHERE char_obj_id=? ORDER BY class_index ASC"; private static final String ADD_CHAR_SUBCLASS = "INSERT INTO character_subclasses (char_obj_id,class_id,exp,sp,level,class_index) VALUES (?,?,?,?,?,?)"; private static final String UPDATE_CHAR_SUBCLASS = "UPDATE character_subclasses SET exp=?,sp=?,level=?,class_id=? WHERE char_obj_id=? AND class_index =?"; @@ -6743,77 +6740,40 @@ private void storeEffect() { return; } - java.sql.Connection con = null; - try { - con = L2DatabaseFactory.getInstance().getConnection(); - PreparedStatement statement; - - // Delete all current stored effects for char to avoid dupe - statement = con.prepareStatement(DELETE_SKILL_SAVE); - statement.setInt(1, getObjectId()); - statement.setInt(2, getClassIndex()); - statement.execute(); - statement.close(); + CharacterSkillsSaveRepository repository = DatabaseAccess.getRepository(CharacterSkillsSaveRepository.class); + repository.deleteAllByClassIndex(getObjectId(), getClassIndex()); - int buff_index = 0; + int buff_index = 0; - // Store all effect data along with calulated remaining - // reuse delays for matching skills. 'restore_type'= 0. - for (L2Effect effect : getAllEffects()) { - if ((effect != null) && effect.getInUse() && !effect.getSkill().isToggle()) { - int skillId = effect.getSkill().getId(); - buff_index++; - - statement = con.prepareStatement(ADD_SKILL_SAVE); - statement.setInt(1, getObjectId()); - statement.setInt(2, skillId); - statement.setInt(3, effect.getSkill().getLevel()); - statement.setInt(4, effect.getCount()); - statement.setInt(5, effect.getTime()); - - if (ReuseTimeStamps.containsKey(skillId)) { - TimeStamp t = ReuseTimeStamps.remove(skillId); - statement.setLong(6, t.hasNotPassed() ? t.getReuse() : 0); - } else { - statement.setLong(6, 0); - } - - statement.setInt(7, 0); - statement.setInt(8, getClassIndex()); - statement.setInt(9, buff_index); - statement.execute(); - statement.close(); + // Store all effect data along with calulated remaining + // reuse delays for matching skills. 'restore_type'= 0. + for (L2Effect effect : getAllEffects()) { + if ((effect != null) && effect.getInUse() && !effect.getSkill().isToggle()) { + int skillId = effect.getSkill().getId(); + buff_index++; + long reuseDelay = 0; + if (ReuseTimeStamps.containsKey(skillId)) { + TimeStamp t = ReuseTimeStamps.remove(skillId); + reuseDelay = t.hasNotPassed() ? t.getReuse() : 0; } - } - // Store the reuse delays of remaining skills which - // lost effect but still under reuse delay. 'restore_type' 1. - for (TimeStamp t : ReuseTimeStamps.values()) { - if (t.hasNotPassed()) { - buff_index++; - statement = con.prepareStatement(ADD_SKILL_SAVE); - statement.setInt(1, getObjectId()); - statement.setInt(2, t.getSkill()); - statement.setInt(3, -1); - statement.setInt(4, -1); - statement.setInt(5, -1); - statement.setLong(6, t.getReuse()); - statement.setInt(7, 1); - statement.setInt(8, getClassIndex()); - statement.setInt(9, buff_index); - statement.execute(); - statement.close(); - } + CharacterSkillsSave skillsSave = new CharacterSkillsSave(getObjectId(), skillId, effect.getSkill().getLevel(), + effect.getCount(), effect.getTime(), reuseDelay, 0, getClassIndex(), buff_index ); + repository.save(skillsSave); } - ReuseTimeStamps.clear(); - } catch (Exception e) { - _log.warn("Could not store char effect data: " + e); - } finally { - try { - con.close(); - } catch (Exception e) { + } + + // Store the reuse delays of remaining skills which + // lost effect but still under reuse delay. 'restore_type' 1. + for (TimeStamp t : ReuseTimeStamps.values()) { + if (t.hasNotPassed()) { + buff_index++; + CharacterSkillsSave skillsSave = new CharacterSkillsSave(getObjectId(), t.getSkill(), -1, -1, -1, + t.getReuse(), 1, getClassIndex(), buff_index ); + repository.save(skillsSave); } } + ReuseTimeStamps.clear(); } /** @@ -6947,101 +6907,65 @@ private void restoreSkills() { }); } - /** - * Retrieve from the database all skill effects of this L2PcInstance and add them to the player. - */ public void restoreEffects() { - L2Object[] targets = new L2Character[] - { - this - }; - java.sql.Connection con = null; + L2Object[] targets = new L2Character[] { this }; - try { - con = L2DatabaseFactory.getInstance().getConnection(); - PreparedStatement statement; - ResultSet rset; - - /** - * Restore Type 0 These skill were still in effect on the character upon logout. Some of which were self casted and might still have had a long reuse delay which also is restored. - */ - statement = con.prepareStatement(RESTORE_SKILL_SAVE); - statement.setInt(1, getObjectId()); - statement.setInt(2, getClassIndex()); - statement.setInt(3, 0); - rset = statement.executeQuery(); - - while (rset.next()) { - int skillId = rset.getInt("skill_id"); - int skillLvl = rset.getInt("skill_level"); - int effectCount = rset.getInt("effect_count"); - int effectCurTime = rset.getInt("effect_cur_time"); - long reuseDelay = rset.getLong("reuse_delay"); - - // Just incase the admin minipulated this table incorrectly :x - if ((skillId == -1) || (effectCount == -1) || (effectCurTime == -1) || (reuseDelay < 0)) { - continue; - } + /** + * Restore Type 0 These skill were still in effect on the character upon logout. + * Some of which were self casted and might still have had a long reuse delay which also is restored. + */ + CharacterSkillsSaveRepository repository = DatabaseAccess.getRepository(CharacterSkillsSaveRepository.class); + repository.findAllByClassIndexAndRestoreType(getObjectId(), getClassIndex(), 0).forEach( skillSave -> { + int skillId = skillSave.getSkillId(); + int skillLvl = skillSave.getSkillLevel(); + int effectCount = skillSave.getEffectCount(); + int effectCurTime = skillSave.getEffectCurTime(); + long reuseDelay = skillSave.getReuseDelay(); + + // Just in case the admin minipulated this table incorrectly :x + if ((skillId == -1) || (effectCount == -1) || (effectCurTime == -1) || (reuseDelay < 0)) { + return; + } - L2Skill skill = SkillTable.getInstance().getInfo(skillId, skillLvl); - ISkillHandler IHand = SkillHandler.getInstance().getSkillHandler(skill.getSkillType()); - if (IHand != null) { + L2Skill skill = SkillTable.getInstance().getInfo(skillId, skillLvl); + ISkillHandler IHand = SkillHandler.getInstance().getSkillHandler(skill.getSkillType()); + if (IHand != null) { + try { IHand.useSkill(this, skill, targets); - } else { - skill.useSkill(this, targets); + } catch (IOException e) { + _log.error(e.getLocalizedMessage(), e); } + } else { + skill.useSkill(this, targets); + } - if (reuseDelay > 10) { - disableSkill(skillId, reuseDelay); - addTimeStamp(new TimeStamp(skillId, reuseDelay)); - } + if (reuseDelay > 10) { + disableSkill(skillId, reuseDelay); + addTimeStamp(new TimeStamp(skillId, reuseDelay)); + } - for (L2Effect effect : getAllEffects()) { - if (effect.getSkill().getId() == skillId) { - effect.setCount(effectCount); - effect.setFirstTime(effectCurTime); - } + for (L2Effect effect : getAllEffects()) { + if (effect.getSkill().getId() == skillId) { + effect.setCount(effectCount); + effect.setFirstTime(effectCurTime); } } - rset.close(); - statement.close(); + }); - /** - * Restore Type 1 The remaning skills lost effect upon logout but were still under a high reuse delay. - */ - statement = con.prepareStatement(RESTORE_SKILL_SAVE); - statement.setInt(1, getObjectId()); - statement.setInt(2, getClassIndex()); - statement.setInt(3, 1); - rset = statement.executeQuery(); + repository.findAllByClassIndexAndRestoreType(getObjectId(), getClassIndex(), 0).forEach( skillSave -> { + int skillId = skillSave.getSkillId(); + long reuseDelay = skillSave.getReuseDelay(); - while (rset.next()) { - int skillId = rset.getInt("skill_id"); - long reuseDelay = rset.getLong("reuse_delay"); + if (reuseDelay <= 0) { + return; + } - if (reuseDelay <= 0) { - continue; - } + disableSkill(skillId, reuseDelay); + addTimeStamp(new TimeStamp(skillId, reuseDelay)); + }); - disableSkill(skillId, reuseDelay); - addTimeStamp(new TimeStamp(skillId, reuseDelay)); - } - rset.close(); - statement.close(); - statement = con.prepareStatement(DELETE_SKILL_SAVE); - statement.setInt(1, getObjectId()); - statement.setInt(2, getClassIndex()); - statement.executeUpdate(); - statement.close(); - } catch (Exception e) { - _log.warn("Could not restore active effect data: " + e); - } finally { - try { - con.close(); - } catch (Exception e) { - } - } + repository.deleteAllByClassIndex(getObjectId(), getClassIndex()); updateEffectIcons(); } @@ -9202,18 +9126,14 @@ public boolean modifySubClass(int classIndex, int newClassId) { PreparedStatement statement; CharacterHennasRepository hennasRepository = DatabaseAccess.getRepository(CharacterHennasRepository.class); - hennasRepository.deleteByClassIndex(getObjectId(), classIndex); + hennasRepository.deleteAllByClassIndex(getObjectId(), classIndex); CharacterShortcutsRepository shortcutsRepository = DatabaseAccess.getRepository(CharacterShortcutsRepository.class); - shortcutsRepository.deleteByClassIndex(getObjectId(), classIndex); + shortcutsRepository.deleteAllByClassIndex(getObjectId(), classIndex); - // Remove all effects info stored for this sub-class. - statement = con.prepareStatement(DELETE_SKILL_SAVE); - statement.setInt(1, getObjectId()); - statement.setInt(2, classIndex); - statement.execute(); - statement.close(); + CharacterSkillsSaveRepository skillsSaveRepository = DatabaseAccess.getRepository(CharacterSkillsSaveRepository.class); + skillsSaveRepository.deleteAllByClassIndex(getObjectId(), getClassIndex()); CharacterSkillsRepository skillsRepository = DatabaseAccess.getRepository(CharacterSkillsRepository.class); skillsRepository.deleteAllByClassIndex(getObjectId(), classIndex); diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/CharacterSkills.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/CharacterSkills.java index d155fd99..20b3a2e4 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/CharacterSkills.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/CharacterSkills.java @@ -3,10 +3,12 @@ import com.l2jbr.commons.database.annotation.Column; import com.l2jbr.commons.database.annotation.Table; import com.l2jbr.commons.database.model.Entity; +import org.springframework.data.annotation.Id; @Table("character_skills") public class CharacterSkills extends Entity { + @Id @Column("char_obj_id") private int charObjId; @Column("skill_id") diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/CharacterSkillsSave.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/CharacterSkillsSave.java index 6ecc8ad7..29a95e47 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/CharacterSkillsSave.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/CharacterSkillsSave.java @@ -1,16 +1,80 @@ package com.l2jbr.gameserver.model.database; +import com.l2jbr.commons.database.annotation.Column; +import com.l2jbr.commons.database.annotation.Table; +import com.l2jbr.commons.database.model.Entity; +import com.l2jbr.gameserver.model.L2Effect; +import org.springframework.data.annotation.Id; +@Table("character_skills_save") +public class CharacterSkillsSave extends Entity { -public class CharacterSkillsSave { + @Id + @Column("char_obj_id") + private int charObjId; + @Column("skill_id") + private int skillId; + @Column("skill_level") + private int skillLevel; + @Column("effect_count") + private int effectCount; + @Column("effect_cur_time") + private int effectCurTime; + @Column("reuse_delay") + private long reuseDelay; + @Column("restore_type") + private int restoreType; + @Column("class_index") + private int classIndex; + @Column("buff_index") + private int buffIndex; - private int char_obj_id; - private int skill_id; - private int skill_level; - private int effect_count; - private int effect_cur_time; - private int reuse_delay; - private int restore_type; - private int class_index; - private int buff_index; + public CharacterSkillsSave(int objectId, int skillId, int skillLevel, int effectCount, int effectCurTime, long reuseDelay, int restoreType, int classIndex, int buffIndex) { + this.charObjId = objectId; + this.skillId = skillId; + this.skillLevel = skillLevel; + this.effectCount = effectCount; + this.effectCurTime = effectCurTime; + this.reuseDelay = reuseDelay; + this.restoreType = restoreType; + this.classIndex = classIndex; + this.buffIndex = buffIndex; + } + + @Override + public Integer getId() { + return charObjId; + } + + public int getSkillId() { + return skillId; + } + + public int getSkillLevel() { + return skillLevel; + } + + public int getEffectCount() { + return effectCount; + } + + public int getEffectCurTime() { + return effectCurTime; + } + + public long getReuseDelay() { + return reuseDelay; + } + + public int getRestoreType() { + return restoreType; + } + + public int getClassIndex() { + return classIndex; + } + + public int getBuffIndex() { + return buffIndex; + } } diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/repository/CharacterHennasRepository.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/repository/CharacterHennasRepository.java index c2d87aea..a5cd6894 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/repository/CharacterHennasRepository.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/repository/CharacterHennasRepository.java @@ -13,7 +13,7 @@ public interface CharacterHennasRepository extends CrudRepository { + + @Query("SELECT * FROM character_skills_save WHERE char_obj_id=:char AND class_index=:classIndex AND restore_type=:restoreType" + + " ORDER BY buff_index ASC") + Iterable findAllByClassIndexAndRestoreType(@Param("char") int charObjectId, @Param("classIndex") int classIndex, + @Param("restoreType") int restoreType); + + @Modifying + @Query("DELETE FROM character_skills_save WHERE char_obj_id=:char AND class_index=:classIndex") + int deleteAllByClassIndex(@Param("char") int charObjectId, @Param("classIndex") int classIndex); +} diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/network/L2GameClient.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/network/L2GameClient.java index 276e43eb..451a1b40 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/network/L2GameClient.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/network/L2GameClient.java @@ -269,10 +269,8 @@ public static void deleteCharByObjId(int objId) { CharacterSkillsRepository skillsRepository = DatabaseAccess.getRepository(CharacterSkillsRepository.class); skillsRepository.deleteById(objId); - statement = con.prepareStatement("DELETE FROM character_skills_save WHERE char_obj_id=?"); - statement.setInt(1, objId); - statement.execute(); - statement.close(); + CharacterSkillsSaveRepository skillsSaveRepository = DatabaseAccess.getRepository(CharacterSkillsSaveRepository.class); + skillsRepository.deleteById(objId); statement = con.prepareStatement("DELETE FROM character_subclasses WHERE char_obj_id=?"); statement.setInt(1, objId); From 4d7722c0358331a882be8d885523fcfb516116b8 Mon Sep 17 00:00:00 2001 From: Alisson Oliveira Date: Tue, 1 May 2018 09:56:52 -0300 Subject: [PATCH 046/236] =?UTF-8?q?Remove=20refer=C3=AAncias=20diretas=20?= =?UTF-8?q?=C3=A0=20tabela=20character=5Fsubclasses?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../model/actor/instance/L2PcInstance.java | 159 ++++-------------- .../model/database/CharacterSubclasses.java | 56 +++++- .../CharacterSubclassesRepository.java | 27 +++ .../gameserver/network/L2GameClient.java | 8 +- .../serverpackets/CharSelectInfo.java | 34 +--- 5 files changed, 116 insertions(+), 168 deletions(-) create mode 100644 Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/repository/CharacterSubclassesRepository.java diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/actor/instance/L2PcInstance.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/actor/instance/L2PcInstance.java index dbb047a0..c0f86c7f 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/actor/instance/L2PcInstance.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/actor/instance/L2PcInstance.java @@ -81,10 +81,6 @@ * @version $Revision: 1.66.2.41.2.33 $ $Date: 2005/04/11 10:06:09 $ */ public final class L2PcInstance extends L2PlayableInstance { - private static final String RESTORE_CHAR_SUBCLASSES = "SELECT class_id,exp,sp,level,class_index FROM character_subclasses WHERE char_obj_id=? ORDER BY class_index ASC"; - private static final String ADD_CHAR_SUBCLASS = "INSERT INTO character_subclasses (char_obj_id,class_id,exp,sp,level,class_index) VALUES (?,?,?,?,?,?)"; - private static final String UPDATE_CHAR_SUBCLASS = "UPDATE character_subclasses SET exp=?,sp=?,level=?,class_id=? WHERE char_obj_id=? AND class_index =?"; - private static final String DELETE_CHAR_SUBCLASS = "DELETE FROM character_subclasses WHERE char_obj_id=? AND class_index=?"; public static final int REQUEST_TIMEOUT = 15; public static final int STORE_PRIVATE_NONE = 0; @@ -6477,45 +6473,18 @@ public void setMemo(Forum forum) { _forumMemo = forum; } - /** - * Restores sub-class data for the L2PcInstance, used to check the current class index for the character. - * - * @param player the player - * @return true, if successful - */ private static boolean restoreSubClassData(L2PcInstance player) { - java.sql.Connection con = null; - - try { - con = L2DatabaseFactory.getInstance().getConnection(); - PreparedStatement statement = con.prepareStatement(RESTORE_CHAR_SUBCLASSES); - statement.setInt(1, player.getObjectId()); - - ResultSet rset = statement.executeQuery(); - - while (rset.next()) { - SubClass subClass = new SubClass(); - subClass.setClassId(rset.getInt("class_id")); - subClass.setLevel(rset.getByte("level")); - subClass.setExp(rset.getLong("exp")); - subClass.setSp(rset.getInt("sp")); - subClass.setClassIndex(rset.getInt("class_index")); - - // Enforce the correct indexing of _subClasses against their class indexes. - player.getSubClasses().put(subClass.getClassIndex(), subClass); - } - - statement.close(); - } catch (Exception e) { - _log.warn("Could not restore classes for " + player.getName() + ": " + e); - e.printStackTrace(); - } finally { - try { - con.close(); - } catch (Exception e) { - } - } - + CharacterSubclassesRepository repository = DatabaseAccess.getRepository(CharacterSubclassesRepository.class); + repository.findAllByCharacter(player.getObjectId()).forEach(characterSubclasse -> { + SubClass subClass = new SubClass(); + subClass.setClassId(characterSubclasse.getClassId()); + subClass.setLevel(characterSubclasse.getLevel()); + subClass.setExp(characterSubclasse.getExp()); + subClass.setSp(characterSubclasse.getSp()); + subClass.setClassIndex(characterSubclasse.getClassIndex()); + + player.getSubClasses().put(subClass.getClassIndex(), subClass); + }); return true; } @@ -6698,36 +6667,13 @@ private void storeCharBase() { repository.save(character); } - /** - * Store char sub. - */ private void storeCharSub() { - java.sql.Connection con = null; + if (getTotalSubClasses() > 0) { + CharacterSubclassesRepository repository = DatabaseAccess.getRepository(CharacterSubclassesRepository.class); - try { - con = L2DatabaseFactory.getInstance().getConnection(); - PreparedStatement statement; - - if (getTotalSubClasses() > 0) { - for (SubClass subClass : getSubClasses().values()) { - statement = con.prepareStatement(UPDATE_CHAR_SUBCLASS); - statement.setLong(1, subClass.getExp()); - statement.setInt(2, subClass.getSp()); - statement.setInt(3, subClass.getLevel()); - statement.setInt(4, subClass.getClassId()); - statement.setInt(5, getObjectId()); - statement.setInt(6, subClass.getClassIndex()); - - statement.execute(); - statement.close(); - } - } - } catch (Exception e) { - _log.warn("Could not store sub class data for " + getName() + ": " + e); - } finally { - try { - con.close(); - } catch (Exception e) { + for (SubClass subClass : getSubClasses().values()) { + repository.updateByClassIndex(getObjectId(), subClass.getClassIndex(), subClass.getExp(), subClass.getSp(), subClass.getLevel(), + subClass.getClassId()); } } } @@ -9042,29 +8988,9 @@ public boolean addSubClass(int classId, int classIndex) { newClass.setClassId(classId); newClass.setClassIndex(classIndex); - java.sql.Connection con = null; - - try { - // Store the basic info about this new sub-class. - con = L2DatabaseFactory.getInstance().getConnection(); - PreparedStatement statement = con.prepareStatement(ADD_CHAR_SUBCLASS); - statement.setInt(1, getObjectId()); - statement.setInt(2, newClass.getClassId()); - statement.setLong(3, newClass.getExp()); - statement.setInt(4, newClass.getSp()); - statement.setInt(5, newClass.getLevel()); - statement.setInt(6, newClass.getClassIndex()); // <-- Added - statement.execute(); - statement.close(); - } catch (Exception e) { - _log.warn("WARNING: Could not add character sub class for " + getName() + ": " + e); - return false; - } finally { - try { - con.close(); - } catch (Exception e) { - } - } + CharacterSubclasses subclasse = new CharacterSubclasses(getObjectId(), newClass); + CharacterSubclassesRepository repository = DatabaseAccess.getRepository(CharacterSubclassesRepository.class); + repository.save(subclasse); // Commit after database INSERT incase exception is thrown. getSubClasses().put(newClass.getClassIndex(), newClass); @@ -9115,47 +9041,22 @@ public boolean addSubClass(int classId, int classIndex) { public boolean modifySubClass(int classIndex, int newClassId) { int oldClassId = getSubClasses().get(classIndex).getClassId(); - if (Config.DEBUG) { - _log.info(getName() + " has requested to modify sub class index " + classIndex + " from class ID " + oldClassId + " to " + newClassId + "."); - } - - java.sql.Connection con = null; - - try { - con = L2DatabaseFactory.getInstance().getConnection(); - PreparedStatement statement; - - CharacterHennasRepository hennasRepository = DatabaseAccess.getRepository(CharacterHennasRepository.class); - hennasRepository.deleteAllByClassIndex(getObjectId(), classIndex); + _log.debug("{} has requested to modify sub class index {} from {} class ID to {}.", getName(), classIndex, oldClassId, newClassId); - CharacterShortcutsRepository shortcutsRepository = DatabaseAccess.getRepository(CharacterShortcutsRepository.class); - shortcutsRepository.deleteAllByClassIndex(getObjectId(), classIndex); + CharacterHennasRepository hennasRepository = DatabaseAccess.getRepository(CharacterHennasRepository.class); + hennasRepository.deleteAllByClassIndex(getObjectId(), classIndex); + CharacterShortcutsRepository shortcutsRepository = DatabaseAccess.getRepository(CharacterShortcutsRepository.class); + shortcutsRepository.deleteAllByClassIndex(getObjectId(), classIndex); - CharacterSkillsSaveRepository skillsSaveRepository = DatabaseAccess.getRepository(CharacterSkillsSaveRepository.class); - skillsSaveRepository.deleteAllByClassIndex(getObjectId(), getClassIndex()); + CharacterSkillsSaveRepository skillsSaveRepository = DatabaseAccess.getRepository(CharacterSkillsSaveRepository.class); + skillsSaveRepository.deleteAllByClassIndex(getObjectId(), getClassIndex()); - CharacterSkillsRepository skillsRepository = DatabaseAccess.getRepository(CharacterSkillsRepository.class); - skillsRepository.deleteAllByClassIndex(getObjectId(), classIndex); + CharacterSkillsRepository skillsRepository = DatabaseAccess.getRepository(CharacterSkillsRepository.class); + skillsRepository.deleteAllByClassIndex(getObjectId(), classIndex); - // Remove all basic info stored about this sub-class. - statement = con.prepareStatement(DELETE_CHAR_SUBCLASS); - statement.setInt(1, getObjectId()); - statement.setInt(2, classIndex); - statement.execute(); - statement.close(); - } catch (Exception e) { - _log.warn("Could not modify sub class for " + getName() + " to class index " + classIndex + ": " + e); - - // This must be done in order to maintain data consistency. - getSubClasses().remove(classIndex); - return false; - } finally { - try { - con.close(); - } catch (Exception e) { - } - } + CharacterSubclassesRepository subclassesRepository = DatabaseAccess.getRepository(CharacterSubclassesRepository.class); + subclassesRepository.deleteByClassIndex(getObjectId(), classIndex); getSubClasses().remove(classIndex); return addSubClass(newClassId, classIndex); diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/CharacterSubclasses.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/CharacterSubclasses.java index c342ab87..a427bc95 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/CharacterSubclasses.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/CharacterSubclasses.java @@ -1,14 +1,56 @@ package com.l2jbr.gameserver.model.database; +import com.l2jbr.commons.database.annotation.Column; +import com.l2jbr.commons.database.annotation.Table; +import com.l2jbr.commons.database.model.Entity; +import com.l2jbr.gameserver.model.base.SubClass; +import org.springframework.data.annotation.Id; +@Table("character_subclasses") +public class CharacterSubclasses extends Entity { -public class CharacterSubclasses { - - private int char_obj_id; - private int class_id; + @Id + @Column("char_obj_id") + private int charObjId; + @Column("class_id") + private int classId; private long exp; - private long sp; - private int level; - private int class_index; + private int sp; + private byte level; + @Column("class_index") + private int classIndex; + + public CharacterSubclasses(int charObjectId, SubClass newClass) { + this.charObjId = charObjectId; + this.classId = newClass.getClassId(); + this.exp = newClass.getExp(); + this.sp = newClass.getSp(); + this.level = newClass.getLevel(); + this.classIndex = newClass.getClassIndex(); + } + + @Override + public Integer getId() { + return charObjId; + } + + public int getClassId() { + return classId; + } + + public long getExp() { + return exp; + } + + public int getSp() { + return sp; + } + + public byte getLevel() { + return level; + } + public int getClassIndex() { + return classIndex; + } } diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/repository/CharacterSubclassesRepository.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/repository/CharacterSubclassesRepository.java new file mode 100644 index 00000000..620d7f4e --- /dev/null +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/repository/CharacterSubclassesRepository.java @@ -0,0 +1,27 @@ +package com.l2jbr.gameserver.model.database.repository; + +import com.l2jbr.gameserver.model.database.CharacterSubclasses; +import org.springframework.data.jdbc.repository.query.Modifying; +import org.springframework.data.jdbc.repository.query.Query; +import org.springframework.data.repository.CrudRepository; +import org.springframework.data.repository.query.Param; + +import java.util.Optional; + +public interface CharacterSubclassesRepository extends CrudRepository { + + @Query("SELECT * FROM character_subclasses WHERE char_obj_id=:char AND class_id=:classId") + Optional findByClassId(@Param("char") int charObjectId, @Param("classId") int classId); + + @Query("SELECT * FROM character_subclasses WHERE char_obj_id=:char ORDER BY class_index ASC") + Iterable findAllByCharacter(@Param("char") int charObjectId); + + @Modifying + @Query("UPDATE character_subclasses SET exp=:exp,sp=:sp,level=:level,class_id=:classId WHERE char_obj_id=:char AND class_index=:classIndex") + int updateByClassIndex(@Param("char") int charObjectId, @Param("classIndex") int classIndex, @Param("exp") long exp, + @Param("sp") int sp, @Param("level") byte level, @Param("classId") int classId); + + @Modifying + @Query("DELETE FROM character_subclasses WHERE char_obj_id=:char AND class_index=:classIndex") + int deleteByClassIndex(@Param("char") int charObjectId, @Param("classIndex") int classIndex); +} diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/network/L2GameClient.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/network/L2GameClient.java index 451a1b40..cdb149b5 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/network/L2GameClient.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/network/L2GameClient.java @@ -270,12 +270,10 @@ public static void deleteCharByObjId(int objId) { skillsRepository.deleteById(objId); CharacterSkillsSaveRepository skillsSaveRepository = DatabaseAccess.getRepository(CharacterSkillsSaveRepository.class); - skillsRepository.deleteById(objId); + skillsSaveRepository.deleteById(objId); - statement = con.prepareStatement("DELETE FROM character_subclasses WHERE char_obj_id=?"); - statement.setInt(1, objId); - statement.execute(); - statement.close(); + CharacterSubclassesRepository subclassesRepository = DatabaseAccess.getRepository(CharacterSubclassesRepository.class); + subclassesRepository.deleteById(objId); statement = con.prepareStatement("DELETE FROM heroes WHERE char_id=?"); statement.setInt(1, objId); diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/serverpackets/CharSelectInfo.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/serverpackets/CharSelectInfo.java index 24520a90..af388329 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/serverpackets/CharSelectInfo.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/serverpackets/CharSelectInfo.java @@ -27,6 +27,7 @@ import com.l2jbr.gameserver.model.database.Character; import com.l2jbr.gameserver.model.database.repository.AugmentationsRepository; import com.l2jbr.gameserver.model.database.repository.CharacterRepository; +import com.l2jbr.gameserver.model.database.repository.CharacterSubclassesRepository; import com.l2jbr.gameserver.network.L2GameClient; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -218,33 +219,12 @@ private CharSelectInfoPackage[] loadCharacterSelectInfo() { } private void loadCharacterSubclassInfo(CharSelectInfoPackage charInfopackage, int ObjectId, int activeClassId) { - java.sql.Connection con = null; - - try { - con = L2DatabaseFactory.getInstance().getConnection(); - PreparedStatement statement = con.prepareStatement("SELECT exp, sp, level FROM character_subclasses WHERE char_obj_id=? && class_id=? ORDER BY char_obj_id"); - statement.setInt(1, ObjectId); - statement.setInt(2, activeClassId); - ResultSet charList = statement.executeQuery(); - - if (charList.next()) { - charInfopackage.setExp(charList.getLong("exp")); - charInfopackage.setSp(charList.getInt("sp")); - charInfopackage.setLevel(charList.getInt("level")); - } - - charList.close(); - statement.close(); - - } catch (Exception e) { - _log.warn("Could not restore char subclass info: " + e); - } finally { - try { - con.close(); - } catch (Exception e) { - } - } - + CharacterSubclassesRepository repository = DatabaseAccess.getRepository(CharacterSubclassesRepository.class); + repository.findByClassId(ObjectId, activeClassId).ifPresent(characterSubclasse -> { + charInfopackage.setExp(characterSubclasse.getExp()); + charInfopackage.setSp(characterSubclasse.getSp()); + charInfopackage.setLevel(characterSubclasse.getLevel()); + }); } private CharSelectInfoPackage restoreChar(Character character) { From 5c087364f869baf996f60229c1475ad910ab3639 Mon Sep 17 00:00:00 2001 From: Alisson Oliveira Date: Tue, 1 May 2018 10:33:28 -0300 Subject: [PATCH 047/236] =?UTF-8?q?Remove=20refer=C3=AAncias=20diretas=20?= =?UTF-8?q?=C3=A0=20tabela=20clan=5Fprivs?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../gameserver/datatables/ClanTable.java | 11 ++- .../com/l2jbr/gameserver/model/L2Clan.java | 86 +++---------------- .../gameserver/model/database/ClanPrivs.java | 31 ++++++- .../repository/ClanPrivsRepository.java | 17 ++++ .../accountmanager/SQLAccountManager.java | 11 +-- 5 files changed, 65 insertions(+), 91 deletions(-) create mode 100644 Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/repository/ClanPrivsRepository.java diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/datatables/ClanTable.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/datatables/ClanTable.java index 53b7431e..bf6f5dc9 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/datatables/ClanTable.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/datatables/ClanTable.java @@ -28,6 +28,7 @@ import com.l2jbr.gameserver.model.L2ClanMember; import com.l2jbr.gameserver.model.actor.instance.L2PcInstance; import com.l2jbr.gameserver.model.database.repository.CastleRepository; +import com.l2jbr.gameserver.model.database.repository.ClanPrivsRepository; import com.l2jbr.gameserver.model.database.repository.ClanRepository; import com.l2jbr.gameserver.model.entity.Siege; import com.l2jbr.gameserver.network.SystemMessageId; @@ -208,14 +209,12 @@ public synchronized void destroyClan(int clanId) { ClanRepository clanRepository = DatabaseAccess.getRepository(ClanRepository.class); clanRepository.deleteById(clanId); - con = L2DatabaseFactory.getInstance().getConnection(); + ClanPrivsRepository clanPrivsRepository = DatabaseAccess.getRepository(ClanPrivsRepository.class); + clanPrivsRepository.deleteById(clanId); - PreparedStatement statement = con.prepareStatement("DELETE FROM clan_privs WHERE clan_id=?"); - statement.setInt(1, clanId); - statement.execute(); - statement.close(); + con = L2DatabaseFactory.getInstance().getConnection(); - statement = con.prepareStatement("DELETE FROM clan_skills WHERE clan_id=?"); + PreparedStatement statement = con.prepareStatement("DELETE FROM clan_skills WHERE clan_id=?"); statement.setInt(1, clanId); statement.execute(); statement.close(); diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/L2Clan.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/L2Clan.java index 4212defe..15769567 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/L2Clan.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/L2Clan.java @@ -30,6 +30,7 @@ import com.l2jbr.gameserver.model.actor.instance.L2PcInstance; import com.l2jbr.gameserver.model.database.ClanData; import com.l2jbr.gameserver.model.database.repository.CharacterRepository; +import com.l2jbr.gameserver.model.database.repository.ClanPrivsRepository; import com.l2jbr.gameserver.model.database.repository.ClanRepository; import com.l2jbr.gameserver.network.SystemMessageId; import com.l2jbr.gameserver.serverpackets.*; @@ -1286,37 +1287,12 @@ public void updateSubPledgeInDB(int pledgeType) { } private void restoreRankPrivs() { - java.sql.Connection con = null; - - try { - // Retrieve all skills of this L2PcInstance from the database - con = L2DatabaseFactory.getInstance().getConnection(); - PreparedStatement statement = con.prepareStatement("SELECT privs,rank,party FROM clan_privs WHERE clan_id=?"); - statement.setInt(1, getClanId()); - // _log.warn("clanPrivs restore for ClanId : "+getClanId()); - ResultSet rset = statement.executeQuery(); - - // Go though the recordset of this SQL query - while (rset.next()) { - int rank = rset.getInt("rank"); - // int party = rset.getInt("party"); - int privileges = rset.getInt("privs"); - // Create a SubPledge object for each record - // RankPrivs privs = new RankPrivs(rank, party, privileges); - // _Privs.put(rank, privs); - _privs.get(rank).setPrivs(privileges); - } - - rset.close(); - statement.close(); - } catch (Exception e) { - _log.warn("Could not restore clan privs by rank: " + e); - } finally { - try { - con.close(); - } catch (Exception e) { - } - } + ClanPrivsRepository repository = DatabaseAccess.getRepository(ClanPrivsRepository.class); + repository.findAllByClan(getClanId()).forEach(clanPrivs -> { + int rank = clanPrivs.getRank(); + int privileges = clanPrivs.getPrivs(); + _privs.get(rank).setPrivs(privileges); + }); } public void initializePrivs() { @@ -1339,29 +1315,9 @@ public void setRankPrivs(int rank, int privs) { if (_privs.get(rank) != null) { _privs.get(rank).setPrivs(privs); - java.sql.Connection con = null; + ClanPrivsRepository repository = DatabaseAccess.getRepository(ClanPrivsRepository.class); + repository.saveOrUpdate(getClanId(), rank, 0, privs); - try { - // _log.warn("requested store clan privs in db for rank: "+rank+", privs: "+privs); - // Retrieve all skills of this L2PcInstance from the database - con = L2DatabaseFactory.getInstance().getConnection(); - PreparedStatement statement = con.prepareStatement("INSERT INTO clan_privs (clan_id,rank,party,privs) VALUES (?,?,?,?) ON DUPLICATE KEY UPDATE privs = ?"); - statement.setInt(1, getClanId()); - statement.setInt(2, rank); - statement.setInt(3, 0); - statement.setInt(4, privs); - statement.setInt(5, privs); - - statement.execute(); - statement.close(); - } catch (Exception e) { - _log.warn("Could not store clan privs for rank: " + e); - } finally { - try { - con.close(); - } catch (Exception e) { - } - } for (L2ClanMember cm : getMembers()) { if (cm.isOnline()) { if (cm.getPowerGrade() == rank) { @@ -1375,28 +1331,8 @@ public void setRankPrivs(int rank, int privs) { broadcastClanStatus(); } else { _privs.put(rank, new RankPrivs(rank, 0, privs)); - - java.sql.Connection con = null; - - try { - // _log.warn("requested store clan new privs in db for rank: "+rank); - // Retrieve all skills of this L2PcInstance from the database - con = L2DatabaseFactory.getInstance().getConnection(); - PreparedStatement statement = con.prepareStatement("INSERT INTO clan_privs (clan_id,rank,party,privs) VALUES (?,?,?,?)"); - statement.setInt(1, getClanId()); - statement.setInt(2, rank); - statement.setInt(3, 0); - statement.setInt(4, privs); - statement.execute(); - statement.close(); - } catch (Exception e) { - _log.warn("Could not create new rank and store clan privs for rank: " + e); - } finally { - try { - con.close(); - } catch (Exception e) { - } - } + ClanPrivsRepository repository = DatabaseAccess.getRepository(ClanPrivsRepository.class); + repository.saveOrUpdate(getClanId(), rank, 0, privs); } } diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/ClanPrivs.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/ClanPrivs.java index 3249652a..2a01c90d 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/ClanPrivs.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/ClanPrivs.java @@ -1,11 +1,36 @@ package com.l2jbr.gameserver.model.database; +import com.l2jbr.commons.database.annotation.Column; +import com.l2jbr.commons.database.annotation.Table; +import com.l2jbr.commons.database.model.Entity; +import org.springframework.data.annotation.Id; +@Table("clan_privs") +public class ClanPrivs extends Entity { -public class ClanPrivs { - - private int clan_id; + @Id + @Column("clan_id") + private int clanId; private int rank; private int party; private int privs; + + @Override + public Integer getId() { + return clanId; + } + + public int getRank() { + return rank; + } + + public int getParty() { + return party; + } + + public int getPrivs() { + return privs; + } + + } diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/repository/ClanPrivsRepository.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/repository/ClanPrivsRepository.java new file mode 100644 index 00000000..404dae92 --- /dev/null +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/repository/ClanPrivsRepository.java @@ -0,0 +1,17 @@ +package com.l2jbr.gameserver.model.database.repository; + +import com.l2jbr.gameserver.model.database.ClanPrivs; +import org.springframework.data.jdbc.repository.query.Modifying; +import org.springframework.data.jdbc.repository.query.Query; +import org.springframework.data.repository.CrudRepository; +import org.springframework.data.repository.query.Param; + +public interface ClanPrivsRepository extends CrudRepository { + + @Query("SELECT * FROM clan_privs WHERE clan_id=:clan") + Iterable findAllByClan(@Param("clan") int clanId); + + @Modifying + @Query("INSERT INTO clan_privs (clan_id,rank,party,privs) VALUES (:clan,:rank,:party,:privs) ON DUPLICATE KEY UPDATE privs=:privs") + int saveOrUpdate(@Param("clan") int clanId, @Param("rank") int rank, @Param("party") int party, @Param("privs") int privs); +} diff --git a/Tools/src/main/com.l2jbr.tools/com/l2jbr/tools/accountmanager/SQLAccountManager.java b/Tools/src/main/com.l2jbr.tools/com/l2jbr/tools/accountmanager/SQLAccountManager.java index 0e06f1b6..e21cca30 100644 --- a/Tools/src/main/com.l2jbr.tools/com/l2jbr/tools/accountmanager/SQLAccountManager.java +++ b/Tools/src/main/com.l2jbr.tools/com/l2jbr/tools/accountmanager/SQLAccountManager.java @@ -26,6 +26,7 @@ import com.l2jbr.commons.database.L2DatabaseFactory; import com.l2jbr.commons.database.model.Account; import com.l2jbr.gameserver.model.database.CharacterQuests; +import com.l2jbr.gameserver.model.database.ClanPrivs; import com.l2jbr.gameserver.model.database.repository.*; import java.io.IOException; @@ -153,6 +154,7 @@ private static void deleteAccount(String login) throws SQLException { CharacterRepository characterRepository = DatabaseAccess.getRepository(CharacterRepository.class); ClanRepository clanRepository = DatabaseAccess.getRepository(ClanRepository.class); + ClanPrivsRepository clanPrivsRepository = DatabaseAccess.getRepository(ClanPrivsRepository.class); characterRepository.findAllByAccountName(login).forEach(character -> { final int clanId = character.getClanId(); @@ -166,16 +168,11 @@ private static void deleteAccount(String login) throws SQLException { statement.setString(1, clanData.getClanName()); statement.setString(2, clanData.getClanName()); statement.executeUpdate(); - - + // Remove All From clan - characterRepository.removeClanId(clanId); + clanPrivsRepository.deleteById(clanId); - statement.close(); - statement = con.prepareStatement("DELETE FROM clan_privs WHERE clan_id=?;"); - statement.setInt(1, clanId); - statement.executeUpdate(); statement.close(); statement = con.prepareStatement("DELETE FROM clan_subpledges WHERE clan_id=?;"); From 2c62e7f5cdb149dbcce031b204519b05380e4cd1 Mon Sep 17 00:00:00 2001 From: Alisson Oliveira Date: Tue, 1 May 2018 10:52:18 -0300 Subject: [PATCH 048/236] =?UTF-8?q?Remove=20refer=C3=AAncias=20diretas=20?= =?UTF-8?q?=C3=A0=20tabela=20clan=5Fskills?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../gameserver/datatables/ClanTable.java | 11 ++- .../com/l2jbr/gameserver/model/L2Clan.java | 74 ++++--------------- .../gameserver/model/database/ClanSkills.java | 44 +++++++++-- .../repository/ClanSkillRepository.java | 15 ++++ 4 files changed, 74 insertions(+), 70 deletions(-) create mode 100644 Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/repository/ClanSkillRepository.java diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/datatables/ClanTable.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/datatables/ClanTable.java index bf6f5dc9..f99ce88d 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/datatables/ClanTable.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/datatables/ClanTable.java @@ -30,6 +30,7 @@ import com.l2jbr.gameserver.model.database.repository.CastleRepository; import com.l2jbr.gameserver.model.database.repository.ClanPrivsRepository; import com.l2jbr.gameserver.model.database.repository.ClanRepository; +import com.l2jbr.gameserver.model.database.repository.ClanSkillRepository; import com.l2jbr.gameserver.model.entity.Siege; import com.l2jbr.gameserver.network.SystemMessageId; import com.l2jbr.gameserver.serverpackets.*; @@ -212,14 +213,12 @@ public synchronized void destroyClan(int clanId) { ClanPrivsRepository clanPrivsRepository = DatabaseAccess.getRepository(ClanPrivsRepository.class); clanPrivsRepository.deleteById(clanId); - con = L2DatabaseFactory.getInstance().getConnection(); + ClanSkillRepository skillRepository = DatabaseAccess.getRepository(ClanSkillRepository.class); + skillRepository.deleteById(clanId); - PreparedStatement statement = con.prepareStatement("DELETE FROM clan_skills WHERE clan_id=?"); - statement.setInt(1, clanId); - statement.execute(); - statement.close(); + con = L2DatabaseFactory.getInstance().getConnection(); - statement = con.prepareStatement("DELETE FROM clan_subpledges WHERE clan_id=?"); + PreparedStatement statement = con.prepareStatement("DELETE FROM clan_subpledges WHERE clan_id=?"); statement.setInt(1, clanId); statement.execute(); statement.close(); diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/L2Clan.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/L2Clan.java index 15769567..e1f7fceb 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/L2Clan.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/L2Clan.java @@ -29,9 +29,11 @@ import com.l2jbr.gameserver.instancemanager.SiegeManager; import com.l2jbr.gameserver.model.actor.instance.L2PcInstance; import com.l2jbr.gameserver.model.database.ClanData; +import com.l2jbr.gameserver.model.database.ClanSkills; import com.l2jbr.gameserver.model.database.repository.CharacterRepository; import com.l2jbr.gameserver.model.database.repository.ClanPrivsRepository; import com.l2jbr.gameserver.model.database.repository.ClanRepository; +import com.l2jbr.gameserver.model.database.repository.ClanSkillRepository; import com.l2jbr.gameserver.network.SystemMessageId; import com.l2jbr.gameserver.serverpackets.*; import com.l2jbr.gameserver.util.Util; @@ -734,36 +736,13 @@ private void restore(ClanData clanData) { } private void restoreSkills() { - java.sql.Connection con = null; - - try { - // Retrieve all skills of this L2PcInstance from the database - con = L2DatabaseFactory.getInstance().getConnection(); - PreparedStatement statement = con.prepareStatement("SELECT skill_id,skill_level FROM clan_skills WHERE clan_id=?"); - statement.setInt(1, getClanId()); - - ResultSet rset = statement.executeQuery(); - - // Go though the recordset of this SQL query - while (rset.next()) { - int id = rset.getInt("skill_id"); - int level = rset.getInt("skill_level"); - // Create a L2Skill object for each record - L2Skill skill = SkillTable.getInstance().getInfo(id, level); - // Add the L2Skill object to the L2Clan _skills - _skills.put(skill.getId(), skill); - } - - rset.close(); - statement.close(); - } catch (Exception e) { - _log.warn("Could not restore clan skills: " + e); - } finally { - try { - con.close(); - } catch (Exception e) { - } - } + ClanSkillRepository repository = DatabaseAccess.getRepository(ClanSkillRepository.class); + repository.findAllByClan(getClanId()).forEach( clanSkill -> { + int id = clanSkill.getSkillId(); + int level = clanSkill.getSkillLevel(); + L2Skill skill = SkillTable.getInstance().getInfo(id, level); + _skills.put(skill.getId(), skill); + }); } /** @@ -804,40 +783,17 @@ public L2Skill addSkill(L2Skill newSkill) { */ public L2Skill addNewSkill(L2Skill newSkill) { L2Skill oldSkill = null; - java.sql.Connection con = null; if (newSkill != null) { - // Replace oldSkill by newSkill or Add the newSkill oldSkill = _skills.put(newSkill.getId(), newSkill); - try { - con = L2DatabaseFactory.getInstance().getConnection(); - PreparedStatement statement; - - if (oldSkill != null) { - statement = con.prepareStatement("UPDATE clan_skills SET skill_level=? WHERE skill_id=? AND clan_id=?"); - statement.setInt(1, newSkill.getLevel()); - statement.setInt(2, oldSkill.getId()); - statement.setInt(3, getClanId()); - statement.execute(); - statement.close(); - } else { - statement = con.prepareStatement("INSERT INTO clan_skills (clan_id,skill_id,skill_level,skill_name) VALUES (?,?,?,?)"); - statement.setInt(1, getClanId()); - statement.setInt(2, newSkill.getId()); - statement.setInt(3, newSkill.getLevel()); - statement.setString(4, newSkill.getName()); - statement.execute(); - statement.close(); - } - } catch (Exception e) { - _log.warn("Error could not store char skills: " + e); - } finally { - try { - con.close(); - } catch (Exception e) { - } + ClanSkillRepository repository = DatabaseAccess.getRepository(ClanSkillRepository.class); + if (oldSkill != null) { + repository.updateSkillLevel(getClanId(), oldSkill.getId(), newSkill.getLevel()); + } else { + ClanSkills clanSkill = new ClanSkills(getClanId(), newSkill); + repository.save(clanSkill); } for (L2ClanMember temp : _members.values()) { diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/ClanSkills.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/ClanSkills.java index e6e025a4..27e1e680 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/ClanSkills.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/ClanSkills.java @@ -1,10 +1,44 @@ package com.l2jbr.gameserver.model.database; +import com.l2jbr.commons.database.annotation.Column; +import com.l2jbr.commons.database.annotation.Table; +import com.l2jbr.commons.database.model.Entity; +import com.l2jbr.gameserver.model.L2Skill; +import org.springframework.data.annotation.Id; +@Table("clan_skills") +public class ClanSkills extends Entity { + @Id + @Column("clan_id") + private int clanId; + @Column("skill_id") + private int skillId; + @Column("skill_level") + private int skillLevel; + @Column("skill_name") + private String skillName; -public class ClanSkills { - private int clan_id; - private int skill_id; - private int skill_level; - private String skill_name; + public ClanSkills(int clanId, L2Skill newSkill) { + this.clanId = clanId; + this.skillId = newSkill.getId(); + this.skillLevel = newSkill.getLevel(); + this.skillName = newSkill.getName(); + } + + @Override + public Integer getId() { + return clanId; + } + + public int getSkillId() { + return skillId; + } + + public int getSkillLevel() { + return skillLevel; + } + + public String getSkillName() { + return skillName; + } } diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/repository/ClanSkillRepository.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/repository/ClanSkillRepository.java new file mode 100644 index 00000000..4d1b9f23 --- /dev/null +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/repository/ClanSkillRepository.java @@ -0,0 +1,15 @@ +package com.l2jbr.gameserver.model.database.repository; + +import com.l2jbr.gameserver.model.database.ClanSkills; +import org.springframework.data.jdbc.repository.query.Query; +import org.springframework.data.repository.CrudRepository; +import org.springframework.data.repository.query.Param; + +public interface ClanSkillRepository extends CrudRepository { + + @Query("SELECT * FROM clan_skills WHERE clan_id=:clan") + Iterable findAllByClan(@Param("clan") int clanId); + + @Query("UPDATE clan_skills SET skill_level=:level WHERE skill_id=:skill AND clan_id=:clan") + int updateSkillLevel(@Param("clan") int clanId, @Param("skill") int skillId, @Param("level") int skillLevel); +} From a949f2f42154532bd1b3984cde8b88c87ba874fa Mon Sep 17 00:00:00 2001 From: Alisson Oliveira Date: Tue, 1 May 2018 11:15:42 -0300 Subject: [PATCH 049/236] =?UTF-8?q?Remove=20refer=C3=AAncias=20diretas=20?= =?UTF-8?q?=C3=A0=20tabela=20clan=5Fsubpledges?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../gameserver/datatables/ClanTable.java | 15 +-- .../com/l2jbr/gameserver/model/L2Clan.java | 105 ++++-------------- .../model/database/ClanSubpledges.java | 42 ++++++- .../repository/ClanSubpledgesRepository.java | 17 +++ .../accountmanager/SQLAccountManager.java | 9 +- 5 files changed, 86 insertions(+), 102 deletions(-) create mode 100644 Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/repository/ClanSubpledgesRepository.java diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/datatables/ClanTable.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/datatables/ClanTable.java index f99ce88d..e0a121b0 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/datatables/ClanTable.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/datatables/ClanTable.java @@ -27,10 +27,7 @@ import com.l2jbr.gameserver.model.L2Clan; import com.l2jbr.gameserver.model.L2ClanMember; import com.l2jbr.gameserver.model.actor.instance.L2PcInstance; -import com.l2jbr.gameserver.model.database.repository.CastleRepository; -import com.l2jbr.gameserver.model.database.repository.ClanPrivsRepository; -import com.l2jbr.gameserver.model.database.repository.ClanRepository; -import com.l2jbr.gameserver.model.database.repository.ClanSkillRepository; +import com.l2jbr.gameserver.model.database.repository.*; import com.l2jbr.gameserver.model.entity.Siege; import com.l2jbr.gameserver.network.SystemMessageId; import com.l2jbr.gameserver.serverpackets.*; @@ -216,14 +213,12 @@ public synchronized void destroyClan(int clanId) { ClanSkillRepository skillRepository = DatabaseAccess.getRepository(ClanSkillRepository.class); skillRepository.deleteById(clanId); - con = L2DatabaseFactory.getInstance().getConnection(); + ClanSubpledgesRepository subpledgesRepository = DatabaseAccess.getRepository(ClanSubpledgesRepository.class); + subpledgesRepository.deleteById(clanId); - PreparedStatement statement = con.prepareStatement("DELETE FROM clan_subpledges WHERE clan_id=?"); - statement.setInt(1, clanId); - statement.execute(); - statement.close(); + con = L2DatabaseFactory.getInstance().getConnection(); - statement = con.prepareStatement("DELETE FROM clan_wars WHERE clan1=? OR clan2=?"); + PreparedStatement statement = con.prepareStatement("DELETE FROM clan_wars WHERE clan1=? OR clan2=?"); statement.setInt(1, clanId); statement.setInt(2, clanId); statement.execute(); diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/L2Clan.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/L2Clan.java index e1f7fceb..30b0deb5 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/L2Clan.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/L2Clan.java @@ -30,10 +30,8 @@ import com.l2jbr.gameserver.model.actor.instance.L2PcInstance; import com.l2jbr.gameserver.model.database.ClanData; import com.l2jbr.gameserver.model.database.ClanSkills; -import com.l2jbr.gameserver.model.database.repository.CharacterRepository; -import com.l2jbr.gameserver.model.database.repository.ClanPrivsRepository; -import com.l2jbr.gameserver.model.database.repository.ClanRepository; -import com.l2jbr.gameserver.model.database.repository.ClanSkillRepository; +import com.l2jbr.gameserver.model.database.ClanSubpledges; +import com.l2jbr.gameserver.model.database.repository.*; import com.l2jbr.gameserver.network.SystemMessageId; import com.l2jbr.gameserver.serverpackets.*; import com.l2jbr.gameserver.util.Util; @@ -1055,34 +1053,14 @@ public void setPrivs(int privs) { } private void restoreSubPledges() { - java.sql.Connection con = null; - - try { - // Retrieve all subpledges of this clan from the database - con = L2DatabaseFactory.getInstance().getConnection(); - PreparedStatement statement = con.prepareStatement("SELECT sub_pledge_id,name,leader_name FROM clan_subpledges WHERE clan_id=?"); - statement.setInt(1, getClanId()); - ResultSet rset = statement.executeQuery(); - - while (rset.next()) { - int id = rset.getInt("sub_pledge_id"); - String name = rset.getString("name"); - String leaderName = rset.getString("leader_name"); - // Create a SubPledge object for each record - SubPledge pledge = new SubPledge(id, name, leaderName); - _subPledges.put(id, pledge); - } - - rset.close(); - statement.close(); - } catch (Exception e) { - _log.warn("Could not restore clan sub-units: " + e); - } finally { - try { - con.close(); - } catch (Exception e) { - } - } + ClanSubpledgesRepository repository = DatabaseAccess.getRepository(ClanSubpledgesRepository.class); + repository.findAllByClan(getClanId()).forEach(clanSubpledges -> { + int id = clanSubpledges.getSubPledgeId(); + String name = clanSubpledges.getName(); + String leaderName = clanSubpledges.getLeaderName(); + SubPledge pledge = new SubPledge(id, name, leaderName); + _subPledges.put(id, pledge); + }); } /** @@ -1154,39 +1132,21 @@ public SubPledge createSubPledge(L2PcInstance player, int pledgeType, String lea player.sendPacket(sp); return null; } - java.sql.Connection con = null; - try { - con = L2DatabaseFactory.getInstance().getConnection(); - PreparedStatement statement = con.prepareStatement("INSERT INTO clan_subpledges (clan_id,sub_pledge_id,name,leader_name) values (?,?,?,?)"); - statement.setInt(1, getClanId()); - statement.setInt(2, pledgeType); - statement.setString(3, subPledgeName); - if (pledgeType != -1) { - statement.setString(4, leaderName); - } else { - statement.setString(4, ""); - } - statement.execute(); - statement.close(); - subPledge = new SubPledge(pledgeType, subPledgeName, leaderName); - _subPledges.put(pledgeType, subPledge); + String leader = pledgeType == -1 ? "" : leaderName; + ClanSubpledges subpledge = new ClanSubpledges(getClanId(), pledgeType, subPledgeName, leader); + ClanSubpledgesRepository repository = DatabaseAccess.getRepository(ClanSubpledgesRepository.class); + repository.save(subpledge); - if (pledgeType != -1) { - setReputationScore(getReputationScore() - 2500, true); - } + subPledge = new SubPledge(pledgeType, subPledgeName, leaderName); + _subPledges.put(pledgeType, subPledge); - if (Config.DEBUG) { - _log.debug("New sub_clan saved in db: " + getClanId() + "; " + pledgeType); - } - } catch (Exception e) { - _log.warn("error while saving new sub_clan to db " + e); - } finally { - try { - con.close(); - } catch (Exception e) { - } + if (pledgeType != -1) { + setReputationScore(getReputationScore() - 2500, true); } + + _log.debug("New sub_clan saved in db: {} - {} ", getClanId(), pledgeType); + broadcastToOnlineMembers(new PledgeShowInfoUpdate(_leader.getClan())); broadcastToOnlineMembers(new PledgeReceiveSubPledgeCreated(subPledge)); return subPledge; @@ -1220,26 +1180,9 @@ public int getAvailablePledgeTypes(int pledgeType) { } public void updateSubPledgeInDB(int pledgeType) { - java.sql.Connection con = null; - try { - con = L2DatabaseFactory.getInstance().getConnection(); - PreparedStatement statement = con.prepareStatement("UPDATE clan_subpledges SET leader_name=? WHERE clan_id=? AND sub_pledge_id=?"); - statement.setString(1, getSubPledge(pledgeType).getLeaderName()); - statement.setInt(2, getClanId()); - statement.setInt(3, pledgeType); - statement.execute(); - statement.close(); - if (Config.DEBUG) { - _log.debug("New subpledge leader saved in db: " + getClanId()); - } - } catch (Exception e) { - _log.warn("error while saving new clan leader to db " + e); - } finally { - try { - con.close(); - } catch (Exception e) { - } - } + ClanSubpledgesRepository repository = DatabaseAccess.getRepository(ClanSubpledgesRepository.class); + repository.updateLeader(getClanId(), pledgeType, getSubPledge(pledgeType).getLeaderName()); + _log.debug("New subpledge leader saved in db: {} ", getClanId()); } private void restoreRankPrivs() { diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/ClanSubpledges.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/ClanSubpledges.java index 46fcdea5..975e9185 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/ClanSubpledges.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/ClanSubpledges.java @@ -1,9 +1,43 @@ package com.l2jbr.gameserver.model.database; -public class ClanSubpledges { +import com.l2jbr.commons.database.annotation.Column; +import com.l2jbr.commons.database.annotation.Table; +import com.l2jbr.commons.database.model.Entity; +import org.springframework.data.annotation.Id; - private int clan_id; - private int sub_pledge_id; +@Table("clan_subpledges") +public class ClanSubpledges extends Entity { + + @Id + @Column("clan_id") + private int clanId; + @Column("sub_pledge_id") + private int subPledgeId; private String name; - private String leader_name; + @Column("leader_name") + private String leaderName; + + public ClanSubpledges(int clanId, int subPledgeId, String subPledgeName, String leader) { + this.clanId = clanId; + this.subPledgeId = subPledgeId; + this.name = subPledgeName; + this.leaderName = leader; + } + + @Override + public Integer getId() { + return clanId; + } + + public int getSubPledgeId() { + return subPledgeId; + } + + public String getName() { + return name; + } + + public String getLeaderName() { + return leaderName; + } } diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/repository/ClanSubpledgesRepository.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/repository/ClanSubpledgesRepository.java new file mode 100644 index 00000000..89b03fbd --- /dev/null +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/repository/ClanSubpledgesRepository.java @@ -0,0 +1,17 @@ +package com.l2jbr.gameserver.model.database.repository; + +import com.l2jbr.gameserver.model.database.ClanSubpledges; +import org.springframework.data.jdbc.repository.query.Modifying; +import org.springframework.data.jdbc.repository.query.Query; +import org.springframework.data.repository.CrudRepository; +import org.springframework.data.repository.query.Param; + +public interface ClanSubpledgesRepository extends CrudRepository { + + @Query("SELECT * FROM clan_subpledges WHERE clan_id=:clan") + Iterable findAllByClan(@Param("clan") int clanId); + + @Modifying + @Query("UPDATE clan_subpledges SET leader_name=:leader WHERE clan_id=:clan AND sub_pledge_id=:subpledge") + int updateLeader(@Param("clan") int clanId, @Param("subpledge") int pledgeId, @Param("leader") String leaderName); +} diff --git a/Tools/src/main/com.l2jbr.tools/com/l2jbr/tools/accountmanager/SQLAccountManager.java b/Tools/src/main/com.l2jbr.tools/com/l2jbr/tools/accountmanager/SQLAccountManager.java index e21cca30..fbaf3553 100644 --- a/Tools/src/main/com.l2jbr.tools/com/l2jbr/tools/accountmanager/SQLAccountManager.java +++ b/Tools/src/main/com.l2jbr.tools/com/l2jbr/tools/accountmanager/SQLAccountManager.java @@ -155,6 +155,7 @@ private static void deleteAccount(String login) throws SQLException { CharacterRepository characterRepository = DatabaseAccess.getRepository(CharacterRepository.class); ClanRepository clanRepository = DatabaseAccess.getRepository(ClanRepository.class); ClanPrivsRepository clanPrivsRepository = DatabaseAccess.getRepository(ClanPrivsRepository.class); + ClanSubpledgesRepository subpledgesRepository = DatabaseAccess.getRepository(ClanSubpledgesRepository.class); characterRepository.findAllByAccountName(login).forEach(character -> { final int clanId = character.getClanId(); @@ -172,13 +173,7 @@ private static void deleteAccount(String login) throws SQLException { // Remove All From clan characterRepository.removeClanId(clanId); clanPrivsRepository.deleteById(clanId); - - - statement.close(); - statement = con.prepareStatement("DELETE FROM clan_subpledges WHERE clan_id=?;"); - statement.setInt(1, clanId); - statement.executeUpdate(); - + subpledgesRepository.deleteById(clanId); clanRepository.delete(clanData); } catch (Exception e) { e.printStackTrace(); From 9f6c1fe14938126040c94cb38940bc78d4e38c6c Mon Sep 17 00:00:00 2001 From: Alisson Oliveira Date: Tue, 1 May 2018 18:15:32 -0300 Subject: [PATCH 050/236] =?UTF-8?q?Remove=20refer=C3=AAncias=20diretas=20?= =?UTF-8?q?=C3=A0=20tabela=20clan=5Fwars?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../gameserver/datatables/ClanTable.java | 136 ++++-------------- .../usercommandhandlers/ClanWarsList.java | 119 ++++++--------- .../gameserver/model/database/ClanData.java | 2 +- .../gameserver/model/database/ClanWars.java | 32 ++++- .../database/repository/ClanRepository.java | 22 +++ .../repository/ClanWarsRepository.java | 23 +++ .../accountmanager/SQLAccountManager.java | 28 ++-- 7 files changed, 156 insertions(+), 206 deletions(-) create mode 100644 Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/repository/ClanWarsRepository.java diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/datatables/ClanTable.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/datatables/ClanTable.java index e0a121b0..0bfd7336 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/datatables/ClanTable.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/datatables/ClanTable.java @@ -20,7 +20,6 @@ import com.l2jbr.commons.Config; import com.l2jbr.commons.database.DatabaseAccess; -import com.l2jbr.commons.database.L2DatabaseFactory; import com.l2jbr.gameserver.ThreadPoolManager; import com.l2jbr.gameserver.idfactory.IdFactory; import com.l2jbr.gameserver.instancemanager.SiegeManager; @@ -35,8 +34,6 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import java.sql.PreparedStatement; -import java.sql.ResultSet; import java.util.LinkedHashMap; import java.util.Map; @@ -80,7 +77,7 @@ private ClanTable() { } }); _log.info(getMessage("info.restored.clans"), _clans.size()); - restorewars(); + restoreWars(); } /** @@ -202,42 +199,28 @@ public synchronized void destroyClan(int clanId) { _clans.remove(clanId); IdFactory.getInstance().releaseId(clanId); - java.sql.Connection con = null; - try { - ClanRepository clanRepository = DatabaseAccess.getRepository(ClanRepository.class); - clanRepository.deleteById(clanId); + ClanRepository clanRepository = DatabaseAccess.getRepository(ClanRepository.class); + clanRepository.deleteById(clanId); - ClanPrivsRepository clanPrivsRepository = DatabaseAccess.getRepository(ClanPrivsRepository.class); - clanPrivsRepository.deleteById(clanId); + ClanPrivsRepository clanPrivsRepository = DatabaseAccess.getRepository(ClanPrivsRepository.class); + clanPrivsRepository.deleteById(clanId); - ClanSkillRepository skillRepository = DatabaseAccess.getRepository(ClanSkillRepository.class); - skillRepository.deleteById(clanId); + ClanSkillRepository skillRepository = DatabaseAccess.getRepository(ClanSkillRepository.class); + skillRepository.deleteById(clanId); - ClanSubpledgesRepository subpledgesRepository = DatabaseAccess.getRepository(ClanSubpledgesRepository.class); - subpledgesRepository.deleteById(clanId); + ClanSubpledgesRepository subpledgesRepository = DatabaseAccess.getRepository(ClanSubpledgesRepository.class); + subpledgesRepository.deleteById(clanId); - con = L2DatabaseFactory.getInstance().getConnection(); + ClanWarsRepository warsRepository = DatabaseAccess.getRepository(ClanWarsRepository.class); + warsRepository.deleteByClan(clanId); - PreparedStatement statement = con.prepareStatement("DELETE FROM clan_wars WHERE clan1=? OR clan2=?"); - statement.setInt(1, clanId); - statement.setInt(2, clanId); - statement.execute(); - statement.close(); - if (castleId != 0) { - CastleRepository castleRepository = DatabaseAccess.getRepository(CastleRepository.class); - castleRepository.updateTaxById(castleId, 0); - } - - _log.debug(getMessage("debug.clan.removed"), clanId); - } catch (Exception e) { - _log.warn(getMessage("error.clan.remove"), e); - } finally { - try { - con.close(); - } catch (Exception e) { - } + if (castleId != 0) { + CastleRepository castleRepository = DatabaseAccess.getRepository(CastleRepository.class); + castleRepository.updateTaxById(castleId, 0); } + + _log.debug(getMessage("debug.clan.removed"), clanId); } public void scheduleRemoveClan(final int clanId) { @@ -268,27 +251,10 @@ public void storeclanswars(int clanId1, int clanId2) { clan2.setAttackerClan(clan1); clan1.broadcastClanStatus(); clan2.broadcastClanStatus(); - java.sql.Connection con = null; - try { - con = L2DatabaseFactory.getInstance().getConnection(); - PreparedStatement statement; - statement = con.prepareStatement("REPLACE INTO clan_wars (clan1, clan2, wantspeace1, wantspeace2) VALUES(?,?,?,?)"); - statement.setInt(1, clanId1); - statement.setInt(2, clanId2); - statement.setInt(3, 0); - statement.setInt(4, 0); - statement.execute(); - statement.close(); - } catch (Exception e) { - _log.warn("could not store clans wars data:" + e); - } finally { - try { - con.close(); - } catch (Exception e) { - } - } - // SystemMessage msg = new SystemMessage(SystemMessageId.WAR_WITH_THE_S1_CLAN_HAS_BEGUN); - // + + ClanWarsRepository repository = DatabaseAccess.getRepository(ClanWarsRepository.class); + repository.saveOrUpdate(clanId1, clanId2, 0, 0); + SystemMessage msg = new SystemMessage(SystemMessageId.CLAN_WAR_DECLARED_AGAINST_S1_IF_KILLED_LOSE_LOW_EXP); msg.addString(clan2.getName()); clan1.broadcastToOnlineMembers(msg); @@ -308,38 +274,10 @@ public void deleteclanswars(int clanId1, int clanId2) { clan2.deleteAttackerClan(clan1); clan1.broadcastClanStatus(); clan2.broadcastClanStatus(); - // for(L2ClanMember player: clan1.getMembers()) - // { - // if(player.getPlayerInstance()!=null) - // player.getPlayerInstance().setWantsPeace(0); - // } - // for(L2ClanMember player: clan2.getMembers()) - // { - // if(player.getPlayerInstance()!=null) - // player.getPlayerInstance().setWantsPeace(0); - // } - java.sql.Connection con = null; - try { - con = L2DatabaseFactory.getInstance().getConnection(); - PreparedStatement statement; - statement = con.prepareStatement("DELETE FROM clan_wars WHERE clan1=? AND clan2=?"); - statement.setInt(1, clanId1); - statement.setInt(2, clanId2); - statement.execute(); - // statement = con.prepareStatement("DELETE FROM clan_wars WHERE clan1=? AND clan2=?"); - // statement.setInt(1,clanId2); - // statement.setInt(2,clanId1); - // statement.execute(); - - statement.close(); - } catch (Exception e) { - _log.warn("could not restore clans wars data:" + e); - } finally { - try { - con.close(); - } catch (Exception e) { - } - } + + ClanWarsRepository repository = DatabaseAccess.getRepository(ClanWarsRepository.class); + repository.deleteWar(clanId1, clanId2); + // SystemMessage msg = new SystemMessage(SystemMessageId.WAR_WITH_THE_S1_CLAN_HAS_ENDED); SystemMessage msg = new SystemMessage(SystemMessageId.WAR_AGAINST_S1_HAS_STOPPED); msg.addString(clan2.getName()); @@ -366,25 +304,11 @@ public void checkSurrender(L2Clan clan1, L2Clan clan2) { } } - private void restorewars() { - java.sql.Connection con = null; - try { - con = L2DatabaseFactory.getInstance().getConnection(); - PreparedStatement statement; - statement = con.prepareStatement("SELECT clan1, clan2, wantspeace1, wantspeace2 FROM clan_wars"); - ResultSet rset = statement.executeQuery(); - while (rset.next()) { - getClan(rset.getInt("clan1")).setEnemyClan(rset.getInt("clan2")); - getClan(rset.getInt("clan2")).setAttackerClan(rset.getInt("clan1")); - } - statement.close(); - } catch (Exception e) { - _log.warn("could not restore clan wars data:" + e); - } finally { - try { - con.close(); - } catch (Exception e) { - } - } + private void restoreWars() { + ClanWarsRepository repository = DatabaseAccess.getRepository(ClanWarsRepository.class); + repository.findAll().forEach(clanWars -> { + getClan(clanWars.getClan1()).setEnemyClan(clanWars.getClan2()); + getClan(clanWars.getClan2()).setAttackerClan(clanWars.getClan1()); + }); } } diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/handler/usercommandhandlers/ClanWarsList.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/handler/usercommandhandlers/ClanWarsList.java index b9e08efa..9f406eae 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/handler/usercommandhandlers/ClanWarsList.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/handler/usercommandhandlers/ClanWarsList.java @@ -19,10 +19,13 @@ package com.l2jbr.gameserver.handler.usercommandhandlers; +import com.l2jbr.commons.database.DatabaseAccess; import com.l2jbr.commons.database.L2DatabaseFactory; import com.l2jbr.gameserver.handler.IUserCommandHandler; import com.l2jbr.gameserver.model.L2Clan; import com.l2jbr.gameserver.model.actor.instance.L2PcInstance; +import com.l2jbr.gameserver.model.database.ClanData; +import com.l2jbr.gameserver.model.database.repository.ClanRepository; import com.l2jbr.gameserver.network.SystemMessageId; import com.l2jbr.gameserver.serverpackets.SystemMessage; @@ -62,83 +65,45 @@ public boolean useUserCommand(int id, L2PcInstance activeChar) activeChar.sendMessage("You are not in a clan."); return false; } - - SystemMessage sm; - java.sql.Connection con = null; - - try - { - con = L2DatabaseFactory.getInstance().getConnection(); - PreparedStatement statement; - - if (id == 88) - { - // Attack List - activeChar.sendPacket(new SystemMessage(SystemMessageId.CLANS_YOU_DECLARED_WAR_ON)); - statement = con.prepareStatement("select clan_name,clan_id,ally_id,ally_name from clan_data,clan_wars where clan1=? and clan_id=clan2 and clan2 not in (select clan1 from clan_wars where clan2=?)"); - statement.setInt(1, clan.getClanId()); - statement.setInt(2, clan.getClanId()); - } - else if (id == 89) - { - // Under Attack List - activeChar.sendPacket(new SystemMessage(SystemMessageId.CLANS_THAT_HAVE_DECLARED_WAR_ON_YOU)); - statement = con.prepareStatement("select clan_name,clan_id,ally_id,ally_name from clan_data,clan_wars where clan2=? and clan_id=clan1 and clan1 not in (select clan2 from clan_wars where clan1=?)"); - statement.setInt(1, clan.getClanId()); - statement.setInt(2, clan.getClanId()); - } - else - // ID = 90 - { - // War List - activeChar.sendPacket(new SystemMessage(SystemMessageId.WAR_LIST)); - statement = con.prepareStatement("select clan_name,clan_id,ally_id,ally_name from clan_data,clan_wars where clan1=? and clan_id=clan2 and clan2 in (select clan1 from clan_wars where clan2=?)"); - statement.setInt(1, clan.getClanId()); - statement.setInt(2, clan.getClanId()); - } - - ResultSet rset = statement.executeQuery(); - - while (rset.next()) - { - String clanName = rset.getString("clan_name"); - int ally_id = rset.getInt("ally_id"); - - if (ally_id > 0) - { - // Target With Ally - sm = new SystemMessage(SystemMessageId.S1_S2_ALLIANCE); - sm.addString(clanName); - sm.addString(rset.getString("ally_name")); - } - else - { - // Target Without Ally - sm = new SystemMessage(SystemMessageId.S1_NO_ALLI_EXISTS); - sm.addString(clanName); - } - - activeChar.sendPacket(sm); - } - - activeChar.sendPacket(new SystemMessage(SystemMessageId.FRIEND_LIST_FOOT)); - - rset.close(); - statement.close(); - } - catch (Exception e) - { - } - finally - { - try - { - con.close(); - } - catch (Exception e) - { - } - } + + Iterable clans; + ClanRepository repository = DatabaseAccess.getRepository(ClanRepository.class); + if (id == 88) { + // Attack List + activeChar.sendPacket(new SystemMessage(SystemMessageId.CLANS_YOU_DECLARED_WAR_ON)); + clans = repository.findAllByOnlyAttacker(clan.getClanId()); + } + else if (id == 89) { + // Under Attack List + activeChar.sendPacket(new SystemMessage(SystemMessageId.CLANS_THAT_HAVE_DECLARED_WAR_ON_YOU)); + clans = repository.findAllByOnlyUnderAttack(clan.getClanId()); + } + else { // ID = 90 + // War List + activeChar.sendPacket(new SystemMessage(SystemMessageId.WAR_LIST)); + clans = repository.findAllInWar(clan.getClanId()); + } + + clans.forEach(clanData -> { + String clanName = clanData.getClanName(); + int ally_id = clanData.getAllyId(); + + SystemMessage sm; + if (ally_id > 0) { + // Target With Ally + sm = new SystemMessage(SystemMessageId.S1_S2_ALLIANCE); + sm.addString(clanName); + sm.addString(clanData.getAllyName()); + } + else { + // Target Without Ally + sm = new SystemMessage(SystemMessageId.S1_NO_ALLI_EXISTS); + sm.addString(clanName); + } + activeChar.sendPacket(sm); + }); + + activeChar.sendPacket(new SystemMessage(SystemMessageId.FRIEND_LIST_FOOT)); return true; } diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/ClanData.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/ClanData.java index c072c8d7..6249eeb3 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/ClanData.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/ClanData.java @@ -8,8 +8,8 @@ @Table("clan_data") public class ClanData extends Entity { - @Column("clan_id") @Id + @Column("clan_id") private Integer clanId; @Column("clan_name") private String clanName; diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/ClanWars.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/ClanWars.java index 80a921b6..0ee98ad4 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/ClanWars.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/ClanWars.java @@ -1,12 +1,36 @@ package com.l2jbr.gameserver.model.database; +import com.l2jbr.commons.database.annotation.Table; +import com.l2jbr.commons.database.model.Entity; +import org.springframework.data.annotation.Id; +@Table("clan_wars") +public class ClanWars extends Entity { -public class ClanWars { - - private String clan1; - private String clan2; + @Id + private int clan1; + private int clan2; private int wantspeace1; private int wantspeace2; + @Override + public Integer getId() { + return clan1; + } + + public int getClan1() { + return clan1; + } + + public int getClan2() { + return clan2; + } + + public int getWantspeace1() { + return wantspeace1; + } + + public int getWantspeace2() { + return wantspeace2; + } } diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/repository/ClanRepository.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/repository/ClanRepository.java index e873af6a..79eb37c3 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/repository/ClanRepository.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/repository/ClanRepository.java @@ -6,6 +6,8 @@ import org.springframework.data.repository.CrudRepository; import org.springframework.data.repository.query.Param; +import java.util.Optional; + public interface ClanRepository extends CrudRepository { @Modifying @@ -38,4 +40,24 @@ public interface ClanRepository extends CrudRepository { @Modifying @Query("UPDATE clan_data SET crest_large_id=:crest WHERE clan_id=:objectId") int updateLargeClanCrestById(@Param("objectId") int objectId, @Param("crest") int crestId); + + @Query("SELECT * FROM clan_data WHERE leader_id=:leader") + Optional findByLeaderId(@Param("leader") int charObjectId); + + @Query("SELECT c.* FROM clan_data c " + + "LEFT JOIN clan_wars w ON c.clan_id=w.clan2 " + + "WHERE w.clan1=:clan AND NOT EXISTS (SELECT 1 FROM clan_wars WHERE clan2=:clan AND clan1=c.clan_id)") + Iterable findAllByOnlyAttacker(@Param("clan") int clanId); + + @Query("SELECT c.* FROM clan_data c " + + "LEFT JOIN clan_wars w ON c.clan_id=w.clan1 " + + "WHERE w.clan2=:clan AND NOT EXISTS (SELECT 1 FROM clan_wars WHERE clan1=:clan AND clan2=c.clan_id)") + Iterable findAllByOnlyUnderAttack(@Param("clan") int clanId); + + @Query("SELECT c.* FROM clan_data c " + + "LEFT JOIN clan_wars w ON c.clan_id=w.clan2 " + + "WHERE w.clan1=:clan AND EXISTS (SELECT 1 FROM clan_wars WHERE clan2=:clan AND clan1=c.clan_id)") + Iterable findAllInWar(@Param("clan") int clanId); + + } diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/repository/ClanWarsRepository.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/repository/ClanWarsRepository.java new file mode 100644 index 00000000..980cf39e --- /dev/null +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/repository/ClanWarsRepository.java @@ -0,0 +1,23 @@ +package com.l2jbr.gameserver.model.database.repository; + +import com.l2jbr.gameserver.model.database.ClanWars; +import org.springframework.data.jdbc.repository.query.Modifying; +import org.springframework.data.jdbc.repository.query.Query; +import org.springframework.data.repository.CrudRepository; +import org.springframework.data.repository.query.Param; + +public interface ClanWarsRepository extends CrudRepository { + + @Modifying + @Query("DELETE FROM clan_wars WHERE clan1=:clan OR clan2=:clan") + int deleteByClan(@Param("clan") int clanId); + + @Modifying + @Query("REPLACE INTO clan_wars (clan1, clan2, wantspeace1, wantspeace2) VALUES(:clan1,:clan2,:wantsPeace1,:wantsPeace2)") + int saveOrUpdate(@Param("clan1") int clanId1, @Param("clan2") int clanId2, @Param("wantsPeace1") int wantsPeace1, + @Param("wantsPeace2") int wantsPeace2); + + @Modifying + @Query("DELETE FROM clan_wars WHERE clan1=:clan1 AND clan2=:clan2") + int deleteWar(@Param("clan1") int clanId1, @Param("clan2") int clanId2); +} diff --git a/Tools/src/main/com.l2jbr.tools/com/l2jbr/tools/accountmanager/SQLAccountManager.java b/Tools/src/main/com.l2jbr.tools/com/l2jbr/tools/accountmanager/SQLAccountManager.java index fbaf3553..9e5218f0 100644 --- a/Tools/src/main/com.l2jbr.tools/com/l2jbr/tools/accountmanager/SQLAccountManager.java +++ b/Tools/src/main/com.l2jbr.tools/com/l2jbr/tools/accountmanager/SQLAccountManager.java @@ -156,28 +156,20 @@ private static void deleteAccount(String login) throws SQLException { ClanRepository clanRepository = DatabaseAccess.getRepository(ClanRepository.class); ClanPrivsRepository clanPrivsRepository = DatabaseAccess.getRepository(ClanPrivsRepository.class); ClanSubpledgesRepository subpledgesRepository = DatabaseAccess.getRepository(ClanSubpledgesRepository.class); + ClanWarsRepository warsRepository = DatabaseAccess.getRepository(ClanWarsRepository.class); characterRepository.findAllByAccountName(login).forEach(character -> { - final int clanId = character.getClanId(); - clanRepository.findById(clanId).ifPresent(clanData -> { - + clanRepository.findByLeaderId(character.getObjectId()).ifPresent(clanData -> { + int clanId = clanData.getClanId(); // Clan Leader System.out.println("Deleting clan " + clanData.getClanName() + "."); - try { - PreparedStatement statement = con.prepareStatement("DELETE FROM clan_wars WHERE clan1=? OR clan2=?;"); - statement.setEscapeProcessing(true); - statement.setString(1, clanData.getClanName()); - statement.setString(2, clanData.getClanName()); - statement.executeUpdate(); - - // Remove All From clan - characterRepository.removeClanId(clanId); - clanPrivsRepository.deleteById(clanId); - subpledgesRepository.deleteById(clanId); - clanRepository.delete(clanData); - } catch (Exception e) { - e.printStackTrace(); - } + + // Remove All From clan + warsRepository.deleteByClan(clanId); + characterRepository.removeClanId(clanId); + clanPrivsRepository.deleteById(clanId); + subpledgesRepository.deleteById(clanId); + clanRepository.delete(clanData); }); System.out.println("Deleting character " + character.getCharName()); From 14db140ede57dee820db99d9e78377654fe143ec Mon Sep 17 00:00:00 2001 From: Alisson Oliveira Date: Tue, 1 May 2018 18:40:14 -0300 Subject: [PATCH 051/236] =?UTF-8?q?Remove=20refer=C3=AAncias=20diretas=20?= =?UTF-8?q?=C3=A0=20tabela=20clanhall=5Ffunctions?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../model/database/ClanHallFunctions.java | 46 +++++++++- .../ClanHallFunctionRepository.java | 22 +++++ .../gameserver/model/entity/ClanHall.java | 92 ++++--------------- 3 files changed, 82 insertions(+), 78 deletions(-) create mode 100644 Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/repository/ClanHallFunctionRepository.java diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/ClanHallFunctions.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/ClanHallFunctions.java index 41356017..1c9a054a 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/ClanHallFunctions.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/ClanHallFunctions.java @@ -1,13 +1,53 @@ package com.l2jbr.gameserver.model.database; +import com.l2jbr.commons.database.annotation.Column; +import com.l2jbr.commons.database.annotation.Table; +import com.l2jbr.commons.database.model.Entity; +import org.springframework.data.annotation.Id; +@Table("clanhall_functions") +public class ClanHallFunctions extends Entity { -public class ClanHallFunctions { - - private int hall_id; + @Id + @Column("hall_Id") + private int hallId; private int type; private int lvl; private int lease; private long rate; private long endTime; + + public ClanHallFunctions(int id, int type, int lvl, int lease, long rate, long endTime) { + this.hallId = id; + this.type = type; + this.lvl =lvl; + this.lease = lease; + this.rate = rate; + this.endTime = endTime; + } + + @Override + public Integer getId() { + return hallId; + } + + public int getType() { + return type; + } + + public int getLvl() { + return lvl; + } + + public int getLease() { + return lease; + } + + public long getRate() { + return rate; + } + + public long getEndTime() { + return endTime; + } } diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/repository/ClanHallFunctionRepository.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/repository/ClanHallFunctionRepository.java new file mode 100644 index 00000000..aab1ba60 --- /dev/null +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/repository/ClanHallFunctionRepository.java @@ -0,0 +1,22 @@ +package com.l2jbr.gameserver.model.database.repository; + +import com.l2jbr.gameserver.model.database.ClanHallFunctions; +import org.springframework.data.jdbc.repository.query.Modifying; +import org.springframework.data.jdbc.repository.query.Query; +import org.springframework.data.repository.CrudRepository; +import org.springframework.data.repository.query.Param; + +public interface ClanHallFunctionRepository extends CrudRepository { + + @Modifying + @Query("UPDATE clanhall_functions SET lvl=:lvl, lease=:lease, endTime=:endTime WHERE hall_id=:hall AND type=:id") + int updateByType(@Param("hall") int hallId, @Param("type") int type, @Param("lvl") int lvl, @Param("lease") int lease, + @Param("endTime") long endTime); + + @Query("SELECT * FROM clanhall_functions WHERE hall_id=:hall") + Iterable findAllByHall(@Param("hall") int hallId); + + @Modifying + @Query("DELETE FROM clanhall_functions WHERE hall_id=:hall AND type=:type") + int deleteByType(@Param("hall") int hallId, @Param("type") int type); +} diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/entity/ClanHall.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/entity/ClanHall.java index f4a31ab2..6fac17bf 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/entity/ClanHall.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/entity/ClanHall.java @@ -30,6 +30,8 @@ import com.l2jbr.gameserver.model.L2Clan; import com.l2jbr.gameserver.model.actor.instance.L2DoorInstance; import com.l2jbr.gameserver.model.actor.instance.L2PcInstance; +import com.l2jbr.gameserver.model.database.ClanHallFunctions; +import com.l2jbr.gameserver.model.database.repository.ClanHallFunctionRepository; import com.l2jbr.gameserver.model.database.repository.ClanHallRepository; import com.l2jbr.gameserver.model.zone.type.L2ClanHallZone; import com.l2jbr.gameserver.network.SystemMessageId; @@ -177,36 +179,12 @@ public void run() { } public void dbSave(boolean newFunction) { - java.sql.Connection con = null; - try { - PreparedStatement statement; - - con = L2DatabaseFactory.getInstance().getConnection(); - if (newFunction) { - statement = con.prepareStatement("INSERT INTO clanhall_functions (hall_id, type, lvl, lease, rate, endTime) VALUES (?,?,?,?,?,?)"); - statement.setInt(1, getId()); - statement.setInt(2, getType()); - statement.setInt(3, getLvl()); - statement.setInt(4, getLease()); - statement.setLong(5, getRate()); - statement.setLong(6, getEndTime()); - } else { - statement = con.prepareStatement("UPDATE clanhall_functions SET lvl=?, lease=?, endTime=? WHERE hall_id=? AND type=?"); - statement.setInt(1, getLvl()); - statement.setInt(2, getLease()); - statement.setLong(3, getEndTime()); - statement.setInt(4, getId()); - statement.setInt(5, getType()); - } - statement.execute(); - statement.close(); - } catch (Exception e) { - _log.error( "Exception: ClanHall.updateFunctions(int type, int lvl, int lease, long rate, long time, boolean addNew): " + e.getMessage(), e); - } finally { - try { - con.close(); - } catch (Exception e) { - } + ClanHallFunctionRepository repository = DatabaseAccess.getRepository(ClanHallFunctionRepository.class); + if (newFunction) { + ClanHallFunctions function = new ClanHallFunctions(getId(), getType(), getLvl(), getLease(), getRate(), getEndTime()); + repository.save(function); + } else { + repository.updateByType(getId(), getType(), getLvl(), getLease(), getEndTime()); } } } @@ -492,56 +470,20 @@ public void banishForeigners() { _zone.banishForeigners(getOwnerId()); } - /** - * Load All Functions - */ private void loadFunctions() { - java.sql.Connection con = null; - try { - PreparedStatement statement; - ResultSet rs; - con = L2DatabaseFactory.getInstance().getConnection(); - statement = con.prepareStatement("Select * from clanhall_functions where hall_id = ?"); - statement.setInt(1, getId()); - rs = statement.executeQuery(); - while (rs.next()) { - _functions.put(rs.getInt("type"), new ClanHallFunction(rs.getInt("type"), rs.getInt("lvl"), rs.getInt("lease"), 0, rs.getLong("rate"), rs.getLong("endTime"))); - } - statement.close(); - } catch (Exception e) { - _log.error( "Exception: ClanHall.loadFunctions(): " + e.getMessage(), e); - } finally { - try { - con.close(); - } catch (Exception e) { - } - } + ClanHallFunctionRepository repository = DatabaseAccess.getRepository(ClanHallFunctionRepository.class); + repository.findAllByHall(getId()).forEach( function -> { + ClanHallFunction clanHallFunction = new ClanHallFunction(function.getType(), function.getLvl(), function.getLease(), + 0, function.getRate(), function.getEndTime()); + _functions.put(function.getType(), clanHallFunction); + }); } - /** - * Remove function In List and in DB - * - * @param functionType - */ + public void removeFunction(int functionType) { _functions.remove(functionType); - java.sql.Connection con = null; - try { - PreparedStatement statement; - con = L2DatabaseFactory.getInstance().getConnection(); - statement = con.prepareStatement("DELETE FROM clanhall_functions WHERE hall_id=? AND type=?"); - statement.setInt(1, getId()); - statement.setInt(2, functionType); - statement.execute(); - statement.close(); - } catch (Exception e) { - _log.error( "Exception: ClanHall.removeFunctions(int functionType): " + e.getMessage(), e); - } finally { - try { - con.close(); - } catch (Exception e) { - } - } + ClanHallFunctionRepository repository = DatabaseAccess.getRepository(ClanHallFunctionRepository.class); + repository.deleteByType(getId(), functionType); } /** From 17f33f73d2b7f5cf4ac67fdf472c8416e2cb1525 Mon Sep 17 00:00:00 2001 From: Alisson Oliveira Date: Tue, 1 May 2018 18:57:21 -0300 Subject: [PATCH 052/236] =?UTF-8?q?Remove=20refer=C3=AAncias=20diretas=20?= =?UTF-8?q?=C3=A0=20tabela=20cursed=5Fweapons?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../instancemanager/CursedWeaponsManager.java | 83 ++++--------------- .../l2jbr/gameserver/model/CursedWeapon.java | 41 +++------ .../model/database/CursedWeapons.java | 41 ++++++++- .../repository/CursedWeaponRepository.java | 7 ++ 4 files changed, 72 insertions(+), 100 deletions(-) create mode 100644 Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/repository/CursedWeaponRepository.java diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/instancemanager/CursedWeaponsManager.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/instancemanager/CursedWeaponsManager.java index fd244014..3e7b2106 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/instancemanager/CursedWeaponsManager.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/instancemanager/CursedWeaponsManager.java @@ -26,6 +26,7 @@ import com.l2jbr.gameserver.model.actor.instance.L2RiftInvaderInstance; import com.l2jbr.gameserver.model.actor.instance.L2SiegeGuardInstance; import com.l2jbr.gameserver.model.database.repository.CharacterRepository; +import com.l2jbr.gameserver.model.database.repository.CursedWeaponRepository; import com.l2jbr.gameserver.network.SystemMessageId; import com.l2jbr.gameserver.serverpackets.SystemMessage; import org.slf4j.Logger; @@ -163,57 +164,20 @@ private final void load() { } } - private final void restore() { - if (Config.DEBUG) { - System.out.print(" Restoring ... "); - } - Connection con = null; - try { - // Retrieve the L2PcInstance from the characters table of the database - con = L2DatabaseFactory.getInstance().getConnection(); - - PreparedStatement statement = con.prepareStatement("SELECT itemId, playerId, playerKarma, playerPkKills, nbKills, endTime FROM cursed_weapons"); - ResultSet rset = statement.executeQuery(); - - if (rset.next()) { - int itemId = rset.getInt("itemId"); - int playerId = rset.getInt("playerId"); - int playerKarma = rset.getInt("playerKarma"); - int playerPkKills = rset.getInt("playerPkKills"); - int nbKills = rset.getInt("nbKills"); - long endTime = rset.getLong("endTime"); - - CursedWeapon cw = _cursedWeapons.get(itemId); - cw.setPlayerId(playerId); - cw.setPlayerKarma(playerKarma); - cw.setPlayerPkKills(playerPkKills); - cw.setNbKills(nbKills); - cw.setEndTime(endTime); - cw.reActivate(); - } - - rset.close(); - statement.close(); - - if (Config.DEBUG) { - System.out.println("OK"); - } - } catch (Exception e) { - _log.warn("Could not restore CursedWeapons data: " + e); - - if (Config.DEBUG) { - System.out.println("ERROR"); - } - return; - } finally { - try { - con.close(); - } catch (Exception e) { - } - } + private void restore() { + CursedWeaponRepository repository = DatabaseAccess.getRepository(CursedWeaponRepository.class); + repository.findAll().forEach(cursedWeapon -> { + CursedWeapon cw = _cursedWeapons.get(cursedWeapon.getId()); + cw.setPlayerId(cursedWeapon.getPlayerId()); + cw.setPlayerKarma(cursedWeapon.getPlayerKarma()); + cw.setPlayerPkKills(cursedWeapon.getPlayerPkKills()); + cw.setNbKills(cursedWeapon.getNbKills()); + cw.setEndTime(cursedWeapon.getEndTime()); + cw.reActivate(); + }); } - private final void controlPlayers() { + private void controlPlayers() { if (Config.DEBUG) { System.out.print(" Checking players ... "); } @@ -390,25 +354,8 @@ public void checkPlayer(L2PcInstance player) { } public static void removeFromDb(int itemId) { - Connection con = null; - try { - con = L2DatabaseFactory.getInstance().getConnection(); - - // Delete datas - PreparedStatement statement = con.prepareStatement("DELETE FROM cursed_weapons WHERE itemId = ?"); - statement.setInt(1, itemId); - statement.executeUpdate(); - - statement.close(); - con.close(); - } catch (SQLException e) { - _log.error("CursedWeaponsManager: Failed to remove data: " + e); - } finally { - try { - con.close(); - } catch (Exception e) { - } - } + CursedWeaponRepository repository = DatabaseAccess.getRepository(CursedWeaponRepository.class); + repository.deleteById(itemId); } public void saveData() { diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/CursedWeapon.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/CursedWeapon.java index 604c4e58..4d67a4e8 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/CursedWeapon.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/CursedWeapon.java @@ -25,7 +25,9 @@ import com.l2jbr.gameserver.datatables.SkillTable; import com.l2jbr.gameserver.instancemanager.CursedWeaponsManager; import com.l2jbr.gameserver.model.actor.instance.L2PcInstance; +import com.l2jbr.gameserver.model.database.CursedWeapons; import com.l2jbr.gameserver.model.database.repository.CharacterRepository; +import com.l2jbr.gameserver.model.database.repository.CursedWeaponRepository; import com.l2jbr.gameserver.network.SystemMessageId; import com.l2jbr.gameserver.serverpackets.*; import com.l2jbr.gameserver.templates.L2Item; @@ -429,37 +431,14 @@ public void activate(L2PcInstance player, L2ItemInstance item) CursedWeaponsManager.announce(sm); } - public void saveData() - { - if (Config.DEBUG) - { - System.out.println("CursedWeapon: Saving data to disk."); - } - - try (Connection con = L2DatabaseFactory.getInstance().getConnection(); - PreparedStatement ps1 = con.prepareStatement("DELETE FROM cursed_weapons WHERE itemId = ?");) - { - ps1.setInt(1, _itemId); - ps1.executeUpdate(); - - if (_isActivated) - { - try (PreparedStatement ps2 = con.prepareStatement("INSERT INTO cursed_weapons (itemId, playerId, playerKarma, playerPkKills, nbKills, endTime) VALUES (?, ?, ?, ?, ?, ?)")) - { - ps2.setInt(1, _itemId); - ps2.setInt(2, _playerId); - ps2.setInt(3, _playerKarma); - ps2.setInt(4, _playerPkKills); - ps2.setInt(5, _nbKills); - ps2.setLong(6, _endTime); - ps2.executeUpdate(); - } - } - } - catch (SQLException e) - { - _log.error("CursedWeapon: Failed to save data: " + e); - } + public void saveData() { + CursedWeaponRepository repository = DatabaseAccess.getRepository(CursedWeaponRepository.class); + repository.deleteById(_itemId); + + if (_isActivated) { + CursedWeapons weapon = new CursedWeapons(_itemId, _playerId, _playerKarma, _playerPkKills, _nbKills, _endTime); + repository.save(weapon); + } } public void dropIt(L2Character killer) diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/CursedWeapons.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/CursedWeapons.java index 65439ad6..bf988cd8 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/CursedWeapons.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/CursedWeapons.java @@ -1,12 +1,51 @@ package com.l2jbr.gameserver.model.database; +import com.l2jbr.commons.database.annotation.Table; +import com.l2jbr.commons.database.model.Entity; +import org.springframework.data.annotation.Id; +@Table("cursed_weapons") +public class CursedWeapons extends Entity { -public class CursedWeapons { + @Id private int itemId; private int playerId; private int playerKarma; private int playerPkKills; private int nbKills; private long endTime; + + public CursedWeapons(int itemId, int playerId, int playerKarma, int playerPkKills, int nbKills, long endTime) { + this.itemId = itemId; + this.playerId =playerId; + this.playerKarma = playerKarma; + this.playerPkKills = playerPkKills; + this.nbKills = nbKills; + this.endTime = endTime; + } + + @Override + public Integer getId() { + return itemId; + } + + public int getPlayerId() { + return playerId; + } + + public int getPlayerKarma() { + return playerKarma; + } + + public int getPlayerPkKills() { + return playerPkKills; + } + + public int getNbKills() { + return nbKills; + } + + public long getEndTime() { + return endTime; + } } diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/repository/CursedWeaponRepository.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/repository/CursedWeaponRepository.java new file mode 100644 index 00000000..444261bd --- /dev/null +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/repository/CursedWeaponRepository.java @@ -0,0 +1,7 @@ +package com.l2jbr.gameserver.model.database.repository; + +import com.l2jbr.gameserver.model.database.CursedWeapons; +import org.springframework.data.repository.CrudRepository; + +public interface CursedWeaponRepository extends CrudRepository { +} From 7188fbb5d4fa9516c8983e85ad2f1407120ce6c3 Mon Sep 17 00:00:00 2001 From: Alisson Oliveira Date: Tue, 1 May 2018 19:16:04 -0300 Subject: [PATCH 053/236] =?UTF-8?q?Remove=20refer=C3=AAncias=20diretas=20?= =?UTF-8?q?=C3=A0=20tabela=20dimensional=5Frift?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../DimensionalRiftManager.java | 104 ++++++------------ .../model/database/DimensionalRift.java | 59 +++++++++- .../repository/DimensionalRiftRepository.java | 7 ++ 3 files changed, 99 insertions(+), 71 deletions(-) create mode 100644 Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/repository/DimensionalRiftRepository.java diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/instancemanager/DimensionalRiftManager.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/instancemanager/DimensionalRiftManager.java index d948e03d..90be9c6e 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/instancemanager/DimensionalRiftManager.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/instancemanager/DimensionalRiftManager.java @@ -19,6 +19,7 @@ package com.l2jbr.gameserver.instancemanager; import com.l2jbr.commons.Config; +import com.l2jbr.commons.database.DatabaseAccess; import com.l2jbr.commons.database.L2DatabaseFactory; import com.l2jbr.commons.util.Rnd; import com.l2jbr.gameserver.datatables.NpcTable; @@ -27,6 +28,7 @@ import com.l2jbr.gameserver.model.L2Spawn; import com.l2jbr.gameserver.model.actor.instance.L2NpcInstance; import com.l2jbr.gameserver.model.actor.instance.L2PcInstance; +import com.l2jbr.gameserver.model.database.repository.DimensionalRiftRepository; import com.l2jbr.gameserver.model.entity.DimensionalRift; import com.l2jbr.gameserver.serverpackets.NpcHtmlMessage; import com.l2jbr.gameserver.templates.L2NpcTemplate; @@ -77,47 +79,18 @@ public DimensionalRiftRoom getRoom(byte type, byte room) { } private void loadRooms() { - Connection con = null; - - try { - con = L2DatabaseFactory.getInstance().getConnection(); - PreparedStatement s = con.prepareStatement("SELECT * FROM dimensional_rift"); - ResultSet rs = s.executeQuery(); - - while (rs.next()) { - // 0 waiting room, 1 recruit, 2 soldier, 3 officer, 4 captain , 5 commander, 6 hero - byte type = rs.getByte("type"); - byte room_id = rs.getByte("room_id"); - - // coords related - int xMin = rs.getInt("xMin"); - int xMax = rs.getInt("xMax"); - int yMin = rs.getInt("yMin"); - int yMax = rs.getInt("yMax"); - int z1 = rs.getInt("zMin"); - int z2 = rs.getInt("zMax"); - int xT = rs.getInt("xT"); - int yT = rs.getInt("yT"); - int zT = rs.getInt("zT"); - boolean isBossRoom = rs.getByte("boss") > 0; - - if (!_rooms.containsKey(type)) { - _rooms.put(type, new LinkedHashMap()); - } - - _rooms.get(type).put(room_id, new DimensionalRiftRoom(type, room_id, xMin, xMax, yMin, yMax, z1, z2, xT, yT, zT, isBossRoom)); + DimensionalRiftRepository repository = DatabaseAccess.getRepository(DimensionalRiftRepository.class); + repository.findAll().forEach(dimensionalRift -> { + // 0 waiting room, 1 recruit, 2 soldier, 3 officer, 4 captain , 5 commander, 6 hero + byte type = dimensionalRift.getType(); + byte room_id = dimensionalRift.getRoomId(); + + if (!_rooms.containsKey(type)) { + _rooms.put(type, new LinkedHashMap<>()); } + _rooms.get(type).put(room_id, new DimensionalRiftRoom(dimensionalRift)); - s.close(); - con.close(); - } catch (Exception e) { - _log.warn("Can't load Dimension Rift zones. " + e); - } finally { - try { - con.close(); - } catch (Exception e) { /* do nothing */ - } - } + }); int typeSize = _rooms.keySet().size(); int roomSize = 0; @@ -348,37 +321,32 @@ public class DimensionalRiftRoom { private final List _roomSpawns; protected final List _roomMobs; - public DimensionalRiftRoom(byte type, byte room, int xMin, int xMax, int yMin, int yMax, int zMin, int zMax, int xT, int yT, int zT, boolean isBossRoom) { - _type = type; - _room = room; - _xMin = (xMin + 128); - _xMax = (xMax - 128); - _yMin = (yMin + 128); - _yMax = (yMax - 128); - _zMin = zMin; - _zMax = zMax; - _teleportCoords = new int[] - { - xT, - yT, - zT - }; - _isBossRoom = isBossRoom; + public DimensionalRiftRoom(com.l2jbr.gameserver.model.database.DimensionalRift dimensionalRift) { + + _type = dimensionalRift.getType(); + _room = dimensionalRift.getRoomId(); + _xMin = (dimensionalRift.getxMin() + 128); + _xMax = (dimensionalRift.getxMax() - 128); + _yMin = (dimensionalRift.getyMin() + 128); + _yMax = (dimensionalRift.getyMax() - 128); + _zMin = dimensionalRift.getzMin(); + _zMax = dimensionalRift.getzMax(); + _teleportCoords = new int[] { dimensionalRift.getxT(), dimensionalRift.getyT(), dimensionalRift.getzT() }; + _isBossRoom = dimensionalRift.getBoss() > 0; _roomSpawns = new LinkedList<>(); _roomMobs = new LinkedList<>(); - _s = new Polygon(new int[] - { - xMin, - xMax, - xMax, - xMin - }, new int[] - { - yMin, - yMin, - yMax, - yMax - }, 4); + _s = new Polygon(new int[] { + dimensionalRift.getxMin(), + dimensionalRift.getxMax(), + dimensionalRift.getxMax(), + dimensionalRift.getxMin() + }, new int[] { + dimensionalRift.getyMin(), + dimensionalRift.getyMin(), + dimensionalRift.getyMax(), + dimensionalRift.getyMax() + }, 4); + } public int getRandomX() { diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/DimensionalRift.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/DimensionalRift.java index 70b8fd6a..5ff7229b 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/DimensionalRift.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/DimensionalRift.java @@ -1,10 +1,15 @@ package com.l2jbr.gameserver.model.database; +import com.l2jbr.commons.database.annotation.Column; +import com.l2jbr.commons.database.annotation.Table; +import org.springframework.data.annotation.Id; - +@Table("dimensional_rift") public class DimensionalRift { - private int type; - private int room_id; + @Id + private byte type; + @Column("room_id") + private byte roomId; private int xMin; private int xMax; private int yMin; @@ -15,4 +20,52 @@ public class DimensionalRift { private int yT; private int zT; private int boss; + + public byte getType() { + return type; + } + + public byte getRoomId() { + return roomId; + } + + public int getxMin() { + return xMin; + } + + public int getxMax() { + return xMax; + } + + public int getyMin() { + return yMin; + } + + public int getyMax() { + return yMax; + } + + public int getzMin() { + return zMin; + } + + public int getzMax() { + return zMax; + } + + public int getxT() { + return xT; + } + + public int getyT() { + return yT; + } + + public int getzT() { + return zT; + } + + public int getBoss() { + return boss; + } } diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/repository/DimensionalRiftRepository.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/repository/DimensionalRiftRepository.java new file mode 100644 index 00000000..96c0acab --- /dev/null +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/repository/DimensionalRiftRepository.java @@ -0,0 +1,7 @@ +package com.l2jbr.gameserver.model.database.repository; + +import com.l2jbr.gameserver.model.database.DimensionalRift; +import org.springframework.data.repository.CrudRepository; + +public interface DimensionalRiftRepository extends CrudRepository { +} From a3fcc4db7e68650ee1a70e1b477df62a648c45ab Mon Sep 17 00:00:00 2001 From: Alisson Oliveira Date: Tue, 1 May 2018 19:48:14 -0300 Subject: [PATCH 054/236] =?UTF-8?q?Remove=20refer=C3=AAncias=20diretas=20?= =?UTF-8?q?=C3=A0=20tabela=20droplist?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../admincommandhandlers/AdminEditNpc.java | 159 +++++------------- .../gameserver/model/database/DropList.java | 36 +++- .../repository/DropListRepository.java | 23 +++ 3 files changed, 103 insertions(+), 115 deletions(-) create mode 100644 Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/repository/DropListRepository.java diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/handler/admincommandhandlers/AdminEditNpc.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/handler/admincommandhandlers/AdminEditNpc.java index 487331c4..63f90a75 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/handler/admincommandhandlers/AdminEditNpc.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/handler/admincommandhandlers/AdminEditNpc.java @@ -19,6 +19,7 @@ package com.l2jbr.gameserver.handler.admincommandhandlers; import com.l2jbr.commons.Config; +import com.l2jbr.commons.database.DatabaseAccess; import com.l2jbr.commons.database.L2DatabaseFactory; import com.l2jbr.gameserver.TradeController; import com.l2jbr.gameserver.cache.HtmCache; @@ -28,6 +29,7 @@ import com.l2jbr.gameserver.model.*; import com.l2jbr.gameserver.model.actor.instance.L2BoxInstance; import com.l2jbr.gameserver.model.actor.instance.L2PcInstance; +import com.l2jbr.gameserver.model.database.repository.DropListRepository; import com.l2jbr.gameserver.serverpackets.NpcHtmlMessage; import com.l2jbr.gameserver.templates.L2Item; import com.l2jbr.gameserver.templates.L2NpcTemplate; @@ -778,49 +780,32 @@ private void showNpcDropList(L2PcInstance activeChar, int npcId) { } private void showEditDropData(L2PcInstance activeChar, int npcId, int itemId, int category) { - java.sql.Connection con = null; - - try { - con = L2DatabaseFactory.getInstance().getConnection(); - - PreparedStatement statement = con.prepareStatement("SELECT mobId, itemId, min, max, category, chance FROM droplist WHERE mobId=" + npcId + " AND itemId=" + itemId + " AND category=" + category); - ResultSet dropData = statement.executeQuery(); - - NpcHtmlMessage adminReply = new NpcHtmlMessage(5); - - StringBuilder replyMSG = new StringBuilder("the detail of dropdata: (" + npcId + " " + itemId + " " + category + ")"); - replyMSG.append(""); + NpcHtmlMessage adminReply = new NpcHtmlMessage(5); - if (dropData.next()) { - replyMSG.append(""); - replyMSG.append(""); - replyMSG.append(""); - replyMSG.append(""); - replyMSG.append(""); - replyMSG.append(""); - replyMSG.append(""); - replyMSG.append("
    Appertain of NPC" + NpcTable.getInstance().getTemplate(dropData.getInt("mobId")).name + "
    ItemName" + ItemTable.getInstance().getTemplate(dropData.getInt("itemId")).getName() + "(" + dropData.getInt("itemId") + ")
    Category" + ((category == -1) ? "sweep" : Integer.toString(category)) + "
    MIN(" + dropData.getInt("min") + ")
    MAX(" + dropData.getInt("max") + ")
    CHANCE(" + dropData.getInt("chance") + ")
    "); - - replyMSG.append("
    "); - replyMSG.append("
    "); - } + StringBuilder replyMSG = new StringBuilder("the detail of dropdata: (" + npcId + " " + itemId + " " + category + ")"); + replyMSG.append(""); - dropData.close(); - statement.close(); + DropListRepository repository = DatabaseAccess.getRepository(DropListRepository.class); + repository.findByNpcItemAndCategory(npcId, itemId, category).ifPresent(dropList -> { + replyMSG.append(""); + replyMSG.append(""); + replyMSG.append(""); + replyMSG.append(""); + replyMSG.append(""); + replyMSG.append(""); + replyMSG.append(""); + replyMSG.append("
    Appertain of NPC" + NpcTable.getInstance().getTemplate(npcId).name + "
    ItemName" + ItemTable.getInstance().getTemplate(itemId).getName() + "(" + itemId + ")
    Category" + ((category == -1) ? "sweep" : Integer.toString(category)) + "
    MIN(" + dropList.getMin() + ")
    MAX(" + dropList.getMax() + ")
    CHANCE(" + dropList.getChance() + ")
    "); + + replyMSG.append("
    "); + replyMSG.append("
    "); + }); - replyMSG.append(""); - adminReply.setHtml(replyMSG.toString()); + replyMSG.append(""); + adminReply.setHtml(replyMSG.toString()); - activeChar.sendPacket(adminReply); - } catch (Exception e) { - } finally { - try { - con.close(); - } catch (Exception e) { - } - } + activeChar.sendPacket(adminReply); } private void showAddDropData(L2PcInstance activeChar, L2NpcTemplate npcData) { @@ -847,55 +832,20 @@ private void showAddDropData(L2PcInstance activeChar, L2NpcTemplate npcData) { } private void updateDropData(L2PcInstance activeChar, int npcId, int itemId, int min, int max, int category, int chance) { - java.sql.Connection con = null; - - try { - con = L2DatabaseFactory.getInstance().getConnection(); - - PreparedStatement statement = con.prepareStatement("UPDATE droplist SET min=?, max=?, chance=? WHERE mobId=? AND itemId=? AND category=?"); - statement.setInt(1, min); - statement.setInt(2, max); - statement.setInt(3, chance); - statement.setInt(4, npcId); - statement.setInt(5, itemId); - statement.setInt(6, category); - - statement.execute(); - statement.close(); - - PreparedStatement statement2 = con.prepareStatement("SELECT mobId FROM droplist WHERE mobId=? AND itemId=? AND category=?"); - statement2.setInt(1, npcId); - statement2.setInt(2, itemId); - statement2.setInt(3, category); - - ResultSet npcIdRs = statement2.executeQuery(); - if (npcIdRs.next()) { - npcId = npcIdRs.getInt("mobId"); - } - npcIdRs.close(); - statement2.close(); + if(npcId > 0) { + DropListRepository repository = DatabaseAccess.getRepository(DropListRepository.class); + repository.updateDrop(npcId, itemId, category, min, max, chance); - if (npcId > 0) { - reLoadNpcDropList(npcId); + reLoadNpcDropList(npcId); - NpcHtmlMessage adminReply = new NpcHtmlMessage(5); - StringBuilder replyMSG = new StringBuilder("Drop data modify complete!"); - replyMSG.append(""); - replyMSG.append("
    "); - replyMSG.append(""); + NpcHtmlMessage adminReply = new NpcHtmlMessage(5); + StringBuilder replyMSG = new StringBuilder("Drop data modify complete!"); + replyMSG.append(""); + replyMSG.append("
    "); + replyMSG.append(""); - adminReply.setHtml(replyMSG.toString()); - activeChar.sendPacket(adminReply); - } else { - activeChar.sendMessage("unknown error!"); - } - } catch (Exception e) { - e.printStackTrace(); - } finally { - try { - con.close(); - } catch (Exception e) { - } + adminReply.setHtml(replyMSG.toString()); + activeChar.sendPacket(adminReply); } } @@ -936,38 +886,21 @@ private void addDropData(L2PcInstance activeChar, int npcId, int itemId, int min } private void deleteDropData(L2PcInstance activeChar, int npcId, int itemId, int category) { - java.sql.Connection con = null; - try { - con = L2DatabaseFactory.getInstance().getConnection(); - - if (npcId > 0) { - PreparedStatement statement2 = con.prepareStatement("DELETE FROM droplist WHERE mobId=? AND itemId=? AND category=?"); - statement2.setInt(1, npcId); - statement2.setInt(2, itemId); - statement2.setInt(3, category); - statement2.execute(); - statement2.close(); + if (npcId > 0) { + DropListRepository repository = DatabaseAccess.getRepository(DropListRepository.class); + repository.deleteByNpcItemAndCategory(npcId, itemId, category); - reLoadNpcDropList(npcId); - - NpcHtmlMessage adminReply = new NpcHtmlMessage(5); - StringBuilder replyMSG = new StringBuilder("Delete drop data(" + npcId + ", " + itemId + ", " + category + ")complete"); - replyMSG.append(""); - replyMSG.append("
    "); - replyMSG.append(""); + reLoadNpcDropList(npcId); - adminReply.setHtml(replyMSG.toString()); - activeChar.sendPacket(adminReply); + NpcHtmlMessage adminReply = new NpcHtmlMessage(5); + StringBuilder replyMSG = new StringBuilder("Delete drop data(" + npcId + ", " + itemId + ", " + category + ")complete"); + replyMSG.append(""); + replyMSG.append("
    "); + replyMSG.append(""); - } - } catch (Exception e) { - } finally { - try { - con.close(); - } catch (Exception e) { - } + adminReply.setHtml(replyMSG.toString()); + activeChar.sendPacket(adminReply); } - } private void reLoadNpcDropList(int npcId) { diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/DropList.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/DropList.java index 4b3db0c7..dd9efbab 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/DropList.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/DropList.java @@ -1,12 +1,44 @@ package com.l2jbr.gameserver.model.database; +import com.l2jbr.commons.database.annotation.Table; +import com.l2jbr.commons.database.model.Entity; +import org.springframework.data.annotation.Id; - -public class DropList { +public class DropList extends Entity { + @Id private int mobId; private int itemId; private int min; private int max; private int category; private int chance; + + @Override + public Integer getId() { + return mobId; + } + + public int getMobId() { + return mobId; + } + + public int getItemId() { + return itemId; + } + + public int getMin() { + return min; + } + + public int getMax() { + return max; + } + + public int getCategory() { + return category; + } + + public int getChance() { + return chance; + } } diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/repository/DropListRepository.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/repository/DropListRepository.java new file mode 100644 index 00000000..d156bfb1 --- /dev/null +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/repository/DropListRepository.java @@ -0,0 +1,23 @@ +package com.l2jbr.gameserver.model.database.repository; + +import com.l2jbr.gameserver.model.database.DropList; +import org.springframework.data.jdbc.repository.query.Modifying; +import org.springframework.data.jdbc.repository.query.Query; +import org.springframework.data.repository.CrudRepository; +import org.springframework.data.repository.query.Param; + +import java.util.Optional; + +public interface DropListRepository extends CrudRepository { + + @Query("SELECT * FROM droplist WHERE mobId=:npc AND itemId=:item AND category=:category") + Optional findByNpcItemAndCategory(@Param("npc") int npcId, @Param("item") int itemId, @Param("category") int category); + + @Modifying + @Query("UPDATE droplist SET min=:min, max=:max, chance=:chance WHERE mobId=:npc AND itemId=:item AND category=:category") + int updateDrop(@Param("npc") int npcId, @Param("item") int itemId, @Param("category") int category, @Param("min") int min, + @Param("max") int max, @Param("chance") int chance); + + @Query("DELETE FROM droplist WHERE mobId=:npc AND itemId=:item AND category=:category") + int deleteByNpcItemAndCategory(@Param("npc") int npcId, @Param("item") int itemId, @Param("category") int category); +} From 7fb57e8021c4c03a9e5e87dfb97a3c4e7737cb7f Mon Sep 17 00:00:00 2001 From: Alisson Oliveira Date: Tue, 1 May 2018 20:09:39 -0300 Subject: [PATCH 055/236] =?UTF-8?q?Remove=20refer=C3=AAncias=20diretas=20?= =?UTF-8?q?=C3=A0=20tabela=20enchant=5Fskills=5Ftree?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../gameserver/datatables/SkillTreeTable.java | 52 ++++++-------- .../model/database/EnchantSkillTrees.java | 71 ++++++++++++++++--- .../EnchantSkillTreesRepository.java | 11 +++ 3 files changed, 95 insertions(+), 39 deletions(-) create mode 100644 Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/repository/EnchantSkillTreesRepository.java diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/datatables/SkillTreeTable.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/datatables/SkillTreeTable.java index b710a5d6..e4f66daa 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/datatables/SkillTreeTable.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/datatables/SkillTreeTable.java @@ -27,7 +27,9 @@ import com.l2jbr.gameserver.model.actor.instance.L2PcInstance; import com.l2jbr.gameserver.model.base.ClassId; import com.l2jbr.gameserver.model.database.CharTemplate; +import com.l2jbr.gameserver.model.database.EnchantSkillTrees; import com.l2jbr.gameserver.model.database.repository.CharTemplateRepository; +import com.l2jbr.gameserver.model.database.repository.EnchantSkillTreesRepository; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -116,12 +118,12 @@ public int getMinSkillLevel(int skillId, int skillLvl) { private SkillTreeTable() { int count = 0; - CharTemplateRepository repository = DatabaseAccess.getRepository(CharTemplateRepository.class); + CharTemplateRepository charTemplateRepository = DatabaseAccess.getRepository(CharTemplateRepository.class); Map map; int parentClassId; int classId; L2SkillLearn skillLearn; - for (CharTemplate charTemplate : repository.findAll()) { + for (CharTemplate charTemplate : charTemplateRepository.findAll()) { map = new LinkedHashMap<>(); parentClassId = charTemplate.getParentId(); classId = charTemplate.getId(); @@ -205,40 +207,28 @@ private SkillTreeTable() { _log.error("Error while creating fishing skill table: " + e); } - int count4 = 0; - try(Connection con = L2DatabaseFactory.getInstance().getConnection(); - PreparedStatement statement = con.prepareStatement("SELECT skill_id, level, name, base_lvl, sp, min_skill_lvl, exp, success_rate76, success_rate77, success_rate78 FROM enchant_skill_trees ORDER BY skill_id, level"); - ResultSet skilltree3 = statement.executeQuery();) { - _enchantSkillTrees = new LinkedList<>(); - - int prevSkillId = -1; + _enchantSkillTrees = new LinkedList<>(); - while (skilltree3.next()) { - int id = skilltree3.getInt("skill_id"); - int lvl = skilltree3.getInt("level"); - String name = skilltree3.getString("name"); - int baseLvl = skilltree3.getInt("base_lvl"); - int minSkillLvl = skilltree3.getInt("min_skill_lvl"); - int sp = skilltree3.getInt("sp"); - int exp = skilltree3.getInt("exp"); - byte rate76 = skilltree3.getByte("success_rate76"); - byte rate77 = skilltree3.getByte("success_rate77"); - byte rate78 = skilltree3.getByte("success_rate78"); - - if (prevSkillId != id) { - prevSkillId = id; - } + EnchantSkillTreesRepository enchantSkillTreesRepository = DatabaseAccess.getRepository(EnchantSkillTreesRepository.class); + enchantSkillTreesRepository.findAllOrderBySkillAndLevel().forEach(enchantSkillTrees -> { + int id = enchantSkillTrees.getSkillId(); + int lvl = enchantSkillTrees.getLevel(); + String name = enchantSkillTrees.getName(); + int baseLvl = enchantSkillTrees.getBaseLvl(); + int minSkillLvl = enchantSkillTrees.getMinSkillLvl(); + int sp = enchantSkillTrees.getSp(); + int exp = enchantSkillTrees.getExp(); + byte rate76 = enchantSkillTrees.getSuccessRate76(); + byte rate77 = enchantSkillTrees.getSuccessRate77(); + byte rate78 = enchantSkillTrees.getSuccessRate78(); - L2EnchantSkillLearn skill = new L2EnchantSkillLearn(id, lvl, minSkillLvl, baseLvl, name, sp, exp, rate76, rate77, rate78); + L2EnchantSkillLearn skill = new L2EnchantSkillLearn(id, lvl, minSkillLvl, baseLvl, name, sp, exp, rate76, rate77, rate78); - _enchantSkillTrees.add(skill); - } + _enchantSkillTrees.add(skill); + }); + int count4 = _enchantSkillTrees.size(); - count4 = _enchantSkillTrees.size(); - } catch (Exception e) { - _log.error("Error while creating enchant skill table: " + e); - } int count5 = 0; try(Connection con = L2DatabaseFactory.getInstance().getConnection(); diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/EnchantSkillTrees.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/EnchantSkillTrees.java index 4ec192bc..45071b3c 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/EnchantSkillTrees.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/EnchantSkillTrees.java @@ -1,17 +1,72 @@ package com.l2jbr.gameserver.model.database; +import com.l2jbr.commons.database.annotation.Column; +import com.l2jbr.commons.database.annotation.Table; +import org.springframework.data.annotation.Id; - +@Table("enchant_skill_trees") public class EnchantSkillTrees { - private int skill_id; + @Id + @Column("skill_id") + private int skillId; private int level; private String name; - private int base_lvl; - private String enchant_type; + @Column("base_lvl") + private int baseLvl; + @Column("enchant_type") + private String enchantType; private int sp; private int exp; - private int min_skill_lvl; - private int success_rate76; - private int success_rate77; - private int success_rate78; + @Column("min_skill_lvl") + private int minSkillLvl; + @Column("success_rate76") + private byte successRate76; + @Column("success_rate77") + private byte successRate77; + @Column("success_rate78") + private byte successRate78; + + public int getSkillId() { + return skillId; + } + + public int getLevel() { + return level; + } + + public String getName() { + return name; + } + + public int getBaseLvl() { + return baseLvl; + } + + public String getEnchantType() { + return enchantType; + } + + public int getSp() { + return sp; + } + + public int getExp() { + return exp; + } + + public int getMinSkillLvl() { + return minSkillLvl; + } + + public byte getSuccessRate76() { + return successRate76; + } + + public byte getSuccessRate77() { + return successRate77; + } + + public byte getSuccessRate78() { + return successRate78; + } } diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/repository/EnchantSkillTreesRepository.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/repository/EnchantSkillTreesRepository.java new file mode 100644 index 00000000..07e09592 --- /dev/null +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/repository/EnchantSkillTreesRepository.java @@ -0,0 +1,11 @@ +package com.l2jbr.gameserver.model.database.repository; + +import com.l2jbr.gameserver.model.database.EnchantSkillTrees; +import org.springframework.data.jdbc.repository.query.Query; +import org.springframework.data.repository.CrudRepository; + +public interface EnchantSkillTreesRepository extends CrudRepository { + + @Query("SELECT * FROM enchant_skill_trees ORDER BY skill_id, level") + Iterable findAllOrderBySkillAndLevel(); +} From 902ac78443045ed2fcc1f6fc760e5ae1e07df856 Mon Sep 17 00:00:00 2001 From: Alisson Oliveira Date: Tue, 1 May 2018 20:26:29 -0300 Subject: [PATCH 056/236] =?UTF-8?q?Remove=20refer=C3=AAncias=20diretas=20?= =?UTF-8?q?=C3=A0=20tabela=20fish?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../gameserver/datatables/FishTable.java | 81 ++++++++----------- .../l2jbr/gameserver/model/database/Fish.java | 65 +++++++++++++-- .../database/repository/FishRepository.java | 7 ++ 3 files changed, 98 insertions(+), 55 deletions(-) create mode 100644 Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/repository/FishRepository.java diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/datatables/FishTable.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/datatables/FishTable.java index 9272b578..146cf44c 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/datatables/FishTable.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/datatables/FishTable.java @@ -18,13 +18,12 @@ */ package com.l2jbr.gameserver.datatables; -import com.l2jbr.commons.database.L2DatabaseFactory; +import com.l2jbr.commons.database.DatabaseAccess; import com.l2jbr.gameserver.model.FishData; +import com.l2jbr.gameserver.model.database.repository.FishRepository; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import java.sql.PreparedStatement; -import java.sql.ResultSet; import java.util.LinkedList; import java.util.List; @@ -45,54 +44,38 @@ public static FishTable getInstance() { } private FishTable() { - // Create table that contains all fish datas - int count = 0; - java.sql.Connection con = null; - try { - con = L2DatabaseFactory.getInstance().getConnection(); - _fishsEasy = new LinkedList<>(); - _fishsNormal = new LinkedList<>(); - _fishsHard = new LinkedList<>(); - FishData fish; - PreparedStatement statement = con.prepareStatement("SELECT id, level, name, hp, hpregen, fish_type, fish_group, fish_guts, guts_check_time, wait_time, combat_time FROM fish ORDER BY id"); - ResultSet Fishes = statement.executeQuery(); + _fishsEasy = new LinkedList<>(); + _fishsNormal = new LinkedList<>(); + _fishsHard = new LinkedList<>(); - while (Fishes.next()) { - int id = Fishes.getInt("id"); - int lvl = Fishes.getInt("level"); - String name = Fishes.getString("name"); - int hp = Fishes.getInt("hp"); - int hpreg = Fishes.getInt("hpregen"); - int type = Fishes.getInt("fish_type"); - int group = Fishes.getInt("fish_group"); - int fish_guts = Fishes.getInt("fish_guts"); - int guts_check_time = Fishes.getInt("guts_check_time"); - int wait_time = Fishes.getInt("wait_time"); - int combat_time = Fishes.getInt("combat_time"); - fish = new FishData(id, lvl, name, hp, hpreg, type, group, fish_guts, guts_check_time, wait_time, combat_time); - switch (fish.getGroup()) { - case 0: - _fishsEasy.add(fish); - break; - case 1: - _fishsNormal.add(fish); - break; - case 2: - _fishsHard.add(fish); - } + FishRepository repository = DatabaseAccess.getRepository(FishRepository.class); + repository.findAll().forEach(fish ->{ + int id = fish.getId(); + int lvl = fish.getLevel(); + String name = fish.getName(); + int hp = fish.getHp(); + int hpreg = fish.getHpregen(); + int type = fish.getFishType(); + int group = fish.getFishGroup(); + int fish_guts = fish.getFishGuts(); + int guts_check_time = fish.getGutsCheckTime(); + int wait_time = fish.getWaitTime(); + int combat_time = fish.getCombatTime(); + FishData fishData = new FishData(id, lvl, name, hp, hpreg, type, group, fish_guts, guts_check_time, wait_time, combat_time); + switch (fishData.getGroup()) { + case 0: + _fishsEasy.add(fishData); + break; + case 1: + _fishsNormal.add(fishData); + break; + case 2: + _fishsHard.add(fishData); } - Fishes.close(); - statement.close(); - count = _fishsEasy.size() + _fishsNormal.size() + _fishsHard.size(); - } catch (Exception e) { - _log.error( "error while creating fishes table" + e); - } finally { - try { - con.close(); - } catch (Exception e) { - } - } - _log.info("FishTable: Loaded " + count + " Fishes."); + }); + + int count = _fishsEasy.size() + _fishsNormal.size() + _fishsHard.size(); + _log.info("FishTable: Loaded {} Fishes.", count); } /** diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/Fish.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/Fish.java index c7c6dd34..9e827f47 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/Fish.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/Fish.java @@ -1,17 +1,70 @@ package com.l2jbr.gameserver.model.database; +import com.l2jbr.commons.database.annotation.Column; +import org.springframework.data.annotation.Id; public class Fish { + @Id private int id; private int level; private String name; private int hp; private int hpregen; - private int fish_type; - private int fish_group; - private int fish_guts; - private int guts_check_time; - private int wait_time; - private int combat_time; + @Column("fish_type") + private int fishType; + @Column("fish_group") + private int fishGroup; + @Column("fish_guts") + private int fishGuts; + @Column("guts_check_time") + private int gutsCheckTime; + @Column("wait_time") + private int waitTime; + @Column("combat_time") + private int combatTime; + + public int getId() { + return id; + } + + public int getLevel() { + return level; + } + + public String getName() { + return name; + } + + public int getHp() { + return hp; + } + + public int getHpregen() { + return hpregen; + } + + public int getFishType() { + return fishType; + } + + public int getFishGroup() { + return fishGroup; + } + + public int getFishGuts() { + return fishGuts; + } + + public int getGutsCheckTime() { + return gutsCheckTime; + } + + public int getWaitTime() { + return waitTime; + } + + public int getCombatTime() { + return combatTime; + } } diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/repository/FishRepository.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/repository/FishRepository.java new file mode 100644 index 00000000..112d8b9b --- /dev/null +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/repository/FishRepository.java @@ -0,0 +1,7 @@ +package com.l2jbr.gameserver.model.database.repository; + +import com.l2jbr.gameserver.model.database.Fish; +import org.springframework.data.repository.CrudRepository; + +public interface FishRepository extends CrudRepository { +} From cc4f34945c47de089031c7a8a6b26e43fd8cffa5 Mon Sep 17 00:00:00 2001 From: Alisson Oliveira Date: Tue, 1 May 2018 20:40:32 -0300 Subject: [PATCH 057/236] =?UTF-8?q?Remove=20refer=C3=AAncias=20diretas=20?= =?UTF-8?q?=C3=A0=20tabela=20fishing=5Fskill=5Ftrees?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../gameserver/datatables/SkillTreeTable.java | 59 ++++++++----------- .../model/database/FishingSkillTrees.java | 48 +++++++++++++-- .../FishingSkillTreeRepository.java | 11 ++++ 3 files changed, 78 insertions(+), 40 deletions(-) create mode 100644 Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/repository/FishingSkillTreeRepository.java diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/datatables/SkillTreeTable.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/datatables/SkillTreeTable.java index e4f66daa..c227177c 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/datatables/SkillTreeTable.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/datatables/SkillTreeTable.java @@ -30,6 +30,7 @@ import com.l2jbr.gameserver.model.database.EnchantSkillTrees; import com.l2jbr.gameserver.model.database.repository.CharTemplateRepository; import com.l2jbr.gameserver.model.database.repository.EnchantSkillTreesRepository; +import com.l2jbr.gameserver.model.database.repository.FishingSkillTreeRepository; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -168,44 +169,32 @@ private SkillTreeTable() { _log.info("SkillTreeTable: Loaded " + count + " skills."); // Skill tree for fishing skill (from Fisherman) - int count2 = 0; - int count3 = 0; - try(Connection con = L2DatabaseFactory.getInstance().getConnection(); - PreparedStatement statement = con.prepareStatement("SELECT skill_id, level, name, sp, min_level, costid, cost, isfordwarf FROM fishing_skill_trees ORDER BY skill_id, level"); - ResultSet skilltree2 = statement.executeQuery();) { - _fishingSkillTrees = new LinkedList<>(); - _expandDwarfCraftSkillTrees = new LinkedList<>(); - - int prevSkillId = -1; - - while (skilltree2.next()) { - int id = skilltree2.getInt("skill_id"); - int lvl = skilltree2.getInt("level"); - String name = skilltree2.getString("name"); - int minLvl = skilltree2.getInt("min_level"); - int cost = skilltree2.getInt("sp"); - int costId = skilltree2.getInt("costid"); - int costCount = skilltree2.getInt("cost"); - int isDwarven = skilltree2.getInt("isfordwarf"); - - if (prevSkillId != id) { - prevSkillId = id; - } - L2SkillLearn skill = new L2SkillLearn(id, lvl, minLvl, name, cost, costId, costCount); - - if (isDwarven == 0) { - _fishingSkillTrees.add(skill); - } else { - _expandDwarfCraftSkillTrees.add(skill); - } + _fishingSkillTrees = new LinkedList<>(); + _expandDwarfCraftSkillTrees = new LinkedList<>(); + FishingSkillTreeRepository fishingSkillTreeRepository = DatabaseAccess.getRepository(FishingSkillTreeRepository.class); + fishingSkillTreeRepository.findAllOrderBySkillAndLevel().forEach(fishingSkillTree -> { + int id = fishingSkillTree.getSkillId(); + int lvl = fishingSkillTree.getLevel(); + String name = fishingSkillTree.getName(); + int minLvl = fishingSkillTree.getMinLevel(); + int cost = fishingSkillTree.getSp(); + int costId = fishingSkillTree.getCostId(); + int costCount = fishingSkillTree.getCost(); + int isDwarven = fishingSkillTree.getIsForDwarf(); + + L2SkillLearn skill = new L2SkillLearn(id, lvl, minLvl, name, cost, costId, costCount); + + if (isDwarven == 0) { + _fishingSkillTrees.add(skill); + } else { + _expandDwarfCraftSkillTrees.add(skill); } + }); - count2 = _fishingSkillTrees.size(); - count3 = _expandDwarfCraftSkillTrees.size(); - } catch (Exception e) { - _log.error("Error while creating fishing skill table: " + e); - } + + int count2 = _fishingSkillTrees.size(); + int count3 = _expandDwarfCraftSkillTrees.size(); _enchantSkillTrees = new LinkedList<>(); diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/FishingSkillTrees.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/FishingSkillTrees.java index 50544f35..0b7bdb8c 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/FishingSkillTrees.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/FishingSkillTrees.java @@ -1,15 +1,53 @@ package com.l2jbr.gameserver.model.database; +import com.l2jbr.commons.database.annotation.Column; +import com.l2jbr.commons.database.annotation.Table; +import org.springframework.data.annotation.Id; - +@Table("fishing_skill_trees") public class FishingSkillTrees { - private int skill_id; + @Id + @Column("skill_id") + private int skillId; private int level; private String name; private int sp; - private int min_level; - private int costid; + @Column("min_level") + private int minLevel; + private int costId; private int cost; - private int isfordwarf; + private int isForDwarf; + + public int getSkillId() { + return skillId; + } + + public int getLevel() { + return level; + } + + public String getName() { + return name; + } + + public int getSp() { + return sp; + } + + public int getMinLevel() { + return minLevel; + } + + public int getCostId() { + return costId; + } + + public int getCost() { + return cost; + } + + public int getIsForDwarf() { + return isForDwarf; + } } diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/repository/FishingSkillTreeRepository.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/repository/FishingSkillTreeRepository.java new file mode 100644 index 00000000..436caa19 --- /dev/null +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/repository/FishingSkillTreeRepository.java @@ -0,0 +1,11 @@ +package com.l2jbr.gameserver.model.database.repository; + +import com.l2jbr.gameserver.model.database.FishingSkillTrees; +import org.springframework.data.jdbc.repository.query.Query; +import org.springframework.data.repository.CrudRepository; + +public interface FishingSkillTreeRepository extends CrudRepository { + + @Query("SELECT * FROM fishing_skill_trees ORDER BY skill_id, level") + Iterable findAllOrderBySkillAndLevel(); +} From 408d9b4c9450fa61e59c5e244b64f3dee6cc09e6 Mon Sep 17 00:00:00 2001 From: Alisson Oliveira Date: Tue, 1 May 2018 21:01:29 -0300 Subject: [PATCH 058/236] =?UTF-8?q?Remove=20refer=C3=AAncias=20diretas=20?= =?UTF-8?q?=C3=A0=20tabela=20forums?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../gameserver/communitybbs/BB/Forum.java | 112 ++++-------------- .../Manager/ForumsBBSManager.java | 37 ++---- .../gameserver/model/database/Forums.java | 64 ++++++++-- .../database/repository/ForumRepository.java | 15 +++ 4 files changed, 101 insertions(+), 127 deletions(-) create mode 100644 Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/repository/ForumRepository.java diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/communitybbs/BB/Forum.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/communitybbs/BB/Forum.java index 1420e81c..ca068dcd 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/communitybbs/BB/Forum.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/communitybbs/BB/Forum.java @@ -18,9 +18,12 @@ */ package com.l2jbr.gameserver.communitybbs.BB; +import com.l2jbr.commons.database.DatabaseAccess; import com.l2jbr.commons.database.L2DatabaseFactory; import com.l2jbr.gameserver.communitybbs.Manager.ForumsBBSManager; import com.l2jbr.gameserver.communitybbs.Manager.TopicBBSManager; +import com.l2jbr.gameserver.model.database.Forums; +import com.l2jbr.gameserver.model.database.repository.ForumRepository; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -98,36 +101,18 @@ public Forum(String name, Forum parent, int type, int perm, int OwnerID) { _loaded = true; } - /** - * - */ private void load() { + ForumRepository repository = DatabaseAccess.getRepository(ForumRepository.class); + repository.findById(_forumId).ifPresent(forum -> { + _forumName = forum.getForumName(); + _forumPost = forum.getForumPost(); + _forumType = forum.getForumType(); + _forumPerm = forum.getForumPerm(); + _ownerID = forum.getForumOwnerId(); + }); + java.sql.Connection con = null; - try { - con = L2DatabaseFactory.getInstance().getConnection(); - PreparedStatement statement = con.prepareStatement("SELECT * FROM forums WHERE forum_id=?"); - statement.setInt(1, _forumId); - ResultSet result = statement.executeQuery(); - if (result.next()) { - _forumName = result.getString("forum_name"); - // _ForumParent = Integer.parseInt(result.getString("forum_parent")); - _forumPost = Integer.parseInt(result.getString("forum_post")); - _forumType = Integer.parseInt(result.getString("forum_type")); - _forumPerm = Integer.parseInt(result.getString("forum_perm")); - _ownerID = Integer.parseInt(result.getString("forum_owner_id")); - } - result.close(); - statement.close(); - } catch (Exception e) { - _log.warn("data error on Forum " + _forumId + " : " + e); - e.printStackTrace(); - } finally { - try { - con.close(); - } catch (Exception e) { - } - } try { con = L2DatabaseFactory.getInstance().getConnection(); PreparedStatement statement = con.prepareStatement("SELECT * FROM topic WHERE topic_forum_id=? ORDER BY topic_id DESC"); @@ -154,33 +139,11 @@ private void load() { } } - /** - * - */ private void getChildren() { - java.sql.Connection con = null; - try { - con = L2DatabaseFactory.getInstance().getConnection(); - PreparedStatement statement = con.prepareStatement("SELECT forum_id FROM forums WHERE forum_parent=?"); - statement.setInt(1, _forumId); - ResultSet result = statement.executeQuery(); - - while (result.next()) { - - _children.add(new Forum(Integer.parseInt(result.getString("forum_id")), this)); - } - result.close(); - statement.close(); - } catch (Exception e) { - _log.warn("data error on Forum (children): " + e); - e.printStackTrace(); - } finally { - try { - con.close(); - } catch (Exception e) { - } - } - + ForumRepository repository = DatabaseAccess.getRepository(ForumRepository.class); + repository.findAllIdsByParent(_forumId).forEach(forumId -> { + _children.add(new Forum(forumId, this)); + }); } public int getTopicSize() { @@ -253,46 +216,17 @@ public Forum getChildByName(String name) { return null; } - /** - * @param id - */ + public void rmTopicByID(int id) { _topic.remove(id); - } - /** - * - */ - public void insertindb() { - java.sql.Connection con = null; - try { - con = L2DatabaseFactory.getInstance().getConnection(); - PreparedStatement statement = con.prepareStatement("INSERT INTO forums (forum_id,forum_name,forum_parent,forum_post,forum_type,forum_perm,forum_owner_id) values (?,?,?,?,?,?,?)"); - statement.setInt(1, _forumId); - statement.setString(2, _forumName); - statement.setInt(3, _fParent.getID()); - statement.setInt(4, _forumPost); - statement.setInt(5, _forumType); - statement.setInt(6, _forumPerm); - statement.setInt(7, _ownerID); - statement.execute(); - statement.close(); - - } catch (Exception e) { - _log.warn("error while saving new Forum to db " + e); - } finally { - try { - con.close(); - } catch (Exception e) { - } - } - + public void insertInDb() { + Forums forum = new Forums(_forumId, _forumName, _fParent.getID(), _forumPost, _forumType, _forumPerm, _ownerID); + ForumRepository repository = DatabaseAccess.getRepository(ForumRepository.class); + repository.save(forum); } - /** - * - */ public void vload() { if (_loaded == false) { load(); @@ -301,8 +235,4 @@ public void vload() { } } - /** - * @return - */ - } \ No newline at end of file diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/communitybbs/Manager/ForumsBBSManager.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/communitybbs/Manager/ForumsBBSManager.java index ec3a2e54..d9867cee 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/communitybbs/Manager/ForumsBBSManager.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/communitybbs/Manager/ForumsBBSManager.java @@ -18,14 +18,13 @@ */ package com.l2jbr.gameserver.communitybbs.Manager; -import com.l2jbr.commons.database.L2DatabaseFactory; +import com.l2jbr.commons.database.DatabaseAccess; import com.l2jbr.gameserver.communitybbs.BB.Forum; import com.l2jbr.gameserver.model.actor.instance.L2PcInstance; +import com.l2jbr.gameserver.model.database.repository.ForumRepository; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import java.sql.PreparedStatement; -import java.sql.ResultSet; import java.util.LinkedHashMap; import java.util.LinkedList; import java.util.List; @@ -63,31 +62,13 @@ public void addForum(Forum ff) { } } - /** - * - */ + private void load() { - java.sql.Connection con = null; - try { - con = L2DatabaseFactory.getInstance().getConnection(); - PreparedStatement statement = con.prepareStatement("SELECT forum_id FROM forums WHERE forum_type=0"); - ResultSet result = statement.executeQuery(); - while (result.next()) { - - Forum f = new Forum(Integer.parseInt(result.getString("forum_id")), null); - _root.put(Integer.parseInt(result.getString("forum_id")), f); - } - result.close(); - statement.close(); - } catch (Exception e) { - _log.warn("data error on Forum (root): " + e); - e.printStackTrace(); - } finally { - try { - con.close(); - } catch (Exception e) { - } - } + ForumRepository repository = DatabaseAccess.getRepository(ForumRepository.class); + repository.findAllIdsByType(0).forEach(forumId -> { + Forum f = new Forum(forumId, null); + _root.put(forumId, f); + }); } /* @@ -124,7 +105,7 @@ public Forum getForumByName(String Name) { public Forum createNewForum(String name, Forum parent, int type, int perm, int oid) { Forum forum; forum = new Forum(name, parent, type, perm, oid); - forum.insertindb(); + forum.insertInDb(); return forum; } diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/Forums.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/Forums.java index 9306d2c1..396acae2 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/Forums.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/Forums.java @@ -1,14 +1,62 @@ package com.l2jbr.gameserver.model.database; +import com.l2jbr.commons.database.annotation.Column; +import com.l2jbr.commons.database.model.Entity; +import org.springframework.data.annotation.Id; +public class Forums extends Entity { + @Id + @Column("forum_id") + private int forumId; + @Column("forum_name") + private String forumName; + @Column("forum_parent") + private int forumParent; + @Column("forum_post") + private int forumPost; + @Column("forum_type") + private int forumType; + @Column("forum_perm") + private int forumPerm; + @Column("forum_owner_id") + private int forumOwnerId; -public class Forums { - private int forum_id; - private String forum_name; - private int forum_parent; - private int forum_post; - private int forum_type; - private int forum_perm; - private int forum_owner_id; + public Forums(int forumId, String forumName, int parentId, int forumPost, int forumType, int forumPerm, int ownerId) { + this.forumId = forumId; + this.forumName = forumName; + this.forumParent = parentId; + this.forumPost = forumPost; + this.forumType = forumType; + this.forumPerm = forumPerm; + this.forumOwnerId = ownerId; + } + @Override + public Integer getId() { + return forumId; + } + + public String getForumName() { + return forumName; + } + + public int getForumParent() { + return forumParent; + } + + public int getForumPost() { + return forumPost; + } + + public int getForumType() { + return forumType; + } + + public int getForumPerm() { + return forumPerm; + } + + public int getForumOwnerId() { + return forumOwnerId; + } } diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/repository/ForumRepository.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/repository/ForumRepository.java new file mode 100644 index 00000000..74ea2f37 --- /dev/null +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/repository/ForumRepository.java @@ -0,0 +1,15 @@ +package com.l2jbr.gameserver.model.database.repository; + +import com.l2jbr.gameserver.model.database.Forums; +import org.springframework.data.jdbc.repository.query.Query; +import org.springframework.data.repository.CrudRepository; +import org.springframework.data.repository.query.Param; + +public interface ForumRepository extends CrudRepository { + + @Query("SELECT forum_id FROM forums WHERE forum_type=:type") + Iterable findAllIdsByType(@Param("type") int type); + + @Query("SELECT forum_id FROM forums WHERE forum_parent=:parent") + Iterable findAllIdsByParent(@Param("parent") int parentId); +} From 3d308ec025446b55ed272bdcb2887c85a3542651 Mon Sep 17 00:00:00 2001 From: Alisson Oliveira Date: Tue, 1 May 2018 22:12:32 -0300 Subject: [PATCH 059/236] =?UTF-8?q?Remove=20refer=C3=AAncias=20diretas=20?= =?UTF-8?q?=C3=A0=20tabela=20games?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../instancemanager/games/Lottery.java | 366 +++++------------- .../gameserver/model/database/Games.java | 66 +++- .../database/repository/GameRepository.java | 26 ++ 3 files changed, 193 insertions(+), 265 deletions(-) create mode 100644 Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/repository/GameRepository.java diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/instancemanager/games/Lottery.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/instancemanager/games/Lottery.java index 1ca12b8e..d6dec679 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/instancemanager/games/Lottery.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/instancemanager/games/Lottery.java @@ -19,11 +19,14 @@ package com.l2jbr.gameserver.instancemanager.games; import com.l2jbr.commons.Config; +import com.l2jbr.commons.database.DatabaseAccess; import com.l2jbr.commons.database.L2DatabaseFactory; import com.l2jbr.commons.util.Rnd; import com.l2jbr.gameserver.Announcements; import com.l2jbr.gameserver.ThreadPoolManager; import com.l2jbr.gameserver.model.L2ItemInstance; +import com.l2jbr.gameserver.model.database.Games; +import com.l2jbr.gameserver.model.database.repository.GameRepository; import com.l2jbr.gameserver.network.SystemMessageId; import com.l2jbr.gameserver.serverpackets.SystemMessage; import org.slf4j.Logger; @@ -33,23 +36,17 @@ import java.sql.ResultSet; import java.sql.SQLException; import java.util.Calendar; +import java.util.Optional; -public class Lottery -{ - public static final long SECOND = 1000; +public class Lottery { public static final long MINUTE = 60000; private static Lottery _instance; protected static final Logger _log = LoggerFactory.getLogger(Lottery.class.getName()); - - private static final String INSERT_LOTTERY = "INSERT INTO games(id, idnr, enddate, prize, newprize) VALUES (?, ?, ?, ?, ?)"; - private static final String UPDATE_PRICE = "UPDATE games SET prize=?, newprize=? WHERE id = 1 AND idnr = ?"; - private static final String UPDATE_LOTTERY = "UPDATE games SET finished=1, prize=?, newprize=?, number1=?, number2=?, prize1=?, prize2=?, prize3=? WHERE id=1 AND idnr=?"; - private static final String SELECT_LAST_LOTTERY = "SELECT idnr, prize, newprize, enddate, finished FROM games WHERE id = 1 ORDER BY idnr DESC LIMIT 1"; + private static final String SELECT_LOTTERY_ITEM = "SELECT enchant_level, custom_type2 FROM items WHERE item_id = 4442 AND custom_type1 = ?"; - private static final String SELECT_LOTTERY_TICKET = "SELECT number1, number2, prize1, prize2, prize3 FROM games WHERE id = 1 and idnr = ?"; - + protected int _number; protected int _prize; protected boolean _isSellingTickets; @@ -95,35 +92,10 @@ public long getEndDate() return _enddate; } - public void increasePrize(int count) - { + public void increasePrize(int count) { _prize += count; - java.sql.Connection con = null; - try - { - con = L2DatabaseFactory.getInstance().getConnection(); - PreparedStatement statement; - statement = con.prepareStatement(UPDATE_PRICE); - statement.setInt(1, getPrize()); - statement.setInt(2, getPrize()); - statement.setInt(3, getId()); - statement.execute(); - statement.close(); - } - catch (SQLException e) - { - _log.warn("Lottery: Could not increase current lottery prize: " + e); - } - finally - { - try - { - con.close(); - } - catch (Exception e) - { - } - } + GameRepository repository = DatabaseAccess.getRepository(GameRepository.class); + repository.updatePrizeByIdNr(1, getId(), getPrize()); } public boolean isSellableTickets() @@ -144,76 +116,40 @@ protected startLottery() } @Override - public void run() - { - java.sql.Connection con = null; - PreparedStatement statement; - try - { - con = L2DatabaseFactory.getInstance().getConnection(); - statement = con.prepareStatement(SELECT_LAST_LOTTERY); - ResultSet rset = statement.executeQuery(); - - if (rset.next()) - { - _number = rset.getInt("idnr"); - - if (rset.getInt("finished") == 1) - { - _number++; - _prize = rset.getInt("newprize"); - } - else - { - _prize = rset.getInt("prize"); - _enddate = rset.getLong("enddate"); - - if (_enddate <= (System.currentTimeMillis() + (2 * MINUTE))) - { - (new finishLottery()).run(); - rset.close(); - statement.close(); - return; - } - - if (_enddate > System.currentTimeMillis()) - { - _isStarted = true; - ThreadPoolManager.getInstance().scheduleGeneral(new finishLottery(), _enddate - System.currentTimeMillis()); - - if (_enddate > (System.currentTimeMillis() + (12 * MINUTE))) - { - _isSellingTickets = true; - ThreadPoolManager.getInstance().scheduleGeneral(new stopSellingTickets(), _enddate - System.currentTimeMillis() - (10 * MINUTE)); - } - rset.close(); - statement.close(); - return; - } - } - } - rset.close(); - statement.close(); - } - catch (SQLException e) - { - _log.warn("Lottery: Could not restore lottery data: " + e); - } - finally - { - try - { - con.close(); - } - catch (Exception e) - { - } - } - - if (Config.DEBUG) - { - _log.info("Lottery: Starting ticket sell for lottery #" + getId() + "."); - } + public void run() { + + GameRepository repository = DatabaseAccess.getRepository(GameRepository.class); + repository.findLastIdnrById(1).ifPresent(game -> { + _number = game.getIdnr(); + + if (game.getFinished() == 1) { + _number++; + _prize = game.getNewPrize(); + } + else { + _prize = game.getPrize(); + _enddate = game.getEndDate(); + + if (_enddate <= (System.currentTimeMillis() + (2 * MINUTE))) { + (new finishLottery()).run(); + return; + } + + if (_enddate > System.currentTimeMillis()) { + _isStarted = true; + ThreadPoolManager.getInstance().scheduleGeneral(new finishLottery(), _enddate - System.currentTimeMillis()); + + if (_enddate > (System.currentTimeMillis() + (12 * MINUTE))) { + _isSellingTickets = true; + ThreadPoolManager.getInstance().scheduleGeneral(new stopSellingTickets(), _enddate - System.currentTimeMillis() - (10 * MINUTE)); + } + return; + } + } + }); + + _log.debug("Lottery: Starting ticket sell for lottery #{}.", getId()); + _isSellingTickets = true; _isStarted = true; @@ -238,33 +174,9 @@ public void run() ThreadPoolManager.getInstance().scheduleGeneral(new stopSellingTickets(), _enddate - System.currentTimeMillis() - (10 * MINUTE)); ThreadPoolManager.getInstance().scheduleGeneral(new finishLottery(), _enddate - System.currentTimeMillis()); - - try - { - con = L2DatabaseFactory.getInstance().getConnection(); - statement = con.prepareStatement(INSERT_LOTTERY); - statement.setInt(1, 1); - statement.setInt(2, getId()); - statement.setLong(3, getEndDate()); - statement.setInt(4, getPrize()); - statement.setInt(5, getPrize()); - statement.execute(); - statement.close(); - } - catch (SQLException e) - { - _log.warn("Lottery: Could not store new lottery data: " + e); - } - finally - { - try - { - con.close(); - } - catch (Exception e) - { - } - } + + Games game = new Games(1, getId(), getEndDate(), getPrize()); + repository.save(game); } } @@ -485,37 +397,10 @@ else if (count > 0) sm.addNumber(getPrize()); Announcements.getInstance().announceToAll(sm); } - - try - { - con = L2DatabaseFactory.getInstance().getConnection(); - statement = con.prepareStatement(UPDATE_LOTTERY); - statement.setInt(1, getPrize()); - statement.setInt(2, newprize); - statement.setInt(3, enchant); - statement.setInt(4, type2); - statement.setInt(5, prize1); - statement.setInt(6, prize2); - statement.setInt(7, prize3); - statement.setInt(8, getId()); - statement.execute(); - statement.close(); - } - catch (SQLException e) - { - _log.warn("Lottery: Could not store finished lottery data: " + e); - } - finally - { - try - { - con.close(); - } - catch (Exception e) - { - } - } - + + GameRepository repository = DatabaseAccess.getRepository(GameRepository.class); + repository.updateByIdNr(1, getId(), getPrize(), newprize, enchant, type2, prize1, prize2, prize3); + ThreadPoolManager.getInstance().scheduleGeneral(new startLottery(), MINUTE); _number++; @@ -563,99 +448,62 @@ public int[] checkTicket(L2ItemInstance item) return checkTicket(item.getCustomType1(), item.getEnchantLevel(), item.getCustomType2()); } - public int[] checkTicket(int id, int enchant, int type2) - { - int res[] = - { - 0, - 0 - }; - - java.sql.Connection con = null; - PreparedStatement statement; - - try - { - con = L2DatabaseFactory.getInstance().getConnection(); - statement = con.prepareStatement(SELECT_LOTTERY_TICKET); - statement.setInt(1, id); - ResultSet rset = statement.executeQuery(); - - if (rset.next()) - { - int curenchant = rset.getInt("number1") & enchant; - int curtype2 = rset.getInt("number2") & type2; - - if ((curenchant == 0) && (curtype2 == 0)) - { - rset.close(); - statement.close(); - return res; - } - - int count = 0; - - for (int i = 1; i <= 16; i++) - { - int val = curenchant / 2; - if (val != ((double) curenchant / 2)) - { - count++; - } - int val2 = curtype2 / 2; - if (val2 != ((double) curtype2 / 2)) - { - count++; - } - curenchant = val; - curtype2 = val2; - } - - switch (count) - { - case 0: - break; - case 5: - res[0] = 1; - res[1] = rset.getInt("prize1"); - break; - case 4: - res[0] = 2; - res[1] = rset.getInt("prize2"); - break; - case 3: - res[0] = 3; - res[1] = rset.getInt("prize3"); - break; - default: - res[0] = 4; - res[1] = 200; - } - - if (Config.DEBUG) - { - _log.warn("count: " + count + ", id: " + id + ", enchant: " + enchant + ", type2: " + type2); - } - } - - rset.close(); - statement.close(); - } - catch (SQLException e) - { - _log.warn("Lottery: Could not check lottery ticket #" + id + ": " + e); - } - finally - { - try - { - con.close(); - } - catch (Exception e) - { - } - } - + public int[] checkTicket(int id, int enchant, int type2) { + int res[] = { 0, 0 }; + + GameRepository repository = DatabaseAccess.getRepository(GameRepository.class); + Optional optionalGame = repository.findById(id); + if(optionalGame.isPresent()) { + Games game = optionalGame.get(); + + int curenchant = game.getNumber1() & enchant; + int curtype2 = game.getNumber2() & type2; + + if ((curenchant == 0) && (curtype2 == 0)) { + return res; + } + + int count = 0; + + for (int i = 1; i <= 16; i++) + { + int val = curenchant / 2; + if (val != ((double) curenchant / 2)) + { + count++; + } + int val2 = curtype2 / 2; + if (val2 != ((double) curtype2 / 2)) + { + count++; + } + curenchant = val; + curtype2 = val2; + } + + switch (count) + { + case 0: + break; + case 5: + res[0] = 1; + res[1] = game.getPrize1(); + break; + case 4: + res[0] = 2; + res[1] = game.getPrize2(); + break; + case 3: + res[0] = 3; + res[1] = game.getPrize3(); + break; + default: + res[0] = 4; + res[1] = 200; + } + + _log.warn("count: " + count + ", id: " + id + ", enchant: " + enchant + ", type2: " + type2); + } return res; } } diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/Games.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/Games.java index 2ff0c06f..29a71d7a 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/Games.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/Games.java @@ -1,18 +1,72 @@ package com.l2jbr.gameserver.model.database; +import com.l2jbr.commons.database.model.Entity; +import org.springframework.data.annotation.Id; - -public class Games { - - private int id; +public class Games extends Entity { + @Id private int idnr; + private int id; private int number1; private int number2; private int prize; - private int newprize; + private int newPrize; private int prize1; private int prize2; private int prize3; - private long enddate; + private long endDate; private int finished; + + public Games(int id, int idnr, long endDate, int prize) { + this.id = id; + this.idnr = idnr; + this.endDate = endDate; + this.prize = prize; + this.newPrize = prize; + } + + @Override + public Integer getId() { + return idnr; + } + + public int getIdnr() { + return idnr; + } + + public int getNumber1() { + return number1; + } + + public int getNumber2() { + return number2; + } + + public int getPrize() { + return prize; + } + + public int getNewPrize() { + return newPrize; + } + + public int getPrize1() { + return prize1; + } + + public int getPrize2() { + return prize2; + } + + public int getPrize3() { + return prize3; + } + + public long getEndDate() { + return endDate; + } + + public int getFinished() { + return finished; + } } diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/repository/GameRepository.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/repository/GameRepository.java new file mode 100644 index 00000000..e371be89 --- /dev/null +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/repository/GameRepository.java @@ -0,0 +1,26 @@ +package com.l2jbr.gameserver.model.database.repository; + +import com.l2jbr.gameserver.model.database.Games; +import org.springframework.data.jdbc.repository.query.Modifying; +import org.springframework.data.jdbc.repository.query.Query; +import org.springframework.data.repository.CrudRepository; +import org.springframework.data.repository.query.Param; + +import java.util.Optional; + +public interface GameRepository extends CrudRepository { + + @Modifying + @Query("UPDATE games SET prize=:prize, newprize=:prize WHERE id=:id AND idnr=:idnr") + int updatePrizeByIdNr(@Param("id") int id, @Param("idnr") int idnr, @Param("prize") int prize); + + @Modifying + @Query("UPDATE games SET finished=1, prize=:prize, newprize=:newPrize, number1=:number1, number2=:number2, prize1=:prize1, " + + "prize2=:prize2, prize3=:prize3 WHERE id=:id AND idnr=:idnr") + int updateByIdNr(@Param("id") int id, @Param("idnr") int idnr, @Param("prize") int prize, @Param("newPrize") int newprize, + @Param("number1") int number1, @Param("number2") int number2, @Param("prize1") int prize1, @Param("prize2") int prize2, + @Param("prize3") int prize3); + + @Query("SELECT * FROM games WHERE id=1 ORDER BY idnr DESC LIMIT 1") + Optional findLastIdnrById(@Param("id") int id); +} From b77aa360fed6f12786a48376919517d77a90c0a1 Mon Sep 17 00:00:00 2001 From: Alisson Oliveira Date: Tue, 1 May 2018 22:42:13 -0300 Subject: [PATCH 060/236] =?UTF-8?q?Remove=20refer=C3=AAncias=20diretas=20?= =?UTF-8?q?=C3=A0=20tabela=20gameservers?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../database/GameserverRepository.java | 7 +++ .../commons/database/model/GameServers.java | 31 +++++++++++ .../model/database/GameServers.java | 7 --- .../l2jbr/loginserver/GameServerTable.java | 51 +++++-------------- .../gsregistering/GameServerRegister.java | 38 +++----------- 5 files changed, 56 insertions(+), 78 deletions(-) create mode 100644 Commons/src/main/com.l2jbr.commons/com/l2jbr/commons/database/GameserverRepository.java create mode 100644 Commons/src/main/com.l2jbr.commons/com/l2jbr/commons/database/model/GameServers.java delete mode 100644 Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/GameServers.java diff --git a/Commons/src/main/com.l2jbr.commons/com/l2jbr/commons/database/GameserverRepository.java b/Commons/src/main/com.l2jbr.commons/com/l2jbr/commons/database/GameserverRepository.java new file mode 100644 index 00000000..7414660b --- /dev/null +++ b/Commons/src/main/com.l2jbr.commons/com/l2jbr/commons/database/GameserverRepository.java @@ -0,0 +1,7 @@ +package com.l2jbr.commons.database; + +import com.l2jbr.commons.database.model.GameServers; +import org.springframework.data.repository.CrudRepository; + +public interface GameserverRepository extends CrudRepository { +} diff --git a/Commons/src/main/com.l2jbr.commons/com/l2jbr/commons/database/model/GameServers.java b/Commons/src/main/com.l2jbr.commons/com/l2jbr/commons/database/model/GameServers.java new file mode 100644 index 00000000..27bcded1 --- /dev/null +++ b/Commons/src/main/com.l2jbr.commons/com/l2jbr/commons/database/model/GameServers.java @@ -0,0 +1,31 @@ +package com.l2jbr.commons.database.model; + +import com.l2jbr.commons.database.annotation.Column; +import org.springframework.data.annotation.Id; + +public class GameServers extends Entity { + @Id + @Column("server_id") + private int serverId; + private String hexid; + private String host; + + public GameServers(int id, String hexId, String host) { + this.serverId = id; + this.hexid = hexId; + this.host = host; + } + + @Override + public Integer getId() { + return serverId; + } + + public String getHexid() { + return hexid; + } + + public String getHost() { + return host; + } +} diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/GameServers.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/GameServers.java deleted file mode 100644 index f70dfff7..00000000 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/GameServers.java +++ /dev/null @@ -1,7 +0,0 @@ -package com.l2jbr.gameserver.model.database; - -public class GameServers { - private int server_id; - private String hexid; - private String host; -} diff --git a/Loginserver/src/main/com.l2jbr.loginserver/com/l2jbr/loginserver/GameServerTable.java b/Loginserver/src/main/com.l2jbr.loginserver/com/l2jbr/loginserver/GameServerTable.java index e2a5f60c..3b681e92 100644 --- a/Loginserver/src/main/com.l2jbr.loginserver/com/l2jbr/loginserver/GameServerTable.java +++ b/Loginserver/src/main/com.l2jbr.loginserver/com/l2jbr/loginserver/GameServerTable.java @@ -17,7 +17,9 @@ */ package com.l2jbr.loginserver; -import com.l2jbr.commons.database.L2DatabaseFactory; +import com.l2jbr.commons.database.DatabaseAccess; +import com.l2jbr.commons.database.GameserverRepository; +import com.l2jbr.commons.database.model.GameServers; import com.l2jbr.commons.util.Rnd; import com.l2jbr.commons.xml.XMLDocumentFactory; import com.l2jbr.loginserver.gameserverpackets.ServerStatus; @@ -112,23 +114,13 @@ private void loadServerNames() { } - private void loadRegisteredGameServers() throws SQLException { - java.sql.Connection con = null; - PreparedStatement statement = null; - - int id; - con = L2DatabaseFactory.getInstance().getConnection(); - statement = con.prepareStatement("SELECT * FROM gameservers"); - ResultSet rset = statement.executeQuery(); - GameServerInfo gsi; - while (rset.next()) { - id = rset.getInt("server_id"); - gsi = new GameServerInfo(id, stringToHex(rset.getString("hexid"))); + private void loadRegisteredGameServers() { + GameserverRepository repository = DatabaseAccess.getRepository(GameserverRepository.class); + repository.findAll().forEach(gameServer -> { + int id = gameServer.getId(); + GameServerInfo gsi = new GameServerInfo(id, stringToHex(gameServer.getHexid())); _gameServerTable.put(id, gsi); - } - rset.close(); - statement.close(); - con.close(); + }); } public Map getRegisteredGameServers() { @@ -174,28 +166,9 @@ public void registerServerOnDB(GameServerInfo gsi) { } public void registerServerOnDB(byte[] hexId, int id, String externalHost) { - java.sql.Connection con = null; - PreparedStatement statement = null; - try { - con = L2DatabaseFactory.getInstance().getConnection(); - statement = con.prepareStatement("INSERT INTO gameservers (hexid,server_id,host) values (?,?,?)"); - statement.setString(1, hexToString(hexId)); - statement.setInt(2, id); - statement.setString(3, externalHost); - statement.executeUpdate(); - statement.close(); - } catch (SQLException e) { - _log.warn("SQL error while saving gameserver: " + e); - } finally { - try { - statement.close(); - } catch (Exception e) { - } - try { - con.close(); - } catch (Exception e) { - } - } + GameServers gameServer = new GameServers(id, hexToString(hexId), externalHost); + GameserverRepository repository = DatabaseAccess.getRepository(GameserverRepository.class); + repository.save(gameServer); } public String getServerNameById(int id) { diff --git a/Tools/src/main/com.l2jbr.tools/com/l2jbr/tools/gsregistering/GameServerRegister.java b/Tools/src/main/com.l2jbr.tools/com/l2jbr/tools/gsregistering/GameServerRegister.java index 0270128a..d501f0f1 100644 --- a/Tools/src/main/com.l2jbr.tools/com/l2jbr/tools/gsregistering/GameServerRegister.java +++ b/Tools/src/main/com.l2jbr.tools/com/l2jbr/tools/gsregistering/GameServerRegister.java @@ -19,9 +19,12 @@ package com.l2jbr.tools.gsregistering; import com.l2jbr.commons.Config; +import com.l2jbr.commons.database.DatabaseAccess; +import com.l2jbr.commons.database.GameserverRepository; import com.l2jbr.commons.database.L2DatabaseFactory; import com.l2jbr.commons.Server; import com.l2jbr.gameserver.LoginServerThread; +import com.l2jbr.gameserver.model.database.Games; import com.l2jbr.loginserver.GameServerTable; import java.io.IOException; @@ -128,37 +131,8 @@ else if (_choice.equalsIgnoreCase("clean")) } } - public static void cleanRegisteredGameServersFromDB() - { - java.sql.Connection con = null; - PreparedStatement statement = null; - try - { - con = L2DatabaseFactory.getInstance().getConnection(); - statement = con.prepareStatement("DELETE FROM gameservers"); - statement.executeUpdate(); - statement.close(); - } - catch (SQLException e) - { - System.out.println("SQL error while cleaning registered servers: " + e); - } - finally - { - try - { - statement.close(); - } - catch (Exception e) - { - } - try - { - con.close(); - } - catch (Exception e) - { - } - } + public static void cleanRegisteredGameServersFromDB() { + GameserverRepository repository = DatabaseAccess.getRepository(GameserverRepository.class); + repository.deleteAll(); } } \ No newline at end of file From b066f0c69caeb6ae24bc62b6123b20850d9c812c Mon Sep 17 00:00:00 2001 From: Alisson Oliveira Date: Tue, 1 May 2018 23:10:22 -0300 Subject: [PATCH 061/236] =?UTF-8?q?Remove=20refer=C3=AAncias=20diretas=20?= =?UTF-8?q?=C3=A0=20tabela=20global=5Ftasks?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../model/database/Augmentation.java | 2 + .../model/database/CastleManorProcure.java | 2 +- .../model/database/CastleManorProduction.java | 2 + .../model/database/CastleSiegeGuard.java | 2 + .../model/database/CharacterFriends.java | 2 + .../model/database/CharacterHennas.java | 2 + .../model/database/CharacterMacroses.java | 2 + .../model/database/CharacterQuests.java | 2 + .../model/database/CharacterRecipeBook.java | 2 + .../model/database/CharacterRecommends.java | 2 + .../model/database/CharacterSkills.java | 2 + .../model/database/CharacterSkillsSave.java | 2 + .../model/database/CharacterSubclasses.java | 2 + .../model/database/ClanHallFunctions.java | 2 + .../gameserver/model/database/ClanSkills.java | 2 + .../model/database/ClanSubpledges.java | 2 + .../model/database/CursedWeapons.java | 2 + .../gameserver/model/database/Forums.java | 2 + .../gameserver/model/database/Games.java | 2 + .../model/database/GlobalTasks.java | 48 +++++- .../repository/GlobalTaskRepository.java | 17 ++ .../gameserver/taskmanager/TaskManager.java | 157 ++++-------------- 22 files changed, 134 insertions(+), 126 deletions(-) create mode 100644 Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/repository/GlobalTaskRepository.java diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/Augmentation.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/Augmentation.java index 2a2933d0..0601d755 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/Augmentation.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/Augmentation.java @@ -15,6 +15,8 @@ public class Augmentation extends Entity { private Integer skill; private Integer level; + public Augmentation() {} + public Augmentation(int objectId, int effectsId, L2Skill skill) { this.itemId = objectId; this.attributes = effectsId; diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/CastleManorProcure.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/CastleManorProcure.java index 40efe0bc..9eb5cbbb 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/CastleManorProcure.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/CastleManorProcure.java @@ -22,7 +22,7 @@ public class CastleManorProcure extends Entity { private int rewardType; private int period; - CastleManorProcure(){} + public CastleManorProcure(){} public CastleManorProcure(int castleId, int id, int amount, int startAmount, int price, int reward, int period) { this.castleId = castleId; diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/CastleManorProduction.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/CastleManorProduction.java index 865af208..d6952bb2 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/CastleManorProduction.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/CastleManorProduction.java @@ -21,6 +21,8 @@ public class CastleManorProduction extends Entity { private int seedPrice; private int period; + public CastleManorProduction() {} + public CastleManorProduction(int castleId, int seedId, int canProduce, int startProduce, int price, int period) { this.castleId = castleId; this.seedId = seedId; diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/CastleSiegeGuard.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/CastleSiegeGuard.java index 4ba5ab19..07632491 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/CastleSiegeGuard.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/CastleSiegeGuard.java @@ -17,6 +17,8 @@ public class CastleSiegeGuard { private int respawnDelay; private int isHired; + public CastleSiegeGuard() {} + public CastleSiegeGuard(int castleId, int npcId, int x, int y, int z, int heading, int respawnDelay, int isHire) { this.castleId = castleId; this.npcId = npcId; diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/CharacterFriends.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/CharacterFriends.java index 6ae7a77c..f638b008 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/CharacterFriends.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/CharacterFriends.java @@ -16,6 +16,8 @@ public class CharacterFriends extends Entity { @Column("friend_name") private String friendName; + public CharacterFriends() {} + public CharacterFriends(int objectId, int friendId, String name) { this.charId = objectId; this.friendId = friendId; diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/CharacterHennas.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/CharacterHennas.java index a31daf51..5c7ba7d5 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/CharacterHennas.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/CharacterHennas.java @@ -17,6 +17,8 @@ public class CharacterHennas extends Entity { @Column("class_index") private int classIndex; + public CharacterHennas() {} + public CharacterHennas(int objectId, int symbolId, int classIndex, int slot) { this.charObjId = objectId; this.symbolId = symbolId; diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/CharacterMacroses.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/CharacterMacroses.java index 81449005..0c10b563 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/CharacterMacroses.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/CharacterMacroses.java @@ -19,6 +19,8 @@ public class CharacterMacroses extends Entity { private String acronym; private String commands; + public CharacterMacroses() {} + public CharacterMacroses(int objectId, L2Macro macro) { this.charObjId = objectId; this.id = macro.id; diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/CharacterQuests.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/CharacterQuests.java index 2a227605..5fd64dce 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/CharacterQuests.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/CharacterQuests.java @@ -17,6 +17,8 @@ public class CharacterQuests extends Entity { @Column("class_index") private int classIndex; + public CharacterQuests() {} + public CharacterQuests(int objectId, String questName, String var, String value) { this.charId = objectId; this.name = questName; diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/CharacterRecipeBook.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/CharacterRecipeBook.java index 0028e83d..0be05e4a 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/CharacterRecipeBook.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/CharacterRecipeBook.java @@ -12,6 +12,8 @@ public class CharacterRecipeBook extends Entity { private int id; private int type; + public CharacterRecipeBook() {} + public CharacterRecipeBook(int objectId, int id, int type) { this.charId = objectId; this.id = id; diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/CharacterRecommends.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/CharacterRecommends.java index 288d176f..85a805da 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/CharacterRecommends.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/CharacterRecommends.java @@ -14,6 +14,8 @@ public class CharacterRecommends extends Entity { @Column("target_id") private int targetId; + public CharacterRecommends() {} + public CharacterRecommends(int charId, int targetId) { this.charId = charId; this.targetId = targetId; diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/CharacterSkills.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/CharacterSkills.java index 20b3a2e4..67374ec9 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/CharacterSkills.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/CharacterSkills.java @@ -20,6 +20,8 @@ public class CharacterSkills extends Entity { @Column("class_index") private int classIndex; + public CharacterSkills() {} + public CharacterSkills(int charObjectId, int skillId, int skillLevel, String skillName, int classIndex) { this.charObjId = charObjectId; this.skillId = skillId; diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/CharacterSkillsSave.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/CharacterSkillsSave.java index 29a95e47..fe3822e2 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/CharacterSkillsSave.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/CharacterSkillsSave.java @@ -29,6 +29,8 @@ public class CharacterSkillsSave extends Entity { @Column("buff_index") private int buffIndex; + public CharacterSkillsSave() {} + public CharacterSkillsSave(int objectId, int skillId, int skillLevel, int effectCount, int effectCurTime, long reuseDelay, int restoreType, int classIndex, int buffIndex) { this.charObjId = objectId; this.skillId = skillId; diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/CharacterSubclasses.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/CharacterSubclasses.java index a427bc95..f07ce055 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/CharacterSubclasses.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/CharacterSubclasses.java @@ -20,6 +20,8 @@ public class CharacterSubclasses extends Entity { @Column("class_index") private int classIndex; + public CharacterSubclasses() {} + public CharacterSubclasses(int charObjectId, SubClass newClass) { this.charObjId = charObjectId; this.classId = newClass.getClassId(); diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/ClanHallFunctions.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/ClanHallFunctions.java index 1c9a054a..b79a8233 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/ClanHallFunctions.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/ClanHallFunctions.java @@ -17,6 +17,8 @@ public class ClanHallFunctions extends Entity { private long rate; private long endTime; + public ClanHallFunctions() {} + public ClanHallFunctions(int id, int type, int lvl, int lease, long rate, long endTime) { this.hallId = id; this.type = type; diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/ClanSkills.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/ClanSkills.java index 27e1e680..77f55be4 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/ClanSkills.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/ClanSkills.java @@ -18,6 +18,8 @@ public class ClanSkills extends Entity { @Column("skill_name") private String skillName; + public ClanSkills() {} + public ClanSkills(int clanId, L2Skill newSkill) { this.clanId = clanId; this.skillId = newSkill.getId(); diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/ClanSubpledges.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/ClanSubpledges.java index 975e9185..848e2dc7 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/ClanSubpledges.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/ClanSubpledges.java @@ -17,6 +17,8 @@ public class ClanSubpledges extends Entity { @Column("leader_name") private String leaderName; + public ClanSubpledges() {} + public ClanSubpledges(int clanId, int subPledgeId, String subPledgeName, String leader) { this.clanId = clanId; this.subPledgeId = subPledgeId; diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/CursedWeapons.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/CursedWeapons.java index bf988cd8..cd30d4fe 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/CursedWeapons.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/CursedWeapons.java @@ -15,6 +15,8 @@ public class CursedWeapons extends Entity { private int nbKills; private long endTime; + public CursedWeapons() {} + public CursedWeapons(int itemId, int playerId, int playerKarma, int playerPkKills, int nbKills, long endTime) { this.itemId = itemId; this.playerId =playerId; diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/Forums.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/Forums.java index 396acae2..60641364 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/Forums.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/Forums.java @@ -21,6 +21,8 @@ public class Forums extends Entity { @Column("forum_owner_id") private int forumOwnerId; + public Forums() {} + public Forums(int forumId, String forumName, int parentId, int forumPost, int forumType, int forumPerm, int ownerId) { this.forumId = forumId; this.forumName = forumName; diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/Games.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/Games.java index 29a71d7a..e0be85ea 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/Games.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/Games.java @@ -17,6 +17,8 @@ public class Games extends Entity { private long endDate; private int finished; + public Games() {} + public Games(int id, int idnr, long endDate, int prize) { this.id = id; this.idnr = idnr; diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/GlobalTasks.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/GlobalTasks.java index c9b785f2..fb74d976 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/GlobalTasks.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/GlobalTasks.java @@ -1,14 +1,58 @@ package com.l2jbr.gameserver.model.database; +import com.l2jbr.commons.database.annotation.Column; +import com.l2jbr.commons.database.annotation.Table; +import com.l2jbr.commons.database.model.Entity; +import org.springframework.data.annotation.Id; - +@Table("global_tasks") public class GlobalTasks { + @Id private int id; private String task; private String type; - private long last_activation; + @Column("last_activation") + private long lastActivation; private String param1; private String param2; private String param3; + + public GlobalTasks() {} + + public GlobalTasks(String task, String s, long lastActivation, String param1, String param2, String param3) { + this.task = task; + this.type = s; + this.lastActivation = lastActivation; + this.param1 = param1; + this.param2 = param2; + this.param3 = param3; + } + + public Integer getId() { + return id; + } + public String getTask() { + return task; + } + + public String getType() { + return type; + } + + public long getLastActivation() { + return lastActivation; + } + + public String getParam1() { + return param1; + } + + public String getParam2() { + return param2; + } + + public String getParam3() { + return param3; + } } diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/repository/GlobalTaskRepository.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/repository/GlobalTaskRepository.java new file mode 100644 index 00000000..b64b13a0 --- /dev/null +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/repository/GlobalTaskRepository.java @@ -0,0 +1,17 @@ +package com.l2jbr.gameserver.model.database.repository; + +import com.l2jbr.gameserver.model.database.GlobalTasks; +import org.springframework.data.jdbc.repository.query.Modifying; +import org.springframework.data.jdbc.repository.query.Query; +import org.springframework.data.repository.CrudRepository; +import org.springframework.data.repository.query.Param; + +public interface GlobalTaskRepository extends CrudRepository { + + @Modifying + @Query("UPDATE global_tasks SET last_activation=:activation WHERE id=:id") + int updateLastActivationById(@Param("id") int id, @Param("activation") long lastActivation); + + @Query("SELECT EXISTS (SELECT 1 FROM global_tasks WHERE task=:task)") + boolean existsByTask(@Param("task") String task); +} diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/taskmanager/TaskManager.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/taskmanager/TaskManager.java index 8578ab94..ce9af180 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/taskmanager/TaskManager.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/taskmanager/TaskManager.java @@ -17,8 +17,11 @@ */ package com.l2jbr.gameserver.taskmanager; +import com.l2jbr.commons.database.DatabaseAccess; import com.l2jbr.commons.database.L2DatabaseFactory; import com.l2jbr.gameserver.ThreadPoolManager; +import com.l2jbr.gameserver.model.database.GlobalTasks; +import com.l2jbr.gameserver.model.database.repository.GlobalTaskRepository; import com.l2jbr.gameserver.taskmanager.tasks.*; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -40,14 +43,6 @@ public final class TaskManager { protected static final Logger _log = LoggerFactory.getLogger(TaskManager.class.getName()); private static TaskManager _instance; - protected static final String[] SQL_STATEMENTS = - { - "SELECT id,task,type,last_activation,param1,param2,param3 FROM global_tasks", - "UPDATE global_tasks SET last_activation=? WHERE id=?", - "SELECT id FROM global_tasks WHERE task=?", - "INSERT INTO global_tasks (task,type,last_activation,param1,param2,param3) VALUES(?,?,?,?,?,?)" - }; - private final LinkedHashMap _tasks = new LinkedHashMap<>(); protected final List _currentTasks = new LinkedList<>(); @@ -59,17 +54,16 @@ public class ExecutedTask implements Runnable { String[] params; ScheduledFuture scheduled; - public ExecutedTask(Task ptask, TaskTypes ptype, ResultSet rset) throws SQLException { + public ExecutedTask(Task ptask, TaskTypes ptype, GlobalTasks globalTask) { task = ptask; type = ptype; - id = rset.getInt("id"); - lastActivation = rset.getLong("last_activation"); - params = new String[] - { - rset.getString("param1"), - rset.getString("param2"), - rset.getString("param3") - }; + id = globalTask.getId(); + lastActivation = globalTask.getLastActivation(); + params = new String[] { + globalTask.getParam1(), + globalTask.getParam2(), + globalTask.getParam3() + }; } @Override @@ -78,23 +72,8 @@ public void run() { lastActivation = System.currentTimeMillis(); - java.sql.Connection con = null; - - try { - con = L2DatabaseFactory.getInstance().getConnection(); - PreparedStatement statement = con.prepareStatement(SQL_STATEMENTS[1]); - statement.setLong(1, lastActivation); - statement.setInt(2, id); - statement.executeUpdate(); - statement.close(); - } catch (SQLException e) { - _log.warn("cannot updated the Global Task " + id + ": " + e.getMessage()); - } finally { - try { - con.close(); - } catch (Exception e) { - } - } + GlobalTaskRepository repository = DatabaseAccess.getRepository(GlobalTaskRepository.class); + repository.updateLastActivationById(id, lastActivation); if ((type == TYPE_SHEDULED) || (type == TYPE_TIME)) { stopTask(); @@ -174,45 +153,24 @@ public void registerTask(Task task) { } private void startAllTasks() { - java.sql.Connection con = null; - try { - try { - con = L2DatabaseFactory.getInstance().getConnection(); - PreparedStatement statement = con.prepareStatement(SQL_STATEMENTS[0]); - ResultSet rset = statement.executeQuery(); - - while (rset.next()) { - Task task = _tasks.get(rset.getString("task").trim().toLowerCase().hashCode()); + GlobalTaskRepository repository = DatabaseAccess.getRepository(GlobalTaskRepository.class); + repository.findAll().forEach(globalTasks -> { + Task task = _tasks.get(globalTasks.getTask().trim().toLowerCase().hashCode()); - if (task == null) { - continue; - } - - TaskTypes type = TaskTypes.valueOf(rset.getString("type")); + if (task == null) { + return; + } - if (type != TYPE_NONE) { - ExecutedTask current = new ExecutedTask(task, type, rset); - if (launchTask(current)) { - _currentTasks.add(current); - } - } + TaskTypes type = TaskTypes.valueOf(globalTasks.getType()); + if (type != TYPE_NONE) { + ExecutedTask current = new ExecutedTask(task, type, globalTasks); + if (launchTask(current)) { + _currentTasks.add(current); } - - rset.close(); - statement.close(); - - } catch (Exception e) { - _log.error("error while loading Global Task table " + e); - e.printStackTrace(); } + }); - } finally { - try { - con.close(); - } catch (Exception e) { - } - } } private boolean launchTask(ExecutedTask task) { @@ -290,39 +248,13 @@ public static boolean addUniqueTask(String task, TaskTypes type, String param1, } public static boolean addUniqueTask(String task, TaskTypes type, String param1, String param2, String param3, long lastActivation) { - java.sql.Connection con = null; - - try { - con = L2DatabaseFactory.getInstance().getConnection(); - PreparedStatement statement = con.prepareStatement(SQL_STATEMENTS[2]); - statement.setString(1, task); - ResultSet rset = statement.executeQuery(); - - if (!rset.next()) { - statement = con.prepareStatement(SQL_STATEMENTS[3]); - statement.setString(1, task); - statement.setString(2, type.toString()); - statement.setLong(3, lastActivation); - statement.setString(4, param1); - statement.setString(5, param2); - statement.setString(6, param3); - statement.execute(); - } - - rset.close(); - statement.close(); - + GlobalTaskRepository repository = DatabaseAccess.getRepository(GlobalTaskRepository.class); + if(!repository.existsByTask(task)) { + GlobalTasks globalTask = new GlobalTasks(task, type.toString(), lastActivation, param1, param2, param3); + repository.save(globalTask); return true; - } catch (SQLException e) { - _log.warn("cannot add the unique task: " + e.getMessage()); - } finally { - try { - con.close(); - } catch (Exception e) { - } } - - return false; + return false; } public static boolean addTask(String task, TaskTypes type, String param1, String param2, String param3) { @@ -330,31 +262,10 @@ public static boolean addTask(String task, TaskTypes type, String param1, String } public static boolean addTask(String task, TaskTypes type, String param1, String param2, String param3, long lastActivation) { - java.sql.Connection con = null; - - try { - con = L2DatabaseFactory.getInstance().getConnection(); - PreparedStatement statement = con.prepareStatement(SQL_STATEMENTS[3]); - statement.setString(1, task); - statement.setString(2, type.toString()); - statement.setLong(3, lastActivation); - statement.setString(4, param1); - statement.setString(5, param2); - statement.setString(6, param3); - statement.execute(); - - statement.close(); - return true; - } catch (SQLException e) { - _log.warn("cannot add the task: " + e.getMessage()); - } finally { - try { - con.close(); - } catch (Exception e) { - } - } - - return false; + GlobalTasks globalTask = new GlobalTasks(task, type.toString(), lastActivation, param1, param2, param3); + GlobalTaskRepository repository = DatabaseAccess.getRepository(GlobalTaskRepository.class); + repository.save(globalTask); + return true; } } From f85dccd1f6576629945c1a5dcb7aaf8c45d3d416 Mon Sep 17 00:00:00 2001 From: Alisson Oliveira Date: Wed, 2 May 2018 13:47:07 -0300 Subject: [PATCH 062/236] =?UTF-8?q?Remove=20refer=C3=AAncias=20diretas=20?= =?UTF-8?q?=C3=A0=20tabela=20helper=5Fbuff=5Flist?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../datatables/HelperBuffTable.java | 101 ++++++------------ .../model/database/HelperBuffList.java | 50 +++++++-- .../repository/HelperBuffRepository.java | 7 ++ 3 files changed, 85 insertions(+), 73 deletions(-) create mode 100644 Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/repository/HelperBuffRepository.java diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/datatables/HelperBuffTable.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/datatables/HelperBuffTable.java index 43e67962..090eaf4e 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/datatables/HelperBuffTable.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/datatables/HelperBuffTable.java @@ -18,14 +18,14 @@ */ package com.l2jbr.gameserver.datatables; -import com.l2jbr.commons.database.L2DatabaseFactory; +import com.l2jbr.commons.database.DatabaseAccess; +import com.l2jbr.gameserver.model.database.HelperBuffList; +import com.l2jbr.gameserver.model.database.repository.HelperBuffRepository; import com.l2jbr.gameserver.templates.L2HelperBuff; import com.l2jbr.gameserver.templates.StatsSet; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import java.sql.PreparedStatement; -import java.sql.ResultSet; import java.util.LinkedList; import java.util.List; @@ -78,78 +78,45 @@ private HelperBuffTable() { } - /** - * Read and Load the Newbie Helper Buff list from SQL Table helper_buff_list - */ private void restoreHelperBuffData() { - java.sql.Connection con = null; - try { - try { - con = L2DatabaseFactory.getInstance().getConnection(); - PreparedStatement statement = con.prepareStatement("SELECT * FROM helper_buff_list"); - ResultSet helperbuffdata = statement.executeQuery(); - - fillHelperBuffTable(helperbuffdata); - helperbuffdata.close(); - statement.close(); - } catch (Exception e) { - _log.error("Table helper_buff_list not found : Update your DataPack" + e); - e.printStackTrace(); - } + HelperBuffRepository repository = DatabaseAccess.getRepository(HelperBuffRepository.class); + repository.findAll().forEach(helperBuffList -> { + fillHelperBuffTable(helperBuffList); + }); + } - } finally { - try { - con.close(); - } catch (Exception e) { + private void fillHelperBuffTable(HelperBuffList helperBuffList) { + StatsSet helperBuffDat = new StatsSet(); + int id = helperBuffList.getId(); + + helperBuffDat.set("id", id); + helperBuffDat.set("skillID", helperBuffList.getSkillId()); + helperBuffDat.set("skillLevel", helperBuffList.getSkillLevel()); + helperBuffDat.set("lowerLevel", helperBuffList.getLowerLevel()); + helperBuffDat.set("upperLevel", helperBuffList.getUpperLevel()); + helperBuffDat.set("isMagicClass", helperBuffList.getIsMagicClass()); + + // Calulate the range level in wich player must be to obtain buff from Newbie Helper + if ("false".equals(helperBuffList.getIsMagicClass())) { + if (helperBuffList.getLowerLevel() < _physicClassLowestLevel) { + _physicClassLowestLevel = helperBuffList.getLowerLevel(); } - } - } - /** - * Load the Newbie Helper Buff list from SQL Table helper_buff_list - * - * @param HelperBuffData - * @throws Exception - */ - private void fillHelperBuffTable(ResultSet HelperBuffData) throws Exception { - - while (HelperBuffData.next()) { - StatsSet helperBuffDat = new StatsSet(); - int id = HelperBuffData.getInt("id"); - - helperBuffDat.set("id", id); - helperBuffDat.set("skillID", HelperBuffData.getInt("skill_id")); - helperBuffDat.set("skillLevel", HelperBuffData.getInt("skill_level")); - helperBuffDat.set("lowerLevel", HelperBuffData.getInt("lower_level")); - helperBuffDat.set("upperLevel", HelperBuffData.getInt("upper_level")); - helperBuffDat.set("isMagicClass", HelperBuffData.getString("is_magic_class")); - - // Calulate the range level in wich player must be to obtain buff from Newbie Helper - if ("false".equals(HelperBuffData.getString("is_magic_class"))) { - if (HelperBuffData.getInt("lower_level") < _physicClassLowestLevel) { - _physicClassLowestLevel = HelperBuffData.getInt("lower_level"); - } - - if (HelperBuffData.getInt("upper_level") > _physicClassHighestLevel) { - _physicClassHighestLevel = HelperBuffData.getInt("upper_level"); - } - } else { - if (HelperBuffData.getInt("lower_level") < _magicClassLowestLevel) { - _magicClassLowestLevel = HelperBuffData.getInt("lower_level"); - } - - if (HelperBuffData.getInt("upper_level") > _magicClassHighestLevel) { - _magicClassHighestLevel = HelperBuffData.getInt("upper_level"); - } + if (helperBuffList.getUpperLevel() > _physicClassHighestLevel) { + _physicClassHighestLevel = helperBuffList.getUpperLevel(); + } + } else { + if (helperBuffList.getLowerLevel() < _magicClassLowestLevel) { + _magicClassLowestLevel = helperBuffList.getLowerLevel(); } - // Add this Helper Buff to the Helper Buff List - L2HelperBuff template = new L2HelperBuff(helperBuffDat); - _helperBuff.add(template); + if (helperBuffList.getUpperLevel() > _magicClassHighestLevel) { + _magicClassHighestLevel = helperBuffList.getUpperLevel(); + } } - _log.info("Helper Buff Table: Loaded " + _helperBuff.size() + " Templates."); - + L2HelperBuff template = new L2HelperBuff(helperBuffDat); + _helperBuff.add(template); } public boolean isInitialized() { diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/HelperBuffList.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/HelperBuffList.java index dbb82653..5d432882 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/HelperBuffList.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/HelperBuffList.java @@ -1,13 +1,51 @@ package com.l2jbr.gameserver.model.database; +import com.l2jbr.commons.database.annotation.Column; +import com.l2jbr.commons.database.annotation.Table; +import org.springframework.data.annotation.Id; - +@Table("helper_buff_list") public class HelperBuffList { + + @Id private int id; - private int skill_id; + @Column("skill_id") + private int skillId; private String name; - private int skill_level; - private int lower_level; - private int upper_level; - private String is_magic_class; + @Column("skill_level") + private int skillLevel; + @Column("lower_level") + private int lowerLevel; + @Column("upper_level") + private int upperLevel; + @Column("is_magic_class") + private String isMagicClass; + + public int getId() { + return id; + } + + public int getSkillId() { + return skillId; + } + + public String getName() { + return name; + } + + public int getSkillLevel() { + return skillLevel; + } + + public int getLowerLevel() { + return lowerLevel; + } + + public int getUpperLevel() { + return upperLevel; + } + + public String getIsMagicClass() { + return isMagicClass; + } } diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/repository/HelperBuffRepository.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/repository/HelperBuffRepository.java new file mode 100644 index 00000000..4fe516ed --- /dev/null +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/repository/HelperBuffRepository.java @@ -0,0 +1,7 @@ +package com.l2jbr.gameserver.model.database.repository; + +import com.l2jbr.gameserver.model.database.HelperBuffList; +import org.springframework.data.repository.CrudRepository; + +public interface HelperBuffRepository extends CrudRepository { +} From 9c202e324a9c59eaf392d427532cd9d2a30da0e2 Mon Sep 17 00:00:00 2001 From: Alisson Oliveira Date: Wed, 2 May 2018 14:02:44 -0300 Subject: [PATCH 063/236] =?UTF-8?q?Remove=20refer=C3=AAncias=20diretas=20?= =?UTF-8?q?=C3=A0=20tabela=20henna=5Ftrees?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../datatables/HelperBuffTable.java | 1 - .../gameserver/datatables/HennaTreeTable.java | 35 ++++++++----------- .../gameserver/model/database/HennaTrees.java | 21 +++++++++-- .../repository/HennaTreeRepository.java | 7 ++++ 4 files changed, 39 insertions(+), 25 deletions(-) create mode 100644 Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/repository/HennaTreeRepository.java diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/datatables/HelperBuffTable.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/datatables/HelperBuffTable.java index 090eaf4e..087bf844 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/datatables/HelperBuffTable.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/datatables/HelperBuffTable.java @@ -75,7 +75,6 @@ public static HelperBuffTable getInstance() { private HelperBuffTable() { _helperBuff = new LinkedList<>(); restoreHelperBuffData(); - } private void restoreHelperBuffData() { diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/datatables/HennaTreeTable.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/datatables/HennaTreeTable.java index be147889..591ae2f8 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/datatables/HennaTreeTable.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/datatables/HennaTreeTable.java @@ -18,16 +18,15 @@ */ package com.l2jbr.gameserver.datatables; -import com.l2jbr.commons.database.L2DatabaseFactory; +import com.l2jbr.commons.database.DatabaseAccess; import com.l2jbr.gameserver.model.L2HennaInstance; import com.l2jbr.gameserver.model.base.ClassId; +import com.l2jbr.gameserver.model.database.HennaTrees; +import com.l2jbr.gameserver.model.database.repository.HennaTreeRepository; import com.l2jbr.gameserver.templates.L2Henna; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import java.sql.Connection; -import java.sql.PreparedStatement; -import java.sql.ResultSet; import java.util.LinkedHashMap; import java.util.LinkedList; import java.util.List; @@ -53,26 +52,20 @@ private HennaTreeTable() { _hennaTrees = new LinkedHashMap<>(); int count = 0; - try(Connection con = L2DatabaseFactory.getInstance().getConnection(); - PreparedStatement statement2 = con.prepareStatement("SELECT class_id, symbol_id FROM henna_trees ORDER BY symbol_id"); - ResultSet hennatree = statement2.executeQuery()){ - List list; - while (hennatree.next()) { - int id = hennatree.getInt("symbol_id"); - int classId = hennatree.getInt("class_id"); + List list; + HennaTreeRepository repository = DatabaseAccess.getRepository(HennaTreeRepository.class); + for (HennaTrees hennaTrees : repository.findAll()) { + int id = hennaTrees.getSymbolId(); + int classId = hennaTrees.getClassId(); - L2Henna template = HennaTable.getInstance().getTemplate(id); - if (template == null) { - continue; - } - list = _hennaTrees.getOrDefault(ClassId.values()[classId], new LinkedList<>()); - list.add(new L2HennaInstance(template)); - count++; + L2Henna template = HennaTable.getInstance().getTemplate(id); + if (template == null) { + continue; } - }catch (Exception e){ - _log.error("error while creating henna tree", e); + list = _hennaTrees.getOrDefault(ClassId.values()[classId], new LinkedList<>()); + list.add(new L2HennaInstance(template)); + count++; } - _log.info("HennaTreeTable: Loaded " + count + " Henna Tree Templates."); } diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/HennaTrees.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/HennaTrees.java index c4118bda..1300970f 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/HennaTrees.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/HennaTrees.java @@ -1,8 +1,23 @@ package com.l2jbr.gameserver.model.database; +import com.l2jbr.commons.database.annotation.Column; +import com.l2jbr.commons.database.annotation.Table; +import org.springframework.data.annotation.Id; - +@Table("henna_trees") public class HennaTrees { - private int class_id; - private int symbol_id; + + @Id + @Column("class_id") + private int classId; + @Column("symbol_id") + private int symbolId; + + public int getClassId() { + return classId; + } + + public int getSymbolId() { + return symbolId; + } } diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/repository/HennaTreeRepository.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/repository/HennaTreeRepository.java new file mode 100644 index 00000000..b45c5820 --- /dev/null +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/repository/HennaTreeRepository.java @@ -0,0 +1,7 @@ +package com.l2jbr.gameserver.model.database.repository; + +import com.l2jbr.gameserver.model.database.HennaTrees; +import org.springframework.data.repository.CrudRepository; + +public interface HennaTreeRepository extends CrudRepository { +} From 2f6898b5d1e091acaad07228b7a336feaee3785c Mon Sep 17 00:00:00 2001 From: Alisson Oliveira Date: Wed, 2 May 2018 14:43:50 -0300 Subject: [PATCH 064/236] =?UTF-8?q?Remove=20refer=C3=AAncias=20diretas=20?= =?UTF-8?q?=C3=A0=20tabela=20heroes?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../gameserver/model/database/Heroes.java | 44 ++++++- .../database/repository/HeroesRepository.java | 18 +++ .../l2jbr/gameserver/model/entity/Hero.java | 116 +++++++----------- .../gameserver/network/L2GameClient.java | 8 +- 4 files changed, 101 insertions(+), 85 deletions(-) create mode 100644 Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/repository/HeroesRepository.java diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/Heroes.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/Heroes.java index 58b93aa3..f32b914a 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/Heroes.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/Heroes.java @@ -1,11 +1,47 @@ package com.l2jbr.gameserver.model.database; - +import com.l2jbr.commons.database.annotation.Column; +import org.springframework.data.annotation.Id; public class Heroes { - private int char_id; - private String char_name; - private int class_id; + + @Id + @Column("char_id") + private int charId; + @Column("char_name") + private String charName; + @Column("class_id") + private int classId; private int count; private int played; + + public Heroes() {} + + public Heroes(Integer heroId, String name, int classId, int count, int played) { + this.charId = heroId; + this.charName = name; + this.classId = classId; + this.count = count; + this.played = played; + } + + public int getId() { + return charId; + } + + public String getCharName() { + return charName; + } + + public int getClassId() { + return classId; + } + + public int getCount() { + return count; + } + + public int getPlayed() { + return played; + } } diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/repository/HeroesRepository.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/repository/HeroesRepository.java new file mode 100644 index 00000000..a00a36b9 --- /dev/null +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/repository/HeroesRepository.java @@ -0,0 +1,18 @@ +package com.l2jbr.gameserver.model.database.repository; + +import com.l2jbr.gameserver.model.database.Heroes; +import org.springframework.data.jdbc.repository.query.Modifying; +import org.springframework.data.jdbc.repository.query.Query; +import org.springframework.data.repository.CrudRepository; +import org.springframework.data.repository.query.Param; + +public interface HeroesRepository extends CrudRepository { + + @Modifying + @Query("UPDATE heroes SET played=0") + int updateAllResetPlayed(); + + @Modifying + @Query("UPDATE heroes SET count=:count, played=:played WHERE char_id=:char") + int updateCountPlayed(@Param("char") Integer charId, @Param("count") int count, @Param("played") int played); +} diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/entity/Hero.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/entity/Hero.java index fbd5eb4c..e534bd60 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/entity/Hero.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/entity/Hero.java @@ -23,7 +23,6 @@ package com.l2jbr.gameserver.model.entity; -import com.l2jbr.commons.Config; import com.l2jbr.commons.database.DatabaseAccess; import com.l2jbr.commons.database.L2DatabaseFactory; import com.l2jbr.commons.util.Util; @@ -33,7 +32,9 @@ import com.l2jbr.gameserver.model.L2ItemInstance; import com.l2jbr.gameserver.model.L2World; import com.l2jbr.gameserver.model.actor.instance.L2PcInstance; +import com.l2jbr.gameserver.model.database.Heroes; import com.l2jbr.gameserver.model.database.repository.CharacterRepository; +import com.l2jbr.gameserver.model.database.repository.HeroesRepository; import com.l2jbr.gameserver.network.SystemMessageId; import com.l2jbr.gameserver.serverpackets.InventoryUpdate; import com.l2jbr.gameserver.serverpackets.PledgeShowInfoUpdate; @@ -46,7 +47,6 @@ import java.sql.Connection; import java.sql.PreparedStatement; -import java.sql.ResultSet; import java.sql.SQLException; import java.util.ArrayList; import java.util.LinkedHashMap; @@ -54,15 +54,11 @@ import java.util.Map; -public class Hero -{ +public class Hero { private static Logger _log = LoggerFactory.getLogger(Hero.class.getName()); private static Hero _instance; - private static final String GET_ALL_HEROES = "SELECT * FROM heroes"; - private static final String UPDATE_ALL = "UPDATE heroes SET played = 0"; - private static final String INSERT_HERO = "INSERT INTO heroes VALUES (?,?,?,?,?)"; - private static final String UPDATE_HERO = "UPDATE heroes SET count = ?, played = ?" + " WHERE char_id = ?"; + private static final String DELETE_ITEMS = "DELETE FROM items WHERE item_id IN " + "(6842, 6611, 6612, 6613, 6614, 6615, 6616, 6617, 6618, 6619, 6620, 6621) " + "AND owner_id NOT IN (SELECT obj_id FROM characters WHERE accesslevel > 0)"; private static final List _heroItems = new ArrayList<>(); @@ -111,37 +107,26 @@ private void init() { _heroes = new LinkedHashMap<>(); _completeHeroes = new LinkedHashMap<>(); + CharacterRepository characterRepository = DatabaseAccess.getRepository(CharacterRepository.class); - try(Connection con = L2DatabaseFactory.getInstance().getConnection(); - PreparedStatement statement = con.prepareStatement(GET_ALL_HEROES); - ResultSet rset = statement.executeQuery() ) { - - CharacterRepository repository = DatabaseAccess.getRepository(CharacterRepository.class); - - while (rset.next()) { - StatsSet hero = new StatsSet(); - int charId = rset.getInt(Olympiad.CHAR_ID); - hero.set(Olympiad.CHAR_NAME, rset.getString(Olympiad.CHAR_NAME)); - hero.set(Olympiad.CLASS_ID, rset.getInt(Olympiad.CLASS_ID)); - hero.set(COUNT, rset.getInt(COUNT)); - int played = rset.getInt(PLAYED); - hero.set(PLAYED, played); + HeroesRepository heroesRepository = DatabaseAccess.getRepository(HeroesRepository.class); + heroesRepository.findAll().forEach(heroes -> { + StatsSet hero = new StatsSet(); + int charId = heroes.getId(); + hero.set(Olympiad.CHAR_NAME, heroes.getCharName()); + hero.set(Olympiad.CLASS_ID, heroes.getClassId()); + hero.set(COUNT, heroes.getCount()); + int played = heroes.getPlayed(); + hero.set(PLAYED, played); - loadClanData(repository, hero, charId); + loadClanData(characterRepository, hero, charId); - if(played > 0) { - _heroes.put(charId, hero); - } - _completeHeroes.put(charId, hero); - - } - } - catch (SQLException e) { - _log.warn("Hero System: Couldnt load Heroes"); - if (Config.DEBUG) { - _log.error(e.getMessage(), e); + if(played > 0) { + _heroes.put(charId, hero); } - } + _completeHeroes.put(charId, hero); + }); + _log.info("Hero System: Loaded " + _heroes.size() + " Heroes."); _log.info("Hero System: Loaded " + _completeHeroes.size() + " all time Heroes."); } @@ -342,50 +327,31 @@ private void increaseClanReputation(String name, L2Clan clan) { public void updateHeroes(boolean setDefault) { - try(Connection con = L2DatabaseFactory.getInstance().getConnection();) { + HeroesRepository heroesRepository = DatabaseAccess.getRepository(HeroesRepository.class); + if (setDefault) { + heroesRepository.updateAllResetPlayed(); + } else { - if (setDefault) { - PreparedStatement statement = con.prepareStatement(UPDATE_ALL); - statement.execute(); - statement.close(); - } else { - PreparedStatement statement; + CharacterRepository characterRepository = DatabaseAccess.getRepository(CharacterRepository.class); + for (Integer heroId : _heroes.keySet()) { + StatsSet hero = _heroes.get(heroId); - CharacterRepository repository = DatabaseAccess.getRepository(CharacterRepository.class); - for (Integer heroId : _heroes.keySet()) { - StatsSet hero = _heroes.get(heroId); - - if ((_completeHeroes == null) || !_completeHeroes.containsKey(heroId)) { - statement = con.prepareStatement(INSERT_HERO); - statement.setInt(1, heroId); - statement.setString(2, hero.getString(Olympiad.CHAR_NAME)); - statement.setInt(3, hero.getInteger(Olympiad.CLASS_ID)); - statement.setInt(4, hero.getInteger(COUNT)); - statement.setInt(5, hero.getInteger(PLAYED)); - statement.execute(); + if ((_completeHeroes == null) || !_completeHeroes.containsKey(heroId)) { + Heroes heroes = new Heroes(heroId, hero.getString(Olympiad.CHAR_NAME), hero.getInteger(Olympiad.CLASS_ID), + hero.getInteger(COUNT), hero.getInteger(PLAYED)); - loadClanData(repository, hero, heroId); + heroesRepository.save(heroes); - _heroes.remove(heroId); - _heroes.put(heroId, hero); - _completeHeroes.put(heroId, hero); - } else { - statement = con.prepareStatement(UPDATE_HERO); - statement.setInt(1, hero.getInteger(COUNT)); - statement.setInt(2, hero.getInteger(PLAYED)); - statement.setInt(3, heroId); - statement.execute(); - } - statement.close(); - } - } - } - catch (SQLException e) { - _log.warn("Hero System: Couldnt update Heroes"); - if (Config.DEBUG) { - _log.error(e.getMessage(), e); - } - } + loadClanData(characterRepository, hero, heroId); + + _heroes.remove(heroId); + _heroes.put(heroId, hero); + _completeHeroes.put(heroId, hero); + } else { + heroesRepository.updateCountPlayed(heroId, hero.getInteger(COUNT), hero.getInteger(PLAYED)); + } + } + } } public List getHeroItems() diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/network/L2GameClient.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/network/L2GameClient.java index cdb149b5..7923b35c 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/network/L2GameClient.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/network/L2GameClient.java @@ -28,8 +28,6 @@ import com.l2jbr.gameserver.model.CharSelectInfoPackage; import com.l2jbr.gameserver.model.L2World; import com.l2jbr.gameserver.model.actor.instance.L2PcInstance; -import com.l2jbr.gameserver.model.database.Character; -import com.l2jbr.gameserver.model.database.CharacterQuests; import com.l2jbr.gameserver.model.database.repository.*; import com.l2jbr.gameserver.model.entity.L2Event; import com.l2jbr.gameserver.serverpackets.L2GameServerPacket; @@ -275,10 +273,8 @@ public static void deleteCharByObjId(int objId) { CharacterSubclassesRepository subclassesRepository = DatabaseAccess.getRepository(CharacterSubclassesRepository.class); subclassesRepository.deleteById(objId); - statement = con.prepareStatement("DELETE FROM heroes WHERE char_id=?"); - statement.setInt(1, objId); - statement.execute(); - statement.close(); + HeroesRepository heroesRepository = DatabaseAccess.getRepository(HeroesRepository.class); + heroesRepository.deleteById(objId); statement = con.prepareStatement("DELETE FROM olympiad_nobles WHERE char_id=?"); statement.setInt(1, objId); From e90229f494ab6521563bd1fd021254fb38bb2a62 Mon Sep 17 00:00:00 2001 From: Alisson Oliveira Date: Wed, 2 May 2018 18:15:02 -0300 Subject: [PATCH 065/236] =?UTF-8?q?Remove=20refer=C3=AAncias=20diretas=20?= =?UTF-8?q?=C3=A0=20tabela=20items?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../admincommandhandlers/AdminRepairChar.java | 21 +- .../instancemanager/CastleManager.java | 24 +- .../instancemanager/CursedWeaponsManager.java | 102 ++---- .../instancemanager/games/Lottery.java | 133 +++----- .../l2jbr/gameserver/model/CursedWeapon.java | 26 +- .../com/l2jbr/gameserver/model/Inventory.java | 72 ++--- .../l2jbr/gameserver/model/ItemContainer.java | 55 +--- .../gameserver/model/L2ItemInstance.java | 291 +++++------------- .../l2jbr/gameserver/model/PcInventory.java | 37 +-- .../gameserver/model/database/Items.java | 108 ++++++- .../database/repository/ItemRepository.java | 48 +++ .../l2jbr/gameserver/model/entity/Hero.java | 39 +-- .../gameserver/network/L2GameClient.java | 6 +- .../accountmanager/SQLAccountManager.java | 9 +- 14 files changed, 370 insertions(+), 601 deletions(-) create mode 100644 Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/repository/ItemRepository.java diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/handler/admincommandhandlers/AdminRepairChar.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/handler/admincommandhandlers/AdminRepairChar.java index 962ccd39..44ce3145 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/handler/admincommandhandlers/AdminRepairChar.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/handler/admincommandhandlers/AdminRepairChar.java @@ -20,19 +20,16 @@ import com.l2jbr.commons.Config; import com.l2jbr.commons.database.DatabaseAccess; -import com.l2jbr.commons.database.L2DatabaseFactory; import com.l2jbr.gameserver.handler.IAdminCommandHandler; import com.l2jbr.gameserver.model.GMAudit; import com.l2jbr.gameserver.model.actor.instance.L2PcInstance; import com.l2jbr.gameserver.model.database.Character; import com.l2jbr.gameserver.model.database.repository.CharacterRepository; import com.l2jbr.gameserver.model.database.repository.CharacterShortcutsRepository; +import com.l2jbr.gameserver.model.database.repository.ItemRepository; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import java.sql.Connection; -import java.sql.PreparedStatement; -import java.sql.SQLException; import java.util.Optional; @@ -92,25 +89,13 @@ private void handleRepair(String command) { optionalCharacter.ifPresent(character -> { character.updateLocation(-84318, 244579, -3730); - PreparedStatement statement = null; CharacterShortcutsRepository shortcutsRepository = DatabaseAccess.getRepository(CharacterShortcutsRepository.class); shortcutsRepository.deleteById(character.getObjectId()); - try(Connection connection = L2DatabaseFactory.getInstance().getConnection();){ - statement = connection.prepareStatement("UPDATE items SET loc=\"INVENTORY\" WHERE owner_id=?"); - statement.setInt(1, character.getId()); - statement.execute(); - statement.close(); + ItemRepository itemRepository = DatabaseAccess.getRepository(ItemRepository.class); + itemRepository.updateLocationByOwner(character.getId(), "INVENTORY"); - } catch (SQLException e) { - _log.warn( "could not repair char:", e); - } finally { - try { - statement.close(); - } catch (SQLException e) { - } - } characterRepository.save(character); }); diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/instancemanager/CastleManager.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/instancemanager/CastleManager.java index 4d19a61a..e022b81d 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/instancemanager/CastleManager.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/instancemanager/CastleManager.java @@ -18,7 +18,6 @@ package com.l2jbr.gameserver.instancemanager; import com.l2jbr.commons.database.DatabaseAccess; -import com.l2jbr.commons.database.L2DatabaseFactory; import com.l2jbr.gameserver.SevenSigns; import com.l2jbr.gameserver.model.L2Clan; import com.l2jbr.gameserver.model.L2ClanMember; @@ -26,9 +25,9 @@ import com.l2jbr.gameserver.model.L2Object; import com.l2jbr.gameserver.model.actor.instance.L2PcInstance; import com.l2jbr.gameserver.model.database.repository.CastleRepository; +import com.l2jbr.gameserver.model.database.repository.ItemRepository; import com.l2jbr.gameserver.model.entity.Castle; -import java.sql.PreparedStatement; import java.util.LinkedList; import java.util.List; @@ -239,24 +238,9 @@ public void removeCirclet(L2ClanMember member, int castleId) { // continue removing offline } } - // else offline-player circlet removal - java.sql.Connection con = null; - try { - con = L2DatabaseFactory.getInstance().getConnection(); - PreparedStatement statement = con.prepareStatement("DELETE FROM items WHERE owner_id = ? and item_id = ?"); - statement.setInt(1, member.getObjectId()); - statement.setInt(2, circletId); - statement.execute(); - statement.close(); - } catch (Exception e) { - System.out.println("Failed to remove castle circlets offline for player " + member.getName()); - e.printStackTrace(); - } finally { - try { - con.close(); - } catch (Exception e) { - } - } + + ItemRepository repository = DatabaseAccess.getRepository(ItemRepository.class); + repository.deleteByOwnerAndItem(member.getObjectId(), circletId); } } } diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/instancemanager/CursedWeaponsManager.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/instancemanager/CursedWeaponsManager.java index 3e7b2106..d312151d 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/instancemanager/CursedWeaponsManager.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/instancemanager/CursedWeaponsManager.java @@ -19,7 +19,6 @@ import com.l2jbr.commons.Config; import com.l2jbr.commons.database.DatabaseAccess; -import com.l2jbr.commons.database.L2DatabaseFactory; import com.l2jbr.gameserver.model.*; import com.l2jbr.gameserver.model.actor.instance.L2FestivalMonsterInstance; import com.l2jbr.gameserver.model.actor.instance.L2PcInstance; @@ -27,6 +26,7 @@ import com.l2jbr.gameserver.model.actor.instance.L2SiegeGuardInstance; import com.l2jbr.gameserver.model.database.repository.CharacterRepository; import com.l2jbr.gameserver.model.database.repository.CursedWeaponRepository; +import com.l2jbr.gameserver.model.database.repository.ItemRepository; import com.l2jbr.gameserver.network.SystemMessageId; import com.l2jbr.gameserver.serverpackets.SystemMessage; import org.slf4j.Logger; @@ -37,10 +37,6 @@ import javax.xml.parsers.DocumentBuilderFactory; import java.io.File; -import java.sql.Connection; -import java.sql.PreparedStatement; -import java.sql.ResultSet; -import java.sql.SQLException; import java.util.Collection; import java.util.LinkedHashMap; import java.util.Map; @@ -178,84 +174,34 @@ private void restore() { } private void controlPlayers() { - if (Config.DEBUG) { - System.out.print(" Checking players ... "); - } - - Connection con = null; - try { - // Retrieve the L2PcInstance from the characters table of the database - con = L2DatabaseFactory.getInstance().getConnection(); - PreparedStatement statement = null; - ResultSet rset = null; - - - CharacterRepository repository = DatabaseAccess.getRepository(CharacterRepository.class); - // TODO: See comments below... - // This entire for loop should NOT be necessary, since it is already handled by - // CursedWeapon.endOfLife(). However, if we indeed *need* to duplicate it for safety, - // then we'd better make sure that it FULLY cleans up inactive cursed weapons! - // Undesired effects result otherwise, such as player with no zariche but with karma - // or a lost-child entry in the cursedweapons table, without a corresponding one in items... - for (CursedWeapon cw : _cursedWeapons.values()) { - if (cw.isActivated()) { - continue; - } - - // Do an item check to be sure that the cursed weapon isn't hold by someone - int itemId = cw.getItemId(); - try { - statement = con.prepareStatement("SELECT owner_id FROM items WHERE item_id=?"); - statement.setInt(1, itemId); - rset = statement.executeQuery(); - - if (rset.next()) { - // A player has the cursed weapon in his inventory ... - int playerId = rset.getInt("owner_id"); - _log.info("PROBLEM : Player " + playerId + " owns the cursed weapon " + itemId + " but he shouldn't."); - - // Delete the item - statement = con.prepareStatement("DELETE FROM items WHERE owner_id=? AND item_id=?"); - statement.setInt(1, playerId); - statement.setInt(2, itemId); - if (statement.executeUpdate() != 1) { - _log.warn("Error while deleting cursed weapon " + itemId + " from userId " + playerId); - } - statement.close(); + CharacterRepository characterRepository = DatabaseAccess.getRepository(CharacterRepository.class); + ItemRepository itemRepository = DatabaseAccess.getRepository(ItemRepository.class); + // TODO: See comments below... + // This entire for loop should NOT be necessary, since it is already handled by + // CursedWeapon.endOfLife(). However, if we indeed *need* to duplicate it for safety, + // then we'd better make sure that it FULLY cleans up inactive cursed weapons! + // Undesired effects result otherwise, such as player with no zariche but with karma + // or a lost-child entry in the cursedweapons table, without a corresponding one in items... + for (CursedWeapon cw : _cursedWeapons.values()) { + if (cw.isActivated()) { + continue; + } - if(repository.updatePKAndKarma(playerId, cw.getPlayerPkKills(), cw.getPlayerKarma()) < 1){ - _log.warn("Error while updating karma & pkkills for userId {}", cw.getPlayerId()); - } + // Do an item check to be sure that the cursed weapon isn't hold by someone + int itemId = cw.getItemId(); + itemRepository.findOwnerIdByItem(itemId).ifPresent(owner -> { + _log.warn("PROBLEM : Player {} owns the cursed weapon {} but he shouldn't.", owner, itemId); - // clean up the cursedweapons table. - removeFromDb(itemId); - } - rset.close(); - statement.close(); - } catch (SQLException sqlE) { + if(itemRepository.deleteByOwnerAndItem(owner, itemId) == 0) { + _log.warn("Error while deleting cursed weapon {} from userId {}", itemId, owner); } - // close the statement to avoid multiply prepared statement errors in following iterations. - try { - con.close(); - } catch (Exception e) { - } - } - } catch (Exception e) { - _log.warn("Could not check CursedWeapons data: " + e); - if (Config.DEBUG) { - System.out.println("ERROR"); - } - return; - } finally { - try { - con.close(); - } catch (Exception e) { - } - } + if(characterRepository.updatePKAndKarma(owner, cw.getPlayerPkKills(), cw.getPlayerKarma()) < 1){ + _log.warn("Error while updating karma & pkkills for userId {}", cw.getPlayerId()); + } - if (Config.DEBUG) { - System.out.println("DONE"); + removeFromDb(itemId); + }); } } diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/instancemanager/games/Lottery.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/instancemanager/games/Lottery.java index d6dec679..8348f9e5 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/instancemanager/games/Lottery.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/instancemanager/games/Lottery.java @@ -20,21 +20,19 @@ import com.l2jbr.commons.Config; import com.l2jbr.commons.database.DatabaseAccess; -import com.l2jbr.commons.database.L2DatabaseFactory; import com.l2jbr.commons.util.Rnd; import com.l2jbr.gameserver.Announcements; import com.l2jbr.gameserver.ThreadPoolManager; import com.l2jbr.gameserver.model.L2ItemInstance; import com.l2jbr.gameserver.model.database.Games; +import com.l2jbr.gameserver.model.database.Items; import com.l2jbr.gameserver.model.database.repository.GameRepository; +import com.l2jbr.gameserver.model.database.repository.ItemRepository; import com.l2jbr.gameserver.network.SystemMessageId; import com.l2jbr.gameserver.serverpackets.SystemMessage; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import java.sql.PreparedStatement; -import java.sql.ResultSet; -import java.sql.SQLException; import java.util.Calendar; import java.util.Optional; @@ -45,8 +43,6 @@ public class Lottery { private static Lottery _instance; protected static final Logger _log = LoggerFactory.getLogger(Lottery.class.getName()); - private static final String SELECT_LOTTERY_ITEM = "SELECT enchant_level, custom_type2 FROM items WHERE item_id = 4442 AND custom_type1 = ?"; - protected int _number; protected int _prize; protected boolean _isSellingTickets; @@ -268,83 +264,50 @@ public void run() int count2 = 0; int count3 = 0; int count4 = 0; - - java.sql.Connection con = null; - PreparedStatement statement; - try - { - con = L2DatabaseFactory.getInstance().getConnection(); - statement = con.prepareStatement(SELECT_LOTTERY_ITEM); - statement.setInt(1, getId()); - ResultSet rset = statement.executeQuery(); - - while (rset.next()) - { - int curenchant = rset.getInt("enchant_level") & enchant; - int curtype2 = rset.getInt("custom_type2") & type2; - - if ((curenchant == 0) && (curtype2 == 0)) - { - continue; - } - - int count = 0; - - for (int i = 1; i <= 16; i++) - { - int val = curenchant / 2; - - if (val != ((double) curenchant / 2)) - { - count++; - } - - int val2 = curtype2 / 2; - - if (val2 != ((double) curtype2 / 2)) - { - count++; - } - - curenchant = val; - curtype2 = val2; - } - - if (count == 5) - { - count1++; - } - else if (count == 4) - { - count2++; - } - else if (count == 3) - { - count3++; - } - else if (count > 0) - { - count4++; - } - } - rset.close(); - statement.close(); - } - catch (SQLException e) - { - _log.warn("Lottery: Could restore lottery data: " + e); - } - finally - { - try - { - con.close(); - } - catch (Exception e) - { - } - } - + + + ItemRepository itemRepository = DatabaseAccess.getRepository(ItemRepository.class); + for (Items items : itemRepository.findByItemAndCustomType(4442, getId())) { + int curenchant = items.getEnchantLevel() & enchant; + int curtype2 = items.getCustomType2() & type2; + + if ((curenchant == 0) && (curtype2 == 0)) { + continue; + } + + int count = 0; + + for (int i = 1; i <= 16; i++) { + int val = curenchant / 2; + + if (val != ((double) curenchant / 2)) { + count++; + } + + int val2 = curtype2 / 2; + + if (val2 != ((double) curtype2 / 2)) { + count++; + } + + curenchant = val; + curtype2 = val2; + } + + if (count == 5) { + count1++; + } + else if (count == 4) { + count2++; + } + else if (count == 3) { + count3++; + } + else if (count > 0) { + count4++; + } + } + int prize4 = count4 * Config.ALT_LOTTERY_2_AND_1_NUMBER_PRIZE; int prize1 = 0; int prize2 = 0; @@ -398,8 +361,8 @@ else if (count > 0) Announcements.getInstance().announceToAll(sm); } - GameRepository repository = DatabaseAccess.getRepository(GameRepository.class); - repository.updateByIdNr(1, getId(), getPrize(), newprize, enchant, type2, prize1, prize2, prize3); + GameRepository gameRepository = DatabaseAccess.getRepository(GameRepository.class); + gameRepository.updateByIdNr(1, getId(), getPrize(), newprize, enchant, type2, prize1, prize2, prize3); ThreadPoolManager.getInstance().scheduleGeneral(new startLottery(), MINUTE); _number++; diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/CursedWeapon.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/CursedWeapon.java index 4d67a4e8..38a3b7e7 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/CursedWeapon.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/CursedWeapon.java @@ -19,7 +19,6 @@ import com.l2jbr.commons.Config; import com.l2jbr.commons.database.DatabaseAccess; -import com.l2jbr.commons.database.L2DatabaseFactory; import com.l2jbr.commons.util.Rnd; import com.l2jbr.gameserver.ThreadPoolManager; import com.l2jbr.gameserver.datatables.SkillTable; @@ -28,6 +27,7 @@ import com.l2jbr.gameserver.model.database.CursedWeapons; import com.l2jbr.gameserver.model.database.repository.CharacterRepository; import com.l2jbr.gameserver.model.database.repository.CursedWeaponRepository; +import com.l2jbr.gameserver.model.database.repository.ItemRepository; import com.l2jbr.gameserver.network.SystemMessageId; import com.l2jbr.gameserver.serverpackets.*; import com.l2jbr.gameserver.templates.L2Item; @@ -35,9 +35,6 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import java.sql.Connection; -import java.sql.PreparedStatement; -import java.sql.SQLException; import java.util.concurrent.ScheduledFuture; @@ -125,23 +122,16 @@ public void endOfLife() } else { // Remove from Db - _log.info(_name + " being removed offline."); - CharacterRepository repository = DatabaseAccess.getRepository(CharacterRepository.class); - if(repository.updatePKAndKarma(_playerId, _playerPkKills, _playerKarma) < 1) { + _log.info("{} being removed offline.", _name); + CharacterRepository characterRepository = DatabaseAccess.getRepository(CharacterRepository.class); + if(characterRepository.updatePKAndKarma(_playerId, _playerPkKills, _playerKarma) < 1) { _log.warn("Error while updating karma & pkkills for userId {}", _playerId); } - try(Connection con = L2DatabaseFactory.getInstance().getConnection(); - PreparedStatement statement = con.prepareStatement("DELETE FROM items WHERE owner_id=? AND item_id=?")) { - statement.setInt(1, _playerId); - statement.setInt(2, _itemId); - if (statement.executeUpdate() != 1) { - _log.warn("Error while deleting itemId " + _itemId + " from userId " + _playerId); - } - } - catch (Exception e) { - _log.warn("Could not delete : " + e); - } + ItemRepository itemRepository = DatabaseAccess.getRepository(ItemRepository.class); + if(itemRepository.deleteByOwnerAndItem(_playerId, _itemId) < 1) { + _log.warn("Error while deleting itemId {} from userId {}", _itemId, _playerId); + } } } else diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/Inventory.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/Inventory.java index 9fb4495b..d833db80 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/Inventory.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/Inventory.java @@ -19,16 +19,15 @@ package com.l2jbr.gameserver.model; import com.l2jbr.commons.Config; -import com.l2jbr.commons.database.L2DatabaseFactory; +import com.l2jbr.commons.database.DatabaseAccess; import com.l2jbr.gameserver.datatables.ArmorSetsTable; import com.l2jbr.gameserver.datatables.ItemTable; import com.l2jbr.gameserver.datatables.SkillTable; import com.l2jbr.gameserver.model.L2ItemInstance.ItemLocation; import com.l2jbr.gameserver.model.actor.instance.L2PcInstance; +import com.l2jbr.gameserver.model.database.repository.ItemRepository; import com.l2jbr.gameserver.templates.*; -import java.sql.PreparedStatement; -import java.sql.ResultSet; import java.util.LinkedList; import java.util.List; @@ -1161,62 +1160,37 @@ public L2ItemInstance findArrowForBow(L2Item bow) { return getItemByItemId(arrowsId); } - /** - * Get back items in inventory from database - */ @Override public void restore() { - java.sql.Connection con = null; - try { - con = L2DatabaseFactory.getInstance().getConnection(); - PreparedStatement statement = con.prepareStatement("SELECT object_id FROM items WHERE owner_id=? AND (loc=? OR loc=?) " + "ORDER BY object_id DESC"); - statement.setInt(1, getOwner().getObjectId()); - statement.setString(2, getBaseLocation().name()); - statement.setString(3, getEquipLocation().name()); - ResultSet inv = statement.executeQuery(); - - L2ItemInstance item; - while (inv.next()) { - int objectId = inv.getInt(1); - item = L2ItemInstance.restoreFromDb(objectId); - if (item == null) { - continue; - } + ItemRepository repository = DatabaseAccess.getRepository(ItemRepository.class); + repository.findAllByOwnerAndLocations(getOwner().getObjectId(), getBaseLocation().name(), getEquipLocation().name()).forEach(items -> { + L2ItemInstance item = L2ItemInstance.restoreFromDb(items); + if (item == null) { + return; + } - if (getOwner() instanceof L2PcInstance) { - L2PcInstance player = (L2PcInstance) getOwner(); + if (getOwner() instanceof L2PcInstance) { + L2PcInstance player = (L2PcInstance) getOwner(); - if (!player.isGM()) { - if (!player.isHero()) { - int itemId = item.getItemId(); - if (((itemId >= 6611) && (itemId <= 6621)) || (itemId == 6842)) { - item.setLocation(ItemLocation.INVENTORY); - } + if (!player.isGM()) { + if (!player.isHero()) { + int itemId = item.getItemId(); + if (((itemId >= 6611) && (itemId <= 6621)) || (itemId == 6842)) { + item.setLocation(ItemLocation.INVENTORY); } } } - - L2World.getInstance().storeObject(item); - - // If stackable item is found in inventory just add to current quantity - if (item.isStackable() && (getItemByItemId(item.getItemId()) != null)) { - addItem("Restore", item, null, getOwner()); - } else { - addItem(item); - } } - inv.close(); - statement.close(); - refreshWeight(); - } catch (Exception e) { - _log.warn("Could not restore inventory : " + e); - } finally { - try { - con.close(); - } catch (Exception e) { + L2World.getInstance().storeObject(item); + + // If stackable item is found in inventory just add to current quantity + if (item.isStackable() && (getItemByItemId(item.getItemId()) != null)) { + addItem("Restore", item, null, getOwner()); + } else { + addItem(item); } - } + }); } /** diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/ItemContainer.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/ItemContainer.java index c0ee9d0c..7d1f6578 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/ItemContainer.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/ItemContainer.java @@ -19,17 +19,16 @@ package com.l2jbr.gameserver.model; import com.l2jbr.commons.Config; -import com.l2jbr.commons.database.L2DatabaseFactory; +import com.l2jbr.commons.database.DatabaseAccess; import com.l2jbr.gameserver.GameTimeController; import com.l2jbr.gameserver.datatables.ItemTable; import com.l2jbr.gameserver.model.L2ItemInstance.ItemLocation; import com.l2jbr.gameserver.model.actor.instance.L2PcInstance; +import com.l2jbr.gameserver.model.database.repository.ItemRepository; import com.l2jbr.gameserver.templates.L2Item; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import java.sql.PreparedStatement; -import java.sql.ResultSet; import java.util.LinkedList; import java.util.List; @@ -539,47 +538,23 @@ public void updateDatabase() { } } - /** - * Get back items in container from database - */ public void restore() { - java.sql.Connection con = null; - try { - con = L2DatabaseFactory.getInstance().getConnection(); - PreparedStatement statement = con.prepareStatement("SELECT object_id FROM items WHERE owner_id=? AND (loc=?) " + "ORDER BY object_id DESC"); - statement.setInt(1, getOwnerId()); - statement.setString(2, getBaseLocation().name()); - ResultSet inv = statement.executeQuery(); - - L2ItemInstance item; - while (inv.next()) { - int objectId = inv.getInt(1); - item = L2ItemInstance.restoreFromDb(objectId); - if (item == null) { - continue; - } - - L2World.getInstance().storeObject(item); - - // If stackable item is found in inventory just add to current quantity - if (item.isStackable() && (getItemByItemId(item.getItemId()) != null)) { - addItem("Restore", item, null, getOwner()); - } else { - addItem(item); - } + ItemRepository repository = DatabaseAccess.getRepository(ItemRepository.class); + repository.findAllByOwnerAndLocation(getOwnerId(), getBaseLocation().name()).forEach(items -> { + L2ItemInstance item = L2ItemInstance.restoreFromDb(items); + if (item == null) { + return; } - inv.close(); - statement.close(); - refreshWeight(); - } catch (Exception e) { - _log.warn( "could not restore container:", e); - } finally { - try { - con.close(); - } catch (Exception e) { + L2World.getInstance().storeObject(item); + + // If stackable item is found in inventory just add to current quantity + if (item.isStackable() && (getItemByItemId(item.getItemId()) != null)) { + addItem("Restore", item, null, getOwner()); + } else { + addItem(item); } - } + }); } public boolean validateCapacity(int slots) { diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/L2ItemInstance.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/L2ItemInstance.java index 53ff3048..3271f59e 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/L2ItemInstance.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/L2ItemInstance.java @@ -20,7 +20,6 @@ import com.l2jbr.commons.Config; import com.l2jbr.commons.database.DatabaseAccess; -import com.l2jbr.commons.database.L2DatabaseFactory; import com.l2jbr.gameserver.ThreadPoolManager; import com.l2jbr.gameserver.ai.CtrlIntention; import com.l2jbr.gameserver.datatables.ItemTable; @@ -28,7 +27,9 @@ import com.l2jbr.gameserver.model.actor.instance.L2PcInstance; import com.l2jbr.gameserver.model.actor.knownlist.NullKnownList; import com.l2jbr.gameserver.model.database.Augmentation; +import com.l2jbr.gameserver.model.database.Items; import com.l2jbr.gameserver.model.database.repository.AugmentationsRepository; +import com.l2jbr.gameserver.model.database.repository.ItemRepository; import com.l2jbr.gameserver.network.SystemMessageId; import com.l2jbr.gameserver.serverpackets.ActionFailed; import com.l2jbr.gameserver.serverpackets.InventoryUpdate; @@ -41,8 +42,6 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import java.sql.PreparedStatement; -import java.sql.ResultSet; import java.util.Optional; import java.util.concurrent.ScheduledFuture; @@ -55,7 +54,7 @@ public final class L2ItemInstance extends L2Object { private static final Logger _log = LoggerFactory.getLogger(L2ItemInstance.class.getName()); private static final Logger _logItems = LoggerFactory.getLogger("item"); - + /** Enumeration of locations for item */ public static enum ItemLocation { @@ -977,111 +976,66 @@ public void updateDatabase() insertIntoDb(); } } - - /** - * Returns a L2ItemInstance stored in database from its objectID - * @param objectId : int designating the objectID of the item - * @return L2ItemInstance - */ - public static L2ItemInstance restoreFromDb(int objectId) - { - L2ItemInstance inst = null; - java.sql.Connection con = null; - try - { - con = L2DatabaseFactory.getInstance().getConnection(); - PreparedStatement statement = con.prepareStatement("SELECT owner_id, object_id, item_id, count, enchant_level, loc, loc_data, price_sell, price_buy, custom_type1, custom_type2, mana_left FROM items WHERE object_id = ?"); - statement.setInt(1, objectId); - ResultSet rs = statement.executeQuery(); - if (rs.next()) - { - int owner_id = rs.getInt("owner_id"); - int item_id = rs.getInt("item_id"); - int count = rs.getInt("count"); - ItemLocation loc = ItemLocation.valueOf(rs.getString("loc")); - int loc_data = rs.getInt("loc_data"); - int enchant_level = rs.getInt("enchant_level"); - int custom_type1 = rs.getInt("custom_type1"); - int custom_type2 = rs.getInt("custom_type2"); - int price_sell = rs.getInt("price_sell"); - int price_buy = rs.getInt("price_buy"); - int manaLeft = rs.getInt("mana_left"); - L2Item item = ItemTable.getInstance().getTemplate(item_id); - if (item == null) - { - _log.error("Item item_id=" + item_id + " not known, object_id=" + objectId); - rs.close(); - statement.close(); - return null; - } - inst = new L2ItemInstance(objectId, item); - inst._existsInDb = true; - inst._storedInDb = true; - inst._ownerId = owner_id; - inst._count = count; - inst._enchantLevel = enchant_level; - inst._type1 = custom_type1; - inst._type2 = custom_type2; - inst._loc = loc; - inst._locData = loc_data; - inst._priceSell = price_sell; - inst._priceBuy = price_buy; - - // Setup life time for shadow weapons - inst._mana = manaLeft; - - // consume 1 mana - if ((inst._mana > 0) && (inst.getLocation() == ItemLocation.PAPERDOLL)) - { - inst.decreaseMana(false); - } - - // if mana left is 0 delete this item - if (inst._mana == 0) - { - inst.removeFromDb(); - rs.close(); - statement.close(); - return null; - } - else if ((inst._mana > 0) && (inst.getLocation() == ItemLocation.PAPERDOLL)) - { - inst.scheduleConsumeManaTask(); - } - } - else - { - _log.error("Item object_id=" + objectId + " not found"); - rs.close(); - statement.close(); - return null; - } - rs.close(); - statement.close(); - AugmentationsRepository repository = DatabaseAccess.getRepository(AugmentationsRepository.class); - Optional optionalAugmentation = repository.findById(objectId); - if(optionalAugmentation.isPresent()) { - Augmentation augmentation = optionalAugmentation.get(); - inst._augmentation = new L2Augmentation(inst, augmentation.getAttributes(), augmentation.getSkill(), augmentation.getLevel(), false ); - } - - } - catch (Exception e) - { - _log.error( "Could not restore item " + objectId + " from DB:", e); - } - finally - { - try - { - con.close(); - } - catch (Exception e) - { - } - } - return inst; + public static L2ItemInstance restoreFromDb(Items items) { + int owner_id = items.getOwnerId(); + int item_id = items.getItemId(); + int objectId = items.getId(); + int count = items.getCount(); + ItemLocation loc = ItemLocation.valueOf(items.getLoc()); + int loc_data = items.getLocData(); + int enchant_level = items.getEnchantLevel(); + int custom_type1 = items.getCustomType1(); + int custom_type2 = items.getCustomType2(); + int price_sell = items.getPriceSell(); + int price_buy = items.getPriceBuy(); + int manaLeft = items.getManaLeft(); + + L2Item item = ItemTable.getInstance().getTemplate(item_id); + if (item == null) { + _log.error("Item item_id={} not known, object_id={}", item_id, objectId); + return null; + } + + L2ItemInstance inst = new L2ItemInstance(objectId, item); + inst._existsInDb = true; + inst._storedInDb = true; + inst._ownerId = owner_id; + inst._count = count; + inst._enchantLevel = enchant_level; + inst._type1 = custom_type1; + inst._type2 = custom_type2; + inst._loc = loc; + inst._locData = loc_data; + inst._priceSell = price_sell; + inst._priceBuy = price_buy; + + // Setup life time for shadow weapons + inst._mana = manaLeft; + + // consume 1 mana + if ((inst._mana > 0) && (inst.getLocation() == ItemLocation.PAPERDOLL)) + { + inst.decreaseMana(false); + } + + // if mana left is 0 delete this item + if (inst._mana == 0) { + inst.removeFromDb(); + return null; + } + else if ((inst._mana > 0) && (inst.getLocation() == ItemLocation.PAPERDOLL)) { + inst.scheduleConsumeManaTask(); + } + + AugmentationsRepository repository = DatabaseAccess.getRepository(AugmentationsRepository.class); + Optional optionalAugmentation = repository.findById(objectId); + if(optionalAugmentation.isPresent()) { + Augmentation augmentation = optionalAugmentation.get(); + inst._augmentation = new L2Augmentation(inst, augmentation.getAttributes(), augmentation.getSkill(), augmentation.getLevel(), false ); + } + + return inst; } /** @@ -1152,41 +1106,13 @@ private void updateInDb() return; } - java.sql.Connection con = null; - try - { - con = L2DatabaseFactory.getInstance().getConnection(); - PreparedStatement statement = con.prepareStatement("UPDATE items SET owner_id=?,count=?,loc=?,loc_data=?,enchant_level=?,price_sell=?,price_buy=?,custom_type1=?,custom_type2=?,mana_left=? " + "WHERE object_id = ?"); - statement.setInt(1, _ownerId); - statement.setInt(2, getCount()); - statement.setString(3, _loc.name()); - statement.setInt(4, _locData); - statement.setInt(5, getEnchantLevel()); - statement.setInt(6, _priceSell); - statement.setInt(7, _priceBuy); - statement.setInt(8, getCustomType1()); - statement.setInt(9, getCustomType2()); - statement.setInt(10, getMana()); - statement.setInt(11, getObjectId()); - statement.executeUpdate(); - _existsInDb = true; - _storedInDb = true; - statement.close(); - } - catch (Exception e) - { - _log.error( "Could not update item " + getObjectId() + " in DB: Reason: " + "Duplicate itemId"); - } - finally - { - try - { - con.close(); - } - catch (Exception e) - { - } - } + ItemRepository repository = DatabaseAccess.getRepository(ItemRepository.class); + repository.updateById(getObjectId(), _ownerId, getCount(), _loc.name(), _locData, getEnchantLevel(), _priceSell, + _priceBuy, getCustomType1(), getCustomType2(), getMana()); + + _existsInDb = true; + _storedInDb = true; + } /** @@ -1202,43 +1128,14 @@ private void insertIntoDb() { assert !_existsInDb && (getObjectId() != 0); } - java.sql.Connection con = null; - try - { - con = L2DatabaseFactory.getInstance().getConnection(); - PreparedStatement statement = con.prepareStatement("INSERT INTO items (owner_id,item_id,count,loc,loc_data,enchant_level,price_sell,price_buy,object_id,custom_type1,custom_type2,mana_left) " + "VALUES (?,?,?,?,?,?,?,?,?,?,?,?)"); - statement.setInt(1, _ownerId); - statement.setInt(2, _itemId); - statement.setInt(3, getCount()); - statement.setString(4, _loc.name()); - statement.setInt(5, _locData); - statement.setInt(6, getEnchantLevel()); - statement.setInt(7, _priceSell); - statement.setInt(8, _priceBuy); - statement.setInt(9, getObjectId()); - statement.setInt(10, _type1); - statement.setInt(11, _type2); - statement.setInt(12, getMana()); - - statement.executeUpdate(); - _existsInDb = true; - _storedInDb = true; - statement.close(); - } - catch (Exception e) - { - _log.error( "Could not insert item " + getObjectId() + " into DB: Reason: " + "Duplicate itemId"); - } - finally - { - try - { - con.close(); - } - catch (Exception e) - { - } - } + + Items item = new Items(getObjectId(), _ownerId, _itemId, getCount(), _loc.name(), _locData, getEnchantLevel(), + _priceSell, _priceBuy, _type1, _type2, _mana); + ItemRepository repository = DatabaseAccess.getRepository(ItemRepository.class); + repository.save(item); + _existsInDb = true; + _storedInDb = true; + } /** @@ -1256,36 +1153,14 @@ private void removeFromDb() } // delete augmentation data - if (isAugmented()) - { + if (isAugmented()) { _augmentation.deleteAugmentationData(); } - - java.sql.Connection con = null; - try - { - con = L2DatabaseFactory.getInstance().getConnection(); - PreparedStatement statement = con.prepareStatement("DELETE FROM items WHERE object_id=?"); - statement.setInt(1, getObjectId()); - statement.executeUpdate(); - _existsInDb = false; - _storedInDb = false; - statement.close(); - } - catch (Exception e) - { - _log.error( "Could not delete item " + getObjectId() + " in DB:", e); - } - finally - { - try - { - con.close(); - } - catch (Exception e) - { - } - } + + ItemRepository repository = DatabaseAccess.getRepository(ItemRepository.class); + repository.deleteById(getObjectId()); + _existsInDb = false; + _storedInDb = false; } /** diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/PcInventory.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/PcInventory.java index db4a96ba..c53d7277 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/PcInventory.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/PcInventory.java @@ -17,14 +17,13 @@ */ package com.l2jbr.gameserver.model; -import com.l2jbr.commons.database.L2DatabaseFactory; +import com.l2jbr.commons.database.DatabaseAccess; import com.l2jbr.gameserver.model.L2ItemInstance.ItemLocation; import com.l2jbr.gameserver.model.TradeList.TradeItem; import com.l2jbr.gameserver.model.actor.instance.L2PcInstance; +import com.l2jbr.gameserver.model.database.repository.ItemRepository; import com.l2jbr.gameserver.templates.L2EtcItemType; -import java.sql.PreparedStatement; -import java.sql.ResultSet; import java.util.LinkedList; import java.util.List; @@ -552,32 +551,14 @@ public void restore() { public static int[][] restoreVisibleInventory(int objectId) { int[][] paperdoll = new int[0x12][3]; - java.sql.Connection con = null; - - try { - con = L2DatabaseFactory.getInstance().getConnection(); - PreparedStatement statement2 = con.prepareStatement("SELECT object_id,item_id,loc_data,enchant_level FROM items WHERE owner_id=? AND loc='PAPERDOLL'"); - statement2.setInt(1, objectId); - ResultSet invdata = statement2.executeQuery(); - - while (invdata.next()) { - int slot = invdata.getInt("loc_data"); - paperdoll[slot][0] = invdata.getInt("object_id"); - paperdoll[slot][1] = invdata.getInt("item_id"); - paperdoll[slot][2] = invdata.getInt("enchant_level"); - } - invdata.close(); - statement2.close(); - } catch (Exception e) { - _log.warn( "could not restore inventory:", e); - } finally { - try { - con.close(); - } catch (Exception e) { - _log.warn(""); - } - } + ItemRepository repository = DatabaseAccess.getRepository(ItemRepository.class); + repository.findAllByOwnerAndLocation(objectId, "PAPERDOLL").forEach(items -> { + int slot = items.getLocData(); + paperdoll[slot][0] = items.getId(); + paperdoll[slot][1] = items.getItemId(); + paperdoll[slot][2] = items.getEnchantLevel(); + }); return paperdoll; } diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/Items.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/Items.java index c3a6a061..37af411a 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/Items.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/Items.java @@ -1,18 +1,102 @@ package com.l2jbr.gameserver.model.database; -public class Items { +import com.l2jbr.commons.database.annotation.Column; +import com.l2jbr.commons.database.model.Entity; +import org.springframework.data.annotation.Id; - private int owner_id; - private int object_id; - private int item_id; +public class Items extends Entity { + + @Id + @Column("object_id") + private int objectId; + @Column("owner_id") + private int ownerId; + @Column("item_id") + private int itemId; private int count; - private int enchant_level; + @Column("enchant_level") + private int enchantLevel; private String loc; - private int loc_data; - private int price_sell; - private int price_buy; - private int time_of_use; - private int custom_type1; - private int custom_type2; - private int mana_left; + @Column("loc_data") + private int locData; + @Column("price_sell") + private int priceSell; + @Column("price_buy") + private int priceBuy; + @Column("time_of_use") + private int timeOfUse; + @Column("custom_type1") + private int customType1; + @Column("custom_type2") + private int customType2; + @Column("mana_left") + private int manaLeft; + + public Items() { } + + public Items(int objectId, int ownerId, int itemId, int count, String loc, int locData, int enchantLevel, int priceSell, int priceBuy, int type1, int type2, int mana) { + this.objectId = objectId; + this.ownerId = ownerId; + this.itemId = itemId; + this.count = count; + this.loc = loc; + this.locData = locData; + this.enchantLevel = enchantLevel; + this.priceSell = priceSell; + this.priceBuy = priceBuy; + this.customType1 = type1; + this.customType2 = type2; + this.manaLeft = mana; + } + + @Override + public Integer getId() { return objectId; } + + public int getOwnerId() { + return ownerId; + } + + public int getItemId() { + return itemId; + } + + public int getCount() { + return count; + } + + public int getEnchantLevel() { + return enchantLevel; + } + + public String getLoc() { + return loc; + } + + public int getLocData() { + return locData; + } + + public int getPriceSell() { + return priceSell; + } + + public int getPriceBuy() { + return priceBuy; + } + + public int getTimeOfUse() { + return timeOfUse; + } + + public int getCustomType1() { + return customType1; + } + + public int getCustomType2() { + return customType2; + } + + public int getManaLeft() { + return manaLeft; + } } diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/repository/ItemRepository.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/repository/ItemRepository.java new file mode 100644 index 00000000..1b7fdc7e --- /dev/null +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/repository/ItemRepository.java @@ -0,0 +1,48 @@ +package com.l2jbr.gameserver.model.database.repository; + +import com.l2jbr.gameserver.model.database.Items; +import org.springframework.data.jdbc.repository.query.Modifying; +import org.springframework.data.jdbc.repository.query.Query; +import org.springframework.data.repository.CrudRepository; +import org.springframework.data.repository.query.Param; + +import java.util.Optional; + +public interface ItemRepository extends CrudRepository { + + @Query("SELECT * FROM items WHERE owner_id=:owner AND (loc=:loc1 OR loc=:loc2)") + Iterable findAllByOwnerAndLocations(@Param("owner") int ownerObjectId, @Param("loc1") String loc1, @Param("loc2") String loc2); + + @Query("SELECT * FROM items WHERE owner_id=:owner AND loc=:loc") + Iterable findAllByOwnerAndLocation(@Param("owner") int ownerObjectId, @Param("loc") String loc); + + @Query("SELECT owner_id FROM items WHERE item_id=?") + Optional findOwnerIdByItem(@Param("item") int itemId); + + @Modifying + @Query("DELETE FROM items WHERE owner_id=:owner AND item_id=:item") + int deleteByOwnerAndItem(@Param("owner") int ownerId, @Param("item") int itemId); + + @Query("SELECT * FROM items WHERE item_id=:item AND custom_type1=:customType") + Iterable findByItemAndCustomType(@Param("item") int itemId, @Param("customType") int customType); + + @Modifying + @Query("UPDATE items SET loc=:loc WHERE owner_id=:owner") + void updateLocationByOwner(@Param("owner") int ownerId, @Param("loc") String loc); + + @Modifying + @Query("UPDATE items SET owner_id=:owner,count=:count,loc=:loc,loc_data=:locData,enchant_level=:enchantLevel,price_sell=:priceSell,price_buy=:priceBuy," + + "custom_type1=:customType1,custom_type2=:customType2,mana_left=:mana WHERE object_id=:id") + int updateById(@Param("id") int id, @Param("owner") int ownerId, @Param("count") int count, @Param("loc") String loc, @Param("locData") int locData, + @Param("enchantLevel") int enchantLevel, @Param("priceSell") int priceSell, @Param("priceBuy") int priceBuy, + @Param("CustomType1") int customType1, @Param("customType2") int customType2, @Param("mana") int mana); + + @Modifying + @Query("DELETE FROM items WHERE owner_id=:owner") + int deleteByOwner(@Param("owner") int ownerId); + + + @Modifying + @Query("DELETE FROM items WHERE item_id IN :items AND owner_id IN (SELECT obj_id FROM characters WHERE accesslevel <= 0)") + int deleteItemsFromBannedOwners(@Param("items") Iterable items); +} diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/entity/Hero.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/entity/Hero.java index e534bd60..5f927391 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/entity/Hero.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/entity/Hero.java @@ -24,7 +24,6 @@ package com.l2jbr.gameserver.model.entity; import com.l2jbr.commons.database.DatabaseAccess; -import com.l2jbr.commons.database.L2DatabaseFactory; import com.l2jbr.commons.util.Util; import com.l2jbr.gameserver.Olympiad; import com.l2jbr.gameserver.datatables.ClanTable; @@ -35,6 +34,7 @@ import com.l2jbr.gameserver.model.database.Heroes; import com.l2jbr.gameserver.model.database.repository.CharacterRepository; import com.l2jbr.gameserver.model.database.repository.HeroesRepository; +import com.l2jbr.gameserver.model.database.repository.ItemRepository; import com.l2jbr.gameserver.network.SystemMessageId; import com.l2jbr.gameserver.serverpackets.InventoryUpdate; import com.l2jbr.gameserver.serverpackets.PledgeShowInfoUpdate; @@ -45,9 +45,6 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import java.sql.Connection; -import java.sql.PreparedStatement; -import java.sql.SQLException; import java.util.ArrayList; import java.util.LinkedHashMap; import java.util.List; @@ -55,11 +52,9 @@ public class Hero { + private static Logger _log = LoggerFactory.getLogger(Hero.class.getName()); - private static Hero _instance; - - private static final String DELETE_ITEMS = "DELETE FROM items WHERE item_id IN " + "(6842, 6611, 6612, 6613, 6614, 6615, 6616, 6617, 6618, 6619, 6620, 6621) " + "AND owner_id NOT IN (SELECT obj_id FROM characters WHERE accesslevel > 0)"; private static final List _heroItems = new ArrayList<>(); @@ -325,7 +320,6 @@ private void increaseClanReputation(String name, L2Clan clan) { } } - public void updateHeroes(boolean setDefault) { HeroesRepository heroesRepository = DatabaseAccess.getRepository(HeroesRepository.class); if (setDefault) { @@ -359,31 +353,8 @@ public List getHeroItems() return _heroItems; } - private void deleteItemsInDb() - { - Connection con = null; - - try - { - con = L2DatabaseFactory.getInstance().getConnection(); - PreparedStatement statement = con.prepareStatement(DELETE_ITEMS); - statement.execute(); - statement.close(); - } - catch (SQLException e) - { - e.printStackTrace(); - } - finally - { - try - { - con.close(); - } - catch (SQLException e) - { - e.printStackTrace(); - } - } + private void deleteItemsInDb() { + ItemRepository repository = DatabaseAccess.getRepository(ItemRepository.class); + repository.deleteItemsFromBannedOwners(_heroItems); } } \ No newline at end of file diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/network/L2GameClient.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/network/L2GameClient.java index 7923b35c..bb58d8df 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/network/L2GameClient.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/network/L2GameClient.java @@ -294,10 +294,8 @@ public static void deleteCharByObjId(int objId) { AugmentationsRepository augmentationsRepository = DatabaseAccess.getRepository(AugmentationsRepository.class); augmentationsRepository.deleteByItemOwner(objId); - statement = con.prepareStatement("DELETE FROM items WHERE owner_id=?"); - statement.setInt(1, objId); - statement.execute(); - statement.close(); + ItemRepository itemRepository = DatabaseAccess.getRepository(ItemRepository.class); + itemRepository.deleteByOwner(objId); statement = con.prepareStatement("DELETE FROM merchant_lease WHERE player_id=?"); statement.setInt(1, objId); diff --git a/Tools/src/main/com.l2jbr.tools/com/l2jbr/tools/accountmanager/SQLAccountManager.java b/Tools/src/main/com.l2jbr.tools/com/l2jbr/tools/accountmanager/SQLAccountManager.java index 9e5218f0..3ae7b513 100644 --- a/Tools/src/main/com.l2jbr.tools/com/l2jbr/tools/accountmanager/SQLAccountManager.java +++ b/Tools/src/main/com.l2jbr.tools/com/l2jbr/tools/accountmanager/SQLAccountManager.java @@ -25,8 +25,6 @@ import com.l2jbr.commons.database.DatabaseAccess; import com.l2jbr.commons.database.L2DatabaseFactory; import com.l2jbr.commons.database.model.Account; -import com.l2jbr.gameserver.model.database.CharacterQuests; -import com.l2jbr.gameserver.model.database.ClanPrivs; import com.l2jbr.gameserver.model.database.repository.*; import java.io.IOException; @@ -183,11 +181,8 @@ private static void deleteAccount(String login) throws SQLException { CharacterShortcutsRepository shortcutsRepository = DatabaseAccess.getRepository(CharacterShortcutsRepository.class); shortcutsRepository.deleteById(character.getObjectId()); - // items - statement.close(); - statement = con.prepareStatement("DELETE FROM items WHERE owner_id=?;"); - statement.setInt(1, character.getObjectId()); - statement.executeUpdate(); + ItemRepository itemRepository = DatabaseAccess.getRepository(ItemRepository.class); + itemRepository.deleteByOwner(character.getObjectId()); CharacterRecipebookRepository recipebookRepository = DatabaseAccess.getRepository(CharacterRecipebookRepository.class); recipebookRepository.deleteAllByCharacter(character.getObjectId()); From 4c0e955c3495a82bf2fcb3192d74c71487d9aba5 Mon Sep 17 00:00:00 2001 From: Alisson Oliveira Date: Wed, 2 May 2018 18:47:30 -0300 Subject: [PATCH 066/236] =?UTF-8?q?Remove=20refer=C3=AAncias=20diretas=20?= =?UTF-8?q?=C3=A0=20tabela=20itemsonground?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../instancemanager/ItemsOnGroundManager.java | 176 +++++------------- .../model/database/ItemsOnGround.java | 69 ++++++- .../repository/ItemsOnGroundRepository.java | 18 ++ 3 files changed, 128 insertions(+), 135 deletions(-) create mode 100644 Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/repository/ItemsOnGroundRepository.java diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/instancemanager/ItemsOnGroundManager.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/instancemanager/ItemsOnGroundManager.java index c02ee2bb..34b7620b 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/instancemanager/ItemsOnGroundManager.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/instancemanager/ItemsOnGroundManager.java @@ -18,19 +18,18 @@ package com.l2jbr.gameserver.instancemanager; import com.l2jbr.commons.Config; -import com.l2jbr.commons.database.L2DatabaseFactory; +import com.l2jbr.commons.database.DatabaseAccess; import com.l2jbr.gameserver.ItemsAutoDestroy; import com.l2jbr.gameserver.ThreadPoolManager; import com.l2jbr.gameserver.model.L2ItemInstance; import com.l2jbr.gameserver.model.L2Object; import com.l2jbr.gameserver.model.L2World; +import com.l2jbr.gameserver.model.database.ItemsOnGround; +import com.l2jbr.gameserver.model.database.repository.ItemsOnGroundRepository; import com.l2jbr.gameserver.templates.L2EtcItemType; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import java.sql.PreparedStatement; -import java.sql.ResultSet; -import java.sql.Statement; import java.util.LinkedList; import java.util.List; @@ -75,89 +74,50 @@ private void load() { return; } + ItemsOnGroundRepository repository = DatabaseAccess.getRepository(ItemsOnGroundRepository.class); // if DestroyPlayerDroppedItem was previously false, items curently protected will be added to ItemsAutoDestroy if (Config.DESTROY_DROPPED_PLAYER_ITEM) { - java.sql.Connection con = null; - try { - String str = null; - if (!Config.DESTROY_EQUIPABLE_PLAYER_ITEM) { - str = "update itemsonground set drop_time=? where drop_time=-1 and equipable=0"; - } else if (Config.DESTROY_EQUIPABLE_PLAYER_ITEM) { - str = "update itemsonground set drop_time=? where drop_time=-1"; - } - con = L2DatabaseFactory.getInstance().getConnection(); - PreparedStatement statement = con.prepareStatement(str); - statement.setLong(1, System.currentTimeMillis()); - statement.execute(); - statement.close(); - } catch (Exception e) { - _log.error( "error while updating table ItemsOnGround " + e); - e.printStackTrace(); - } finally { - try { - con.close(); - } catch (Exception e) { - } + if (!Config.DESTROY_EQUIPABLE_PLAYER_ITEM) { + repository.updateDropTimeNotEquipable(System.currentTimeMillis()); + } else if (Config.DESTROY_EQUIPABLE_PLAYER_ITEM) { + repository.updateDropTime(System.currentTimeMillis()); } } - // Add items to world - java.sql.Connection con = null; - try { - try { - con = L2DatabaseFactory.getInstance().getConnection(); - Statement s = con.createStatement(); - ResultSet result; - int count = 0; - result = s.executeQuery("select object_id,item_id,count,enchant_level,x,y,z,drop_time,equipable from itemsonground"); - while (result.next()) { - L2ItemInstance item = new L2ItemInstance(result.getInt(1), result.getInt(2)); - L2World.getInstance().storeObject(item); - if (item.isStackable() && (result.getInt(3) > 1)) { - item.setCount(result.getInt(3)); - } - if (result.getInt(4) > 0) { - item.setEnchantLevel(result.getInt(4)); - } - item.getPosition().setWorldPosition(result.getInt(5), result.getInt(6), result.getInt(7)); - item.getPosition().setWorldRegion(L2World.getInstance().getRegion(item.getPosition().getWorldPosition())); - item.getPosition().getWorldRegion().addVisibleObject(item); - item.setDropTime(result.getLong(8)); - if (result.getLong(8) == -1) { - item.setProtected(true); - } else { - item.setProtected(false); - } - item.setIsVisible(true); - L2World.getInstance().addVisibleObject(item, item.getPosition().getWorldRegion(), null); - _items.add(item); - count++; - // add to ItemsAutoDestroy only items not protected - if (!Config.LIST_PROTECTED_ITEMS.contains(item.getItemId())) { - if (result.getLong(8) > -1) { - if (((Config.AUTODESTROY_ITEM_AFTER > 0) && (item.getItemType() != L2EtcItemType.HERB)) || ((Config.HERB_AUTO_DESTROY_TIME > 0) && (item.getItemType() == L2EtcItemType.HERB))) { - ItemsAutoDestroy.getInstance().addItem(item); - } - } + repository.findAll().forEach(itemsOnGround -> { + L2ItemInstance item = new L2ItemInstance(itemsOnGround.getId(), itemsOnGround.getItemId()); + L2World.getInstance().storeObject(item); + if (item.isStackable() && (itemsOnGround.getCount() > 1)) { + item.setCount(itemsOnGround.getCount()); + } + if (itemsOnGround.getEnchantLevel() > 0) { + item.setEnchantLevel(itemsOnGround.getEnchantLevel()); + } + item.getPosition().setWorldPosition(itemsOnGround.getX(), itemsOnGround.getY(), itemsOnGround.getZ()); + item.getPosition().setWorldRegion(L2World.getInstance().getRegion(item.getPosition().getWorldPosition())); + item.getPosition().getWorldRegion().addVisibleObject(item); + item.setDropTime(itemsOnGround.getDropTime()); + if (itemsOnGround.getDropTime() == -1) { + item.setProtected(true); + } else { + item.setProtected(false); + } + item.setIsVisible(true); + L2World.getInstance().addVisibleObject(item, item.getPosition().getWorldRegion(), null); + _items.add(item); + // add to ItemsAutoDestroy only items not protected + if (!Config.LIST_PROTECTED_ITEMS.contains(item.getItemId())) { + if (itemsOnGround.getDropTime() > -1) { + if (((Config.AUTODESTROY_ITEM_AFTER > 0) && (item.getItemType() != L2EtcItemType.HERB)) || + ((Config.HERB_AUTO_DESTROY_TIME > 0) && (item.getItemType() == L2EtcItemType.HERB))) { + ItemsAutoDestroy.getInstance().addItem(item); } } - result.close(); - s.close(); - if (count > 0) { - System.out.println("ItemsOnGroundManager: restored " + count + " items."); - } else { - System.out.println("Initializing ItemsOnGroundManager."); - } - } catch (Exception e) { - _log.error( "error while loading ItemsOnGround " + e); - e.printStackTrace(); } - } finally { - try { - con.close(); - } catch (Exception e) { - } - } + }); + + _log.info("ItemsOnGroundManager: restored {} items.", _items.size()); + if (Config.EMPTY_DROPPED_ITEM_TABLE_AFTER_LOAD) { emptyTable(); } @@ -186,21 +146,8 @@ public void cleanUp() { } public void emptyTable() { - java.sql.Connection conn = null; - try { - conn = L2DatabaseFactory.getInstance().getConnection(); - PreparedStatement del = conn.prepareStatement("delete from itemsonground"); - del.execute(); - del.close(); - } catch (Exception e1) { - _log.error( "error while cleaning table ItemsOnGround " + e1); - e1.printStackTrace(); - } finally { - try { - conn.close(); - } catch (Exception e1) { - } - } + ItemsOnGroundRepository repository = DatabaseAccess.getRepository(ItemsOnGroundRepository.class); + repository.deleteAll(); } protected class storeInDb extends Thread { @@ -225,43 +172,12 @@ public void run() { continue; // Cursed Items not saved to ground, prevent double save } - java.sql.Connection con = null; - try { - con = L2DatabaseFactory.getInstance().getConnection(); - PreparedStatement statement = con.prepareStatement("insert into itemsonground(object_id,item_id,count,enchant_level,x,y,z,drop_time,equipable) values(?,?,?,?,?,?,?,?,?)"); - statement.setInt(1, item.getObjectId()); - statement.setInt(2, item.getItemId()); - statement.setInt(3, item.getCount()); - statement.setInt(4, item.getEnchantLevel()); - statement.setInt(5, item.getX()); - statement.setInt(6, item.getY()); - statement.setInt(7, item.getZ()); - - if (item.isProtected()) { - statement.setLong(8, -1); // item will be protected - } else { - statement.setLong(8, item.getDropTime()); // item will be added to ItemsAutoDestroy - } - if (item.isEquipable()) { - statement.setLong(9, 1); // set equipable - } else { - statement.setLong(9, 0); - } - statement.execute(); - statement.close(); - } catch (Exception e) { - _log.error( "error while inserting into table ItemsOnGround " + e); - e.printStackTrace(); - } finally { - try { - con.close(); - } catch (Exception e) { - } - } - } - if (Config.DEBUG) { - _log.warn("ItemsOnGroundManager: " + _items.size() + " items on ground saved"); + ItemsOnGround itemsOnGround = new ItemsOnGround(item); + ItemsOnGroundRepository repository = DatabaseAccess.getRepository(ItemsOnGroundRepository.class); + repository.save(itemsOnGround); } + _log.debug("ItemsOnGroundManager: {} items on ground saved.", _items.size()); + } } } diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/ItemsOnGround.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/ItemsOnGround.java index a58dfc8e..61fec60d 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/ItemsOnGround.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/ItemsOnGround.java @@ -1,16 +1,75 @@ package com.l2jbr.gameserver.model.database; +import com.l2jbr.commons.database.annotation.Column; +import com.l2jbr.commons.database.model.Entity; +import com.l2jbr.gameserver.model.L2ItemInstance; +import org.springframework.data.annotation.Id; +public class ItemsOnGround extends Entity { -public class ItemsOnGround { - private int object_id; - private int item_id; + @Id + @Column("object_id") + private int objectId; + @Column("item_id") + private int itemId; private int count; - private int enchant_level; + @Column("enchant_level") + private int enchantLevel; private int x; private int y; private int z; - private long drop_time; + @Column("drop_time") + private long dropTime; private int equipable; + public ItemsOnGround() {} + + public ItemsOnGround(L2ItemInstance item) { + this.objectId = item.getObjectId(); + this.itemId = item.getItemId(); + this.count = item.getCount(); + this.enchantLevel = item.getEnchantLevel(); + this.x = item.getX(); + this.y = item.getY(); + this.z = item.getZ(); + this.dropTime = item.isProtected() ? -1 : item.getDropTime(); + this.equipable = item.isEquipable() ? 1 : 0; + } + + @Override + public Integer getId() { + return objectId; + } + + public int getItemId() { + return itemId; + } + + public int getCount() { + return count; + } + + public int getEnchantLevel() { + return enchantLevel; + } + + public int getX() { + return x; + } + + public int getY() { + return y; + } + + public int getZ() { + return z; + } + + public long getDropTime() { + return dropTime; + } + + public int getEquipable() { + return equipable; + } } diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/repository/ItemsOnGroundRepository.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/repository/ItemsOnGroundRepository.java new file mode 100644 index 00000000..62b26c11 --- /dev/null +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/repository/ItemsOnGroundRepository.java @@ -0,0 +1,18 @@ +package com.l2jbr.gameserver.model.database.repository; + +import com.l2jbr.gameserver.model.database.ItemsOnGround; +import org.springframework.data.jdbc.repository.query.Modifying; +import org.springframework.data.jdbc.repository.query.Query; +import org.springframework.data.repository.CrudRepository; +import org.springframework.data.repository.query.Param; + +public interface ItemsOnGroundRepository extends CrudRepository { + + @Modifying + @Query("UPDATE itemsonground SET drop_time=:dropTime WHERE drop_time=-1 AND equipable=0") + int updateDropTimeNotEquipable(@Param("dropTime") long dropTime); + + @Modifying + @Query("UPDATE itemsonground SET drop_time=:dropTime WHERE drop_time=-1") + int updateDropTime(@Param("dropTime") long dropTime); +} From 1df4759feb53996b88da57879659723db544113a Mon Sep 17 00:00:00 2001 From: Alisson Oliveira Date: Thu, 3 May 2018 10:54:40 -0300 Subject: [PATCH 067/236] =?UTF-8?q?Remove=20refer=C3=AAncias=20diretas=20?= =?UTF-8?q?=C3=A0=20tabela=20locations?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/l2jbr/commons/lib/SqlUtils.java | 226 ------------------ .../com/l2jbr/gameserver/Territory.java | 33 +-- .../l2jbr/gameserver/model/L2Territory.java | 8 + .../gameserver/model/database/Locations.java | 44 +++- .../repository/LocationRepository.java | 7 + 5 files changed, 61 insertions(+), 257 deletions(-) delete mode 100644 Commons/src/main/com.l2jbr.commons/com/l2jbr/commons/lib/SqlUtils.java create mode 100644 Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/repository/LocationRepository.java diff --git a/Commons/src/main/com.l2jbr.commons/com/l2jbr/commons/lib/SqlUtils.java b/Commons/src/main/com.l2jbr.commons/com/l2jbr/commons/lib/SqlUtils.java deleted file mode 100644 index c279ba8c..00000000 --- a/Commons/src/main/com.l2jbr.commons/com/l2jbr/commons/lib/SqlUtils.java +++ /dev/null @@ -1,226 +0,0 @@ -/* This program 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 2, 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, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA - * 02111-1307, USA. - * - * http://www.gnu.org/copyleft/gpl.html - */ -package com.l2jbr.commons.lib; - -import com.l2jbr.commons.database.L2DatabaseFactory; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import java.sql.PreparedStatement; -import java.sql.ResultSet; - - -public class SqlUtils -{ - private static Logger _log = LoggerFactory.getLogger(SqlUtils.class.getName()); - - // ========================================================= - // Data Field - private static SqlUtils _instance; - - // ========================================================= - // Property - Public - public static SqlUtils getInstance() - { - if (_instance == null) - { - _instance = new SqlUtils(); - } - return _instance; - } - - // ========================================================= - // Method - Public - public static Integer getIntValue(String resultField, String tableName, String whereClause) - { - String query = ""; - Integer res = null; - - PreparedStatement statement = null; - ResultSet rset = null; - - try - { - query = L2DatabaseFactory.getInstance().prepQuerySelect(new String[] - { - resultField - }, tableName, whereClause, true); - - statement = L2DatabaseFactory.getInstance().getConnection().prepareStatement(query); - rset = statement.executeQuery(); - - if (rset.next()) - { - res = rset.getInt(1); - } - } - catch (Exception e) - { - _log.warn("Error in query '" + query + "':" + e); - e.printStackTrace(); - } - finally - { - try - { - rset.close(); - } - catch (Exception e) - { - } - try - { - statement.close(); - } - catch (Exception e) - { - } - } - - return res; - } - - public static Integer[] getIntArray(String resultField, String tableName, String whereClause) - { - String query = ""; - Integer[] res = null; - - PreparedStatement statement = null; - ResultSet rset = null; - - try - { - query = L2DatabaseFactory.getInstance().prepQuerySelect(new String[] - { - resultField - }, tableName, whereClause, false); - statement = L2DatabaseFactory.getInstance().getConnection().prepareStatement(query); - rset = statement.executeQuery(); - - int rows = 0; - - while (rset.next()) - { - rows++; - } - - if (rows == 0) - { - return new Integer[0]; - } - - res = new Integer[rows - 1]; - - rset.first(); - - int row = 0; - while (rset.next()) - { - res[row] = rset.getInt(1); - } - } - catch (Exception e) - { - _log.warn("mSGI: Error in query '" + query + "':" + e); - e.printStackTrace(); - } - finally - { - try - { - rset.close(); - } - catch (Exception e) - { - } - try - { - statement.close(); - } - catch (Exception e) - { - } - } - - return res; - } - - public static Integer[][] get2DIntArray(String[] resultFields, String usedTables, String whereClause) - { - long start = System.currentTimeMillis(); - - String query = ""; - - PreparedStatement statement = null; - ResultSet rset = null; - - Integer res[][] = null; - - try - { - query = L2DatabaseFactory.getInstance().prepQuerySelect(resultFields, usedTables, whereClause, false); - statement = L2DatabaseFactory.getInstance().getConnection().prepareStatement(query); - rset = statement.executeQuery(); - - int rows = 0; - while (rset.next()) - { - rows++; - } - - res = new Integer[rows - 1][resultFields.length]; - - rset.first(); - - int row = 0; - while (rset.next()) - { - for (int i = 0; i < resultFields.length; i++) - { - res[row][i] = rset.getInt(i + 1); - } - row++; - } - } - catch (Exception e) - { - _log.warn("Error in query '" + query + "':" + e); - e.printStackTrace(); - } - finally - { - try - { - rset.close(); - } - catch (Exception e) - { - } - try - { - statement.close(); - } - catch (Exception e) - { - } - } - - _log.debug("Get all rows in query '" + query + "' in " + (System.currentTimeMillis() - start) + "ms"); - return res; - } -} diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/Territory.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/Territory.java index f4f45c90..74c4c617 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/Territory.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/Territory.java @@ -27,8 +27,9 @@ package com.l2jbr.gameserver; -import com.l2jbr.commons.lib.SqlUtils; +import com.l2jbr.commons.database.DatabaseAccess; import com.l2jbr.gameserver.model.L2Territory; +import com.l2jbr.gameserver.model.database.repository.LocationRepository; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -46,7 +47,6 @@ public static Territory getInstance() { } private Territory() { - // load all data at server start reload_data(); } @@ -60,28 +60,13 @@ public int getProcMax(int terr) { public void reload_data() { _territory.clear(); - Integer[][] point = SqlUtils.get2DIntArray(new String[] - { - "loc_id", - "loc_x", - "loc_y", - "loc_zmin", - "loc_zmax", - "proc" - }, "locations", "loc_id > 0"); - for (Integer[] row : point) { - // _log.info("row = "+row[0]); - Integer terr = row[0]; - if (terr == null) { - _log.warn("Null territory!"); - continue; + LocationRepository repository = DatabaseAccess.getRepository(LocationRepository.class); + repository.findAll().forEach(location -> { + if(_territory.get(location.getLocId()) == null) { + L2Territory territory = new L2Territory(location.getLocId()); + _territory.put(location.getLocId(), territory); } - - if (_territory.get(terr) == null) { - L2Territory t = new L2Territory(terr); - _territory.put(terr, t); - } - _territory.get(terr).add(row[1], row[2], row[3], row[4], row[5]); - } + _territory.get(location.getLocId()).add(location); + }); } } diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/L2Territory.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/L2Territory.java index a64ba880..fe9d501c 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/L2Territory.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/L2Territory.java @@ -26,6 +26,7 @@ package com.l2jbr.gameserver.model; import com.l2jbr.commons.util.Rnd; +import com.l2jbr.gameserver.model.database.Locations; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -36,6 +37,8 @@ public class L2Territory { private static Logger _log = LoggerFactory.getLogger(L2Territory.class.getName()); + + protected class Point { protected int _x, _y, _zmin, _zmax, _proc; @@ -70,6 +73,11 @@ public L2Territory(int terr) { _procMax = 0; } + public void add(Locations location) { + add(location.getLocX(), location.getLocY(), location.getLocZMin(), location.getLocZMax(), location.getProc()); + } + + public void add(int x, int y, int zmin, int zmax, int proc) { _points.add(new Point(x, y, zmin, zmax, proc)); if (x < _xMin) { diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/Locations.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/Locations.java index 6c0ddd3f..7b44c3e7 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/Locations.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/Locations.java @@ -1,13 +1,43 @@ package com.l2jbr.gameserver.model.database; - +import com.l2jbr.commons.database.annotation.Column; +import org.springframework.data.annotation.Id; public class Locations { - - private int loc_id; - private int loc_x; - private int loc_y; - private int loc_zmin; - private int loc_zmax; + @Id + @Column("loc_id") + private int locId; + @Column("loc_x") + private int locX; + @Column("loc_y") + private int locY; + @Column("loc_zmin") + private int locZMin; + @Column("loc_zmax") + private int locZMax; private int proc; + + public int getLocId() { + return locId; + } + + public int getLocX() { + return locX; + } + + public int getLocY() { + return locY; + } + + public int getLocZMin() { + return locZMin; + } + + public int getLocZMax() { + return locZMax; + } + + public int getProc() { + return proc; + } } diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/repository/LocationRepository.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/repository/LocationRepository.java new file mode 100644 index 00000000..2dfaf820 --- /dev/null +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/repository/LocationRepository.java @@ -0,0 +1,7 @@ +package com.l2jbr.gameserver.model.database.repository; + +import com.l2jbr.gameserver.model.database.Locations; +import org.springframework.data.repository.CrudRepository; + +public interface LocationRepository extends CrudRepository { +} From 0439093cdae4653bc1477bf214357a329f4f26ab Mon Sep 17 00:00:00 2001 From: Alisson Oliveira Date: Thu, 3 May 2018 13:58:14 -0300 Subject: [PATCH 068/236] =?UTF-8?q?Remove=20refer=C3=AAncias=20diretas=20?= =?UTF-8?q?=C3=A0=20tabela=20mapregion?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../gameserver/datatables/MapRegionTable.java | 70 +++++-------------- .../gameserver/model/database/MapRegion.java | 47 ++++++++++++- .../repository/MapRegionRepository.java | 7 ++ 3 files changed, 71 insertions(+), 53 deletions(-) create mode 100644 Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/repository/MapRegionRepository.java diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/datatables/MapRegionTable.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/datatables/MapRegionTable.java index 0aa784e7..bc63bf0c 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/datatables/MapRegionTable.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/datatables/MapRegionTable.java @@ -18,8 +18,7 @@ */ package com.l2jbr.gameserver.datatables; -import com.l2jbr.commons.Config; -import com.l2jbr.commons.database.L2DatabaseFactory; +import com.l2jbr.commons.database.DatabaseAccess; import com.l2jbr.gameserver.instancemanager.ArenaManager; import com.l2jbr.gameserver.instancemanager.CastleManager; import com.l2jbr.gameserver.instancemanager.ClanHallManager; @@ -28,6 +27,7 @@ import com.l2jbr.gameserver.model.Location; import com.l2jbr.gameserver.model.actor.instance.L2NpcInstance; import com.l2jbr.gameserver.model.actor.instance.L2PcInstance; +import com.l2jbr.gameserver.model.database.repository.MapRegionRepository; import com.l2jbr.gameserver.model.entity.Castle; import com.l2jbr.gameserver.model.entity.ClanHall; import com.l2jbr.gameserver.model.zone.type.L2ArenaZone; @@ -35,8 +35,6 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import java.sql.PreparedStatement; -import java.sql.ResultSet; import java.util.List; @@ -53,7 +51,7 @@ public class MapRegionTable private final int[][] _pointsWithKarmas; - public static enum TeleportWhereType + public enum TeleportWhereType { Castle, ClanHall, @@ -70,52 +68,22 @@ public static MapRegionTable getInstance() return _instance; } - private MapRegionTable() - { - int count2 = 0; - - // LineNumberReader lnr = null; - java.sql.Connection con = null; - try - { - con = L2DatabaseFactory.getInstance().getConnection(); - PreparedStatement statement = con.prepareStatement("SELECT region, sec0, sec1, sec2, sec3, sec4, sec5, sec6, sec7, sec8, sec9 FROM mapregion"); - ResultSet rset = statement.executeQuery(); - int region; - while (rset.next()) - { - region = rset.getInt(1); - - for (int j = 0; j < 10; j++) - { - _regions[j][region] = rset.getInt(j + 2); - count2++; - // _log.debug(j+","+region+" -> "+rset.getInt(j+2)); - } - } - - rset.close(); - statement.close(); - if (Config.DEBUG) - { - _log.debug(count2 + " mapregion loaded"); - } - } - catch (Exception e) - { - _log.warn("error while creating map region data: " + e); - } - finally - { - try - { - con.close(); - } - catch (Exception e) - { - } - } - + private MapRegionTable() { + MapRegionRepository repository = DatabaseAccess.getRepository(MapRegionRepository.class); + repository.findAll().forEach(mapRegion -> { + _regions[0][mapRegion.getRegion()] = mapRegion.getSec0(); + _regions[1][mapRegion.getRegion()] = mapRegion.getSec1(); + _regions[2][mapRegion.getRegion()] = mapRegion.getSec2(); + _regions[3][mapRegion.getRegion()] = mapRegion.getSec3(); + _regions[4][mapRegion.getRegion()] = mapRegion.getSec4(); + _regions[5][mapRegion.getRegion()] = mapRegion.getSec5(); + _regions[6][mapRegion.getRegion()] = mapRegion.getSec6(); + _regions[7][mapRegion.getRegion()] = mapRegion.getSec7(); + _regions[8][mapRegion.getRegion()] = mapRegion.getSec8(); + _regions[9][mapRegion.getRegion()] = mapRegion.getSec9(); + + }); + _pointsWithKarmas = new int[19][3]; // Talking Island _pointsWithKarmas[0][0] = -79077; diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/MapRegion.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/MapRegion.java index c283f4c1..2f093e36 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/MapRegion.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/MapRegion.java @@ -1,7 +1,5 @@ package com.l2jbr.gameserver.model.database; - - public class MapRegion { private int region; private int sec0; @@ -14,4 +12,49 @@ public class MapRegion { private int sec7; private int sec8; private int sec9; + + public int getRegion() { + return region; + } + + public int getSec0() { + return sec0; + } + + public int getSec1() { + return sec1; + } + + public int getSec2() { + return sec2; + } + + public int getSec3() { + return sec3; + } + + public int getSec4() { + return sec4; + } + + public int getSec5() { + return sec5; + } + + public int getSec6() { + return sec6; + } + + public int getSec7() { + return sec7; + } + + public int getSec8() { + return sec8; + } + + public int getSec9() { + return sec9; + } + } diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/repository/MapRegionRepository.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/repository/MapRegionRepository.java new file mode 100644 index 00000000..a3d20e8c --- /dev/null +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/repository/MapRegionRepository.java @@ -0,0 +1,7 @@ +package com.l2jbr.gameserver.model.database.repository; + +import com.l2jbr.gameserver.model.database.MapRegion; +import org.springframework.data.repository.CrudRepository; + +public interface MapRegionRepository extends CrudRepository { +} From c54ed62f2937c61133c30fd12c2defcc06e39fcc Mon Sep 17 00:00:00 2001 From: Alisson Oliveira Date: Thu, 3 May 2018 18:51:33 -0300 Subject: [PATCH 069/236] =?UTF-8?q?Remove=20refer=C3=AAncia=20direta=20a?= =?UTF-8?q?=20tabelas=20merchant=5Fbuy=5Flist=20e=20merchant=5Fshop=5Fids?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/l2jbr/gameserver/TradeController.java | 286 +++++------------- .../admincommandhandlers/AdminEditNpc.java | 79 +---- .../model/database/MerchantAreasList.java | 10 - .../model/database/MerchantBuyList.java | 57 +++- .../model/database/MerchantShopIds.java | 23 +- .../gameserver/model/database/Merchants.java | 8 - .../repository/MerchantBuyListRepository.java | 31 ++ .../repository/MerchantShopRepository.java | 8 + 8 files changed, 192 insertions(+), 310 deletions(-) delete mode 100644 Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/MerchantAreasList.java delete mode 100644 Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/Merchants.java create mode 100644 Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/repository/MerchantBuyListRepository.java create mode 100644 Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/repository/MerchantShopRepository.java diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/TradeController.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/TradeController.java index 6dcaa20c..ccb5ee57 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/TradeController.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/TradeController.java @@ -18,20 +18,17 @@ */ package com.l2jbr.gameserver; -import com.l2jbr.commons.Config; -import com.l2jbr.commons.database.L2DatabaseFactory; +import com.l2jbr.commons.database.DatabaseAccess; import com.l2jbr.gameserver.datatables.ItemTable; import com.l2jbr.gameserver.model.L2ItemInstance; import com.l2jbr.gameserver.model.L2TradeList; +import com.l2jbr.gameserver.model.database.MerchantBuyList; +import com.l2jbr.gameserver.model.database.MerchantShopIds; +import com.l2jbr.gameserver.model.database.repository.MerchantBuyListRepository; +import com.l2jbr.gameserver.model.database.repository.MerchantShopRepository; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import java.io.BufferedReader; -import java.io.File; -import java.io.FileReader; -import java.io.LineNumberReader; -import java.sql.PreparedStatement; -import java.sql.ResultSet; import java.util.*; @@ -79,175 +76,67 @@ public static TradeController getInstance() { private TradeController() { _lists = new LinkedHashMap<>(); _listsTaskItem = new LinkedHashMap<>(); - File buylistData = new File(Config.DATAPACK_ROOT, "data/buylists.csv"); - if (buylistData.exists()) { - _log.warn("Do, please, remove buylists from data folder and use SQL buylist instead"); - String line = null; - LineNumberReader lnr = null; - int dummyItemCount = 0; - - try { - lnr = new LineNumberReader(new BufferedReader(new FileReader(buylistData))); + LinkedHashMap timers = new LinkedHashMap<>(); + int dummyItemCount = 0; + boolean LimitedItem = false; + MerchantShopRepository repository = DatabaseAccess.getRepository(MerchantShopRepository.class); + for (MerchantShopIds merchantShopIds : repository.findAll()) { + + L2TradeList tradeList = new L2TradeList(merchantShopIds.getShopId()); + tradeList.setNpcId(merchantShopIds.getNpcId()); + + for (MerchantBuyList merchantBuyList : merchantShopIds.getBuyLists()) { + LimitedItem = false; + dummyItemCount++; + L2ItemInstance item = ItemTable.getInstance().createDummyItem(merchantBuyList.getItemId()); + if (item == null) { + continue; + } - while ((line = lnr.readLine()) != null) { - if ((line.trim().length() == 0) || line.startsWith("#")) { - continue; + if (merchantBuyList.getCount() > -1) { + item.setCountDecrease(true); + LimitedItem = true; + if(!timers.containsKey(merchantBuyList.getTime())) { + timers.put(merchantBuyList.getTime(), merchantBuyList.getSavetimer()); } - - dummyItemCount += parseList(line); } - if (Config.DEBUG) { - _log.debug("created " + dummyItemCount + " Dummy-Items for buylists"); - } - _log.info("TradeController: Loaded " + _lists.size() + " Buylists."); - } catch (Exception e) { - _log.warn( "error while creating trade controller in linenr: " + lnr.getLineNumber(), e); - } - } else { - _log.debug("No buylists were found in data folder, using SQL buylist instead"); - java.sql.Connection con = null; - /* - * Initialize Shop buylist - */ - int dummyItemCount = 0; - boolean LimitedItem = false; - try { - con = L2DatabaseFactory.getInstance().getConnection(); - PreparedStatement statement1 = con.prepareStatement("SELECT " + L2DatabaseFactory.getInstance().safetyString(new String[] - { - "shop_id", - "npc_id" - }) + " FROM merchant_shopids"); - ResultSet rset1 = statement1.executeQuery(); - while (rset1.next()) { - PreparedStatement statement = con.prepareStatement("SELECT " + L2DatabaseFactory.getInstance().safetyString(new String[] - { - "item_id", - "price", - "shop_id", - "order", - "count", - "time", - "currentCount" - }) + " FROM merchant_buylists WHERE shop_id=? ORDER BY " + L2DatabaseFactory.getInstance().safetyString(new String[] - { - "order" - }) + " ASC"); - statement.setString(1, String.valueOf(rset1.getInt("shop_id"))); - ResultSet rset = statement.executeQuery(); - if (rset.next()) { - LimitedItem = false; - dummyItemCount++; - L2TradeList buy1 = new L2TradeList(rset1.getInt("shop_id")); - int itemId = rset.getInt("item_id"); - int price = rset.getInt("price"); - int count = rset.getInt("count"); - int currentCount = rset.getInt("currentCount"); - int time = rset.getInt("time"); - L2ItemInstance item = ItemTable.getInstance().createDummyItem(itemId); - if (item == null) { - rset.close(); - statement.close(); - continue; - } - if (count > -1) { - item.setCountDecrease(true); - LimitedItem = true; - } - item.setPriceToSell(price); - item.setTime(time); - item.setInitCount(count); - if (currentCount > -1) { - item.setCount(currentCount); - } else { - item.setCount(count); - } - buy1.addItem(item); - buy1.setNpcId(rset1.getString("npc_id")); - try { - while (rset.next()) { - dummyItemCount++; - itemId = rset.getInt("item_id"); - price = rset.getInt("price"); - count = rset.getInt("count"); - time = rset.getInt("time"); - currentCount = rset.getInt("currentCount"); - L2ItemInstance item2 = ItemTable.getInstance().createDummyItem(itemId); - if (item2 == null) { - continue; - } - if (count > -1) { - item2.setCountDecrease(true); - LimitedItem = true; - } - item2.setPriceToSell(price); - item2.setTime(time); - item2.setInitCount(count); - if (currentCount > -1) { - item2.setCount(currentCount); - } else { - item2.setCount(count); - } - buy1.addItem(item2); - } - } catch (Exception e) { - _log.warn("TradeController: Problem with buylist " + buy1.getListId() + " item " + itemId); - } - if (LimitedItem) { - _listsTaskItem.put(buy1.getListId(), buy1); - } else { - _lists.put(buy1.getListId(), buy1); - } - _nextListId = Math.max(_nextListId, buy1.getListId() + 1); - } + item.setPriceToSell(merchantBuyList.getPrice()); + item.setTime(merchantBuyList.getTime()); + item.setInitCount(merchantBuyList.getCount()); - rset.close(); - statement.close(); + if (merchantBuyList.getCurrentCount() > -1) { + item.setCount(merchantBuyList.getCurrentCount()); + } else { + item.setCount(merchantBuyList.getCount()); } - rset1.close(); - statement1.close(); - if (Config.DEBUG) { - _log.debug("created " + dummyItemCount + " Dummy-Items for buylists"); - } - _log.info("TradeController: Loaded " + _lists.size() + " Buylists."); - _log.info("TradeController: Loaded " + _listsTaskItem.size() + " Limited Buylists."); - /* - * Restore Task for reinitialyze count of buy item - */ - try { - int time = 0; - long savetimer = 0; - long currentMillis = System.currentTimeMillis(); - PreparedStatement statement2 = con.prepareStatement("SELECT DISTINCT time, savetimer FROM merchant_buylists WHERE time <> 0 ORDER BY time"); - ResultSet rset2 = statement2.executeQuery(); - while (rset2.next()) { - time = rset2.getInt("time"); - savetimer = rset2.getLong("savetimer"); - if ((savetimer - currentMillis) > 0) { - ThreadPoolManager.getInstance().scheduleGeneral(new RestoreCount(time), savetimer - System.currentTimeMillis()); - } else { - ThreadPoolManager.getInstance().scheduleGeneral(new RestoreCount(time), 0); - } - } - rset2.close(); - statement2.close(); - } catch (Exception e) { - _log.warn("TradeController: Could not restore Timer for Item count."); - e.printStackTrace(); - } - } catch (Exception e) { - // problem with initializing spawn, go to next one - _log.warn("TradeController: Buylists could not be initialized."); - e.printStackTrace(); - } finally { - try { - con.close(); - } catch (Exception e) { - } + tradeList.addItem(item); } + + if (LimitedItem) { + _listsTaskItem.put(tradeList.getListId(), tradeList); + } else { + _lists.put(tradeList.getListId(), tradeList); + } + _nextListId = Math.max(_nextListId, tradeList.getListId() + 1); } + + _log.debug("created {} Dummy-Items for buylists", dummyItemCount); + + _log.info("TradeController: Loaded {} Buylists.", _lists.size()); + _log.info("TradeController: Loaded {} Limited Buylists.", _listsTaskItem.size()); + + + long currentMillis = System.currentTimeMillis(); + timers.forEach((time, saveTimer) -> { + if((saveTimer - currentMillis) > 0) { + ThreadPoolManager.getInstance().scheduleGeneral(new RestoreCount(time), saveTimer - System.currentTimeMillis()); + } else { + ThreadPoolManager.getInstance().scheduleGeneral(new RestoreCount(time), 0); + } + }); + } private int parseList(String line) { @@ -308,69 +197,30 @@ protected void restoreCount(int time) { } protected void dataTimerSave(int time) { - java.sql.Connection con = null; - long timerSave = System.currentTimeMillis() + ((long) time * 60 * 60 * 1000); - try { - con = L2DatabaseFactory.getInstance().getConnection(); - PreparedStatement statement = con.prepareStatement("UPDATE merchant_buylists SET savetimer =? WHERE time =?"); - statement.setLong(1, timerSave); - statement.setInt(2, time); - statement.executeUpdate(); - statement.close(); - } catch (Exception e) { - _log.error( "TradeController: Could not update Timer save in Buylist"); - } finally { - try { - con.close(); - } catch (Exception e) { - } - } + long saveTimer = System.currentTimeMillis() + ((long) time * 60 * 60 * 1000); + MerchantBuyListRepository repository = DatabaseAccess.getRepository(MerchantBuyListRepository.class); + repository.updateSaveTimerByTime(time, saveTimer); } public void dataCountStore() { - java.sql.Connection con = null; - PreparedStatement statement; - - int listId; if (_listsTaskItem == null) { return; } - try { - con = L2DatabaseFactory.getInstance().getConnection(); + MerchantBuyListRepository repository = DatabaseAccess.getRepository(MerchantBuyListRepository.class); + for (L2TradeList list : _listsTaskItem.values()) { + if (list == null) { + continue; + } - for (L2TradeList list : _listsTaskItem.values()) { - if (list == null) { - continue; - } - listId = list.getListId(); - - for (L2ItemInstance Item : list.getItems()) { - if (Item.getCount() < Item.getInitCount()) // needed? - { - statement = con.prepareStatement("UPDATE merchant_buylists SET currentCount=? WHERE item_id=? AND shop_id=?"); - statement.setInt(1, Item.getCount()); - statement.setInt(2, Item.getItemId()); - statement.setInt(3, listId); - statement.executeUpdate(); - statement.close(); - } + for (L2ItemInstance item : list.getItems()) { + if (item.getCount() < item.getInitCount()){ + repository.updateCurrentCountByItem(list.getListId(), item.getItemId(), item.getCount()); } } - } catch (Exception e) { - _log.error( "TradeController: Could not store Count Item"); - } finally { - try { - con.close(); - } catch (Exception e) { - e.printStackTrace(); - } } } - /** - * @return - */ public synchronized int getNextId() { return _nextListId++; } diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/handler/admincommandhandlers/AdminEditNpc.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/handler/admincommandhandlers/AdminEditNpc.java index 63f90a75..c90f7cd1 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/handler/admincommandhandlers/AdminEditNpc.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/handler/admincommandhandlers/AdminEditNpc.java @@ -29,7 +29,9 @@ import com.l2jbr.gameserver.model.*; import com.l2jbr.gameserver.model.actor.instance.L2BoxInstance; import com.l2jbr.gameserver.model.actor.instance.L2PcInstance; +import com.l2jbr.gameserver.model.database.MerchantBuyList; import com.l2jbr.gameserver.model.database.repository.DropListRepository; +import com.l2jbr.gameserver.model.database.repository.MerchantBuyListRepository; import com.l2jbr.gameserver.serverpackets.NpcHtmlMessage; import com.l2jbr.gameserver.templates.L2Item; import com.l2jbr.gameserver.templates.L2NpcTemplate; @@ -39,7 +41,6 @@ import java.sql.PreparedStatement; import java.sql.ResultSet; -import java.sql.SQLException; import java.util.LinkedList; import java.util.List; import java.util.StringTokenizer; @@ -464,82 +465,24 @@ private void showShop(L2PcInstance activeChar, int merchantID) { } private void storeTradeList(int itemID, int price, int tradeListID, int order) { - java.sql.Connection con = null; - try { - con = L2DatabaseFactory.getInstance().getConnection(); - PreparedStatement stmt = con.prepareStatement("INSERT INTO merchant_buylists (`item_id`,`price`,`shop_id`,`order`) values (" + itemID + "," + price + "," + tradeListID + "," + order + ")"); - stmt.execute(); - stmt.close(); - } catch (SQLException esql) { - esql.printStackTrace(); - } finally { - try { - con.close(); - } catch (SQLException e) { - e.printStackTrace(); - } - } + MerchantBuyListRepository repository = DatabaseAccess.getRepository(MerchantBuyListRepository.class); + MerchantBuyList buyList = new MerchantBuyList(itemID, price, tradeListID, order); + repository.save(buyList); } private void updateTradeList(int itemID, int price, int tradeListID, int order) { - java.sql.Connection con = null; - try { - con = L2DatabaseFactory.getInstance().getConnection(); - PreparedStatement stmt = con.prepareStatement("UPDATE merchant_buylists SET `price`='" + price + "' WHERE `shop_id`='" + tradeListID + "' AND `order`='" + order + "'"); - stmt.execute(); - stmt.close(); - } catch (SQLException esql) { - esql.printStackTrace(); - } finally { - try { - con.close(); - } catch (SQLException e) { - e.printStackTrace(); - } - } + MerchantBuyListRepository repository = DatabaseAccess.getRepository(MerchantBuyListRepository.class); + repository.updatePriceByItem(tradeListID, itemID, order, price); } private void deleteTradeList(int tradeListID, int order) { - java.sql.Connection con = null; - try { - con = L2DatabaseFactory.getInstance().getConnection(); - PreparedStatement stmt = con.prepareStatement("DELETE FROM merchant_buylists WHERE `shop_id`='" + tradeListID + "' AND `order`='" + order + "'"); - stmt.execute(); - stmt.close(); - } catch (SQLException esql) { - esql.printStackTrace(); - } finally { - try { - con.close(); - } catch (SQLException e) { - e.printStackTrace(); - } - } + MerchantBuyListRepository repository = DatabaseAccess.getRepository(MerchantBuyListRepository.class); + repository.deleteByOrder(tradeListID, order); } private int findOrderTradeList(int itemID, int price, int tradeListID) { - java.sql.Connection con = null; - int order = 0; - try { - con = L2DatabaseFactory.getInstance().getConnection(); - PreparedStatement stmt = con.prepareStatement("SELECT * FROM merchant_buylists WHERE `shop_id`='" + tradeListID + "' AND `item_id` ='" + itemID + "' AND `price` = '" + price + "'"); - ResultSet rs = stmt.executeQuery(); - rs.first(); - - order = rs.getInt("order"); - - stmt.close(); - rs.close(); - } catch (SQLException esql) { - esql.printStackTrace(); - } finally { - try { - con.close(); - } catch (SQLException e) { - e.printStackTrace(); - } - } - return order; + MerchantBuyListRepository repository = DatabaseAccess.getRepository(MerchantBuyListRepository.class); + return repository.findOrderByItemAndPrice(tradeListID, itemID, price).orElse(0); } private List getTradeLists(int merchantID) { diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/MerchantAreasList.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/MerchantAreasList.java deleted file mode 100644 index 88bfd149..00000000 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/MerchantAreasList.java +++ /dev/null @@ -1,10 +0,0 @@ -package com.l2jbr.gameserver.model.database; - - - -public class MerchantAreasList { - private int merchant_area_id; - private String merchant_area_name; - private float tax; - private int chaotic; -} diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/MerchantBuyList.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/MerchantBuyList.java index 91414b91..70176c23 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/MerchantBuyList.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/MerchantBuyList.java @@ -1,15 +1,64 @@ package com.l2jbr.gameserver.model.database; +import com.l2jbr.commons.database.annotation.Column; +import com.l2jbr.commons.database.annotation.Table; +import com.l2jbr.commons.database.model.Entity; +import org.springframework.data.annotation.Id; +@Table("merchant_buylists") +public class MerchantBuyList extends Entity { -public class MerchantBuyList { - - private int item_id; + @Id + @Column("shop_id") + private int shopId; + @Column("item_id") + private int itemId; private int price; - private int shop_id; private int order; private int count; private int currentCount; private int time; private long savetimer; + + public MerchantBuyList() {} + + public MerchantBuyList(int itemId, int price, int shopId, int order) { + this.itemId =itemId; + this.price = price; + this.shopId = shopId; + this.order = order; + } + + @Override + public Integer getId() { + return shopId; + } + + public int getItemId() { + return itemId; + } + + public int getPrice() { + return price; + } + + public int getOrder() { + return order; + } + + public int getCount() { + return count; + } + + public int getCurrentCount() { + return currentCount; + } + + public int getTime() { + return time; + } + + public long getSavetimer() { + return savetimer; + } } diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/MerchantShopIds.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/MerchantShopIds.java index cff2787f..d7cb5dea 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/MerchantShopIds.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/MerchantShopIds.java @@ -1,9 +1,28 @@ package com.l2jbr.gameserver.model.database; +import com.l2jbr.commons.database.annotation.Column; +import com.l2jbr.commons.database.annotation.Table; +import java.util.Set; +@Table("merchant_shopids") public class MerchantShopIds { - private int shop_id; - private String npc_id; + @Column("shop_id") + private int shopId; + @Column("npc_id") + private String npcId; + @Column("shop_id") + private Set buyLists; + public int getShopId() { + return shopId; + } + + public String getNpcId() { + return npcId; + } + + public Set getBuyLists() { + return buyLists; + } } diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/Merchants.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/Merchants.java deleted file mode 100644 index d3ec7a5c..00000000 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/Merchants.java +++ /dev/null @@ -1,8 +0,0 @@ -package com.l2jbr.gameserver.model.database; - - - -public class Merchants { - private int npc_id; - private int merchant_area_id; -} diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/repository/MerchantBuyListRepository.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/repository/MerchantBuyListRepository.java new file mode 100644 index 00000000..0411b06c --- /dev/null +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/repository/MerchantBuyListRepository.java @@ -0,0 +1,31 @@ +package com.l2jbr.gameserver.model.database.repository; + +import com.l2jbr.gameserver.model.database.MerchantBuyList; +import org.springframework.data.jdbc.repository.query.Modifying; +import org.springframework.data.jdbc.repository.query.Query; +import org.springframework.data.repository.CrudRepository; +import org.springframework.data.repository.query.Param; + +import java.util.Optional; + +public interface MerchantBuyListRepository extends CrudRepository { + + @Modifying + @Query("UPDATE merchant_buylists SET savetimer=:saveTimer WHERE time=:time") + int updateSaveTimerByTime(@Param("time") int time, @Param("saveTimer") long saveTimer); + + @Modifying + @Query("UPDATE merchant_buylists SET currentCount=:count WHERE item_id=:item AND shop_id=:shop") + int updateCurrentCountByItem(@Param("shop") int shopId, @Param("item") int itemId, @Param("count") int count); + + @Modifying + @Query("UPDATE merchant_buylists SET price=:price WHERE shop_id=:shop AND item_id=:item AND order=:order") + int updatePriceByItem(@Param("shop") int shopId, @Param("item") int itemId, @Param("order") int order, @Param("price") int price); + + @Modifying + @Query("DELETE FROM merchant_buylists WHERE shop_id=:shop AND order=:order") + int deleteByOrder(@Param("shop") int shopId, @Param("order") int order); + + @Query("SELECT order FROM merchant_buylists WHERE shop_id=:shop AND item_id=:item AND price=:price") + Optional findOrderByItemAndPrice(@Param("shop") int shopId, @Param("item") int itemId, @Param("price") int price); +} diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/repository/MerchantShopRepository.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/repository/MerchantShopRepository.java new file mode 100644 index 00000000..2e10a651 --- /dev/null +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/repository/MerchantShopRepository.java @@ -0,0 +1,8 @@ +package com.l2jbr.gameserver.model.database.repository; + +import com.l2jbr.gameserver.model.database.MerchantShopIds; +import org.springframework.data.repository.CrudRepository; + +public interface MerchantShopRepository extends CrudRepository { + +} From 7cf001c5fab7044d464fef9201358e4fc021924f Mon Sep 17 00:00:00 2001 From: Alisson Oliveira Date: Thu, 3 May 2018 18:59:06 -0300 Subject: [PATCH 070/236] =?UTF-8?q?Remove=20refer=C3=AAncias=20direta=20?= =?UTF-8?q?=C3=A0=20tabela=20merchant=5Flease?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../gameserver/model/database/MerchantLease.java | 16 ++++++++++++---- .../repository/MerchantLeaseRepository.java | 14 ++++++++++++++ .../l2jbr/gameserver/network/L2GameClient.java | 6 ++---- .../tools/accountmanager/SQLAccountManager.java | 7 ++----- 4 files changed, 30 insertions(+), 13 deletions(-) create mode 100644 Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/repository/MerchantLeaseRepository.java diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/MerchantLease.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/MerchantLease.java index 978cbbe2..ac49d160 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/MerchantLease.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/MerchantLease.java @@ -1,11 +1,19 @@ package com.l2jbr.gameserver.model.database; +import com.l2jbr.commons.database.annotation.Column; +import com.l2jbr.commons.database.annotation.Table; +import org.springframework.data.annotation.Id; - +@Table("merchant_lease") public class MerchantLease { - private int merchant_id; - private int player_id; + + @Id + @Column("merchant_id") + private int merchantId; + @Column("player_id") + private int playerId; private int bid; private int type; - private String player_name; + @Column("player_name") + private String playerName; } diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/repository/MerchantLeaseRepository.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/repository/MerchantLeaseRepository.java new file mode 100644 index 00000000..6a6538a0 --- /dev/null +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/repository/MerchantLeaseRepository.java @@ -0,0 +1,14 @@ +package com.l2jbr.gameserver.model.database.repository; + +import com.l2jbr.gameserver.model.database.MerchantLease; +import org.springframework.data.jdbc.repository.query.Modifying; +import org.springframework.data.jdbc.repository.query.Query; +import org.springframework.data.repository.CrudRepository; +import org.springframework.data.repository.query.Param; + +public interface MerchantLeaseRepository extends CrudRepository { + + @Modifying + @Query("DELETE FROM merchant_lease WHERE player_id=:player") + int deleteByPlayer(@Param("player") int playerObjectId); +} diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/network/L2GameClient.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/network/L2GameClient.java index bb58d8df..b044cb86 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/network/L2GameClient.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/network/L2GameClient.java @@ -297,10 +297,8 @@ public static void deleteCharByObjId(int objId) { ItemRepository itemRepository = DatabaseAccess.getRepository(ItemRepository.class); itemRepository.deleteByOwner(objId); - statement = con.prepareStatement("DELETE FROM merchant_lease WHERE player_id=?"); - statement.setInt(1, objId); - statement.execute(); - statement.close(); + MerchantLeaseRepository leaseRepository = DatabaseAccess.getRepository(MerchantLeaseRepository.class); + leaseRepository.deleteByPlayer(objId); CharacterRepository characterRepository = DatabaseAccess.getRepository(CharacterRepository.class); characterRepository.deleteById(objId); diff --git a/Tools/src/main/com.l2jbr.tools/com/l2jbr/tools/accountmanager/SQLAccountManager.java b/Tools/src/main/com.l2jbr.tools/com/l2jbr/tools/accountmanager/SQLAccountManager.java index 3ae7b513..fb4fedf6 100644 --- a/Tools/src/main/com.l2jbr.tools/com/l2jbr/tools/accountmanager/SQLAccountManager.java +++ b/Tools/src/main/com.l2jbr.tools/com/l2jbr/tools/accountmanager/SQLAccountManager.java @@ -196,11 +196,8 @@ private static void deleteAccount(String login) throws SQLException { CharacterFriendRepository characterFriendRepository = DatabaseAccess.getRepository(CharacterFriendRepository.class); characterFriendRepository.deleteById(character.getObjectId()); - // merchant_lease - statement.close(); - statement = con.prepareStatement("DELETE FROM merchant_lease WHERE player_id=?;"); - statement.setInt(1, character.getObjectId()); - statement.executeUpdate(); + MerchantLeaseRepository leaseRepository = DatabaseAccess.getRepository(MerchantLeaseRepository.class); + leaseRepository.deleteByPlayer(character.getObjectId()); // boxaccess statement.close(); From 6ec98caf0b29a63e89a6432258df050cd61983be Mon Sep 17 00:00:00 2001 From: Alisson Oliveira Date: Thu, 3 May 2018 21:39:00 -0300 Subject: [PATCH 071/236] =?UTF-8?q?Remove=20refer=C3=AAncias=20diretas=20?= =?UTF-8?q?=C3=A0=20tabela=20minions?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../l2jbr/gameserver/datatables/NpcTable.java | 48 +++++++------------ .../gameserver/model/database/Minions.java | 31 ++++++++++-- .../database/repository/MinionRepository.java | 8 ++++ 3 files changed, 53 insertions(+), 34 deletions(-) create mode 100644 Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/repository/MinionRepository.java diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/datatables/NpcTable.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/datatables/NpcTable.java index 46a38086..3f104499 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/datatables/NpcTable.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/datatables/NpcTable.java @@ -26,7 +26,9 @@ import com.l2jbr.gameserver.model.L2MinionData; import com.l2jbr.gameserver.model.L2Skill; import com.l2jbr.gameserver.model.base.ClassId; +import com.l2jbr.gameserver.model.database.Minions; import com.l2jbr.gameserver.model.database.Npc; +import com.l2jbr.gameserver.model.database.repository.MinionRepository; import com.l2jbr.gameserver.model.database.repository.NpcRepository; import com.l2jbr.gameserver.skills.Stats; import com.l2jbr.gameserver.templates.L2NpcTemplate; @@ -69,8 +71,8 @@ private NpcTable() { } private void restoreNpcData() { - NpcRepository repository = DatabaseAccess.getRepository(NpcRepository.class); - repository.findAll().forEach(this::addToNpcMap); + NpcRepository npcRepository = DatabaseAccess.getRepository(NpcRepository.class); + npcRepository.findAll().forEach(this::addToNpcMap); _log.info("info.loaded.npc", _npcs.size()); @@ -178,36 +180,22 @@ private void restoreNpcData() { _log.error("NPCTable: Error reading NPC trainer data: " + e); } - try { - PreparedStatement statement4 = con.prepareStatement("SELECT " + L2DatabaseFactory.getInstance().safetyString(new String[] - { - "boss_id", - "minion_id", - "amount_min", - "amount_max" - }) + " FROM minions"); - ResultSet minionData = statement4.executeQuery(); - L2MinionData minionDat = null; - L2NpcTemplate npcDat = null; - int cnt = 0; - - while (minionData.next()) { - int raidId = minionData.getInt("boss_id"); - npcDat = _npcs.get(raidId); - minionDat = new L2MinionData(); - minionDat.setMinionId(minionData.getInt("minion_id")); - minionDat.setAmountMin(minionData.getInt("amount_min")); - minionDat.setAmountMax(minionData.getInt("amount_max")); - npcDat.addRaidData(minionDat); - cnt++; - } - minionData.close(); - statement4.close(); - _log.info("NpcTable: Loaded " + cnt + " Minions."); - } catch (Exception e) { - _log.error("Error loading minion data: " + e); + MinionRepository minionRepository = DatabaseAccess.getRepository(MinionRepository.class); + int cnt = 0; + L2NpcTemplate npcDat = null; + L2MinionData minionDat = null; + for (Minions minion : minionRepository.findAll()) { + int raidId = minion.getBossId(); + npcDat = _npcs.get(raidId); + minionDat = new L2MinionData(); + minionDat.setMinionId(minion.getMinionId()); + minionDat.setAmountMin(minion.getAmountMin()); + minionDat.setAmountMax(minion.getAmountMin()); + npcDat.addRaidData(minionDat); + cnt++; } + _log.info("NpcTable: Loaded {} Minions", cnt); } catch (SQLException e1) { // TODO Auto-generated catch block e1.printStackTrace(); diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/Minions.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/Minions.java index 25c7af48..8195a547 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/Minions.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/Minions.java @@ -1,10 +1,33 @@ package com.l2jbr.gameserver.model.database; +import com.l2jbr.commons.database.annotation.Column; +import org.springframework.data.annotation.Id; public class Minions { - private int boss_id; - private int minion_id; - private int amount_min; - private int amount_max; + @Id + @Column("boss_id") + private int bossId; + @Column("minion_id") + private int minionId; + @Column("amount_min") + private int amountMin; + @Column("amount_max") + private int amountMax; + + public int getBossId() { + return bossId; + } + + public int getMinionId() { + return minionId; + } + + public int getAmountMin() { + return amountMin; + } + + public int getAmountMax() { + return amountMax; + } } diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/repository/MinionRepository.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/repository/MinionRepository.java new file mode 100644 index 00000000..f5fc3467 --- /dev/null +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/repository/MinionRepository.java @@ -0,0 +1,8 @@ +package com.l2jbr.gameserver.model.database.repository; + +import com.l2jbr.gameserver.model.database.Minions; +import org.springframework.data.repository.CrudRepository; + +public interface MinionRepository extends CrudRepository { + +} From a9275d9f76657b1c1f2746c868ed627174b36dff Mon Sep 17 00:00:00 2001 From: Alisson Oliveira Date: Fri, 4 May 2018 00:01:37 -0300 Subject: [PATCH 072/236] =?UTF-8?q?Remove=20refer=C3=AAncias=20diretas=20?= =?UTF-8?q?=C3=A0=20tabela=20mod=5Fwedding?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../instancemanager/CoupleManager.java | 38 +--- .../model/database/ModsWedding.java | 45 ++++- .../repository/ModsWeddingRepository.java | 14 ++ .../l2jbr/gameserver/model/entity/Couple.java | 170 ++++-------------- 4 files changed, 96 insertions(+), 171 deletions(-) create mode 100644 Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/repository/ModsWeddingRepository.java diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/instancemanager/CoupleManager.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/instancemanager/CoupleManager.java index ae7f5cfd..5524124e 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/instancemanager/CoupleManager.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/instancemanager/CoupleManager.java @@ -18,9 +18,11 @@ */ package com.l2jbr.gameserver.instancemanager; +import com.l2jbr.commons.database.DatabaseAccess; import com.l2jbr.commons.database.L2DatabaseFactory; import com.l2jbr.gameserver.model.L2World; import com.l2jbr.gameserver.model.actor.instance.L2PcInstance; +import com.l2jbr.gameserver.model.database.repository.ModsWeddingRepository; import com.l2jbr.gameserver.model.entity.Couple; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -62,38 +64,16 @@ public void reload() { load(); } - // ========================================================= - // Method - Private - private final void load() { - java.sql.Connection con = null; - try { - PreparedStatement statement; - ResultSet rs; - - con = L2DatabaseFactory.getInstance().getConnection(); - - statement = con.prepareStatement("Select id from mods_wedding order by id"); - rs = statement.executeQuery(); - - while (rs.next()) { - getCouples().add(new Couple(rs.getInt("id"))); - } - statement.close(); - - _log.info("Loaded: " + getCouples().size() + " couples(s)"); - } catch (Exception e) { - _log.error("Exception: CoupleManager.load(): " + e.getMessage(), e); - } finally { - try { - con.close(); - } catch (Exception e) { - } - } + private void load() { + ModsWeddingRepository repository = DatabaseAccess.getRepository(ModsWeddingRepository.class); + repository.findAll().forEach(wedding -> { + getCouples().add(new Couple(wedding)); + }); + _log.info("Loaded: " + getCouples().size() + " couples(s)"); } - // ========================================================= - // Property - Public + public final Couple getCouple(int coupleId) { int index = getCoupleIndex(coupleId); if (index >= 0) { diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/ModsWedding.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/ModsWedding.java index 9983fe40..769fc2c0 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/ModsWedding.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/ModsWedding.java @@ -1,13 +1,54 @@ package com.l2jbr.gameserver.model.database; +import com.l2jbr.commons.database.annotation.Table; +import com.l2jbr.commons.database.model.Entity; +import org.python.antlr.op.Mod; +import org.springframework.data.annotation.Id; +@Table("mods_wedding") +public class ModsWedding extends Entity { -public class ModsWedding { - + @Id private int id; private int player1Id; private int player2Id; private String married; private long affianceDate; private long weddingDate; + + public ModsWedding() {} + + public ModsWedding(int id, int player1Id, int player2Id, boolean married, long affianceDate, long weddingDate) { + this.id = id; + this.player1Id = player1Id; + this.player2Id = player2Id; + this.married = String.valueOf(married); + this.affianceDate = affianceDate; + this.weddingDate = weddingDate; + } + + @Override + public Integer getId() { + return id; + } + + public int getPlayer1Id() { + return player1Id; + } + + public int getPlayer2Id() { + return player2Id; + } + + public String getMarried() { + return married; + } + + public long getAffianceDate() { + return affianceDate; + } + + public long getWeddingDate() { + return weddingDate; + } } diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/repository/ModsWeddingRepository.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/repository/ModsWeddingRepository.java new file mode 100644 index 00000000..8b9c8c8a --- /dev/null +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/repository/ModsWeddingRepository.java @@ -0,0 +1,14 @@ +package com.l2jbr.gameserver.model.database.repository; + +import com.l2jbr.gameserver.model.database.ModsWedding; +import org.springframework.data.jdbc.repository.query.Modifying; +import org.springframework.data.jdbc.repository.query.Query; +import org.springframework.data.repository.CrudRepository; +import org.springframework.data.repository.query.Param; + +public interface ModsWeddingRepository extends CrudRepository { + + @Modifying + @Query("UPDATE mods_wedding SET married=:married, weddingDate=:weddingDate WHERE id=:id") + int updateMarried(@Param("id") int id, @Param("married") boolean married, @Param("weddingDate") long weddingDate); +} diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/entity/Couple.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/entity/Couple.java index 417cdf32..655557e0 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/entity/Couple.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/entity/Couple.java @@ -18,9 +18,12 @@ */ package com.l2jbr.gameserver.model.entity; +import com.l2jbr.commons.database.DatabaseAccess; import com.l2jbr.commons.database.L2DatabaseFactory; import com.l2jbr.gameserver.idfactory.IdFactory; import com.l2jbr.gameserver.model.actor.instance.L2PcInstance; +import com.l2jbr.gameserver.model.database.ModsWedding; +import com.l2jbr.gameserver.model.database.repository.ModsWeddingRepository; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -35,9 +38,7 @@ public class Couple { private static final Logger _log = LoggerFactory.getLogger(Couple.class.getName()); - - // ========================================================= - // Data Field + private int _Id = 0; private int _player1Id = 0; private int _player2Id = 0; @@ -45,54 +46,6 @@ public class Couple private Calendar _affiancedDate; private Calendar _weddingDate; - // ========================================================= - // Constructor - public Couple(int coupleId) - { - _Id = coupleId; - - java.sql.Connection con = null; - try - { - PreparedStatement statement; - ResultSet rs; - - con = L2DatabaseFactory.getInstance().getConnection(); - - statement = con.prepareStatement("Select * from mods_wedding where id = ?"); - statement.setInt(1, _Id); - rs = statement.executeQuery(); - - while (rs.next()) - { - _player1Id = rs.getInt("player1Id"); - _player2Id = rs.getInt("player2Id"); - _maried = rs.getBoolean("married"); - - _affiancedDate = Calendar.getInstance(); - _affiancedDate.setTimeInMillis(rs.getLong("affianceDate")); - - _weddingDate = Calendar.getInstance(); - _weddingDate.setTimeInMillis(rs.getLong("weddingDate")); - } - statement.close(); - } - catch (Exception e) - { - _log.error("Exception: Couple.load(): " + e.getMessage(), e); - } - finally - { - try - { - con.close(); - } - catch (Exception e) - { - } - } - } - public Couple(L2PcInstance player1, L2PcInstance player2) { int _tempPlayer1Id = player1.getObjectId(); @@ -106,98 +59,35 @@ public Couple(L2PcInstance player1, L2PcInstance player2) _weddingDate = Calendar.getInstance(); _weddingDate.setTimeInMillis(Calendar.getInstance().getTimeInMillis()); - - java.sql.Connection con = null; - try - { - con = L2DatabaseFactory.getInstance().getConnection(); - PreparedStatement statement; - _Id = IdFactory.getInstance().getNextId(); - statement = con.prepareStatement("INSERT INTO mods_wedding (id, player1Id, player2Id, married, affianceDate, weddingDate) VALUES (?, ?, ?, ?, ?, ?)"); - statement.setInt(1, _Id); - statement.setInt(2, _player1Id); - statement.setInt(3, _player2Id); - statement.setBoolean(4, false); - statement.setLong(5, _affiancedDate.getTimeInMillis()); - statement.setLong(6, _weddingDate.getTimeInMillis()); - statement.execute(); - statement.close(); - } - catch (Exception e) - { - _log.error("", e); - } - finally - { - try - { - con.close(); - } - catch (Exception e) - { - } - } + + _Id = IdFactory.getInstance().getNextId(); + ModsWedding wedding = new ModsWedding(_Id, _player1Id, _player2Id, false, _affiancedDate.getTimeInMillis(), _weddingDate.getTimeInMillis()); + ModsWeddingRepository repository = DatabaseAccess.getRepository(ModsWeddingRepository.class); + repository.save(wedding); } - - public void marry() - { - java.sql.Connection con = null; - try - { - con = L2DatabaseFactory.getInstance().getConnection(); - PreparedStatement statement; - - statement = con.prepareStatement("UPDATE mods_wedding set married = ?, weddingDate = ? where id = ?"); - statement.setBoolean(1, true); - _weddingDate = Calendar.getInstance(); - statement.setLong(2, _weddingDate.getTimeInMillis()); - statement.setInt(3, _Id); - statement.execute(); - statement.close(); - _maried = true; - } - catch (Exception e) - { - _log.error("", e); - } - finally - { - try - { - con.close(); - } - catch (Exception e) - { - } - } + + public Couple(ModsWedding wedding) { + _player1Id = wedding.getPlayer1Id(); + _player2Id = wedding.getPlayer2Id(); + _maried = Boolean.valueOf(wedding.getMarried()); + + _affiancedDate = Calendar.getInstance(); + _affiancedDate.setTimeInMillis(wedding.getAffianceDate()); + + _weddingDate = Calendar.getInstance(); + _weddingDate.setTimeInMillis(wedding.getWeddingDate()); + } + + public void marry() { + _weddingDate = Calendar.getInstance(); + ModsWeddingRepository repository = DatabaseAccess.getRepository(ModsWeddingRepository.class); + repository.updateMarried(_Id, true, _weddingDate.getTimeInMillis()); + _maried = true; } - public void divorce() - { - java.sql.Connection con = null; - try - { - con = L2DatabaseFactory.getInstance().getConnection(); - PreparedStatement statement; - - statement = con.prepareStatement("DELETE FROM mods_wedding WHERE id=?"); - statement.setInt(1, _Id); - statement.execute(); - } - catch (Exception e) - { - _log.error("Exception: Couple.divorce(): " + e.getMessage(), e); - } - finally - { - try - { - con.close(); - } - catch (Exception e) - { - } - } + public void divorce() { + ModsWeddingRepository repository = DatabaseAccess.getRepository(ModsWeddingRepository.class); + repository.deleteById(_Id); } public final int getId() From 0f29de3672b645f71fb30e2514fee69c82c14c29 Mon Sep 17 00:00:00 2001 From: Alisson Oliveira Date: Fri, 4 May 2018 00:23:22 -0300 Subject: [PATCH 073/236] =?UTF-8?q?Remove=20refer=C3=AAncias=20diretas=20?= =?UTF-8?q?=C3=A0=20tabela=20npcskills?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../l2jbr/gameserver/datatables/NpcTable.java | 51 ++++++++----------- .../gameserver/model/database/NpcSkills.java | 17 +++++++ .../repository/NpcSkillRepository.java | 8 +++ 3 files changed, 46 insertions(+), 30 deletions(-) create mode 100644 Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/repository/NpcSkillRepository.java diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/datatables/NpcTable.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/datatables/NpcTable.java index 3f104499..7fb6b1e8 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/datatables/NpcTable.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/datatables/NpcTable.java @@ -21,6 +21,7 @@ import com.l2jbr.commons.Config; import com.l2jbr.commons.database.DatabaseAccess; import com.l2jbr.commons.database.L2DatabaseFactory; +import com.l2jbr.commons.util.Util; import com.l2jbr.gameserver.model.L2DropCategory; import com.l2jbr.gameserver.model.L2DropData; import com.l2jbr.gameserver.model.L2MinionData; @@ -30,6 +31,7 @@ import com.l2jbr.gameserver.model.database.Npc; import com.l2jbr.gameserver.model.database.repository.MinionRepository; import com.l2jbr.gameserver.model.database.repository.NpcRepository; +import com.l2jbr.gameserver.model.database.repository.NpcSkillRepository; import com.l2jbr.gameserver.skills.Stats; import com.l2jbr.gameserver.templates.L2NpcTemplate; import com.l2jbr.gameserver.templates.StatsSet; @@ -76,43 +78,32 @@ private void restoreNpcData() { _log.info("info.loaded.npc", _npcs.size()); - try (Connection con = L2DatabaseFactory.getInstance().getConnection();) { - try { - PreparedStatement statement = con.prepareStatement("SELECT npcid, skillid, level FROM npcskills"); - ResultSet npcskills = statement.executeQuery(); - L2NpcTemplate npcDat = null; - L2Skill npcSkill = null; - - while (npcskills.next()) { - int mobId = npcskills.getInt("npcid"); - npcDat = _npcs.get(mobId); - - if (npcDat == null) { - continue; - } + try (Connection con = L2DatabaseFactory.getInstance().getConnection()) { + NpcSkillRepository npcSkillRepository = DatabaseAccess.getRepository(NpcSkillRepository.class); + npcSkillRepository.findAll().forEach(npcSkill -> { + int mobId = npcSkill.getNpcid(); + L2NpcTemplate npcDat = _npcs.get(mobId); - int skillId = npcskills.getInt("skillid"); - int level = npcskills.getInt("level"); + if (Util.isNull(npcDat)) { + return; + } - if ((npcDat.race == null) && (skillId == 4416)) { - npcDat.setRace(level); - continue; - } + int skillId = npcSkill.getSkillid(); + int level = npcSkill.getLevel(); - npcSkill = SkillTable.getInstance().getInfo(skillId, level); + if (Util.isNull(npcDat.race) && (skillId == 4416)) { + npcDat.setRace(level); + return; + } - if (npcSkill == null) { - continue; - } + L2Skill skill = SkillTable.getInstance().getInfo(skillId, level); - npcDat.addSkill(npcSkill); + if (Util.isNull(skill)) { + return; } - npcskills.close(); - statement.close(); - } catch (Exception e) { - _log.error("NPCTable: Error reading NPC skills table: " + e); - } + npcDat.addSkill(skill); + }); try { PreparedStatement statement2 = con.prepareStatement("SELECT " + L2DatabaseFactory.getInstance().safetyString(new String[] diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/NpcSkills.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/NpcSkills.java index 184c5170..8bd2d572 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/NpcSkills.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/NpcSkills.java @@ -1,7 +1,24 @@ package com.l2jbr.gameserver.model.database; +import org.springframework.data.annotation.Id; + public class NpcSkills { + + @Id private int npcid; private int skillid; private int level; + + public int getNpcid() { + return npcid; + } + + public int getSkillid() { + return skillid; + } + + public int getLevel() { + return level; + } } + diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/repository/NpcSkillRepository.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/repository/NpcSkillRepository.java new file mode 100644 index 00000000..731b2b5e --- /dev/null +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/repository/NpcSkillRepository.java @@ -0,0 +1,8 @@ +package com.l2jbr.gameserver.model.database.repository; + +import com.l2jbr.gameserver.model.database.NpcSkills; +import org.springframework.data.repository.CrudRepository; + +public interface NpcSkillRepository extends CrudRepository { + +} From 611f62ae22ce3c2ec0bd8e634f9aa43b12c06f7e Mon Sep 17 00:00:00 2001 From: Alisson Oliveira Date: Fri, 4 May 2018 00:58:12 -0300 Subject: [PATCH 074/236] =?UTF-8?q?Remove=20refer=C3=AAncias=20diretas=20?= =?UTF-8?q?=C3=A0=20tabela=20olympiad=5Fnobles?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/l2jbr/gameserver/Olympiad.java | 120 +++++------------- .../model/database/OlympiadNobles.java | 53 +++++++- .../repository/OlympiadNoblesRepository.java | 23 ++++ .../gameserver/network/L2GameClient.java | 6 +- 4 files changed, 105 insertions(+), 97 deletions(-) create mode 100644 Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/repository/OlympiadNoblesRepository.java diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/Olympiad.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/Olympiad.java index 418755bc..4067461c 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/Olympiad.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/Olympiad.java @@ -24,6 +24,7 @@ package com.l2jbr.gameserver; import com.l2jbr.commons.Config; +import com.l2jbr.commons.database.DatabaseAccess; import com.l2jbr.commons.database.L2DatabaseFactory; import com.l2jbr.commons.util.Rnd; import com.l2jbr.gameserver.datatables.HeroSkillTable; @@ -32,6 +33,8 @@ import com.l2jbr.gameserver.model.*; import com.l2jbr.gameserver.model.actor.instance.L2PcInstance; import com.l2jbr.gameserver.model.actor.instance.L2PetInstance; +import com.l2jbr.gameserver.model.database.OlympiadNobles; +import com.l2jbr.gameserver.model.database.repository.OlympiadNoblesRepository; import com.l2jbr.gameserver.model.entity.Hero; import com.l2jbr.gameserver.network.SystemMessageId; import com.l2jbr.gameserver.serverpackets.ExOlympiadUserInfoSpectator; @@ -50,7 +53,6 @@ import java.util.*; import java.util.concurrent.ScheduledFuture; - public class Olympiad { protected static final Logger _log = LoggerFactory.getLogger(Olympiad.class.getName()); @@ -63,12 +65,6 @@ public class Olympiad { private static final String OLYMPIAD_CONFIG_FILE_PATH = "config/olympiad.properties"; public static final String OLYMPIAD_HTML_FILE = "data/html/olympiad/"; - private static final String OLYMPIAD_LOAD_NOBLES = "SELECT * from olympiad_nobles"; - private static final String OLYMPIAD_SAVE_NOBLES = "INSERT INTO olympiad_nobles " + "values (?,?,?,?,?)"; - private static final String OLYMPIAD_UPDATE_NOBLES = "UPDATE olympiad_nobles set " + "olympiad_points = ?, competitions_done = ? where char_id = ?"; - private static final String OLYMPIAD_GET_HEROS = "SELECT char_id, char_name from " + "olympiad_nobles where class_id = ? and competitions_done >= 9 order by " + "olympiad_points desc, competitions_done desc"; - private static final String GET_EACH_CLASS_LEADER = "SELECT char_name from " + "olympiad_nobles where class_id = ? order by olympiad_points desc, " + "competitions_done desc"; - private static final String OLYMPIAD_DELETE_ALL = "DELETE from olympiad_nobles"; private static final int COMP_START = Config.ALT_OLY_START_TIME; // 6PM private static final int COMP_MIN = Config.ALT_OLY_MIN; // 00 mins @@ -298,29 +294,18 @@ private void load() throws IOException { return; } - try { - Connection con = L2DatabaseFactory.getInstance().getConnection(); - PreparedStatement statement = con.prepareStatement(OLYMPIAD_LOAD_NOBLES); - ResultSet rset = statement.executeQuery(); + OlympiadNoblesRepository repository = DatabaseAccess.getRepository(OlympiadNoblesRepository.class); + repository.findAll().forEach(nobles -> { + StatsSet statDat = new StatsSet(); + int charId = nobles.getId(); + statDat.set(CLASS_ID, nobles.getClassId()); + statDat.set(CHAR_NAME, nobles.getCharName()); + statDat.set(POINTS, nobles.getOlympiadPoints()); + statDat.set(COMP_DONE, nobles.getCompetitionsDone()); + statDat.set("to_save", false); + _nobles.put(charId, statDat); + }); - while (rset.next()) { - StatsSet statDat = new StatsSet(); - int charId = rset.getInt(CHAR_ID); - statDat.set(CLASS_ID, rset.getInt(CLASS_ID)); - statDat.set(CHAR_NAME, rset.getString(CHAR_NAME)); - statDat.set(POINTS, rset.getInt(POINTS)); - statDat.set(COMP_DONE, rset.getInt(COMP_DONE)); - statDat.set("to_save", false); - - _nobles.put(charId, statDat); - } - - rset.close(); - statement.close(); - con.close(); - } catch (Exception e) { - e.printStackTrace(); - } synchronized (this) { _log.info("Olympiad System: Loading Olympiad System...."); @@ -879,28 +864,17 @@ protected synchronized void saveNobleData() { int compDone = nobleInfo.getInteger(COMP_DONE); boolean toSave = nobleInfo.getBool("to_save"); + OlympiadNoblesRepository repository = DatabaseAccess.getRepository(OlympiadNoblesRepository.class); if (toSave) { - statement = con.prepareStatement(OLYMPIAD_SAVE_NOBLES); - statement.setInt(1, charId); - statement.setInt(2, classId); - statement.setString(3, charName); - statement.setInt(4, points); - statement.setInt(5, compDone); - statement.execute(); - - statement.close(); + OlympiadNobles nobles = new OlympiadNobles(charId, classId, charName, points, compDone); + repository.save(nobles); nobleInfo.set("to_save", false); _nobles.remove(nobleId); _nobles.put(nobleId, nobleInfo); } else { - statement = con.prepareStatement(OLYMPIAD_UPDATE_NOBLES); - statement.setInt(1, points); - statement.setInt(2, compDone); - statement.setInt(3, charId); - statement.execute(); - statement.close(); + repository.updateCompetitions(charId, points, compDone); } } } catch (SQLException e) { @@ -915,50 +889,27 @@ protected void sortHerosToBe() { _heroesToBe = new LinkedList<>(); - try (Connection con = L2DatabaseFactory.getInstance().getConnection()) { - PreparedStatement statement; - ResultSet rset; - StatsSet hero; - - for (int i = 88; i < 119; i++) { - statement = con.prepareStatement(OLYMPIAD_GET_HEROS); - statement.setInt(1, i); - rset = statement.executeQuery(); + OlympiadNoblesRepository repository = DatabaseAccess.getRepository(OlympiadNoblesRepository.class); - if (rset.next()) { - hero = new StatsSet(); - hero.set(CLASS_ID, i); - hero.set(CHAR_ID, rset.getInt(CHAR_ID)); - hero.set(CHAR_NAME, rset.getString(CHAR_NAME)); + for (int classId = 88; classId < 119; classId++) { + repository.findWinnerByClassId(classId).ifPresent(nobles -> { + StatsSet hero = new StatsSet(); + hero.set(CLASS_ID, nobles.getClassId()); + hero.set(CHAR_ID, nobles.getId()); + hero.set(CHAR_NAME, nobles.getCharName()); - _heroesToBe.add(hero); - } - - statement.close(); - rset.close(); - } - } catch (SQLException e) { - _log.warn("Olympiad System: Couldnt heros from db"); + _heroesToBe.add(hero); + }); } } public List getClassLeaderBoard(int classId) { List names = new LinkedList<>(); - try (Connection con = L2DatabaseFactory.getInstance().getConnection(); - PreparedStatement statement = con.prepareStatement(GET_EACH_CLASS_LEADER);) { - statement.setInt(1, classId); - try (ResultSet rset = statement.executeQuery()) { - while (rset.next()) { - names.add(rset.getString(CHAR_NAME)); - } - } - return names; - } catch (SQLException e) { - _log.warn("Olympiad System: Couldnt heros from db"); - } - + OlympiadNoblesRepository repository = DatabaseAccess.getRepository(OlympiadNoblesRepository.class); + repository.findAllNoblesByClassId(classId).forEach(nobles -> { + names.add(nobles.getCharName()); + }); return names; - } protected void giveHeroBonus() { @@ -1046,13 +997,8 @@ public int getCompetitionDone(int objId) { } protected void deleteNobles() { - try (Connection con = L2DatabaseFactory.getInstance().getConnection(); - PreparedStatement statement = con.prepareStatement(OLYMPIAD_DELETE_ALL)) { - statement.execute(); - } catch (SQLException e) { - _log.warn("Olympiad System: Couldnt delete nobles from db"); - } - + OlympiadNoblesRepository repository = DatabaseAccess.getRepository(OlympiadNoblesRepository.class); + repository.deleteAll(); _nobles.clear(); } diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/OlympiadNobles.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/OlympiadNobles.java index b1ce0322..82b7de83 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/OlympiadNobles.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/OlympiadNobles.java @@ -1,12 +1,53 @@ package com.l2jbr.gameserver.model.database; +import com.l2jbr.commons.database.annotation.Column; +import com.l2jbr.commons.database.annotation.Table; +import com.l2jbr.commons.database.model.Entity; +import org.springframework.data.annotation.Id; +@Table("olympiad_nobles") +public class OlympiadNobles extends Entity { -public class OlympiadNobles { + @Id + @Column("char_id") + private int charId; + @Column("class_id") + private int classId; + @Column("char_name") + private String charName; + @Column("olympiad_points") + private int olympiadPoints; + @Column("competitions_done") + private int competitionsDone; - private int char_id; - private int class_id; - private String char_name; - private int olympiad_points; - private int competitions_done; + public OlympiadNobles() {} + + public OlympiadNobles(int charId, int classId, String charName, int points, int competitionsDone) { + this.charId = charId; + this.classId = classId; + this.charName = charName; + this.olympiadPoints = points; + this.competitionsDone = competitionsDone; + } + + @Override + public Integer getId() { + return charId; + } + + public int getClassId() { + return classId; + } + + public String getCharName() { + return charName; + } + + public int getOlympiadPoints() { + return olympiadPoints; + } + + public int getCompetitionsDone() { + return competitionsDone; + } } diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/repository/OlympiadNoblesRepository.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/repository/OlympiadNoblesRepository.java new file mode 100644 index 00000000..95fd03ba --- /dev/null +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/repository/OlympiadNoblesRepository.java @@ -0,0 +1,23 @@ +package com.l2jbr.gameserver.model.database.repository; + +import com.l2jbr.gameserver.model.database.OlympiadNobles; +import org.springframework.data.jdbc.repository.query.Modifying; +import org.springframework.data.jdbc.repository.query.Query; +import org.springframework.data.repository.CrudRepository; +import org.springframework.data.repository.query.Param; + +import java.util.Optional; + +public interface OlympiadNoblesRepository extends CrudRepository { + + @Modifying + @Query("UPDATE olympiad_nobles SET olympiad_points=:points, competitions_done=:competitions WHERE char_id=:char") + int updateCompetitions(@Param("char") int charId, @Param("points") int points, @Param("competitions") int competitions); + + @Query("SELECT char_name FROM olympiad_nobles WHERE class_id=:class ORDER BY olympiad_points DESC, competitions_done DESC") + Iterable findAllNoblesByClassId(@Param("class") int classId); + + @Query("SELECT * FROM olympiad_nobles WHERE class_id=:class AND competitions_done>=9 ORDER BY olympiad_points DESC," + + " competitions_done DESC LIMIT 1") + Optional findWinnerByClassId(@Param("class") int classId); +} diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/network/L2GameClient.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/network/L2GameClient.java index b044cb86..8d0e088c 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/network/L2GameClient.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/network/L2GameClient.java @@ -276,10 +276,8 @@ public static void deleteCharByObjId(int objId) { HeroesRepository heroesRepository = DatabaseAccess.getRepository(HeroesRepository.class); heroesRepository.deleteById(objId); - statement = con.prepareStatement("DELETE FROM olympiad_nobles WHERE char_id=?"); - statement.setInt(1, objId); - statement.execute(); - statement.close(); + OlympiadNoblesRepository noblesRepository = DatabaseAccess.getRepository(OlympiadNoblesRepository.class); + noblesRepository.deleteById(objId); statement = con.prepareStatement("DELETE FROM seven_signs WHERE char_obj_id=?"); statement.setInt(1, objId); From 59c60a97a643d3c8007ba4a9411c23cd06e40921 Mon Sep 17 00:00:00 2001 From: Alisson Oliveira Date: Fri, 4 May 2018 18:57:41 -0300 Subject: [PATCH 075/236] =?UTF-8?q?Remove=20refer=C3=AAncias=20direta=20?= =?UTF-8?q?=C3=A0=20tabela=20pets?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../clientpackets/RequestDestroyItem.java | 46 +++-------- .../gameserver/datatables/ItemTable.java | 21 +---- .../l2jbr/gameserver/model/L2TradeList.java | 22 +----- .../model/actor/instance/L2PetInstance.java | 78 ++++--------------- .../l2jbr/gameserver/model/database/Pets.java | 28 +++++-- .../database/repository/PetsRepository.java | 20 +++++ 6 files changed, 74 insertions(+), 141 deletions(-) create mode 100644 Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/repository/PetsRepository.java diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/clientpackets/RequestDestroyItem.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/clientpackets/RequestDestroyItem.java index 5ae57834..e1fa6b62 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/clientpackets/RequestDestroyItem.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/clientpackets/RequestDestroyItem.java @@ -19,12 +19,13 @@ package com.l2jbr.gameserver.clientpackets; import com.l2jbr.commons.Config; -import com.l2jbr.commons.database.L2DatabaseFactory; +import com.l2jbr.commons.database.DatabaseAccess; import com.l2jbr.gameserver.instancemanager.CursedWeaponsManager; import com.l2jbr.gameserver.model.L2ItemInstance; import com.l2jbr.gameserver.model.L2PetDataTable; import com.l2jbr.gameserver.model.L2World; import com.l2jbr.gameserver.model.actor.instance.L2PcInstance; +import com.l2jbr.gameserver.model.database.repository.PetsRepository; import com.l2jbr.gameserver.network.SystemMessageId; import com.l2jbr.gameserver.serverpackets.InventoryUpdate; import com.l2jbr.gameserver.serverpackets.ItemList; @@ -34,8 +35,6 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import java.sql.PreparedStatement; - /** * This class ... @@ -117,8 +116,7 @@ protected void runImpl() count = itemToRemove.getCount(); } - if (itemToRemove.isEquipped()) - { + if (itemToRemove.isEquipped()) { L2ItemInstance[] unequiped = activeChar.getInventory().unEquipItemInSlotAndRecord(itemToRemove.getEquipSlot()); InventoryUpdate iu = new InventoryUpdate(); for (L2ItemInstance element : unequiped) @@ -131,37 +129,13 @@ protected void runImpl() activeChar.broadcastUserInfo(); } - if (L2PetDataTable.isPetItem(itemId)) - { - java.sql.Connection con = null; - try - { - if ((activeChar.getPet() != null) && (activeChar.getPet().getControlItemId() == _objectId)) - { - activeChar.getPet().unSummon(activeChar); - } - - // if it's a pet control item, delete the pet - con = L2DatabaseFactory.getInstance().getConnection(); - PreparedStatement statement = con.prepareStatement("DELETE FROM pets WHERE item_obj_id=?"); - statement.setInt(1, _objectId); - statement.execute(); - statement.close(); - } - catch (Exception e) - { - _log.warn( "could not delete pet objectid: ", e); - } - finally - { - try - { - con.close(); - } - catch (Exception e) - { - } - } + if (L2PetDataTable.isPetItem(itemId)) { + if ((activeChar.getPet() != null) && (activeChar.getPet().getControlItemId() == _objectId)) { + activeChar.getPet().unSummon(activeChar); + } + + PetsRepository repository = DatabaseAccess.getRepository(PetsRepository.class); + repository.deleteById(_objectId); } L2ItemInstance removedItem = activeChar.getInventory().destroyItem("Destroy", _objectId, count, activeChar, null); diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/datatables/ItemTable.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/datatables/ItemTable.java index 9e8b84ac..86f7c343 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/datatables/ItemTable.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/datatables/ItemTable.java @@ -20,7 +20,6 @@ import com.l2jbr.commons.Config; import com.l2jbr.commons.database.DatabaseAccess; -import com.l2jbr.commons.database.L2DatabaseFactory; import com.l2jbr.gameserver.Item; import com.l2jbr.gameserver.ThreadPoolManager; import com.l2jbr.gameserver.idfactory.IdFactory; @@ -34,13 +33,13 @@ import com.l2jbr.gameserver.model.database.Weapon; import com.l2jbr.gameserver.model.database.repository.ArmorRepository; import com.l2jbr.gameserver.model.database.repository.EtcItemRepository; +import com.l2jbr.gameserver.model.database.repository.PetsRepository; import com.l2jbr.gameserver.model.database.repository.WeaponRepository; import com.l2jbr.gameserver.skills.SkillsEngine; import com.l2jbr.gameserver.templates.*; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import java.sql.PreparedStatement; import java.sql.SQLException; import java.util.LinkedHashMap; import java.util.Map; @@ -657,22 +656,8 @@ public void destroyItem(String process, L2ItemInstance item, L2PcInstance actor, // if it's a pet control item, delete the pet as well if (L2PetDataTable.isPetItem(item.getItemId())) { - java.sql.Connection con = null; - try { - // Delete the pet in db - con = L2DatabaseFactory.getInstance().getConnection(); - PreparedStatement statement = con.prepareStatement("DELETE FROM pets WHERE item_obj_id=?"); - statement.setInt(1, item.getObjectId()); - statement.execute(); - statement.close(); - } catch (Exception e) { - _log.warn( "could not delete pet objectid:", e); - } finally { - try { - con.close(); - } catch (Exception e) { - } - } + PetsRepository repository = DatabaseAccess.getRepository(PetsRepository.class); + repository.deleteById(item.getObjectId()); } } } diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/L2TradeList.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/L2TradeList.java index ca09044c..f16cc5dc 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/L2TradeList.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/L2TradeList.java @@ -18,9 +18,10 @@ */ package com.l2jbr.gameserver.model; -import com.l2jbr.commons.database.L2DatabaseFactory; +import com.l2jbr.commons.database.DatabaseAccess; import com.l2jbr.gameserver.datatables.ItemTable; import com.l2jbr.gameserver.model.actor.instance.L2PcInstance; +import com.l2jbr.gameserver.model.database.repository.PetsRepository; import com.l2jbr.gameserver.network.SystemMessageId; import com.l2jbr.gameserver.serverpackets.InventoryUpdate; import com.l2jbr.gameserver.serverpackets.StatusUpdate; @@ -28,7 +29,6 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import java.sql.PreparedStatement; import java.util.LinkedList; import java.util.List; @@ -306,22 +306,8 @@ public void tradeItems(L2PcInstance player, L2PcInstance reciever) { } private void changePetItemObjectId(int oldObjectId, int newObjectId) { - java.sql.Connection con = null; - try { - con = L2DatabaseFactory.getInstance().getConnection(); - PreparedStatement statement = con.prepareStatement("UPDATE pets SET item_obj_id = ? WHERE item_obj_id = ?"); - statement.setInt(1, newObjectId); - statement.setInt(2, oldObjectId); - statement.executeUpdate(); - statement.close(); - } catch (Exception e) { - _log.warn("could not change pet item object id: " + e); - } finally { - try { - con.close(); - } catch (Exception e) { - } - } + PetsRepository repository = DatabaseAccess.getRepository(PetsRepository.class); + repository.updateId(oldObjectId, newObjectId); } public void updateBuyList(L2PcInstance player, List list) { diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/actor/instance/L2PetInstance.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/actor/instance/L2PetInstance.java index c8462b01..e64a94b4 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/actor/instance/L2PetInstance.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/actor/instance/L2PetInstance.java @@ -19,6 +19,7 @@ package com.l2jbr.gameserver.model.actor.instance; import com.l2jbr.commons.Config; +import com.l2jbr.commons.database.DatabaseAccess; import com.l2jbr.commons.database.L2DatabaseFactory; import com.l2jbr.gameserver.ThreadPoolManager; import com.l2jbr.gameserver.ai.CtrlIntention; @@ -27,6 +28,8 @@ import com.l2jbr.gameserver.instancemanager.ItemsOnGroundManager; import com.l2jbr.gameserver.model.*; import com.l2jbr.gameserver.model.actor.stat.PetStat; +import com.l2jbr.gameserver.model.database.Pets; +import com.l2jbr.gameserver.model.database.repository.PetsRepository; import com.l2jbr.gameserver.network.SystemMessageId; import com.l2jbr.gameserver.serverpackets.*; import com.l2jbr.gameserver.taskmanager.DecayTaskManager; @@ -712,31 +715,9 @@ public void destroyControlItem(L2PcInstance owner) { _logPet.warn("Error while destroying control item: " + e); } - - // pet control item no longer exists, delete the pet from the db - java.sql.Connection con = null; - try - { - con = L2DatabaseFactory.getInstance().getConnection(); - PreparedStatement statement = con.prepareStatement("DELETE FROM pets WHERE item_obj_id=?"); - statement.setInt(1, getControlItemId()); - statement.execute(); - statement.close(); - } - catch (Exception e) - { - _logPet.warn("could not delete pet:" + e); - } - finally - { - try - { - con.close(); - } - catch (Exception e) - { - } - } + + PetsRepository repository = DatabaseAccess.getRepository(PetsRepository.class); + repository.deleteById(getControlItemId()); } public void dropAllItems() @@ -868,46 +849,15 @@ public void store() } String req; - if (!isRespawned()) - { - req = "INSERT INTO pets (name,level,curHp,curMp,exp,sp,karma,pkkills,fed,item_obj_id) " + "VALUES (?,?,?,?,?,?,?,?,?,?)"; + PetsRepository repository = DatabaseAccess.getRepository(PetsRepository.class); + if (!isRespawned()) { + Pets pet = new Pets(getControlItemId(), getName(), getStat().getLevel(), getStatus().getCurrentHp(), getStatus().getCurrentMp(), getStat().getExp(), + getStat().getSp(), getKarma(), getPkKills(), getCurrentFed()); + repository.save(pet); } - else - { - req = "UPDATE pets SET name=?,level=?,curHp=?,curMp=?,exp=?,sp=?,karma=?,pkkills=?,fed=? " + "WHERE item_obj_id = ?"; - } - java.sql.Connection con = null; - try - { - con = L2DatabaseFactory.getInstance().getConnection(); - PreparedStatement statement = con.prepareStatement(req); - statement.setString(1, getName()); - statement.setInt(2, getStat().getLevel()); - statement.setDouble(3, getStatus().getCurrentHp()); - statement.setDouble(4, getStatus().getCurrentMp()); - statement.setLong(5, getStat().getExp()); - statement.setInt(6, getStat().getSp()); - statement.setInt(7, getKarma()); - statement.setInt(8, getPkKills()); - statement.setInt(9, getCurrentFed()); - statement.setInt(10, getControlItemId()); - statement.executeUpdate(); - statement.close(); - _respawned = true; - } - catch (Exception e) - { - _logPet.warn("could not store pet data: " + e); - } - finally - { - try - { - con.close(); - } - catch (Exception e) - { - } + else { + repository.updateById(getControlItemId(), getName(), getStat().getLevel(), getStatus().getCurrentHp(), getStatus().getCurrentMp(), + getStat().getExp(), getStat().getSp(), getKarma(), getPkKills(), getCurrentFed()); } L2ItemInstance itemInst = getControlItem(); diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/Pets.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/Pets.java index b992525b..38d19e6e 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/Pets.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/Pets.java @@ -1,17 +1,35 @@ package com.l2jbr.gameserver.model.database; - +import com.l2jbr.commons.database.annotation.Column; +import org.springframework.data.annotation.Id; public class Pets { - private int item_obj_id; + @Id + @Column("item_obj_id") + private int itemObjId; private String name; - private int level; - private int curHp; - private int curMp; + private byte level; + private double curHp; + private double curMp; private long exp; private int sp; private int karma; private int pkkills; private int fed; + + public Pets() {} + + public Pets( int objectId, String name, byte level, double currentHp, double currentMp, long exp, int sp, int karma, int pkKills, int currentFed) { + this.itemObjId = objectId; + this.name = name; + this.level = level; + this.curHp = currentHp; + this.curMp = currentMp; + this.exp = exp; + this.sp = sp; + this.karma = karma; + this.pkkills = pkKills; + this.fed = currentFed; + } } diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/repository/PetsRepository.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/repository/PetsRepository.java new file mode 100644 index 00000000..74dbd086 --- /dev/null +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/repository/PetsRepository.java @@ -0,0 +1,20 @@ +package com.l2jbr.gameserver.model.database.repository; + +import com.l2jbr.gameserver.model.database.Pets; +import org.springframework.data.jdbc.repository.query.Modifying; +import org.springframework.data.jdbc.repository.query.Query; +import org.springframework.data.repository.CrudRepository; +import org.springframework.data.repository.query.Param; + +public interface PetsRepository extends CrudRepository { + + @Modifying + @Query("UPDATE pets SET item_obj_id=:newObjectId WHERE item_obj_id=:objectId") + int updateId(@Param("objectId") int oldObjectId, @Param("newObjectId") int newObjectId); + + @Modifying + @Query("UPDATE pets SET name=:name,level=:level,curHp=:hp,curMp=:mp,exp=:exp,sp=:sp,karma=:karma,pkkills=:pk,fed=:fed WHERE item_obj_id=:objectId") + int updateById(@Param("objectId") int objectId, @Param("name") String name, @Param("level") byte level, @Param("hp") double hp, + @Param("mp") double mp, @Param("exp") long exp, @Param("sp") int sp, @Param("karma") int karma, @Param("pk") int pkKills, + @Param("fed") int fed); +} From 5c3425aeaf4e7707d07d260559ee296431dc4a91 Mon Sep 17 00:00:00 2001 From: Alisson Oliveira Date: Sat, 5 May 2018 01:15:46 -0300 Subject: [PATCH 076/236] =?UTF-8?q?Remove=20refer=C3=AAncias=20diretas=20?= =?UTF-8?q?=C3=A0=20tabela=20pets=5Fstats?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../gameserver/model/L2PetDataTable.java | 93 ++++++--------- .../gameserver/model/database/PetsStats.java | 108 +++++++++++++++++- .../repository/PetStatsRepository.java | 7 ++ 3 files changed, 148 insertions(+), 60 deletions(-) create mode 100644 Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/repository/PetStatsRepository.java diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/L2PetDataTable.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/L2PetDataTable.java index b62c78a5..b0386b08 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/L2PetDataTable.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/L2PetDataTable.java @@ -18,8 +18,10 @@ */ package com.l2jbr.gameserver.model; +import com.l2jbr.commons.database.DatabaseAccess; import com.l2jbr.commons.database.L2DatabaseFactory; import com.l2jbr.gameserver.model.actor.instance.L2PetInstance; +import com.l2jbr.gameserver.model.database.repository.PetStatsRepository; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -49,63 +51,44 @@ private L2PetDataTable() { } public void loadPetsData() { - java.sql.Connection con = null; - - try { - con = L2DatabaseFactory.getInstance().getConnection(); - PreparedStatement statement = con.prepareStatement("SELECT typeID, level, expMax, hpMax, mpMax, patk, pdef, matk, mdef, acc, evasion, crit, speed, atk_speed, cast_speed, feedMax, feedbattle, feednormal, loadMax, hpregen, mpregen, owner_exp_taken FROM pets_stats"); - ResultSet rset = statement.executeQuery(); - - int petId, petLevel; - - while (rset.next()) { - petId = rset.getInt("typeID"); - petLevel = rset.getInt("level"); - - // build the petdata for this level - L2PetData petData = new L2PetData(); - petData.setPetID(petId); - petData.setPetLevel(petLevel); - petData.setPetMaxExp(rset.getInt("expMax")); - petData.setPetMaxHP(rset.getInt("hpMax")); - petData.setPetMaxMP(rset.getInt("mpMax")); - petData.setPetPAtk(rset.getInt("patk")); - petData.setPetPDef(rset.getInt("pdef")); - petData.setPetMAtk(rset.getInt("matk")); - petData.setPetMDef(rset.getInt("mdef")); - petData.setPetAccuracy(rset.getInt("acc")); - petData.setPetEvasion(rset.getInt("evasion")); - petData.setPetCritical(rset.getInt("crit")); - petData.setPetSpeed(rset.getInt("speed")); - petData.setPetAtkSpeed(rset.getInt("atk_speed")); - petData.setPetCastSpeed(rset.getInt("cast_speed")); - petData.setPetMaxFeed(rset.getInt("feedMax")); - petData.setPetFeedNormal(rset.getInt("feednormal")); - petData.setPetFeedBattle(rset.getInt("feedbattle")); - petData.setPetMaxLoad(rset.getInt("loadMax")); - petData.setPetRegenHP(rset.getInt("hpregen")); - petData.setPetRegenMP(rset.getInt("mpregen")); - petData.setPetRegenMP(rset.getInt("mpregen")); - petData.setOwnerExpTaken(rset.getFloat("owner_exp_taken")); - - // if its the first data for this petid, we initialize its level FastMap - if (!_petTable.containsKey(petId)) { - _petTable.put(petId, new LinkedHashMap()); - } - - _petTable.get(petId).put(petLevel, petData); - } - rset.close(); - statement.close(); - } catch (Exception e) { - _log.warn("Could not load pets stats: " + e); - } finally { - try { - con.close(); - } catch (Exception e) { + PetStatsRepository repository = DatabaseAccess.getRepository(PetStatsRepository.class); + repository.findAll().forEach(petsStats -> { + int petId = petsStats.getTypeID(); + int petLevel = petsStats.getLevel(); + + L2PetData petData = new L2PetData(); + petData.setPetID(petId); + petData.setPetLevel(petLevel); + petData.setPetMaxExp(petsStats.getExpMax()); + petData.setPetMaxHP(petsStats.getHpMax()); + petData.setPetMaxMP(petsStats.getMpMax()); + petData.setPetPAtk(petsStats.getPatk()); + petData.setPetPDef(petsStats.getPdef()); + petData.setPetMAtk(petsStats.getMatk()); + petData.setPetMDef(petsStats.getMdef()); + petData.setPetAccuracy(petsStats.getAcc()); + petData.setPetEvasion(petsStats.getEvasion()); + petData.setPetCritical(petsStats.getCrit()); + petData.setPetSpeed(petsStats.getSpeed()); + petData.setPetAtkSpeed(petsStats.getAtkSpeed()); + petData.setPetCastSpeed(petsStats.getCastSpeed()); + petData.setPetMaxFeed(petsStats.getFeedMax()); + petData.setPetFeedNormal(petsStats.getFeednormal()); + petData.setPetFeedBattle(petsStats.getFeedbattle()); + petData.setPetMaxLoad(petsStats.getLoadMax()); + petData.setPetRegenHP(petsStats.getHpregen()); + petData.setPetRegenMP(petsStats.getMpregen()); + petData.setPetRegenMP(petsStats.getMpregen()); + petData.setOwnerExpTaken(petsStats.getOwnerExpTaken()); + + if (!_petTable.containsKey(petId)) { + _petTable.put(petId, new LinkedHashMap<>()); } - } + + _petTable.get(petId).put(petLevel, petData); + + }); } public void addPetData(L2PetData petData) { diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/PetsStats.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/PetsStats.java index 7edc27d8..a448adca 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/PetsStats.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/PetsStats.java @@ -1,11 +1,15 @@ package com.l2jbr.gameserver.model.database; +import com.l2jbr.commons.database.annotation.Column; +import com.l2jbr.commons.database.annotation.Table; +import org.springframework.data.annotation.Id; - +@Table("pets_stats") public class PetsStats { - private String type; + @Id private int typeID; + private String type; private int level; private int expMax; private int hpMax; @@ -18,14 +22,108 @@ public class PetsStats { private int evasion; private int crit; private int speed; - private int atk_speed; - private int cast_speed; + @Column("atk_speed") + private int atkSpeed; + @Column("cast_speed") + private int castSpeed; private int feedMax; private int feedbattle; private int feednormal; private int loadMax; private int hpregen; private int mpregen; - private int owner_exp_taken; + @Column("owner_exp_taken") + private int ownerExpTaken; + + public int getTypeID() { + return typeID; + } + + public String getType() { + return type; + } + + public int getLevel() { + return level; + } + + public int getExpMax() { + return expMax; + } + + public int getHpMax() { + return hpMax; + } + + public int getMpMax() { + return mpMax; + } + + public int getPatk() { + return patk; + } + + public int getPdef() { + return pdef; + } + + public int getMatk() { + return matk; + } + + public int getMdef() { + return mdef; + } + + public int getAcc() { + return acc; + } + + public int getEvasion() { + return evasion; + } + + public int getCrit() { + return crit; + } + + public int getSpeed() { + return speed; + } + + public int getAtkSpeed() { + return atkSpeed; + } + + public int getCastSpeed() { + return castSpeed; + } + + public int getFeedMax() { + return feedMax; + } + + public int getFeedbattle() { + return feedbattle; + } + + public int getFeednormal() { + return feednormal; + } + + public int getLoadMax() { + return loadMax; + } + + public int getHpregen() { + return hpregen; + } + + public int getMpregen() { + return mpregen; + } + public int getOwnerExpTaken() { + return ownerExpTaken; + } } diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/repository/PetStatsRepository.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/repository/PetStatsRepository.java new file mode 100644 index 00000000..4fa27f12 --- /dev/null +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/repository/PetStatsRepository.java @@ -0,0 +1,7 @@ +package com.l2jbr.gameserver.model.database.repository; + +import com.l2jbr.gameserver.model.database.PetsStats; +import org.springframework.data.repository.CrudRepository; + +public interface PetStatsRepository extends CrudRepository { +} From 3ca9c619d528b5ef569d2acb67875ad0c4e5e698 Mon Sep 17 00:00:00 2001 From: Alisson Oliveira Date: Sat, 5 May 2018 06:42:28 -0300 Subject: [PATCH 077/236] =?UTF-8?q?Remove=20refer=C3=AAncias=20diretas=20?= =?UTF-8?q?=C3=A0=20tabela=20pledge=5Fskill=5Ftrees?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../gameserver/datatables/SkillTreeTable.java | 41 +++++++------------ .../model/database/PledgeSkillTrees.java | 40 ++++++++++++++++-- .../PledgeSkillTreesRepository.java | 11 +++++ 3 files changed, 62 insertions(+), 30 deletions(-) create mode 100644 Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/repository/PledgeSkillTreesRepository.java diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/datatables/SkillTreeTable.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/datatables/SkillTreeTable.java index c227177c..9913840a 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/datatables/SkillTreeTable.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/datatables/SkillTreeTable.java @@ -31,6 +31,7 @@ import com.l2jbr.gameserver.model.database.repository.CharTemplateRepository; import com.l2jbr.gameserver.model.database.repository.EnchantSkillTreesRepository; import com.l2jbr.gameserver.model.database.repository.FishingSkillTreeRepository; +import com.l2jbr.gameserver.model.database.repository.PledgeSkillTreesRepository; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -218,37 +219,23 @@ private SkillTreeTable() { int count4 = _enchantSkillTrees.size(); + _pledgeSkillTrees = new LinkedList<>(); + PledgeSkillTreesRepository pledgeSkillTreesRepository = DatabaseAccess.getRepository(PledgeSkillTreesRepository.class); + pledgeSkillTreesRepository.findAllOrderBySkillAndLevel().forEach(pledgeSkill -> { + int id = pledgeSkill.getSkillId(); + int lvl = pledgeSkill.getLevel(); + String name = pledgeSkill.getName(); + int baseLvl = pledgeSkill.getClanLvl(); + int sp = pledgeSkill.getRepCost(); + int itemId = pledgeSkill.getItemId(); - int count5 = 0; - try(Connection con = L2DatabaseFactory.getInstance().getConnection(); - PreparedStatement statement = con.prepareStatement("SELECT skill_id, level, name, clan_lvl, repCost, itemId FROM pledge_skill_trees ORDER BY skill_id, level"); - ResultSet skilltree4 = statement.executeQuery();) { - _pledgeSkillTrees = new LinkedList<>(); - int prevSkillId = -1; - - while (skilltree4.next()) { - int id = skilltree4.getInt("skill_id"); - int lvl = skilltree4.getInt("level"); - String name = skilltree4.getString("name"); - int baseLvl = skilltree4.getInt("clan_lvl"); - int sp = skilltree4.getInt("repCost"); - int itemId = skilltree4.getInt("itemId"); - - if (prevSkillId != id) { - prevSkillId = id; - } - - L2PledgeSkillLearn skill = new L2PledgeSkillLearn(id, lvl, baseLvl, name, sp, itemId); - - _pledgeSkillTrees.add(skill); - } + L2PledgeSkillLearn skill = new L2PledgeSkillLearn(id, lvl, baseLvl, name, sp, itemId); + _pledgeSkillTrees.add(skill); + }); - count5 = _pledgeSkillTrees.size(); - } catch (Exception e) { - _log.error("Error while creating fishing skill table: " + e); - } + int count5 = _pledgeSkillTrees.size(); _log.info("FishingSkillTreeTable: Loaded " + count2 + " general skills."); _log.info("FishingSkillTreeTable: Loaded " + count3 + " dwarven skills."); diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/PledgeSkillTrees.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/PledgeSkillTrees.java index 5ad2b111..dba3466d 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/PledgeSkillTrees.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/PledgeSkillTrees.java @@ -1,14 +1,48 @@ package com.l2jbr.gameserver.model.database; +import com.l2jbr.commons.database.annotation.Column; +import com.l2jbr.commons.database.annotation.Table; +import org.springframework.data.annotation.Id; - +@Table("pledge_skill_trees") public class PledgeSkillTrees { - private int skill_id; + @Id + @Column("skill_id") + private int skillId; private int level; private String name; - private int clan_lvl; + @Column("clan_lvl") + private int clanLvl; private String Description; private int repCost; private int itemId; + + public int getSkillId() { + return skillId; + } + + public int getLevel() { + return level; + } + + public String getName() { + return name; + } + + public int getClanLvl() { + return clanLvl; + } + + public String getDescription() { + return Description; + } + + public int getRepCost() { + return repCost; + } + + public int getItemId() { + return itemId; + } } diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/repository/PledgeSkillTreesRepository.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/repository/PledgeSkillTreesRepository.java new file mode 100644 index 00000000..1cd3db03 --- /dev/null +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/repository/PledgeSkillTreesRepository.java @@ -0,0 +1,11 @@ +package com.l2jbr.gameserver.model.database.repository; + +import com.l2jbr.gameserver.model.database.PledgeSkillTrees; +import org.springframework.data.jdbc.repository.query.Query; +import org.springframework.data.repository.CrudRepository; + +public interface PledgeSkillTreesRepository extends CrudRepository { + + @Query("SELECT * FROM pledge_skill_trees ORDER BY skill_id, level") + Iterable findAllOrderBySkillAndLevel(); +} From aa470f54f7027a9ca53da4ebd45d417cc9ae4b5d Mon Sep 17 00:00:00 2001 From: Alisson Oliveira Date: Sat, 5 May 2018 07:12:08 -0300 Subject: [PATCH 078/236] =?UTF-8?q?Remove=20refer=C3=AAncias=20diretas=20?= =?UTF-8?q?=C3=A0=20tabela=20topic?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../gameserver/communitybbs/BB/Forum.java | 32 +----- .../gameserver/communitybbs/BB/Topic.java | 106 +++--------------- .../gameserver/model/database/Forums.java | 8 ++ .../gameserver/model/database/Topic.java | 73 ++++++++++-- .../database/repository/TopicRepository.java | 12 ++ 5 files changed, 106 insertions(+), 125 deletions(-) create mode 100644 Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/repository/TopicRepository.java diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/communitybbs/BB/Forum.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/communitybbs/BB/Forum.java index ca068dcd..4393d54e 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/communitybbs/BB/Forum.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/communitybbs/BB/Forum.java @@ -19,7 +19,6 @@ package com.l2jbr.gameserver.communitybbs.BB; import com.l2jbr.commons.database.DatabaseAccess; -import com.l2jbr.commons.database.L2DatabaseFactory; import com.l2jbr.gameserver.communitybbs.Manager.ForumsBBSManager; import com.l2jbr.gameserver.communitybbs.Manager.TopicBBSManager; import com.l2jbr.gameserver.model.database.Forums; @@ -27,8 +26,6 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import java.sql.PreparedStatement; -import java.sql.ResultSet; import java.util.LinkedHashMap; import java.util.LinkedList; import java.util.List; @@ -109,34 +106,15 @@ private void load() { _forumType = forum.getForumType(); _forumPerm = forum.getForumPerm(); _ownerID = forum.getForumOwnerId(); - }); - - java.sql.Connection con = null; - - try { - con = L2DatabaseFactory.getInstance().getConnection(); - PreparedStatement statement = con.prepareStatement("SELECT * FROM topic WHERE topic_forum_id=? ORDER BY topic_id DESC"); - statement.setInt(1, _forumId); - ResultSet result = statement.executeQuery(); - - while (result.next()) { - Topic t = new Topic(Topic.ConstructorType.RESTORE, Integer.parseInt(result.getString("topic_id")), Integer.parseInt(result.getString("topic_forum_id")), result.getString("topic_name"), Long.parseLong(result.getString("topic_date")), result.getString("topic_ownername"), Integer.parseInt(result.getString("topic_ownerid")), Integer.parseInt(result.getString("topic_type")), Integer.parseInt(result.getString("topic_reply"))); + forum.getTopics().forEach(topic -> { + Topic t = new Topic(Topic.ConstructorType.RESTORE, topic.getTopicId(), topic.getTopicForumId(), topic.getTopicName(), + topic.getTopicDate(), topic.getTopicOwnerName(), topic.getTopicOwnerId(), topic.getTopicType(), topic.getTopicReply()); _topic.put(t.getID(), t); if (t.getID() > TopicBBSManager.getInstance().getMaxID(this)) { TopicBBSManager.getInstance().setMaxID(t.getID(), this); } - } - result.close(); - statement.close(); - } catch (Exception e) { - _log.warn("data error on Forum " + _forumId + " : " + e); - e.printStackTrace(); - } finally { - try { - con.close(); - } catch (Exception e) { - } - } + }); + }); } private void getChildren() { diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/communitybbs/BB/Topic.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/communitybbs/BB/Topic.java index 47a6ef21..92926c86 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/communitybbs/BB/Topic.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/communitybbs/BB/Topic.java @@ -18,13 +18,12 @@ */ package com.l2jbr.gameserver.communitybbs.BB; -import com.l2jbr.commons.database.L2DatabaseFactory; +import com.l2jbr.commons.database.DatabaseAccess; import com.l2jbr.gameserver.communitybbs.Manager.TopicBBSManager; +import com.l2jbr.gameserver.model.database.repository.TopicRepository; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import java.sql.PreparedStatement; - public class Topic { @@ -71,44 +70,12 @@ public Topic(ConstructorType ct, int id, int fid, String name, long date, String insertindb(); } } - - /** - * - */ - public void insertindb() - { - java.sql.Connection con = null; - try - { - con = L2DatabaseFactory.getInstance().getConnection(); - PreparedStatement statement = con.prepareStatement("INSERT INTO topic (topic_id,topic_forum_id,topic_name,topic_date,topic_ownername,topic_ownerid,topic_type,topic_reply) values (?,?,?,?,?,?,?,?)"); - statement.setInt(1, _id); - statement.setInt(2, _forumId); - statement.setString(3, _topicName); - statement.setLong(4, _date); - statement.setString(5, _ownerName); - statement.setInt(6, _ownerId); - statement.setInt(7, _type); - statement.setInt(8, _cReply); - statement.execute(); - statement.close(); - - } - catch (Exception e) - { - _log.warn("error while saving new Topic to db " + e); - } - finally - { - try - { - con.close(); - } - catch (Exception e) - { - } - } - + + public void insertindb() { + com.l2jbr.gameserver.model.database.Topic topic = new com.l2jbr.gameserver.model.database.Topic(_id, _forumId, _topicName, _date, + _ownerName, _ownerId, _type, _cReply); + TopicRepository repository = DatabaseAccess.getRepository(TopicRepository.class); + repository.save(topic); } public enum ConstructorType @@ -116,10 +83,7 @@ public enum ConstructorType RESTORE, CREATE } - - /** - * @return - */ + public int getID() { return _id; @@ -129,58 +93,22 @@ public int getForumID() { return _forumId; } - - /** - * @return - */ - public String getName() - { - // TODO Auto-generated method stub + + public String getName() { return _topicName; } - public String getOwnerName() - { - // TODO Auto-generated method stub + public String getOwnerName() { return _ownerName; } - - /** - * @param f - */ - public void deleteme(Forum f) - { + + public void deleteme(Forum f) { TopicBBSManager.getInstance().delTopic(this); f.rmTopicByID(getID()); - java.sql.Connection con = null; - try - { - con = L2DatabaseFactory.getInstance().getConnection(); - PreparedStatement statement = con.prepareStatement("DELETE FROM topic WHERE topic_id=? AND topic_forum_id=?"); - statement.setInt(1, getID()); - statement.setInt(2, f.getID()); - statement.execute(); - statement.close(); - } - catch (Exception e) - { - e.printStackTrace(); - } - finally - { - try - { - con.close(); - } - catch (Exception e) - { - } - } + TopicRepository repository = DatabaseAccess.getRepository(TopicRepository.class); + repository.deleteByForum(getID(), f.getID()); } - - /** - * @return - */ + public long getDate() { return _date; diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/Forums.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/Forums.java index 60641364..32269244 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/Forums.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/Forums.java @@ -4,6 +4,8 @@ import com.l2jbr.commons.database.model.Entity; import org.springframework.data.annotation.Id; +import java.util.Set; + public class Forums extends Entity { @Id @Column("forum_id") @@ -20,6 +22,8 @@ public class Forums extends Entity { private int forumPerm; @Column("forum_owner_id") private int forumOwnerId; + @Column("topic_forum_id") + private Set topics; public Forums() {} @@ -61,4 +65,8 @@ public int getForumPerm() { public int getForumOwnerId() { return forumOwnerId; } + + public Set getTopics() { + return topics; + } } diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/Topic.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/Topic.java index c2b2a297..b4003de9 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/Topic.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/Topic.java @@ -1,15 +1,70 @@ package com.l2jbr.gameserver.model.database; - +import com.l2jbr.commons.database.annotation.Column; +import org.springframework.data.annotation.Id; public class Topic { - private int topic_id; - private int topic_forum_id; - private String topic_name; - private long topic_date; - private String topic_ownername; - private int topic_ownerid; - private int topic_type; - private int topic_reply; + @Id + @Column("topic_id") + private int topicId; + @Column("topic_forum_id") + private int topicForumId; + @Column("topic_name") + private String topicName; + @Column("topic_date") + private long topicDate; + @Column("topic_ownername") + private String topicOwnerName; + @Column("topic_ownerid") + private int topicOwnerId; + @Column("topicType") + private int topicType; + @Column("topic_reply") + private int topicReply; + + public Topic() {} + + public Topic(int id, int forumId, String topicName, long date, String ownerName, int ownerId, int type, int cReply) { + this.topicId = id; + this.topicForumId = forumId; + this.topicName = topicName; + this.topicDate = date; + this.topicOwnerName = ownerName; + this.topicOwnerId = ownerId; + this.topicType = type; + this.topicReply = cReply; + } + + public int getTopicId() { + return topicId; + } + + public int getTopicForumId() { + return topicForumId; + } + + public String getTopicName() { + return topicName; + } + + public long getTopicDate() { + return topicDate; + } + + public String getTopicOwnerName() { + return topicOwnerName; + } + + public int getTopicOwnerId() { + return topicOwnerId; + } + + public int getTopicType() { + return topicType; + } + + public int getTopicReply() { + return topicReply; + } } diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/repository/TopicRepository.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/repository/TopicRepository.java new file mode 100644 index 00000000..7c54d9ad --- /dev/null +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/repository/TopicRepository.java @@ -0,0 +1,12 @@ +package com.l2jbr.gameserver.model.database.repository; + +import com.l2jbr.gameserver.model.database.Topic; +import org.springframework.data.jdbc.repository.query.Query; +import org.springframework.data.repository.CrudRepository; +import org.springframework.data.repository.query.Param; + +public interface TopicRepository extends CrudRepository { + + @Query("DELETE FROM topic WHERE topic_id=:topic AND topic_forum_id=:forum") + int deleteByForum(@Param("topic") int topicId, @Param("forum") int forumId); +} From 138d1801ffd4d725558cb9a639688068458f6169 Mon Sep 17 00:00:00 2001 From: Alisson Oliveira Date: Sat, 5 May 2018 11:57:08 -0300 Subject: [PATCH 079/236] =?UTF-8?q?Remove=20refer=C3=AAncias=20diretas=20?= =?UTF-8?q?=C3=A0=20tabela=20post?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../gameserver/communitybbs/BB/Post.java | 113 ++---------------- .../gameserver/model/database/Posts.java | 45 +++++-- .../gameserver/model/database/Topic.java | 6 +- .../database/repository/PostRepository.java | 21 ++++ 4 files changed, 75 insertions(+), 110 deletions(-) create mode 100644 Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/repository/PostRepository.java diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/communitybbs/BB/Post.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/communitybbs/BB/Post.java index d7da2484..5ef3daf1 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/communitybbs/BB/Post.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/communitybbs/BB/Post.java @@ -18,13 +18,13 @@ */ package com.l2jbr.gameserver.communitybbs.BB; -import com.l2jbr.commons.database.L2DatabaseFactory; +import com.l2jbr.commons.database.DatabaseAccess; import com.l2jbr.gameserver.communitybbs.Manager.PostBBSManager; +import com.l2jbr.gameserver.model.database.Posts; +import com.l2jbr.gameserver.model.database.repository.PostRepository; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import java.sql.PreparedStatement; -import java.sql.ResultSet; import java.util.LinkedList; import java.util.List; @@ -71,28 +71,9 @@ public Post(String _PostOwner, int _PostOwnerID, long date, int tid, int _PostFo } public void insertindb(CPost cp) { - java.sql.Connection con = null; - try { - con = L2DatabaseFactory.getInstance().getConnection(); - PreparedStatement statement = con.prepareStatement("INSERT INTO posts (post_id,post_owner_name,post_ownerid,post_date,post_topic_id,post_forum_id,post_txt) values (?,?,?,?,?,?,?)"); - statement.setInt(1, cp.postId); - statement.setString(2, cp.postOwner); - statement.setInt(3, cp.postOwnerId); - statement.setLong(4, cp.postDate); - statement.setInt(5, cp.postTopicId); - statement.setInt(6, cp.postForumId); - statement.setString(7, cp.postTxt); - statement.execute(); - statement.close(); - } catch (Exception e) { - _log.warn("error while saving new Post to db " + e); - } finally { - try { - con.close(); - } catch (Exception e) { - } - } - + Posts post = new Posts(cp.postId, cp.postOwner, cp.postOwnerId, cp.postDate, cp.postTopicId, cp.postForumId, cp.postTxt); + PostRepository repository = DatabaseAccess.getRepository(PostRepository.class); + repository.save(post); } public Post(Topic t) { @@ -113,86 +94,18 @@ public CPost getCPost(int id) { public void deleteme(Topic t) { PostBBSManager.getInstance().delPostByTopic(t); - java.sql.Connection con = null; - try { - con = L2DatabaseFactory.getInstance().getConnection(); - PreparedStatement statement = con.prepareStatement("DELETE FROM posts WHERE post_forum_id=? AND post_topic_id=?"); - statement.setInt(1, t.getForumID()); - statement.setInt(2, t.getID()); - statement.execute(); - statement.close(); - } catch (Exception e) { - e.printStackTrace(); - } finally { - try { - con.close(); - } catch (Exception e) { - } - } + PostRepository repository = DatabaseAccess.getRepository(PostRepository.class); + repository.deleteByForumAndTopic(t.getForumID(), t.getID()); } - /** - * @param t - */ private void load(Topic t) { - java.sql.Connection con = null; - try { - con = L2DatabaseFactory.getInstance().getConnection(); - PreparedStatement statement = con.prepareStatement("SELECT * FROM posts WHERE post_forum_id=? AND post_topic_id=? ORDER BY post_id ASC"); - statement.setInt(1, t.getForumID()); - statement.setInt(2, t.getID()); - ResultSet result = statement.executeQuery(); - while (result.next()) { - CPost cp = new CPost(); - cp.postId = Integer.parseInt(result.getString("post_id")); - cp.postOwner = result.getString("post_owner_name"); - cp.postOwnerId = Integer.parseInt(result.getString("post_ownerid")); - cp.postDate = Long.parseLong(result.getString("post_date")); - cp.postTopicId = Integer.parseInt(result.getString("post_topic_id")); - cp.postForumId = Integer.parseInt(result.getString("post_forum_id")); - cp.postTxt = result.getString("post_txt"); - _post.add(cp); - } - result.close(); - statement.close(); - } catch (Exception e) { - _log.warn("data error on Post " + t.getForumID() + "/" + t.getID() + " : " + e); - e.printStackTrace(); - } finally { - try { - con.close(); - } catch (Exception e) { - } - } + PostRepository repository = DatabaseAccess.getRepository(PostRepository.class); + repository.findAllByForumAndTopic(t.getForumID(), t.getID()); } - /** - * @param i - */ public void updatetxt(int i) { - java.sql.Connection con = null; - try { - CPost cp = getCPost(i); - con = L2DatabaseFactory.getInstance().getConnection(); - PreparedStatement statement = con.prepareStatement("UPDATE posts SET post_txt=? WHERE post_id=? AND post_topic_id=? AND post_forum_id=?"); - statement.setString(1, cp.postTxt); - statement.setInt(2, cp.postId); - statement.setInt(3, cp.postTopicId); - statement.setInt(4, cp.postForumId); - statement.execute(); - statement.close(); - } catch (Exception e) { - _log.warn("error while saving new Post to db " + e); - } finally { - try { - con.close(); - } catch (Exception e) { - } - } - + PostRepository repository = DatabaseAccess.getRepository(PostRepository.class); + CPost cp = getCPost(i); + repository.updateText(cp.postId, cp.postTopicId, cp.postForumId, cp.postTxt); } - /** - * - */ - } diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/Posts.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/Posts.java index a5e34600..8958c6a4 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/Posts.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/Posts.java @@ -1,12 +1,41 @@ package com.l2jbr.gameserver.model.database; -public class Posts { - private int post_id; - private String post_owner_name; - private int post_ownerid; - private long post_date; - private int post_topic_id; - private int post_forum_id; - private String post_txt; +import com.l2jbr.commons.database.annotation.Column; +import com.l2jbr.commons.database.model.Entity; +import org.springframework.data.annotation.Id; +public class Posts extends Entity { + @Id + @Column("post_id") + private int postId; + @Column("post_owner_name") + private String postOwnerName; + @Column("post_ownerid") + private int postOwnerid; + @Column("post_date") + private long postDate; + @Column("post_topic_id") + private int postTopicId; + @Column("post_forum_id") + private int postForumId; + @Column("post_txt") + private String postTxt; + + public Posts() {} + + public Posts(int postId, String postOwner, int postOwnerId, long postDate, int postTopicId, int postForumId, String postTxt) { + this.postId = postId; + this.postOwnerName = postOwner; + this.postOwnerid = postOwnerId; + this.postDate = postDate; + this.postTopicId = postTopicId; + this.postForumId = postForumId; + this.postTxt = postTxt; + + } + + @Override + public Integer getId() { + return postId; + } } diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/Topic.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/Topic.java index b4003de9..0ba41f56 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/Topic.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/Topic.java @@ -1,9 +1,10 @@ package com.l2jbr.gameserver.model.database; import com.l2jbr.commons.database.annotation.Column; +import com.l2jbr.commons.database.model.Entity; import org.springframework.data.annotation.Id; -public class Topic { +public class Topic extends Entity { @Id @Column("topic_id") @@ -36,7 +37,8 @@ public Topic(int id, int forumId, String topicName, long date, String ownerName, this.topicReply = cReply; } - public int getTopicId() { + @Override + public Integer getId() { return topicId; } diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/repository/PostRepository.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/repository/PostRepository.java new file mode 100644 index 00000000..f5432ce2 --- /dev/null +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/repository/PostRepository.java @@ -0,0 +1,21 @@ +package com.l2jbr.gameserver.model.database.repository; + +import com.l2jbr.gameserver.model.database.Posts; +import org.springframework.data.jdbc.repository.query.Modifying; +import org.springframework.data.jdbc.repository.query.Query; +import org.springframework.data.repository.CrudRepository; +import org.springframework.data.repository.query.Param; + +public interface PostRepository extends CrudRepository { + + @Modifying + @Query("DELETE FROM posts WHERE post_forum_id=:forum AND post_topic_id=:topic") + int deleteByForumAndTopic(@Param("forum") int forumId, @Param("topic") int topicId); + + @Query("SELECT * FROM posts WHERE post_forum_id=:forum AND post_topic_id=:post ORDER BY post_id ASC") + int findAllByForumAndTopic(@Param("forum") int forumId, @Param("topic") int topicId); + + @Modifying + @Query("UPDATE posts SET post_txt=:text WHERE post_id=:pot AND post_topic_id=:topic AND post_forum_id=:forum") + void updateText(@Param("post") int postId, @Param("topic") int topicId, @Param("forum") int forumId, @Param("text") String postTxt); +} From 1de12ce7d18abe64bc1e1058035ac4891b211f14 Mon Sep 17 00:00:00 2001 From: Alisson Oliveira Date: Sat, 5 May 2018 13:08:48 -0300 Subject: [PATCH 080/236] =?UTF-8?q?Remove=20refer=C3=AAncias=20diretas=20?= =?UTF-8?q?=C3=A0=20tabela=20quest=5Fglobal=5Fdata?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../gameserver/communitybbs/BB/Forum.java | 2 +- .../model/database/QuestGlobalData.java | 9 +- .../repository/QuestGlobalDataRepository.java | 22 +++++ .../l2jbr/gameserver/model/quest/Quest.java | 87 ++----------------- 4 files changed, 39 insertions(+), 81 deletions(-) create mode 100644 Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/repository/QuestGlobalDataRepository.java diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/communitybbs/BB/Forum.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/communitybbs/BB/Forum.java index 4393d54e..7578b859 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/communitybbs/BB/Forum.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/communitybbs/BB/Forum.java @@ -107,7 +107,7 @@ private void load() { _forumPerm = forum.getForumPerm(); _ownerID = forum.getForumOwnerId(); forum.getTopics().forEach(topic -> { - Topic t = new Topic(Topic.ConstructorType.RESTORE, topic.getTopicId(), topic.getTopicForumId(), topic.getTopicName(), + Topic t = new Topic(Topic.ConstructorType.RESTORE, topic.getId(), topic.getTopicForumId(), topic.getTopicName(), topic.getTopicDate(), topic.getTopicOwnerName(), topic.getTopicOwnerId(), topic.getTopicType(), topic.getTopicReply()); _topic.put(t.getID(), t); if (t.getID() > TopicBBSManager.getInstance().getMaxID(this)) { diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/QuestGlobalData.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/QuestGlobalData.java index 5ccb67e6..fccb0bd4 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/QuestGlobalData.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/QuestGlobalData.java @@ -1,10 +1,15 @@ package com.l2jbr.gameserver.model.database; +import com.l2jbr.commons.database.annotation.Column; +import com.l2jbr.commons.database.annotation.Table; +import org.springframework.data.annotation.Id; - +@Table("quest_global_data") public class QuestGlobalData { - private String quest_name; + @Id + @Column("quest_name") + private String questName; private String var; private String value; } diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/repository/QuestGlobalDataRepository.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/repository/QuestGlobalDataRepository.java new file mode 100644 index 00000000..600a5d21 --- /dev/null +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/repository/QuestGlobalDataRepository.java @@ -0,0 +1,22 @@ +package com.l2jbr.gameserver.model.database.repository; + +import com.l2jbr.gameserver.model.database.QuestGlobalData; +import org.springframework.data.jdbc.repository.query.Modifying; +import org.springframework.data.jdbc.repository.query.Query; +import org.springframework.data.repository.CrudRepository; +import org.springframework.data.repository.query.Param; + +import java.util.Optional; + +public interface QuestGlobalDataRepository extends CrudRepository { + + @Modifying + @Query("REPLACE INTO quest_global_data VALUES (:quest,:var,:value)") + void saveOrUpdate(@Param("quest") String questName, @Param("var") String var, @Param("value") String value); + + @Query("SELECT value FROM quest_global_data WHERE quest_name=:quest AND var=:var") + Optional findValueByVar(@Param("quest") String name, @Param("var") String var); + + @Query("DELETE FROM quest_global_data WHERE quest_name=:quest AND var=:var") + int deleteByVar(@Param("quest") String questName, @Param("var") String var); +} diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/quest/Quest.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/quest/Quest.java index 13d6e677..3f0b1de9 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/quest/Quest.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/quest/Quest.java @@ -20,7 +20,6 @@ import com.l2jbr.commons.Config; import com.l2jbr.commons.database.DatabaseAccess; -import com.l2jbr.commons.database.L2DatabaseFactory; import com.l2jbr.commons.util.Rnd; import com.l2jbr.gameserver.ThreadPoolManager; import com.l2jbr.gameserver.cache.HtmCache; @@ -31,18 +30,16 @@ import com.l2jbr.gameserver.model.actor.instance.L2PcInstance; import com.l2jbr.gameserver.model.database.CharacterQuests; import com.l2jbr.gameserver.model.database.repository.CharacterQuestsRepository; +import com.l2jbr.gameserver.model.database.repository.QuestGlobalDataRepository; import com.l2jbr.gameserver.network.SystemMessageId; import com.l2jbr.gameserver.serverpackets.NpcHtmlMessage; import com.l2jbr.gameserver.serverpackets.SystemMessage; import com.l2jbr.gameserver.templates.L2NpcTemplate; -import org.python.bouncycastle.asn1.dvcs.Data; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import java.io.PrintWriter; import java.io.StringWriter; -import java.sql.PreparedStatement; -import java.sql.ResultSet; import java.util.*; @@ -534,24 +531,8 @@ public final static void playerEnter(L2PcInstance player) { * @param value : String designating the value of the variable for the quest */ public final void saveGlobalQuestVar(String var, String value) { - java.sql.Connection con = null; - try { - con = L2DatabaseFactory.getInstance().getConnection(); - PreparedStatement statement; - statement = con.prepareStatement("REPLACE INTO quest_global_data (quest_name,var,value) VALUES (?,?,?)"); - statement.setString(1, getName()); - statement.setString(2, var); - statement.setString(3, value); - statement.executeUpdate(); - statement.close(); - } catch (Exception e) { - _log.warn( "could not insert global quest variable:", e); - } finally { - try { - con.close(); - } catch (Exception e) { - } - } + QuestGlobalDataRepository repository = DatabaseAccess.getRepository(QuestGlobalDataRepository.class); + repository.saveOrUpdate(getName(), var, value); } /** @@ -562,29 +543,8 @@ public final void saveGlobalQuestVar(String var, String value) { * @return String : String representing the loaded value for the passed var, or an empty string if the var was invalid */ public final String loadGlobalQuestVar(String var) { - String result = ""; - java.sql.Connection con = null; - try { - con = L2DatabaseFactory.getInstance().getConnection(); - PreparedStatement statement; - statement = con.prepareStatement("SELECT value FROM quest_global_data WHERE quest_name = ? AND var = ?"); - statement.setString(1, getName()); - statement.setString(2, var); - ResultSet rs = statement.executeQuery(); - if (rs.first()) { - result = rs.getString(1); - } - rs.close(); - statement.close(); - } catch (Exception e) { - _log.warn( "could not load global quest variable:", e); - } finally { - try { - con.close(); - } catch (Exception e) { - } - } - return result; + QuestGlobalDataRepository repository = DatabaseAccess.getRepository(QuestGlobalDataRepository.class); + return repository.findValueByVar(getName(), var).orElse(""); } /** @@ -593,45 +553,16 @@ public final String loadGlobalQuestVar(String var) { * @param var : String designating the name of the variable for the quest */ public final void deleteGlobalQuestVar(String var) { - java.sql.Connection con = null; - try { - con = L2DatabaseFactory.getInstance().getConnection(); - PreparedStatement statement; - statement = con.prepareStatement("DELETE FROM quest_global_data WHERE quest_name = ? AND var = ?"); - statement.setString(1, getName()); - statement.setString(2, var); - statement.executeUpdate(); - statement.close(); - } catch (Exception e) { - _log.warn( "could not delete global quest variable:", e); - } finally { - try { - con.close(); - } catch (Exception e) { - } - } + QuestGlobalDataRepository repository = DatabaseAccess.getRepository(QuestGlobalDataRepository.class); + repository.deleteByVar(getName(), var); } /** * Permanently delete from the database all global quest variables that was previously saved for this quest. */ public final void deleteAllGlobalQuestVars() { - java.sql.Connection con = null; - try { - con = L2DatabaseFactory.getInstance().getConnection(); - PreparedStatement statement; - statement = con.prepareStatement("DELETE FROM quest_global_data WHERE quest_name = ?"); - statement.setString(1, getName()); - statement.executeUpdate(); - statement.close(); - } catch (Exception e) { - _log.warn( "could not delete global quest variables:", e); - } finally { - try { - con.close(); - } catch (Exception e) { - } - } + QuestGlobalDataRepository repository = DatabaseAccess.getRepository(QuestGlobalDataRepository.class); + repository.deleteById(getName()); } public static void createQuestVarInDb(QuestState qs, String var, String value) { From 25ca80505cc9cee1d69dddbbec184a095ce6a50e Mon Sep 17 00:00:00 2001 From: Alisson Oliveira Date: Sat, 5 May 2018 16:04:42 -0300 Subject: [PATCH 081/236] =?UTF-8?q?Remove=20refer=C3=AAncias=20diretas=20?= =?UTF-8?q?=C3=A0=20tabela=20raidboss=5Fspawnlist?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../instancemanager/RaidBossSpawnManager.java | 161 +++++------------- .../model/database/RaidbossSpawnList.java | 91 ++++++++-- .../RaidBossSpawnListRepository.java | 14 ++ 3 files changed, 136 insertions(+), 130 deletions(-) create mode 100644 Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/repository/RaidBossSpawnListRepository.java diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/instancemanager/RaidBossSpawnManager.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/instancemanager/RaidBossSpawnManager.java index 9a70c696..e1cbf7f8 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/instancemanager/RaidBossSpawnManager.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/instancemanager/RaidBossSpawnManager.java @@ -19,7 +19,7 @@ package com.l2jbr.gameserver.instancemanager; import com.l2jbr.commons.Config; -import com.l2jbr.commons.database.L2DatabaseFactory; +import com.l2jbr.commons.database.DatabaseAccess; import com.l2jbr.commons.util.Rnd; import com.l2jbr.gameserver.GmListTable; import com.l2jbr.gameserver.ThreadPoolManager; @@ -27,15 +27,14 @@ import com.l2jbr.gameserver.datatables.SpawnTable; import com.l2jbr.gameserver.model.L2Spawn; import com.l2jbr.gameserver.model.actor.instance.L2RaidBossInstance; +import com.l2jbr.gameserver.model.database.RaidbossSpawnList; +import com.l2jbr.gameserver.model.database.repository.RaidBossSpawnListRepository; import com.l2jbr.gameserver.templates.L2NpcTemplate; import com.l2jbr.gameserver.templates.StatsSet; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import java.sql.Connection; -import java.sql.PreparedStatement; -import java.sql.ResultSet; -import java.sql.SQLException; import java.util.Calendar; import java.util.LinkedHashMap; import java.util.Map; @@ -46,8 +45,6 @@ /** * @author godson */ - - public class RaidBossSpawnManager { private static Logger _log = LoggerFactory.getLogger(RaidBossSpawnManager.class.getName()); @@ -83,51 +80,29 @@ private void init() { _spawns = new LinkedHashMap<>(); Connection con = null; - - try { - con = L2DatabaseFactory.getInstance().getConnection(); - - PreparedStatement statement = con.prepareStatement("SELECT * from raidboss_spawnlist ORDER BY boss_id"); - ResultSet rset = statement.executeQuery(); - - L2Spawn spawnDat; - L2NpcTemplate template; - long respawnTime; - while (rset.next()) { - template = getValidTemplate(rset.getInt("boss_id")); - if (template != null) { - spawnDat = new L2Spawn(template); - spawnDat.setLocx(rset.getInt("loc_x")); - spawnDat.setLocy(rset.getInt("loc_y")); - spawnDat.setLocz(rset.getInt("loc_z")); - spawnDat.setAmount(rset.getInt("amount")); - spawnDat.setHeading(rset.getInt("heading")); - spawnDat.setRespawnMinDelay(rset.getInt("respawn_min_delay")); - spawnDat.setRespawnMaxDelay(rset.getInt("respawn_max_delay")); - respawnTime = rset.getLong("respawn_time"); - - addNewSpawn(spawnDat, respawnTime, rset.getDouble("currentHP"), rset.getDouble("currentMP"), false); - } else { - _log.warn("RaidBossSpawnManager: Could not load raidboss #" + rset.getInt("boss_id") + " from DB"); + RaidBossSpawnListRepository repository = DatabaseAccess.getRepository(RaidBossSpawnListRepository.class); + repository.findAll().forEach(spawnList -> { + L2NpcTemplate template = getValidTemplate(spawnList.getBossId()); + if (template != null) { + try { + L2Spawn spawnDat = new L2Spawn(template);; + spawnDat.setLocx(spawnList.getLocX()); + spawnDat.setLocy(spawnList.getLocY()); + spawnDat.setLocz(spawnList.getLocZ()); + spawnDat.setAmount(spawnList.getAmount()); + spawnDat.setHeading(spawnList.getHeading()); + spawnDat.setRespawnMinDelay(spawnList.getRespawnMinDelay()); + spawnDat.setRespawnMaxDelay(spawnList.getRespawnMaxDelay()); + + addNewSpawn(spawnDat, spawnList.getRespawnTime(), spawnList.getCurrentHp(),spawnList.getCurrentMp(), false); + } catch (ClassNotFoundException | NoSuchMethodException e) { + _log.warn("RaidBossSpawnManager: Could not load raidboss #{} from DB", spawnList.getBossId()); + _log.error(e.getLocalizedMessage(), e); } + } else { + _log.warn("RaidBossSpawnManager: Could not load raidboss #{} from DB. Template not found", spawnList.getBossId()); } - - _log.info("RaidBossSpawnManager: Loaded " + _bosses.size() + " Instances"); - _log.info("RaidBossSpawnManager: Scheduled " + _schedules.size() + " Instances"); - - rset.close(); - statement.close(); - } catch (SQLException e) { - _log.warn("RaidBossSpawnManager: Couldnt load raidboss_spawnlist table"); - } catch (Exception e) { - e.printStackTrace(); - } finally { - try { - con.close(); - } catch (Exception e) { - e.printStackTrace(); - } - } + }); } private class spawnSchedule implements Runnable { @@ -254,31 +229,10 @@ public void addNewSpawn(L2Spawn spawnDat, long respawnTime, double currentHP, do _spawns.put(bossId, spawnDat); if (storeInDb) { - Connection con = null; - - try { - con = L2DatabaseFactory.getInstance().getConnection(); - PreparedStatement statement = con.prepareStatement("INSERT INTO raidboss_spawnlist (boss_id,amount,loc_x,loc_y,loc_z,heading,respawn_time,currentHp,currentMp) values(?,?,?,?,?,?,?,?,?)"); - statement.setInt(1, spawnDat.getNpcid()); - statement.setInt(2, spawnDat.getAmount()); - statement.setInt(3, spawnDat.getLocx()); - statement.setInt(4, spawnDat.getLocy()); - statement.setInt(5, spawnDat.getLocz()); - statement.setInt(6, spawnDat.getHeading()); - statement.setLong(7, respawnTime); - statement.setDouble(8, currentHP); - statement.setDouble(9, currentMP); - statement.execute(); - statement.close(); - } catch (Exception e) { - // problem with storing spawn - _log.warn("RaidBossSpawnManager: Could not store raidboss #" + bossId + " in the DB:" + e); - } finally { - try { - con.close(); - } catch (Exception e) { - } - } + RaidbossSpawnList spawnList = new RaidbossSpawnList(spawnDat.getNpcid(), spawnDat.getAmount(), + spawnDat.getLocx(), spawnDat.getLocy(), spawnDat.getLocz(), spawnDat.getHeading(), respawnTime, currentHP, currentMP); + RaidBossSpawnListRepository repository = DatabaseAccess.getRepository(RaidBossSpawnListRepository.class); + repository.save(spawnList); } } @@ -310,62 +264,29 @@ public void deleteSpawn(L2Spawn spawnDat, boolean updateDb) { } if (updateDb) { - Connection con = null; - - try { - con = L2DatabaseFactory.getInstance().getConnection(); - PreparedStatement statement = con.prepareStatement("DELETE FROM raidboss_spawnlist WHERE boss_id=?"); - statement.setInt(1, bossId); - statement.execute(); - statement.close(); - } catch (Exception e) { - // problem with deleting spawn - _log.warn("RaidBossSpawnManager: Could not remove raidboss #" + bossId + " from DB: " + e); - } finally { - try { - con.close(); - } catch (Exception e) { - } - } + RaidBossSpawnListRepository repository = DatabaseAccess.getRepository(RaidBossSpawnListRepository.class); + repository.deleteById(bossId); } } private void updateDb() { - for (Integer bossId : _storedInfo.keySet()) { - Connection con = null; + for (Map.Entry entry : _storedInfo.entrySet()) { - try { - con = L2DatabaseFactory.getInstance().getConnection(); + L2RaidBossInstance boss = _bosses.get(entry.getKey()); - L2RaidBossInstance boss = _bosses.get(bossId); + if (boss == null) { + continue; + } - if (boss == null) { - continue; - } + StatsSet info = entry.getValue(); - StatsSet info = _storedInfo.get(bossId); + if (info == null) { + continue; + } - if (info == null) { - continue; - } + RaidBossSpawnListRepository repository = DatabaseAccess.getRepository(RaidBossSpawnListRepository.class); + repository.updateById(entry.getKey(), info.getLong("respawnTime"), info.getDouble("currentHP"), info.getDouble("currentMP")); - PreparedStatement statement = con.prepareStatement("UPDATE raidboss_spawnlist set respawn_time = ?, currentHP = ?, currentMP = ? where boss_id = ?"); - statement.setLong(1, info.getLong("respawnTime")); - statement.setDouble(2, info.getDouble("currentHP")); - statement.setDouble(3, info.getDouble("currentMP")); - statement.setInt(4, bossId); - statement.execute(); - - statement.close(); - } catch (SQLException e) { - _log.warn("RaidBossSpawnManager: Couldnt update raidboss_spawnlist table"); - } finally { - try { - con.close(); - } catch (Exception e) { - e.printStackTrace(); - } - } } } diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/RaidbossSpawnList.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/RaidbossSpawnList.java index 1706ca82..1221b4b2 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/RaidbossSpawnList.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/RaidbossSpawnList.java @@ -1,17 +1,88 @@ package com.l2jbr.gameserver.model.database; +import com.l2jbr.commons.database.annotation.Column; +import com.l2jbr.commons.database.annotation.Table; +import org.springframework.data.annotation.Id; - +@Table("raidboss_spawnlist") public class RaidbossSpawnList { - private int boss_id; + + @Id + @Column("boss_id") + private int bossId; private int amount; - private int loc_x; - private int loc_y; - private int loc_z; + @Column("loc_x") + private int locX; + @Column("loc_y") + private int locY; + @Column("loc_z") + private int locZ; private int heading; - private int respawn_min_delay; - private int respawn_max_delay; - private int respawn_time; - private int currentHp; - private int currentMp; + @Column("respawn_min_delay") + private int respawnMinDelay; + @Column("respawn_max_delay") + private int respawnMaxDelay; + @Column("respawn_time") + private long respawnTime; + private double currentHp; + private double currentMp; + + public RaidbossSpawnList() { + } + + public RaidbossSpawnList(int npcid, int amount, int locx, int locy, int locz, int heading, long respawnTime, double hp, double mp) { + this.bossId = npcid; + this.amount = amount; + this.locX = locx; + this.locY = locy; + this.locZ = locz; + this.heading = heading; + this.respawnTime = respawnTime; + this.currentHp = hp; + this.currentMp = mp; + } + + public int getBossId() { + return bossId; + } + + public int getAmount() { + return amount; + } + + public int getLocX() { + return locX; + } + + public int getLocY() { + return locY; + } + + public int getLocZ() { + return locZ; + } + + public int getHeading() { + return heading; + } + + public int getRespawnMinDelay() { + return respawnMinDelay; + } + + public int getRespawnMaxDelay() { + return respawnMaxDelay; + } + + public long getRespawnTime() { + return respawnTime; + } + + public double getCurrentHp() { + return currentHp; + } + + public double getCurrentMp() { + return currentMp; + } } diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/repository/RaidBossSpawnListRepository.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/repository/RaidBossSpawnListRepository.java new file mode 100644 index 00000000..4da70d8b --- /dev/null +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/repository/RaidBossSpawnListRepository.java @@ -0,0 +1,14 @@ +package com.l2jbr.gameserver.model.database.repository; + +import com.l2jbr.gameserver.model.database.RaidbossSpawnList; +import org.springframework.data.jdbc.repository.query.Modifying; +import org.springframework.data.jdbc.repository.query.Query; +import org.springframework.data.repository.CrudRepository; +import org.springframework.data.repository.query.Param; + +public interface RaidBossSpawnListRepository extends CrudRepository { + + @Modifying + @Query("UPDATE raidboss_spawnlist set respawn_time=:respawn, currentHP=:hp, currentMP=:mp where boss_id=:boss") + int updateById(@Param("boss") Integer bossId, @Param("respawn") long respawnTime, @Param("hp") double hp, @Param("mp") double mp); +} From 82b92a54f3b6ea29f085a4d62148aa7785028f65 Mon Sep 17 00:00:00 2001 From: Alisson Oliveira Date: Sat, 5 May 2018 18:05:59 -0300 Subject: [PATCH 082/236] =?UTF-8?q?Remove=20refer=C3=AAncias=20diretas=20a?= =?UTF-8?q?=20tabelas=20random=5Fspawn=20e=20random=5Fspawn=5Floc?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../gameserver/model/AutoSpawnHandler.java | 85 +++++-------------- .../model/database/RandomSpawn.java | 44 ++++++++++ .../model/database/RandomSpawnLoc.java | 25 +++++- .../repository/RandomSpawnRepository.java | 7 ++ 4 files changed, 94 insertions(+), 67 deletions(-) create mode 100644 Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/repository/RandomSpawnRepository.java diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/AutoSpawnHandler.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/AutoSpawnHandler.java index 83da9238..a6391faa 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/AutoSpawnHandler.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/AutoSpawnHandler.java @@ -18,7 +18,7 @@ package com.l2jbr.gameserver.model; import com.l2jbr.commons.Config; -import com.l2jbr.commons.database.L2DatabaseFactory; +import com.l2jbr.commons.database.DatabaseAccess; import com.l2jbr.commons.util.Rnd; import com.l2jbr.gameserver.Announcements; import com.l2jbr.gameserver.ThreadPoolManager; @@ -27,12 +27,12 @@ import com.l2jbr.gameserver.datatables.SpawnTable; import com.l2jbr.gameserver.idfactory.IdFactory; import com.l2jbr.gameserver.model.actor.instance.L2NpcInstance; +import com.l2jbr.gameserver.model.database.RandomSpawn; +import com.l2jbr.gameserver.model.database.repository.RandomSpawnRepository; import com.l2jbr.gameserver.templates.L2NpcTemplate; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import java.sql.PreparedStatement; -import java.sql.ResultSet; import java.util.LinkedHashMap; import java.util.LinkedList; import java.util.List; @@ -83,59 +83,22 @@ public final int size() { } private void restoreSpawnData() { - int numLoaded = 0; - java.sql.Connection con = null; - - try { - PreparedStatement statement = null; - PreparedStatement statement2 = null; - ResultSet rs = null; - ResultSet rs2 = null; - - con = L2DatabaseFactory.getInstance().getConnection(); - - // Restore spawn group data, then the location data. - statement = con.prepareStatement("SELECT * FROM random_spawn ORDER BY groupId ASC"); - rs = statement.executeQuery(); - - while (rs.next()) { - // Register random spawn group, set various options on the - // created spawn instance. - AutoSpawnInstance spawnInst = registerSpawn(rs.getInt("npcId"), rs.getInt("initialDelay"), rs.getInt("respawnDelay"), rs.getInt("despawnDelay")); - - spawnInst.setSpawnCount(rs.getInt("count")); - spawnInst.setBroadcast(rs.getBoolean("broadcastSpawn")); - spawnInst.setRandomSpawn(rs.getBoolean("randomSpawn")); - numLoaded++; - - // Restore the spawn locations for this spawn group/instance. - statement2 = con.prepareStatement("SELECT * FROM random_spawn_loc WHERE groupId=?"); - statement2.setInt(1, rs.getInt("groupId")); - rs2 = statement2.executeQuery(); - - while (rs2.next()) { - // Add each location to the spawn group/instance. - spawnInst.addSpawnLocation(rs2.getInt("x"), rs2.getInt("y"), rs2.getInt("z"), rs2.getInt("heading")); - } - - statement2.close(); - } - - statement.close(); - - if (Config.DEBUG) { - _log.info("AutoSpawnHandler: Loaded " + numLoaded + " spawn group(s) from the database."); - } - } catch (Exception e) { - _log.warn("AutoSpawnHandler: Could not restore spawn data: " + e); - } finally { - try { - con.close(); - } catch (Exception e) { - } - } + RandomSpawnRepository repository = DatabaseAccess.getRepository(RandomSpawnRepository.class); + repository.findAll().forEach(spawn -> { + AutoSpawnInstance spawnInst = registerSpawn(spawn); + + spawnInst.setSpawnCount(spawn.getCount()); + spawnInst.setBroadcast(Boolean.valueOf(spawn.getBroadcastSpawn())); + spawnInst.setRandomSpawn(Boolean.valueOf(spawn.getRandomSpawn())); + + spawn.getLocs().forEach(loc -> { + spawnInst.addSpawnLocation(loc.getX(), loc.getY(), loc.getZ(), loc.getHeading()); + }); + }); + _log.info("AutoSpawnHandler: Loaded {} spawn group(s) from the database.", size()); } + /** * Registers a spawn with the given parameters with the spawner, and marks it as active. Returns a AutoSpawnInstance containing info about the spawn. * @@ -180,18 +143,8 @@ public AutoSpawnInstance registerSpawn(int npcId, int[][] spawnPoints, int initi return newSpawn; } - /** - * Registers a spawn with the given parameters with the spawner, and marks it as active. Returns a AutoSpawnInstance containing info about the spawn.
    - * Warning: Spawn locations must be specified separately using addSpawnLocation(). - * - * @param npcId - * @param initialDelay If < 0 = default value - * @param respawnDelay If < 0 = default value - * @param despawnDelay If < 0 = default value - * @return AutoSpawnInstance spawnInst - */ - public AutoSpawnInstance registerSpawn(int npcId, int initialDelay, int respawnDelay, int despawnDelay) { - return registerSpawn(npcId, null, initialDelay, respawnDelay, despawnDelay); + private AutoSpawnInstance registerSpawn(RandomSpawn spawn) { + return registerSpawn(spawn.getNpcId(), null, spawn.getInitialDelay(), spawn.getRespawnDelay(), spawn.getDespawnDelay()); } /** diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/RandomSpawn.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/RandomSpawn.java index 75ea9d0a..ca25f305 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/RandomSpawn.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/RandomSpawn.java @@ -1,9 +1,15 @@ package com.l2jbr.gameserver.model.database; +import com.l2jbr.commons.database.annotation.Column; +import com.l2jbr.commons.database.annotation.Table; +import org.springframework.data.annotation.Id; +import java.util.Set; +@Table("random_spawn") public class RandomSpawn { + @Id private int groupId; private int npcId; private int count; @@ -12,4 +18,42 @@ public class RandomSpawn { private int despawnDelay; private String broadcastSpawn; private String randomSpawn; + @Column("groupId") + private Set locs; + + public int getGroupId() { + return groupId; + } + + public int getNpcId() { + return npcId; + } + + public int getCount() { + return count; + } + + public int getInitialDelay() { + return initialDelay; + } + + public int getRespawnDelay() { + return respawnDelay; + } + + public int getDespawnDelay() { + return despawnDelay; + } + + public String getBroadcastSpawn() { + return broadcastSpawn; + } + + public String getRandomSpawn() { + return randomSpawn; + } + + public Set getLocs() { + return locs; + } } diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/RandomSpawnLoc.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/RandomSpawnLoc.java index 593cd517..361c6f6b 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/RandomSpawnLoc.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/RandomSpawnLoc.java @@ -1,12 +1,35 @@ package com.l2jbr.gameserver.model.database; +import com.l2jbr.commons.database.annotation.Table; +import org.springframework.data.annotation.Id; - +@Table("random_spawn_loc") public class RandomSpawnLoc { + @Id private int groupId; private int x; private int y; private int z; private int heading; + + public int getGroupId() { + return groupId; + } + + public int getX() { + return x; + } + + public int getY() { + return y; + } + + public int getZ() { + return z; + } + + public int getHeading() { + return heading; + } } diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/repository/RandomSpawnRepository.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/repository/RandomSpawnRepository.java new file mode 100644 index 00000000..80ec3e7e --- /dev/null +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/repository/RandomSpawnRepository.java @@ -0,0 +1,7 @@ +package com.l2jbr.gameserver.model.database.repository; + +import com.l2jbr.gameserver.model.database.RandomSpawn; +import org.springframework.data.repository.CrudRepository; + +public interface RandomSpawnRepository extends CrudRepository { +} From d86f861ce58d0bcc081d7f4530d7a2990aca27a0 Mon Sep 17 00:00:00 2001 From: Alisson Oliveira Date: Sat, 5 May 2018 19:54:30 -0300 Subject: [PATCH 083/236] =?UTF-8?q?Remove=20refer=C3=AAncias=20diretas=20?= =?UTF-8?q?=C3=A0=20tabela=20seven=5Fsigns?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../commons/database/DatabaseAccess.java | 6 +- .../commons/database/L2DatabaseFactory.java | 5 - .../com/l2jbr/gameserver/SevenSigns.java | 94 ++++++------------- .../gameserver/model/database/SevenSigns.java | 65 +++++++++++-- .../repository/SevenSignsRepository.java | 17 ++++ .../gameserver/network/L2GameClient.java | 6 +- 6 files changed, 113 insertions(+), 80 deletions(-) create mode 100644 Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/repository/SevenSignsRepository.java diff --git a/Commons/src/main/com.l2jbr.commons/com/l2jbr/commons/database/DatabaseAccess.java b/Commons/src/main/com.l2jbr.commons/com/l2jbr/commons/database/DatabaseAccess.java index 406b1bfc..d7bf8e95 100644 --- a/Commons/src/main/com.l2jbr.commons/com/l2jbr/commons/database/DatabaseAccess.java +++ b/Commons/src/main/com.l2jbr.commons/com/l2jbr/commons/database/DatabaseAccess.java @@ -1,5 +1,7 @@ package com.l2jbr.commons.database; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.springframework.data.repository.CrudRepository; import java.sql.SQLException; @@ -8,6 +10,8 @@ public class DatabaseAccess { + private static Logger logger = LoggerFactory.getLogger(DatabaseAccess.class); + private static Map objects = new WeakHashMap<>(); public static T getRepository(Class repositoryClass) { @@ -19,7 +23,7 @@ public static T getRepository(Class repositoryClas repository = L2DatabaseFactory.getInstance().getRepository(repositoryClass); objects.put(repositoryClass, repository); } catch (SQLException e) { - + logger.error("Error accessing Database", e); } return repository; } diff --git a/Commons/src/main/com.l2jbr.commons/com/l2jbr/commons/database/L2DatabaseFactory.java b/Commons/src/main/com.l2jbr.commons/com/l2jbr/commons/database/L2DatabaseFactory.java index 7f793f98..c15c53ee 100644 --- a/Commons/src/main/com.l2jbr.commons/com/l2jbr/commons/database/L2DatabaseFactory.java +++ b/Commons/src/main/com.l2jbr.commons/com/l2jbr/commons/database/L2DatabaseFactory.java @@ -18,7 +18,6 @@ */ package com.l2jbr.commons.database; -import com.l2jbr.commons.Config; import com.zaxxer.hikari.HikariDataSource; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -27,7 +26,6 @@ import java.sql.Connection; import java.sql.SQLException; -import java.util.Optional; public class L2DatabaseFactory { @@ -44,9 +42,6 @@ public L2DatabaseFactory() throws SQLException { try { _dataSource.getConnection().close(); } catch (SQLException e) { - if (Config.DEBUG) { - _log.error("Database Connection FAILED"); - } _log.error(e.getMessage(), e); } } diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/SevenSigns.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/SevenSigns.java index d9e8742b..e951e59e 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/SevenSigns.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/SevenSigns.java @@ -18,6 +18,7 @@ package com.l2jbr.gameserver; import com.l2jbr.commons.Config; +import com.l2jbr.commons.database.DatabaseAccess; import com.l2jbr.commons.database.L2DatabaseFactory; import com.l2jbr.gameserver.datatables.MapRegionTable; import com.l2jbr.gameserver.instancemanager.CastleManager; @@ -26,6 +27,7 @@ import com.l2jbr.gameserver.model.AutoSpawnHandler.AutoSpawnInstance; import com.l2jbr.gameserver.model.L2World; import com.l2jbr.gameserver.model.actor.instance.L2PcInstance; +import com.l2jbr.gameserver.model.database.repository.SevenSignsRepository; import com.l2jbr.gameserver.network.SystemMessageId; import com.l2jbr.gameserver.serverpackets.SignsSky; import com.l2jbr.gameserver.serverpackets.SystemMessage; @@ -616,32 +618,26 @@ public int getPlayerCabal(L2PcInstance player) { } } - /** - * Restores all Seven Signs data and settings, usually called at server startup. - */ protected void restoreSevenSignsData() { - try (Connection con = L2DatabaseFactory.getInstance().getConnection(); - PreparedStatement ps1 = con.prepareStatement("SELECT char_obj_id, cabal, seal, red_stones, green_stones, blue_stones, " + "ancient_adena_amount, contribution_score FROM seven_signs"); - ResultSet rs1 = ps1.executeQuery()) { - while (rs1.next()) { - int charObjId = rs1.getInt("char_obj_id"); - - StatsSet sevenDat = new StatsSet(); - sevenDat.set("char_obj_id", charObjId); - sevenDat.set("cabal", rs1.getString("cabal")); - sevenDat.set("seal", rs1.getInt("seal")); - sevenDat.set("red_stones", rs1.getInt("red_stones")); - sevenDat.set("green_stones", rs1.getInt("green_stones")); - sevenDat.set("blue_stones", rs1.getInt("blue_stones")); - sevenDat.set("ancient_adena_amount", rs1.getDouble("ancient_adena_amount")); - sevenDat.set("contribution_score", rs1.getDouble("contribution_score")); - - if (Config.DEBUG) { - _log.info("SevenSigns: Loaded data from DB for char ID " + charObjId + " (" + sevenDat.getString("cabal") + ")"); - } + SevenSignsRepository repository = DatabaseAccess.getRepository(SevenSignsRepository.class); + repository.findAll().forEach(sevenSigns -> { + int charObjId = sevenSigns.getId(); + + StatsSet sevenDat = new StatsSet(); + sevenDat.set("char_obj_id", charObjId); + sevenDat.set("cabal", sevenSigns.getCabal()); + sevenDat.set("seal", sevenSigns.getSeal()); + sevenDat.set("red_stones", sevenSigns.getRedStones()); + sevenDat.set("green_stones", sevenSigns.getGreenStones()); + sevenDat.set("blue_stones", sevenSigns.getBlueStones()); + sevenDat.set("ancient_adena_amount", sevenSigns.getAncientAdenaAmount()); + sevenDat.set("contribution_score", sevenSigns.getContributionScore()); + + _log.info("SevenSigns: Loaded data from DB for char ID {} ({})", charObjId, sevenDat.getString("cabal")); - _signsPlayerData.put(charObjId, sevenDat); - } + _signsPlayerData.put(charObjId, sevenDat); + }); + try (Connection con = L2DatabaseFactory.getInstance().getConnection()) { try (PreparedStatement ps2 = con.prepareStatement("SELECT * FROM seven_signs_status WHERE id=0"); ResultSet rs2 = ps2.executeQuery()) { @@ -694,7 +690,7 @@ public void saveSevenSignsData(L2PcInstance player, boolean updateSettings) { } try { - con = L2DatabaseFactory.getInstance().getConnection(); + SevenSignsRepository repository = DatabaseAccess.getRepository(SevenSignsRepository.class); for (StatsSet sevenDat : _signsPlayerData.values()) { if (player != null) { @@ -703,22 +699,11 @@ public void saveSevenSignsData(L2PcInstance player, boolean updateSettings) { } } - statement = con.prepareStatement("UPDATE seven_signs SET cabal=?, seal=?, red_stones=?, " + "green_stones=?, blue_stones=?, " + "ancient_adena_amount=?, contribution_score=? " + "WHERE char_obj_id=?"); - statement.setString(1, sevenDat.getString("cabal")); - statement.setInt(2, sevenDat.getInteger("seal")); - statement.setInt(3, sevenDat.getInteger("red_stones")); - statement.setInt(4, sevenDat.getInteger("green_stones")); - statement.setInt(5, sevenDat.getInteger("blue_stones")); - statement.setDouble(6, sevenDat.getDouble("ancient_adena_amount")); - statement.setDouble(7, sevenDat.getDouble("contribution_score")); - statement.setInt(8, sevenDat.getInteger("char_obj_id")); - statement.execute(); - - statement.close(); + repository.updateContribution(sevenDat.getInteger("char_obj_id"), sevenDat.getString("cabal"), sevenDat.getInteger("seal"), + sevenDat.getInteger("red_stones"), sevenDat.getInteger("green_stones"), sevenDat.getInteger("blue_stones"), + sevenDat.getDouble("ancient_adena_amount"), sevenDat.getDouble("contribution_score")); - if (Config.DEBUG) { - _log.info("SevenSigns: Updated data in database for char ID " + sevenDat.getInteger("char_obj_id") + " (" + sevenDat.getString("cabal") + ")"); - } + _log.debug("SevenSigns: Updated data in database for char ID {} ()", sevenDat.getInteger("char_obj_id"), sevenDat.getString("cabal")); } if (updateSettings) { @@ -730,6 +715,8 @@ public void saveSevenSignsData(L2PcInstance player, boolean updateSettings) { sqlQuery += "date=? WHERE id=0"; + con = L2DatabaseFactory.getInstance().getConnection(); + statement = con.prepareStatement(sqlQuery); statement.setInt(1, _currentCycle); statement.setInt(2, _activePeriod); @@ -842,30 +829,11 @@ public int setPlayerInfo(L2PcInstance player, int chosenCabal, int chosenSeal) { _signsPlayerData.put(charObjId, currPlayerData); - // Update data in database, as we have a new player signing up. - try { - con = L2DatabaseFactory.getInstance().getConnection(); - statement = con.prepareStatement("INSERT INTO seven_signs (char_obj_id, cabal, seal) VALUES (?,?,?)"); - statement.setInt(1, charObjId); - statement.setString(2, getCabalShortName(chosenCabal)); - statement.setInt(3, chosenSeal); - statement.execute(); - - statement.close(); - con.close(); + com.l2jbr.gameserver.model.database.SevenSigns sevenSigns = new com.l2jbr.gameserver.model.database.SevenSigns(charObjId, getCabalShortName(chosenCabal), chosenSeal); + SevenSignsRepository repository = DatabaseAccess.getRepository(SevenSignsRepository.class); + repository.save(sevenSigns); - if (Config.DEBUG) { - _log.info("SevenSigns: Inserted data in DB for char ID " + currPlayerData.getInteger("char_obj_id") + " (" + currPlayerData.getString("cabal") + ")"); - } - } catch (SQLException e) { - _log.error("SevenSigns: Failed to save data: " + e); - } finally { - try { - statement.close(); - con.close(); - } catch (Exception e) { - } - } + _log.debug("SevenSigns: Inserted data in DB for char ID {} ()", currPlayerData.getInteger("char_obj_id"), currPlayerData.getString("cabal")); } // Increasing Seal total score for the player chosen Seal. diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/SevenSigns.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/SevenSigns.java index 7c26296c..aef67eae 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/SevenSigns.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/SevenSigns.java @@ -1,14 +1,65 @@ package com.l2jbr.gameserver.model.database; +import com.l2jbr.commons.database.annotation.Column; +import com.l2jbr.commons.database.annotation.Table; +import com.l2jbr.commons.database.model.Entity; +import org.springframework.data.annotation.Id; +@Table("seven_signs") +public class SevenSigns extends Entity { -public class SevenSigns { - private int char_obj_id; + @Id + @Column("char_obj_id") + private int charObjId; private String cabal; private int seal; - private int red_stones; - private int green_stones; - private int blue_stones; - private long ancient_adena_amount; - private long contribution_score; + @Column("red_stones") + private int redStones; + @Column("green_stones") + private int greenStones; + @Column("blue_stones") + private int blueStones; + @Column("ancient_adena_amount") + private long ancientAdenaAmount; + @Column("contribution_score") + private long contributionScore; + + public SevenSigns(int charObjId, String cabal, int seal) { + this.charObjId = charObjId; + this.cabal = cabal; + this.seal = seal; + } + + @Override + public Integer getId() { + return charObjId; + } + + public String getCabal() { + return cabal; + } + + public int getSeal() { + return seal; + } + + public int getRedStones() { + return redStones; + } + + public int getGreenStones() { + return greenStones; + } + + public int getBlueStones() { + return blueStones; + } + + public long getAncientAdenaAmount() { + return ancientAdenaAmount; + } + + public long getContributionScore() { + return contributionScore; + } } diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/repository/SevenSignsRepository.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/repository/SevenSignsRepository.java new file mode 100644 index 00000000..53f830b8 --- /dev/null +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/repository/SevenSignsRepository.java @@ -0,0 +1,17 @@ +package com.l2jbr.gameserver.model.database.repository; + +import com.l2jbr.gameserver.model.database.SevenSigns; +import org.springframework.data.jdbc.repository.query.Modifying; +import org.springframework.data.jdbc.repository.query.Query; +import org.springframework.data.repository.CrudRepository; +import org.springframework.data.repository.query.Param; + +public interface SevenSignsRepository extends CrudRepository { + + @Modifying + @Query("UPDATE seven_signs SET cabal=:cabal, seal=:seal, red_stones=:red, green_stones=:green, blue_stones=:blue, " + + "ancient_adena_amount=:ancientAdena, contribution_score=:score WHERE char_obj_id=:char") + int updateContribution(@Param("char") int charObjId, @Param("cabal") String cabal, @Param("seal") int seal, @Param("red") int redStones, + @Param("green") int greenStones, @Param("blue") int blueStones, @Param("ancientAdena") double ancientAdenaAmount, + @Param("score") double contributionScore); +} diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/network/L2GameClient.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/network/L2GameClient.java index 8d0e088c..8ebc9110 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/network/L2GameClient.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/network/L2GameClient.java @@ -279,10 +279,8 @@ public static void deleteCharByObjId(int objId) { OlympiadNoblesRepository noblesRepository = DatabaseAccess.getRepository(OlympiadNoblesRepository.class); noblesRepository.deleteById(objId); - statement = con.prepareStatement("DELETE FROM seven_signs WHERE char_obj_id=?"); - statement.setInt(1, objId); - statement.execute(); - statement.close(); + SevenSignsRepository sevenSignsRepository = DatabaseAccess.getRepository(SevenSignsRepository.class); + sevenSignsRepository.deleteById(objId); statement = con.prepareStatement("DELETE FROM pets WHERE item_obj_id IN (SELECT object_id FROM items WHERE items.owner_id=?)"); statement.setInt(1, objId); From 8c54ad44b5d2fcc30e44d09405743ebe3f1ee308 Mon Sep 17 00:00:00 2001 From: Alisson Oliveira Date: Sat, 5 May 2018 21:10:31 -0300 Subject: [PATCH 084/236] =?UTF-8?q?Remove=20refer=C3=AAncias=20diretas=20?= =?UTF-8?q?=C3=A0=20tabela=20seven=5Fsigns=5Ffestival?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../l2jbr/gameserver/SevenSignsFestival.java | 139 +++++++----------- .../model/database/SevenSignsFestival.java | 43 +++++- .../SevenSignsFestivalRepository.java | 16 ++ 3 files changed, 113 insertions(+), 85 deletions(-) create mode 100644 Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/repository/SevenSignsFestivalRepository.java diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/SevenSignsFestival.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/SevenSignsFestival.java index d27ba5d2..aa32236f 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/SevenSignsFestival.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/SevenSignsFestival.java @@ -32,6 +32,7 @@ import com.l2jbr.gameserver.model.actor.instance.L2PcInstance; import com.l2jbr.gameserver.model.base.Experience; import com.l2jbr.gameserver.model.database.repository.CharacterRepository; +import com.l2jbr.gameserver.model.database.repository.SevenSignsFestivalRepository; import com.l2jbr.gameserver.network.SystemMessageId; import com.l2jbr.gameserver.serverpackets.CreatureSay; import com.l2jbr.gameserver.serverpackets.MagicSkillUser; @@ -3302,47 +3303,40 @@ protected void startFestivalManager() { _log.info("SevenSignsFestival: The first Festival of Darkness cycle begins in " + (Config.ALT_FESTIVAL_MANAGER_START / 60000) + " minute(s)."); } - /** - * Restores saved festival data, basic settings from the properties file and past high score data from the database. - */ protected void restoreFestivalData() { - if (Config.DEBUG) { - _log.info("SevenSignsFestival: Restoring festival data. Current SS Cycle: " + _signsCycle); - } - - try (Connection con = L2DatabaseFactory.getInstance().getConnection(); - PreparedStatement statement = con.prepareStatement("SELECT festivalId, cabal, cycle, date, score, members " + "FROM seven_signs_festival"); - ResultSet rset = statement.executeQuery()) { - while (rset.next()) { - int festivalCycle = rset.getInt("cycle"); - int festivalId = rset.getInt("festivalId"); - String cabal = rset.getString("cabal"); - - StatsSet festivalDat = new StatsSet(); - festivalDat.set("festivalId", festivalId); - festivalDat.set("cabal", cabal); - festivalDat.set("cycle", festivalCycle); - festivalDat.set("date", rset.getString("date")); - festivalDat.set("score", rset.getInt("score")); - festivalDat.set("members", rset.getString("members")); - - if (Config.DEBUG) { - _log.info("SevenSignsFestival: Loaded data from DB for (Cycle = " + festivalCycle + ", Oracle = " + cabal + ", Festival = " + getFestivalName(festivalId)); - } + _log.debug("SevenSignsFestival: Restoring festival data. Current SS Cycle: {}", _signsCycle); + + SevenSignsFestivalRepository repository = DatabaseAccess.getRepository(SevenSignsFestivalRepository.class); + repository.findAll().forEach(festival -> { + int festivalCycle = festival.getCycle(); + int festivalId = festival.getFestivalId(); + String cabal = festival.getCabal(); + + StatsSet festivalDat = new StatsSet(); + festivalDat.set("festivalId", festivalId); + festivalDat.set("cabal", cabal); + festivalDat.set("cycle", festivalCycle); + festivalDat.set("date", festival.getDate()); + festivalDat.set("score", festival.getScore()); + festivalDat.set("members", festival.getMembers()); + + _log.info("SevenSignsFestival: Loaded data from DB for (Cycle = {}, Oracle = {}, Festival = {})", festivalCycle, cabal, getFestivalName(festivalId)); + + if (cabal.equals("dawn")) { + festivalId += FESTIVAL_COUNT; + } - if (cabal.equals("dawn")) { - festivalId += FESTIVAL_COUNT; - } + Map tempData = _festivalData.get(festivalCycle); - Map tempData = _festivalData.get(festivalCycle); + if (tempData == null) { + tempData = new LinkedHashMap<>(); + } - if (tempData == null) { - tempData = new LinkedHashMap<>(); - } + tempData.put(festivalId, festivalDat); + _festivalData.put(festivalCycle, tempData); + }); - tempData.put(festivalId, festivalDat); - _festivalData.put(festivalCycle, tempData); - } + try (Connection con = L2DatabaseFactory.getInstance().getConnection()) { String query = "SELECT festival_cycle, "; @@ -3370,64 +3364,43 @@ protected void restoreFestivalData() { } /** - * Stores current festival data, basic settings to the properties file and past high score data to the database. If updateSettings = true, then all Seven Signs data is updated in the database. + * Stores current festival data, basic settings to the properties file and past high score data to the database. + * If updateSettings = true, then all Seven Signs data is updated in the database. * * @param updateSettings */ public void saveFestivalData(boolean updateSettings) { - if (Config.DEBUG) { - System.out.println("SevenSignsFestival: Saving festival data to disk."); - } + _log.debug("SevenSignsFestival: Saving festival data."); - try (Connection con = L2DatabaseFactory.getInstance().getConnection(); - PreparedStatement statement = con.prepareStatement("UPDATE seven_signs_festival SET date=?, score=?, members=? WHERE cycle=? AND cabal=? AND festivalId=?")) { - for (Map currCycleData : _festivalData.values()) { - for (StatsSet festivalDat : currCycleData.values()) { - int festivalCycle = festivalDat.getInteger("cycle"); - int festivalId = festivalDat.getInteger("festivalId"); - String cabal = festivalDat.getString("cabal"); - - // Try to update an existing record. - statement.setLong(1, Long.valueOf(festivalDat.getString("date"))); - statement.setInt(2, festivalDat.getInteger("score")); - statement.setString(3, festivalDat.getString("members")); - statement.setInt(4, festivalCycle); - statement.setString(5, cabal); - statement.setInt(6, festivalId); - - // If there was no record to update, assume it doesn't exist and add a new one, - // otherwise continue with the next record to store. - if (statement.executeUpdate() > 0) { - if (Config.DEBUG) { - _log.info("SevenSignsFestival: Updated data in DB (Cycle = " + festivalCycle + ", Cabal = " + cabal + ", FestID = " + festivalId + ")"); - } + SevenSignsFestivalRepository repository = DatabaseAccess.getRepository(SevenSignsFestivalRepository.class); - statement.clearParameters(); - continue; - } + for (Map currCycleData : _festivalData.values()) { + for (StatsSet festivalDat : currCycleData.values()) { - try (PreparedStatement ps2 = con.prepareStatement("INSERT INTO seven_signs_festival (festivalId, cabal, cycle, date, score, members) VALUES (?,?,?,?,?,?)")) { - ps2.setInt(1, festivalId); - ps2.setString(2, cabal); - ps2.setInt(3, festivalCycle); - ps2.setLong(4, Long.valueOf(festivalDat.getString("date"))); - ps2.setInt(5, festivalDat.getInteger("score")); - ps2.setString(6, festivalDat.getString("members")); - ps2.execute(); - } + int festivalCycle = festivalDat.getInteger("cycle"); + int festivalId = festivalDat.getInteger("festivalId"); + String cabal = festivalDat.getString("cabal"); - if (Config.DEBUG) { - _log.info("SevenSignsFestival: Inserted data in DB (Cycle = " + festivalCycle + ", Cabal = " + cabal + ", FestID = " + festivalId + ")"); - } + int updated = repository.updateByCycleAndCabal(festivalId, festivalCycle, cabal, Long.valueOf(festivalDat.getString("date")), + festivalDat.getInteger("score"), festivalDat.getString("members")); + + + if (updated > 0) { + _log.info("SevenSignsFestival: Updated data in DB (Cycle = {}, Cabal = {}, FestivalId = {}", festivalCycle, cabal, festivalId); + continue; } - } - // Updates Seven Signs DB data also, so call only if really necessary. - if (updateSettings) { - SevenSigns.getInstance().saveSevenSignsData(null, true); + com.l2jbr.gameserver.model.database.SevenSignsFestival festival = new com.l2jbr.gameserver.model.database.SevenSignsFestival( + festivalId, cabal, festivalCycle, Long.valueOf(festivalDat.getString("date")), festivalDat.getInteger("score"), festivalDat.getString("members")); + repository.save(festival); + + _log.debug("SevenSignsFestival: Inserted data in DB (Cycle = {}, Cabal = {}, FestivalId = {})", festivalCycle, cabal, festivalId); } - } catch (SQLException e) { - _log.error("SevenSignsFestival: Failed to save configuration: " + e); + } + + // Updates Seven Signs DB data also, so call only if really necessary. + if (updateSettings) { + SevenSigns.getInstance().saveSevenSignsData(null, true); } } diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/SevenSignsFestival.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/SevenSignsFestival.java index 7b58f4bf..e0fe3e43 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/SevenSignsFestival.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/SevenSignsFestival.java @@ -1,12 +1,51 @@ package com.l2jbr.gameserver.model.database; +import com.l2jbr.commons.database.annotation.Table; +import org.springframework.data.annotation.Id; - +@Table("seven_signs_festival") public class SevenSignsFestival { + + @Id private int festivalId; private String cabal; private int cycle; - private int date; + private long date; private int score; private String members; + + public SevenSignsFestival() { } + + public SevenSignsFestival(int festivalId, String cabal, int cycle, long date, int score, String members) { + this.festivalId = festivalId; + this.cabal = cabal; + this.cycle = cycle; + this.date = date; + this.score = score; + this.members = members; + } + + public int getFestivalId() { + return festivalId; + } + + public String getCabal() { + return cabal; + } + + public int getCycle() { + return cycle; + } + + public long getDate() { + return date; + } + + public int getScore() { + return score; + } + + public String getMembers() { + return members; + } } diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/repository/SevenSignsFestivalRepository.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/repository/SevenSignsFestivalRepository.java new file mode 100644 index 00000000..9d4d641e --- /dev/null +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/repository/SevenSignsFestivalRepository.java @@ -0,0 +1,16 @@ +package com.l2jbr.gameserver.model.database.repository; + +import com.l2jbr.gameserver.model.database.SevenSignsFestival; +import org.springframework.data.jdbc.repository.query.Modifying; +import org.springframework.data.jdbc.repository.query.Query; +import org.springframework.data.repository.CrudRepository; +import org.springframework.data.repository.query.Param; + +public interface SevenSignsFestivalRepository extends CrudRepository { + + @Modifying + @Query("UPDATE seven_signs_festival SET date=:date, score=:score, members=:members WHERE cycle=:cycle AND cabal=:cabal " + + "AND festivalId=:festival") + int updateByCycleAndCabal(@Param("festival") int festivalId, @Param("cycle") int cycle, @Param("cabal") String cabal, + @Param("date") long date, @Param("score") int score, @Param("members") String members); +} \ No newline at end of file From 55ec6f1cb756d74326c4e3e328198991d6529ed5 Mon Sep 17 00:00:00 2001 From: Alisson Oliveira Date: Sat, 5 May 2018 22:14:37 -0300 Subject: [PATCH 085/236] =?UTF-8?q?Remove=20refer=C3=AAncias=20diretas=20?= =?UTF-8?q?=C3=A0=20tabela=20seven=5Fsigns=5Fstatus?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/l2jbr/gameserver/SevenSigns.java | 161 ++++++----------- .../l2jbr/gameserver/SevenSignsFestival.java | 42 ++--- .../model/database/SevenSignsFestival.java | 6 +- .../model/database/SevenSignsStatus.java | 168 +++++++++++++++--- .../SevenSignsStatusRepository.java | 29 +++ 5 files changed, 240 insertions(+), 166 deletions(-) create mode 100644 Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/repository/SevenSignsStatusRepository.java diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/SevenSigns.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/SevenSigns.java index e951e59e..b95337aa 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/SevenSigns.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/SevenSigns.java @@ -19,7 +19,6 @@ import com.l2jbr.commons.Config; import com.l2jbr.commons.database.DatabaseAccess; -import com.l2jbr.commons.database.L2DatabaseFactory; import com.l2jbr.gameserver.datatables.MapRegionTable; import com.l2jbr.gameserver.instancemanager.CastleManager; import com.l2jbr.gameserver.model.AutoChatHandler; @@ -28,6 +27,7 @@ import com.l2jbr.gameserver.model.L2World; import com.l2jbr.gameserver.model.actor.instance.L2PcInstance; import com.l2jbr.gameserver.model.database.repository.SevenSignsRepository; +import com.l2jbr.gameserver.model.database.repository.SevenSignsStatusRepository; import com.l2jbr.gameserver.network.SystemMessageId; import com.l2jbr.gameserver.serverpackets.SignsSky; import com.l2jbr.gameserver.serverpackets.SystemMessage; @@ -37,8 +37,6 @@ import java.sql.Connection; import java.sql.PreparedStatement; -import java.sql.ResultSet; -import java.sql.SQLException; import java.util.Calendar; import java.util.LinkedHashMap; import java.util.Map; @@ -619,8 +617,8 @@ public int getPlayerCabal(L2PcInstance player) { } protected void restoreSevenSignsData() { - SevenSignsRepository repository = DatabaseAccess.getRepository(SevenSignsRepository.class); - repository.findAll().forEach(sevenSigns -> { + SevenSignsRepository signsRepository = DatabaseAccess.getRepository(SevenSignsRepository.class); + signsRepository.findAll().forEach(sevenSigns -> { int charObjId = sevenSigns.getId(); StatsSet sevenDat = new StatsSet(); @@ -637,128 +635,71 @@ protected void restoreSevenSignsData() { _signsPlayerData.put(charObjId, sevenDat); }); - try (Connection con = L2DatabaseFactory.getInstance().getConnection()) { - - try (PreparedStatement ps2 = con.prepareStatement("SELECT * FROM seven_signs_status WHERE id=0"); - ResultSet rs2 = ps2.executeQuery()) { - while (rs2.next()) { - _currentCycle = rs2.getInt("current_cycle"); - _activePeriod = rs2.getInt("active_period"); - _previousWinner = rs2.getInt("previous_winner"); - - _dawnStoneScore = rs2.getDouble("dawn_stone_score"); - _dawnFestivalScore = rs2.getInt("dawn_festival_score"); - _duskStoneScore = rs2.getDouble("dusk_stone_score"); - _duskFestivalScore = rs2.getInt("dusk_festival_score"); - - _signsSealOwners.put(SEAL_AVARICE, rs2.getInt("avarice_owner")); - _signsSealOwners.put(SEAL_GNOSIS, rs2.getInt("gnosis_owner")); - _signsSealOwners.put(SEAL_STRIFE, rs2.getInt("strife_owner")); - - _signsDawnSealTotals.put(SEAL_AVARICE, rs2.getInt("avarice_dawn_score")); - _signsDawnSealTotals.put(SEAL_GNOSIS, rs2.getInt("gnosis_dawn_score")); - _signsDawnSealTotals.put(SEAL_STRIFE, rs2.getInt("strife_dawn_score")); - _signsDuskSealTotals.put(SEAL_AVARICE, rs2.getInt("avarice_dusk_score")); - _signsDuskSealTotals.put(SEAL_GNOSIS, rs2.getInt("gnosis_dusk_score")); - _signsDuskSealTotals.put(SEAL_STRIFE, rs2.getInt("strife_dusk_score")); - } - } - try (PreparedStatement ps3 = con.prepareStatement("UPDATE seven_signs_status SET date=? WHERE id=0")) { - ps3.setInt(1, Calendar.getInstance().get(Calendar.DAY_OF_WEEK)); - ps3.execute(); - } - } catch (SQLException e) { - _log.error("SevenSigns: Unable to load Seven Signs data from database: " + e); - } - // Festival data is loaded now after the Seven Signs engine data. + SevenSignsStatusRepository statusRepository = DatabaseAccess.getRepository(SevenSignsStatusRepository.class); + statusRepository.findById(0).ifPresent(status -> { + _currentCycle = status.getCurrentCycle(); + _activePeriod = status.getActivePeriod(); + _previousWinner = status.getPreviousWinner(); + + _dawnStoneScore = status.getDawnStoneScore(); + _dawnFestivalScore = status.getDawnFestivalScore(); + _duskStoneScore = status.getDuskStoneScore(); + _duskFestivalScore = status.getDuskFestivalScore(); + + _signsSealOwners.put(SEAL_AVARICE, status.getAvariceOwner()); + _signsSealOwners.put(SEAL_GNOSIS, status.getGnosisOwner()); + _signsSealOwners.put(SEAL_STRIFE, status.getStrifeOwner()); + + _signsDawnSealTotals.put(SEAL_AVARICE, status.getAvariceDawnScore()); + _signsDawnSealTotals.put(SEAL_GNOSIS, status.getGnosisDawnScore()); + _signsDawnSealTotals.put(SEAL_STRIFE, status.getStrifeDawnScore()); + _signsDuskSealTotals.put(SEAL_AVARICE, status.getAvariceDuskScore()); + _signsDuskSealTotals.put(SEAL_GNOSIS, status.getGnosisDuskScore()); + _signsDuskSealTotals.put(SEAL_STRIFE, status.getStrifeDuskScore()); + }); + + statusRepository.updateDate(0, Calendar.getInstance().get(Calendar.DAY_OF_WEEK)); } /** - * Saves all Seven Signs data, both to the database and properties file (if updateSettings = True). Often called to preserve data integrity and synchronization with DB, in case of errors.
    + * Saves all Seven Signs data, both to the database and properties file (if updateSettings = True). + * Often called to preserve data integrity and synchronization with DB, in case of errors.
    * If player != null, just that player's data is updated in the database, otherwise all player's data is sequentially updated. * - * @param player - * @param updateSettings */ public void saveSevenSignsData(L2PcInstance player, boolean updateSettings) { - Connection con = null; - PreparedStatement statement = null; + _log.debug("SevenSigns: Saving data to disk."); - if (Config.DEBUG) { - System.out.println("SevenSigns: Saving data to disk."); - } - - try { - SevenSignsRepository repository = DatabaseAccess.getRepository(SevenSignsRepository.class); + SevenSignsRepository repository = DatabaseAccess.getRepository(SevenSignsRepository.class); - for (StatsSet sevenDat : _signsPlayerData.values()) { - if (player != null) { - if (sevenDat.getInteger("char_obj_id") != player.getObjectId()) { - continue; - } + for (StatsSet sevenDat : _signsPlayerData.values()) { + if (player != null) { + if (sevenDat.getInteger("char_obj_id") != player.getObjectId()) { + continue; } - - repository.updateContribution(sevenDat.getInteger("char_obj_id"), sevenDat.getString("cabal"), sevenDat.getInteger("seal"), - sevenDat.getInteger("red_stones"), sevenDat.getInteger("green_stones"), sevenDat.getInteger("blue_stones"), - sevenDat.getDouble("ancient_adena_amount"), sevenDat.getDouble("contribution_score")); - - _log.debug("SevenSigns: Updated data in database for char ID {} ()", sevenDat.getInteger("char_obj_id"), sevenDat.getString("cabal")); } - if (updateSettings) { - String sqlQuery = "UPDATE seven_signs_status SET current_cycle=?, active_period=?, previous_winner=?, " + "dawn_stone_score=?, dawn_festival_score=?, dusk_stone_score=?, dusk_festival_score=?, " + "avarice_owner=?, gnosis_owner=?, strife_owner=?, avarice_dawn_score=?, gnosis_dawn_score=?, " + "strife_dawn_score=?, avarice_dusk_score=?, gnosis_dusk_score=?, strife_dusk_score=?, " + "festival_cycle=?, "; - - for (int i = 0; i < (SevenSignsFestival.FESTIVAL_COUNT); i++) { - sqlQuery += "accumulated_bonus" + String.valueOf(i) + "=?, "; - } + repository.updateContribution(sevenDat.getInteger("char_obj_id"), sevenDat.getString("cabal"), sevenDat.getInteger("seal"), + sevenDat.getInteger("red_stones"), sevenDat.getInteger("green_stones"), sevenDat.getInteger("blue_stones"), + sevenDat.getDouble("ancient_adena_amount"), sevenDat.getDouble("contribution_score")); - sqlQuery += "date=? WHERE id=0"; - - con = L2DatabaseFactory.getInstance().getConnection(); - - statement = con.prepareStatement(sqlQuery); - statement.setInt(1, _currentCycle); - statement.setInt(2, _activePeriod); - statement.setInt(3, _previousWinner); - statement.setDouble(4, _dawnStoneScore); - statement.setInt(5, _dawnFestivalScore); - statement.setDouble(6, _duskStoneScore); - statement.setInt(7, _duskFestivalScore); - statement.setInt(8, _signsSealOwners.get(SEAL_AVARICE)); - statement.setInt(9, _signsSealOwners.get(SEAL_GNOSIS)); - statement.setInt(10, _signsSealOwners.get(SEAL_STRIFE)); - statement.setInt(11, _signsDawnSealTotals.get(SEAL_AVARICE)); - statement.setInt(12, _signsDawnSealTotals.get(SEAL_GNOSIS)); - statement.setInt(13, _signsDawnSealTotals.get(SEAL_STRIFE)); - statement.setInt(14, _signsDuskSealTotals.get(SEAL_AVARICE)); - statement.setInt(15, _signsDuskSealTotals.get(SEAL_GNOSIS)); - statement.setInt(16, _signsDuskSealTotals.get(SEAL_STRIFE)); - statement.setInt(17, SevenSignsFestival.getInstance().getCurrentFestivalCycle()); - - for (int i = 0; i < SevenSignsFestival.FESTIVAL_COUNT; i++) { - statement.setInt(18 + i, SevenSignsFestival.getInstance().getAccumulatedBonus(i)); - } + _log.debug("SevenSigns: Updated data in database for char ID {} ()", sevenDat.getInteger("char_obj_id"), sevenDat.getString("cabal")); + } - statement.setInt(18 + SevenSignsFestival.FESTIVAL_COUNT, Calendar.getInstance().get(Calendar.DAY_OF_WEEK)); - statement.execute(); + if (updateSettings) { + SevenSignsStatusRepository statusRepository = DatabaseAccess.getRepository(SevenSignsStatusRepository.class); - statement.close(); - con.close(); + SevenSignsFestival festival = SevenSignsFestival.getInstance(); + statusRepository.update(0, _currentCycle, _activePeriod, _previousWinner, _dawnStoneScore, _dawnFestivalScore, _duskStoneScore, + _duskFestivalScore, _signsSealOwners.get(SEAL_AVARICE), _signsSealOwners.get(SEAL_GNOSIS), _signsSealOwners.get(SEAL_STRIFE), + _signsDawnSealTotals.get(SEAL_AVARICE), _signsDawnSealTotals.get(SEAL_GNOSIS), _signsDawnSealTotals.get(SEAL_STRIFE), + _signsDuskSealTotals.get(SEAL_AVARICE), _signsDuskSealTotals.get(SEAL_GNOSIS), _signsDuskSealTotals.get(SEAL_STRIFE), + SevenSignsFestival.getInstance().getCurrentFestivalCycle(), festival.getAccumulatedBonus(0), festival.getAccumulatedBonus(1), + festival.getAccumulatedBonus(2), festival.getAccumulatedBonus(3), festival.getAccumulatedBonus(4), + Calendar.getInstance().get(Calendar.DAY_OF_WEEK)); - if (Config.DEBUG) { - _log.info("SevenSigns: Updated data in database."); - } - - } - } catch (SQLException e) { - _log.error("SevenSigns: Unable to save data to database: " + e); - } finally { - try { - statement.close(); - con.close(); - } catch (Exception e) { - } + _log.info("SevenSigns: Updated data in database."); } } diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/SevenSignsFestival.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/SevenSignsFestival.java index aa32236f..4c7a1923 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/SevenSignsFestival.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/SevenSignsFestival.java @@ -19,7 +19,6 @@ import com.l2jbr.commons.Config; import com.l2jbr.commons.database.DatabaseAccess; -import com.l2jbr.commons.database.L2DatabaseFactory; import com.l2jbr.commons.util.Rnd; import com.l2jbr.gameserver.ai.CtrlIntention; import com.l2jbr.gameserver.datatables.ClanTable; @@ -33,6 +32,7 @@ import com.l2jbr.gameserver.model.base.Experience; import com.l2jbr.gameserver.model.database.repository.CharacterRepository; import com.l2jbr.gameserver.model.database.repository.SevenSignsFestivalRepository; +import com.l2jbr.gameserver.model.database.repository.SevenSignsStatusRepository; import com.l2jbr.gameserver.network.SystemMessageId; import com.l2jbr.gameserver.serverpackets.CreatureSay; import com.l2jbr.gameserver.serverpackets.MagicSkillUser; @@ -44,10 +44,6 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import java.sql.Connection; -import java.sql.PreparedStatement; -import java.sql.ResultSet; -import java.sql.SQLException; import java.util.LinkedHashMap; import java.util.LinkedList; import java.util.List; @@ -3309,7 +3305,7 @@ protected void restoreFestivalData() { SevenSignsFestivalRepository repository = DatabaseAccess.getRepository(SevenSignsFestivalRepository.class); repository.findAll().forEach(festival -> { int festivalCycle = festival.getCycle(); - int festivalId = festival.getFestivalId(); + int festivalId = festival.getId(); String cabal = festival.getCabal(); StatsSet festivalDat = new StatsSet(); @@ -3336,31 +3332,15 @@ protected void restoreFestivalData() { _festivalData.put(festivalCycle, tempData); }); - try (Connection con = L2DatabaseFactory.getInstance().getConnection()) { - - String query = "SELECT festival_cycle, "; - - for (int i = 0; i < (FESTIVAL_COUNT - 1); i++) { - query += "accumulated_bonus" + String.valueOf(i) + ", "; - } - query += "accumulated_bonus" + String.valueOf(FESTIVAL_COUNT - 1) + " "; - query += "FROM seven_signs_status WHERE id=0"; - try (PreparedStatement ps2 = con.prepareStatement(query); - ResultSet rs2 = ps2.executeQuery()) { - while (rs2.next()) { - _festivalCycle = rs2.getInt("festival_cycle"); - - for (int i = 0; i < FESTIVAL_COUNT; i++) { - _accumulatedBonuses.add(i, rs2.getInt("accumulated_bonus" + String.valueOf(i))); - } - } - } - if (Config.DEBUG) { - _log.info("SevenSignsFestival: Loaded data from database."); - } - } catch (SQLException e) { - _log.error("SevenSignsFestival: Failed to load configuration: " + e); - } + SevenSignsStatusRepository statusRepository = DatabaseAccess.getRepository(SevenSignsStatusRepository.class); + statusRepository.findById(0).ifPresent(status -> { + _festivalCycle = status.getFestivalCycle(); + _accumulatedBonuses.add(0, status.getAccumulatedBonus0()); + _accumulatedBonuses.add(1, status.getAccumulatedBonus1()); + _accumulatedBonuses.add(2, status.getAccumulatedBonus2()); + _accumulatedBonuses.add(3, status.getAccumulatedBonus3()); + _accumulatedBonuses.add(4, status.getAccumulatedBonus4()); + }); } /** diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/SevenSignsFestival.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/SevenSignsFestival.java index e0fe3e43..bcf55ddd 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/SevenSignsFestival.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/SevenSignsFestival.java @@ -1,10 +1,11 @@ package com.l2jbr.gameserver.model.database; import com.l2jbr.commons.database.annotation.Table; +import com.l2jbr.commons.database.model.Entity; import org.springframework.data.annotation.Id; @Table("seven_signs_festival") -public class SevenSignsFestival { +public class SevenSignsFestival extends Entity { @Id private int festivalId; @@ -25,7 +26,8 @@ public SevenSignsFestival(int festivalId, String cabal, int cycle, long date, in this.members = members; } - public int getFestivalId() { + @Override + public Integer getId() { return festivalId; } diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/SevenSignsStatus.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/SevenSignsStatus.java index 4042ec84..d6a6438e 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/SevenSignsStatus.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/SevenSignsStatus.java @@ -1,31 +1,153 @@ package com.l2jbr.gameserver.model.database; +import com.l2jbr.commons.database.annotation.Column; +import com.l2jbr.commons.database.annotation.Table; +import org.springframework.data.annotation.Id; - +@Table("seven_signs_status") public class SevenSignsStatus { + @Id private int id; - private int current_cycle; - private int festival_cycle; - private int active_period; + @Column("current_cycle") + private int currentCycle; + @Column("festival_cycle") + private int festivalCycle; + @Column("active_period") + private int activePeriod; private int date; - private int previous_winner; - private long dawn_stone_score; - private int dawn_festival_score; - private long dusk_stone_score; - private int dusk_festival_score; - private int avarice_owner; - private int gnosis_owner; - private int strife_owner; - private int avarice_dawn_score; - private int gnosis_dawn_score; - private int strife_dawn_score; - private int avarice_dusk_score; - private int gnosis_dusk_score; - private int strife_dusk_score; - private int accumulated_bonus0; - private int accumulated_bonus1; - private int accumulated_bonus2; - private int accumulated_bonus3; - private int accumulated_bonus4; + @Column("previous_winner") + private int previousWinner; + @Column("dawn_stone_score") + private long dawnStoneScore; + @Column("dawn_festival_score") + private int dawnFestivalScore; + @Column("dusk_stone_score") + private long duskStoneScore; + @Column("dusk_festival_score") + private int duskFestivalScore; + @Column("avarice_onwer") + private int avariceOwner; + @Column("gnosis_owner") + private int gnosisOwner; + @Column("strife_owner") + private int strifeOwner; + @Column("avarice_dawn_score") + private int avariceDawnScore; + @Column("gnosis_dawn_score") + private int gnosisDawnScore; + @Column("strife_dawn_score") + private int strifeDawnScore; + @Column("avarice_dusk_score") + private int avariceDuskScore; + @Column("gnosis_dusk_score") + private int gnosisDuskScore; + @Column("strife_dusk_score") + private int strifeDuskScore; + @Column("accumulated_bonus0") + private int accumulatedBonus0; + @Column("accumulated_bonus1") + private int accumulatedBonus1; + @Column("accumulated_bonus2") + private int accumulatedBonus2; + @Column("accumulated_bonus3") + private int accumulatedBonus3; + @Column("accumulated_bonus4") + private int accumulatedBonus4; + + public int getId() { + return id; + } + + public int getCurrentCycle() { + return currentCycle; + } + + public int getFestivalCycle() { + return festivalCycle; + } + + public int getActivePeriod() { + return activePeriod; + } + + public int getDate() { + return date; + } + + public int getPreviousWinner() { + return previousWinner; + } + + public long getDawnStoneScore() { + return dawnStoneScore; + } + + public int getDawnFestivalScore() { + return dawnFestivalScore; + } + + public long getDuskStoneScore() { + return duskStoneScore; + } + + public int getDuskFestivalScore() { + return duskFestivalScore; + } + + public int getAvariceOwner() { + return avariceOwner; + } + + public int getGnosisOwner() { + return gnosisOwner; + } + + public int getStrifeOwner() { + return strifeOwner; + } + + public int getAvariceDawnScore() { + return avariceDawnScore; + } + + public int getGnosisDawnScore() { + return gnosisDawnScore; + } + + public int getStrifeDawnScore() { + return strifeDawnScore; + } + + public int getAvariceDuskScore() { + return avariceDuskScore; + } + + public int getGnosisDuskScore() { + return gnosisDuskScore; + } + + public int getStrifeDuskScore() { + return strifeDuskScore; + } + + public int getAccumulatedBonus0() { + return accumulatedBonus0; + } + + public int getAccumulatedBonus1() { + return accumulatedBonus1; + } + + public int getAccumulatedBonus2() { + return accumulatedBonus2; + } + + public int getAccumulatedBonus3() { + return accumulatedBonus3; + } + + public int getAccumulatedBonus4() { + return accumulatedBonus4; + } } diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/repository/SevenSignsStatusRepository.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/repository/SevenSignsStatusRepository.java new file mode 100644 index 00000000..e0fa4f55 --- /dev/null +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/repository/SevenSignsStatusRepository.java @@ -0,0 +1,29 @@ +package com.l2jbr.gameserver.model.database.repository; + +import com.l2jbr.gameserver.model.database.SevenSignsStatus; +import org.springframework.data.jdbc.repository.query.Modifying; +import org.springframework.data.jdbc.repository.query.Query; +import org.springframework.data.repository.CrudRepository; +import org.springframework.data.repository.query.Param; + +public interface SevenSignsStatusRepository extends CrudRepository { + + @Modifying + @Query("UPDATE seven_signs_status SET date=:date WHERE id=:id") + int updateDate(@Param("id") int id, @Param("date") int date); + + @Query("UPDATE seven_signs_status SET current_cycle=?, active_period=?, previous_winner=?, " + + "dawn_stone_score=?, dawn_festival_score=?, dusk_stone_score=?, dusk_festival_score=?, " + + "avarice_owner=?, gnosis_owner=?, strife_owner=?, avarice_dawn_score=?, gnosis_dawn_score=?, " + + "strife_dawn_score=?, avarice_dusk_score=?, gnosis_dusk_score=?, strife_dusk_score=?, " + + "festival_cycle=?, accumulated_bonus0=?, accumulated_bonus1=?, accumulated_bonus2=?, accumulated_bonus3=?, " + + "accumulated_bonus4=?, date=? WHERE id=?") + void update(@Param("id") int id, @Param("cycle") int currentCycle, @Param("period") int activePeriod, @Param("previousWinner") int previousWinner, + @Param("dawnStone") double dawnStoneScore, @Param("dawnFestival") int dawnFestivalScore, @Param("duskStone") double duskStoneScore, + @Param("duskFestival") int duskFestivalScore, @Param("avariceOwner") int avariceOwner, @Param("gnosisOwner") int gnosisOwner, + @Param("strifeOwner") int strifeOwner, @Param("avariceDawn") int avariceDawnScore, @Param("gnosisDawn") int gnosisDawnScore, + @Param("strifeDawn") int strifeDawnScore, @Param("avariceDusk") int avariceDuskScore, @Param("gnosisDusk") int gnosisDuskScore, + @Param("strifeDusk") int strifeDuskScore, @Param("festivalCycle") int currentFestivalCycle, @Param("bonus0") int accumulatedBonus0, + @Param("bonus1") int accumulatedBonus1, @Param("bonus2") int accumulatedBonus2, @Param("bonus3") int accumulatedBonus3, + @Param("bonus4") int accumulatedBonus4, @Param("date") int date); +} From e2b411bd6016f287cc660ac2b5e01ef039d36207 Mon Sep 17 00:00:00 2001 From: Alisson Oliveira Date: Sun, 6 May 2018 00:24:22 -0300 Subject: [PATCH 086/236] =?UTF-8?q?Atualiza=20depend=C3=AAncias=20de=20Log?= =?UTF-8?q?ger=20do=20Tools?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Tools/bin/startSQLAccountManager.sh | 2 +- Tools/build.gradle | 7 ++++++- gradle/wrapper/gradle-wrapper.properties | 3 ++- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/Tools/bin/startSQLAccountManager.sh b/Tools/bin/startSQLAccountManager.sh index e40e82b4..ade7d3fa 100644 --- a/Tools/bin/startSQLAccountManager.sh +++ b/Tools/bin/startSQLAccountManager.sh @@ -1,2 +1,2 @@ #!/bin/sh -java -Djava.util.logging.config.file=console.cfg -cp './lib/*' com.l2jbr.tools.gsregistering.accountmanager.SQLAccountManager +java -Djava.util.logging.config.file=console.cfg -cp './lib/*' com.l2jbr.tools.accountmanager.SQLAccountManager diff --git a/Tools/build.gradle b/Tools/build.gradle index c56f9109..ae0f3520 100644 --- a/Tools/build.gradle +++ b/Tools/build.gradle @@ -4,7 +4,7 @@ plugins { id "eclipse" } -version '1.3.0' +version '1.3.1' ext.moduleName = 'com.l2jbr.tools' @@ -25,8 +25,13 @@ dependencies { compile project(":Loginserver") compile project(":Gameserver") + compile 'org.slf4j:slf4j-api:1.8.0-beta2' + runtime project(':Mmocore') + runtime 'org.apache.logging.log4j:log4j-core:2.11.0' + runtime 'org.apache.logging.log4j:log4j-api:2.11.0' + runtime 'org.apache.logging.log4j:log4j-slf4j-impl:2.11.0' runtime 'com.mchange:c3p0:0.9.5.2' runtime 'com.mchange:mchange-commons-java:0.2.15' runtime 'mysql:mysql-connector-java:8.0.9-rc' diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index bf3de218..3a5e6771 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,6 @@ +#Sun May 06 00:14:06 BRT 2018 distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-4.6-bin.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists +distributionUrl=https\://services.gradle.org/distributions/gradle-4.6-all.zip From 1c6af22b3718f47dda78c30f5968f944026350ed Mon Sep 17 00:00:00 2001 From: Alisson Oliveira Date: Sun, 6 May 2018 00:24:37 -0300 Subject: [PATCH 087/236] Corrige ConcurrentModificationException --- Gameserver/build.gradle | 2 +- .../actor/knownlist/ObjectKnownList.java | 4 +-- .../taskmanager/AttackStanceTaskManager.java | 23 +++++---------- .../taskmanager/DecayTaskManager.java | 29 ++++++++----------- 4 files changed, 23 insertions(+), 35 deletions(-) diff --git a/Gameserver/build.gradle b/Gameserver/build.gradle index 476a687e..4c2df236 100644 --- a/Gameserver/build.gradle +++ b/Gameserver/build.gradle @@ -6,7 +6,7 @@ plugins { ext.moduleName = 'com.l2jbr.gameserver' -version '1.3.0' +version '1.3.1' sourceSets { main { diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/actor/knownlist/ObjectKnownList.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/actor/knownlist/ObjectKnownList.java index 24bfcb59..f271beb2 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/actor/knownlist/ObjectKnownList.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/actor/knownlist/ObjectKnownList.java @@ -27,8 +27,8 @@ import com.l2jbr.gameserver.util.Util; import java.util.Collection; -import java.util.LinkedHashMap; import java.util.Map; +import java.util.concurrent.ConcurrentHashMap; public class ObjectKnownList { @@ -210,7 +210,7 @@ public int getDistanceToWatchObject(L2Object object) { */ public final Map getKnownObjects() { if (_knownObjects == null) { - _knownObjects = new LinkedHashMap<>(); + _knownObjects = new ConcurrentHashMap<>(); } return _knownObjects; } diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/taskmanager/AttackStanceTaskManager.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/taskmanager/AttackStanceTaskManager.java index bfb40560..d544c5dc 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/taskmanager/AttackStanceTaskManager.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/taskmanager/AttackStanceTaskManager.java @@ -31,8 +31,8 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import java.util.LinkedHashMap; import java.util.Map; +import java.util.concurrent.ConcurrentHashMap; /** @@ -44,7 +44,7 @@ public class AttackStanceTaskManager { protected static final Logger _log = LoggerFactory.getLogger(AttackStanceTaskManager.class.getName()); - protected Map _attackStanceTasks = new LinkedHashMap<>(); + protected Map _attackStanceTasks = new ConcurrentHashMap<>(); private static AttackStanceTaskManager _instance; @@ -80,21 +80,14 @@ protected FightModeScheduler() { @Override public void run() { Long current = System.currentTimeMillis(); - try { - if (_attackStanceTasks != null) { - synchronized (this) { - for (L2Character actor : _attackStanceTasks.keySet()) { - if ((current - _attackStanceTasks.get(actor)) > 15000) { - actor.broadcastPacket(new AutoAttackStop(actor.getObjectId())); - actor.getAI().setAutoAttacking(false); - _attackStanceTasks.remove(actor); - } - } + if (_attackStanceTasks != null) { + for (L2Character actor : _attackStanceTasks.keySet()) { + if ((current - _attackStanceTasks.get(actor)) > 15000) { + actor.broadcastPacket(new AutoAttackStop(actor.getObjectId())); + actor.getAI().setAutoAttacking(false); + _attackStanceTasks.remove(actor); } } - } catch (Throwable e) { - // TODO: Find out the reason for exception. Unless caught here, players remain in attack positions. - _log.warn(e.toString()); } } } diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/taskmanager/DecayTaskManager.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/taskmanager/DecayTaskManager.java index de35fbc0..9c29087f 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/taskmanager/DecayTaskManager.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/taskmanager/DecayTaskManager.java @@ -23,9 +23,9 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import java.util.LinkedHashMap; import java.util.Map; import java.util.NoSuchElementException; +import java.util.concurrent.ConcurrentHashMap; /** @@ -33,7 +33,7 @@ */ public class DecayTaskManager { protected static final Logger _log = LoggerFactory.getLogger(DecayTaskManager.class.getName()); - protected Map _decayTasks = new LinkedHashMap(); + protected Map _decayTasks = new ConcurrentHashMap<>(); private static DecayTaskManager _instance; @@ -73,23 +73,18 @@ protected DecayScheduler() { public void run() { Long current = System.currentTimeMillis(); int delay; - try { - if (_decayTasks != null) { - for (L2Character actor : _decayTasks.keySet()) { - if (actor instanceof L2RaidBossInstance) { - delay = 30000; - } else { - delay = 8500; - } - if ((current - _decayTasks.get(actor)) > delay) { - actor.onDecay(); - _decayTasks.remove(actor); - } + if (_decayTasks != null) { + for (L2Character actor : _decayTasks.keySet()) { + if (actor instanceof L2RaidBossInstance) { + delay = 30000; + } else { + delay = 8500; + } + if ((current - _decayTasks.get(actor)) > delay) { + actor.onDecay(); + _decayTasks.remove(actor); } } - } catch (Throwable e) { - // TODO: Find out the reason for exception. Unless caught here, mob decay would stop. - _log.warn(e.toString()); } } } From 3eb0535c067b413f649e71bc8e00237c6183f2c4 Mon Sep 17 00:00:00 2001 From: Alisson Oliveira Date: Sun, 6 May 2018 13:21:39 -0300 Subject: [PATCH 088/236] =?UTF-8?q?Remove=20refer=C3=AAncias=20diretas=20?= =?UTF-8?q?=C3=A0=20tabela=20siege=5Fclans?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../instancemanager/SiegeManager.java | 41 +-- .../gameserver/model/database/SiegeClan.java | 43 +++- .../repository/SiegeClanRepository.java | 32 +++ .../l2jbr/gameserver/model/entity/Siege.java | 233 +++++------------- 4 files changed, 136 insertions(+), 213 deletions(-) create mode 100644 Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/repository/SiegeClanRepository.java diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/instancemanager/SiegeManager.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/instancemanager/SiegeManager.java index 3bd016bd..cd77152f 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/instancemanager/SiegeManager.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/instancemanager/SiegeManager.java @@ -18,13 +18,15 @@ package com.l2jbr.gameserver.instancemanager; import com.l2jbr.commons.Config; -import com.l2jbr.commons.database.L2DatabaseFactory; +import com.l2jbr.commons.database.DatabaseAccess; +import com.l2jbr.commons.util.Util; import com.l2jbr.gameserver.datatables.SkillTable; import com.l2jbr.gameserver.model.L2Character; import com.l2jbr.gameserver.model.L2Clan; import com.l2jbr.gameserver.model.L2Object; import com.l2jbr.gameserver.model.Location; import com.l2jbr.gameserver.model.actor.instance.L2PcInstance; +import com.l2jbr.gameserver.model.database.repository.SiegeClanRepository; import com.l2jbr.gameserver.model.entity.Castle; import com.l2jbr.gameserver.model.entity.Siege; import com.l2jbr.gameserver.network.SystemMessageId; @@ -35,8 +37,6 @@ import java.io.File; import java.io.FileInputStream; import java.io.InputStream; -import java.sql.PreparedStatement; -import java.sql.ResultSet; import java.util.*; @@ -119,14 +119,9 @@ public final boolean checkIfOkToSummon(L2Character activeChar, boolean isCheckOn /** * Return true if the clan is registered or owner of a castle
    - *
    - * - * @param clan The L2Clan of the player - * @param castleid - * @return */ public final boolean checkIsRegistered(L2Clan clan, int castleid) { - if (clan == null) { + if (Util.isNull(clan)) { return false; } @@ -134,32 +129,8 @@ public final boolean checkIsRegistered(L2Clan clan, int castleid) { return true; } - java.sql.Connection con = null; - boolean register = false; - try { - con = L2DatabaseFactory.getInstance().getConnection(); - PreparedStatement statement = con.prepareStatement("SELECT clan_id FROM siege_clans where clan_id=? and castle_id=?"); - statement.setInt(1, clan.getClanId()); - statement.setInt(2, castleid); - ResultSet rs = statement.executeQuery(); - - while (rs.next()) { - register = true; - break; - } - - rs.close(); - statement.close(); - } catch (Exception e) { - System.out.println("Exception: checkIsRegistered(): " + e.getMessage()); - e.printStackTrace(); - } finally { - try { - con.close(); - } catch (Exception e) { - } - } - return register; + SiegeClanRepository repository = DatabaseAccess.getRepository(SiegeClanRepository.class); + return repository.existsByClanAndCastle(clan.getClanId(), castleid); } public final void removeSiegeSkills(L2PcInstance character) { diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/SiegeClan.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/SiegeClan.java index 27cd13b1..72261604 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/SiegeClan.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/SiegeClan.java @@ -1,10 +1,45 @@ package com.l2jbr.gameserver.model.database; +import com.l2jbr.commons.database.annotation.Column; +import com.l2jbr.commons.database.annotation.Table; +import com.l2jbr.commons.database.model.Entity; +import org.springframework.data.annotation.Id; +@Table("siege_clan") +public class SiegeClan extends Entity { -public class SiegeClan { - private int castle_id; - private int clan_id; + @Id + @Column("castle_id") + private int castleId; + @Column("clan_id") + private int clanId; private int type; - private int castle_owner; + @Column("castle_owner") + private int castleOwner; + + public SiegeClan() { } + + public SiegeClan(int castleId, int clanId, int typeId, int castleOwner) { + this.castleId = castleId; + this.clanId = clanId; + this.type = typeId; + this.castleOwner = castleOwner; + } + + @Override + public Integer getId() { + return castleId; + } + + public int getClanId() { + return clanId; + } + + public int getType() { + return type; + } + + public int getCastleOwner() { + return castleOwner; + } } diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/repository/SiegeClanRepository.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/repository/SiegeClanRepository.java new file mode 100644 index 00000000..b50bf355 --- /dev/null +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/repository/SiegeClanRepository.java @@ -0,0 +1,32 @@ +package com.l2jbr.gameserver.model.database.repository; + +import com.l2jbr.gameserver.model.database.SiegeClan; +import org.springframework.data.jdbc.repository.query.Modifying; +import org.springframework.data.jdbc.repository.query.Query; +import org.springframework.data.repository.CrudRepository; +import org.springframework.data.repository.query.Param; + +public interface SiegeClanRepository extends CrudRepository { + + @Query("SELECT EXISTS ( SELECT 1 FROM siege_clans WHERE clan_id=:clan AND castle_id=:castle)") + boolean existsByClanAndCastle(@Param("clan") int clanId, @Param("castle") int castleid); + + @Modifying + @Query("DELETE FROM siege_clans WHERE clan_id=:clan") + int deleteByClan(@Param("clan") int clanId); + + @Modifying + @Query("DELETE FROM siege_clans WHERE castle_id=:castle and type=:type") + int deleteByCastleAndType(@Param("castle") int castleId, @Param("type") int type); + + @Modifying + @Query("DELETE FROM siege_clans WHERE castle_id=:castle and clan_id=:clan") + int deleteByCastleAndClan(@Param("castle") int castleId, @Param("clan") int clanId); + + @Query("SELECT * FROM siege_clans where castle_id=:castle") + Iterable findByCastle(@Param("castle") int castleId); + + @Modifying + @Query("UPDATE siege_clans SET type=:type WHERE castle_id=:castle AND clan_id=:clan") + int updateTypeByClan(@Param("castle") int castleId, @Param("clan") int clanId, @Param("type") int typeId); +} diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/entity/Siege.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/entity/Siege.java index 25279591..64dfbbbb 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/entity/Siege.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/entity/Siege.java @@ -19,7 +19,6 @@ package com.l2jbr.gameserver.model.entity; import com.l2jbr.commons.database.DatabaseAccess; -import com.l2jbr.commons.database.L2DatabaseFactory; import com.l2jbr.gameserver.Announcements; import com.l2jbr.gameserver.ThreadPoolManager; import com.l2jbr.gameserver.datatables.ClanTable; @@ -36,7 +35,9 @@ import com.l2jbr.gameserver.model.actor.instance.L2ControlTowerInstance; import com.l2jbr.gameserver.model.actor.instance.L2NpcInstance; import com.l2jbr.gameserver.model.actor.instance.L2PcInstance; +import com.l2jbr.gameserver.model.database.SiegeClan; import com.l2jbr.gameserver.model.database.repository.CastleRepository; +import com.l2jbr.gameserver.model.database.repository.SiegeClanRepository; import com.l2jbr.gameserver.network.SystemMessageId; import com.l2jbr.gameserver.serverpackets.RelationChanged; import com.l2jbr.gameserver.serverpackets.SiegeInfo; @@ -44,8 +45,6 @@ import com.l2jbr.gameserver.serverpackets.UserInfo; import com.l2jbr.gameserver.templates.L2NpcTemplate; -import java.sql.PreparedStatement; -import java.sql.ResultSet; import java.util.Calendar; import java.util.LinkedList; import java.util.List; @@ -518,61 +517,21 @@ public boolean checkIsDefenderWaiting(L2Clan clan) { return (getDefenderWaitingClan(clan) != null); } - /** - * Clear all registered siege clans from database for castle - */ public void clearSiegeClan() { - java.sql.Connection con = null; - try { - con = L2DatabaseFactory.getInstance().getConnection(); - PreparedStatement statement = con.prepareStatement("DELETE FROM siege_clans WHERE castle_id=?"); - statement.setInt(1, getCastle().getCastleId()); - statement.execute(); - statement.close(); - - if (getCastle().getOwnerId() > 0) { - PreparedStatement statement2 = con.prepareStatement("DELETE FROM siege_clans WHERE clan_id=?"); - statement2.setInt(1, getCastle().getOwnerId()); - statement2.execute(); - statement2.close(); - } - - getAttackerClans().clear(); - getDefenderClans().clear(); - getDefenderWaitingClans().clear(); - } catch (Exception e) { - System.out.println("Exception: clearSiegeClan(): " + e.getMessage()); - e.printStackTrace(); - } finally { - try { - con.close(); - } catch (Exception e) { - } + SiegeClanRepository repository = DatabaseAccess.getRepository(SiegeClanRepository.class); + repository.deleteById(getCastle().getCastleId()); + if(getCastle().getOwnerId() > 0) { + repository.deleteByClan(getCastle().getOwnerId()); } + getAttackerClans().clear(); + getDefenderClans().clear(); + getDefenderWaitingClans().clear(); } - /** - * Clear all siege clans waiting for approval from database for castle - */ + public void clearSiegeWaitingClan() { - java.sql.Connection con = null; - try { - con = L2DatabaseFactory.getInstance().getConnection(); - PreparedStatement statement = con.prepareStatement("DELETE FROM siege_clans WHERE castle_id=? and type = 2"); - statement.setInt(1, getCastle().getCastleId()); - statement.execute(); - statement.close(); - - getDefenderWaitingClans().clear(); - } catch (Exception e) { - System.out.println("Exception: clearSiegeWaitingClan(): " + e.getMessage()); - e.printStackTrace(); - } finally { - try { - con.close(); - } catch (Exception e) { - } - } + SiegeClanRepository repository = DatabaseAccess.getRepository(SiegeClanRepository.class); + repository.deleteByCastleAndType(getCastle().getCastleId(), 2); } /** @@ -750,34 +709,12 @@ public void registerDefender(L2PcInstance player, boolean force) { } } - /** - * Remove clan from siege
    - *
    - * - * @param clanId The int of player's clan id - */ public void removeSiegeClan(int clanId) { if (clanId <= 0) { return; } - - java.sql.Connection con = null; - try { - con = L2DatabaseFactory.getInstance().getConnection(); - PreparedStatement statement = con.prepareStatement("DELETE FROM siege_clans WHERE castle_id=? and clan_id=?"); - statement.setInt(1, getCastle().getCastleId()); - statement.setInt(2, clanId); - statement.execute(); - statement.close(); - - loadSiegeClan(); - } catch (Exception e) { - } finally { - try { - con.close(); - } catch (Exception e) { - } - } + SiegeClanRepository repository = DatabaseAccess.getRepository(SiegeClanRepository.class); + repository.deleteByCastleAndClan(getCastle().getCastleId(), clanId); } /** @@ -959,52 +896,30 @@ private void correctSiegeDateTime() { } } - /** - * Load siege clans. - */ private void loadSiegeClan() { - java.sql.Connection con = null; - try { - getAttackerClans().clear(); - getDefenderClans().clear(); - getDefenderWaitingClans().clear(); - - // Add castle owner as defender (add owner first so that they are on the top of the defender list) - if (getCastle().getOwnerId() > 0) { - addDefender(getCastle().getOwnerId(), SiegeClanType.OWNER); - } - - PreparedStatement statement = null; - ResultSet rs = null; - - con = L2DatabaseFactory.getInstance().getConnection(); - - statement = con.prepareStatement("SELECT clan_id,type FROM siege_clans where castle_id=?"); - statement.setInt(1, getCastle().getCastleId()); - rs = statement.executeQuery(); - - int typeId; - while (rs.next()) { - typeId = rs.getInt("type"); - if (typeId == 0) { - addDefender(rs.getInt("clan_id")); - } else if (typeId == 1) { - addAttacker(rs.getInt("clan_id")); - } else if (typeId == 2) { - addDefenderWaiting(rs.getInt("clan_id")); - } + getAttackerClans().clear(); + getDefenderClans().clear(); + getDefenderWaitingClans().clear(); + + // Add castle owner as defender (add owner first so that they are on the top of the defender list) + if (getCastle().getOwnerId() > 0) { + addDefender(getCastle().getOwnerId(), SiegeClanType.OWNER); + } + + SiegeClanRepository repository = DatabaseAccess.getRepository(SiegeClanRepository.class); + repository.findByCastle(getCastle().getCastleId()).forEach(siegeClan -> { + switch (siegeClan.getType()){ + case 0: + addDefender(siegeClan.getClanId()); + break; + case 1: + addAttacker(siegeClan.getClanId()); + break; + case 2: + addDefenderWaiting(siegeClan.getClanId()); } + }); - statement.close(); - } catch (Exception e) { - System.out.println("Exception: loadSiegeClan(): " + e.getMessage()); - e.printStackTrace(); - } finally { - try { - con.close(); - } catch (Exception e) { - } - } } /** @@ -1074,73 +989,43 @@ private void saveCastleSiege() { startAutoTask(); // Prepare auto start siege and end registration } - private void saveSiegeDate() { CastleRepository repository = DatabaseAccess.getRepository(CastleRepository.class); repository.updateSiegeDateById(getCastle().getCastleId(), getSiegeDate().getTimeInMillis()); } - /** - * Save registration to database.
    - *
    - * - * @param clan The L2Clan of player - * @param typeId -1 = owner 0 = defender, 1 = attacker, 2 = defender waiting - * @param isUpdateRegistration - */ private void saveSiegeClan(L2Clan clan, int typeId, boolean isUpdateRegistration) { if (clan.getHasCastle() > 0) { return; } - java.sql.Connection con = null; - try { - if ((typeId == 0) || (typeId == 2) || (typeId == -1)) { - if ((getDefenderClans().size() + getDefenderWaitingClans().size()) >= SiegeManager.getInstance().getDefenderMaxClans()) { - return; - } - } else { - if (getAttackerClans().size() >= SiegeManager.getInstance().getAttackerMaxClans()) { - return; - } + if ((typeId == 0) || (typeId == 2) || (typeId == -1)) { + if ((getDefenderClans().size() + getDefenderWaitingClans().size()) >= SiegeManager.getInstance().getDefenderMaxClans()) { + return; } - - con = L2DatabaseFactory.getInstance().getConnection(); - PreparedStatement statement; - if (!isUpdateRegistration) { - statement = con.prepareStatement("INSERT INTO siege_clans (clan_id,castle_id,type,castle_owner) values (?,?,?,0)"); - statement.setInt(1, clan.getClanId()); - statement.setInt(2, getCastle().getCastleId()); - statement.setInt(3, typeId); - statement.execute(); - statement.close(); - } else { - statement = con.prepareStatement("Update siege_clans set type = ? where castle_id = ? and clan_id = ?"); - statement.setInt(1, typeId); - statement.setInt(2, getCastle().getCastleId()); - statement.setInt(3, clan.getClanId()); - statement.execute(); - statement.close(); + } else { + if (getAttackerClans().size() >= SiegeManager.getInstance().getAttackerMaxClans()) { + return; } + } - if ((typeId == 0) || (typeId == -1)) { - addDefender(clan.getClanId()); - announceToPlayer(clan.getName() + " has been registered to defend " + getCastle().getName(), false); - } else if (typeId == 1) { - addAttacker(clan.getClanId()); - announceToPlayer(clan.getName() + " has been registered to attack " + getCastle().getName(), false); - } else if (typeId == 2) { - addDefenderWaiting(clan.getClanId()); - announceToPlayer(clan.getName() + " has requested to defend " + getCastle().getName(), false); - } - } catch (Exception e) { - System.out.println("Exception: saveSiegeClan(L2Clan clan, int typeId, boolean isUpdateRegistration): " + e.getMessage()); - e.printStackTrace(); - } finally { - try { - con.close(); - } catch (Exception e) { - } + SiegeClanRepository repository = DatabaseAccess.getRepository(SiegeClanRepository.class); + if (!isUpdateRegistration) { + SiegeClan siegeClan = new SiegeClan(getCastle().getCastleId(), clan.getClanId(), typeId, 0); + repository.save(siegeClan); + } else { + repository.updateTypeByClan(getCastle().getCastleId(), clan.getClanId(), typeId); + } + + if ((typeId == 0) || (typeId == -1)) { + addDefender(clan.getClanId()); + announceToPlayer(clan.getName() + " has been registered to defend " + getCastle().getName(), false); + } else if (typeId == 1) { + addAttacker(clan.getClanId()); + announceToPlayer(clan.getName() + " has been registered to attack " + getCastle().getName(), false); + } else if (typeId == 2) { + addDefenderWaiting(clan.getClanId()); + announceToPlayer(clan.getName() + " has requested to defend " + getCastle().getName(), false); } } From cb2700c67efb5c969f96fcb9c4afb4687daa745d Mon Sep 17 00:00:00 2001 From: Alisson Oliveira Date: Sun, 6 May 2018 13:26:54 -0300 Subject: [PATCH 089/236] =?UTF-8?q?Remove=20refer=C3=AAncias=20diretas=20?= =?UTF-8?q?=C3=A0=20tabela=20skill=5Flearn?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../l2jbr/gameserver/datatables/NpcTable.java | 35 ++++++------------- .../gameserver/model/database/SkillLearn.java | 20 +++++++++-- .../repository/SkillLearnRepository.java | 7 ++++ 3 files changed, 35 insertions(+), 27 deletions(-) create mode 100644 Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/repository/SkillLearnRepository.java diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/datatables/NpcTable.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/datatables/NpcTable.java index 7fb6b1e8..4ac1744e 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/datatables/NpcTable.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/datatables/NpcTable.java @@ -32,6 +32,7 @@ import com.l2jbr.gameserver.model.database.repository.MinionRepository; import com.l2jbr.gameserver.model.database.repository.NpcRepository; import com.l2jbr.gameserver.model.database.repository.NpcSkillRepository; +import com.l2jbr.gameserver.model.database.repository.SkillLearnRepository; import com.l2jbr.gameserver.skills.Stats; import com.l2jbr.gameserver.templates.L2NpcTemplate; import com.l2jbr.gameserver.templates.StatsSet; @@ -144,33 +145,19 @@ private void restoreNpcData() { _log.error("NPCTable: Error reading NPC drop data: " + e); } - try { - PreparedStatement statement3 = con.prepareStatement("SELECT " + L2DatabaseFactory.getInstance().safetyString(new String[] - { - "npc_id", - "class_id" - }) + " FROM skill_learn"); - ResultSet learndata = statement3.executeQuery(); - - while (learndata.next()) { - int npcId = learndata.getInt("npc_id"); - int classId = learndata.getInt("class_id"); - L2NpcTemplate npc = getTemplate(npcId); - - if (npc == null) { - _log.warn("NPCTable: Error getting NPC template ID " + npcId + " while trying to load skill trainer data."); - continue; - } + SkillLearnRepository repository = DatabaseAccess.getRepository(SkillLearnRepository.class); + repository.findAll().forEach(skillLearn -> { + int npcId = skillLearn.getNpcId(); + int classId = skillLearn.getClassId(); + L2NpcTemplate npc = getTemplate(npcId); - npc.addTeachInfo(ClassId.values()[classId]); + if (npc == null) { + _log.warn("NPCTable: Error getting NPC template ID " + npcId + " while trying to load skill trainer data."); + return; } - learndata.close(); - statement3.close(); - } catch (Exception e) { - _log.error("NPCTable: Error reading NPC trainer data: " + e); - } - + npc.addTeachInfo(ClassId.values()[classId]); + }); MinionRepository minionRepository = DatabaseAccess.getRepository(MinionRepository.class); int cnt = 0; diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/SkillLearn.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/SkillLearn.java index 813a9b81..e164dfd0 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/SkillLearn.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/SkillLearn.java @@ -1,9 +1,23 @@ package com.l2jbr.gameserver.model.database; +import com.l2jbr.commons.database.annotation.Column; +import com.l2jbr.commons.database.annotation.Table; +import org.springframework.data.annotation.Id; - +@Table("skill_learn") public class SkillLearn { - private int npc_id; - private int class_id; + @Id + @Column("npc_id") + private int npcId; + @Column("class_id") + private int classId; + + public int getNpcId() { + return npcId; + } + + public int getClassId() { + return classId; + } } diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/repository/SkillLearnRepository.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/repository/SkillLearnRepository.java new file mode 100644 index 00000000..f559eacf --- /dev/null +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/repository/SkillLearnRepository.java @@ -0,0 +1,7 @@ +package com.l2jbr.gameserver.model.database.repository; + +import com.l2jbr.gameserver.model.database.SkillLearn; +import org.springframework.data.repository.CrudRepository; + +public interface SkillLearnRepository extends CrudRepository { +} From 6f7d37ccc1feb432e1673daec1d873ea474942ff Mon Sep 17 00:00:00 2001 From: Alisson Oliveira Date: Sun, 6 May 2018 13:32:48 -0300 Subject: [PATCH 090/236] =?UTF-8?q?Remove=20refer=C3=AAncias=20diretas=20?= =?UTF-8?q?=C3=A0=20tabela=20skill=5Fspellbooks?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../datatables/SkillSpellbookTable.java | 37 +++---------------- .../model/database/SkillSpellBooks.java | 20 ++++++++-- .../repository/SkillSpeelBooksRepository.java | 7 ++++ 3 files changed, 30 insertions(+), 34 deletions(-) create mode 100644 Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/repository/SkillSpeelBooksRepository.java diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/datatables/SkillSpellbookTable.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/datatables/SkillSpellbookTable.java index 75857b38..c7121893 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/datatables/SkillSpellbookTable.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/datatables/SkillSpellbookTable.java @@ -18,19 +18,14 @@ */ package com.l2jbr.gameserver.datatables; -import com.l2jbr.commons.database.L2DatabaseFactory; +import com.l2jbr.commons.database.DatabaseAccess; import com.l2jbr.gameserver.model.L2Skill; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; +import com.l2jbr.gameserver.model.database.repository.SkillSpeelBooksRepository; -import java.sql.PreparedStatement; -import java.sql.ResultSet; import java.util.LinkedHashMap; import java.util.Map; - public class SkillSpellbookTable { - private static Logger _log = LoggerFactory.getLogger(SkillTreeTable.class.getName()); private static SkillSpellbookTable _instance; private static Map _skillSpellbooks; @@ -39,42 +34,22 @@ public static SkillSpellbookTable getInstance() { if (_instance == null) { _instance = new SkillSpellbookTable(); } - return _instance; } private SkillSpellbookTable() { _skillSpellbooks = new LinkedHashMap<>(); java.sql.Connection con = null; - - try { - con = L2DatabaseFactory.getInstance().getConnection(); - PreparedStatement statement = con.prepareStatement("SELECT skill_id, item_id FROM skill_spellbooks"); - ResultSet spbooks = statement.executeQuery(); - - while (spbooks.next()) { - _skillSpellbooks.put(spbooks.getInt("skill_id"), spbooks.getInt("item_id")); - } - - spbooks.close(); - statement.close(); - - _log.info("SkillSpellbookTable: Loaded " + _skillSpellbooks.size() + " Spellbooks."); - } catch (Exception e) { - _log.warn("Error while loading spellbook data: " + e); - } finally { - try { - con.close(); - } catch (Exception e) { - } - } + SkillSpeelBooksRepository repository = DatabaseAccess.getRepository(SkillSpeelBooksRepository.class); + repository.findAll().forEach(skillSpellBooks -> { + _skillSpellbooks.put(skillSpellBooks.getSkillId(), skillSpellBooks.getItemId()); + }); } public int getBookForSkill(int skillId) { if (!_skillSpellbooks.containsKey(skillId)) { return -1; } - return _skillSpellbooks.get(skillId); } diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/SkillSpellBooks.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/SkillSpellBooks.java index fca23686..cf25a35f 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/SkillSpellBooks.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/SkillSpellBooks.java @@ -1,8 +1,22 @@ package com.l2jbr.gameserver.model.database; +import com.l2jbr.commons.database.annotation.Column; +import com.l2jbr.commons.database.annotation.Table; +import org.springframework.data.annotation.Id; - +@Table("skill_spellbooks") public class SkillSpellBooks { - private int skill_id; - private int item_id; + @Id + @Column("skill_id") + private int skillId; + @Column("item_id") + private int itemId; + + public int getSkillId() { + return skillId; + } + + public int getItemId() { + return itemId; + } } diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/repository/SkillSpeelBooksRepository.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/repository/SkillSpeelBooksRepository.java new file mode 100644 index 00000000..fe9ba6ac --- /dev/null +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/repository/SkillSpeelBooksRepository.java @@ -0,0 +1,7 @@ +package com.l2jbr.gameserver.model.database.repository; + +import com.l2jbr.gameserver.model.database.SkillSpellBooks; +import org.springframework.data.repository.CrudRepository; + +public interface SkillSpeelBooksRepository extends CrudRepository { +} From 7cfa5887fec5320b6e35560cd36bd8b296ce47ff Mon Sep 17 00:00:00 2001 From: Alisson Oliveira Date: Sun, 6 May 2018 15:13:58 -0300 Subject: [PATCH 091/236] =?UTF-8?q?Remove=20refer=C3=AAncias=20diretas=20?= =?UTF-8?q?=C3=A0=20tabela=20skill=5Ftrees?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../gameserver/datatables/SkillTreeTable.java | 63 ++++++------------- .../gameserver/model/database/SkillTrees.java | 38 +++++++++-- .../repository/SkillTreeRepository.java | 12 ++++ 3 files changed, 65 insertions(+), 48 deletions(-) create mode 100644 Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/repository/SkillTreeRepository.java diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/datatables/SkillTreeTable.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/datatables/SkillTreeTable.java index 9913840a..8c467e3c 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/datatables/SkillTreeTable.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/datatables/SkillTreeTable.java @@ -19,7 +19,6 @@ package com.l2jbr.gameserver.datatables; import com.l2jbr.commons.database.DatabaseAccess; -import com.l2jbr.commons.database.L2DatabaseFactory; import com.l2jbr.gameserver.model.L2EnchantSkillLearn; import com.l2jbr.gameserver.model.L2PledgeSkillLearn; import com.l2jbr.gameserver.model.L2Skill; @@ -27,17 +26,10 @@ import com.l2jbr.gameserver.model.actor.instance.L2PcInstance; import com.l2jbr.gameserver.model.base.ClassId; import com.l2jbr.gameserver.model.database.CharTemplate; -import com.l2jbr.gameserver.model.database.EnchantSkillTrees; -import com.l2jbr.gameserver.model.database.repository.CharTemplateRepository; -import com.l2jbr.gameserver.model.database.repository.EnchantSkillTreesRepository; -import com.l2jbr.gameserver.model.database.repository.FishingSkillTreeRepository; -import com.l2jbr.gameserver.model.database.repository.PledgeSkillTreesRepository; +import com.l2jbr.gameserver.model.database.repository.*; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import java.sql.Connection; -import java.sql.PreparedStatement; -import java.sql.ResultSet; import java.util.*; @@ -121,55 +113,38 @@ public int getMinSkillLevel(int skillId, int skillLvl) { private SkillTreeTable() { int count = 0; CharTemplateRepository charTemplateRepository = DatabaseAccess.getRepository(CharTemplateRepository.class); - Map map; + SkillTreeRepository skillTreeRepository = DatabaseAccess.getRepository(SkillTreeRepository.class); int parentClassId; int classId; - L2SkillLearn skillLearn; for (CharTemplate charTemplate : charTemplateRepository.findAll()) { - map = new LinkedHashMap<>(); + Map map = new LinkedHashMap<>(); parentClassId = charTemplate.getParentId(); classId = charTemplate.getId(); - try(Connection con = L2DatabaseFactory.getInstance().getConnection(); - PreparedStatement statement2 = con.prepareStatement("SELECT class_id, skill_id, level, name, sp, min_level FROM skill_trees where class_id=? ORDER BY skill_id, level")) { - - statement2.setInt(1, classId); - ResultSet skilltree = statement2.executeQuery(); - - if (parentClassId != -1) { - Map parentMap = getSkillTrees().get(ClassId.values()[parentClassId]); - map.putAll(parentMap); - } - - int prevSkillId = -1; - - while (skilltree.next()) { - int id = skilltree.getInt("skill_id"); - int lvl = skilltree.getInt("level"); - String name = skilltree.getString("name"); - int minLvl = skilltree.getInt("min_level"); - int cost = skilltree.getInt("sp"); + if (parentClassId != -1) { + Map parentMap = getSkillTrees().get(ClassId.values()[parentClassId]); + map.putAll(parentMap); + } - if (prevSkillId != id) { - prevSkillId = id; - } + skillTreeRepository.findAllByClassOrderBySkill(classId).forEach(skillTrees -> { + int id = skillTrees.getSkillId(); + int lvl = skillTrees.getLevel(); + String name = skillTrees.getName(); + int minLvl = skillTrees.getMinLevel(); + int cost = skillTrees.getSp(); - skillLearn = new L2SkillLearn(id, lvl, minLvl, name, cost, 0, 0); - map.put(SkillTable.getSkillHashCode(id, lvl), skillLearn); - } + L2SkillLearn skillLearn = new L2SkillLearn(id, lvl, minLvl, name, cost, 0, 0); + map.put(SkillTable.getSkillHashCode(id, lvl), skillLearn); + }); - getSkillTrees().put(ClassId.values()[classId], map); - count += map.size(); + getSkillTrees().put(ClassId.values()[classId], map); + count += map.size(); - _log.debug("SkillTreeTable: skill tree for class " + classId + " has " + map.size() + " skills"); - } catch (Exception e) { - _log.error("Error while creating skill tree (Class ID " + classId + "):" + e); - } + _log.debug("SkillTreeTable: skill tree for class {} has {} skills.", classId, map.size()); } _log.info("SkillTreeTable: Loaded " + count + " skills."); - // Skill tree for fishing skill (from Fisherman) _fishingSkillTrees = new LinkedList<>(); _expandDwarfCraftSkillTrees = new LinkedList<>(); diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/SkillTrees.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/SkillTrees.java index 742c4a98..d343da06 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/SkillTrees.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/SkillTrees.java @@ -1,14 +1,44 @@ package com.l2jbr.gameserver.model.database; +import com.l2jbr.commons.database.annotation.Column; +import com.l2jbr.commons.database.annotation.Table; +import org.springframework.data.annotation.Id; - +@Table("skill_trees") public class SkillTrees { - private int class_id; - private int skill_id; + @Id + @Column("class_id") + private int classId; + @Column("skill_id") + private int skillId; private int level; private String name; private int sp; - private int min_level; + @Column("min_level") + private int minLevel; + + public int getClassId() { + return classId; + } + + public int getSkillId() { + return skillId; + } + + public int getLevel() { + return level; + } + + public String getName() { + return name; + } + + public int getSp() { + return sp; + } + public int getMinLevel() { + return minLevel; + } } diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/repository/SkillTreeRepository.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/repository/SkillTreeRepository.java new file mode 100644 index 00000000..dbbd06de --- /dev/null +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/repository/SkillTreeRepository.java @@ -0,0 +1,12 @@ +package com.l2jbr.gameserver.model.database.repository; + +import com.l2jbr.gameserver.model.database.SkillTrees; +import org.springframework.data.jdbc.repository.query.Query; +import org.springframework.data.repository.CrudRepository; +import org.springframework.data.repository.query.Param; + +public interface SkillTreeRepository extends CrudRepository { + + @Query("SELECT * FROM skill_trees where class_id=:class ORDER BY skill_id, level") + Iterable findAllByClassOrderBySkill(@Param("class") int classId); +} From 49cd8404234b2cf1ab4747e042b04ce2ced112b2 Mon Sep 17 00:00:00 2001 From: Alisson Oliveira Date: Sun, 6 May 2018 15:41:37 -0300 Subject: [PATCH 092/236] =?UTF-8?q?Remove=20refer=C3=AAncias=20diretas=20?= =?UTF-8?q?=C3=A0=20tabela=20spawnlist?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../gameserver/datatables/SpawnTable.java | 132 +++++------------- .../gameserver/model/database/Spawnlist.java | 85 ++++++++++- .../repository/SpawnListRepository.java | 7 + 3 files changed, 125 insertions(+), 99 deletions(-) create mode 100644 Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/repository/SpawnListRepository.java diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/datatables/SpawnTable.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/datatables/SpawnTable.java index 3ecb9bcb..98e75397 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/datatables/SpawnTable.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/datatables/SpawnTable.java @@ -19,20 +19,19 @@ package com.l2jbr.gameserver.datatables; import com.l2jbr.commons.Config; -import com.l2jbr.commons.database.L2DatabaseFactory; +import com.l2jbr.commons.database.DatabaseAccess; import com.l2jbr.gameserver.instancemanager.DayNightSpawnManager; import com.l2jbr.gameserver.model.L2Spawn; import com.l2jbr.gameserver.model.actor.instance.L2PcInstance; +import com.l2jbr.gameserver.model.database.Spawnlist; +import com.l2jbr.gameserver.model.database.repository.SpawnListRepository; import com.l2jbr.gameserver.templates.L2NpcTemplate; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import java.sql.PreparedStatement; -import java.sql.ResultSet; import java.util.LinkedHashMap; import java.util.Map; - /** * This class ... * @@ -65,37 +64,31 @@ public Map getSpawnTable() { private void fillSpawnTable() { java.sql.Connection con = null; - - try { - con = L2DatabaseFactory.getInstance().getConnection(); - PreparedStatement statement = con.prepareStatement("SELECT id, count, npc_templateid, locx, locy, locz, heading, respawn_delay, loc_id, periodOfDay FROM spawnlist ORDER BY id"); - ResultSet rset = statement.executeQuery(); - - L2Spawn spawnDat; - L2NpcTemplate template1; - - while (rset.next()) { - template1 = NpcTable.getInstance().getTemplate(rset.getInt("npc_templateid")); - if (template1 != null) { - if (template1.type.equalsIgnoreCase("L2SiegeGuard")) { - // Don't spawn - } else if (template1.type.equalsIgnoreCase("L2RaidBoss")) { - // Don't spawn raidboss - } else if (!Config.ALLOW_CLASS_MASTERS && template1.type.equals("L2ClassMaster")) { - // Dont' spawn class masters - } else { + SpawnListRepository repository = DatabaseAccess.getRepository(SpawnListRepository.class); + repository.findAll().forEach(spawnlist -> { + L2NpcTemplate template1 = NpcTable.getInstance().getTemplate(spawnlist.getNpcTemplateId()); + if (template1 != null) { + if (template1.type.equalsIgnoreCase("L2SiegeGuard")) { + // Don't spawn + } else if (template1.type.equalsIgnoreCase("L2RaidBoss")) { + // Don't spawn raidboss + } else if (!Config.ALLOW_CLASS_MASTERS && template1.type.equals("L2ClassMaster")) { + // Dont' spawn class masters + } else { + L2Spawn spawnDat = null; + try { spawnDat = new L2Spawn(template1); - spawnDat.setId(rset.getInt("id")); - spawnDat.setAmount(rset.getInt("count")); - spawnDat.setLocx(rset.getInt("locx")); - spawnDat.setLocy(rset.getInt("locy")); - spawnDat.setLocz(rset.getInt("locz")); - spawnDat.setHeading(rset.getInt("heading")); - spawnDat.setRespawnDelay(rset.getInt("respawn_delay")); - int loc_id = rset.getInt("loc_id"); + spawnDat.setId(spawnlist.getId()); + spawnDat.setAmount(spawnlist.getCount()); + spawnDat.setLocx(spawnlist.getLocx()); + spawnDat.setLocy(spawnlist.getLocy()); + spawnDat.setLocz(spawnlist.getLocz()); + spawnDat.setHeading(spawnlist.getHeading()); + spawnDat.setRespawnDelay(spawnlist.getRespawnDelay()); + int loc_id = spawnlist.getLocId(); spawnDat.setLocation(loc_id); - switch (rset.getInt("periodOfDay")) { + switch (spawnlist.getPeriodOfDay()) { case 0: // default _npcSpawnCount += spawnDat.init(); break; @@ -113,30 +106,18 @@ private void fillSpawnTable() { if (spawnDat.getId() > _highestId) { _highestId = spawnDat.getId(); } + } catch (ClassNotFoundException | NoSuchMethodException e) { + _log.error("SpawnTable: Error on spawn id {}", spawnlist.getId()); + _log.error(e.getLocalizedMessage(), e); } - } else { - _log.warn("SpawnTable: Data missing in NPC table for ID: " + rset.getInt("npc_templateid") + "."); } + } else { + _log.warn("SpawnTable: Data missing in NPC table for ID: {} .", spawnlist.getNpcTemplateId()); } - rset.close(); - statement.close(); - } catch (Exception e) { - // problem with initializing spawn, go to next one - _log.warn("SpawnTable: Spawn could not be initialized: " + e); - e.printStackTrace(); - } finally { - try { - con.close(); - } catch (Exception e) { - } - } - - _log.info("SpawnTable: Loaded " + _spawntable.size() + " Npc Spawn Locations."); - - if (Config.DEBUG) { - _log.debug("SpawnTable: Spawning completed, total number of NPCs in the world: " + _npcSpawnCount); - } + }); + _log.info("SpawnTable: Loaded {} Npc Spawn Locations.", _spawntable.size()); + _log.debug("SpawnTable: Spawning completed, total number of NPCs in the world: {}", _npcSpawnCount); } public L2Spawn getTemplate(int id) { @@ -149,31 +130,9 @@ public void addNewSpawn(L2Spawn spawn, boolean storeInDb) { _spawntable.put(_highestId, spawn); if (storeInDb) { - java.sql.Connection con = null; - - try { - con = L2DatabaseFactory.getInstance().getConnection(); - PreparedStatement statement = con.prepareStatement("INSERT INTO spawnlist (id,count,npc_templateid,locx,locy,locz,heading,respawn_delay,loc_id) values(?,?,?,?,?,?,?,?,?)"); - statement.setInt(1, spawn.getId()); - statement.setInt(2, spawn.getAmount()); - statement.setInt(3, spawn.getNpcid()); - statement.setInt(4, spawn.getLocx()); - statement.setInt(5, spawn.getLocy()); - statement.setInt(6, spawn.getLocz()); - statement.setInt(7, spawn.getHeading()); - statement.setInt(8, spawn.getRespawnDelay() / 1000); - statement.setInt(9, spawn.getLocation()); - statement.execute(); - statement.close(); - } catch (Exception e) { - // problem with storing spawn - _log.warn("SpawnTable: Could not store spawn in the DB:" + e); - } finally { - try { - con.close(); - } catch (Exception e) { - } - } + Spawnlist spawnlist = new Spawnlist(spawn); + SpawnListRepository repository = DatabaseAccess.getRepository(SpawnListRepository.class); + repository.save(spawnlist); } } @@ -183,23 +142,8 @@ public void deleteSpawn(L2Spawn spawn, boolean updateDb) { } if (updateDb) { - java.sql.Connection con = null; - - try { - con = L2DatabaseFactory.getInstance().getConnection(); - PreparedStatement statement = con.prepareStatement("DELETE FROM spawnlist WHERE id=?"); - statement.setInt(1, spawn.getId()); - statement.execute(); - statement.close(); - } catch (Exception e) { - // problem with deleting spawn - _log.warn("SpawnTable: Spawn " + spawn.getId() + " could not be removed from DB: " + e); - } finally { - try { - con.close(); - } catch (Exception e) { - } - } + SpawnListRepository repository = DatabaseAccess.getRepository(SpawnListRepository.class); + repository.deleteById(spawn.getId()); } } diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/Spawnlist.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/Spawnlist.java index f037da19..0194dd61 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/Spawnlist.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/Spawnlist.java @@ -1,19 +1,94 @@ package com.l2jbr.gameserver.model.database; +import com.l2jbr.commons.database.annotation.Column; +import com.l2jbr.commons.database.model.Entity; +import com.l2jbr.gameserver.model.L2Spawn; +import org.springframework.data.annotation.Id; +public class Spawnlist extends Entity { -public class Spawnlist { + @Id private int id; private String location; private int count; - private int npc_templateid; + @Column("npc_templateid") + private int npcTemplateId; private int locx; private int locy; private int locz; private int randomx; private int randomy; private int heading; - private int respawn_delay; - private int loc_id; + @Column("respawn_delay") + private int respawnDelay; + @Column("loc_id") + private int locId; private int periodOfDay; -} + + public Spawnlist() { } + + public Spawnlist(L2Spawn spawn) { + this.id = spawn.getId(); + this.count = spawn.getAmount(); + this.npcTemplateId = spawn.getNpcid(); + this.locx = spawn.getLocx(); + this.locy = spawn.getLocy(); + this.locz = spawn.getLocz(); + this.heading = spawn.getHeading(); + this.respawnDelay = spawn.getRespawnDelay() / 1000; + this.locId = spawn.getLocation(); + } + + @Override + public Integer getId() { + return id; + } + + public String getLocation() { + return location; + } + + public int getCount() { + return count; + } + + public int getNpcTemplateId() { + return npcTemplateId; + } + + public int getLocx() { + return locx; + } + + public int getLocy() { + return locy; + } + + public int getLocz() { + return locz; + } + + public int getRandomx() { + return randomx; + } + + public int getRandomy() { + return randomy; + } + + public int getHeading() { + return heading; + } + + public int getRespawnDelay() { + return respawnDelay; + } + + public int getLocId() { + return locId; + } + + public int getPeriodOfDay() { + return periodOfDay; + } +} \ No newline at end of file diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/repository/SpawnListRepository.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/repository/SpawnListRepository.java new file mode 100644 index 00000000..7b64528a --- /dev/null +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/repository/SpawnListRepository.java @@ -0,0 +1,7 @@ +package com.l2jbr.gameserver.model.database.repository; + +import com.l2jbr.gameserver.model.database.Spawnlist; +import org.springframework.data.repository.CrudRepository; + +public interface SpawnListRepository extends CrudRepository { +} From a0f00afd3a7f0c35965399bebd4ecb13814d08b2 Mon Sep 17 00:00:00 2001 From: Alisson Oliveira Date: Sun, 6 May 2018 15:54:55 -0300 Subject: [PATCH 093/236] =?UTF-8?q?Remove=20refer=C3=AAncias=20diretas=20?= =?UTF-8?q?=C3=A0=20tabela=20teleport?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../datatables/TeleportLocationTable.java | 62 +++++-------------- .../gameserver/model/database/Teleport.java | 44 +++++++++++-- .../repository/TeleportRepository.java | 7 +++ 3 files changed, 63 insertions(+), 50 deletions(-) create mode 100644 Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/repository/TeleportRepository.java diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/datatables/TeleportLocationTable.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/datatables/TeleportLocationTable.java index fe16885d..35cd027e 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/datatables/TeleportLocationTable.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/datatables/TeleportLocationTable.java @@ -18,22 +18,15 @@ */ package com.l2jbr.gameserver.datatables; -import com.l2jbr.commons.database.L2DatabaseFactory; +import com.l2jbr.commons.database.DatabaseAccess; import com.l2jbr.gameserver.model.L2TeleportLocation; +import com.l2jbr.gameserver.model.database.repository.TeleportRepository; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import java.sql.PreparedStatement; -import java.sql.ResultSet; import java.util.LinkedHashMap; import java.util.Map; - -/** - * This class ... - * - * @version $Revision: 1.3.2.2.2.3 $ $Date: 2005/03/27 15:29:18 $ - */ public class TeleportLocationTable { private static Logger _log = LoggerFactory.getLogger(TeleportLocationTable.class.getName()); @@ -54,45 +47,22 @@ private TeleportLocationTable() { public void reloadAll() { _teleports = new LinkedHashMap<>(); - - java.sql.Connection con = null; - try { - con = L2DatabaseFactory.getInstance().getConnection(); - PreparedStatement statement = con.prepareStatement("SELECT Description, id, loc_x, loc_y, loc_z, price, fornoble FROM teleport"); - ResultSet rset = statement.executeQuery(); - L2TeleportLocation teleport; - - while (rset.next()) { - teleport = new L2TeleportLocation(); - - teleport.setTeleId(rset.getInt("id")); - teleport.setLocX(rset.getInt("loc_x")); - teleport.setLocY(rset.getInt("loc_y")); - teleport.setLocZ(rset.getInt("loc_z")); - teleport.setPrice(rset.getInt("price")); - teleport.setIsForNoble(rset.getInt("fornoble") == 1); - - _teleports.put(teleport.getTeleId(), teleport); - } - - rset.close(); - statement.close(); - - _log.info("TeleportLocationTable: Loaded " + _teleports.size() + " Teleport Location Templates."); - } catch (Exception e) { - _log.warn("error while creating teleport table " + e); - } finally { - try { - con.close(); - } catch (Exception e) { - } - } + TeleportRepository repository = DatabaseAccess.getRepository(TeleportRepository.class); + repository.findAll().forEach(teleportData -> { + L2TeleportLocation teleport = new L2TeleportLocation(); + + teleport.setTeleId(teleportData.getId()); + teleport.setLocX(teleportData.getLocX()); + teleport.setLocY(teleportData.getLocY()); + teleport.setLocZ(teleportData.getLocZ()); + teleport.setPrice(teleportData.getPrice()); + teleport.setIsForNoble(teleportData.getFornoble() == 1); + + _teleports.put(teleport.getTeleId(), teleport); + }); + _log.info("TeleportLocationTable: Loaded {} Teleport Location Templates.", _teleports.size()); } - /** - * @param id - * @return - */ public L2TeleportLocation getTemplate(int id) { return _teleports.get(id); } diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/Teleport.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/Teleport.java index 7400323c..f850d292 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/Teleport.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/Teleport.java @@ -1,11 +1,47 @@ package com.l2jbr.gameserver.model.database; +import com.l2jbr.commons.database.annotation.Column; +import org.springframework.data.annotation.Id; + public class Teleport { - private String Description; + + @Id private int id; - private int loc_x; - private int loc_y; - private int loc_z; + private String Description; + @Column("loc_x") + private int locX; + @Column("loc_y") + private int locY; + @Column("loc_z") + private int locZ; private int price; private int fornoble; + + public int getId() { + return id; + } + + public String getDescription() { + return Description; + } + + public int getLocX() { + return locX; + } + + public int getLocY() { + return locY; + } + + public int getLocZ() { + return locZ; + } + + public int getPrice() { + return price; + } + + public int getFornoble() { + return fornoble; + } } diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/repository/TeleportRepository.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/repository/TeleportRepository.java new file mode 100644 index 00000000..b04c2f39 --- /dev/null +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/repository/TeleportRepository.java @@ -0,0 +1,7 @@ +package com.l2jbr.gameserver.model.database.repository; + +import com.l2jbr.gameserver.model.database.Teleport; +import org.springframework.data.repository.CrudRepository; + +public interface TeleportRepository extends CrudRepository { +} From 8f6265cf9a202c1c60fa044b8fe9836c239887c4 Mon Sep 17 00:00:00 2001 From: Alisson Oliveira Date: Sun, 6 May 2018 16:08:51 -0300 Subject: [PATCH 094/236] =?UTF-8?q?Remove=20refer=C3=AAncias=20diretas=20?= =?UTF-8?q?=C3=A0=20tabela=20walker=5Froutes?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../datatables/NpcWalkerRoutesTable.java | 48 +++------------ .../gameserver/model/L2NpcWalkerNode.java | 42 ++++++------- .../model/database/WalkerRoutes.java | 60 ++++++++++++++++--- .../repository/WalkerRoutesRepository.java | 7 +++ 4 files changed, 85 insertions(+), 72 deletions(-) create mode 100644 Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/repository/WalkerRoutesRepository.java diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/datatables/NpcWalkerRoutesTable.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/datatables/NpcWalkerRoutesTable.java index b090be5a..f70565c2 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/datatables/NpcWalkerRoutesTable.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/datatables/NpcWalkerRoutesTable.java @@ -18,13 +18,12 @@ */ package com.l2jbr.gameserver.datatables; -import com.l2jbr.commons.database.L2DatabaseFactory; +import com.l2jbr.commons.database.DatabaseAccess; import com.l2jbr.gameserver.model.L2NpcWalkerNode; +import com.l2jbr.gameserver.model.database.repository.WalkerRoutesRepository; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import java.sql.PreparedStatement; -import java.sql.ResultSet; import java.util.LinkedList; import java.util.List; @@ -47,52 +46,21 @@ public static NpcWalkerRoutesTable getInstance() { _instance = new NpcWalkerRoutesTable(); _log.info("Initializing Walkers Routes Table."); } - return _instance; } private NpcWalkerRoutesTable() { } - // FIXME: NPE while loading. :S public void load() { _routes = new LinkedList<>(); - java.sql.Connection con = null; - try { - con = L2DatabaseFactory.getInstance().getConnection(); - PreparedStatement statement = con.prepareStatement("SELECT route_id, npc_id, move_point, chatText, move_x, move_y, move_z, delay, running FROM walker_routes"); - ResultSet rset = statement.executeQuery(); - L2NpcWalkerNode route; - while (rset.next()) { - route = new L2NpcWalkerNode(); - route.setRouteId(rset.getInt("route_id")); - route.setNpcId(rset.getInt("npc_id")); - route.setMovePoint(rset.getString("move_point")); - route.setChatText(rset.getString("chatText")); - - route.setMoveX(rset.getInt("move_x")); - route.setMoveY(rset.getInt("move_y")); - route.setMoveZ(rset.getInt("move_z")); - route.setDelay(rset.getInt("delay")); - route.setRunning(rset.getBoolean("running")); - - _routes.add(route); - } + WalkerRoutesRepository repository = DatabaseAccess.getRepository(WalkerRoutesRepository.class); + repository.findAll().forEach(walkerRoutes -> { + L2NpcWalkerNode route = new L2NpcWalkerNode(walkerRoutes); + _routes.add(route); + }); - rset.close(); - statement.close(); - - _log.info("WalkerRoutesTable: Loaded " + _routes.size() + " Npc Walker Routes."); - rset.close(); - statement.close(); - } catch (Exception e) { - _log.error("WalkerRoutesTable: Error while loading Npc Walkers Routes: " + e.getMessage()); - } finally { - try { - con.close(); - } catch (Exception e) { - } - } + _log.info("WalkerRoutesTable: Loaded {} Npc Walker Routes.", _routes.size()); } public List getRouteForNpc(int id) { diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/L2NpcWalkerNode.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/L2NpcWalkerNode.java index 2dbd2e59..ae0274d2 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/L2NpcWalkerNode.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/L2NpcWalkerNode.java @@ -18,7 +18,7 @@ */ package com.l2jbr.gameserver.model; -import com.l2jbr.gameserver.templates.StatsSet; +import com.l2jbr.gameserver.model.database.WalkerRoutes; /** @@ -29,7 +29,7 @@ public class L2NpcWalkerNode { private int _routeId; private int _npcId; - private String _movePoint; + private int _movePoint; private String _chatText; private int _moveX; private int _moveY; @@ -37,7 +37,19 @@ public class L2NpcWalkerNode private int _delay; private boolean _running; - + + public L2NpcWalkerNode(WalkerRoutes walkerRoutes) { + this._routeId = walkerRoutes.getRouteId(); + this._npcId = walkerRoutes.getNpcId(); + this._movePoint = walkerRoutes.getMovePoint(); + this._chatText = walkerRoutes.getChatText(); + this._moveX = walkerRoutes.getMoveX(); + this._moveY = walkerRoutes.getMoveY(); + this._moveZ = walkerRoutes.getMoveZ(); + this._delay = walkerRoutes.getDelay(); + this._running = walkerRoutes.getRunning() == 1; + } + public void setRunning(boolean val) { _running = val; @@ -53,7 +65,7 @@ public void setNpcId(int id) _npcId = id; } - public void setMovePoint(String val) + public void setMovePoint(int val) { _movePoint = val; } @@ -93,7 +105,7 @@ public int getNpcId() return _npcId; } - public String getMovePoint() + public int getMovePoint() { return _movePoint; } @@ -127,24 +139,4 @@ public boolean getRunning() { return _running; } - - public L2NpcWalkerNode() - { - - } - - /** - * Constructor of L2NpcWalker. - * @param set The StatsSet object to transfer data to the method - */ - public L2NpcWalkerNode(StatsSet set) - { - _npcId = set.getInteger("npc_id"); - _movePoint = set.getString("move_point"); - _chatText = set.getString("chatText"); - _moveX = set.getInteger("move_x"); - _moveX = set.getInteger("move_y"); - _moveX = set.getInteger("move_z"); - _delay = set.getInteger("delay"); - } } diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/WalkerRoutes.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/WalkerRoutes.java index 1e2e1794..218be611 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/WalkerRoutes.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/WalkerRoutes.java @@ -1,15 +1,61 @@ package com.l2jbr.gameserver.model.database; +import com.l2jbr.commons.database.annotation.Column; +import com.l2jbr.commons.database.annotation.Table; +import org.springframework.data.annotation.Id; - +@Table("walker_routes") public class WalkerRoutes { - private int route_id; - private int npc_id; - private int move_point; + @Id + @Column("route_id") + private int routeId; + @Column("npc_id") + private int npcId; + @Column("move_point") + private int movePoint; private String chatText; - private int move_x; - private int move_y; - private int move_z; + @Column("move_x") + private int moveX; + @Column("move_y") + private int moveY; + @Column("move_z") + private int moveZ; private int delay; private int running; + + public int getRouteId() { + return routeId; + } + + public int getNpcId() { + return npcId; + } + + public int getMovePoint() { + return movePoint; + } + + public String getChatText() { + return chatText; + } + + public int getMoveX() { + return moveX; + } + + public int getMoveY() { + return moveY; + } + + public int getMoveZ() { + return moveZ; + } + + public int getDelay() { + return delay; + } + + public int getRunning() { + return running; + } } diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/repository/WalkerRoutesRepository.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/repository/WalkerRoutesRepository.java new file mode 100644 index 00000000..716f47cc --- /dev/null +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/repository/WalkerRoutesRepository.java @@ -0,0 +1,7 @@ +package com.l2jbr.gameserver.model.database.repository; + +import com.l2jbr.gameserver.model.database.WalkerRoutes; +import org.springframework.data.repository.CrudRepository; + +public interface WalkerRoutesRepository extends CrudRepository { +} From d8837039e4ea2ad3d1494c6b67c7564f7965d47d Mon Sep 17 00:00:00 2001 From: Alisson Oliveira Date: Sun, 6 May 2018 17:27:40 -0300 Subject: [PATCH 095/236] =?UTF-8?q?Remove=20refer=C3=AAncias=20diretas=20?= =?UTF-8?q?=C3=A0=20tabela=20zone=5Fvertices?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../sql/experimental/l2j_full_structure.sql | 21 --- .../l2jbr/gameserver/datatables/ZoneData.java | 148 ++++-------------- .../l2jbr/gameserver/model/database/Zone.java | 16 -- .../model/database/ZoneVertices.java | 21 ++- .../repository/ZoneVerticesRepository.java | 14 ++ 5 files changed, 67 insertions(+), 153 deletions(-) delete mode 100644 Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/Zone.java create mode 100644 Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/repository/ZoneVerticesRepository.java diff --git a/Datapack/sql/experimental/l2j_full_structure.sql b/Datapack/sql/experimental/l2j_full_structure.sql index c32349b3..7ea89d55 100644 --- a/Datapack/sql/experimental/l2j_full_structure.sql +++ b/Datapack/sql/experimental/l2j_full_structure.sql @@ -2169,27 +2169,6 @@ CREATE TABLE IF NOT EXISTS `walker_routes` ( ENGINE = InnoDB DEFAULT CHARACTER SET = latin1; - --- ----------------------------------------------------- --- Table `zone` --- ----------------------------------------------------- -DROP TABLE IF EXISTS `zone` ; - -CREATE TABLE IF NOT EXISTS `zone` ( - `id` INT(11) NOT NULL DEFAULT '0', - `type` VARCHAR(25) NOT NULL, - `name` VARCHAR(40) NOT NULL, - `x1` INT(11) NOT NULL DEFAULT '0', - `y1` INT(11) NOT NULL DEFAULT '0', - `x2` INT(11) NOT NULL DEFAULT '0', - `y2` INT(11) NOT NULL DEFAULT '0', - `z` INT(11) NOT NULL DEFAULT '0', - `z2` INT(11) NOT NULL DEFAULT '0', - `taxById` INT(11) NOT NULL DEFAULT '0') -ENGINE = InnoDB -DEFAULT CHARACTER SET = latin1; - - -- ----------------------------------------------------- -- Table `zone_vertices` -- ----------------------------------------------------- diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/datatables/ZoneData.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/datatables/ZoneData.java index b28f7086..8311a419 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/datatables/ZoneData.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/datatables/ZoneData.java @@ -18,13 +18,15 @@ package com.l2jbr.gameserver.datatables; import com.l2jbr.commons.Config; -import com.l2jbr.commons.database.L2DatabaseFactory; +import com.l2jbr.commons.database.DatabaseAccess; import com.l2jbr.gameserver.instancemanager.ArenaManager; import com.l2jbr.gameserver.instancemanager.FishingZoneManager; import com.l2jbr.gameserver.instancemanager.OlympiadStadiaManager; import com.l2jbr.gameserver.instancemanager.TownManager; import com.l2jbr.gameserver.model.L2World; import com.l2jbr.gameserver.model.L2WorldRegion; +import com.l2jbr.gameserver.model.database.ZoneVertices; +import com.l2jbr.gameserver.model.database.repository.ZoneVerticesRepository; import com.l2jbr.gameserver.model.zone.L2ZoneType; import com.l2jbr.gameserver.model.zone.form.ZoneCuboid; import com.l2jbr.gameserver.model.zone.form.ZoneNPoly; @@ -37,9 +39,6 @@ import javax.xml.parsers.DocumentBuilderFactory; import java.io.File; -import java.sql.PreparedStatement; -import java.sql.ResultSet; -import java.util.LinkedList; import java.util.List; @@ -51,55 +50,38 @@ public class ZoneData { private static final Logger _log = LoggerFactory.getLogger(ZoneData.class.getName()); - // ========================================================= private static ZoneData _instance; - public static final ZoneData getInstance() { + public static ZoneData getInstance() { if (_instance == null) { _instance = new ZoneData(); } return _instance; } - // ========================================================= - // Data Field - - // ========================================================= - // Constructor - public ZoneData() { + private ZoneData() { _log.info("Loading zones..."); - load(); } - // ========================================================= - // Method - Private - - private final void load() { - java.sql.Connection con = null; + private void load() { int zoneCount = 0; - // Get the world regions L2WorldRegion[][] worldRegions = L2World.getInstance().getAllWorldRegions(); - // Load the zone xml try { - // Get a sql connection here - con = L2DatabaseFactory.getInstance().getConnection(); - DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); factory.setValidating(false); factory.setIgnoringComments(true); File file = new File(Config.DATAPACK_ROOT + "/data/zones/zone.xml"); if (!file.exists()) { - if (Config.DEBUG) { - _log.info("The zone.xml file is missing."); - } + _log.warn("The {} file is missing.", file.getAbsolutePath()); return; } Document doc = factory.newDocumentBuilder().parse(file); + ZoneVerticesRepository repository = DatabaseAccess.getRepository(ZoneVerticesRepository.class); for (Node n = doc.getFirstChild(); n != null; n = n.getNextSibling()) { if ("list".equalsIgnoreCase(n.getNodeName())) { @@ -112,7 +94,6 @@ private final void load() { String zoneType = attrs.getNamedItem("type").getNodeValue(); String zoneShape = attrs.getNamedItem("shape").getNodeValue(); - // Create the zone L2ZoneType temp = null; if (zoneType.equals("FishingZone")) { @@ -143,95 +124,40 @@ private final void load() { temp = new L2DerbyTrackZone(); } - // Check for unknown type if (temp == null) { - _log.warn("ZoneData: No such zone type: " + zoneType); + _log.warn("ZoneData: No such zone type: {}", zoneType); continue; } - // Get the zone shape from sql - try { - PreparedStatement statement = null; + List vertices = repository.findAllOrderedById(zoneId); - // Set the correct query - statement = con.prepareStatement("SELECT x,y FROM zone_vertices WHERE id=? ORDER BY 'order' ASC "); + // Create this zone. Parsing for cuboids is a bit different than for other polygons + // cuboids need exactly 2 points to be defined. Other polygons need at least 3 (one per vertex) + if (zoneShape.equals("Cuboid")) { - statement.setInt(1, zoneId); - ResultSet rset = statement.executeQuery(); - - // Create this zone. Parsing for cuboids is a bit different than for other polygons - // cuboids need exactly 2 points to be defined. Other polygons need at least 3 (one per vertex) - if (zoneShape.equals("Cuboid")) { - int[] x = - { - 0, - 0 - }; - int[] y = - { - 0, - 0 - }; - boolean successfulLoad = true; - - for (int i = 0; i < 2; i++) { - if (rset.next()) { - x[i] = rset.getInt("x"); - y[i] = rset.getInt("y"); - } else { - _log.warn("ZoneData: Missing cuboid vertex in sql data for zone: " + zoneId); - rset.close(); - statement.close(); - successfulLoad = false; - break; - } - } - - if (successfulLoad) { - temp.setZone(new ZoneCuboid(x[0], x[1], y[0], y[1], minZ, maxZ)); - } else { - continue; - } - } else if (zoneShape.equals("NPoly")) { - List fl_x = new LinkedList<>(), fl_y = new LinkedList<>(); - - // Load the rest - while (rset.next()) { - fl_x.add(rset.getInt("x")); - fl_y.add(rset.getInt("y")); - } + if(vertices.size() < 2) { + _log.warn("ZoneData: Missing cuboid vertex in sql data for zone: {}", zoneId); + continue; + } - // An nPoly needs to have at least 3 vertices - if ((fl_x.size() == fl_y.size()) && (fl_x.size() > 2)) { - // Create arrays - int[] aX = new int[fl_x.size()]; - int[] aY = new int[fl_y.size()]; + int[] x = vertices.stream().mapToInt(ZoneVertices::getX).toArray(); + int[] y = vertices.stream().mapToInt(ZoneVertices::getY).toArray(); - // This runs only at server startup so dont complain :> - for (int i = 0; i < fl_x.size(); i++) { - aX[i] = fl_x.get(i); - aY[i] = fl_y.get(i); - } + temp.setZone(new ZoneCuboid(x[0], x[1], y[0], y[1], minZ, maxZ)); + } else if (zoneShape.equals("NPoly")) { + // An nPoly needs to have at least 3 vertices + if (vertices.size() > 2) { + int[] aX = vertices.stream().mapToInt(ZoneVertices::getX).toArray(); + int[] aY = vertices.stream().mapToInt(ZoneVertices::getY).toArray(); - // Create the zone - temp.setZone(new ZoneNPoly(aX, aY, minZ, maxZ)); - } else { - _log.warn("ZoneData: Bad sql data for zone: " + zoneId); - rset.close(); - statement.close(); - continue; - } + temp.setZone(new ZoneNPoly(aX, aY, minZ, maxZ)); } else { - _log.warn("ZoneData: Unknown shape: " + zoneShape); - rset.close(); - statement.close(); + _log.warn("ZoneData: Bad sql data for zone: {}", zoneId); continue; } - - rset.close(); - statement.close(); - } catch (Exception e) { - _log.warn("ZoneData: Failed to load zone coordinates: " + e); + } else { + _log.warn("ZoneData: Unknown shape: {}", zoneShape); + continue; } // Check for aditional parameters @@ -262,15 +188,13 @@ private final void load() { by = ((y + 1) - L2World.OFFSET_Y) << L2World.SHIFT_BY; if (temp.getZone().intersectsRectangle(ax, bx, ay, by)) { - if (Config.DEBUG) { - _log.info("Zone (" + zoneId + ") added to: " + x + " " + y); - } worldRegions[x][y].addZone(temp); + _log.debug("Zone ( {} ) added to: {}, {}.", zoneId, x, y); } } } - // Special managers for arenas, towns... + if (temp instanceof L2ArenaZone) { ArenaManager.getInstance().addArena((L2ArenaZone) temp); } else if (temp instanceof L2TownZone) { @@ -279,7 +203,6 @@ private final void load() { OlympiadStadiaManager.getInstance().addStadium((L2OlympiadStadiumZone) temp); } - // Increase the counter zoneCount++; } } @@ -288,13 +211,8 @@ private final void load() { } catch (Exception e) { _log.error( "Error while loading zones.", e); return; - } finally { - try { - con.close(); - } catch (Exception e) { - } } - _log.info("Done: loaded " + zoneCount + " zones."); + _log.info("Done: loaded {} zones.", zoneCount); } } diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/Zone.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/Zone.java deleted file mode 100644 index 6d7ad504..00000000 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/Zone.java +++ /dev/null @@ -1,16 +0,0 @@ -package com.l2jbr.gameserver.model.database; - - - -public class Zone { - private int id; - private String type; - private String name; - private int x1; - private int y1; - private int x2; - private int y2; - private int z; - private int z2; - private int taxById; -} diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/ZoneVertices.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/ZoneVertices.java index 69f22210..e02f7779 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/ZoneVertices.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/ZoneVertices.java @@ -1,10 +1,29 @@ package com.l2jbr.gameserver.model.database; +import com.l2jbr.commons.database.annotation.Table; +import org.springframework.data.annotation.Id; - +@Table("zone_vertices") public class ZoneVertices { + @Id private int id; private int order; private int x; private int y; + + public int getId() { + return id; + } + + public int getOrder() { + return order; + } + + public int getX() { + return x; + } + + public int getY() { + return y; + } } diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/repository/ZoneVerticesRepository.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/repository/ZoneVerticesRepository.java new file mode 100644 index 00000000..d3925a00 --- /dev/null +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/repository/ZoneVerticesRepository.java @@ -0,0 +1,14 @@ +package com.l2jbr.gameserver.model.database.repository; + +import com.l2jbr.gameserver.model.database.ZoneVertices; +import org.springframework.data.jdbc.repository.query.Query; +import org.springframework.data.repository.CrudRepository; +import org.springframework.data.repository.query.Param; + +import java.util.List; + +public interface ZoneVerticesRepository extends CrudRepository { + + @Query("SELECT * FROM zone_vertices WHERE id=? ORDER BY 'order' ASC ") + List findAllOrderedById(@Param("zone") int zoneId); +} \ No newline at end of file From 3c8d670db4ade0a89eaebd208212a2ab6ca56bd1 Mon Sep 17 00:00:00 2001 From: Alisson Oliveira Date: Sun, 6 May 2018 18:39:13 -0300 Subject: [PATCH 096/236] =?UTF-8?q?Adiciona=20nomes=20a=20tabelas=20para?= =?UTF-8?q?=20serem=20comp=C3=A1tivel=20com=20sistemas=20Unix?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Em consideração que o MySQL pode guardar as tabelas como arquivos, utilizando assim as propriedade do sistema de arquivo da máquina. É necessário que o acesso a tabelas sejam com case sensitive, visto que muitos sistemas linux usam case sensitive em seus sistema de arquivos --- .../commons/database/model/GameServers.java | 2 ++ .../l2jbr/gameserver/datatables/ZoneData.java | 2 -- .../gameserver/model/database/Armor.java | 2 ++ .../model/database/AuctionData.java | 2 ++ .../gameserver/model/database/Character.java | 2 ++ .../model/database/ClanHallData.java | 3 ++- .../gameserver/model/database/DropList.java | 1 + .../gameserver/model/database/EtcItem.java | 2 ++ .../l2jbr/gameserver/model/database/Fish.java | 3 ++- .../gameserver/model/database/Forums.java | 2 ++ .../gameserver/model/database/Games.java | 2 ++ .../gameserver/model/database/Henna.java | 25 ++++++++++++------- .../gameserver/model/database/Heroes.java | 2 ++ .../gameserver/model/database/Items.java | 2 ++ .../model/database/ItemsOnGround.java | 2 ++ .../gameserver/model/database/Locations.java | 2 ++ .../gameserver/model/database/MapRegion.java | 3 +++ .../gameserver/model/database/Minions.java | 3 ++- .../l2jbr/gameserver/model/database/Npc.java | 2 ++ .../gameserver/model/database/NpcSkills.java | 2 ++ .../l2jbr/gameserver/model/database/Pets.java | 2 ++ .../gameserver/model/database/Posts.java | 2 ++ .../gameserver/model/database/Spawnlist.java | 2 ++ .../gameserver/model/database/Teleport.java | 2 ++ .../gameserver/model/database/Topic.java | 2 ++ .../gameserver/model/database/Weapon.java | 2 ++ 26 files changed, 64 insertions(+), 14 deletions(-) diff --git a/Commons/src/main/com.l2jbr.commons/com/l2jbr/commons/database/model/GameServers.java b/Commons/src/main/com.l2jbr.commons/com/l2jbr/commons/database/model/GameServers.java index 27bcded1..61e17881 100644 --- a/Commons/src/main/com.l2jbr.commons/com/l2jbr/commons/database/model/GameServers.java +++ b/Commons/src/main/com.l2jbr.commons/com/l2jbr/commons/database/model/GameServers.java @@ -1,8 +1,10 @@ package com.l2jbr.commons.database.model; import com.l2jbr.commons.database.annotation.Column; +import com.l2jbr.commons.database.annotation.Table; import org.springframework.data.annotation.Id; +@Table("gameservers") public class GameServers extends Entity { @Id @Column("server_id") diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/datatables/ZoneData.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/datatables/ZoneData.java index 8311a419..389bee7d 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/datatables/ZoneData.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/datatables/ZoneData.java @@ -41,7 +41,6 @@ import java.io.File; import java.util.List; - /** * This class manages the augmentation data and can also create new augmentations. * @@ -194,7 +193,6 @@ private void load() { } } - if (temp instanceof L2ArenaZone) { ArenaManager.getInstance().addArena((L2ArenaZone) temp); } else if (temp instanceof L2TownZone) { diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/Armor.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/Armor.java index 6eafcdaa..5d5e9034 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/Armor.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/Armor.java @@ -2,8 +2,10 @@ import com.l2jbr.commons.database.annotation.Column; +import com.l2jbr.commons.database.annotation.Table; import com.l2jbr.commons.database.model.Entity; +@Table("armor") public class Armor extends Entity { private int itemId; diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/AuctionData.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/AuctionData.java index 3675acdc..41dd46f1 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/AuctionData.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/AuctionData.java @@ -1,9 +1,11 @@ package com.l2jbr.gameserver.model.database; +import com.l2jbr.commons.database.annotation.Table; import com.l2jbr.commons.database.model.Entity; import org.springframework.data.annotation.Id; +@Table("auction") public class AuctionData extends Entity { @Id diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/Character.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/Character.java index e91d1e8d..b19ead03 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/Character.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/Character.java @@ -1,9 +1,11 @@ package com.l2jbr.gameserver.model.database; import com.l2jbr.commons.database.annotation.Column; +import com.l2jbr.commons.database.annotation.Table; import com.l2jbr.commons.database.model.Entity; import org.springframework.data.annotation.Id; +@Table("characters") public class Character extends Entity { @Id diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/ClanHallData.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/ClanHallData.java index c38a1159..8b276d0f 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/ClanHallData.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/ClanHallData.java @@ -1,9 +1,10 @@ package com.l2jbr.gameserver.model.database; - +import com.l2jbr.commons.database.annotation.Table; import com.l2jbr.commons.database.model.Entity; import org.springframework.data.annotation.Id; +@Table("clanhall") public class ClanHallData extends Entity { @Id diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/DropList.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/DropList.java index dd9efbab..430add4e 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/DropList.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/DropList.java @@ -4,6 +4,7 @@ import com.l2jbr.commons.database.model.Entity; import org.springframework.data.annotation.Id; +@Table("droplist") public class DropList extends Entity { @Id private int mobId; diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/EtcItem.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/EtcItem.java index a3cdf65e..f8ba59e5 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/EtcItem.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/EtcItem.java @@ -1,7 +1,9 @@ package com.l2jbr.gameserver.model.database; +import com.l2jbr.commons.database.annotation.Table; import org.springframework.data.annotation.Id; +@Table("etcitem") public class EtcItem { @Id private int item_id; diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/Fish.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/Fish.java index 9e827f47..b17f8df8 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/Fish.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/Fish.java @@ -1,9 +1,10 @@ package com.l2jbr.gameserver.model.database; - import com.l2jbr.commons.database.annotation.Column; +import com.l2jbr.commons.database.annotation.Table; import org.springframework.data.annotation.Id; +@Table("fish") public class Fish { @Id private int id; diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/Forums.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/Forums.java index 32269244..b9671872 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/Forums.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/Forums.java @@ -1,11 +1,13 @@ package com.l2jbr.gameserver.model.database; import com.l2jbr.commons.database.annotation.Column; +import com.l2jbr.commons.database.annotation.Table; import com.l2jbr.commons.database.model.Entity; import org.springframework.data.annotation.Id; import java.util.Set; +@Table("forums") public class Forums extends Entity { @Id @Column("forum_id") diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/Games.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/Games.java index e0be85ea..97e4e8a2 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/Games.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/Games.java @@ -1,8 +1,10 @@ package com.l2jbr.gameserver.model.database; +import com.l2jbr.commons.database.annotation.Table; import com.l2jbr.commons.database.model.Entity; import org.springframework.data.annotation.Id; +@Table("games") public class Games extends Entity { @Id private int idnr; diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/Henna.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/Henna.java index 7a766c3d..27c66eab 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/Henna.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/Henna.java @@ -1,14 +1,21 @@ package com.l2jbr.gameserver.model.database; +import com.l2jbr.commons.database.annotation.Column; +import com.l2jbr.commons.database.annotation.Table; import org.springframework.data.annotation.Id; +@Table("henna") public class Henna { @Id - private int symbol_id; - private String symbol_name; - private int dye_id; - private int dye_amount; + @Column("simbol_id") + private int symbolId; + @Column("symbol_name") + private String symbolName; + @Column("dye_id") + private int dyeId; + @Column("dye_amount") + private int dyeAmount; private int price; private int stat_INT; private int stat_STR; @@ -18,19 +25,19 @@ public class Henna { private int stat_WIT; public int getSymbolId() { - return symbol_id; + return symbolId; } - public String getSymbol_name() { - return symbol_name; + public String getSymbolName() { + return symbolName; } public int getDyeId() { - return dye_id; + return dyeId; } public int getDyeAmount() { - return dye_amount; + return dyeAmount; } public int getPrice() { diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/Heroes.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/Heroes.java index f32b914a..2177a545 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/Heroes.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/Heroes.java @@ -1,8 +1,10 @@ package com.l2jbr.gameserver.model.database; import com.l2jbr.commons.database.annotation.Column; +import com.l2jbr.commons.database.annotation.Table; import org.springframework.data.annotation.Id; +@Table("heroes") public class Heroes { @Id diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/Items.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/Items.java index 37af411a..9a8e8f13 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/Items.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/Items.java @@ -1,9 +1,11 @@ package com.l2jbr.gameserver.model.database; import com.l2jbr.commons.database.annotation.Column; +import com.l2jbr.commons.database.annotation.Table; import com.l2jbr.commons.database.model.Entity; import org.springframework.data.annotation.Id; +@Table("items") public class Items extends Entity { @Id diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/ItemsOnGround.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/ItemsOnGround.java index 61fec60d..a200ecab 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/ItemsOnGround.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/ItemsOnGround.java @@ -1,10 +1,12 @@ package com.l2jbr.gameserver.model.database; import com.l2jbr.commons.database.annotation.Column; +import com.l2jbr.commons.database.annotation.Table; import com.l2jbr.commons.database.model.Entity; import com.l2jbr.gameserver.model.L2ItemInstance; import org.springframework.data.annotation.Id; +@Table("itemsonground") public class ItemsOnGround extends Entity { @Id diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/Locations.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/Locations.java index 7b44c3e7..424a00df 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/Locations.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/Locations.java @@ -1,8 +1,10 @@ package com.l2jbr.gameserver.model.database; import com.l2jbr.commons.database.annotation.Column; +import com.l2jbr.commons.database.annotation.Table; import org.springframework.data.annotation.Id; +@Table("location") public class Locations { @Id @Column("loc_id") diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/MapRegion.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/MapRegion.java index 2f093e36..f7537715 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/MapRegion.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/MapRegion.java @@ -1,5 +1,8 @@ package com.l2jbr.gameserver.model.database; +import com.l2jbr.commons.database.annotation.Table; + +@Table("mapregion") public class MapRegion { private int region; private int sec0; diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/Minions.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/Minions.java index 8195a547..1bd1adb3 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/Minions.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/Minions.java @@ -1,9 +1,10 @@ package com.l2jbr.gameserver.model.database; import com.l2jbr.commons.database.annotation.Column; +import com.l2jbr.commons.database.annotation.Table; import org.springframework.data.annotation.Id; - +@Table("minions") public class Minions { @Id @Column("boss_id") diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/Npc.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/Npc.java index 7fbd549b..9a984048 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/Npc.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/Npc.java @@ -1,8 +1,10 @@ package com.l2jbr.gameserver.model.database; import com.l2jbr.commons.database.annotation.Column; +import com.l2jbr.commons.database.annotation.Table; import org.springframework.data.annotation.Id; +@Table("npc") public class Npc { @Id diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/NpcSkills.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/NpcSkills.java index 8bd2d572..6fea531f 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/NpcSkills.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/NpcSkills.java @@ -1,7 +1,9 @@ package com.l2jbr.gameserver.model.database; +import com.l2jbr.commons.database.annotation.Table; import org.springframework.data.annotation.Id; +@Table("npcskills") public class NpcSkills { @Id diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/Pets.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/Pets.java index 38d19e6e..29d16de9 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/Pets.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/Pets.java @@ -1,8 +1,10 @@ package com.l2jbr.gameserver.model.database; import com.l2jbr.commons.database.annotation.Column; +import com.l2jbr.commons.database.annotation.Table; import org.springframework.data.annotation.Id; +@Table("pets") public class Pets { @Id diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/Posts.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/Posts.java index 8958c6a4..d98c20e4 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/Posts.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/Posts.java @@ -1,9 +1,11 @@ package com.l2jbr.gameserver.model.database; import com.l2jbr.commons.database.annotation.Column; +import com.l2jbr.commons.database.annotation.Table; import com.l2jbr.commons.database.model.Entity; import org.springframework.data.annotation.Id; +@Table("posts") public class Posts extends Entity { @Id @Column("post_id") diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/Spawnlist.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/Spawnlist.java index 0194dd61..21723691 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/Spawnlist.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/Spawnlist.java @@ -1,10 +1,12 @@ package com.l2jbr.gameserver.model.database; import com.l2jbr.commons.database.annotation.Column; +import com.l2jbr.commons.database.annotation.Table; import com.l2jbr.commons.database.model.Entity; import com.l2jbr.gameserver.model.L2Spawn; import org.springframework.data.annotation.Id; +@Table("spawnlist") public class Spawnlist extends Entity { @Id diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/Teleport.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/Teleport.java index f850d292..dec43803 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/Teleport.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/Teleport.java @@ -1,8 +1,10 @@ package com.l2jbr.gameserver.model.database; import com.l2jbr.commons.database.annotation.Column; +import com.l2jbr.commons.database.annotation.Table; import org.springframework.data.annotation.Id; +@Table("teleport") public class Teleport { @Id diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/Topic.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/Topic.java index 0ba41f56..62069624 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/Topic.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/Topic.java @@ -1,9 +1,11 @@ package com.l2jbr.gameserver.model.database; import com.l2jbr.commons.database.annotation.Column; +import com.l2jbr.commons.database.annotation.Table; import com.l2jbr.commons.database.model.Entity; import org.springframework.data.annotation.Id; +@Table("topic") public class Topic extends Entity { @Id diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/Weapon.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/Weapon.java index 618e0fb6..f4d21a23 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/Weapon.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/Weapon.java @@ -1,8 +1,10 @@ package com.l2jbr.gameserver.model.database; import com.l2jbr.commons.database.annotation.Column; +import com.l2jbr.commons.database.annotation.Table; import com.l2jbr.commons.database.model.Entity; +@Table("weapon") public class Weapon extends Entity { @Column("item_id") From c807a357990145a2b85a4c58ff3abdafa7bda7d4 Mon Sep 17 00:00:00 2001 From: Alisson Oliveira Date: Mon, 7 May 2018 08:01:06 -0300 Subject: [PATCH 097/236] Ajustes na estrutura do Banco de Dados --- Commons/build.gradle | 2 +- .../commons/database/DatabaseAccess.java | 12 +- .../DatabaseContextConfiguration.java | 4 +- .../commons/database/model/GameServers.java | 5 +- Datapack/sql/accounts.sql | 17 +- Datapack/sql/char_templates.sql | 272 +++++++++--------- Datapack/sql/clanhall.sql | 27 +- Datapack/sql/dimensional_rift.sql | 4 +- .../sql/experimental/l2j_full_structure.sql | 24 +- Datapack/sql/merchant_buylists.sql | 40 +-- Datapack/sql/npc.sql | 26 +- Gameserver/build.gradle | 4 +- .../l2jbr/gameserver/SevenSignsFestival.java | 2 +- .../gameserver/datatables/ClanTable.java | 2 +- .../gameserver/datatables/DoorTable.java | 11 +- .../gameserver/datatables/HennaTable.java | 4 +- .../l2jbr/gameserver/datatables/NpcTable.java | 4 +- .../instancemanager/ClanHallManager.java | 6 +- .../DimensionalRiftManager.java | 6 +- .../gameserver/model/L2NpcWalkerNode.java | 2 +- .../gameserver/model/database/Armor.java | 5 +- .../model/database/CharTemplate.java | 1 - .../model/database/ClanHallData.java | 6 +- .../model/database/DimensionalRift.java | 4 +- .../gameserver/model/database/Henna.java | 2 +- .../gameserver/model/database/MapRegion.java | 3 + .../model/database/MerchantBuyList.java | 10 +- .../model/database/MerchantShopIds.java | 3 + .../l2jbr/gameserver/model/database/Npc.java | 10 +- .../model/database/SevenSignsStatus.java | 2 +- .../model/database/WalkerRoutes.java | 4 +- .../database/repository/ClanRepository.java | 2 +- .../database/repository/ItemRepository.java | 2 +- .../repository/ZoneVerticesRepository.java | 2 +- .../l2jbr/gameserver/model/entity/Castle.java | 7 +- .../resources/gameserver-messages.properties | 15 +- .../gameserver-messages_pt_BR.properties | 14 +- Loginserver/build.gradle | 2 +- Tools/build.gradle | 2 +- .../accountmanager/SQLAccountManager.java | 1 - build.gradle | 2 +- 41 files changed, 297 insertions(+), 276 deletions(-) diff --git a/Commons/build.gradle b/Commons/build.gradle index d2afc6a8..dbcdde8e 100644 --- a/Commons/build.gradle +++ b/Commons/build.gradle @@ -28,7 +28,7 @@ dependencies { compile ('org.springframework.data:spring-data-jdbc:1.0.0.BUILD-SNAPSHOT') { changing = true } compile 'com.zaxxer:HikariCP:3.0.0' - runtime 'mysql:mysql-connector-java:8.0.9-rc' + runtime 'mysql:mysql-connector-java:8.0.11' } jar { diff --git a/Commons/src/main/com.l2jbr.commons/com/l2jbr/commons/database/DatabaseAccess.java b/Commons/src/main/com.l2jbr.commons/com/l2jbr/commons/database/DatabaseAccess.java index d7bf8e95..80d2a86d 100644 --- a/Commons/src/main/com.l2jbr.commons/com/l2jbr/commons/database/DatabaseAccess.java +++ b/Commons/src/main/com.l2jbr.commons/com/l2jbr/commons/database/DatabaseAccess.java @@ -1,18 +1,18 @@ package com.l2jbr.commons.database; +import com.l2jbr.commons.util.Util; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.data.repository.CrudRepository; -import java.sql.SQLException; +import java.util.LinkedHashMap; import java.util.Map; -import java.util.WeakHashMap; public class DatabaseAccess { private static Logger logger = LoggerFactory.getLogger(DatabaseAccess.class); - private static Map objects = new WeakHashMap<>(); + private static Map objects = new LinkedHashMap<>(); public static T getRepository(Class repositoryClass) { if(objects.containsKey(repositoryClass)) { @@ -21,8 +21,10 @@ public static T getRepository(Class repositoryClas T repository = null; try { repository = L2DatabaseFactory.getInstance().getRepository(repositoryClass); - objects.put(repositoryClass, repository); - } catch (SQLException e) { + if(Util.isNotNull(repository)) { + objects.put(repositoryClass, repository); + } + } catch (Exception e) { logger.error("Error accessing Database", e); } return repository; diff --git a/Commons/src/main/com.l2jbr.commons/com/l2jbr/commons/database/DatabaseContextConfiguration.java b/Commons/src/main/com.l2jbr.commons/com/l2jbr/commons/database/DatabaseContextConfiguration.java index c0087aea..03d69aba 100644 --- a/Commons/src/main/com.l2jbr.commons/com/l2jbr/commons/database/DatabaseContextConfiguration.java +++ b/Commons/src/main/com.l2jbr.commons/com/l2jbr/commons/database/DatabaseContextConfiguration.java @@ -19,7 +19,7 @@ import java.util.Optional; @Configuration -@EnableJdbcRepositories +@EnableJdbcRepositories({"com.l2jbr.commons.database", "com.l2jbr.gameserver.model.database.repository"}) public class DatabaseContextConfiguration { @Bean @@ -41,7 +41,7 @@ public HikariDataSource dataSource() { dataSourceConfig.addDataSourceProperty("cacheServerConfiguration", true); dataSourceConfig.addDataSourceProperty("cacheResultSetMetadata", true); dataSourceConfig.addDataSourceProperty("maintainTimeStats", true); - dataSourceConfig.addDataSourceProperty("logger", "com.mysql.cj.core.log.Slf4JLogger"); + dataSourceConfig.addDataSourceProperty("logger", "com.mysql.cj.log.Slf4JLogger"); dataSourceConfig.addDataSourceProperty("autoCommit", true); dataSourceConfig.addDataSourceProperty("minimumIdle", 10); dataSourceConfig.addDataSourceProperty("validationTimeout", 500); // 500 milliseconds wait before try to acquire connection again diff --git a/Commons/src/main/com.l2jbr.commons/com/l2jbr/commons/database/model/GameServers.java b/Commons/src/main/com.l2jbr.commons/com/l2jbr/commons/database/model/GameServers.java index 61e17881..60ff7067 100644 --- a/Commons/src/main/com.l2jbr.commons/com/l2jbr/commons/database/model/GameServers.java +++ b/Commons/src/main/com.l2jbr.commons/com/l2jbr/commons/database/model/GameServers.java @@ -6,12 +6,15 @@ @Table("gameservers") public class GameServers extends Entity { + @Id @Column("server_id") - private int serverId; + private Integer serverId; private String hexid; private String host; + public GameServers() { } + public GameServers(int id, String hexId, String host) { this.serverId = id; this.hexid = hexId; diff --git a/Datapack/sql/accounts.sql b/Datapack/sql/accounts.sql index 3fb60b51..44e7364e 100644 --- a/Datapack/sql/accounts.sql +++ b/Datapack/sql/accounts.sql @@ -2,11 +2,12 @@ -- Table structure for accounts -- --------------------------- CREATE TABLE IF NOT EXISTS `accounts` ( - `login` VARCHAR(45) NOT NULL default '', - `password` VARCHAR(45) , - `lastactive` DECIMAL(20), - `access_level` INT, - `lastIP` VARCHAR(20), - `lastServer` int(4) default 1, - PRIMARY KEY (`login`) -); + `login` VARCHAR(45) NOT NULL DEFAULT '', + `password` VARCHAR(45) DEFAULT NULL, + `lastactive` DECIMAL(20,0) DEFAULT NULL, + `access_level` INT DEFAULT 0, + `lastIP` VARCHAR(20) DEFAULT NULL, + `lastServer` INT NOT NULL DEFAULT 1, + `newbieCharacterId` DECIMAL(11,0) NULL, + PRIMARY KEY (`login`)) +ENGINE = InnoDB \ No newline at end of file diff --git a/Datapack/sql/char_templates.sql b/Datapack/sql/char_templates.sql index f5eeb261..2277925b 100644 --- a/Datapack/sql/char_templates.sql +++ b/Datapack/sql/char_templates.sql @@ -1,139 +1,149 @@ -- -- Table structure for table `char_templates` --- - +-- DROP TABLE IF EXISTS `char_templates`; -CREATE TABLE `char_templates` ( - `ClassId` int(11) NOT NULL default '0', - `ClassName` varchar(20) NOT NULL default '', - `RaceId` int(1) NOT NULL default '0', - `STR` int(2) NOT NULL default '0', - `CON` int(2) NOT NULL default '0', - `DEX` int(2) NOT NULL default '0', - `_INT` int(2) NOT NULL default '0', - `WIT` int(2) NOT NULL default '0', - `MEN` int(2) NOT NULL default '0', - `P_ATK` int(3) NOT NULL default '0', - `P_DEF` int(3) NOT NULL default '0', - `M_ATK` int(3) NOT NULL default '0', - `M_DEF` int(2) NOT NULL default '0', - `P_SPD` int(3) NOT NULL default '0', - `M_SPD` int(3) NOT NULL default '0', - `ACC` int(3) NOT NULL default '0', - `CRITICAL` int(3) NOT NULL default '0', - `EVASION` int(3) NOT NULL default '0', - `MOVE_SPD` int(3) NOT NULL default '0', - `_LOAD` int(11) NOT NULL default '0', - `x` int(9) NOT NULL default '0', - `y` int(9) NOT NULL default '0', - `z` int(9) NOT NULL default '0', - `canCraft` int(1) NOT NULL default '0', - `M_UNK1` decimal(4,2) NOT NULL default '0.00', - `M_UNK2` decimal(8,6) NOT NULL default '0.000000', - `M_COL_R` decimal(3,1) NOT NULL default '0.0', - `M_COL_H` decimal(4,1) NOT NULL default '0.0', - `F_UNK1` decimal(4,2) NOT NULL default '0.00', - `F_UNK2` decimal(8,6) NOT NULL default '0.000000', - `F_COL_R` decimal(3,1) NOT NULL default '0.0', - `F_COL_H` decimal(4,1) NOT NULL default '0.0', - `items1` int(4) NOT NULL default '0', - `items2` int(4) NOT NULL default '0', - `items3` int(4) NOT NULL default '0', - `items4` int(4) NOT NULL default '0', - `items5` int(10) NOT NULL default '0', - PRIMARY KEY (`ClassId`) -); +CREATE TABLE IF NOT EXISTS `char_templates` ( + `ClassId` INT(11) NOT NULL DEFAULT '0', + `ClassName` VARCHAR(20) NOT NULL DEFAULT '', + `classLevel` INT(3) NOT NULL DEFAULT '0', + `RaceId` INT(1) NOT NULL DEFAULT '0', + `parent_id` INT(11) NOT NULL DEFAULT '0', + `STR` INT(2) NOT NULL DEFAULT '0', + `CON` INT(2) NOT NULL DEFAULT '0', + `DEX` INT(2) NOT NULL DEFAULT '0', + `_INT` INT(2) NOT NULL DEFAULT '0', + `WIT` INT(2) NOT NULL DEFAULT '0', + `MEN` INT(2) NOT NULL DEFAULT '0', + `P_ATK` INT(3) NOT NULL DEFAULT '0', + `P_DEF` INT(3) NOT NULL DEFAULT '0', + `M_ATK` INT(3) NOT NULL DEFAULT '0', + `M_DEF` INT(2) NOT NULL DEFAULT '0', + `P_SPD` INT(3) NOT NULL DEFAULT '0', + `M_SPD` INT(3) NOT NULL DEFAULT '0', + `ACC` INT(3) NOT NULL DEFAULT '0', + `CRITICAL` INT(3) NOT NULL DEFAULT '0', + `EVASION` INT(3) NOT NULL DEFAULT '0', + `MOVE_SPD` INT(3) NOT NULL DEFAULT '0', + `_LOAD` INT(11) NOT NULL DEFAULT '0', + `defaulthpbase` DECIMAL(5,1) NOT NULL DEFAULT '0.0', + `defaulthpadd` DECIMAL(4,2) NOT NULL DEFAULT '0.00', + `defaulthpmod` DECIMAL(4,2) NOT NULL DEFAULT '0.00', + `defaultcpbase` DECIMAL(5,1) NOT NULL DEFAULT '0.0', + `defaultcpadd` DECIMAL(4,2) NOT NULL DEFAULT '0.00', + `defaultcpmod` DECIMAL(4,2) NOT NULL DEFAULT '0.00', + `defaultmpbase` DECIMAL(5,1) NOT NULL DEFAULT '0.0', + `defaultmpadd` DECIMAL(4,2) NOT NULL DEFAULT '0.00', + `defaultmpmod` DECIMAL(4,2) NOT NULL DEFAULT '0.00', + `x` INT(9) NOT NULL DEFAULT '0', + `y` INT(9) NOT NULL DEFAULT '0', + `z` INT(9) NOT NULL DEFAULT '0', + `canCraft` INT(1) NOT NULL DEFAULT '0', + `M_UNK1` DECIMAL(4,2) NOT NULL DEFAULT '0.00', + `M_UNK2` DECIMAL(8,6) NOT NULL DEFAULT '0.000000', + `M_COL_R` DECIMAL(3,1) NOT NULL DEFAULT '0.0', + `M_COL_H` DECIMAL(4,1) NOT NULL DEFAULT '0.0', + `F_UNK1` DECIMAL(4,2) NOT NULL DEFAULT '0.00', + `F_UNK2` DECIMAL(8,6) NOT NULL DEFAULT '0.000000', + `F_COL_R` DECIMAL(3,1) NOT NULL DEFAULT '0.0', + `F_COL_H` DECIMAL(4,1) NOT NULL DEFAULT '0.0', + `items1` INT(4) NOT NULL DEFAULT '0', + `items2` INT(4) NOT NULL DEFAULT '0', + `items3` INT(4) NOT NULL DEFAULT '0', + `items4` INT(4) NOT NULL DEFAULT '0', + `items5` INT(10) NOT NULL DEFAULT '0', + PRIMARY KEY (`ClassId`)) +ENGINE = InnoDB; -- -- Dumping data for table `char_templates` -- INSERT INTO `char_templates` VALUES - (0, 'Human Fighter', 0, 40, 43, 30, 21, 11, 25, 4, 80, 6, 41, 300, 333, 33, 44, 33, 115, 81900, -71338, 258271, -3104, 0, 1.10, 1.188000, 9.0, 23.0, 1.10, 1.188000, 8.0, 23.5, 1147, 1146, 10, 2369, 5588), - (1, 'Warrior', 0, 40, 43, 30, 21, 11, 25, 4, 80, 6, 41, 300, 333, 33, 44, 33, 115, 81900, -71338, 258271, -3104, 0, 1.10, 1.188000, 9.0, 23.0, 1.10, 1.188000, 8.0, 23.5, 1147, 1146, 10, 2369, 5588), - (2, 'Gladiator', 0, 40, 43, 30, 21, 11, 25, 4, 80, 6, 41, 300, 333, 33, 44, 33, 115, 81900, -71338, 258271, -3104, 0, 1.10, 1.188000, 9.0, 23.0, 1.10, 1.188000, 8.0, 23.5, 1147, 1146, 10, 2369, 5588), - (3, 'Warlord', 0, 40, 43, 30, 21, 11, 25, 4, 80, 6, 41, 300, 333, 33, 44, 33, 115, 81900, -71338, 258271, -3104, 0, 1.10, 1.188000, 9.0, 23.0, 1.10, 1.188000, 8.0, 23.5, 1147, 1146, 10, 2369, 5588), - (4, 'Human Knight', 0, 40, 43, 30, 21, 11, 25, 4, 80, 6, 41, 300, 333, 33, 44, 33, 115, 81900, -71338, 258271, -3104, 0, 1.10, 1.188000, 9.0, 23.0, 1.10, 1.188000, 8.0, 23.5, 1147, 1146, 10, 2369, 5588), - (5, 'Paladin', 0, 40, 43, 30, 21, 11, 25, 4, 80, 6, 41, 300, 333, 33, 44, 33, 115, 81900, -71338, 258271, -3104, 0, 1.10, 1.188000, 9.0, 23.0, 1.10, 1.188000, 8.0, 23.5, 1147, 1146, 10, 2369, 5588), - (6, 'Dark Avenger', 0, 40, 43, 30, 21, 11, 25, 4, 80, 6, 41, 300, 333, 33, 44, 33, 115, 81900, -71338, 258271, -3104, 0, 1.10, 1.188000, 9.0, 23.0, 1.10, 1.188000, 8.0, 23.5, 1147, 1146, 10, 2369, 5588), - (7, 'Rogue', 0, 40, 43, 30, 21, 11, 25, 4, 80, 6, 41, 300, 333, 33, 44, 33, 115, 81900, -71338, 258271, -3104, 0, 1.10, 1.188000, 9.0, 23.0, 1.10, 1.188000, 8.0, 23.5, 1147, 1146, 10, 2369, 5588), - (8, 'Treasure Hunter', 0, 40, 43, 30, 21, 11, 25, 4, 80, 6, 41, 300, 333, 33, 44, 33, 115, 81900, -71338, 258271, -3104, 0, 1.10, 1.188000, 9.0, 23.0, 1.10, 1.188000, 8.0, 23.5, 1147, 1146, 10, 2369, 5588), - (9, 'Hawkeye', 0, 40, 43, 30, 21, 11, 25, 4, 80, 6, 41, 300, 333, 33, 44, 33, 115, 81900, -71338, 258271, -3104, 0, 1.10, 1.188000, 9.0, 23.0, 1.10, 1.188000, 8.0, 23.5, 1147, 1146, 10, 2369, 5588), - (10, 'Human Mage', 0, 22, 27, 21, 41, 20, 39, 3, 54, 6, 41, 300, 333, 28, 40, 28, 120, 62500, -90890, 248027, -3570, 0, 1.01, 0.872640, 7.5, 22.8, 1.01, 0.872640, 6.5, 22.5, 425, 461, 6, 5588, 0), - (11, 'Human Wizard', 0, 22, 27, 21, 41, 20, 39, 3, 54, 6, 41, 300, 333, 28, 40, 28, 120, 62500, -90890, 248027, -3570, 0, 1.01, 0.872640, 7.5, 22.8, 1.01, 0.872640, 6.5, 22.5, 425, 461, 6, 5588, 0), - (12, 'Sorcerer', 0, 22, 27, 21, 41, 20, 39, 3, 54, 6, 41, 300, 333, 28, 40, 28, 120, 62500, -90890, 248027, -3570, 0, 1.01, 0.872640, 7.5, 22.8, 1.01, 0.872640, 6.5, 22.5, 425, 461, 6, 5588, 0), - (13, 'Necromancer', 0, 22, 27, 21, 41, 20, 39, 3, 54, 6, 41, 300, 333, 28, 40, 28, 120, 62500, -90890, 248027, -3570, 0, 1.01, 0.872640, 7.5, 22.8, 1.01, 0.872640, 6.5, 22.5, 425, 461, 6, 5588, 0), - (14, 'Warlock', 0, 22, 27, 21, 41, 20, 39, 3, 54, 6, 41, 300, 333, 28, 40, 28, 120, 62500, -90890, 248027, -3570, 0, 1.01, 0.872640, 7.5, 22.8, 1.01, 0.872640, 6.5, 22.5, 425, 461, 6, 5588, 0), - (15, 'Cleric', 0, 22, 27, 21, 41, 20, 39, 3, 54, 6, 41, 300, 333, 28, 40, 28, 120, 62500, -90890, 248027, -3570, 0, 1.01, 0.872640, 7.5, 22.8, 1.01, 0.872640, 6.5, 22.5, 425, 461, 6, 5588, 0), - (16, 'Bishop', 0, 22, 27, 21, 41, 20, 39, 3, 54, 6, 41, 300, 333, 28, 40, 28, 120, 62500, -90890, 248027, -3570, 0, 1.01, 0.872640, 7.5, 22.8, 1.01, 0.872640, 6.5, 22.5, 425, 461, 6, 5588, 0), - (17, 'Human Prophet', 0, 22, 27, 21, 41, 20, 39, 3, 54, 6, 41, 300, 333, 28, 40, 28, 120, 62500, -90890, 248027, -3570, 0, 1.01, 0.872640, 7.5, 22.8, 1.01, 0.872640, 6.5, 22.5, 425, 461, 6, 5588, 0), - (18, 'Elf Fighter', 1, 36, 36, 35, 23, 14, 26, 4, 80, 6, 41, 300, 333, 36, 46, 36, 125, 73000, 45978, 41196, -3440, 0, 1.15, 1.242000, 7.5, 24.0, 1.15, 1.242000, 7.5, 23.0, 1147, 1146, 10, 2369, 5588), - (19, 'Elf Knight', 1, 36, 36, 35, 23, 14, 26, 4, 80, 6, 41, 300, 333, 36, 46, 36, 125, 73000, 45978, 41196, -3440, 0, 1.15, 1.242000, 7.5, 24.0, 1.15, 1.242000, 7.5, 23.0, 1147, 1146, 10, 2369, 5588), - (20, 'Temple Knight', 1, 36, 36, 35, 23, 14, 26, 4, 80, 6, 41, 300, 333, 36, 46, 36, 125, 73000, 45978, 41196, -3440, 0, 1.15, 1.242000, 7.5, 24.0, 1.15, 1.242000, 7.5, 23.0, 1147, 1146, 10, 2369, 5588), - (21, 'Swordsinger', 1, 36, 36, 35, 23, 14, 26, 4, 80, 6, 41, 300, 333, 36, 46, 36, 125, 73000, 45978, 41196, -3440, 0, 1.15, 1.242000, 7.5, 24.0, 1.15, 1.242000, 7.5, 23.0, 1147, 1146, 10, 2369, 5588), - (22, 'Scout', 1, 36, 36, 35, 23, 14, 26, 4, 80, 6, 41, 300, 333, 36, 46, 36, 125, 73000, 45978, 41196, -3440, 0, 1.15, 1.242000, 7.5, 24.0, 1.15, 1.242000, 7.5, 23.0, 1147, 1146, 10, 2369, 5588), - (23, 'Plains Walker', 1, 36, 36, 35, 23, 14, 26, 4, 80, 6, 41, 300, 333, 36, 46, 36, 125, 73000, 45978, 41196, -3440, 0, 1.15, 1.242000, 7.5, 24.0, 1.15, 1.242000, 7.5, 23.0, 1147, 1146, 10, 2369, 5588), - (24, 'Silver Ranger', 1, 36, 36, 35, 23, 14, 26, 4, 80, 6, 41, 300, 333, 36, 46, 36, 125, 73000, 45978, 41196, -3440, 0, 1.15, 1.242000, 7.5, 24.0, 1.15, 1.242000, 7.5, 23.0, 1147, 1146, 10, 2369, 5588), - (25, 'Elf Mage', 1, 21, 25, 24, 37, 23, 40, 3, 54, 6, 41, 300, 333, 30, 41, 30, 122, 62400, 46182, 41198, -3440, 0, 1.04, 0.898560, 7.5, 24.0, 1.04, 0.898560, 7.5, 23.0, 425, 461, 6, 5588, 0), - (26, 'Elf Wizard', 1, 21, 25, 24, 37, 23, 40, 3, 54, 6, 41, 300, 333, 30, 41, 30, 122, 62400, 46182, 41198, -3440, 0, 1.04, 0.898560, 7.5, 24.0, 1.04, 0.898560, 7.5, 23.0, 425, 461, 6, 5588, 0), - (27, 'Spellsinger', 1, 21, 25, 24, 37, 23, 40, 3, 54, 6, 41, 300, 333, 30, 41, 30, 122, 62400, 46182, 41198, -3440, 0, 1.04, 0.898560, 7.5, 24.0, 1.04, 0.898560, 7.5, 23.0, 425, 461, 6, 5588, 0), - (28, 'Elemental Summoner', 1, 21, 25, 24, 37, 23, 40, 3, 54, 6, 41, 300, 333, 30, 41, 30, 122, 62400, 46182, 41198, -3440, 0, 1.04, 0.898560, 7.5, 24.0, 1.04, 0.898560, 7.5, 23.0, 425, 461, 6, 5588, 0), - (29, 'Oracle', 1, 21, 25, 24, 37, 23, 40, 3, 54, 6, 41, 300, 333, 30, 41, 30, 122, 62400, 46182, 41198, -3440, 0, 1.04, 0.898560, 7.5, 24.0, 1.04, 0.898560, 7.5, 23.0, 425, 461, 6, 5588, 0), - (30, 'Elder', 1, 21, 25, 24, 37, 23, 40, 3, 54, 6, 41, 300, 333, 30, 41, 30, 122, 62400, 46182, 41198, -3440, 0, 1.04, 0.898560, 7.5, 24.0, 1.04, 0.898560, 7.5, 23.0, 425, 461, 6, 5588, 0), - (31, 'DE Fighter', 2, 41, 32, 34, 25, 12, 26, 4, 80, 6, 41, 300, 333, 35, 45, 35, 122, 69000, 28377, 10916, -4224, 0, 1.14, 1.231200, 7.5, 24.0, 1.14, 1.231200, 7.0, 23.5, 1147, 1146, 10, 2369, 5588), - (32, 'Palus Knight', 2, 41, 32, 34, 25, 12, 26, 4, 80, 6, 41, 300, 333, 35, 45, 35, 122, 69000, 28377, 10916, -4224, 0, 1.14, 1.231200, 7.5, 24.0, 1.14, 1.231200, 7.0, 23.5, 1147, 1146, 10, 2369, 5588), - (33, 'Shillien Knight', 2, 41, 32, 34, 25, 12, 26, 4, 80, 6, 41, 300, 333, 35, 45, 35, 122, 69000, 28377, 10916, -4224, 0, 1.14, 1.231200, 7.5, 24.0, 1.14, 1.231200, 7.0, 23.5, 1147, 1146, 10, 2369, 5588), - (34, 'Bladedancer', 2, 41, 32, 34, 25, 12, 26, 4, 80, 6, 41, 300, 333, 35, 45, 35, 122, 69000, 28377, 10916, -4224, 0, 1.14, 1.231200, 7.5, 24.0, 1.14, 1.231200, 7.0, 23.5, 1147, 1146, 10, 2369, 5588), - (35, 'Assassin', 2, 41, 32, 34, 25, 12, 26, 4, 80, 6, 41, 300, 333, 35, 45, 35, 122, 69000, 28377, 10916, -4224, 0, 1.14, 1.231200, 7.5, 24.0, 1.14, 1.231200, 7.0, 23.5, 1147, 1146, 10, 2369, 5588), - (36, 'Abyss Walker', 2, 41, 32, 34, 25, 12, 26, 4, 80, 6, 41, 300, 333, 35, 45, 35, 122, 69000, 28377, 10916, -4224, 0, 1.14, 1.231200, 7.5, 24.0, 1.14, 1.231200, 7.0, 23.5, 1147, 1146, 10, 2369, 5588), - (37, 'Phantom Ranger', 2, 41, 32, 34, 25, 12, 26, 4, 80, 6, 41, 300, 333, 35, 45, 35, 122, 69000, 28377, 10916, -4224, 0, 1.14, 1.231200, 7.5, 24.0, 1.14, 1.231200, 7.0, 23.5, 1147, 1146, 10, 2369, 5588), - (38, 'DE Mage', 2, 23, 24, 23, 44, 19, 37, 3, 54, 6, 41, 300, 333, 29, 41, 29, 122, 61000, 28295, 11063, -4224, 0, 1.14, 1.231200, 7.5, 24.0, 1.03, 0.889920, 7.0, 23.5, 425, 461, 6, 5588, 0), - (39, 'DE Wizard', 2, 23, 24, 23, 44, 19, 37, 3, 54, 6, 41, 300, 333, 29, 41, 29, 122, 61000, 28295, 11063, -4224, 0, 1.14, 1.231200, 7.5, 24.0, 1.03, 0.889920, 7.0, 23.5, 425, 461, 6, 5588, 0), - (40, 'Spell Howler', 2, 23, 24, 23, 44, 19, 37, 3, 54, 6, 41, 300, 333, 29, 41, 29, 122, 61000, 28295, 11063, -4224, 0, 1.14, 1.231200, 7.5, 24.0, 1.03, 0.889920, 7.0, 23.5, 425, 461, 6, 5588, 0), - (41, 'Phantom Summoner', 2, 23, 24, 23, 44, 19, 37, 3, 54, 6, 41, 300, 333, 29, 41, 29, 122, 61000, 28295, 11063, -4224, 0, 1.14, 1.231200, 7.5, 24.0, 1.03, 0.889920, 7.0, 23.5, 425, 461, 6, 5588, 0), - (42, 'Shillien Oracle', 2, 23, 24, 23, 44, 19, 37, 3, 54, 6, 41, 300, 333, 29, 41, 29, 122, 61000, 28295, 11063, -4224, 0, 1.14, 1.231200, 7.5, 24.0, 1.03, 0.889920, 7.0, 23.5, 425, 461, 6, 5588, 0), - (43, 'Shillien Elder', 2, 23, 24, 23, 44, 19, 37, 3, 54, 6, 41, 300, 333, 29, 41, 29, 122, 61000, 28295, 11063, -4224, 0, 1.14, 1.231200, 7.5, 24.0, 1.03, 0.889920, 7.0, 23.5, 425, 461, 6, 5588, 0), - (44, 'Orc Fighter', 3, 40, 47, 26, 18, 12, 27, 4, 80, 6, 41, 300, 333, 31, 42, 31, 117, 87000, -56693, -113610, -690, 0, 1.06, 1.144800, 11.0, 28.0, 1.06, 1.144800, 7.0, 27.0, 1147, 1146, 2368, 2369, 5588), - (45, 'Raider', 3, 40, 47, 26, 18, 12, 27, 4, 80, 6, 41, 300, 333, 31, 42, 31, 117, 87000, -56693, -113610, -690, 0, 1.06, 1.144800, 11.0, 28.0, 1.06, 1.144800, 7.0, 27.0, 1147, 1146, 2368, 2369, 5588), - (46, 'Destroyer', 3, 40, 47, 26, 18, 12, 27, 4, 80, 6, 41, 300, 333, 31, 42, 31, 117, 87000, -56693, -113610, -690, 0, 1.06, 1.144800, 11.0, 28.0, 1.06, 1.144800, 7.0, 27.0, 1147, 1146, 2368, 2369, 5588), - (47, 'Monk', 3, 40, 47, 26, 18, 12, 27, 4, 80, 6, 41, 300, 333, 31, 42, 31, 117, 87000, -56682, -113610, -690, 0, 1.06, 1.144800, 11.0, 28.0, 1.06, 1.144800, 7.0, 27.0, 1147, 1146, 2368, 2369, 5588), - (48, 'Tyrant', 3, 40, 47, 26, 18, 12, 27, 4, 80, 6, 41, 300, 333, 31, 42, 31, 117, 87000, -56693, -113610, -690, 0, 1.06, 1.144800, 11.0, 28.0, 1.06, 1.144800, 7.0, 27.0, 1147, 1146, 2368, 2369, 5588), - (49, 'Orc Mage', 3, 27, 31, 24, 31, 15, 42, 3, 54, 6, 41, 300, 333, 30, 41, 30, 121, 68000, -56682, -113730, -690, 0, 1.04, 0.898560, 7.0, 27.5, 1.04, 0.898560, 8.0, 25.5, 425, 461, 2368, 5588, 0), - (50, 'Shaman', 3, 27, 31, 24, 31, 15, 42, 3, 54, 6, 41, 300, 333, 30, 41, 30, 121, 68000, -56682, -113730, -690, 0, 1.04, 0.898560, 7.0, 27.5, 1.04, 0.898560, 8.0, 25.5, 425, 461, 2368, 5588, 0), - (51, 'Overlord', 3, 27, 31, 24, 31, 15, 42, 3, 54, 6, 41, 300, 333, 30, 41, 30, 121, 68000, -56682, -113730, -690, 0, 1.04, 0.898560, 7.0, 27.5, 1.04, 0.898560, 8.0, 25.5, 425, 461, 2368, 5588, 0), - (52, 'Warcryer', 3, 27, 31, 24, 31, 15, 42, 3, 54, 6, 41, 300, 333, 30, 41, 30, 121, 68000, -56682, -113730, -690, 0, 1.04, 0.898560, 7.0, 27.5, 1.04, 0.898560, 8.0, 25.5, 425, 461, 2368, 5588, 0), - (53, 'Dwarf Fighter', 4, 39, 45, 29, 20, 10, 27, 4, 80, 6, 41, 300, 333, 33, 43, 33, 115, 83000, 108512, -174026, -400, 1, 1.09, 1.487196, 9.0, 18.0, 1.09, 1.487196, 5.0, 19.0, 1147, 1146, 10, 2370, 5588), - (54, 'Scavenger', 4, 39, 45, 29, 20, 10, 27, 4, 80, 6, 41, 300, 333, 33, 43, 33, 115, 83000, 108512, -174026, -400, 1, 1.09, 1.487196, 9.0, 18.0, 1.09, 1.487196, 5.0, 19.0, 1147, 1146, 10, 2370, 5588), - (55, 'Bounty Hunter', 4, 39, 45, 29, 20, 10, 27, 4, 80, 6, 41, 300, 333, 33, 43, 33, 115, 83000, 108512, -174026, -400, 1, 1.09, 1.487196, 9.0, 18.0, 1.09, 1.487196, 5.0, 19.0, 1147, 1146, 10, 2370, 5588), - (56, 'Artisan', 4, 39, 45, 29, 20, 10, 27, 4, 80, 6, 41, 300, 333, 33, 43, 33, 115, 83000, 108512, -174026, -400, 1, 1.09, 1.487196, 9.0, 18.0, 1.09, 1.487196, 5.0, 19.0, 1147, 1146, 10, 2370, 5588), - (57, 'Warsmith', 4, 39, 45, 29, 20, 10, 27, 4, 80, 6, 41, 300, 333, 33, 43, 33, 115, 83000, 108512, -174026, -400, 1, 1.09, 1.487196, 9.0, 18.0, 1.09, 1.487196, 5.0, 19.0, 1147, 1146, 10, 2370, 5588), - (88, 'Duelist', 0, 40, 43, 30, 21, 11, 25, 4, 80, 6, 41, 300, 333, 33, 44, 33, 115, 81900, -71338, 258271, -3104, 0, 1.10, 1.188000, 9.0, 23.0, 1.10, 1.188000, 8.0, 23.5, 1147, 1146, 10, 2369, 5588), - (89, 'DreadNought', 0, 40, 43, 30, 21, 11, 25, 4, 80, 6, 41, 300, 333, 33, 44, 33, 115, 81900, -71338, 258271, -3104, 0, 1.10, 1.188000, 9.0, 23.0, 1.10, 1.188000, 8.0, 23.5, 1147, 1146, 10, 2369, 5588), - (90, 'Phoenix Knight', 0, 40, 43, 30, 21, 11, 25, 4, 80, 6, 41, 300, 333, 33, 44, 33, 115, 81900, -71338, 258271, -3104, 0, 1.10, 1.188000, 9.0, 23.0, 1.10, 1.188000, 8.0, 23.5, 1147, 1146, 10, 2369, 5588), - (91, 'Hell Knight', 0, 40, 43, 30, 21, 11, 25, 4, 80, 6, 41, 300, 333, 33, 44, 33, 115, 81900, -71338, 258271, -3104, 0, 1.10, 1.188000, 9.0, 23.0, 1.10, 1.188000, 8.0, 23.5, 1147, 1146, 10, 2369, 5588), - (92, 'Sagittarius', 0, 40, 43, 30, 21, 11, 25, 4, 80, 6, 41, 300, 333, 33, 44, 33, 115, 81900, -71338, 258271, -3104, 0, 1.10, 1.188000, 9.0, 23.0, 1.10, 1.188000, 8.0, 23.5, 1147, 1146, 10, 2369, 5588), - (93, 'Adventurer', 0, 40, 43, 30, 21, 11, 25, 4, 80, 6, 41, 300, 333, 33, 44, 33, 115, 81900, -71338, 258271, -3104, 0, 1.10, 1.188000, 9.0, 23.0, 1.10, 1.188000, 8.0, 23.5, 1147, 1146, 10, 2369, 5588), - (94, 'Archmage', 0, 22, 27, 21, 41, 20, 39, 3, 54, 6, 41, 300, 333, 28, 40, 28, 120, 62500, -90890, 248027, -3570, 0, 1.01, 0.872640, 7.5, 22.8, 1.01, 0.872640, 6.5, 22.5, 425, 461, 6, 5588, 0), - (95, 'Soultaker', 0, 22, 27, 21, 41, 20, 39, 3, 54, 6, 41, 300, 333, 28, 40, 28, 120, 62500, -90890, 248027, -3570, 0, 1.01, 0.872640, 7.5, 22.8, 1.01, 0.872640, 6.5, 22.5, 425, 461, 6, 5588, 0), - (96, 'Arcana Lord', 0, 22, 27, 21, 41, 20, 39, 3, 54, 6, 41, 300, 333, 28, 40, 28, 120, 62500, -90890, 248027, -3570, 0, 1.01, 0.872640, 7.5, 22.8, 1.01, 0.872640, 6.5, 22.5, 425, 461, 6, 5588, 0), - (97, 'Cardinal', 0, 22, 27, 21, 41, 20, 39, 3, 54, 6, 41, 300, 333, 28, 40, 28, 120, 62500, -90890, 248027, -3570, 0, 1.01, 0.872640, 7.5, 22.8, 1.01, 0.872640, 6.5, 22.5, 425, 461, 6, 5588, 0), - (98, 'Hierophant', 0, 22, 27, 21, 41, 20, 39, 3, 54, 6, 41, 300, 333, 28, 40, 28, 120, 62500, -90890, 248027, -3570, 0, 1.01, 0.872640, 7.5, 22.8, 1.01, 0.872640, 6.5, 22.5, 425, 461, 6, 5588, 0), - (99, 'Eva Templar', 1, 36, 36, 35, 23, 14, 26, 4, 80, 6, 41, 300, 333, 36, 46, 36, 125, 73000, 45978, 41196, -3440, 0, 1.15, 1.242000, 7.5, 24.0, 1.15, 1.242000, 7.5, 23.0, 1147, 1146, 10, 2369, 5588), - (100, 'Sword Muse', 1, 36, 36, 35, 23, 14, 26, 4, 80, 6, 41, 300, 333, 36, 46, 36, 125, 73000, 45978, 41196, -3440, 0, 1.15, 1.242000, 7.5, 24.0, 1.15, 1.242000, 7.5, 23.0, 1147, 1146, 10, 2369, 5588), - (101, 'Wind Rider', 1, 36, 36, 35, 23, 14, 26, 4, 80, 6, 41, 300, 333, 36, 46, 36, 125, 73000, 45978, 41196, -3440, 0, 1.15, 1.242000, 7.5, 24.0, 1.15, 1.242000, 7.5, 23.0, 1147, 1146, 10, 2369, 5588), - (102, 'Moonlight Sentinel', 1, 36, 36, 35, 23, 14, 26, 4, 80, 6, 41, 300, 333, 36, 46, 36, 125, 73000, 45978, 41196, -3440, 0, 1.15, 1.242000, 7.5, 24.0, 1.15, 1.242000, 7.5, 23.0, 1147, 1146, 10, 2369, 5588), - (103, 'Mystic Muse', 1, 21, 25, 24, 37, 23, 40, 3, 54, 6, 41, 300, 333, 30, 41, 30, 122, 62400, 46182, 41198, -3440, 0, 1.04, 0.898560, 7.5, 24.0, 1.04, 0.898560, 7.5, 23.0, 425, 461, 6, 5588, 0), - (104, 'Elemental Master', 1, 21, 25, 24, 37, 23, 40, 3, 54, 6, 41, 300, 333, 30, 41, 30, 122, 62400, 46182, 41198, -3440, 0, 1.04, 0.898560, 7.5, 24.0, 1.04, 0.898560, 7.5, 23.0, 425, 461, 6, 5588, 0), - (105, 'Eva Saint', 1, 21, 25, 24, 37, 23, 40, 3, 54, 6, 41, 300, 333, 30, 41, 30, 122, 62400, 46182, 41198, -3440, 0, 1.04, 0.898560, 7.5, 24.0, 1.04, 0.898560, 7.5, 23.0, 425, 461, 6, 5588, 0), - (106, 'Shillien Templar', 2, 41, 32, 34, 25, 12, 26, 4, 80, 6, 41, 300, 333, 35, 45, 35, 122, 69000, 28377, 10916, -4224, 0, 1.14, 1.231200, 7.5, 24.0, 1.14, 1.231200, 7.0, 23.5, 1147, 1146, 10, 2369, 5588), - (107, 'Spectral Dancer', 2, 41, 32, 34, 25, 12, 26, 4, 80, 6, 41, 300, 333, 35, 45, 35, 122, 69000, 28377, 10916, -4224, 0, 1.14, 1.231200, 7.5, 24.0, 1.14, 1.231200, 7.0, 23.5, 1147, 1146, 10, 2369, 5588), - (108, 'Ghost Hunter', 2, 41, 32, 34, 25, 12, 26, 4, 80, 6, 41, 300, 333, 35, 45, 35, 122, 69000, 28377, 10916, -4224, 0, 1.14, 1.231200, 7.5, 24.0, 1.14, 1.231200, 7.0, 23.5, 1147, 1146, 10, 2369, 5588), - (109, 'Ghost Sentinel', 2, 41, 32, 34, 25, 12, 26, 4, 80, 6, 41, 300, 333, 35, 45, 35, 122, 69000, 28377, 10916, -4224, 0, 1.14, 1.231200, 7.5, 24.0, 1.14, 1.231200, 7.0, 23.5, 1147, 1146, 10, 2369, 5588), - (110, 'Storm Screamer', 2, 23, 24, 23, 44, 19, 37, 3, 54, 6, 41, 300, 333, 29, 41, 29, 122, 61000, 28295, 11063, -4224, 0, 1.14, 1.231200, 7.5, 24.0, 1.03, 0.889920, 7.0, 23.5, 425, 461, 6, 5588, 0), - (111, 'Spectral Master', 2, 23, 24, 23, 44, 19, 37, 3, 54, 6, 41, 300, 333, 29, 41, 29, 122, 61000, 28295, 11063, -4224, 0, 1.14, 1.231200, 7.5, 24.0, 1.03, 0.889920, 7.0, 23.5, 425, 461, 6, 5588, 0), - (112, 'Shillen Saint', 2, 23, 24, 23, 44, 19, 37, 3, 54, 6, 41, 300, 333, 29, 41, 29, 122, 61000, 28295, 11063, -4224, 0, 1.14, 1.231200, 7.5, 24.0, 1.03, 0.889920, 7.0, 23.5, 425, 461, 6, 5588, 0), - (113, 'Titan', 3, 40, 47, 26, 18, 12, 27, 4, 80, 6, 41, 300, 333, 31, 42, 31, 117, 87000, -56693, -113610, -690, 0, 1.06, 1.144800, 11.0, 28.0, 1.06, 1.144800, 7.0, 27.0, 1147, 1146, 2368, 2369, 5588), - (114, 'Grand Khauatari', 3, 40, 47, 26, 18, 12, 27, 4, 80, 6, 41, 300, 333, 31, 42, 31, 117, 87000, -56693, -113610, -690, 0, 1.06, 1.144800, 11.0, 28.0, 1.06, 1.144800, 7.0, 27.0, 1147, 1146, 2368, 2369, 5588), - (115, 'Dominator', 3, 27, 31, 24, 31, 15, 42, 3, 54, 6, 41, 300, 333, 30, 41, 30, 121, 68000, -56682, -113730, -690, 0, 1.04, 0.898560, 7.0, 27.5, 1.04, 0.898560, 8.0, 25.5, 425, 461, 2368, 5588, 0), - (116, 'Doomcryer', 3, 27, 31, 24, 31, 15, 42, 3, 54, 6, 41, 300, 333, 30, 41, 30, 121, 68000, -56682, -113730, -690, 0, 1.04, 0.898560, 7.0, 27.5, 1.04, 0.898560, 8.0, 25.5, 425, 461, 2368, 5588, 0), - (117, 'Fortune Seeker', 4, 39, 45, 29, 20, 10, 27, 4, 80, 6, 41, 300, 333, 33, 43, 33, 115, 83000, 108512, -174026, -400, 1, 1.09, 1.487196, 9.0, 18.0, 1.09, 1.487196, 5.0, 19.0, 1147, 1146, 10, 2370, 5588), - (118, 'Maestro', 4, 39, 45, 29, 20, 10, 27, 4, 80, 6, 41, 300, 333, 33, 43, 33, 115, 83000, 108512, -174026, -400, 1, 1.09, 1.487196, 9.0, 18.0, 1.09, 1.487196, 5.0, 19.0, 1147, 1146, 10, 2370, 5588); \ No newline at end of file + (0, 'Human Fighter',1,0,-1,40,43,30,21,11,25,4,80,6,41,300,333,33,44,33,115,81900, 80.0, 11.83, 0.37, 32.0, 4.73, 0.22, 30.0, 5.46, 0.14,-71338,258271,-3104,0, 1.10, 1.188000, 9.0, 23.0, 1.10, 1.188000, 8.0, 23.5,1147,1146,10,2369, 5588), + (1, 'Warrior',20,0,0,40,43,30,21,11,25,4,80,6,41,300,333,33,44,33,115,81900,327.0, 33.00, 0.37, 261.6, 26.40, 0.22, 144.0, 9.90, 0.14,-71338,258271,-3104,0, 1.10, 1.188000, 9.0, 23.0, 1.10, 1.188000, 8.0, 23.5,1147,1146,10,2369, 5588), + (2, 'Gladiator',40,0,1,40,43,30,21,11,25,4,80,6,41,300,333,33,44,33,115,81900,1044.0, 49.40, 0.37, 939.6, 44.46, 0.22, 359.1, 19.50, 0.14,-71338,258271,-3104,0, 1.10, 1.188000, 9.0, 23.0, 1.10, 1.188000, 8.0, 23.5,1147,1146,10,2369, 5588), + (3, 'Warlord',40,0,1,40,43,30,21,11,25,4,80,6,41,300,333,33,44,33,115,81900,1044.0, 54.60, 0.37, 835.2, 43.68, 0.22, 359.1, 19.50, 0.14,-71338,258271,-3104,0, 1.10, 1.188000, 9.0, 23.0, 1.10, 1.188000, 8.0, 23.5,1147,1146,10,2369, 5588), + (4, 'Human Knight',20,0,0,40,43,30,21,11,25,4,80,6,41,300,333,33,44,33,115,81900,327.0, 29.70, 0.37, 196.2, 17.82, 0.22, 144.0, 9.90, 0.14,-71338,258271,-3104,0, 1.10, 1.188000, 9.0, 23.0, 1.10, 1.188000, 8.0, 23.5,1147,1146,10,2369, 5588), + (5, 'Paladin',40,0,4,40,43,30,21,11,25,4,80,6,41,300,333,33,44,33,115,81900,972.3, 46.80, 0.37, 583.3, 28.08, 0.22, 359.1, 19.50, 0.14,-71338,258271,-3104,0, 1.10, 1.188000, 9.0, 23.0, 1.10, 1.188000, 8.0, 23.5,1147,1146,10,2369, 5588), + (6, 'Dark Avenger',40,0,4,40,43,30,21,11,25,4,80,6,41,300,333,33,44,33,115,81900,972.3, 46.80, 0.37, 583.3, 28.08, 0.22, 359.1, 19.50, 0.14,-71338,258271,-3104,0, 1.10, 1.188000, 9.0, 23.0, 1.10, 1.188000, 8.0, 23.5,1147,1146,10,2369, 5588), + (7, 'Rogue',20,0,0,40,43,30,21,11,25,4,80,6,41,300,333,33,44,33,115,81900,327.0, 27.50, 0.37, 130.8, 11.00, 0.22, 144.0, 9.90, 0.14,-71338,258271,-3104,0, 1.10, 1.188000, 9.0, 23.0, 1.10, 1.188000, 8.0, 23.5,1147,1146,10,2369, 5588), + (8, 'Treasure Hunter',40,0,7,40,43,30,21,11,25,4,80,6,41,300,333,33,44,33,115,81900,924.5, 41.60, 0.37, 369.8, 16.64, 0.22, 359.1, 19.50, 0.14,-71338,258271,-3104,0, 1.10, 1.188000, 9.0, 23.0, 1.10, 1.188000, 8.0, 23.5,1147,1146,10,2369, 5588), + (9, 'Hawkeye',40,0,7,40,43,30,21,11,25,4,80,6,41,300,333,33,44,33,115,81900,924.5, 44.20, 0.37, 647.1, 30.94, 0.22, 359.1, 19.50, 0.14,-71338,258271,-3104,0, 1.10, 1.188000, 9.0, 23.0, 1.10, 1.188000, 8.0, 23.5,1147,1146,10,2369, 5588), + (10, 'Human Mage',1,0,-1,22,27,21,41,20,39,3,54,6,41,300,333,28,40,28,120,62500,101.0, 15.57, 0.37, 50.5, 7.84, 0.22, 40.0, 7.38, 0.14,-90890,248027,-3570,0, 1.01, 0.872640, 7.5, 22.8, 1.01, 0.872640, 6.5, 22.5,425,461,6,5588, 0), + (11, 'Human Wizard',20,0,10,22,27,21,41,20,39,3,54,6,41,300,333,28,40,28,120,62500,424.0, 27.60, 0.37, 212.0, 13.85, 0.22, 192.0, 13.30, 0.14,-90890,248027,-3570,0, 1.01, 0.872640, 7.5, 22.8, 1.01, 0.872640, 6.5, 22.5,425,461,6,5588, 0), + (12, 'Sorcerer',40,0,11,22,27,21,41,20,39,3,54,6,41,300,333,28,40,28,120,62500,1021.5, 45.60, 0.37, 510.7, 22.85, 0.22, 478.8, 26.10, 0.14,-90890,248027,-3570,0, 1.01, 0.872640, 7.5, 22.8, 1.01, 0.872640, 6.5, 22.5,425,461,6,5588, 0), + (13, 'Necromancer',40,0,11,22,27,21,41,20,39,3,54,6,41,300,333,28,40,28,120,62500,1021.5, 45.60, 0.37, 510.7, 22.85, 0.22, 478.8, 26.10, 0.14,-90890,248027,-3570,0, 1.01, 0.872640, 7.5, 22.8, 1.01, 0.872640, 6.5, 22.5,425,461,6,5588, 0), + (14, 'Warlock',40,0,11,22,27,21,41,20,39,3,54,6,41,300,333,28,40,28,120,62500,1021.5, 49.50, 0.37, 612.9, 29.74, 0.22, 478.8, 26.10, 0.14,-90890,248027,-3570,0, 1.01, 0.872640, 7.5, 22.8, 1.01, 0.872640, 6.5, 22.5,425,461,6,5588, 0), + (15, 'Cleric',20,0,10,22,27,21,41,20,39,3,54,6,41,300,333,28,40,28,120,62500,424.0, 34.20, 0.37, 212.0, 17.15, 0.22, 192.0, 13.30, 0.14,-90890,248027,-3570,0, 1.01, 0.872640, 7.5, 22.8, 1.01, 0.872640, 6.5, 22.5,425,461,6,5588, 0), + (16, 'Bishop',40,0,15,22,27,21,41,20,39,3,54,6,41,300,333,28,40,28,120,62500,1164.9, 49.50, 0.37, 815.4, 34.68, 0.22, 478.8, 26.10, 0.14,-90890,248027,-3570,0, 1.01, 0.872640, 7.5, 22.8, 1.01, 0.872640, 6.5, 22.5,425,461,6,5588, 0), + (17, 'Human Prophet',40,0,15,22,27,21,41,20,39,3,54,6,41,300,333,28,40,28,120,62500,1164.9, 53.40, 0.37, 582.4, 26.75, 0.22, 478.8, 26.10, 0.14,-90890,248027,-3570,0, 1.01, 0.872640, 7.5, 22.8, 1.01, 0.872640, 6.5, 22.5,425,461,6,5588, 0), + (18, 'Elf Fighter',1,1,-1,36,36,35,23,14,26,4,80,6,41,300,333,36,46,36,125,73000,89.0, 12.74, 0.37, 35.6, 5.00, 0.22, 30.0, 5.46, 0.14,45978,41196,-3440,0, 1.15, 1.242000, 7.5, 24.0, 1.15, 1.242000, 7.5, 23.0,1147,1146,10,2369, 5588), + (19, 'Elf Knight',20,1,18,36,36,35,23,14,26,4,80,6,41,300,333,36,46,36,125,73000,355.0, 33.00, 0.37, 177.5, 16.50, 0.22, 144.0, 9.90, 0.14,45978,41196,-3440,0, 1.15, 1.242000, 7.5, 24.0, 1.15, 1.242000, 7.5, 23.0,1147,1146,10,2369, 5588), + (20, 'Temple Knight',40,1,19,36,36,35,23,14,26,4,80,6,41,300,333,36,46,36,125,73000,1072.0, 52.00, 0.37, 643.2, 31.20, 0.22, 359.1, 19.50, 0.14,45978,41196,-3440,0, 1.15, 1.242000, 7.5, 24.0, 1.15, 1.242000, 7.5, 23.0,1147,1146,10,2369, 5588), + (21, 'Swordsinger',40,1,19,36,36,35,23,14,26,4,80,6,41,300,333,36,46,36,125,73000,1072.0, 54.60, 0.37, 536.0, 27.30, 0.22, 359.1, 19.50, 0.14,45978,41196,-3440,0, 1.15, 1.242000, 7.5, 24.0, 1.15, 1.242000, 7.5, 23.0,1147,1146,10,2369, 5588), + (22, 'Scout',20,1,18,36,36,35,23,14,26,4,80,6,41,300,333,36,46,36,125,73000,355.0, 30.80, 0.37, 142.0, 12.32, 0.22, 144.0, 9.90, 0.14,45978,41196,-3440,0, 1.15, 1.242000, 7.5, 24.0, 1.15, 1.242000, 7.5, 23.0,1147,1146,10,2369, 5588), + (23, 'Plains Walker',40,1,22,36,36,35,23,14,26,4,80,6,41,300,333,36,46,36,125,73000,1024.2, 46.80, 0.37, 409.6, 18.72, 0.22, 359.1, 19.50, 0.14,45978,41196,-3440,0, 1.15, 1.242000, 7.5, 24.0, 1.15, 1.242000, 7.5, 23.0,1147,1146,10,2369, 5588), + (24, 'Silver Ranger',40,1,22,36,36,35,23,14,26,4,80,6,41,300,333,36,46,36,125,73000,1024.2, 49.40, 0.37, 512.1, 24.70, 0.22, 359.1, 19.50, 0.14,45978,41196,-3440,0, 1.15, 1.242000, 7.5, 24.0, 1.15, 1.242000, 7.5, 23.0,1147,1146,10,2369, 5588), + (25, 'Elf Mage',1,1,-1,21,25,24,37,23,40,3,54,6,41,300,333,30,41,30,122,62400,104.0, 15.57, 0.37, 52.0, 7.84, 0.22, 40.0, 7.38, 0.14,46182,41198,-3440,0, 1.04, 0.898560, 7.5, 24.0, 1.04, 0.898560, 7.5, 23.0,425,461,6,5588, 0), + (26, 'Elf Wizard',20,1,25,21,25,24,37,23,40,3,54,6,41,300,333,30,41,30,122,62400,427.0, 28.70, 0.37, 213.5, 14.40, 0.22, 192.0, 13.30, 0.14,46182,41198,-3440,0, 1.04, 0.898560, 7.5, 24.0, 1.04, 0.898560, 7.5, 23.0,425,461,6,5588, 0), + (27, 'Spellsinger',40,1,26,21,25,24,37,23,40,3,54,6,41,300,333,30,41,30,122,62400,1048.4, 48.20, 0.37, 524.2, 24.15, 0.22, 478.8, 26.10, 0.14,46182,41198,-3440,0, 1.04, 0.898560, 7.5, 24.0, 1.04, 0.898560, 7.5, 23.0,425,461,6,5588, 0), + (28, 'Elemental Summoner',40,1,26,21,25,24,37,23,40,3,54,6,41,300,333,30,41,30,122,62400,1048.4, 50.80, 0.37, 629.0, 30.52, 0.22, 478.8, 26.10, 0.14,46182,41198,-3440,0, 1.04, 0.898560, 7.5, 24.0, 1.04, 0.898560, 7.5, 23.0,425,461,6,5588, 0), + (29, 'Oracle',20,1,25,21,25,24,37,23,40,3,54,6,41,300,333,30,41,30,122,62400,427.0, 35.30, 0.37, 213.5, 17.70, 0.22, 192.0, 13.30, 0.14,46182,41198,-3440,0, 1.04, 0.898560, 7.5, 24.0, 1.04, 0.898560, 7.5, 23.0,425,461,6,5588, 0), + (30, 'Elder',40,1,29,21,25,24,37,23,40,3,54,6,41,300,333,30,41,30,122,62400,1191.8, 54.70, 0.37, 595.9, 27.40, 0.22, 478.8, 26.10, 0.14,46182,41198,-3440,0, 1.04, 0.898560, 7.5, 24.0, 1.04, 0.898560, 7.5, 23.0,425,461,6,5588, 0), + (31, 'DE Fighter',1,2,-1,41,32,34,25,12,26,4,80,6,41,300,333,35,45,35,122,69000,94.0, 13.65, 0.37, 37.6, 5.46, 0.22, 30.0, 5.46, 0.14,28377,10916,-4224,0, 1.14, 1.231200, 7.5, 24.0, 1.14, 1.231200, 7.0, 23.5,1147,1146,10,2369, 5588), + (32, 'Palus Knight',20,2,31,41,32,34,25,12,26,4,80,6,41,300,333,35,45,35,122,69000,379.0, 35.20, 0.37, 189.5, 17.60, 0.22, 144.0, 9.90, 0.14,28377,10916,-4224,0, 1.14, 1.231200, 7.5, 24.0, 1.14, 1.231200, 7.0, 23.5,1147,1146,10,2369, 5588), + (33, 'Shillien Knight',40,2,32,41,32,34,25,12,26,4,80,6,41,300,333,35,45,35,122,69000,1143.8, 54.60, 0.37, 686.2, 32.76, 0.22, 359.1, 19.50, 0.14,28377,10916,-4224,0, 1.14, 1.231200, 7.5, 24.0, 1.14, 1.231200, 7.0, 23.5,1147,1146,10,2369, 5588), + (34, 'Bladedancer',40,2,32,41,32,34,25,12,26,4,80,6,41,300,333,35,45,35,122,69000,1143.8, 58.50, 0.37, 571.9, 29.25, 0.22, 359.1, 19.50, 0.14,28377,10916,-4224,0, 1.14, 1.231200, 7.5, 24.0, 1.14, 1.231200, 7.0, 23.5,1147,1146,10,2369, 5588), + (35, 'Assassin',20,2,31,41,32,34,25,12,26,4,80,6,41,300,333,35,45,35,122,69000,379.0, 33.00, 0.37, 151.6, 13.20, 0.22, 144.0, 9.90, 0.14,28377,10916,-4224,0, 1.14, 1.231200, 7.5, 24.0, 1.14, 1.231200, 7.0, 23.5,1147,1146,10,2369, 5588), + (36, 'Abyss Walker',40,2,35,41,32,34,25,12,26,4,80,6,41,300,333,35,45,35,122,69000,1096.0, 49.40, 0.37, 438.4, 19.76, 0.22, 359.1, 19.50, 0.14,28377,10916,-4224,0, 1.14, 1.231200, 7.5, 24.0, 1.14, 1.231200, 7.0, 23.5,1147,1146,10,2369, 5588), + (37, 'Phantom Ranger',40,2,35,41,32,34,25,12,26,4,80,6,41,300,333,35,45,35,122,69000,1096.0, 52.00, 0.37, 548.0, 26.00, 0.22, 359.1, 19.50, 0.14,28377,10916,-4224,0, 1.14, 1.231200, 7.5, 24.0, 1.14, 1.231200, 7.0, 23.5,1147,1146,10,2369, 5588), + (38, 'DE Mage',1,2,-1,23,24,23,44,19,37,3,54,6,41,300,333,29,41,29,122,61000,106.0, 15.57, 0.37, 53.0, 7.84, 0.22, 40.0, 7.38, 0.14,28295,11063,-4224,0, 1.14, 1.231200, 7.5, 24.0, 1.03, 0.889920, 7.0, 23.5,425,461,6,5588, 0), + (39, 'DE Wizard',20,2,38,23,24,23,44,19,37,3,54,6,41,300,333,29,41,29,122,61000,429.0, 29.80, 0.37, 214.5, 14.95, 0.22, 192.0, 13.30, 0.14,28295,11063,-4224,0, 1.14, 1.231200, 7.5, 24.0, 1.03, 0.889920, 7.0, 23.5,425,461,6,5588, 0), + (40, 'Spell Howler',40,2,39,23,24,23,44,19,37,3,54,6,41,300,333,29,41,29,122,61000,1074.3, 48.20, 0.37, 537.1, 24.15, 0.22, 478.8, 26.10, 0.14,28295,11063,-4224,0, 1.14, 1.231200, 7.5, 24.0, 1.03, 0.889920, 7.0, 23.5,425,461,6,5588, 0), + (41, 'Phantom Summoner',40,2,39,23,24,23,44,19,37,3,54,6,41,300,333,29,41,29,122,61000,1074.3, 52.10, 0.37, 644.5, 31.30, 0.22, 478.8, 26.10, 0.14,28295,11063,-4224,0, 1.14, 1.231200, 7.5, 24.0, 1.03, 0.889920, 7.0, 23.5,425,461,6,5588, 0), + (42, 'Shillien Oracle',20,2,38,23,24,23,44,19,37,3,54,6,41,300,333,29,41,29,122,61000,429.0, 36.40, 0.37, 214.5, 18.25, 0.22, 192.0, 13.30, 0.14,28295,11063,-4224,0, 1.14, 1.231200, 7.5, 24.0, 1.03, 0.889920, 7.0, 23.5,425,461,6,5588, 0), + (43, 'Shillien Elder',40,2,42,23,24,23,44,19,37,3,54,6,41,300,333,29,41,29,122,61000,1217.7, 54.70, 0.37, 608.8, 27.40, 0.22, 478.8, 26.10, 0.14,28295,11063,-4224,0, 1.14, 1.231200, 7.5, 24.0, 1.03, 0.889920, 7.0, 23.5,425,461,6,5588, 0), + (44, 'Orc Fighter',1,3,-1,40,47,26,18,12,27,4,80,6,41,300,333,31,42,31,117,87000,80.0, 12.64, 0.37, 40.0, 6.27, 0.22, 30.0, 5.36, 0.14,-56693,-113610,-690,0, 1.06, 1.144800, 11.0, 28.0, 1.06, 1.144800, 7.0, 27.0,1147,1146,2368,2369, 5588), + (45, 'Raider',20,3,44,40,47,26,18,12,27,4,80,6,41,300,333,31,42,31,117,87000,346.0, 35.10, 0.37, 242.2, 24.54, 0.22, 144.0, 9.80, 0.14,-56693,-113610,-690,0, 1.06, 1.144800, 11.0, 28.0, 1.06, 1.144800, 7.0, 27.0,1147,1146,2368,2369, 5588), + (46, 'Destroyer',40,3,45,40,47,26,18,12,27,4,80,6,41,300,333,31,42,31,117,87000,1110.8, 57.10, 0.37, 777.5, 39.94, 0.22, 359.1, 19.40, 0.14,-56693,-113610,-690,0, 1.06, 1.144800, 11.0, 28.0, 1.06, 1.144800, 7.0, 27.0,1147,1146,2368,2369, 5588), + (47, 'Monk',20,3,44,40,47,26,18,12,27,4,80,6,41,300,333,31,42,31,117,87000,346.0, 32.90, 0.37, 173.0, 16.40, 0.22, 144.0, 9.80, 0.14,-56682,-113610,-690,0, 1.06, 1.144800, 11.0, 28.0, 1.06, 1.144800, 7.0, 27.0,1147,1146,2368,2369, 5588), + (48, 'Tyrant',40,3,47,40,47,26,18,12,27,4,80,6,41,300,333,31,42,31,117,87000,1063.0, 54.50, 0.37, 531.5, 27.20, 0.22, 359.1, 19.40, 0.14,-56693,-113610,-690,0, 1.06, 1.144800, 11.0, 28.0, 1.06, 1.144800, 7.0, 27.0,1147,1146,2368,2369, 5588), + (49, 'Orc Mage',1,3,-1,27,31,24,31,15,42,3,54,6,41,300,333,30,41,30,121,68000,95.0, 15.47, 0.37, 47.5, 7.74, 0.22, 40.0, 7.28, 0.14,-56682,-113730,-690,0, 1.04, 0.898560, 7.0, 27.5, 1.04, 0.898560, 8.0, 25.5,425,461,2368,5588, 0), + (50, 'Shaman',20,3,49,27,31,24,31,15,42,3,54,6,41,300,333,30,41,30,121,68000,418.0, 35.20, 0.37, 209.0, 17.60, 0.22, 192.0, 13.20, 0.14,-56682,-113730,-690,0, 1.04, 0.898560, 7.0, 27.5, 1.04, 0.898560, 8.0, 25.5,425,461,2368,5588, 0), + (51, 'Overlord',40,3,50,27,31,24,31,15,42,3,54,6,41,300,333,30,41,30,121,68000,1182.8, 53.30, 0.37, 946.2, 42.64, 0.22, 478.8, 26.00, 0.14,-56682,-113730,-690,0, 1.04, 0.898560, 7.0, 27.5, 1.04, 0.898560, 8.0, 25.5,425,461,2368,5588, 0), + (52, 'Warcryer',40,3,50,27,31,24,31,15,42,3,54,6,41,300,333,30,41,30,121,68000,1182.8, 53.30, 0.37, 591.4, 26.65, 0.22, 478.8, 26.00, 0.14,-56682,-113730,-690,0, 1.04, 0.898560, 7.0, 27.5, 1.04, 0.898560, 8.0, 25.5,425,461,2368,5588, 0), + (53, 'Dwarf Fighter',1,4,-1,39,45,29,20,10,27,4,80,6,41,300,333,33,43,33,115,83000,80.0, 12.64, 0.37, 56.0, 8.82, 0.22, 30.0, 5.36, 0.14,108512,-174026,-400,1, 1.09, 1.487196, 9.0, 18.0, 1.09, 1.487196, 5.0, 19.0,1147,1146,10,2370, 5588), + (54, 'Scavenger',20,4,53,39,45,29,20,10,27,4,80,6,41,300,333,33,43,33,115,83000,346.0, 35.10, 0.37, 242.2, 24.54, 0.22, 144.0, 9.80, 0.14,108512,-174026,-400,1, 1.09, 1.487196, 9.0, 18.0, 1.09, 1.487196, 5.0, 19.0,1147,1146,10,2370, 5588), + (55, 'Bounty Hunter',40,4,54,39,45,29,20,10,27,4,80,6,41,300,333,33,43,33,115,83000,1110.8, 57.10, 0.37, 777.5, 39.94, 0.22, 359.1, 19.40, 0.14,108512,-174026,-400,1, 1.09, 1.487196, 9.0, 18.0, 1.09, 1.487196, 5.0, 19.0,1147,1146,10,2370, 5588), + (56, 'Artisan',20,4,53,39,45,29,20,10,27,4,80,6,41,300,333,33,43,33,115,83000,346.0, 32.90, 0.37, 276.8, 26.30, 0.22, 144.0, 9.80, 0.14,108512,-174026,-400,1, 1.09, 1.487196, 9.0, 18.0, 1.09, 1.487196, 5.0, 19.0,1147,1146,10,2370, 5588), + (57, 'Warsmith',40,4,56,39,45,29,20,10,27,4,80,6,41,300,333,33,43,33,115,83000,1063.0, 54.50, 0.37, 850.4, 43.58, 0.22, 359.1, 19.40, 0.14,108512,-174026,-400,1, 1.09, 1.487196, 9.0, 18.0, 1.09, 1.487196, 5.0, 19.0,1147,1146,10,2370, 5588), + (88, 'Duelist',76,0,2,40,43,30,21,11,25,4,80,6,41,300,333,33,44,33,115,81900,3061.8, 63.08, 0.37, 2755.6, 56.77, 0.22, 1155.6, 24.90, 0.14 ,-71338,258271,-3104,0, 1.10, 1.188000, 9.0, 23.0, 1.10, 1.188000, 8.0, 23.5,1147,1146,10,2369, 5588), + (89, 'DreadNought',76,0,3,40,43,30,21,11,25,4,80,6,41,300,333,33,44,33,115,81900,3274.2, 69.72, 0.37, 2619.3, 55.78, 0.22, 1155.6, 24.90, 0.14 ,-71338,258271,-3104,0, 1.10, 1.188000, 9.0, 23.0, 1.10, 1.188000, 8.0, 23.5,1147,1146,10,2369, 5588), + (90, 'Phoenix Knight',76,0,5,40,43,30,21,11,25,4,80,6,41,300,333,33,44,33,115,81900,2883.9, 59.76, 0.37, 1730.3, 35.86, 0.22, 1155.6, 24.90, 0.14 ,-71338,258271,-3104,0, 1.10, 1.188000, 9.0, 23.0, 1.10, 1.188000, 8.0, 23.5,1147,1146,10,2369, 5588), + (91, 'Hell Knight',76,0,6,40,43,30,21,11,25,4,80,6,41,300,333,33,44,33,115,81900,2883.9, 59.76, 0.37, 1730.3, 35.86, 0.22, 1155.6, 24.90, 0.14 ,-71338,258271,-3104,0, 1.10, 1.188000, 9.0, 23.0, 1.10, 1.188000, 8.0, 23.5,1147,1146,10,2369, 5588), + (92, 'Sagittarius',76,0,9,40,43,30,21,11,25,4,80,6,41,300,333,33,44,33,115,81900,2729.9, 56.44, 0.37, 1910.9, 39.51, 0.22, 1155.6, 24.90, 0.14 ,-71338,258271,-3104,0, 1.10, 1.188000, 9.0, 23.0, 1.10, 1.188000, 8.0, 23.5,1147,1146,10,2369, 5588), + (93, 'Adventurer',76,0,8,40,43,30,21,11,25,4,80,6,41,300,333,33,44,33,115,81900,2623.7, 53.12, 0.37, 1049.4, 21.25, 0.22, 1155.6, 24.90, 0.14 ,-71338,258271,-3104,0, 1.10, 1.188000, 9.0, 23.0, 1.10, 1.188000, 8.0, 23.5,1147,1146,10,2369, 5588), + (94, 'Archmage',76,0,12,22,27,21,41,20,39,3,54,6,41,300,333,28,40,28,120,62500,2880.0, 58.10, 0.37, 1440.0, 29.05, 0.22, 1540.8, 33.20, 0.14 ,-90890,248027,-3570,0, 1.01, 0.872640, 7.5, 22.8, 1.01, 0.872640, 6.5, 22.5,425,461,6,5588, 0), + (95, 'Soultaker',76,0,13,22,27,21,41,20,39,3,54,6,41,300,333,28,40,28,120,62500,2880.0, 58.10, 0.37, 1440.0, 29.05, 0.22, 1540.8, 33.20, 0.14 ,-90890,248027,-3570,0, 1.01, 0.872640, 7.5, 22.8, 1.01, 0.872640, 6.5, 22.5,425,461,6,5588, 0), + (96, 'Arcana Lord',76,0,14,22,27,21,41,20,39,3,54,6,41,300,333,28,40,28,120,62500,3039.3, 63.08, 0.37, 1823.5, 37.85, 0.22, 1540.8, 33.20, 0.14 ,-90890,248027,-3570,0, 1.01, 0.872640, 7.5, 22.8, 1.01, 0.872640, 6.5, 22.5,425,461,6,5588, 0), + (97, 'Cardinal',76,0,16,22,27,21,41,20,39,3,54,6,41,300,333,28,40,28,120,62500,3182.7, 63.08, 0.37, 2227.8, 44.16, 0.22, 1540.8, 33.20, 0.14 ,-90890,248027,-3570,0, 1.01, 0.872640, 7.5, 22.8, 1.01, 0.872640, 6.5, 22.5,425,461,6,5588, 0), + (98, 'Hierophant',76,0,17,22,27,21,41,20,39,3,54,6,41,300,333,28,40,28,120,62500,3342.0, 68.06, 0.37, 1671.0, 34.03, 0.22, 1540.8, 33.20, 0.14 ,-90890,248027,-3570,0, 1.01, 0.872640, 7.5, 22.8, 1.01, 0.872640, 6.5, 22.5,425,461,6,5588, 0), + (99, 'Eva Templar',76,1,20,36,36,35,23,14,26,4,80,6,41,300,333,36,46,36,125,73000,3196.0, 66.40, 0.37, 1917.6, 39.84, 0.22, 1155.6, 24.90, 0.14 ,45978,41196,-3440,0, 1.15, 1.242000, 7.5, 24.0, 1.15, 1.242000, 7.5, 23.0,1147,1146,10,2369, 5588), + (100, 'Sword Muse',76,1,21,36,36,35,23,14,26,4,80,6,41,300,333,36,46,36,125,73000,3302.2, 69.72, 0.37, 1651.1, 34.86, 0.22, 1155.6, 24.90, 0.14 ,45978,41196,-3440,0, 1.15, 1.242000, 7.5, 24.0, 1.15, 1.242000, 7.5, 23.0,1147,1146,10,2369, 5588), + (101, 'Wind Rider',76,1,23,36,36,35,23,14,26,4,80,6,41,300,333,36,46,36,125,73000,2935.8, 59.76, 0.37, 1174.3, 23.90, 0.22, 1155.6, 24.90, 0.14 ,45978,41196,-3440,0, 1.15, 1.242000, 7.5, 24.0, 1.15, 1.242000, 7.5, 23.0,1147,1146,10,2369, 5588), + (102, 'Moonlight Sentinel',76,1,24,36,36,35,23,14,26,4,80,6,41,300,333,36,46,36,125,73000,3042.0, 63.08, 0.37, 1521.0, 31.54, 0.22, 1155.6, 24.90, 0.14 ,45978,41196,-3440,0, 1.15, 1.242000, 7.5, 24.0, 1.15, 1.242000, 7.5, 23.0,1147,1146,10,2369, 5588), + (103, 'Mystic Muse',76,1,27,21,25,24,37,23,40,3,54,6,41,300,333,30,41,30,122,62400,3013.1, 61.42, 0.37, 1506.5, 30.71, 0.22, 1540.8, 33.20, 0.14 ,46182,41198,-3440,0, 1.04, 0.898560, 7.5, 24.0, 1.04, 0.898560, 7.5, 23.0,425,461,6,5588, 0), + (104, 'Elemental Master',76,1,28,21,25,24,37,23,40,3,54,6,41,300,333,30,41,30,122,62400,3119.3, 64.74, 0.37, 1871.5, 38.84, 0.22, 1540.8, 33.20, 0.14 ,46182,41198,-3440,0, 1.04, 0.898560, 7.5, 24.0, 1.04, 0.898560, 7.5, 23.0,425,461,6,5588, 0), + (105, 'Eva Saint',76,1,30,21,25,24,37,23,40,3,54,6,41,300,333,30,41,30,122,62400,3422.0, 69.72, 0.37, 1711.0, 34.86, 0.22, 1540.8, 33.20, 0.14 ,46182,41198,-3440,0, 1.04, 0.898560, 7.5, 24.0, 1.04, 0.898560, 7.5, 23.0,425,461,6,5588, 0), + (106, 'Shillien Templar',76,2,33,41,32,34,25,12,26,4,80,6,41,300,333,35,45,35,122,69000,3374.0, 69.72, 0.37, 2024.4, 41.83, 0.22, 1155.6, 24.90, 0.14 ,28377,10916,-4224,0, 1.14, 1.231200, 7.5, 24.0, 1.14, 1.231200, 7.0, 23.5,1147,1146,10,2369, 5588), + (107, 'Spectral Dancer',76,2,34,41,32,34,25,12,26,4,80,6,41,300,333,35,45,35,122,69000,3533.3, 74.70, 0.37, 1766.6, 37.35, 0.22, 1155.6, 24.90, 0.14 ,28377,10916,-4224,0, 1.14, 1.231200, 7.5, 24.0, 1.14, 1.231200, 7.0, 23.5,1147,1146,10,2369, 5588), + (108, 'Ghost Hunter',76,2,36,41,32,34,25,12,26,4,80,6,41,300,333,35,45,35,122,69000,3113.8, 63.08, 0.37, 1245.5, 25.23, 0.22, 1155.6, 24.90, 0.14 ,28377,10916,-4224,0, 1.14, 1.231200, 7.5, 24.0, 1.14, 1.231200, 7.0, 23.5,1147,1146,10,2369, 5588), + (109, 'Ghost Sentinel',76,2,37,41,32,34,25,12,26,4,80,6,41,300,333,35,45,35,122,69000,3220.0, 66.40, 0.37, 1610.0, 33.20, 0.22, 1155.6, 24.90, 0.14 ,28377,10916,-4224,0, 1.14, 1.231200, 7.5, 24.0, 1.14, 1.231200, 7.0, 23.5,1147,1146,10,2369, 5588), + (110, 'Storm Screamer',76,2,40,23,24,23,44,19,37,3,54,6,41,300,333,29,41,29,122,61000,3039.0, 61.42, 0.37, 1519.5, 30.71, 0.22, 1540.8, 33.20, 0.14 ,28295,11063,-4224,0, 1.14, 1.231200, 7.5, 24.0, 1.03, 0.889920, 7.0, 23.5,425,461,6,5588, 0), + (111, 'Spectral Master',76,2,41,23,24,23,44,19,37,3,54,6,41,300,333,29,41,29,122,61000,3198.3, 66.40, 0.37, 1918.9, 39.84, 0.22, 1540.8, 33.20, 0.14 ,28295,11063,-4224,0, 1.14, 1.231200, 7.5, 24.0, 1.03, 0.889920, 7.0, 23.5,425,461,6,5588, 0), + (112, 'Shillen Saint',76,2,43,23,24,23,44,19,37,3,54,6,41,300,333,29,41,29,122,61000,3447.9, 69.72, 0.37, 1723.9, 34.86, 0.22, 1540.8, 33.20, 0.14 ,28295,11063,-4224,0, 1.14, 1.231200, 7.5, 24.0, 1.03, 0.889920, 7.0, 23.5,425,461,6,5588, 0), + (113, 'Titan',76,3,46,40,47,26,18,12,27,4,80,6,41,300,333,31,42,31,117,87000,3447.2, 72.94, 0.37, 2413.0, 51.03, 0.22, 1155.6, 24.80, 0.14 ,-56693,-113610,-690,0, 1.06, 1.144800, 11.0, 28.0, 1.06, 1.144800, 7.0, 27.0,1147,1146,2368,2369, 5588), + (114, 'Grand Khauatari',76,3,48,40,47,26,18,12,27,4,80,6,41,300,333,31,42,31,117,87000,3293.2, 69.62, 0.37, 1646.6, 34.76, 0.22, 1155.6, 24.80, 0.14 ,-56693,-113610,-690,0, 1.06, 1.144800, 11.0, 28.0, 1.06, 1.144800, 7.0, 27.0,1147,1146,2368,2369, 5588), + (115, 'Dominator',76,3,51,27,31,24,31,15,42,3,54,6,41,300,333,30,41,30,121,68000,3359.9, 67.96, 0.37, 2687.9, 54.35, 0.22, 1540.8, 33.10, 0.14 ,-56682,-113730,-690,0, 1.04, 0.898560, 7.0, 27.5, 1.04, 0.898560, 8.0, 25.5,425,461,2368,5588, 0), + (116, 'Doomcryer',76,3,52,27,31,24,31,15,42,3,54,6,41,300,333,30,41,30,121,68000,3359.9, 67.96, 0.37, 1679.9, 33.93, 0.22, 1540.8, 33.10, 0.14 ,-56682,-113730,-690,0, 1.04, 0.898560, 7.0, 27.5, 1.04, 0.898560, 8.0, 25.5,425,461,2368,5588, 0), + (117, 'Fortune Seeker',76,4,55,39,45,29,20,10,27,4,80,6,41,300,333,33,43,33,115,83000,3447.2, 72.94, 0.37, 2413.0, 51.03, 0.22, 1155.6, 24.80, 0.14 ,108512,-174026,-400,1, 1.09, 1.487196, 9.0, 18.0, 1.09, 1.487196, 5.0, 19.0,1147,1146,10,2370, 5588), + (118, 'Maestro',76,4,57,39,45,29,20,10,27,4,80,6,41,300,333,33,43,33,115,83000,3293.2, 69.62, 0.37, 2634.5, 55.68, 0.22, 1155.6, 24.80, 0.14,108512,-174026,-400,1, 1.09, 1.487196, 9.0, 18.0, 1.09, 1.487196, 5.0, 19.0,1147,1146,10,2370, 5588); \ No newline at end of file diff --git a/Datapack/sql/clanhall.sql b/Datapack/sql/clanhall.sql index 22594268..9a6cd7f1 100644 --- a/Datapack/sql/clanhall.sql +++ b/Datapack/sql/clanhall.sql @@ -1,24 +1,27 @@ -- --------------------------- -- Table structure for clanhall -- --------------------------- +DROP TABLE IF EXISTS `clanhall` ; + CREATE TABLE IF NOT EXISTS `clanhall` ( - `id` int(11) NOT NULL default '0', - `name` varchar(40) NOT NULL default '', - `ownerId` int(11) NOT NULL default '0', - `lease` int(10) NOT NULL default '0', - `desc` text NOT NULL, - `location` varchar(15) NOT NULL default '', - `paidUntil` decimal(20,0) NOT NULL default '0', - `Grade` decimal(1,0) NOT NULL default '0', - `paid` int( 1 ) NOT NULL default '0', - PRIMARY KEY `id` (`id`) -); + `id` INT(11) NOT NULL DEFAULT '0', + `name` VARCHAR(40) NOT NULL DEFAULT '', + `ownerId` INT(11) NOT NULL DEFAULT '0', + `lease` INT(10) NOT NULL DEFAULT '0', + description TEXT NOT NULL, + `location` VARCHAR(15) NOT NULL DEFAULT '', + `paidUntil` DECIMAL(20,0) NOT NULL DEFAULT '0', + `Grade` DECIMAL(1,0) NOT NULL DEFAULT '0', + `paid` INT(1) NOT NULL DEFAULT '0', + PRIMARY KEY (`id`)) +ENGINE = InnoDB +DEFAULT CHARACTER SET = latin1; -- ---------------------------- -- Records -- ---------------------------- INSERT IGNORE INTO `clanhall` VALUE - ('21','Fortress of Resistance','0','100000','Ol Mahum Fortress of Resistance','Dion','0','0','0'), +('21','Fortress of Resistance','0','100000','Ol Mahum Fortress of Resistance','Dion','0','0','0'), ('22','Moonstone Hall','0','100000','Clan hall located in the Town of Gludio','Gludio','0','2','0'), ('23','Onyx Hall','0','100000','Clan hall located in the Town of Gludio','Gludio','0','2','0'), ('24','Topaz Hall','0','100000','Clan hall located in the Town of Gludio','Gludio','0','2','0'), diff --git a/Datapack/sql/dimensional_rift.sql b/Datapack/sql/dimensional_rift.sql index 0fe17c64..23b03a2b 100644 --- a/Datapack/sql/dimensional_rift.sql +++ b/Datapack/sql/dimensional_rift.sql @@ -3,8 +3,8 @@ -- ---------------------------- DROP TABLE IF EXISTS `dimensional_rift`; CREATE TABLE `dimensional_rift` ( - `type` tinyint(1) NOT NULL, - `room_id` tinyint(1) NOT NULL, + `type` tinyint(2) NOT NULL, + `room_id` tinyint(2) NOT NULL, `xMin` int(11) NOT NULL, `xMax` int(11) NOT NULL, `yMin` int(11) NOT NULL, diff --git a/Datapack/sql/experimental/l2j_full_structure.sql b/Datapack/sql/experimental/l2j_full_structure.sql index 7ea89d55..0e0e677c 100644 --- a/Datapack/sql/experimental/l2j_full_structure.sql +++ b/Datapack/sql/experimental/l2j_full_structure.sql @@ -183,7 +183,7 @@ DROP TABLE IF EXISTS `char_templates` ; CREATE TABLE IF NOT EXISTS `char_templates` ( `ClassId` INT(11) NOT NULL DEFAULT '0', `ClassName` VARCHAR(20) NOT NULL DEFAULT '', - `class_lvl` INT(3) NOT NULL DEFAULT '0', + `classLevel` INT(3) NOT NULL DEFAULT '0', `RaceId` INT(1) NOT NULL DEFAULT '0', `parent_id` INT(11) NOT NULL DEFAULT '0', `STR` INT(2) NOT NULL DEFAULT '0', @@ -382,7 +382,7 @@ CREATE TABLE IF NOT EXISTS `clanhall` ( `name` VARCHAR(40) NOT NULL DEFAULT '', `ownerId` INT(11) NOT NULL DEFAULT '0', `lease` INT(10) NOT NULL DEFAULT '0', - `desc` TEXT NOT NULL, + description TEXT NOT NULL, `location` VARCHAR(15) NOT NULL DEFAULT '', `paidUntil` DECIMAL(20,0) NOT NULL DEFAULT '0', `Grade` DECIMAL(1,0) NOT NULL DEFAULT '0', @@ -499,7 +499,7 @@ CREATE TABLE IF NOT EXISTS `npc` ( `str` DECIMAL(7,0) NULL DEFAULT NULL, `con` DECIMAL(7,0) NULL DEFAULT NULL, `dex` DECIMAL(7,0) NULL DEFAULT NULL, - `int` DECIMAL(7,0) NULL DEFAULT NULL, + intelligence DECIMAL(7,0) NULL DEFAULT NULL, `wit` DECIMAL(7,0) NULL DEFAULT NULL, `men` DECIMAL(7,0) NULL DEFAULT NULL, `exp` DECIMAL(9,0) NULL DEFAULT NULL, @@ -1155,8 +1155,8 @@ DEFAULT CHARACTER SET = latin1; DROP TABLE IF EXISTS `dimensional_rift` ; CREATE TABLE IF NOT EXISTS `dimensional_rift` ( - `type` TINYINT(1) NOT NULL, - `room_id` TINYINT(1) NOT NULL, + `type` TINYINT(2) NOT NULL, + `room_id` TINYINT(2) NOT NULL, `xMin` INT(11) NOT NULL, `xMax` INT(11) NOT NULL, `yMin` INT(11) NOT NULL, @@ -1524,11 +1524,6 @@ CREATE TABLE IF NOT EXISTS `merchants` ( FOREIGN KEY (`npc_id`) REFERENCES `npc` (`id`) ON DELETE NO ACTION - ON UPDATE NO ACTION, - CONSTRAINT `fk_merchants_merchant_areas_list1` - FOREIGN KEY (`merchant_area_id`) - REFERENCES `merchant_areas_list` (`merchant_area_id`) - ON DELETE NO ACTION ON UPDATE NO ACTION) ENGINE = InnoDB DEFAULT CHARACTER SET = latin1; @@ -1562,17 +1557,12 @@ CREATE TABLE IF NOT EXISTS `merchant_buylists` ( `item_id` DECIMAL(9,0) NOT NULL DEFAULT '0', `price` DECIMAL(11,0) NOT NULL DEFAULT '0', `shop_id` DECIMAL(9,0) NOT NULL DEFAULT '0', - `order` DECIMAL(4,0) NOT NULL DEFAULT '0', + ordering DECIMAL(4,0) NOT NULL DEFAULT '0', `count` INT(11) NOT NULL DEFAULT '-1', `currentCount` INT(11) NOT NULL DEFAULT '-1', `time` INT(11) NOT NULL DEFAULT '0', `savetimer` DECIMAL(20,0) NOT NULL DEFAULT '0', - PRIMARY KEY (`shop_id`, `order`), - CONSTRAINT `fk_merchant_buylists_merchant_shopids1` - FOREIGN KEY (`shop_id`) - REFERENCES `merchant_shopids` (`shop_id`) - ON DELETE NO ACTION - ON UPDATE NO ACTION) + PRIMARY KEY (`shop_id`, ordering)) ENGINE = InnoDB DEFAULT CHARACTER SET = latin1; diff --git a/Datapack/sql/merchant_buylists.sql b/Datapack/sql/merchant_buylists.sql index a2b1afd4..63cec8e7 100644 --- a/Datapack/sql/merchant_buylists.sql +++ b/Datapack/sql/merchant_buylists.sql @@ -1,24 +1,26 @@ -- -- Table structure for table `merchant_buylists` -- -DROP TABLE IF EXISTS merchant_buylists; -CREATE TABLE merchant_buylists ( - item_id decimal(9,0) NOT NULL default '0', - price decimal(11,0) NOT NULL default '0', - shop_id decimal(9,0) NOT NULL default '0', - `order` decimal(4,0) NOT NULL default '0', - `count` INT( 11 ) NOT NULL DEFAULT '-1', - `currentCount` INT( 11 ) NOT NULL DEFAULT '-1', - time INT NOT NULL DEFAULT '0', - savetimer DECIMAL(20,0) NOT NULL DEFAULT '0', - PRIMARY KEY (shop_id,`order`) -); +DROP TABLE IF EXISTS `merchant_buylists` ; + +CREATE TABLE IF NOT EXISTS `merchant_buylists` ( + `item_id` DECIMAL(9,0) NOT NULL DEFAULT '0', + `price` DECIMAL(11,0) NOT NULL DEFAULT '0', + `shop_id` DECIMAL(9,0) NOT NULL DEFAULT '0', + ordering DECIMAL(4,0) NOT NULL DEFAULT '0', + `count` INT(11) NOT NULL DEFAULT '-1', + `currentCount` INT(11) NOT NULL DEFAULT '-1', + `time` INT(11) NOT NULL DEFAULT '0', + `savetimer` DECIMAL(20,0) NOT NULL DEFAULT '0', + PRIMARY KEY (`shop_id`, ordering)) +ENGINE = InnoDB +DEFAULT CHARACTER SET = latin1; -- -- Dumping data for table `merchant_buylists` -- -INSERT INTO `merchant_buylists` (`item_id`,`price`,`shop_id`,`order`) VALUES +INSERT INTO `merchant_buylists` (`item_id`,`price`,`shop_id`, ordering) VALUES -- General Shops @@ -4685,7 +4687,7 @@ INSERT INTO `merchant_buylists` (`item_id`,`price`,`shop_id`,`order`) VALUES (8945,8100,133,101), (8946,6250,133,102); -INSERT INTO `merchant_buylists` (`item_id`,`price`,`shop_id`,`order`) VALUES +INSERT INTO `merchant_buylists` (`item_id`,`price`,`shop_id`,ordering) VALUES (4445,5100,134,0), (4446,5100,134,1), @@ -15811,7 +15813,7 @@ INSERT INTO `merchant_buylists` (`item_id`,`price`,`shop_id`,`order`) VALUES (7678,0,300542,30), (7679,0,300542,31); -INSERT INTO `merchant_buylists` (`item_id`,`price`,`shop_id`,`order`) VALUES +INSERT INTO `merchant_buylists` (`item_id`,`price`,`shop_id`, ordering) VALUES (6779,30000,355111,1), (6793,90000,355111,12), (6794,200000,355111,13), @@ -15866,7 +15868,7 @@ INSERT INTO `merchant_buylists` (`item_id`,`price`,`shop_id`,`order`) VALUES -- INTERLUDE GM SHOP START -- Accessory -INSERT INTO `merchant_buylists`(`item_id`,`price`,`shop_id`,`order`) VALUES +INSERT INTO `merchant_buylists`(`item_id`,`price`,`shop_id`,ordering) VALUES (8910,0,71032,1), (8911,0,71032,2), (8912,0,71032,3), @@ -15952,7 +15954,7 @@ INSERT INTO `merchant_buylists`(`item_id`,`price`,`shop_id`,`order`) VALUES -- -- Clan Hall Item Creation -- -INSERT INTO `merchant_buylists` (`item_id`,`price`,`shop_id`,`order`,`count`,time) VALUES +INSERT INTO `merchant_buylists` (`item_id`,`price`,`shop_id`,ordering,`count`,time) VALUES (6902,12900,135445,1,-1,0), (6316,300,135445,2,-1,0), (1829,500,135445,3,5,1), @@ -17634,7 +17636,7 @@ INSERT INTO `merchant_buylists` (`item_id`,`price`,`shop_id`,`order`,`count`,tim -- -- Castles Item Creation -- -INSERT INTO `merchant_buylists` (`item_id`,`price`,`shop_id`,`order`) VALUES +INSERT INTO `merchant_buylists` (`item_id`,`price`,`shop_id`,ordering) VALUES (5169,300,351001,1), (6838,500000,351001,2), (7015,12900,351001,3), @@ -17683,7 +17685,7 @@ INSERT INTO `merchant_buylists` (`item_id`,`price`,`shop_id`,`order`) VALUES -- -- Harvester -- -INSERT INTO `merchant_buylists` (`item_id`,`price`,`shop_id`,`order`,`count`,`currentCount`, time, savetimer) VALUES +INSERT INTO `merchant_buylists` (`item_id`,`price`,`shop_id`,ordering,`count`,`currentCount`, time, savetimer) VALUES (5125,575,335103,1,-1,-1,0,0), (5125,575,335145,1,-1,-1,0,0), (5125,575,335187,1,-1,-1,0,0), diff --git a/Datapack/sql/npc.sql b/Datapack/sql/npc.sql index ec980dad..2291f1f7 100644 --- a/Datapack/sql/npc.sql +++ b/Datapack/sql/npc.sql @@ -23,7 +23,7 @@ CREATE TABLE `npc`( `str` decimal(7,0) default NULL, `con` decimal(7,0) default NULL, `dex` decimal(7,0) default NULL, - `int` decimal(7,0) default NULL, + intelligence decimal(7,0) default NULL, `wit` decimal(7,0) default NULL, `men` decimal(7,0) default NULL, `exp` decimal(9,0) default NULL, @@ -50,7 +50,7 @@ CREATE TABLE `npc`( -- -- Dumping data for table `npc` -- -INSERT INTO `npc` (`id`,`idTemplate`,`name`,`serverSideName`,`title`,`serverSideTitle`,`class`,`collision_radius`,`collision_height`,`level`,`sex`,`type`,`attackrange`,`hp`,`mp`,`hpreg`,`mpreg`,`str`,`con`,`dex`,`int`,`wit`,`men`,`exp`,`sp`,`patk`,`pdef`,`matk`,`mdef`,`atkspd`,`aggro`,`matkspd`,`rhand`,`lhand`,`armor`,`walkspd`,`runspd`,`faction_id`,`faction_range`,`isUndead`,`absorb_level`,`absorb_type`) VALUES +INSERT INTO `npc` (`id`,`idTemplate`,`name`,`serverSideName`,`title`,`serverSideTitle`,`class`,`collision_radius`,`collision_height`,`level`,`sex`,`type`,`attackrange`,`hp`,`mp`,`hpreg`,`mpreg`,`str`,`con`,`dex`,intelligence,`wit`,`men`,`exp`,`sp`,`patk`,`pdef`,`matk`,`mdef`,`atkspd`,`aggro`,`matkspd`,`rhand`,`lhand`,`armor`,`walkspd`,`runspd`,`faction_id`,`faction_range`,`isUndead`,`absorb_level`,`absorb_type`) VALUES (12077,12077,'Wolf',0,'',0,'Monster.pet_wolf',13.00,11.50,15,'male','L2Pet',40,195,164,3.95,1.21,40,43,30,21,20,25,0,0,9,19,3,17,282,0,333,0,0,0,26,137,NULL,0,0,0,'LAST_HIT'), (12311,12311,'Hatchling of the Wind',0,'',0,'Monster.hatchling',9.00,10.00,35,'male','L2Pet',40,610,433,7.11,1.84,40,43,30,21,20,25,0,0,48,42,22,39,282,0,333,0,0,0,88,154,NULL,0,0,0,'LAST_HIT'), (12312,12312,'Hatchling of the Stars',0,'',0,'Monster.hatchling',9.00,10.00,35,'male','L2Pet',40,610,433,7.11,1.84,40,43,30,21,20,25,0,0,48,42,22,39,282,0,333,0,0,0,88,154,NULL,0,0,0,'LAST_HIT'), @@ -968,7 +968,7 @@ INSERT INTO `npc` (`id`,`idTemplate`,`name`,`serverSideName`,`title`,`serverSide (16023,16023,'Tiny Baby Kookaburra',0,'',0,'Monster2.baby_ostrich',20.00,31.00,99,'male','L2Monster',40,400000,9999,13.43,3.09,40,43,30,21,20,10,0,0,9000,5000,6000,6000,300,0,333,0,0,0,88,132,NULL,0,0,0,'LAST_HIT'), (16024,16024,'Tame Tiny Baby Kookaburra',0,'',0,'Monster2.baby_ostrich',20.00,31.00,99,'male','L2Monster',40,400000,9999,13.43,3.09,40,43,30,21,20,10,0,0,9000,5000,6000,6000,300,0,333,0,0,0,88,132,NULL,0,0,0,'LAST_HIT'); -INSERT INTO `npc` (`id`,`idTemplate`,`name`,`serverSideName`,`title`,`serverSideTitle`,`class`,`collision_radius`,`collision_height`,`level`,`sex`,`type`,`attackrange`,`hp`,`mp`,`hpreg`,`mpreg`,`str`,`con`,`dex`,`int`,`wit`,`men`,`exp`,`sp`,`patk`,`pdef`,`matk`,`mdef`,`atkspd`,`aggro`,`matkspd`,`rhand`,`lhand`,`armor`,`walkspd`,`runspd`,`faction_id`,`faction_range`,`isUndead`,`absorb_level`,`absorb_type`) VALUES +INSERT INTO `npc` (`id`,`idTemplate`,`name`,`serverSideName`,`title`,`serverSideTitle`,`class`,`collision_radius`,`collision_height`,`level`,`sex`,`type`,`attackrange`,`hp`,`mp`,`hpreg`,`mpreg`,`str`,`con`,`dex`,intelligence,`wit`,`men`,`exp`,`sp`,`patk`,`pdef`,`matk`,`mdef`,`atkspd`,`aggro`,`matkspd`,`rhand`,`lhand`,`armor`,`walkspd`,`runspd`,`faction_id`,`faction_range`,`isUndead`,`absorb_level`,`absorb_type`) VALUES (18001,18001,'Blood Queen',0,'',0,'Monster.bloody_queen',14.00,40.00,60,'female','L2Monster',40,3054,1150,10.27,2.45,40,43,30,21,20,10,4536,394,860,368,478,299,278,500,333,0,0,0,88,176,'cave_servant_clan',400,0,0,'LAST_HIT'), (18002,18002,'Blood Queen',0,'',0,'Monster.bloody_queen',14.00,40.00,60,'female','L2Monster',40,3054,1150,10.27,2.45,40,43,30,21,20,10,4320,375,946,368,478,299,282,500,333,0,0,0,88,176,'cave_servant_clan',300,0,0,'LAST_HIT'), (18003,18003,'Bearded Keltir',0,'',0,'Monster.keltir',9.50,10.00,1,'male','L2Monster',40,62,44,3.16,0.91,40,43,30,21,20,10,29,2,4,39,3,32,278,0,333,0,0,0,25,121,NULL,0,0,0,'LAST_HIT'), @@ -1316,7 +1316,7 @@ INSERT INTO `npc` (`id`,`idTemplate`,`name`,`serverSideName`,`title`,`serverSide (18345,18345,'Sprigant',0,'',0,'Monster3.Arachnoid',45.00,67.00,80,'male','L2Monster',40,1179,2057,13.43,3.09,40,43,30,21,20,10,0,0,2129,615,2129,511,300,500,333,0,0,0,0,0,NULL,0,0,0,'LAST_HIT'), (18346,18346,'Sprigant',0,'',0,'Monster3.Arachnoid',45.00,67.00,80,'male','L2Monster',40,1179,2057,13.43,3.09,40,43,30,21,20,10,0,0,2129,615,2129,511,300,500,333,0,0,0,0,0,NULL,0,0,0,'LAST_HIT'); -INSERT INTO `npc` (`id`,`idTemplate`,`name`,`serverSideName`,`title`,`serverSideTitle`,`class`,`collision_radius`,`collision_height`,`level`,`sex`,`type`,`attackrange`,`hp`,`mp`,`hpreg`,`mpreg`,`str`,`con`,`dex`,`int`,`wit`,`men`,`exp`,`sp`,`patk`,`pdef`,`matk`,`mdef`,`atkspd`,`aggro`,`matkspd`,`rhand`,`lhand`,`armor`,`walkspd`,`runspd`,`faction_id`,`faction_range`,`isUndead`,`absorb_level`,`absorb_type`) VALUES +INSERT INTO `npc` (`id`,`idTemplate`,`name`,`serverSideName`,`title`,`serverSideTitle`,`class`,`collision_radius`,`collision_height`,`level`,`sex`,`type`,`attackrange`,`hp`,`mp`,`hpreg`,`mpreg`,`str`,`con`,`dex`,intelligence,`wit`,`men`,`exp`,`sp`,`patk`,`pdef`,`matk`,`mdef`,`atkspd`,`aggro`,`matkspd`,`rhand`,`lhand`,`armor`,`walkspd`,`runspd`,`faction_id`,`faction_range`,`isUndead`,`absorb_level`,`absorb_type`) VALUES (20001,20001,'Gremlin',0,'',0,'Monster.gremlin',10.00,15.00,1,'male','L2Monster',40,62,44,3.16,0.91,40,43,30,21,20,10,29,2,9,39,3,32,278,0,333,0,0,0,22,55,NULL,0,0,0,'LAST_HIT'), (20002,20002,'Rabbit',0,'',0,'Monster.rabbit',5.00,4.50,1,'male','L2Monster',40,62,44,3.16,0.91,40,43,30,21,20,10,29,2,9,39,3,32,278,0,333,0,0,0,55,88,NULL,0,0,0,'LAST_HIT'), (20003,20003,'Goblin',0,'',0,'Monster.goblin',10.00,16.50,5,'male','L2Monster',40,126,77,3.16,0.91,40,43,30,21,20,10,178,5,13,48,4,39,278,0,333,4,0,0,44,121,'goblin_clan',300,0,0,'LAST_HIT'), @@ -2152,7 +2152,7 @@ INSERT INTO `npc` (`id`,`idTemplate`,`name`,`serverSideName`,`title`,`serverSide (20999,20999,'Roving Soul',0,'',0,'Monster.skeleton',11.00,25.00,53,'male','L2Monster',40,2481,923,10.27,2.45,40,43,30,21,20,10,4943,389,527,304,319,247,317,0,333,75,0,0,66,176,'undead_clan',300,1,0,'LAST_HIT'), (21000,21000,'Soul of Ruins',0,'',0,'Monster.human_ghost',8.00,22.00,54,'male','L2Monster',40,2562,955,10.27,2.45,40,43,30,21,20,10,4325,345,578,344,339,254,278,500,333,0,0,0,88,191,'undead_clan',300,1,0,'LAST_HIT'); -INSERT INTO `npc` (`id`,`idTemplate`,`name`,`serverSideName`,`title`,`serverSideTitle`,`class`,`collision_radius`,`collision_height`,`level`,`sex`,`type`,`attackrange`,`hp`,`mp`,`hpreg`,`mpreg`,`str`,`con`,`dex`,`int`,`wit`,`men`,`exp`,`sp`,`patk`,`pdef`,`matk`,`mdef`,`atkspd`,`aggro`,`matkspd`,`rhand`,`lhand`,`armor`,`walkspd`,`runspd`,`faction_id`,`faction_range`,`isUndead`,`absorb_level`,`absorb_type`) VALUES +INSERT INTO `npc` (`id`,`idTemplate`,`name`,`serverSideName`,`title`,`serverSideTitle`,`class`,`collision_radius`,`collision_height`,`level`,`sex`,`type`,`attackrange`,`hp`,`mp`,`hpreg`,`mpreg`,`str`,`con`,`dex`,intelligence,`wit`,`men`,`exp`,`sp`,`patk`,`pdef`,`matk`,`mdef`,`atkspd`,`aggro`,`matkspd`,`rhand`,`lhand`,`armor`,`walkspd`,`runspd`,`faction_id`,`faction_range`,`isUndead`,`absorb_level`,`absorb_type`) VALUES (21001,21001,'Wretched Archer',0,'',0,'Monster.skeleton_archer',11.00,27.00,55,'male','L2Monster',500,2643,987,10.27,2.45,40,43,30,21,20,10,5856,473,1639,292,360,261,249,0,333,282,0,0,44,191,'undead_clan',300,1,0,'LAST_HIT'), (21002,21002,'Doom Scout',0,'',0,'Monster.skeleton_royal_guard',11.00,28.50,56,'male','L2Monster',40,2724,1019,10.27,2.45,40,43,30,21,20,10,5163,424,679,301,382,269,317,500,333,242,2496,0,88,191,'doom_clan',300,1,0,'LAST_HIT'), (21003,21003,'Grave Lich',0,'',0,'Monster.liviona',15.00,28.00,57,'male','L2Monster',40,2806,1052,10.27,2.45,40,43,30,21,20,10,4725,393,675,374,405,276,278,0,333,0,0,0,88,191,'undead_clan',300,0,0,'LAST_HIT'), @@ -2968,7 +2968,7 @@ INSERT INTO `npc` (`id`,`idTemplate`,`name`,`serverSideName`,`title`,`serverSide -- -- if you have questions/problems, ask HeXa in DP forums -- -INSERT INTO `npc` (`id`,`idTemplate`,`name`,`serverSideName`,`title`,`serverSideTitle`,`class`,`collision_radius`,`collision_height`,`level`,`sex`,`type`,`attackrange`,`hp`,`mp`,`hpreg`,`mpreg`,`str`,`con`,`dex`,`int`,`wit`,`men`,`exp`,`sp`,`patk`,`pdef`,`matk`,`mdef`,`atkspd`,`aggro`,`matkspd`,`rhand`,`lhand`,`armor`,`walkspd`,`runspd`,`faction_id`,`faction_range`,`isUndead`,`absorb_level`,`absorb_type`) VALUES +INSERT INTO `npc` (`id`,`idTemplate`,`name`,`serverSideName`,`title`,`serverSideTitle`,`class`,`collision_radius`,`collision_height`,`level`,`sex`,`type`,`attackrange`,`hp`,`mp`,`hpreg`,`mpreg`,`str`,`con`,`dex`,intelligence,`wit`,`men`,`exp`,`sp`,`patk`,`pdef`,`matk`,`mdef`,`atkspd`,`aggro`,`matkspd`,`rhand`,`lhand`,`armor`,`walkspd`,`runspd`,`faction_id`,`faction_range`,`isUndead`,`absorb_level`,`absorb_type`) VALUES (22001,22001,'Grim Wolf',0,'',0,'Monster.dire_wolf',13.00,11.00,25,'male','L2Monster',80,728,316,5.53,1.53,40,43,30,21,20,10,1199,60,99,112,37,94,278,0,333,0,0,0,88,132,NULL,0,0,0,'LAST_HIT'), (22002,22002,'Grim Grizzly',0,'',0,'Monster.grizzly',21.00,40.00,26,'male','L2Monster',80,770,333,5.53,1.53,40,43,30,21,20,10,879,44,115,114,41,98,278,0,333,0,0,0,88,132,NULL,0,0,0,'LAST_HIT'), (22003,22003,'Grave Robber Scout',0,'',0,'NPC.e_traderB_Fdwarf_mon',20.00,23.00,27,'male','L2Monster',80,814,350,5.53,1.53,40,43,30,21,20,10,1032,53,113,119,45,102,278,0,333,0,0,0,88,132,NULL,0,0,0,'LAST_HIT'), @@ -3184,7 +3184,7 @@ INSERT INTO `npc` (`id`,`idTemplate`,`name`,`serverSideName`,`title`,`serverSide (22226,22226,'Pachycephalosaurus',0,'',0,'Monster3.pachycephalosaurus',22.00,40.00,85,'male','L2Monster',80,12428,2253,13.43,3.09,40,43,30,21,20,10,10931,1301,2129,615,1333,511,278,1000,333,0,0,0,88,188,'dino',500,0,0,'LAST_HIT'), (22227,22227,'Wild Strider',0,'',0,'Monster3.wild_giant_strider',25.00,33.00,85,'male','L2Monster',80,12428,2253,13.43,3.09,40,43,30,21,20,10,10931,1301,2129,615,1333,511,278,1000,333,0,0,0,88,188,'dino',500,0,0,'LAST_HIT'); -INSERT INTO `npc` (`id`,`idTemplate`,`name`,`serverSideName`,`title`,`serverSideTitle`,`class`,`collision_radius`,`collision_height`,`level`,`sex`,`type`,`attackrange`,`hp`,`mp`,`hpreg`,`mpreg`,`str`,`con`,`dex`,`int`,`wit`,`men`,`exp`,`sp`,`patk`,`pdef`,`matk`,`mdef`,`atkspd`,`aggro`,`matkspd`,`rhand`,`lhand`,`armor`,`walkspd`,`runspd`,`faction_id`,`faction_range`,`isUndead`,`absorb_level`,`absorb_type`) VALUES +INSERT INTO `npc` (`id`,`idTemplate`,`name`,`serverSideName`,`title`,`serverSideTitle`,`class`,`collision_radius`,`collision_height`,`level`,`sex`,`type`,`attackrange`,`hp`,`mp`,`hpreg`,`mpreg`,`str`,`con`,`dex`,intelligence,`wit`,`men`,`exp`,`sp`,`patk`,`pdef`,`matk`,`mdef`,`atkspd`,`aggro`,`matkspd`,`rhand`,`lhand`,`armor`,`walkspd`,`runspd`,`faction_id`,`faction_range`,`isUndead`,`absorb_level`,`absorb_type`) VALUES (25001,25001,'Greyclaw Kutus',0,'Raid Boss',0,'Monster.ol_mahum_champion_50_bi',21.00,43.50,23,'male','L2RaidBoss',40,95986,545,117.62,4.73,60,57,73,76,70,80,714843,67170,61,857,6,348,278,0,3819,67,633,0,81,275,NULL,0,0,0,'LAST_HIT'), (25002,25002,'Guard of Kutus',0,'Raid Fighter',0,'Monster.ol_mahum',13.50,25.00,22,'male','L2Minion',40,6613,257,29.94,4.73,40,43,30,41,20,10,0,0,74,411,9,167,278,0,333,7,0,0,55,187,NULL,0,0,0,'LAST_HIT'), (25003,25003,'Pawn of Kutus',0,'Raid Fighter',0,'Monster.ol_mahum',13.50,25.00,22,'male','L2Minion',40,9870,257,29.94,4.73,40,43,30,41,20,10,0,0,111,411,22,167,278,0,333,123,0,0,55,187,NULL,0,0,0,'LAST_HIT'), @@ -3704,7 +3704,7 @@ INSERT INTO `npc` (`id`,`idTemplate`,`name`,`serverSideName`,`title`,`serverSide (25526,25526,'Charged Spirit',0,'Raid Fighter',0,'Monster.magical_weaver',20,23,75,'male','L2Minion',40,50236,1601,197.17,9.81,40,43,30,21,20,10,0,0,7784,2094,9932,850,278,0,333,0,0,0,55,187,NULL,0,0,0,'LAST_HIT'), (25527,25527,'Uruka',0,'Raid Boss',0,'Monster3.Crokian_Elder',30.00,42.51,86,'male','L2RaidBoss',40,1532678,3718,355.43,9.81,60,57,73,76,70,80,3526019,952059,17006,5200,24162,2112,409,0,3819,0,0,0,40,307,NULL,0,0,0,'LAST_HIT'); -INSERT INTO `npc` (`id`,`idTemplate`,`name`,`serverSideName`,`title`,`serverSideTitle`,`class`,`collision_radius`,`collision_height`,`level`,`sex`,`type`,`attackrange`,`hp`,`mp`,`hpreg`,`mpreg`,`str`,`con`,`dex`,`int`,`wit`,`men`,`exp`,`sp`,`patk`,`pdef`,`matk`,`mdef`,`atkspd`,`aggro`,`matkspd`,`rhand`,`lhand`,`armor`,`walkspd`,`runspd`,`faction_id`,`faction_range`,`isUndead`,`absorb_level`,`absorb_type`) VALUES +INSERT INTO `npc` (`id`,`idTemplate`,`name`,`serverSideName`,`title`,`serverSideTitle`,`class`,`collision_radius`,`collision_height`,`level`,`sex`,`type`,`attackrange`,`hp`,`mp`,`hpreg`,`mpreg`,`str`,`con`,`dex`,intelligence,`wit`,`men`,`exp`,`sp`,`patk`,`pdef`,`matk`,`mdef`,`atkspd`,`aggro`,`matkspd`,`rhand`,`lhand`,`armor`,`walkspd`,`runspd`,`faction_id`,`faction_range`,`isUndead`,`absorb_level`,`absorb_type`) VALUES (27001,27001,'Orc Sniper',0,'',0,'Monster.orc_archer',14.00,25.00,10,'male','L2Monster',500,257,120,3.16,0.91,40,43,30,21,20,10,0,0,51,61,8,49,249,0,333,14,0,0,49,121,NULL,0,0,0,'LAST_HIT'), (27002,27002,'Orc Fighter',0,'',0,'Monster.orc_fighter',12.00,22.00,12,'male','L2Monster',40,315,138,3.95,1.21,40,43,30,21,20,10,0,0,27,66,10,54,278,0,333,1,0,0,49,121,NULL,0,0,0,'LAST_HIT'), (27003,27003,'Spirit Of Mirrors',0,'Quest Monster',0,'Monster.poison_toad',20.00,10.00,9,'male','L2Monster',40,226,111,3.16,0.91,40,43,30,21,20,10,0,0,20,58,7,47,278,0,333,0,0,0,55,110,NULL,0,0,0,'LAST_HIT'), @@ -4003,7 +4003,7 @@ INSERT INTO `npc` (`id`,`idTemplate`,`name`,`serverSideName`,`title`,`serverSide (27321,27321,'Bruin Lizardman',0,'Quest Monster',0,'Monster.virud_lizardman',20.00,23.00,20,'male','L2Monster',80,541,213,13.43,3.09,40,43,30,21,20,10,0,0,52,100,82,72,300,0,333,291,0,0,88,132,NULL,0,0,0,'LAST_HIT'), (27322,27322,'Picot Araneid',0,'Quest Monster',0,'Monster.giant_spider_50_bi',20.00,23.00,27,'male','L2Monster',80,813,245,13.43,3.09,40,43,30,21,20,10,0,0,64,114,94,82,300,0,333,0,0,0,88,132,NULL,0,0,0,'LAST_HIT'); -INSERT INTO `npc` (`id`,`idTemplate`,`name`,`serverSideName`,`title`,`serverSideTitle`,`class`,`collision_radius`,`collision_height`,`level`,`sex`,`type`,`attackrange`,`hp`,`mp`,`hpreg`,`mpreg`,`str`,`con`,`dex`,`int`,`wit`,`men`,`exp`,`sp`,`patk`,`pdef`,`matk`,`mdef`,`atkspd`,`aggro`,`matkspd`,`rhand`,`lhand`,`armor`,`walkspd`,`runspd`,`faction_id`,`faction_range`,`isUndead`,`absorb_level`,`absorb_type`) VALUES +INSERT INTO `npc` (`id`,`idTemplate`,`name`,`serverSideName`,`title`,`serverSideTitle`,`class`,`collision_radius`,`collision_height`,`level`,`sex`,`type`,`attackrange`,`hp`,`mp`,`hpreg`,`mpreg`,`str`,`con`,`dex`,intelligence,`wit`,`men`,`exp`,`sp`,`patk`,`pdef`,`matk`,`mdef`,`atkspd`,`aggro`,`matkspd`,`rhand`,`lhand`,`armor`,`walkspd`,`runspd`,`faction_id`,`faction_range`,`isUndead`,`absorb_level`,`absorb_type`) VALUES (29001,29001,'Queen Ant',0,'',0,'Monster.queen_ant',45.00,53.00,40,'female','L2Boss',40,229898,667,495.04,2.14,60,57,73,76,70,80,2179535,140740,329,1615,77,655,278,0,3819,0,0,0,129,372,'queen_ant_clan',1000,0,0,'LAST_HIT'), (29002,29002,'Queen Ant Larva',0,'',0,'Monster.ant_larva',12.00,8.00,38,'male','L2Monster',40,935,349,5.53,1.53,40,43,30,21,20,10,0,1,126,140,53,110,282,0,333,0,0,0,44,66,'queen_ant_clan',4500,0,0,'LAST_HIT'), (29003,29003,'Nurse Ant',0,'',0,'Monster.ant',26.00,15.00,35,'male','L2Monster',40,6320,446,170.64,1.84,40,43,30,41,20,10,0,1,947,678,889,275,278,0,333,0,0,0,44,143,'queen_ant_clan',700,0,0,'LAST_HIT'), @@ -4103,7 +4103,7 @@ INSERT INTO `npc` (`id`,`idTemplate`,`name`,`serverSideName`,`title`,`serverSide (29097,29097,'Splendor Disciple',0,'Raid Fighter',0,'Monster3.apostle_grail',13.00,47.00,99,'male','L2Monster',40,400000,9999,13.43,3.09,40,43,30,21,20,10,0,0,9000,5000,6000,6000,300,0,333,0,0,0,88,132,NULL,0,0,0,'LAST_HIT'), (29098,29098,'Splendor Worshiper',0,'Raid Fighter',0,'Monster3.apostle_grail_a',13.00,47.00,86,'male','L2Monster',40,400000,9999,13.43,3.09,40,43,30,21,20,10,0,0,9000,5000,6000,6000,300,0,333,0,0,0,88,132,NULL,0,0,0,'LAST_HIT'); -INSERT INTO `npc` (`id`,`idTemplate`,`name`,`serverSideName`,`title`,`serverSideTitle`,`class`,`collision_radius`,`collision_height`,`level`,`sex`,`type`,`attackrange`,`hp`,`mp`,`hpreg`,`mpreg`,`str`,`con`,`dex`,`int`,`wit`,`men`,`exp`,`sp`,`patk`,`pdef`,`matk`,`mdef`,`atkspd`,`aggro`,`matkspd`,`rhand`,`lhand`,`armor`,`walkspd`,`runspd`,`faction_id`,`faction_range`,`isUndead`,`absorb_level`,`absorb_type`) VALUES +INSERT INTO `npc` (`id`,`idTemplate`,`name`,`serverSideName`,`title`,`serverSideTitle`,`class`,`collision_radius`,`collision_height`,`level`,`sex`,`type`,`attackrange`,`hp`,`mp`,`hpreg`,`mpreg`,`str`,`con`,`dex`,intelligence,`wit`,`men`,`exp`,`sp`,`patk`,`pdef`,`matk`,`mdef`,`atkspd`,`aggro`,`matkspd`,`rhand`,`lhand`,`armor`,`walkspd`,`runspd`,`faction_id`,`faction_range`,`isUndead`,`absorb_level`,`absorb_type`) VALUES (30001,30001,'Lector',0,'Trader',0,'NPC.a_traderA_MHuman',10.00,24.00,70,'male','L2Merchant',40,3862,1493,11.85,2.78,40,43,30,21,20,10,0,0,1314,470,780,382,278,0,333,0,0,0,55,132,NULL,0,1,0,'LAST_HIT'), (30002,30002,'Jackson',0,'Trader',0,'NPC.a_traderB_MHuman',8.00,25.00,70,'male','L2Merchant',40,3862,1493,11.85,2.78,40,43,30,21,20,10,0,0,1314,470,780,382,278,0,333,0,0,0,55,132,NULL,0,1,0,'LAST_HIT'), (30003,30003,'Silvia',0,'Trader',0,'NPC.a_traderA_FHuman',7.00,23.00,70,'female','L2Merchant',40,3862,1493,11.85,2.78,40,43,30,21,20,10,0,0,1314,470,780,382,278,0,333,0,0,0,55,132,NULL,0,1,0,'LAST_HIT'), @@ -4876,7 +4876,7 @@ INSERT INTO `npc` (`id`,`idTemplate`,`name`,`serverSideName`,`title`,`serverSide (30994,30994,'Lottery Ticket Seller',0,'',0,'NPC.e_trader_MOrc',8.00,23.50,70,'male','L2Npc',40,3862,1493,11.85,2.78,40,43,30,21,20,10,0,0,1314,470,780,382,278,0,333,0,0,0,55,132,NULL,0,1,0,'LAST_HIT'), (30995,30995,'Race Manager',0,'',0,'NPC.e_teleporter_FDwarf',8.00,21.30,70,'female','L2Npc',40,3862,1493,11.85,2.78,40,43,30,21,20,10,0,0,1314,470,780,382,278,0,333,0,0,0,55,132,NULL,0,1,0,'LAST_HIT'); -INSERT INTO `npc` (`id`,`idTemplate`,`name`,`serverSideName`,`title`,`serverSideTitle`,`class`,`collision_radius`,`collision_height`,`level`,`sex`,`type`,`attackrange`,`hp`,`mp`,`hpreg`,`mpreg`,`str`,`con`,`dex`,`int`,`wit`,`men`,`exp`,`sp`,`patk`,`pdef`,`matk`,`mdef`,`atkspd`,`aggro`,`matkspd`,`rhand`,`lhand`,`armor`,`walkspd`,`runspd`,`faction_id`,`faction_range`,`isUndead`,`absorb_level`,`absorb_type`) VALUES +INSERT INTO `npc` (`id`,`idTemplate`,`name`,`serverSideName`,`title`,`serverSideTitle`,`class`,`collision_radius`,`collision_height`,`level`,`sex`,`type`,`attackrange`,`hp`,`mp`,`hpreg`,`mpreg`,`str`,`con`,`dex`,intelligence,`wit`,`men`,`exp`,`sp`,`patk`,`pdef`,`matk`,`mdef`,`atkspd`,`aggro`,`matkspd`,`rhand`,`lhand`,`armor`,`walkspd`,`runspd`,`faction_id`,`faction_range`,`isUndead`,`absorb_level`,`absorb_type`) VALUES (31001,31001,'Claudia Athebalt',0,'',0,'NPC.a_mageguild_master_FHuman',8.00,23.00,70,'female','L2Npc',40,3862,1493,11.85,2.78,40,43,30,21,20,10,0,0,1314,470,780,382,278,0,333,0,0,0,55,132,NULL,0,1,0,'LAST_HIT'), (31002,31002,'Reorin',0,'Maestro',0,'NPC.e_smith_master_MDwarf',8.00,16.50,70,'male','L2Npc',40,3862,1493,11.85,2.78,40,43,30,21,20,10,0,0,1314,470,780,382,278,0,333,0,0,0,55,132,NULL,0,1,0,'LAST_HIT'), (31003,31003,'Here I Come',0,'',0,'Monster.cat_the_cat',9.00,16.00,70,'male','L2Monster',40,3862,1493,11.85,2.78,40,43,30,21,20,10,0,0,1314,470,780,382,278,0,333,0,0,0,88,132,NULL,0,0,0,'LAST_HIT'), @@ -5821,7 +5821,7 @@ INSERT INTO `npc` (`id`,`idTemplate`,`name`,`serverSideName`,`title`,`serverSide (31999,31999,'Preacher of Doom',0,'',0,'Monster.dark_horror',9.50,29.00,70,'male','L2Npc',40,3862,1493,11.85,2.78,40,43,30,21,20,10,0,0,1314,470,780,382,278,0,333,0,0,0,88,132,NULL,0,0,0,'LAST_HIT'), (32000,32000,'Preacher of Doom',0,'',0,'Monster.dark_horror',9.50,29.00,70,'male','L2Npc',40,3862,1493,11.85,2.78,40,43,30,21,20,10,0,0,1314,470,780,382,278,0,333,0,0,0,88,132,NULL,0,0,0,'LAST_HIT'); -INSERT INTO `npc` (`id`,`idTemplate`,`name`,`serverSideName`,`title`,`serverSideTitle`,`class`,`collision_radius`,`collision_height`,`level`,`sex`,`type`,`attackrange`,`hp`,`mp`,`hpreg`,`mpreg`,`str`,`con`,`dex`,`int`,`wit`,`men`,`exp`,`sp`,`patk`,`pdef`,`matk`,`mdef`,`atkspd`,`aggro`,`matkspd`,`rhand`,`lhand`,`armor`,`walkspd`,`runspd`,`faction_id`,`faction_range`,`isUndead`,`absorb_level`,`absorb_type`) VALUES +INSERT INTO `npc` (`id`,`idTemplate`,`name`,`serverSideName`,`title`,`serverSideTitle`,`class`,`collision_radius`,`collision_height`,`level`,`sex`,`type`,`attackrange`,`hp`,`mp`,`hpreg`,`mpreg`,`str`,`con`,`dex`,intelligence,`wit`,`men`,`exp`,`sp`,`patk`,`pdef`,`matk`,`mdef`,`atkspd`,`aggro`,`matkspd`,`rhand`,`lhand`,`armor`,`walkspd`,`runspd`,`faction_id`,`faction_range`,`isUndead`,`absorb_level`,`absorb_type`) VALUES (32001,32001,'Preacher of Doom',0,'',0,'Monster.dark_horror',9.50,29.00,70,'male','L2Npc',40,3862,1493,11.85,2.78,40,43,30,21,20,10,0,0,1314,470,780,382,278,0,333,0,0,0,88,132,NULL,0,0,0,'LAST_HIT'), (32002,32002,'Preacher of Doom',0,'',0,'Monster.dark_horror',9.50,29.00,70,'male','L2Npc',40,3862,1493,11.85,2.78,40,43,30,21,20,10,0,0,1314,470,780,382,278,0,333,0,0,0,88,132,NULL,0,0,0,'LAST_HIT'), (32003,32003,'Orator of Revelations',0,'',0,'Monster.liviona',9.50,29.00,70,'male','L2Npc',40,3862,1493,11.85,2.78,40,43,30,21,20,10,0,0,1314,470,780,382,278,0,333,0,0,0,88,132,NULL,0,0,0,'LAST_HIT'), @@ -5953,7 +5953,7 @@ INSERT INTO `npc` (`id`,`idTemplate`,`name`,`serverSideName`,`title`,`serverSide (32131,32131,'Bonny',0,'Event Manager',0,'NPC.e_smith_Fdwarf',8.00,17.50,70,'male','L2Npc',40,3862,1493,11.85,2.78,40,43,30,21,20,10,0,0,1314,470,780,382,278,0,333,0,0,0,88,132,NULL,0,0,0,'LAST_HIT'), (32132,32132,'Alchemist''s Servitor',0,'',0,'NPC.training_doll_150p',13.00,40.00,70,'etc','L2Npc',40,3862,1493,11.85,2.78,40,43,30,21,20,10,0,0,1314,470,780,382,278,0,333,0,0,0,55,132,NULL,0,1,0,'LAST_HIT'); -INSERT INTO `npc` (`id`,`idTemplate`,`name`,`serverSideName`,`title`,`serverSideTitle`,`class`,`collision_radius`,`collision_height`,`level`,`sex`,`type`,`attackrange`,`hp`,`mp`,`hpreg`,`mpreg`,`str`,`con`,`dex`,`int`,`wit`,`men`,`exp`,`sp`,`patk`,`pdef`,`matk`,`mdef`,`atkspd`,`aggro`,`matkspd`,`rhand`,`lhand`,`armor`,`walkspd`,`runspd`,`faction_id`,`faction_range`,`isUndead`,`absorb_level`,`absorb_type`) VALUES +INSERT INTO `npc` (`id`,`idTemplate`,`name`,`serverSideName`,`title`,`serverSideTitle`,`class`,`collision_radius`,`collision_height`,`level`,`sex`,`type`,`attackrange`,`hp`,`mp`,`hpreg`,`mpreg`,`str`,`con`,`dex`,intelligence,`wit`,`men`,`exp`,`sp`,`patk`,`pdef`,`matk`,`mdef`,`atkspd`,`aggro`,`matkspd`,`rhand`,`lhand`,`armor`,`walkspd`,`runspd`,`faction_id`,`faction_range`,`isUndead`,`absorb_level`,`absorb_type`) VALUES (35010,35010,'Mercenary',0,'',0,'NPC.a_guard_MHuman',8.00,24.00,50,'male','L2SiegeGuard',40,2317,830,3.32,2.14,40,43,30,21,20,10,250,1,683,287,546,233,416,0,333,128,628,0,55,214,'mercenary_siege_clan',1200,1,0,'LAST_HIT'), (35011,35011,'Mercenary',0,'',0,'NPC.a_guard_MHuman',8.00,24.00,50,'male','L2SiegeGuard',80,2317,830,3.32,2.14,40,43,30,21,20,10,250,1,798,287,546,233,357,0,333,93,0,0,55,214,'mercenary_siege_clan',1200,1,0,'LAST_HIT'), (35012,35012,'Mercenary',0,'',0,'NPC.a_guard_MHuman',8.00,24.00,50,'male','L2SiegeGuard',1100,2317,830,3.32,2.14,40,43,30,21,20,10,250,1,889,244,546,233,322,0,333,280,0,0,55,214,'mercenary_siege_clan',1200,1,0,'LAST_HIT'), diff --git a/Gameserver/build.gradle b/Gameserver/build.gradle index 36cf19bd..761a4813 100644 --- a/Gameserver/build.gradle +++ b/Gameserver/build.gradle @@ -2,9 +2,11 @@ plugins { id "java" id "idea" id "eclipse" + id "application" } ext.moduleName = 'com.l2jbr.gameserver' +mainClassName = "com.l2jbr.gameserver.GameServer" version '1.3.1' @@ -36,7 +38,7 @@ dependencies { runtime 'org.apache.logging.log4j:log4j-slf4j-impl:2.11.0' runtime 'org.beanshell:bsh:2.0b5' runtime 'com.zaxxer:HikariCP:3.0.0' - runtime 'mysql:mysql-connector-java:8.0.9-rc' + runtime 'mysql:mysql-connector-java:8.0.11' } diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/SevenSignsFestival.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/SevenSignsFestival.java index 4c7a1923..69fbb683 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/SevenSignsFestival.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/SevenSignsFestival.java @@ -3316,7 +3316,7 @@ protected void restoreFestivalData() { festivalDat.set("score", festival.getScore()); festivalDat.set("members", festival.getMembers()); - _log.info("SevenSignsFestival: Loaded data from DB for (Cycle = {}, Oracle = {}, Festival = {})", festivalCycle, cabal, getFestivalName(festivalId)); + _log.debug("SevenSignsFestival: Loaded data from DB for (Cycle = {}, Oracle = {}, Festival = {})", festivalCycle, cabal, getFestivalName(festivalId)); if (cabal.equals("dawn")) { festivalId += FESTIVAL_COUNT; diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/datatables/ClanTable.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/datatables/ClanTable.java index 0bfd7336..0383afb1 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/datatables/ClanTable.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/datatables/ClanTable.java @@ -76,7 +76,7 @@ private ClanTable() { } } }); - _log.info(getMessage("info.restored.clans"), _clans.size()); + _log.info(getMessage("info.restored.clans", _clans.size())); restoreWars(); } diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/datatables/DoorTable.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/datatables/DoorTable.java index d1500364..e0569e2f 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/datatables/DoorTable.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/datatables/DoorTable.java @@ -117,16 +117,16 @@ public static L2DoorInstance parseDoor(CastleDoor castleDoor) { int rangeYMin = castleDoor.getRangeYmin(); int rangeYMax = castleDoor.getRangeYmax(); int rangeZMin = castleDoor.getRangeZmin(); - int rangeZMax = castleDoor.getRangeXmax(); + int rangeZMax = castleDoor.getRangeZmax(); if (rangeXMin > rangeXMax) { - _log.error("Error in door data, ID: {}", castleDoor.getId() ); + _log.error("Error in door data, ID: {} rangeXMin greater than rangeXMax", castleDoor.getId() ); } if (rangeYMin > rangeYMax) { - _log.error("Error in door data, ID: {}", castleDoor.getId()); + _log.error("Error in door data, ID: {} rangeYMin greater than rangeYMax", castleDoor.getId()); } if (rangeZMin > rangeZMax) { - _log.error("Error in door data, ID: {}", castleDoor.getId()); + _log.error("Error in door data, ID: {} rangeZMin greater than rangeZMax", castleDoor.getId()); } int collisionRadius; // (max) radius for movement checks @@ -190,7 +190,8 @@ public static L2DoorInstance parseDoor(CastleDoor castleDoor) { try { door.setMapRegion(MapRegionTable.getInstance().getMapRegion(castleDoor.getX(), castleDoor.getY())); } catch (Exception e) { - _log.error("Error in door data, ID:" + id); + _log.error("Error in door data, ID: {}", id); + _log.error(e.getLocalizedMessage(), e); } door.setCurrentHpMp(door.getMaxHp(), door.getMaxMp()); door.setOpen(1); diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/datatables/HennaTable.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/datatables/HennaTable.java index e035dbc4..658e388b 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/datatables/HennaTable.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/datatables/HennaTable.java @@ -29,6 +29,8 @@ import java.util.LinkedHashMap; import java.util.Map; +import static com.l2jbr.gameserver.util.GameserverMessages.getMessage; + public class HennaTable { private static Logger _log = LoggerFactory.getLogger(HennaTable.class.getName()); @@ -52,7 +54,7 @@ private HennaTable() { private void restoreHennaData() { HennaRepository repository = DatabaseAccess.getRepository(HennaRepository.class); repository.findAll().forEach(this::fillHennaTable); - _log.info("info.henna.loaded", + _henna.size()); + _log.info(getMessage("info.henna.loaded"), _henna.size()); } private void fillHennaTable(Henna henna) { diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/datatables/NpcTable.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/datatables/NpcTable.java index 4ac1744e..3a90e927 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/datatables/NpcTable.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/datatables/NpcTable.java @@ -45,6 +45,8 @@ import java.sql.SQLException; import java.util.*; +import static com.l2jbr.gameserver.util.GameserverMessages.getMessage; + /** * This class ... @@ -77,7 +79,7 @@ private void restoreNpcData() { NpcRepository npcRepository = DatabaseAccess.getRepository(NpcRepository.class); npcRepository.findAll().forEach(this::addToNpcMap); - _log.info("info.loaded.npc", _npcs.size()); + _log.info(getMessage("info.npc.loaded"), _npcs.size()); try (Connection con = L2DatabaseFactory.getInstance().getConnection()) { NpcSkillRepository npcSkillRepository = DatabaseAccess.getRepository(NpcSkillRepository.class); diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/instancemanager/ClanHallManager.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/instancemanager/ClanHallManager.java index 6a0507bd..fd8fb411 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/instancemanager/ClanHallManager.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/instancemanager/ClanHallManager.java @@ -72,15 +72,15 @@ private void load() { int id = clanHall.getId(); if (clanHall.getOwnerId() == 0) { _freeClanHall.put(id, new ClanHall(id, clanHall.getName(), clanHall.getOwnerId(), clanHall.getLease(), - clanHall.getDesc(), clanHall.getLocation(), 0, clanHall.getGrade(), clanHall.getPaid() == 1)); + clanHall.getDescription(), clanHall.getLocation(), 0, clanHall.getGrade(), clanHall.getPaid() == 1)); } else { if (ClanTable.getInstance().getClan(clanHall.getOwnerId()) != null) { - _clanHall.put(id, new ClanHall(id, clanHall.getName(), clanHall.getOwnerId(), clanHall.getLease(), clanHall.getDesc(), + _clanHall.put(id, new ClanHall(id, clanHall.getName(), clanHall.getOwnerId(), clanHall.getLease(), clanHall.getDescription(), clanHall.getLocation(), clanHall.getPaidUntil(), clanHall.getGrade(), clanHall.getPaid() == 1)); ClanTable.getInstance().getClan(clanHall.getOwnerId()).setHasHideout(id); } else { _freeClanHall.put(id, new ClanHall(id, clanHall.getName(), clanHall.getOwnerId(), clanHall.getLease(), - clanHall.getDesc(), clanHall.getLocation(), 0, clanHall.getGrade(), clanHall.getPaid() == 1)); + clanHall.getDescription(), clanHall.getLocation(), 0, clanHall.getGrade(), clanHall.getPaid() == 1)); _freeClanHall.get(id).free(); AuctionManager.getInstance().initNPC(id); } diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/instancemanager/DimensionalRiftManager.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/instancemanager/DimensionalRiftManager.java index 90be9c6e..dece7d82 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/instancemanager/DimensionalRiftManager.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/instancemanager/DimensionalRiftManager.java @@ -20,7 +20,6 @@ import com.l2jbr.commons.Config; import com.l2jbr.commons.database.DatabaseAccess; -import com.l2jbr.commons.database.L2DatabaseFactory; import com.l2jbr.commons.util.Rnd; import com.l2jbr.gameserver.datatables.NpcTable; import com.l2jbr.gameserver.datatables.SpawnTable; @@ -43,9 +42,6 @@ import java.awt.*; import java.io.File; import java.io.IOException; -import java.sql.Connection; -import java.sql.PreparedStatement; -import java.sql.ResultSet; import java.util.LinkedHashMap; import java.util.LinkedList; import java.util.List; @@ -332,7 +328,7 @@ public DimensionalRiftRoom(com.l2jbr.gameserver.model.database.DimensionalRift d _zMin = dimensionalRift.getzMin(); _zMax = dimensionalRift.getzMax(); _teleportCoords = new int[] { dimensionalRift.getxT(), dimensionalRift.getyT(), dimensionalRift.getzT() }; - _isBossRoom = dimensionalRift.getBoss() > 0; + _isBossRoom = dimensionalRift.getBoss(); _roomSpawns = new LinkedList<>(); _roomMobs = new LinkedList<>(); _s = new Polygon(new int[] { diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/L2NpcWalkerNode.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/L2NpcWalkerNode.java index ae0274d2..c35ebc72 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/L2NpcWalkerNode.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/L2NpcWalkerNode.java @@ -47,7 +47,7 @@ public L2NpcWalkerNode(WalkerRoutes walkerRoutes) { this._moveY = walkerRoutes.getMoveY(); this._moveZ = walkerRoutes.getMoveZ(); this._delay = walkerRoutes.getDelay(); - this._running = walkerRoutes.getRunning() == 1; + this._running = walkerRoutes.getRunning(); } public void setRunning(boolean val) diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/Armor.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/Armor.java index 5d5e9034..52a30903 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/Armor.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/Armor.java @@ -1,17 +1,20 @@ package com.l2jbr.gameserver.model.database; - import com.l2jbr.commons.database.annotation.Column; import com.l2jbr.commons.database.annotation.Table; import com.l2jbr.commons.database.model.Entity; +import org.springframework.data.annotation.Id; @Table("armor") public class Armor extends Entity { + @Id + @Column("item_id") private int itemId; private String name; private String bodyPart; private String crystallizable; + @Column("armor_type") private String armorType; private int weight; private String material; diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/CharTemplate.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/CharTemplate.java index c22d0900..b7169f78 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/CharTemplate.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/CharTemplate.java @@ -11,7 +11,6 @@ public class CharTemplate extends Entity { @Id private Integer classId; private String className; - @Column("class_lvl") private Integer classLevel; private Integer RaceId; @Column("parent_id") diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/ClanHallData.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/ClanHallData.java index 8b276d0f..22e9a37b 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/ClanHallData.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/ClanHallData.java @@ -12,7 +12,7 @@ public class ClanHallData extends Entity { private String name; private Integer ownerId; private Integer lease; - private String desc; + private String description; private String location; private Long paidUntil; private Integer Grade; @@ -35,8 +35,8 @@ public Integer getLease() { return lease; } - public String getDesc() { - return desc; + public String getDescription() { + return description; } public String getLocation() { diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/DimensionalRift.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/DimensionalRift.java index 5ff7229b..afb2fb8e 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/DimensionalRift.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/DimensionalRift.java @@ -19,7 +19,7 @@ public class DimensionalRift { private int xT; private int yT; private int zT; - private int boss; + private boolean boss; public byte getType() { return type; @@ -65,7 +65,7 @@ public int getzT() { return zT; } - public int getBoss() { + public boolean getBoss() { return boss; } } diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/Henna.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/Henna.java index 27c66eab..5325ddd0 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/Henna.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/Henna.java @@ -8,7 +8,7 @@ public class Henna { @Id - @Column("simbol_id") + @Column("symbol_id") private int symbolId; @Column("symbol_name") private String symbolName; diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/MapRegion.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/MapRegion.java index f7537715..bee395df 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/MapRegion.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/MapRegion.java @@ -1,9 +1,12 @@ package com.l2jbr.gameserver.model.database; import com.l2jbr.commons.database.annotation.Table; +import org.springframework.data.annotation.Id; @Table("mapregion") public class MapRegion { + + @Id private int region; private int sec0; private int sec1; diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/MerchantBuyList.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/MerchantBuyList.java index 70176c23..5b9c4cb1 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/MerchantBuyList.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/MerchantBuyList.java @@ -14,7 +14,7 @@ public class MerchantBuyList extends Entity { @Column("item_id") private int itemId; private int price; - private int order; + private int ordering; private int count; private int currentCount; private int time; @@ -22,11 +22,11 @@ public class MerchantBuyList extends Entity { public MerchantBuyList() {} - public MerchantBuyList(int itemId, int price, int shopId, int order) { + public MerchantBuyList(int itemId, int price, int shopId, int ordering) { this.itemId =itemId; this.price = price; this.shopId = shopId; - this.order = order; + this.ordering = ordering; } @Override @@ -42,8 +42,8 @@ public int getPrice() { return price; } - public int getOrder() { - return order; + public int getOrdering() { + return ordering; } public int getCount() { diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/MerchantShopIds.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/MerchantShopIds.java index d7cb5dea..38027d0b 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/MerchantShopIds.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/MerchantShopIds.java @@ -2,11 +2,14 @@ import com.l2jbr.commons.database.annotation.Column; import com.l2jbr.commons.database.annotation.Table; +import org.springframework.data.annotation.Id; import java.util.Set; @Table("merchant_shopids") public class MerchantShopIds { + + @Id @Column("shop_id") private int shopId; @Column("npc_id") diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/Npc.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/Npc.java index 9a984048..ae7188bc 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/Npc.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/Npc.java @@ -14,7 +14,8 @@ public class Npc { private Integer serverSideName; private String title; private Integer serverSideTitle; - private String _class; + @Column("class") + private String npcClass; private Double collision_radius; private Double collision_height; private Integer level; @@ -28,8 +29,7 @@ public class Npc { private Integer str; private Integer con; private Integer dex; - @Column("int") - private Integer _int; + private Integer intelligence; private Integer wit; private Integer men; private Integer exp; @@ -81,7 +81,7 @@ public int getServerSideTitle() { } public String getNpcClass() { - return _class; + return npcClass; } public double getCollision_radius() { @@ -137,7 +137,7 @@ public int getDex() { } public int getInt() { - return _int; + return intelligence; } public int getWit() { diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/SevenSignsStatus.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/SevenSignsStatus.java index d6a6438e..a85ab056 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/SevenSignsStatus.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/SevenSignsStatus.java @@ -26,7 +26,7 @@ public class SevenSignsStatus { private long duskStoneScore; @Column("dusk_festival_score") private int duskFestivalScore; - @Column("avarice_onwer") + @Column("avarice_owner") private int avariceOwner; @Column("gnosis_owner") private int gnosisOwner; diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/WalkerRoutes.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/WalkerRoutes.java index 218be611..a857fd4d 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/WalkerRoutes.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/WalkerRoutes.java @@ -21,7 +21,7 @@ public class WalkerRoutes { @Column("move_z") private int moveZ; private int delay; - private int running; + private boolean running; public int getRouteId() { return routeId; @@ -55,7 +55,7 @@ public int getDelay() { return delay; } - public int getRunning() { + public boolean getRunning() { return running; } } diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/repository/ClanRepository.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/repository/ClanRepository.java index 79eb37c3..3f812951 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/repository/ClanRepository.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/repository/ClanRepository.java @@ -15,7 +15,7 @@ public interface ClanRepository extends CrudRepository { int updateClanCrestById(@Param("clanId") int clanId, @Param("crestId") int crestId); @Query("SELECT clan_id FROM clan_data WHERE hasCastle=:castle") - Integer findClanIdByCastle(@Param("castle") int castleId); + Optional findClanIdByCastle(@Param("castle") int castleId); @Modifying @Query("UPDATE clan_data SET hasCastle=0 WHERE hasCastle=:castle") diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/repository/ItemRepository.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/repository/ItemRepository.java index 1b7fdc7e..b6911064 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/repository/ItemRepository.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/repository/ItemRepository.java @@ -16,7 +16,7 @@ public interface ItemRepository extends CrudRepository { @Query("SELECT * FROM items WHERE owner_id=:owner AND loc=:loc") Iterable findAllByOwnerAndLocation(@Param("owner") int ownerObjectId, @Param("loc") String loc); - @Query("SELECT owner_id FROM items WHERE item_id=?") + @Query("SELECT owner_id FROM items WHERE item_id=:item") Optional findOwnerIdByItem(@Param("item") int itemId); @Modifying diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/repository/ZoneVerticesRepository.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/repository/ZoneVerticesRepository.java index d3925a00..0556d213 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/repository/ZoneVerticesRepository.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/repository/ZoneVerticesRepository.java @@ -9,6 +9,6 @@ public interface ZoneVerticesRepository extends CrudRepository { - @Query("SELECT * FROM zone_vertices WHERE id=? ORDER BY 'order' ASC ") + @Query("SELECT * FROM zone_vertices WHERE id=:zone ORDER BY `order` ASC ") List findAllOrderedById(@Param("zone") int zoneId); } \ No newline at end of file diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/entity/Castle.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/entity/Castle.java index a08b57ea..1d992b85 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/entity/Castle.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/entity/Castle.java @@ -365,13 +365,12 @@ private void load(CastleData castleData) { _taxRate = _taxPercent / 100.0; ClanRepository clanRepository = DatabaseAccess.getRepository(ClanRepository.class); - int clanId = clanRepository.findClanIdByCastle(getCastleId()); - if(clanId != 0) { + clanRepository.findClanIdByCastle(castleData.getId()).ifPresent(clanId -> { _ownerId = clanId; L2Clan clan = ClanTable.getInstance().getClan(getOwnerId()); // Try to find clan instance ThreadPoolManager.getInstance().scheduleGeneral(new CastleUpdater(clan, 1), 3600000); // Schedule owner tasks to start running - } - + }); + for (CastleDoor castleDoor : castleData.getDoors()) { _doorDefault.add(castleDoor); diff --git a/Gameserver/src/main/resources/gameserver-messages.properties b/Gameserver/src/main/resources/gameserver-messages.properties index 309510d3..6f0ee577 100644 --- a/Gameserver/src/main/resources/gameserver-messages.properties +++ b/Gameserver/src/main/resources/gameserver-messages.properties @@ -23,11 +23,12 @@ error.script.not.loaded=Script Loading Failed: {0} debug.parsing.event=Parsing {0} Event info.event.passed={0} has passed... Ignored." info.engine.register=Scripting language {0} registered to file extensions {1}. -info.restored.clans=Restored {} clans from the database. -debug.clan.removed=clan removed from database: {} +info.restored.clans=Restored {0} clans from the database. +debug.clan.removed=clan removed from database: '{}' error.clan.remove=Error while removing clan from database. -info.loaded.clanhall=Loaded {} clan halls. -info.loaded.free.clanhall=Loaded {} free clan halls. -info.npc.loaded=NpcTable: Loaded {} Npc Templates. -info.auto.chat.loaded=AutoChatHandler: Loaded {} chat group(s) from the database. -info.henna.loaded=HennaTable: Loaded {} Templates. +info.loaded.clanhall=Loaded '{}' clan halls. +info.loaded.free.clanhall=Loaded '{}' free clan halls. +info.npc.loaded=NpcTable: Loaded '{}' Npc Templates.\ + +info.auto.chat.loaded=AutoChatHandler: Loaded '{}' chat group(s) from the database. +info.henna.loaded=HennaTable: Loaded '{}' Templates. diff --git a/Gameserver/src/main/resources/gameserver-messages_pt_BR.properties b/Gameserver/src/main/resources/gameserver-messages_pt_BR.properties index 43619d8e..e528ad9e 100644 --- a/Gameserver/src/main/resources/gameserver-messages_pt_BR.properties +++ b/Gameserver/src/main/resources/gameserver-messages_pt_BR.properties @@ -23,11 +23,11 @@ error.script.not.loaded=Falha ao carregar script: {0} debug.parsing.event=Analizando Evento {0} info.event.passed=O {0} acabou... Ignorado. info.engine.register=Linguagem {0} registrada para arquivos com extens\u00F5es {1}. -info.restored.clans={} clans restaurados do banco de dados. -debug.clan.removed=clan removido do banco de dados: {} +info.restored.clans={0} clans restaurados do banco de dados. +debug.clan.removed=clan removido do banco de dados: '{}' error.clan.remove=Erro removendo clan do banco de dados. -info.loaded.clanhall={} Clan Halls carregados. -info.loaded.free.clanhall={} Clan halls livres carregados. -info.npc.loaded=NpcTable: {} modelos de NPCs carregados. -info.auto.chat.loaded=AutoChatHandler: {} grupos de chat foram carregados do banco de dados. -info.henna.loaded=HennaTable: {} templates carregados. +info.loaded.clanhall='{}' Clan Halls carregados. +info.loaded.free.clanhall='{}' Clan halls livres carregados. +info.npc.loaded=NpcTable: '{}' modelos de NPCs carregados. +info.auto.chat.loaded=AutoChatHandler: '{}' grupos de chat foram carregados do banco de dados. +info.henna.loaded=HennaTable: '{}' templates carregados. diff --git a/Loginserver/build.gradle b/Loginserver/build.gradle index 3329834e..83691772 100644 --- a/Loginserver/build.gradle +++ b/Loginserver/build.gradle @@ -35,7 +35,7 @@ dependencies { runtime 'org.apache.logging.log4j:log4j-api:2.11.0' runtime 'org.apache.logging.log4j:log4j-slf4j-impl:2.11.0' runtime 'com.zaxxer:HikariCP:3.0.0' - runtime 'mysql:mysql-connector-java:8.0.9-rc' + runtime 'mysql:mysql-connector-java:8.0.11' } diff --git a/Tools/build.gradle b/Tools/build.gradle index 35a60aa0..2b04a872 100644 --- a/Tools/build.gradle +++ b/Tools/build.gradle @@ -39,7 +39,7 @@ dependencies { runtime 'org.apache.logging.log4j:log4j-api:2.11.0' runtime 'org.apache.logging.log4j:log4j-slf4j-impl:2.11.0' runtime 'com.zaxxer:HikariCP:3.0.0' - runtime 'mysql:mysql-connector-java:8.0.9-rc' + runtime 'mysql:mysql-connector-java:8.0.11' } jar { diff --git a/Tools/src/main/com.l2jbr.tools/com/l2jbr/tools/accountmanager/SQLAccountManager.java b/Tools/src/main/com.l2jbr.tools/com/l2jbr/tools/accountmanager/SQLAccountManager.java index fb4fedf6..1758512f 100644 --- a/Tools/src/main/com.l2jbr.tools/com/l2jbr/tools/accountmanager/SQLAccountManager.java +++ b/Tools/src/main/com.l2jbr.tools/com/l2jbr/tools/accountmanager/SQLAccountManager.java @@ -94,7 +94,6 @@ public static void main(String[] args) throws SQLException, IOException, NoSuchA } while (_level.isEmpty()); } - if (_mode.equals("1")) { addOrUpdateAccount(_uname, _pass, _level); } else if (_mode.equals("2")) { diff --git a/build.gradle b/build.gradle index 50a555b9..c646577b 100644 --- a/build.gradle +++ b/build.gradle @@ -5,7 +5,7 @@ plugins { id "eclipse" } -version '1.3.1' +version '1.3.2' defaultTasks('clean', 'build') From 9256dd0ae3c08a6d79ccf1b8bec1bf4ba96714a4 Mon Sep 17 00:00:00 2001 From: Alisson Oliveira Date: Mon, 7 May 2018 09:08:20 -0300 Subject: [PATCH 098/236] Corrige erro ao salvar dados do Seven Signs no shutdown --- .../com/l2jbr/gameserver/model/L2Spawn.java | 11 +++-------- .../repository/SevenSignsStatusRepository.java | 13 +++++++------ .../com/l2jbr/loginserver/LoginController.java | 6 ++---- 3 files changed, 12 insertions(+), 18 deletions(-) diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/L2Spawn.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/L2Spawn.java index e86b79c3..ae019c7a 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/L2Spawn.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/L2Spawn.java @@ -446,19 +446,13 @@ public void startRespawn() { public L2NpcInstance doSpawn() { L2NpcInstance mob = null; try { - // Check if the L2Spawn is not a L2Pet or L2Minion spawn if (_template.type.equalsIgnoreCase("L2Pet") || _template.type.equalsIgnoreCase("L2Minion")) { _currentCount++; - return mob; } // Get L2NpcInstance Init parameters and its generate an Identifier - Object[] parameters = - { - IdFactory.getInstance().getNextId(), - _template - }; + Object[] parameters = { IdFactory.getInstance().getNextId(), _template }; // Call the constructor of the L2NpcInstance // (can be a L2ArtefactInstance, L2FriendlyMobInstance, L2GuardInstance, L2MonsterInstance, L2SiegeGuardInstance, L2BoxInstance, @@ -472,7 +466,8 @@ public L2NpcInstance doSpawn() { mob = (L2NpcInstance) tmp; return intializeNpcInstance(mob); } catch (Exception e) { - _log.warn( "NPC " + _template.npcId + " class not found", e); + _log.warn( "NPC {} class not found", _template.npcId); + _log.error(e.getLocalizedMessage(), e); } return mob; } diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/repository/SevenSignsStatusRepository.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/repository/SevenSignsStatusRepository.java index e0fa4f55..5493f486 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/repository/SevenSignsStatusRepository.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/repository/SevenSignsStatusRepository.java @@ -12,12 +12,13 @@ public interface SevenSignsStatusRepository extends CrudRepository= 2) && (user.length() <= 14)) { String pwd = Base64.encodeBytes(hash); @@ -443,9 +441,9 @@ public boolean loginValid(String user, String password, L2LoginClient client) { return false; } + } else { + _log.debug("account missing for user {}", user); } - _log.debug("account missing for user {}", user); - return false; }catch (Exception e) { _log.warn("Could not check password:" + e); ok = false; From ff467a549455dc959d3a2bf1dd3696476ecf8df3 Mon Sep 17 00:00:00 2001 From: Alisson Oliveira Date: Mon, 7 May 2018 15:13:28 -0300 Subject: [PATCH 099/236] =?UTF-8?q?atualiza=20vers=C3=A3o=20do=20spring-da?= =?UTF-8?q?ta-jdbc?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Commons/build.gradle | 2 +- Gameserver/build.gradle | 2 +- Loginserver/build.gradle | 2 +- Tools/build.gradle | 2 +- build.gradle | 2 +- gradle/wrapper/gradle-wrapper.properties | 3 +-- 6 files changed, 6 insertions(+), 7 deletions(-) diff --git a/Commons/build.gradle b/Commons/build.gradle index dbcdde8e..35c54b2d 100644 --- a/Commons/build.gradle +++ b/Commons/build.gradle @@ -25,7 +25,7 @@ sourceSets { dependencies { compile 'org.slf4j:slf4j-api:1.8.0-beta2' - compile ('org.springframework.data:spring-data-jdbc:1.0.0.BUILD-SNAPSHOT') { changing = true } + compile ('org.springframework.data:spring-data-jdbc:1.0.0.M2') { changing = true } compile 'com.zaxxer:HikariCP:3.0.0' runtime 'mysql:mysql-connector-java:8.0.11' diff --git a/Gameserver/build.gradle b/Gameserver/build.gradle index 761a4813..0d41cce2 100644 --- a/Gameserver/build.gradle +++ b/Gameserver/build.gradle @@ -31,7 +31,7 @@ dependencies { compile 'org.slf4j:slf4j-api:1.8.0-beta2' compile 'org.python:jython-standalone:2.7.1' - compile 'org.springframework.data:spring-data-jdbc:1.0.0.BUILD-SNAPSHOT' + compile ('org.springframework.data:spring-data-jdbc:1.0.0.M2') { changing = true } runtime 'org.apache.logging.log4j:log4j-core:2.11.0' runtime 'org.apache.logging.log4j:log4j-api:2.11.0' diff --git a/Loginserver/build.gradle b/Loginserver/build.gradle index 83691772..d1893013 100644 --- a/Loginserver/build.gradle +++ b/Loginserver/build.gradle @@ -29,7 +29,7 @@ dependencies { compile project(':Mmocore') compile 'org.slf4j:slf4j-api:1.8.0-beta2' - compile ('org.springframework.data:spring-data-jdbc:1.0.0.BUILD-SNAPSHOT') { changing = true } + compile ('org.springframework.data:spring-data-jdbc:1.0.0.M2') { changing = true } runtime 'org.apache.logging.log4j:log4j-core:2.11.0' runtime 'org.apache.logging.log4j:log4j-api:2.11.0' diff --git a/Tools/build.gradle b/Tools/build.gradle index 2b04a872..87601014 100644 --- a/Tools/build.gradle +++ b/Tools/build.gradle @@ -34,7 +34,7 @@ dependencies { runtime project(':Mmocore') - runtime ('org.springframework.data:spring-data-jdbc:1.0.0.BUILD-SNAPSHOT') { changing = true } + runtime ('org.springframework.data:spring-data-jdbc:1.0.0.M2') { changing = true } runtime 'org.apache.logging.log4j:log4j-core:2.11.0' runtime 'org.apache.logging.log4j:log4j-api:2.11.0' runtime 'org.apache.logging.log4j:log4j-slf4j-impl:2.11.0' diff --git a/build.gradle b/build.gradle index c646577b..0a1304bd 100644 --- a/build.gradle +++ b/build.gradle @@ -16,7 +16,7 @@ allprojects { mavenCentral() maven { - url 'https://repo.spring.io/libs-snapshot' + url 'https://repo.spring.io/libs-milestone' } } diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 3a5e6771..bf3de218 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,5 @@ -#Sun May 06 00:14:06 BRT 2018 distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists +distributionUrl=https\://services.gradle.org/distributions/gradle-4.6-bin.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-4.6-all.zip From 6753689f487837fa99a82ed1e2c1d8452ec5f648 Mon Sep 17 00:00:00 2001 From: Alisson Oliveira Date: Mon, 7 May 2018 19:13:38 -0300 Subject: [PATCH 100/236] =?UTF-8?q?remove=20refer=C3=AAncias=20diretas=20a?= =?UTF-8?q?=20tabelas.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../DatabaseContextConfiguration.java | 2 - .../commons/database/L2DatabaseFactory.java | 4 +- .../com/l2jbr/gameserver/GameServer.java | 7 +- .../com/l2jbr/gameserver/Olympiad.java | 44 ++--- .../com/l2jbr/gameserver/Shutdown.java | 11 -- .../gameserver/datatables/DoorTable.java | 3 +- .../l2jbr/gameserver/datatables/NpcTable.java | 154 +++++++----------- .../gameserver/datatables/PetNameTable.java | 51 +----- .../admincommandhandlers/AdminEditNpc.java | 95 +++-------- .../l2jbr/gameserver/idfactory/IdFactory.java | 35 +--- .../gameserver/model/AutoChatHandler.java | 4 +- .../l2jbr/gameserver/model/L2ClanMember.java | 35 +--- .../l2jbr/gameserver/model/L2DropData.java | 16 +- .../model/actor/instance/L2PetInstance.java | 90 +++------- .../gameserver/model/database/DropList.java | 12 ++ .../l2jbr/gameserver/model/database/Pets.java | 44 ++++- .../repository/CharacterRepository.java | 8 + .../repository/DropListRepository.java | 3 + .../database/repository/PetsRepository.java | 7 + .../gameserver/network/L2GameClient.java | 86 ++++------ .../gameserver/skills/SkillConstants.java | 6 + .../gameserver/templates/L2NpcTemplate.java | 2 +- .../com/l2jbr/loginserver/L2LoginServer.java | 14 -- 23 files changed, 277 insertions(+), 456 deletions(-) create mode 100644 Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/skills/SkillConstants.java diff --git a/Commons/src/main/com.l2jbr.commons/com/l2jbr/commons/database/DatabaseContextConfiguration.java b/Commons/src/main/com.l2jbr.commons/com/l2jbr/commons/database/DatabaseContextConfiguration.java index 03d69aba..9a8d3d1d 100644 --- a/Commons/src/main/com.l2jbr.commons/com/l2jbr/commons/database/DatabaseContextConfiguration.java +++ b/Commons/src/main/com.l2jbr.commons/com/l2jbr/commons/database/DatabaseContextConfiguration.java @@ -80,6 +80,4 @@ public ApplicationListener afterLoadEventApplicationListener() { extractModel(event).ifPresent(Entity::onLoad); }; } - - } diff --git a/Commons/src/main/com.l2jbr.commons/com/l2jbr/commons/database/L2DatabaseFactory.java b/Commons/src/main/com.l2jbr.commons/com/l2jbr/commons/database/L2DatabaseFactory.java index c15c53ee..2daf890d 100644 --- a/Commons/src/main/com.l2jbr.commons/com/l2jbr/commons/database/L2DatabaseFactory.java +++ b/Commons/src/main/com.l2jbr.commons/com/l2jbr/commons/database/L2DatabaseFactory.java @@ -37,16 +37,18 @@ public class L2DatabaseFactory { public L2DatabaseFactory() throws SQLException { context = new AnnotationConfigApplicationContext(DatabaseContextConfiguration.class); + ((AnnotationConfigApplicationContext) context).registerShutdownHook(); _dataSource = context.getBean(HikariDataSource.class); try { _dataSource.getConnection().close(); } catch (SQLException e) { _log.error(e.getMessage(), e); + throw e; } } - public final static String prepQuerySelect(String[] fields, String tableName, String whereClause, boolean returnOnlyTopRecord) { + public static String prepQuerySelect(String[] fields, String tableName, String whereClause, boolean returnOnlyTopRecord) { String msSqlTop1 = ""; String mySqlTop1 = ""; if (returnOnlyTopRecord) { diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/GameServer.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/GameServer.java index 081f9928..6a07d676 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/GameServer.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/GameServer.java @@ -19,7 +19,6 @@ package com.l2jbr.gameserver; import com.l2jbr.commons.Config; -import com.l2jbr.commons.database.L2DatabaseFactory; import com.l2jbr.commons.Server; import com.l2jbr.commons.status.Status; import com.l2jbr.gameserver.cache.CrestCache; @@ -506,15 +505,11 @@ public GameServer() throws Exception { } public static void main(String[] args) throws Exception { - configureLogger(); Server.serverMode = Server.MODE_GAMESERVER; - - // Initialize config + configureLogger(); Config.load(); - Locale.setDefault(Locale.forLanguageTag(Config.LANGUAGE)); - L2DatabaseFactory.getInstance(); gameServer = new GameServer(); if (Config.IS_TELNET_ENABLED) { diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/Olympiad.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/Olympiad.java index 4067461c..bc465cfa 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/Olympiad.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/Olympiad.java @@ -25,7 +25,6 @@ import com.l2jbr.commons.Config; import com.l2jbr.commons.database.DatabaseAccess; -import com.l2jbr.commons.database.L2DatabaseFactory; import com.l2jbr.commons.util.Rnd; import com.l2jbr.gameserver.datatables.HeroSkillTable; import com.l2jbr.gameserver.datatables.SkillTable; @@ -46,10 +45,6 @@ import org.slf4j.LoggerFactory; import java.io.*; -import java.sql.Connection; -import java.sql.PreparedStatement; -import java.sql.ResultSet; -import java.sql.SQLException; import java.util.*; import java.util.concurrent.ScheduledFuture; @@ -851,34 +846,29 @@ protected synchronized void saveNobleData() { return; } - try (Connection con = L2DatabaseFactory.getInstance().getConnection();) { - PreparedStatement statement; + OlympiadNoblesRepository repository = DatabaseAccess.getRepository(OlympiadNoblesRepository.class); + for (Integer nobleId : _nobles.keySet()) { + StatsSet nobleInfo = _nobles.get(nobleId); - for (Integer nobleId : _nobles.keySet()) { - StatsSet nobleInfo = _nobles.get(nobleId); + int charId = nobleId; + int classId = nobleInfo.getInteger(CLASS_ID); + String charName = nobleInfo.getString(CHAR_NAME); + int points = nobleInfo.getInteger(POINTS); + int compDone = nobleInfo.getInteger(COMP_DONE); + boolean toSave = nobleInfo.getBool("to_save"); - int charId = nobleId; - int classId = nobleInfo.getInteger(CLASS_ID); - String charName = nobleInfo.getString(CHAR_NAME); - int points = nobleInfo.getInteger(POINTS); - int compDone = nobleInfo.getInteger(COMP_DONE); - boolean toSave = nobleInfo.getBool("to_save"); - OlympiadNoblesRepository repository = DatabaseAccess.getRepository(OlympiadNoblesRepository.class); - if (toSave) { - OlympiadNobles nobles = new OlympiadNobles(charId, classId, charName, points, compDone); - repository.save(nobles); + if (toSave) { + OlympiadNobles nobles = new OlympiadNobles(charId, classId, charName, points, compDone); + repository.save(nobles); - nobleInfo.set("to_save", false); + nobleInfo.set("to_save", false); - _nobles.remove(nobleId); - _nobles.put(nobleId, nobleInfo); - } else { - repository.updateCompetitions(charId, points, compDone); - } + _nobles.remove(nobleId); + _nobles.put(nobleId, nobleInfo); + } else { + repository.updateCompetitions(charId, points, compDone); } - } catch (SQLException e) { - _log.warn("Olympiad System: Couldnt save nobles info in db"); } } diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/Shutdown.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/Shutdown.java index 6f29013f..9b793589 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/Shutdown.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/Shutdown.java @@ -19,7 +19,6 @@ package com.l2jbr.gameserver; import com.l2jbr.commons.Config; -import com.l2jbr.commons.database.L2DatabaseFactory; import com.l2jbr.gameserver.gameserverpackets.ServerStatus; import com.l2jbr.gameserver.instancemanager.*; import com.l2jbr.gameserver.model.L2World; @@ -220,16 +219,6 @@ public void run() // ignore } - // commit data, last chance - try - { - L2DatabaseFactory.getInstance().shutdown(); - } - catch (Throwable t) - { - - } - // server will quit, when this function ends. if (_instance._shutdownMode == GM_RESTART) { diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/datatables/DoorTable.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/datatables/DoorTable.java index e0569e2f..5222b3a7 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/datatables/DoorTable.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/datatables/DoorTable.java @@ -75,9 +75,8 @@ public void parseData() { File doorData = new File(Config.DATAPACK_ROOT, "data/door.csv"); lnr = new LineNumberReader(new BufferedReader(new FileReader(doorData))); + _log.debug("Searching clan halls doors:"); String line = null; - _log.warn("Searching clan halls doors:"); - while ((line = lnr.readLine()) != null) { if ((line.trim().length() == 0) || line.startsWith("#")) { continue; diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/datatables/NpcTable.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/datatables/NpcTable.java index 3a90e927..d9743fa2 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/datatables/NpcTable.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/datatables/NpcTable.java @@ -29,10 +29,8 @@ import com.l2jbr.gameserver.model.base.ClassId; import com.l2jbr.gameserver.model.database.Minions; import com.l2jbr.gameserver.model.database.Npc; -import com.l2jbr.gameserver.model.database.repository.MinionRepository; -import com.l2jbr.gameserver.model.database.repository.NpcRepository; -import com.l2jbr.gameserver.model.database.repository.NpcSkillRepository; -import com.l2jbr.gameserver.model.database.repository.SkillLearnRepository; +import com.l2jbr.gameserver.model.database.repository.*; +import com.l2jbr.gameserver.skills.SkillConstants; import com.l2jbr.gameserver.skills.Stats; import com.l2jbr.gameserver.templates.L2NpcTemplate; import com.l2jbr.gameserver.templates.StatsSet; @@ -41,8 +39,6 @@ import java.sql.Connection; import java.sql.PreparedStatement; -import java.sql.ResultSet; -import java.sql.SQLException; import java.util.*; import static com.l2jbr.gameserver.util.GameserverMessages.getMessage; @@ -81,105 +77,81 @@ private void restoreNpcData() { _log.info(getMessage("info.npc.loaded"), _npcs.size()); - try (Connection con = L2DatabaseFactory.getInstance().getConnection()) { - NpcSkillRepository npcSkillRepository = DatabaseAccess.getRepository(NpcSkillRepository.class); - npcSkillRepository.findAll().forEach(npcSkill -> { - int mobId = npcSkill.getNpcid(); - L2NpcTemplate npcDat = _npcs.get(mobId); + NpcSkillRepository npcSkillRepository = DatabaseAccess.getRepository(NpcSkillRepository.class); + npcSkillRepository.findAll().forEach(npcSkill -> { + int mobId = npcSkill.getNpcid(); + L2NpcTemplate npcDat = _npcs.get(mobId); - if (Util.isNull(npcDat)) { - return; - } - - int skillId = npcSkill.getSkillid(); - int level = npcSkill.getLevel(); - - if (Util.isNull(npcDat.race) && (skillId == 4416)) { - npcDat.setRace(level); - return; - } + if (Util.isNull(npcDat)) { + return; + } - L2Skill skill = SkillTable.getInstance().getInfo(skillId, level); + int skillId = npcSkill.getSkillid(); + int level = npcSkill.getLevel(); - if (Util.isNull(skill)) { - return; - } + if (Util.isNull(npcDat.race) && (skillId == SkillConstants.RACES)) { + npcDat.setRace(level); + return; + } - npcDat.addSkill(skill); - }); + L2Skill skill = SkillTable.getInstance().getInfo(skillId, level); - try { - PreparedStatement statement2 = con.prepareStatement("SELECT " + L2DatabaseFactory.getInstance().safetyString(new String[] - { - "mobId", - "itemId", - "min", - "max", - "category", - "chance" - }) + " FROM droplist ORDER BY mobId, chance DESC"); - ResultSet dropData = statement2.executeQuery(); - L2DropData dropDat = null; - L2NpcTemplate npcDat = null; - - while (dropData.next()) { - int mobId = dropData.getInt("mobId"); - npcDat = _npcs.get(mobId); - if (npcDat == null) { - _log.error("NPCTable: No npc correlating with id : " + mobId); - continue; - } - dropDat = new L2DropData(); + if (Util.isNull(skill)) { + return; + } - dropDat.setItemId(dropData.getInt("itemId")); - dropDat.setMinDrop(dropData.getInt("min")); - dropDat.setMaxDrop(dropData.getInt("max")); - dropDat.setChance(dropData.getInt("chance")); + npcDat.addSkill(skill); + }); - int category = dropData.getInt("category"); + DropListRepository dropListRepository = DatabaseAccess.getRepository(DropListRepository.class); + dropListRepository.findAll().forEach(dropList -> { + int mobId = dropList.getMobId(); + L2NpcTemplate npcDat = _npcs.get(mobId); + if (npcDat == null) { + _log.error("NPCTable: No npc correlating with id : {}", mobId); + return; + } + L2DropData dropDat = new L2DropData(); - npcDat.addDropData(dropDat, category); - } + dropDat.setItemId(dropList.getItemId()); + dropDat.setMinDrop(dropList.getMin()); + dropDat.setMaxDrop(dropList.getMax()); + dropDat.setChance(dropList.getChance()); - dropData.close(); - statement2.close(); - } catch (Exception e) { - _log.error("NPCTable: Error reading NPC drop data: " + e); - } + int category = dropList.getCategory(); - SkillLearnRepository repository = DatabaseAccess.getRepository(SkillLearnRepository.class); - repository.findAll().forEach(skillLearn -> { - int npcId = skillLearn.getNpcId(); - int classId = skillLearn.getClassId(); - L2NpcTemplate npc = getTemplate(npcId); + npcDat.addDropData(dropDat, category); + }); - if (npc == null) { - _log.warn("NPCTable: Error getting NPC template ID " + npcId + " while trying to load skill trainer data."); - return; - } + SkillLearnRepository repository = DatabaseAccess.getRepository(SkillLearnRepository.class); + repository.findAll().forEach(skillLearn -> { + int npcId = skillLearn.getNpcId(); + int classId = skillLearn.getClassId(); + L2NpcTemplate npc = getTemplate(npcId); - npc.addTeachInfo(ClassId.values()[classId]); - }); - - MinionRepository minionRepository = DatabaseAccess.getRepository(MinionRepository.class); - int cnt = 0; - L2NpcTemplate npcDat = null; - L2MinionData minionDat = null; - for (Minions minion : minionRepository.findAll()) { - int raidId = minion.getBossId(); - npcDat = _npcs.get(raidId); - minionDat = new L2MinionData(); - minionDat.setMinionId(minion.getMinionId()); - minionDat.setAmountMin(minion.getAmountMin()); - minionDat.setAmountMax(minion.getAmountMin()); - npcDat.addRaidData(minionDat); - cnt++; + if (npc == null) { + _log.warn("NPCTable: Error getting NPC template ID " + npcId + " while trying to load skill trainer data."); + return; } - _log.info("NpcTable: Loaded {} Minions", cnt); - } catch (SQLException e1) { - // TODO Auto-generated catch block - e1.printStackTrace(); + + npc.addTeachInfo(ClassId.values()[classId]); + }); + + MinionRepository minionRepository = DatabaseAccess.getRepository(MinionRepository.class); + int cnt = 0; + L2NpcTemplate npcDat = null; + L2MinionData minionDat = null; + for (Minions minion : minionRepository.findAll()) { + int raidId = minion.getBossId(); + npcDat = _npcs.get(raidId); + minionDat = new L2MinionData(); + minionDat.setMinionId(minion.getMinionId()); + minionDat.setAmountMin(minion.getAmountMin()); + minionDat.setAmountMax(minion.getAmountMin()); + npcDat.addRaidData(minionDat); + cnt++; } + _log.info("NpcTable: Loaded {} Minions", cnt); _initialized = true; } diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/datatables/PetNameTable.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/datatables/PetNameTable.java index bb901dca..f9257134 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/datatables/PetNameTable.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/datatables/PetNameTable.java @@ -19,14 +19,11 @@ package com.l2jbr.gameserver.datatables; import com.l2jbr.commons.Config; -import com.l2jbr.commons.database.L2DatabaseFactory; -import com.l2jbr.gameserver.model.L2PetDataTable; +import com.l2jbr.commons.database.DatabaseAccess; +import com.l2jbr.gameserver.model.database.repository.PetsRepository; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import java.sql.PreparedStatement; -import java.sql.ResultSet; -import java.sql.SQLException; import java.util.regex.Matcher; import java.util.regex.Pattern; import java.util.regex.PatternSyntaxException; @@ -47,47 +44,9 @@ public static PetNameTable getInstance() return _instance; } - public boolean doesPetNameExist(String name, int petNpcId) - { - boolean result = true; - java.sql.Connection con = null; - - try - { - con = L2DatabaseFactory.getInstance().getConnection(); - PreparedStatement statement = con.prepareStatement("SELECT name FROM pets p, items i WHERE p.item_obj_id = i.object_id AND name=? AND i.item_id IN (?)"); - statement.setString(1, name); - - String cond = ""; - for (int it : L2PetDataTable.getPetItemsAsNpc(petNpcId)) - { - if (cond != "") - { - cond += ", "; - } - cond += it; - } - statement.setString(2, cond); - ResultSet rset = statement.executeQuery(); - result = rset.next(); - rset.close(); - statement.close(); - } - catch (SQLException e) - { - _log.warn("could not check existing petname:" + e.getMessage()); - } - finally - { - try - { - con.close(); - } - catch (Exception e) - { - } - } - return result; + public boolean doesPetNameExist(String name, int petNpcId) { + PetsRepository repository = DatabaseAccess.getRepository(PetsRepository.class); + return repository.existsByName(name); } public boolean isValidPetName(String name) diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/handler/admincommandhandlers/AdminEditNpc.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/handler/admincommandhandlers/AdminEditNpc.java index c90f7cd1..b3ffe424 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/handler/admincommandhandlers/AdminEditNpc.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/handler/admincommandhandlers/AdminEditNpc.java @@ -20,7 +20,7 @@ import com.l2jbr.commons.Config; import com.l2jbr.commons.database.DatabaseAccess; -import com.l2jbr.commons.database.L2DatabaseFactory; +import com.l2jbr.commons.util.Util; import com.l2jbr.gameserver.TradeController; import com.l2jbr.gameserver.cache.HtmCache; import com.l2jbr.gameserver.datatables.ItemTable; @@ -29,6 +29,7 @@ import com.l2jbr.gameserver.model.*; import com.l2jbr.gameserver.model.actor.instance.L2BoxInstance; import com.l2jbr.gameserver.model.actor.instance.L2PcInstance; +import com.l2jbr.gameserver.model.database.DropList; import com.l2jbr.gameserver.model.database.MerchantBuyList; import com.l2jbr.gameserver.model.database.repository.DropListRepository; import com.l2jbr.gameserver.model.database.repository.MerchantBuyListRepository; @@ -39,8 +40,6 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import java.sql.PreparedStatement; -import java.sql.ResultSet; import java.util.LinkedList; import java.util.List; import java.util.StringTokenizer; @@ -793,39 +792,21 @@ private void updateDropData(L2PcInstance activeChar, int npcId, int itemId, int } private void addDropData(L2PcInstance activeChar, int npcId, int itemId, int min, int max, int category, int chance) { - java.sql.Connection con = null; - - try { - con = L2DatabaseFactory.getInstance().getConnection(); - - PreparedStatement statement = con.prepareStatement("INSERT INTO droplist(mobId, itemId, min, max, category, chance) values(?,?,?,?,?,?)"); - statement.setInt(1, npcId); - statement.setInt(2, itemId); - statement.setInt(3, min); - statement.setInt(4, max); - statement.setInt(5, category); - statement.setInt(6, chance); - statement.execute(); - statement.close(); + DropListRepository repository = DatabaseAccess.getRepository(DropListRepository.class); + DropList drop = new DropList(npcId, itemId, min, max, category, chance); + repository.save(drop); - reLoadNpcDropList(npcId); + reLoadNpcDropList(npcId); - NpcHtmlMessage adminReply = new NpcHtmlMessage(5); - StringBuilder replyMSG = new StringBuilder("Add drop data complete!"); - replyMSG.append(""); - replyMSG.append("
    "); + NpcHtmlMessage adminReply = new NpcHtmlMessage(5); + StringBuilder replyMSG = new StringBuilder("Add drop data complete!"); + replyMSG.append(""); + replyMSG.append("
    "); - adminReply.setHtml(replyMSG.toString()); - activeChar.sendPacket(adminReply); - } catch (Exception e) { - } finally { - try { - con.close(); - } catch (Exception e) { - } - } + adminReply.setHtml(replyMSG.toString()); + activeChar.sendPacket(adminReply); } private void deleteDropData(L2PcInstance activeChar, int npcId, int itemId, int category) { @@ -848,52 +829,16 @@ private void deleteDropData(L2PcInstance activeChar, int npcId, int itemId, int private void reLoadNpcDropList(int npcId) { L2NpcTemplate npcData = NpcTable.getInstance().getTemplate(npcId); - if (npcData == null) { + if (Util.isNull(npcData)) { return; } - // reset the drop lists npcData.clearAllDropData(); - // get the drops - java.sql.Connection con = null; - try { - con = L2DatabaseFactory.getInstance().getConnection(); - L2DropData dropData = null; - - npcData.getDropData().clear(); - - PreparedStatement statement = con.prepareStatement("SELECT " + L2DatabaseFactory.getInstance().safetyString(new String[] - { - "mobId", - "itemId", - "min", - "max", - "category", - "chance" - }) + " FROM droplist WHERE mobId=?"); - statement.setInt(1, npcId); - ResultSet dropDataList = statement.executeQuery(); - - while (dropDataList.next()) { - dropData = new L2DropData(); - - dropData.setItemId(dropDataList.getInt("itemId")); - dropData.setMinDrop(dropDataList.getInt("min")); - dropData.setMaxDrop(dropDataList.getInt("max")); - dropData.setChance(dropDataList.getInt("chance")); - - int category = dropDataList.getInt("category"); - npcData.addDropData(dropData, category); - } - dropDataList.close(); - statement.close(); - } catch (Exception e) { - } finally { - try { - con.close(); - } catch (Exception e) { - } - } + DropListRepository repository = DatabaseAccess.getRepository(DropListRepository.class); + repository.findAllByNpc(npcId).forEach(dropList -> { + L2DropData dropData = new L2DropData(dropList); + npcData.addDropData(dropData, dropList.getCategory()); + }); } } diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/idfactory/IdFactory.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/idfactory/IdFactory.java index 2fc0a412..28e02df7 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/idfactory/IdFactory.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/idfactory/IdFactory.java @@ -19,7 +19,9 @@ package com.l2jbr.gameserver.idfactory; import com.l2jbr.commons.Config; +import com.l2jbr.commons.database.DatabaseAccess; import com.l2jbr.commons.database.L2DatabaseFactory; +import com.l2jbr.gameserver.model.database.repository.CharacterRepository; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -117,35 +119,10 @@ protected IdFactory() break; } } - - /** - * Sets all character offline - */ - private void setAllCharacterOffline() - { - java.sql.Connection con2 = null; - try - { - con2 = L2DatabaseFactory.getInstance().getConnection(); - Statement s2 = con2.createStatement(); - s2.executeUpdate("update characters set online=0"); - _log.info("Updated characters online status."); - - s2.close(); - } - catch (SQLException e) - { - } - finally - { - try - { - con2.close(); - } - catch (Exception e) - { - } - } + + private void setAllCharacterOffline() { + CharacterRepository repository = DatabaseAccess.getRepository(CharacterRepository.class); + repository.updateAllOnlineStatus(0); } /** diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/AutoChatHandler.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/AutoChatHandler.java index 50c317ed..aa75d93b 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/AutoChatHandler.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/AutoChatHandler.java @@ -39,6 +39,8 @@ import java.util.concurrent.ScheduledFuture; import java.util.stream.Collectors; +import static com.l2jbr.gameserver.util.GameserverMessages.getMessage; + /** * Auto Chat Handler Allows NPCs to automatically send messages to nearby players at a set time interval. @@ -71,7 +73,7 @@ private void restoreChatData() { registerGlobalChat(autoChat.getNpcId(), chatTexts , autoChat.getChatDelay()); } - _log.info("info.auto.chat.loaded", numLoaded); + _log.info(getMessage("info.auto.chat.loaded"), numLoaded); } public static AutoChatHandler getInstance() { diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/L2ClanMember.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/L2ClanMember.java index 54befa77..e15ac777 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/L2ClanMember.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/L2ClanMember.java @@ -19,14 +19,10 @@ package com.l2jbr.gameserver.model; import com.l2jbr.commons.database.DatabaseAccess; -import com.l2jbr.commons.database.L2DatabaseFactory; import com.l2jbr.gameserver.instancemanager.SiegeManager; import com.l2jbr.gameserver.model.actor.instance.L2PcInstance; import com.l2jbr.gameserver.model.database.repository.CharacterRepository; -import java.sql.PreparedStatement; -import java.sql.SQLException; - /** * This class ... @@ -463,33 +459,8 @@ public int calculatePledgeClass(L2PcInstance player) return pledgeClass; } - public void saveApprenticeAndSponsor(int apprentice, int sponsor) - { - java.sql.Connection con = null; - - try - { - con = L2DatabaseFactory.getInstance().getConnection(); - PreparedStatement statement = con.prepareStatement("UPDATE characters SET apprentice=?,sponsor=? WHERE obj_Id=?"); - statement.setInt(1, apprentice); - statement.setInt(2, sponsor); - statement.setInt(3, getObjectId()); - statement.execute(); - statement.close(); - } - catch (SQLException e) - { - // _log.warn("could not set apprentice/sponsor:"+e.getMessage()); - } - finally - { - try - { - con.close(); - } - catch (Exception e) - { - } - } + public void saveApprenticeAndSponsor(int apprentice, int sponsor) { + CharacterRepository repository = DatabaseAccess.getRepository(CharacterRepository.class); + repository.updateApprenticeAndSponsor(getObjectId(), apprentice, sponsor); } } diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/L2DropData.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/L2DropData.java index 90472f95..c1c63c97 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/L2DropData.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/L2DropData.java @@ -18,6 +18,8 @@ */ package com.l2jbr.gameserver.model; +import com.l2jbr.gameserver.model.database.DropList; + import java.util.Arrays; @@ -35,8 +37,18 @@ public class L2DropData private int _chance; private String _questID = null; private String[] _stateID = null; - - /** + + public L2DropData() { + } + + public L2DropData(DropList dropList) { + _itemId = dropList.getItemId(); + _minDrop = dropList.getMin(); + _maxDrop = dropList.getMax(); + _chance = dropList.getChance(); + } + + /** * Returns the ID of the item dropped * @return int */ diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/actor/instance/L2PetInstance.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/actor/instance/L2PetInstance.java index e64a94b4..b0bd311d 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/actor/instance/L2PetInstance.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/actor/instance/L2PetInstance.java @@ -20,7 +20,6 @@ import com.l2jbr.commons.Config; import com.l2jbr.commons.database.DatabaseAccess; -import com.l2jbr.commons.database.L2DatabaseFactory; import com.l2jbr.gameserver.ThreadPoolManager; import com.l2jbr.gameserver.ai.CtrlIntention; import com.l2jbr.gameserver.idfactory.IdFactory; @@ -39,8 +38,6 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import java.sql.PreparedStatement; -import java.sql.ResultSet; import java.util.concurrent.Future; @@ -777,66 +774,33 @@ public boolean isMountable() return _mountable; } - private static L2PetInstance restore(L2ItemInstance control, L2NpcTemplate template, L2PcInstance owner) - { - java.sql.Connection con = null; - try - { - L2PetInstance pet; - if (template.type.compareToIgnoreCase("L2BabyPet") == 0) - { - pet = new L2BabyPetInstance(IdFactory.getInstance().getNextId(), template, owner, control); - } - else - { - pet = new L2PetInstance(IdFactory.getInstance().getNextId(), template, owner, control); - } - - con = L2DatabaseFactory.getInstance().getConnection(); - PreparedStatement statement = con.prepareStatement("SELECT item_obj_id, name, level, curHp, curMp, exp, sp, karma, pkkills, fed FROM pets WHERE item_obj_id=?"); - statement.setInt(1, control.getObjectId()); - ResultSet rset = statement.executeQuery(); - if (!rset.next()) - { - rset.close(); - statement.close(); - return pet; - } - - pet._respawned = true; - pet.setName(rset.getString("name")); - - pet.getStat().setLevel(rset.getByte("level")); - pet.getStat().setExp(rset.getLong("exp")); - pet.getStat().setSp(rset.getInt("sp")); - - pet.getStatus().setCurrentHp(rset.getDouble("curHp")); - pet.getStatus().setCurrentMp(rset.getDouble("curMp")); - pet.getStatus().setCurrentCp(pet.getMaxCp()); - - pet.setKarma(rset.getInt("karma")); - pet.setPkKills(rset.getInt("pkkills")); - pet.setCurrentFed(rset.getInt("fed")); - - rset.close(); - statement.close(); - return pet; - } - catch (Exception e) - { - _logPet.warn("could not restore pet data: " + e); - return null; - } - finally - { - try - { - con.close(); - } - catch (Exception e) - { - } - } + private static L2PetInstance restore(L2ItemInstance control, L2NpcTemplate template, L2PcInstance owner) { + L2PetInstance pet; + if (template.type.compareToIgnoreCase("L2BabyPet") == 0) { + pet = new L2BabyPetInstance(IdFactory.getInstance().getNextId(), template, owner, control); + } + else { + pet = new L2PetInstance(IdFactory.getInstance().getNextId(), template, owner, control); + } + + PetsRepository repository = DatabaseAccess.getRepository(PetsRepository.class); + repository.findById(control.getObjectId()).ifPresent(petData -> { + pet._respawned = true; + pet.setName(petData.getName()); + + pet.getStat().setLevel(petData.getLevel()); + pet.getStat().setExp(petData.getExp()); + pet.getStat().setSp(petData.getSp()); + + pet.getStatus().setCurrentHp(petData.getCurHp()); + pet.getStatus().setCurrentMp(petData.getCurMp()); + pet.getStatus().setCurrentCp(pet.getMaxCp()); + + pet.setKarma(petData.getKarma()); + pet.setPkKills(petData.getPkkills()); + pet.setCurrentFed(petData.getFed()); + }); + return pet; } @Override diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/DropList.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/DropList.java index 430add4e..8e4b4e6a 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/DropList.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/DropList.java @@ -14,6 +14,18 @@ public class DropList extends Entity { private int category; private int chance; + public DropList() { + } + + public DropList(int npcId, int itemId, int min, int max, int category, int chance) { + this.mobId = npcId; + this.itemId = itemId; + this.min = min; + this.max = max; + this.category = category; + this.chance = chance; + } + @Override public Integer getId() { return mobId; diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/Pets.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/Pets.java index 29d16de9..dd3ff6c5 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/Pets.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/Pets.java @@ -2,10 +2,11 @@ import com.l2jbr.commons.database.annotation.Column; import com.l2jbr.commons.database.annotation.Table; +import com.l2jbr.commons.database.model.Entity; import org.springframework.data.annotation.Id; @Table("pets") -public class Pets { +public class Pets extends Entity { @Id @Column("item_obj_id") @@ -34,4 +35,45 @@ public Pets( int objectId, String name, byte level, double currentHp, double cur this.pkkills = pkKills; this.fed = currentFed; } + + @Override + public Integer getId() { + return itemObjId; + } + + public String getName() { + return name; + } + + public byte getLevel() { + return level; + } + + public double getCurHp() { + return curHp; + } + + public double getCurMp() { + return curMp; + } + + public long getExp() { + return exp; + } + + public int getSp() { + return sp; + } + + public int getKarma() { + return karma; + } + + public int getPkkills() { + return pkkills; + } + + public int getFed() { + return fed; + } } diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/repository/CharacterRepository.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/repository/CharacterRepository.java index 40d4da15..66a6c03f 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/repository/CharacterRepository.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/repository/CharacterRepository.java @@ -84,4 +84,12 @@ int updateJailStatusByName(@Param("name") String charName, @Param("x") int x, @P @Query("SELECT obj_Id FROM characters WHERE char_name=:name") int findIdByName(@Param("name") String name); + + @Modifying + @Query("UPDATE characters SET online=:online") + int updateAllOnlineStatus(@Param("online") int online); + + @Modifying + @Query("UPDATE characters SET apprentice=:apprentice,sponsor=:sponsor WHERE obj_Id=:objectId") + int updateApprenticeAndSponsor(@Param("objectId") int objectId, @Param("apprentice") int apprentice, @Param("sponsor") int sponsor); } diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/repository/DropListRepository.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/repository/DropListRepository.java index d156bfb1..632ffb02 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/repository/DropListRepository.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/repository/DropListRepository.java @@ -20,4 +20,7 @@ int updateDrop(@Param("npc") int npcId, @Param("item") int itemId, @Param("categ @Query("DELETE FROM droplist WHERE mobId=:npc AND itemId=:item AND category=:category") int deleteByNpcItemAndCategory(@Param("npc") int npcId, @Param("item") int itemId, @Param("category") int category); + + @Query("SELECT * FROM droplist WHERE mobId=:npc") + Iterable findAllByNpc(@Param("npc") int npcId); } diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/repository/PetsRepository.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/repository/PetsRepository.java index 74dbd086..8fcaa383 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/repository/PetsRepository.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/repository/PetsRepository.java @@ -17,4 +17,11 @@ public interface PetsRepository extends CrudRepository { int updateById(@Param("objectId") int objectId, @Param("name") String name, @Param("level") byte level, @Param("hp") double hp, @Param("mp") double mp, @Param("exp") long exp, @Param("sp") int sp, @Param("karma") int karma, @Param("pk") int pkKills, @Param("fed") int fed); + + @Query("SELECT EXISTS (SELECT 1 FROM pets WHERE name=:name)") + boolean existsByName(@Param("name") String name); + + @Modifying + @Query("DELETE FROM pets WHERE item_obj_id IN (SELECT object_id FROM items WHERE items.owner_id=:owner)") + int deleteByOwner(@Param("owner") int ownerObjectId); } diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/network/L2GameClient.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/network/L2GameClient.java index 8ebc9110..b345833d 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/network/L2GameClient.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/network/L2GameClient.java @@ -19,7 +19,6 @@ import com.l2jbr.commons.Config; import com.l2jbr.commons.database.DatabaseAccess; -import com.l2jbr.commons.database.L2DatabaseFactory; import com.l2jbr.gameserver.LoginServerThread; import com.l2jbr.gameserver.LoginServerThread.SessionKey; import com.l2jbr.gameserver.ThreadPoolManager; @@ -41,7 +40,6 @@ import java.net.InetAddress; import java.nio.ByteBuffer; -import java.sql.PreparedStatement; import java.util.LinkedList; import java.util.List; import java.util.concurrent.Future; @@ -240,72 +238,56 @@ public static void deleteCharByObjId(int objId) { return; } - java.sql.Connection con = null; + CharacterFriendRepository characterFriendRepository = DatabaseAccess.getRepository(CharacterFriendRepository.class); + characterFriendRepository.deleteFriends(objId); - try { - con = L2DatabaseFactory.getInstance().getConnection(); - PreparedStatement statement; - - CharacterFriendRepository characterFriendRepository = DatabaseAccess.getRepository(CharacterFriendRepository.class); - characterFriendRepository.deleteFriends(objId); + CharacterHennasRepository characterHennasRepository = DatabaseAccess.getRepository(CharacterHennasRepository.class); + characterHennasRepository.deleteById(objId); - CharacterHennasRepository characterHennasRepository = DatabaseAccess.getRepository(CharacterHennasRepository.class); - characterHennasRepository.deleteById(objId); + CharacterMacrosesRepository characterMacrosesRepository = DatabaseAccess.getRepository(CharacterMacrosesRepository.class); + characterMacrosesRepository.deleteById(objId); - CharacterMacrosesRepository characterMacrosesRepository = DatabaseAccess.getRepository(CharacterMacrosesRepository.class); - characterMacrosesRepository.deleteById(objId); + CharacterQuestsRepository characterQuestsRepository = DatabaseAccess.getRepository(CharacterQuestsRepository.class); + characterQuestsRepository.deleteById(objId); - CharacterQuestsRepository characterQuestsRepository = DatabaseAccess.getRepository(CharacterQuestsRepository.class); - characterQuestsRepository.deleteById(objId); + CharacterRecipebookRepository recipebookRepository = DatabaseAccess.getRepository(CharacterRecipebookRepository.class); + recipebookRepository.deleteAllByCharacter(objId); - CharacterRecipebookRepository recipebookRepository = DatabaseAccess.getRepository(CharacterRecipebookRepository.class); - recipebookRepository.deleteAllByCharacter(objId); + CharacterShortcutsRepository shortcutsRepository = DatabaseAccess.getRepository(CharacterShortcutsRepository.class); + shortcutsRepository.deleteById(objId); - CharacterShortcutsRepository shortcutsRepository = DatabaseAccess.getRepository(CharacterShortcutsRepository.class); - shortcutsRepository.deleteById(objId); + CharacterSkillsRepository skillsRepository = DatabaseAccess.getRepository(CharacterSkillsRepository.class); + skillsRepository.deleteById(objId); - CharacterSkillsRepository skillsRepository = DatabaseAccess.getRepository(CharacterSkillsRepository.class); - skillsRepository.deleteById(objId); + CharacterSkillsSaveRepository skillsSaveRepository = DatabaseAccess.getRepository(CharacterSkillsSaveRepository.class); + skillsSaveRepository.deleteById(objId); - CharacterSkillsSaveRepository skillsSaveRepository = DatabaseAccess.getRepository(CharacterSkillsSaveRepository.class); - skillsSaveRepository.deleteById(objId); + CharacterSubclassesRepository subclassesRepository = DatabaseAccess.getRepository(CharacterSubclassesRepository.class); + subclassesRepository.deleteById(objId); - CharacterSubclassesRepository subclassesRepository = DatabaseAccess.getRepository(CharacterSubclassesRepository.class); - subclassesRepository.deleteById(objId); + HeroesRepository heroesRepository = DatabaseAccess.getRepository(HeroesRepository.class); + heroesRepository.deleteById(objId); - HeroesRepository heroesRepository = DatabaseAccess.getRepository(HeroesRepository.class); - heroesRepository.deleteById(objId); + OlympiadNoblesRepository noblesRepository = DatabaseAccess.getRepository(OlympiadNoblesRepository.class); + noblesRepository.deleteById(objId); - OlympiadNoblesRepository noblesRepository = DatabaseAccess.getRepository(OlympiadNoblesRepository.class); - noblesRepository.deleteById(objId); + SevenSignsRepository sevenSignsRepository = DatabaseAccess.getRepository(SevenSignsRepository.class); + sevenSignsRepository.deleteById(objId); - SevenSignsRepository sevenSignsRepository = DatabaseAccess.getRepository(SevenSignsRepository.class); - sevenSignsRepository.deleteById(objId); + PetsRepository repository = DatabaseAccess.getRepository(PetsRepository.class); + repository.deleteByOwner(objId); - statement = con.prepareStatement("DELETE FROM pets WHERE item_obj_id IN (SELECT object_id FROM items WHERE items.owner_id=?)"); - statement.setInt(1, objId); - statement.execute(); - statement.close(); + AugmentationsRepository augmentationsRepository = DatabaseAccess.getRepository(AugmentationsRepository.class); + augmentationsRepository.deleteByItemOwner(objId); - AugmentationsRepository augmentationsRepository = DatabaseAccess.getRepository(AugmentationsRepository.class); - augmentationsRepository.deleteByItemOwner(objId); + ItemRepository itemRepository = DatabaseAccess.getRepository(ItemRepository.class); + itemRepository.deleteByOwner(objId); - ItemRepository itemRepository = DatabaseAccess.getRepository(ItemRepository.class); - itemRepository.deleteByOwner(objId); + MerchantLeaseRepository leaseRepository = DatabaseAccess.getRepository(MerchantLeaseRepository.class); + leaseRepository.deleteByPlayer(objId); - MerchantLeaseRepository leaseRepository = DatabaseAccess.getRepository(MerchantLeaseRepository.class); - leaseRepository.deleteByPlayer(objId); - - CharacterRepository characterRepository = DatabaseAccess.getRepository(CharacterRepository.class); - characterRepository.deleteById(objId); - } catch (Exception e) { - _log.warn("Data error on deleting char: " + e); - } finally { - try { - con.close(); - } catch (Exception e) { - } - } + CharacterRepository characterRepository = DatabaseAccess.getRepository(CharacterRepository.class); + characterRepository.deleteById(objId); } public L2PcInstance loadCharFromDisk(int charslot) { diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/skills/SkillConstants.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/skills/SkillConstants.java new file mode 100644 index 00000000..c6d68366 --- /dev/null +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/skills/SkillConstants.java @@ -0,0 +1,6 @@ +package com.l2jbr.gameserver.skills; + +public class SkillConstants { + + public static final int RACES = 4416; +} diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/templates/L2NpcTemplate.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/templates/L2NpcTemplate.java index b2e27dd1..41e20739 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/templates/L2NpcTemplate.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/templates/L2NpcTemplate.java @@ -274,7 +274,7 @@ public List getAllDropData() { *
    */ public synchronized void clearAllDropData() { - _categories.forEach( c -> c.clearAllDrops()); + _categories.forEach(L2DropCategory::clearAllDrops); _categories.clear(); } diff --git a/Loginserver/src/main/com.l2jbr.loginserver/com/l2jbr/loginserver/L2LoginServer.java b/Loginserver/src/main/com.l2jbr.loginserver/com/l2jbr/loginserver/L2LoginServer.java index a6eeb0e1..99bde22c 100644 --- a/Loginserver/src/main/com.l2jbr.loginserver/com/l2jbr/loginserver/L2LoginServer.java +++ b/Loginserver/src/main/com.l2jbr.loginserver/com/l2jbr/loginserver/L2LoginServer.java @@ -18,7 +18,6 @@ package com.l2jbr.loginserver; import com.l2jbr.commons.Config; -import com.l2jbr.commons.database.L2DatabaseFactory; import com.l2jbr.commons.Server; import com.l2jbr.commons.status.Status; import com.l2jbr.loginserver.status.LoginStatus; @@ -57,21 +56,8 @@ public static L2LoginServer getInstance() { public L2LoginServer() { Server.serverMode = Server.MODE_LOGINSERVER; - - // Load Config Config.load(); - // Prepare Database - try { - L2DatabaseFactory.getInstance(); - } catch (SQLException e) { - _log.error("FATAL: Failed initializing database. Reason: " + e.getMessage()); - if (Config.DEVELOPER) { - e.printStackTrace(); - } - System.exit(1); - } - try { LoginController.load(); } catch (GeneralSecurityException e) { From 6ba7d746ecf31e3161f0551a33baf50d7d93755e Mon Sep 17 00:00:00 2001 From: Alisson Oliveira Date: Tue, 8 May 2018 08:33:37 -0300 Subject: [PATCH 101/236] Ajusta nome de colunas de tabelas do BD --- .../commons/database/DatabaseAccess.java | 8 ++++ .../commons/database/L2DatabaseFactory.java | 1 - .../com/l2jbr/gameserver/Shutdown.java | 4 ++ .../clientpackets/CharacterCreate.java | 8 +--- .../clientpackets/CharacterDelete.java | 19 +++------ .../clientpackets/L2GameClientPacket.java | 39 +++++++------------ .../l2jbr/gameserver/model/L2Character.java | 3 +- .../l2jbr/gameserver/model/PcInventory.java | 1 - .../com/l2jbr/gameserver/model/ShortCuts.java | 5 +-- .../model/actor/instance/L2PcInstance.java | 30 +++++++++++--- .../gameserver/model/database/AuctionBid.java | 3 ++ .../model/database/Augmentation.java | 2 + .../gameserver/model/database/Character.java | 6 +-- .../gameserver/model/database/Items.java | 2 +- .../repository/CharacterQuestsRepository.java | 4 +- .../repository/CharacterRepository.java | 2 +- .../database/repository/ItemRepository.java | 2 +- 17 files changed, 73 insertions(+), 66 deletions(-) diff --git a/Commons/src/main/com.l2jbr.commons/com/l2jbr/commons/database/DatabaseAccess.java b/Commons/src/main/com.l2jbr.commons/com/l2jbr/commons/database/DatabaseAccess.java index 80d2a86d..489ed1d5 100644 --- a/Commons/src/main/com.l2jbr.commons/com/l2jbr/commons/database/DatabaseAccess.java +++ b/Commons/src/main/com.l2jbr.commons/com/l2jbr/commons/database/DatabaseAccess.java @@ -5,6 +5,7 @@ import org.slf4j.LoggerFactory; import org.springframework.data.repository.CrudRepository; +import java.sql.SQLException; import java.util.LinkedHashMap; import java.util.Map; @@ -31,4 +32,11 @@ public static T getRepository(Class repositoryClas } + public static void shutdown() { + try { + L2DatabaseFactory.getInstance().shutdown(); + } catch (SQLException e) { + e.printStackTrace(); + } + } } diff --git a/Commons/src/main/com.l2jbr.commons/com/l2jbr/commons/database/L2DatabaseFactory.java b/Commons/src/main/com.l2jbr.commons/com/l2jbr/commons/database/L2DatabaseFactory.java index 2daf890d..8f272d86 100644 --- a/Commons/src/main/com.l2jbr.commons/com/l2jbr/commons/database/L2DatabaseFactory.java +++ b/Commons/src/main/com.l2jbr.commons/com/l2jbr/commons/database/L2DatabaseFactory.java @@ -37,7 +37,6 @@ public class L2DatabaseFactory { public L2DatabaseFactory() throws SQLException { context = new AnnotationConfigApplicationContext(DatabaseContextConfiguration.class); - ((AnnotationConfigApplicationContext) context).registerShutdownHook(); _dataSource = context.getBean(HikariDataSource.class); try { diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/Shutdown.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/Shutdown.java index 9b793589..246b7e0b 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/Shutdown.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/Shutdown.java @@ -19,6 +19,7 @@ package com.l2jbr.gameserver; import com.l2jbr.commons.Config; +import com.l2jbr.commons.database.DatabaseAccess; import com.l2jbr.gameserver.gameserverpackets.ServerStatus; import com.l2jbr.gameserver.instancemanager.*; import com.l2jbr.gameserver.model.L2World; @@ -219,6 +220,9 @@ public void run() // ignore } + // commit data, last chance + DatabaseAccess.shutdown(); + // server will quit, when this function ends. if (_instance._shutdownMode == GM_RESTART) { diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/clientpackets/CharacterCreate.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/clientpackets/CharacterCreate.java index 9a043848..88fb9397 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/clientpackets/CharacterCreate.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/clientpackets/CharacterCreate.java @@ -167,12 +167,8 @@ private boolean isValidName(String text) return result; } - private void initNewChar(L2GameClient client, L2PcInstance newChar) - { - if (Config.DEBUG) - { - _log.debug("Character init start"); - } + private void initNewChar(L2GameClient client, L2PcInstance newChar) { + _log.debug("Character init start"); L2World.getInstance().storeObject(newChar); L2PcTemplate template = newChar.getTemplate(); diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/clientpackets/CharacterDelete.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/clientpackets/CharacterDelete.java index e00241a5..6375e59d 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/clientpackets/CharacterDelete.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/clientpackets/CharacterDelete.java @@ -46,18 +46,12 @@ protected void readImpl() } @Override - protected void runImpl() - { - if (Config.DEBUG) - { - _log.debug("deleting slot:" + _charSlot); - } + protected void runImpl() { + _log.debug("deleting slot: {} ", _charSlot); L2PcInstance character = null; - try - { - if (Config.DELETE_DAYS == 0) - { + try { + if (Config.DELETE_DAYS == 0) { character = getClient().deleteChar(_charSlot); } else @@ -65,9 +59,8 @@ protected void runImpl() character = getClient().markToDeleteChar(_charSlot); } } - catch (Exception e) - { - _log.error( "Error:", e); + catch (Exception e) { + _log.error(e.getLocalizedMessage(), e); } if (character == null) diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/clientpackets/L2GameClientPacket.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/clientpackets/L2GameClientPacket.java index d63bd026..12c395b0 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/clientpackets/L2GameClientPacket.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/clientpackets/L2GameClientPacket.java @@ -25,7 +25,6 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; - /** * Packets received by the game server from clients * @author KenM @@ -35,18 +34,14 @@ public abstract class L2GameClientPacket extends ReceivablePacket private static final Logger _log = LoggerFactory.getLogger(L2GameClientPacket.class.getName()); @Override - protected boolean read() - { - // System.out.println(this.getType()); - try - { + protected boolean read() { + try { readImpl(); return true; } - catch (Throwable t) - { + catch (Throwable t) { _log.error("Client: " + getClient().toString() + " - Failed reading: " + getType() + ";"); - t.printStackTrace(); + _log.error(t.getLocalizedMessage(), t); } return false; } @@ -54,23 +49,17 @@ protected boolean read() protected abstract void readImpl(); @Override - public void run() - { - try - { + public void run() { + try { // flood protection - if ((GameTimeController.getGameTicks() - getClient().packetsSentStartTick) > 10) - { + if ((GameTimeController.getGameTicks() - getClient().packetsSentStartTick) > 10) { getClient().packetsSentStartTick = GameTimeController.getGameTicks(); getClient().packetsSentInSec = 0; } - else - { + else { getClient().packetsSentInSec++; - if (getClient().packetsSentInSec > 12) - { - if (getClient().packetsSentInSec < 100) - { + if (getClient().packetsSentInSec > 12) { + if (getClient().packetsSentInSec < 100) { sendPacket(new ActionFailed()); } return; @@ -83,16 +72,14 @@ public void run() { // Removes onspawn protection - player has faster computer than // average - if (getClient().getActiveChar() != null) - { + if (getClient().getActiveChar() != null) { getClient().getActiveChar().onActionRequest(); } } } - catch (Throwable t) - { + catch (Throwable t) { _log.error("Client: " + getClient().toString() + " - Failed running: " + getType() + ";"); - t.printStackTrace(); + _log.error(t.getLocalizedMessage(), t); } } diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/L2Character.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/L2Character.java index 078725b9..40d85462 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/L2Character.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/L2Character.java @@ -6497,7 +6497,8 @@ public void enableSkill(int skillId) { return; } - _disabledSkills.remove(skillId); + //this forced wrapper is necessary. otherwise it should try remove by index + _disabledSkills.remove(Integer.valueOf(skillId)); if (this instanceof L2PcInstance) { removeTimeStamp(skillId); diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/PcInventory.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/PcInventory.java index c53d7277..1e4a0345 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/PcInventory.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/PcInventory.java @@ -27,7 +27,6 @@ import java.util.LinkedList; import java.util.List; - public class PcInventory extends Inventory { public static final int ADENA_ID = 57; public static final int ANCIENT_ADENA_ID = 5575; diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/ShortCuts.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/ShortCuts.java index d222bc8f..70c0b907 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/ShortCuts.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/ShortCuts.java @@ -19,7 +19,6 @@ package com.l2jbr.gameserver.model; import com.l2jbr.commons.database.DatabaseAccess; -import com.l2jbr.commons.database.L2DatabaseFactory; import com.l2jbr.gameserver.model.actor.instance.L2PcInstance; import com.l2jbr.gameserver.model.database.repository.CharacterShortcutsRepository; import com.l2jbr.gameserver.serverpackets.ExAutoSoulShot; @@ -28,8 +27,6 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import java.sql.PreparedStatement; -import java.sql.ResultSet; import java.util.Map; import java.util.TreeMap; @@ -152,7 +149,7 @@ public void restore() int slot = shortcut.getSlot(); int page = shortcut.getPage(); int type = shortcut.getType(); - int id = shortcut.getId(); + int id = shortcut.getShortcutId(); int level = shortcut.getLevel(); L2ShortCut sc = new L2ShortCut(slot, page, type, id, level, 1); diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/actor/instance/L2PcInstance.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/actor/instance/L2PcInstance.java index c0f86c7f..abdef4be 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/actor/instance/L2PcInstance.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/actor/instance/L2PcInstance.java @@ -20,7 +20,6 @@ import com.l2jbr.commons.Config; import com.l2jbr.commons.database.DatabaseAccess; -import com.l2jbr.commons.database.L2DatabaseFactory; import com.l2jbr.commons.util.Rnd; import com.l2jbr.gameserver.*; import com.l2jbr.gameserver.SevenSigns; @@ -49,8 +48,8 @@ import com.l2jbr.gameserver.model.actor.stat.PcStat; import com.l2jbr.gameserver.model.actor.status.PcStatus; import com.l2jbr.gameserver.model.base.*; -import com.l2jbr.gameserver.model.database.*; import com.l2jbr.gameserver.model.database.Character; +import com.l2jbr.gameserver.model.database.*; import com.l2jbr.gameserver.model.database.repository.*; import com.l2jbr.gameserver.model.entity.*; import com.l2jbr.gameserver.model.quest.Quest; @@ -66,8 +65,6 @@ import com.l2jbr.gameserver.util.Point3D; import java.io.IOException; -import java.sql.PreparedStatement; -import java.sql.ResultSet; import java.util.*; import java.util.concurrent.ScheduledFuture; import java.util.concurrent.TimeUnit; @@ -6144,8 +6141,9 @@ public void setIsIn7sDungeon(boolean isIn7sDungeon) { * Update the characters table of the database with online status and lastAccess of this L2PcInstance (called when login and logout). */ public void updateOnlineStatus() { + _lastAccess = System.currentTimeMillis(); CharacterRepository repository = DatabaseAccess.getRepository(CharacterRepository.class); - repository.updateOnlineStatus(getObjectId(), isOnline(), System.currentTimeMillis()); + repository.updateOnlineStatus(getObjectId(), isOnline(), _lastAccess); } /** @@ -6397,7 +6395,7 @@ private static L2PcInstance restore(int objectId) { player.setXYZInvisible(character.getX(), character.getY(), character.getZ()); player.setHeading(character.getHeading()); - repository.findOthersCharactersOnAccount(player.getAccountName(), player.getObjectId()).forEach(other -> { + repository.findOthersCharactersOnAccount(character.getAccountName(), player.getObjectId()).forEach(other -> { player.getAccountChars().put(other.getObjectId(), other.getCharName()); }); @@ -6587,6 +6585,7 @@ private void storeCharBase() { Character character = new Character(); character.setObjId(getObjectId()); + character.setAccountName(_accountName); character.setLevel(level); character.setExperience(exp); @@ -6607,6 +6606,19 @@ private void storeCharBase() { character.setMentality(getMEN()); character.setWitness(getWIT()); character.setMaxload(getMaxLoad()); + character.setAccuracy(getAccuracy()); + character.setCritical(getCriticalHit(null, null)); + character.setEvasion(getEvasionRate(null)); + character.setMagicalAttack(getMAtk(null, null)); + character.setMagicalDefense(getMDef(null, null)); + character.setMagicalSpeed(getMAtkSpd()); + character.setPhysicalAttack(getPAtk(null)); + character.setPhysicalDefense(getPDef(null)); + character.setPhysicalSpeed(getPAtkSpd()); + character.setRunSpeed(getRunSpeed()); + character.setWalkSpeed(getWalkSpeed()); + character.setMovementMultiplier(1); + character.setAttackSpeedMultiplier(1); PcAppearance appearance = getAppearance(); @@ -6615,6 +6627,9 @@ private void storeCharBase() { character.setHairColor(appearance.getHairColor()); character.setTitle(getTitle()); character.setCharName(getName()); + character.setSex(appearance.getSex() ? 1 : 0); + character.setCollisionRadius(getTemplate().collisionRadius); + character.setCollisionHeight(getTemplate().collisionHeight); character.setHeading(getHeading()); setCharacterPosition(character); @@ -6645,6 +6660,7 @@ private void storeCharBase() { character.setDeletetime(getDeleteTimer()); character.setOnline(isOnline()); + character.setLastAccess(_lastAccess); character.setIsin7sdungeon(isIn7sDungeon() ? 1 : 0); long totalOnlineTime = _onlineTime; @@ -6660,6 +6676,8 @@ private void storeCharBase() { character.setNobless(isNoble() ? 1 : 0); character.setVarkaKetraAlly(getAllianceWithVarkaKetra()); character.setDeathPenaltyLevel(getDeathPenaltyBuffLevel()); + character.setCancraft(hasDwarvenCraft() ? 1 : 0); + character.setPersisted(); diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/AuctionBid.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/AuctionBid.java index cda695d6..18c95ea5 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/AuctionBid.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/AuctionBid.java @@ -1,5 +1,6 @@ package com.l2jbr.gameserver.model.database; +import com.l2jbr.commons.database.annotation.Column; import com.l2jbr.commons.database.annotation.Table; import com.l2jbr.commons.database.model.Entity; import org.springframework.data.annotation.Id; @@ -12,8 +13,10 @@ public class AuctionBid extends Entity { private Integer auctionId; private Integer bidderId; private String bidderName; + @Column("clan_name") private String clanName; private Integer maxBid; + @Column("time_bid") private Long timeBid; @Override diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/Augmentation.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/Augmentation.java index 0601d755..d038e294 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/Augmentation.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/Augmentation.java @@ -1,5 +1,6 @@ package com.l2jbr.gameserver.model.database; +import com.l2jbr.commons.database.annotation.Column; import com.l2jbr.commons.database.annotation.Table; import com.l2jbr.commons.database.model.Entity; import com.l2jbr.commons.util.Util; @@ -10,6 +11,7 @@ public class Augmentation extends Entity { @Id + @Column("item_id") private Integer itemId; private Integer attributes; private Integer skill; diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/Character.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/Character.java index b19ead03..053793e2 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/Character.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/Character.java @@ -9,6 +9,7 @@ public class Character extends Entity { @Id + @Column("obj_Id") private int objId; @Column("account_name") private String accountName; @@ -76,7 +77,7 @@ public class Character extends Entity { private int online; private long onlinetime; @Column("char_slot") - private int slot; + private Integer slot; private int newbie; private long lastAccess; @Column("clan_privs") @@ -85,7 +86,7 @@ public class Character extends Entity { private int isin7sdungeon; @Column("in_jail") private int inJail; - @Column("jailTimer") + @Column("jail_timer") private long jailTimer; @Column("power_grade") private int powerGrade; @@ -106,7 +107,6 @@ public class Character extends Entity { @Column("death_penalty_level") private int deathPenaltyLevel; - @Override public Integer getId() { return objId; diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/Items.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/Items.java index 9a8e8f13..08698c9e 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/Items.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/Items.java @@ -26,7 +26,7 @@ public class Items extends Entity { @Column("price_buy") private int priceBuy; @Column("time_of_use") - private int timeOfUse; + private Integer timeOfUse; @Column("custom_type1") private int customType1; @Column("custom_type2") diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/repository/CharacterQuestsRepository.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/repository/CharacterQuestsRepository.java index 8e1c1f60..2cfe01b4 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/repository/CharacterQuestsRepository.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/repository/CharacterQuestsRepository.java @@ -8,7 +8,7 @@ public interface CharacterQuestsRepository extends CrudRepository { - @Query("SELECT * FROM character_quests WHERE char_id=:objectId AND var=") + @Query("SELECT * FROM character_quests WHERE char_id=:objectId AND var=''") Iterable findAllByState(@Param("objectId") int charObjectId); @Modifying @@ -30,6 +30,6 @@ public interface CharacterQuestsRepository extends CrudRepository findByNameAndVar(@Param("char") int charObjectId, @Param("name") String questName, @Param("var") String var); } diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/repository/CharacterRepository.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/repository/CharacterRepository.java index 66a6c03f..fc0ee388 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/repository/CharacterRepository.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/repository/CharacterRepository.java @@ -72,7 +72,7 @@ int updateJailStatusByName(@Param("name") String charName, @Param("x") int x, @P int updateOnlineStatus(@Param("objectId") int objectId, @Param("online") int online, @Param("lastAccess") long lastAccess); @Modifying - @Query("UPDATE characters SET isIn7sDungeon=? WHERE obj_id=?") + @Query("UPDATE characters SET isIn7sDungeon=:inDungeon WHERE obj_id=:objectId") int updateSevenSignsDungeonStatus(@Param("objectId") int objectId, @Param("inDungeon") int isInDungeon); @Modifying diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/repository/ItemRepository.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/repository/ItemRepository.java index b6911064..b9ce2c68 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/repository/ItemRepository.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/repository/ItemRepository.java @@ -35,7 +35,7 @@ public interface ItemRepository extends CrudRepository { "custom_type1=:customType1,custom_type2=:customType2,mana_left=:mana WHERE object_id=:id") int updateById(@Param("id") int id, @Param("owner") int ownerId, @Param("count") int count, @Param("loc") String loc, @Param("locData") int locData, @Param("enchantLevel") int enchantLevel, @Param("priceSell") int priceSell, @Param("priceBuy") int priceBuy, - @Param("CustomType1") int customType1, @Param("customType2") int customType2, @Param("mana") int mana); + @Param("customType1") int customType1, @Param("customType2") int customType2, @Param("mana") int mana); @Modifying @Query("DELETE FROM items WHERE owner_id=:owner") From 2c98c70fbea8bf1343ae605e239b63eec7189277 Mon Sep 17 00:00:00 2001 From: Alisson Oliveira Date: Tue, 8 May 2018 13:35:34 -0300 Subject: [PATCH 102/236] =?UTF-8?q?remove=20tabelas=20boxes=20e=20boxeacce?= =?UTF-8?q?ss=20de=20funcionalidade=20n=C3=A3o=20implementada.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Datapack/data/html/admin/help/gmcommands2.htm | 3 - Datapack/sql/boxaccess.sql | 8 - Datapack/sql/boxes.sql | 15 - .../sql/experimental/l2j_full_structure.sql | 32 -- Datapack/tools/database_installer.bat | 3 - Datapack/tools/database_installer.sh | 2 - Datapack/tools/full_install.sql | 2 - .../admincommandhandlers/AdminEditNpc.java | 34 +- .../com/l2jbr/gameserver/model/L2Spawn.java | 2 +- .../model/actor/instance/L2BoxInstance.java | 373 ------------------ .../model/actor/instance/L2NpcInstance.java | 2 +- .../gameserver/model/database/BoxAccess.java | 7 - .../gameserver/model/database/Boxes.java | 14 - .../config/command-privileges.properties | 1 - .../accountmanager/SQLAccountManager.java | 76 ++-- 15 files changed, 33 insertions(+), 541 deletions(-) delete mode 100644 Datapack/sql/boxaccess.sql delete mode 100644 Datapack/sql/boxes.sql delete mode 100644 Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/actor/instance/L2BoxInstance.java delete mode 100644 Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/BoxAccess.java delete mode 100644 Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/database/Boxes.java diff --git a/Datapack/data/html/admin/help/gmcommands2.htm b/Datapack/data/html/admin/help/gmcommands2.htm index ca3d03d7..ab401587 100644 --- a/Datapack/data/html/admin/help/gmcommands2.htm +++ b/Datapack/data/html/admin/help/gmcommands2.htm @@ -40,9 +40,6 @@ //clear_siege_list
    //sgspawn <npc_id> <group>
    //siege - Castle names: gludio, giran, dion, oren
    -//box_access - with box targetted, shows access list
    -//box_access char1 char2 - To add players to box
    Usage: //box_access kadar LadyPain
    -//box_access no char1 - Removes player from box access
    Usage: //box_access LadyPain no kadar
    //fight_calculator
    //fight_calculator_show
    //fcs
    diff --git a/Datapack/sql/boxaccess.sql b/Datapack/sql/boxaccess.sql deleted file mode 100644 index 6c4d28fb..00000000 --- a/Datapack/sql/boxaccess.sql +++ /dev/null @@ -1,8 +0,0 @@ --- --- Table structure for table `boxaccess` --- - -CREATE TABLE IF NOT EXISTS boxaccess ( - spawn decimal(11,0) default NULL, - charname varchar(32) default NULL -); \ No newline at end of file diff --git a/Datapack/sql/boxes.sql b/Datapack/sql/boxes.sql deleted file mode 100644 index ddaf2f39..00000000 --- a/Datapack/sql/boxes.sql +++ /dev/null @@ -1,15 +0,0 @@ --- --- Table structure for table `boxes` --- - -CREATE TABLE IF NOT EXISTS boxes ( - id int(11) NOT NULL auto_increment, - spawn decimal(11,0) default NULL, - npcid decimal(11,0) default NULL, - drawer varchar(32) default NULL, - itemid decimal(11,0) default NULL, - name varchar(32) default '', - count decimal(11,0) default NULL, - enchant decimal(2,0) default NULL, - PRIMARY KEY (id) -); \ No newline at end of file diff --git a/Datapack/sql/experimental/l2j_full_structure.sql b/Datapack/sql/experimental/l2j_full_structure.sql index 0e0e677c..9c4cfcdb 100644 --- a/Datapack/sql/experimental/l2j_full_structure.sql +++ b/Datapack/sql/experimental/l2j_full_structure.sql @@ -563,38 +563,6 @@ CREATE TABLE IF NOT EXISTS `auto_chat_text` ( ENGINE = InnoDB DEFAULT CHARACTER SET = latin1; - --- ----------------------------------------------------- --- Table `boxaccess` --- ----------------------------------------------------- -DROP TABLE IF EXISTS `boxaccess` ; - -CREATE TABLE IF NOT EXISTS `boxaccess` ( - `spawn` DECIMAL(11,0) NULL DEFAULT NULL, - `charname` VARCHAR(32) NULL DEFAULT NULL) -ENGINE = InnoDB -DEFAULT CHARACTER SET = latin1; - - --- ----------------------------------------------------- --- Table `boxes` --- ----------------------------------------------------- -DROP TABLE IF EXISTS `boxes` ; - -CREATE TABLE IF NOT EXISTS `boxes` ( - `id` INT(11) NOT NULL AUTO_INCREMENT, - `spawn` DECIMAL(11,0) NULL DEFAULT NULL, - `npcid` DECIMAL(11,0) NULL DEFAULT NULL, - `drawer` VARCHAR(32) NULL DEFAULT NULL, - `itemid` DECIMAL(11,0) NULL DEFAULT NULL, - `name` VARCHAR(32) NULL DEFAULT '', - `count` DECIMAL(11,0) NULL DEFAULT NULL, - `enchant` DECIMAL(2,0) NULL DEFAULT NULL, - PRIMARY KEY (`id`)) -ENGINE = InnoDB -DEFAULT CHARACTER SET = latin1; - - -- ----------------------------------------------------- -- Table `castle` -- ----------------------------------------------------- diff --git a/Datapack/tools/database_installer.bat b/Datapack/tools/database_installer.bat index beb4a87c..6937fbc3 100644 --- a/Datapack/tools/database_installer.bat +++ b/Datapack/tools/database_installer.bat @@ -521,8 +521,6 @@ auction_bid.sql augmentations.sql auto_chat.sql auto_chat_text.sql -boxaccess.sql -boxes.sql castle.sql castle_door.sql castle_siege_guards.sql @@ -595,7 +593,6 @@ teleport.sql topic.sql walker_routes.sql weapon.sql -zone.sql zone_vertices.sql castle_manor_procure.sql castle_manor_production.sql diff --git a/Datapack/tools/database_installer.sh b/Datapack/tools/database_installer.sh index 038d4ddd..8961ccfa 100644 --- a/Datapack/tools/database_installer.sh +++ b/Datapack/tools/database_installer.sh @@ -261,8 +261,6 @@ $MYG < ../sql/auction_bid.sql &> /dev/null $MYG < ../sql/augmentations.sql &> /dev/null $MYG < ../sql/auto_chat.sql &> /dev/null $MYG < ../sql/auto_chat_text.sql &> /dev/null -$MYG < ../sql/boxaccess.sql &> /dev/null -$MYG < ../sql/boxes.sql &> /dev/null $MYG < ../sql/castle.sql &> /dev/null $MYG < ../sql/castle_door.sql &> /dev/null $MYG < ../sql/castle_siege_guards.sql &> /dev/null diff --git a/Datapack/tools/full_install.sql b/Datapack/tools/full_install.sql index bedaf581..61a39b15 100644 --- a/Datapack/tools/full_install.sql +++ b/Datapack/tools/full_install.sql @@ -5,8 +5,6 @@ DROP TABLE IF EXISTS auction_bid; DROP TABLE IF EXISTS augmentations; DROP TABLE IF EXISTS auto_chat; DROP TABLE IF EXISTS auto_chat_text; -DROP TABLE IF EXISTS boxaccess; -DROP TABLE IF EXISTS boxes; DROP TABLE IF EXISTS castle; DROP TABLE IF EXISTS castle_door; DROP TABLE IF EXISTS castle_siege_guards; diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/handler/admincommandhandlers/AdminEditNpc.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/handler/admincommandhandlers/AdminEditNpc.java index b3ffe424..ebdcaf4d 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/handler/admincommandhandlers/AdminEditNpc.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/handler/admincommandhandlers/AdminEditNpc.java @@ -26,8 +26,10 @@ import com.l2jbr.gameserver.datatables.ItemTable; import com.l2jbr.gameserver.datatables.NpcTable; import com.l2jbr.gameserver.handler.IAdminCommandHandler; -import com.l2jbr.gameserver.model.*; -import com.l2jbr.gameserver.model.actor.instance.L2BoxInstance; +import com.l2jbr.gameserver.model.L2DropCategory; +import com.l2jbr.gameserver.model.L2DropData; +import com.l2jbr.gameserver.model.L2ItemInstance; +import com.l2jbr.gameserver.model.L2TradeList; import com.l2jbr.gameserver.model.actor.instance.L2PcInstance; import com.l2jbr.gameserver.model.database.DropList; import com.l2jbr.gameserver.model.database.MerchantBuyList; @@ -64,7 +66,6 @@ public class AdminEditNpc implements IAdminCommandHandler { "admin_showShopList", "admin_addShopItem", "admin_delShopItem", - "admin_box_access", "admin_editShopItem", "admin_close_window" }; @@ -217,34 +218,7 @@ public boolean useAdminCommand(String command, L2PcInstance activeChar) {// TODO } else { activeChar.sendMessage("Usage: //del_drop "); } - } else if (command.startsWith("admin_box_access")) { - L2Object target = activeChar.getTarget(); - String[] players = command.split(" "); - if (target instanceof L2BoxInstance) { - L2BoxInstance box = (L2BoxInstance) target; - if (players.length > 1) { - boolean access = true; - for (int i = 1; i < players.length; i++) { - if (players[i].equals("no")) { - access = false; - continue; - } - box.grantAccess(players[i], access); - } - } else { - try { - String msg = "Access:"; - for (Object p : box.getAccess()) { - msg += " " + (String) p; - } - activeChar.sendMessage(msg); - } catch (Exception e) { - _log.info("box_access: " + e); - } - } - } } - return true; } diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/L2Spawn.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/L2Spawn.java index ae019c7a..35d5b24c 100644 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/L2Spawn.java +++ b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/L2Spawn.java @@ -455,7 +455,7 @@ public L2NpcInstance doSpawn() { Object[] parameters = { IdFactory.getInstance().getNextId(), _template }; // Call the constructor of the L2NpcInstance - // (can be a L2ArtefactInstance, L2FriendlyMobInstance, L2GuardInstance, L2MonsterInstance, L2SiegeGuardInstance, L2BoxInstance, + // (can be a L2ArtefactInstance, L2FriendlyMobInstance, L2GuardInstance, L2MonsterInstance, L2SiegeGuardInstance, // L2FeedableBeastInstance, L2TamedBeastInstance, L2FolkInstance or L2TvTEventNpcInstance) Object tmp = _constructor.newInstance(parameters); diff --git a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/actor/instance/L2BoxInstance.java b/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/actor/instance/L2BoxInstance.java deleted file mode 100644 index c76799c8..00000000 --- a/Gameserver/src/main/com.l2jbr.gameserver/com/l2jbr/gameserver/model/actor/instance/L2BoxInstance.java +++ /dev/null @@ -1,373 +0,0 @@ -/* This program 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 2, 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, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA - * 02111-1307, USA. - * - * http://www.gnu.org/copyleft/gpl.html - */ -package com.l2jbr.gameserver.model.actor.instance; - -import com.l2jbr.commons.database.L2DatabaseFactory; -import com.l2jbr.gameserver.model.L2ItemInstance; -import com.l2jbr.gameserver.serverpackets.ActionFailed; -import com.l2jbr.gameserver.serverpackets.NpcHtmlMessage; -import com.l2jbr.gameserver.templates.L2NpcTemplate; - -import java.sql.PreparedStatement; -import java.sql.ResultSet; -import java.util.LinkedHashSet; -import java.util.LinkedList; -import java.util.List; -import java.util.Set; - - -/* - * This class implements a L2Box instance which is used like a warehouse but - * without limits on item numbers. It can be thought of a box with six drawers. - * Depositing and withdrawing is done through a HTML dialog to circumvent the - * package size limit of the warehouse dialog. - * Access to a box has to be set by an admin and uses the players' names for - * easier handling (s. admin command admin_box_access). - * To spawn an L2BoxInstance change the type in npc to L2Box. - * example: update npc set type='L2Box' where id=1042; - * It uses two tables: boxes and boxaccess. Create these with: - CREATE TABLE boxes ( - id int(11) NOT NULL auto_increment, - spawn decimal(11,0) default NULL, - npcid decimal(11,0) default NULL, - drawer varchar(32) default NULL, - itemid decimal(11,0) default NULL, - name varchar(32) default '', - count decimal(11,0) default NULL, - enchant decimal(2,0) default NULL, - PRIMARY KEY (id) - ) TYPE=MyISAM; - CREATE TABLE boxaccess ( - spawn decimal(11,0) default NULL, - charname varchar(32) default NULL - ) TYPE=MyISAM; - */ - -public class L2BoxInstance extends L2NpcInstance { - - private class L2BoxItem implements Comparable { - public int itemid; - public int id; - public int count; - public String name; - - public L2BoxItem(int _itemid, int _count, String _name, int _id, int _enchant) { - itemid = _itemid; - count = _count; - name = _name; - id = _id; - } - - @Override - public int compareTo(Object o) { - int r = name.compareToIgnoreCase(((L2BoxItem) o).name); - if (r != 0) { - return r; - } - if (id < ((L2BoxItem) o).id) { - return -1; - } - return 1; - } - } - - // private static Logger _log = LoggerFactory.getLogger(L2BoxInstance.class.getName()); - private static final int MAX_ITEMS_PER_PAGE = 25; - private static final String INSERT_GRANT = "INSERT INTO boxaccess (charname,spawn) VALUES(?,?)"; - private static final String DELETE_GRANT = "DELETE FROM boxaccess WHERE charname=? AND spawn=?"; - private static final String LIST_GRANT = "SELECT charname FROM boxaccess WHERE spawn=?"; - private static final String VARIABLE_PREFIX = "_abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"; - - public L2BoxInstance(int objectId, L2NpcTemplate _template) { - super(objectId, _template); - } - - @Override - public void onBypassFeedback(L2PcInstance player, String command) { - String playerName = player.getName(); - boolean access = hasAccess(playerName); - - if (command.startsWith("Withdraw")) { - if (access) { - showWithdrawWindow(player, command.substring(9)); - } - } else if (command.startsWith("Deposit")) { - if (access) { - showDepositWindow(player, command.substring(8)); - } - } else if (command.startsWith("InBox")) { - if (access) { - putInBox(player, command.substring(6)); - } - } else if (command.startsWith("OutBox")) { - if (access) { - takeOutBox(player, command.substring(7)); - } - } else { - super.onBypassFeedback(player, command); - // else _log.info("onBypassFeedback unknown command "+command); - } - } - - @Override - public boolean hasRandomAnimation() { - return false; - } - - @Override - public String getHtmlPath(int npcId, int val) { - String pom = ""; - if (val == 0) { - pom = "" + npcId; - } else { - pom = npcId + "-" + val; - } - return "data/html/custom/" + pom + ".htm"; - } - - public boolean hasAccess(String player) { - java.sql.Connection con = null; - boolean result = false; - try { - con = L2DatabaseFactory.getInstance().getConnection(); - PreparedStatement st = con.prepareStatement("SELECT spawn, charname FROM boxaccess WHERE charname=? AND spawn=?"); - st.setString(1, player); - st.setInt(2, getSpawn().getId()); - ResultSet rs = st.executeQuery(); - if (rs.next()) { - result = true; - } - rs.close(); - st.close(); - } catch (Exception e) { - _log.info("hasAccess failed: " + e); - } finally { - try { - con.close(); - } catch (Exception e) { - } - } - return result; - } - - public List getAccess() { - java.sql.Connection con = null; - List acl = new LinkedList<>(); - try { - con = L2DatabaseFactory.getInstance().getConnection(); - PreparedStatement st = con.prepareStatement(LIST_GRANT); - st.setInt(1, getSpawn().getId()); - ResultSet rs = st.executeQuery(); - while (rs.next()) { - acl.add(rs.getString("charname")); - } - rs.close(); - st.close(); - } catch (Exception e) { - _log.info("getAccess failed: " + e); - } finally { - try { - con.close(); - } catch (Exception e) { - } - } - return acl; - } - - public boolean grantAccess(String player, boolean what) { - java.sql.Connection con = null; - boolean result = false; - try { - con = L2DatabaseFactory.getInstance().getConnection(); - String _query; - if (what) { - _query = INSERT_GRANT; - } else { - _query = DELETE_GRANT; - } - - PreparedStatement st = con.prepareStatement(_query); - st.setString(1, player); - st.setInt(2, getSpawn().getId()); - st.execute(); - st.close(); - } catch (Exception e) { - result = false; - } finally { - try { - con.close(); - } catch (Exception e) { - } - } - return result; - } - - private void showWithdrawWindow(L2PcInstance player, String command) { - String drawername = "trash"; - if (command == null) { - return; - } - String[] cmd = command.split(" "); - int startPos = 0; - if (cmd != null) { - drawername = cmd[0]; - } - if (cmd.length > 1) { - startPos = Integer.parseInt(cmd[1]); - } - - NpcHtmlMessage html = new NpcHtmlMessage(getObjectId()); - int nitems = 0; - Set _items = getItems(drawername); - if (startPos >= _items.size()) { - startPos = 0; - } - String button = "