diff --git a/sql/migrations/20260825234315_world.sql b/sql/migrations/20260825234315_world.sql new file mode 100644 index 00000000000..dfee7add2ef --- /dev/null +++ b/sql/migrations/20260825234315_world.sql @@ -0,0 +1,552 @@ +DROP PROCEDURE IF EXISTS add_migration; +delimiter ?? +CREATE PROCEDURE `add_migration`() +BEGIN +DECLARE v INT DEFAULT 1; +SET v = (SELECT COUNT(*) FROM `migrations` WHERE `id`='20260825234315'); +IF v=0 THEN +INSERT INTO `migrations` VALUES ('20260825234315'); +-- Add your query below. + +INSERT INTO `conditions` (`condition_entry`, `type`, `value1`, `value2`, `value3`, `value4`, `flags`) VALUES +(10660, 17, 10660, 0, 0, 0, 0), -- Player has learnt Tribal Leatherworking +(10658, 17, 10658, 0, 0, 0, 0), -- Player has learnt Elemental Leatherworking +(10656, 17, 10656, 0, 0, 0, 0), -- Player has learnt Dragonscale Leatherworking +-- Condition 1367: Player has learnt Goblin Engineering +-- Condition 1371: Player has a Goblin Engineer Membership Card in their bags +(20222, -1, 1367, 1371, 0, 0, 0), -- Goblin Engineering trainer option +-- Condition 1368: Player has learnt Gnomish Engineering +-- Condition 1374: Player has a Gnome Engineer Membership Card in their bags +(20219, -1, 1368, 1374, 0, 0, 0), -- Gnomish Engineering trainer option +(20220, -1, 20219, 2, 0, 0, 0); -- Gnomish Engineering trainer option (Horde only - Oglethorpe is a neutral NPC) + +-- Add missing trainer gossip menu options +INSERT INTO `gossip_menu_option` (`menu_id`, `id`, `option_icon`, `option_text`, `option_broadcast_text`, `option_id`, `npc_option_npcflag`, `action_menu_id`, `action_poi_id`, `action_script_id`, `box_coded`, `box_money`, `box_text`, `box_broadcast_text`, `condition_id`) VALUES +(3068, 0, 3, 'I would like to train.', 2548, 5, 16, 0, 0, 0, 0, 0, NULL, 0, 10656), -- Trainer gossip menu option for Thorkaf Dragoneye (Dragonscale Leatherworking - Horde) +(3069, 0, 3, 'I would like to train.', 2548, 5, 16, 0, 0, 0, 0, 0, NULL, 0, 10658); -- Trainer gossip menu option for Brumn Winterhoof (Elemental Leatherworking - Horde) + +-- Update condition for existing trainer gossip menu options +UPDATE `gossip_menu_option` SET `condition_id` = 1354 WHERE `option_id` = 5 AND `menu_id` IN ( +597, -- Grumnus Steelshaper (Armorsmithing - Alliance) +1043, -- Shayis Steelfury (Armorsmithing - Horde) +3203); -- Okothos Ironrage (Armorsmithing - Horde) + +UPDATE `gossip_menu_option` SET `condition_id` = 1352 WHERE `option_id` = 5 AND `menu_id` IN ( +1041, -- Borgus Steelhand (Weaponsmithing - Alliance) +1042, -- Kelgruk Blooadaxe (Weaponsmithing - Horde) +3201, -- Ironus Coldsteel (Weaponsmithing - Alliance) +3202); -- Borgosh Corebender (Weaponsmithing - Horde) +UPDATE `gossip_menu_option` SET `condition_id` = 10656 WHERE `menu_id` = 3067 AND `option_id` = 5; -- Peter Galen (Dragonscale Leatherworking - Alliance) +UPDATE `gossip_menu_option` SET `condition_id` = 10658 WHERE `menu_id` = 3070 AND `option_id` = 5; -- Sarah Tanner (Elemental Leatherworking - Alliance) +UPDATE `gossip_menu_option` SET `condition_id` = 10660 WHERE `option_id` = 5 AND `menu_id` IN ( +3072, -- Caryssia Moonhunter (Tribal Leatherworking - Alliance) +3073); -- Se'Jib (Tribal Leatherworking - Horde) +UPDATE `gossip_menu_option` SET `condition_id` = 20222, `option_broadcast_text` = 4551 WHERE `menu_id` = 1465 AND `option_id` = 5; -- Vazario Linkgrease (Goblin Engineering) + Correction to broadcast_text entry (currently uses the Gnomish entry 4553 instead of the Goblin one, 4551) +UPDATE `gossip_menu_option` SET `condition_id` = 20219 WHERE `menu_id` = 1468 AND `option_id` = 5; -- Tinkmaster Overspark (Gnomish Engineering - Alliance) +UPDATE `gossip_menu_option` SET `condition_id` = 20220 WHERE `menu_id` = 1467 AND `option_id` = 5; -- Oglethorpe Obnoticus (Gnomish Engineering - Horde) +UPDATE `gossip_menu_option` SET `condition_id` = 20222 WHERE `menu_id` = 1469 AND `option_id` = 5; -- Nixx Sprocketspring (Goblin Engineering) + +-- Add class conditions for all class trainer gossip options -- +-- Druid +UPDATE `gossip_menu_option` SET `condition_id` = 89 WHERE `option_id` = 5 AND menu_id IN ( +1403, -- Mathrengyl Bearwalker +3921, -- Turak Runetotem +3923, -- Kal +3924, -- Denatharion +3926, -- Gennia Runetotem +4507, -- Maldryn +4508, -- Sheldras Moontree +4571, -- Fylerian Nightwing +4606, -- Sheal Runetotem, Jannos Lighthoof +4607, -- Kym Wildmane +4644, -- Gart Mistrunner +4687, -- Loganaar +4688, -- Mardant Strongoak, Theridran +4689); -- Golhine the Hooded +-- Warlock +UPDATE `gossip_menu_option` SET `condition_id` = 67 WHERE `option_id` = 5 AND menu_id IN ( +1503, -- Drusilla La Salle +2381, -- Briarthorn +2383, -- Kaal Soulreaper +2384, -- Zevrost +4503, -- Demisette Cloyce +4504, -- Sandahl +4505, -- Ursula Deline +4566, -- Alexander Calder +4567, -- Thistleheart +4603, -- Grol'dar +4604, -- Mirket +4609, -- Luther Pickman +4610, -- Richard Kerwin +4641, -- Dhugru Gorelust +4642, -- Kartosh +4643, -- Nartok +4655, -- Maximillion +4656, -- Rupert Boch +4667, -- Maximillian Crowe +4681, -- Alamar Grimm +4682); -- Gimrizz Shadowcog +-- Demon trainers already use condition 67 +-- Mage (including Portal trainers) +UPDATE `gossip_menu_option` SET `condition_id` = 90 WHERE `option_id` = 5 AND menu_id IN ( +63, -- Cain Firesong +64, -- Un'Thuwa, Mai'ah +4484, -- Elsharin +4485, -- Jennea Cannon +4486, -- Maginor Dumas +4517, -- Uthel'nay +4518, -- Enyo +4519, -- Deino +4520, -- Pephredo +4534, -- Archmage Shymm +4535, -- Thurston Xane +4536, -- Ursyn Ghull +4537, -- Anastasia Hartwell +4538, -- Pierce Shackleton +4539, -- Kaelystia Hatebringer +4552, -- Bink, Nittlebur Sparkfizzle +4553, -- Dink +4554, -- Juli Stormkettle +4654, -- Isabella +4660, -- Khelden Bremen +4661, -- Zaldimar Wefhellt +4685, -- Magis Sparkmantle +4686, -- Marryk Nurribit +4821, -- Elissa Dumas +4822, -- Larimaine Purdue +4823, -- Milstaff Stormeye +4825, -- Birgitte Cranston +4826, -- Thuul +4827); -- Lexington Mortaim +-- Shaman +UPDATE `gossip_menu_option` SET `condition_id` = 92 WHERE `option_id` = 5 AND menu_id IN ( +4103, -- Meela Dawnstrider, Narm Skychaser +4104, -- Swart +4515, -- Sian'tsu +4516, -- Kardris Dreamseeker +4528, -- Siln Skychaser +4529, -- Beram Skychaser +4530, -- Tigor Skychaser +4652, -- Haromm, Shikrik +5123); -- Sagorne Creststrider +-- Priest +UPDATE `gossip_menu_option` SET `condition_id` = 94 WHERE `option_id` = 5 AND menu_id IN ( +3642, -- High Priest Rohan +3643, -- Nara Meideros +3644, -- Tai'jin, Ken'jai +3645, -- Dark Cleric Duesten, Dark Cleric Beryl +4466, -- High Priestess Laurena +4467, -- Brother Joshua +4468, -- Brother Benjamin +4521, -- Ur'kyo +4522, -- Zayus +4523, -- X'yera +4531, -- Malakai Cross +4532, -- Father Cobb +4533, -- Miles Welsh +4543, -- Father Lazarus +4544, -- Aelthalyste +4545, -- Father Lankester +4558, -- Braenna Flintcrag +4560, -- Toldren Deepiron +4572, -- Lariia +4573, -- Jandria +4665, -- Priestess Anetta +4666, -- Priestess Josetta +4679, -- Branstock Khalder +4680, -- Maxan Anvol, Theodrus Frostbeard +4691); -- Shanda, Laurna Morninglight, Astarii Starseeker, Priestess Alathea +-- Rogue +UPDATE `gossip_menu_option` SET `condition_id` = 100 WHERE `option_id` = 5 AND menu_id IN ( +85, -- David Trias, Marion Call +141, -- Rwag, Kaplak +381, -- Keryn Sylvius +410, -- Hogral Bakkan +411, -- Hulfdan Blackbeard +436, -- Jannok Breezesong +521, -- Shenthul +3984, -- Fahrad +4502, -- Osborne the Night Man +4512, -- Ormok +4513, -- Gest +4540, -- Miles Dexter +4541, -- Gregory Charles +4542, -- Carolyn Ward +4561, -- Fenthwick +4562, -- Ormyr Flinteye +4575, -- Anishar +4576, -- Syurna +4577, -- Erion Shadewhisper +4658, -- Ian Strom +4659, -- Jorik Kerridan +4676, -- Solm Hargrin +4690, -- Frahun Shadewhisper +5061); -- Lord Tony Romano +-- Hunter (including Pet trainers) +UPDATE `gossip_menu_option` SET `condition_id` = 96 WHERE `option_id` = 5 AND menu_id IN ( +4007, -- Grif Wildheart +4008, -- Jocaste +4009, -- Dazalar +4010, -- Ormak Grimshot +4011, -- Kary Thunderhorn +4012, -- Yaw Sharpmane +4013, -- Sian'dur +4017, -- Thotar +4023, -- Holt Thunderhorn +4092, -- Danlaar Nightstride, Alenndaar Lapidaar +4101, -- Ogromm +4472, -- Thorfin Stoneshield +4473, -- Ulfir Ironbeard +4474, -- Einris Brightspear +4506, -- Xor'juul +4524, -- Urek Thunderhorn +4549, -- Daera Brightspear +4550, -- Olmin Burningbeard +4551, -- Regnus Thundergranite +4621, -- Jeen'ra Nightrunner +4647, -- Lanka Farshot +4648, -- Jen'shan +4657, -- Kragg +4674, -- Dargh Trueaim +4675, -- Thorgas Grimson +4693, -- Dorion +4694, -- Kaerbrus +4695, -- Ayanna Everstride +4783); -- (Entry for all Pet trainers) +-- Paladin +UPDATE `gossip_menu_option` SET `condition_id` = 106 WHERE `option_id` = 5 AND menu_id IN ( +2304, -- Brandur Ironhammer +4469, -- Arthur the Faithful +4470, -- Katherine the Pure +4471, -- Lord Grayson Shadowbreaker +4556, -- Beldruk Doombrow +4557, -- Valgar Highforge +4662, -- Brother Karman +4663, -- Brother Sammuel +4664, -- Brother Wilhelm +4677, -- Azar Stronghammer +4678); -- Bromos Grummner +-- Warrior +UPDATE `gossip_menu_option` SET `condition_id` = 98 WHERE `option_id` = 5 AND menu_id IN ( +523, -- Malosh, Frang, Tarshaw Jaggedscar +655, -- Krang Stonehoof +656, -- Austil de Mon +4091, -- Captain Evencane +4475, -- Ander Germaine +4481, -- Ilsa Corbin +4482, -- Wu Shen +4509, -- Grezz Ragefist +4510, -- Zel'mak +4511, -- Sorek +4525, -- Sark Ragetotem +4526, -- Torm Ragetotem +4527, -- Ker Ragetotem +4546, -- Angela Curthas +4547, -- Baltus Fowler +4548, -- Christoph Walker +4568, -- Bilban Tosslespanner +4569, -- Kelstrum Stonebreaker +4570, -- Kelv Sternhammer +4578, -- Sildanair +4579, -- Darnath Bladesinger +4581, -- Arias'ta Bladesinger +4645, -- Harutt Thunderhorn +4649, -- Lyria Du Lac +4650, -- Llane Beshere +4653, -- Dannal Stern +4683, -- Granis Swiftaxe +4684, -- Thran Khorman +4696, -- Alyissia +4697); -- Kyra Windblade + +-- Remove the now deprecated columns +ALTER TABLE `creature_template` + DROP COLUMN `trainer_spell`, + DROP COLUMN `trainer_race`, + DROP COLUMN `trainer_class`, + DROP COLUMN `trainer_type`; + +-- CORRECTIONS FOR `npc_trainer_greeting` +-- Delete entry for non-trainer NPC +DELETE FROM `npc_trainer_greeting` WHERE `entry` = 6251; + +-- NPCs that have an empty trainer greeting +UPDATE `npc_trainer_greeting` SET `content_default` = '', `content_loc1` = '', `content_loc2` = '', `content_loc3` = '', `content_loc4` = '', `content_loc5` = '', `content_loc6` = '', `content_loc7` = '', `content_loc8` = '' WHERE `entry` IN ( +4578, +5164, +7230, +7231, +7232, +7866, +7867, +7868, +7869, +7870, +7871, +8126, +8738, +9584, +11146, +11177, +11178); + +-- Velma Warnam has a non-empty trainer greeting (already correct in other localisations) +UPDATE `npc_trainer_greeting` SET `content_default` = 'Hello! Can I teach you something?' WHERE `entry` = 4773; + +-- Add 'type' to npc_trainer_greeting instead of calculating in core: +-- This is a formatter for training UI that is opened after sending SMSG_TRAINER_LIST to the client (completely unrelated to trainer_type from creature_template) +-- Stored in DB together with trainer greetings, valid values are 0 and 2 +ALTER TABLE `npc_trainer_greeting` + ADD COLUMN `trainer_type` TINYINT(2) UNSIGNED NOT NULL DEFAULT '2' AFTER `entry`; + +-- Assign trainer_type based on `trainer` sniffs +UPDATE `npc_trainer_greeting` SET `trainer_type` = 0 WHERE `entry` = 198; +UPDATE `npc_trainer_greeting` SET `trainer_type` = 0 WHERE `entry` = 328; +UPDATE `npc_trainer_greeting` SET `trainer_type` = 0 WHERE `entry` = 331; +UPDATE `npc_trainer_greeting` SET `trainer_type` = 0 WHERE `entry` = 375; +UPDATE `npc_trainer_greeting` SET `trainer_type` = 0 WHERE `entry` = 376; +UPDATE `npc_trainer_greeting` SET `trainer_type` = 0 WHERE `entry` = 377; +UPDATE `npc_trainer_greeting` SET `trainer_type` = 0 WHERE `entry` = 459; +UPDATE `npc_trainer_greeting` SET `trainer_type` = 0 WHERE `entry` = 460; +UPDATE `npc_trainer_greeting` SET `trainer_type` = 0 WHERE `entry` = 461; +UPDATE `npc_trainer_greeting` SET `trainer_type` = 0 WHERE `entry` = 543; +UPDATE `npc_trainer_greeting` SET `trainer_type` = 0 WHERE `entry` = 837; +UPDATE `npc_trainer_greeting` SET `trainer_type` = 0 WHERE `entry` = 895; +UPDATE `npc_trainer_greeting` SET `trainer_type` = 0 WHERE `entry` = 906; +UPDATE `npc_trainer_greeting` SET `trainer_type` = 0 WHERE `entry` = 911; +UPDATE `npc_trainer_greeting` SET `trainer_type` = 0 WHERE `entry` = 912; +UPDATE `npc_trainer_greeting` SET `trainer_type` = 0 WHERE `entry` = 913; +UPDATE `npc_trainer_greeting` SET `trainer_type` = 0 WHERE `entry` = 914; +UPDATE `npc_trainer_greeting` SET `trainer_type` = 0 WHERE `entry` = 915; +UPDATE `npc_trainer_greeting` SET `trainer_type` = 0 WHERE `entry` = 916; +UPDATE `npc_trainer_greeting` SET `trainer_type` = 0 WHERE `entry` = 917; +UPDATE `npc_trainer_greeting` SET `trainer_type` = 0 WHERE `entry` = 918; +UPDATE `npc_trainer_greeting` SET `trainer_type` = 0 WHERE `entry` = 925; +UPDATE `npc_trainer_greeting` SET `trainer_type` = 0 WHERE `entry` = 926; +UPDATE `npc_trainer_greeting` SET `trainer_type` = 0 WHERE `entry` = 927; +UPDATE `npc_trainer_greeting` SET `trainer_type` = 0 WHERE `entry` = 928; +UPDATE `npc_trainer_greeting` SET `trainer_type` = 0 WHERE `entry` = 944; +UPDATE `npc_trainer_greeting` SET `trainer_type` = 0 WHERE `entry` = 985; +UPDATE `npc_trainer_greeting` SET `trainer_type` = 0 WHERE `entry` = 986; +UPDATE `npc_trainer_greeting` SET `trainer_type` = 0 WHERE `entry` = 987; +UPDATE `npc_trainer_greeting` SET `trainer_type` = 0 WHERE `entry` = 988; +UPDATE `npc_trainer_greeting` SET `trainer_type` = 0 WHERE `entry` = 1226; +UPDATE `npc_trainer_greeting` SET `trainer_type` = 0 WHERE `entry` = 1228; +UPDATE `npc_trainer_greeting` SET `trainer_type` = 0 WHERE `entry` = 1229; +UPDATE `npc_trainer_greeting` SET `trainer_type` = 0 WHERE `entry` = 1231; +UPDATE `npc_trainer_greeting` SET `trainer_type` = 0 WHERE `entry` = 1232; +UPDATE `npc_trainer_greeting` SET `trainer_type` = 0 WHERE `entry` = 1234; +UPDATE `npc_trainer_greeting` SET `trainer_type` = 0 WHERE `entry` = 1404; +UPDATE `npc_trainer_greeting` SET `trainer_type` = 0 WHERE `entry` = 1411; +UPDATE `npc_trainer_greeting` SET `trainer_type` = 0 WHERE `entry` = 1901; +UPDATE `npc_trainer_greeting` SET `trainer_type` = 0 WHERE `entry` = 2119; +UPDATE `npc_trainer_greeting` SET `trainer_type` = 0 WHERE `entry` = 2122; +UPDATE `npc_trainer_greeting` SET `trainer_type` = 0 WHERE `entry` = 2123; +UPDATE `npc_trainer_greeting` SET `trainer_type` = 0 WHERE `entry` = 2124; +UPDATE `npc_trainer_greeting` SET `trainer_type` = 0 WHERE `entry` = 2126; +UPDATE `npc_trainer_greeting` SET `trainer_type` = 0 WHERE `entry` = 2127; +UPDATE `npc_trainer_greeting` SET `trainer_type` = 0 WHERE `entry` = 2128; +UPDATE `npc_trainer_greeting` SET `trainer_type` = 0 WHERE `entry` = 2129; +UPDATE `npc_trainer_greeting` SET `trainer_type` = 0 WHERE `entry` = 2130; +UPDATE `npc_trainer_greeting` SET `trainer_type` = 0 WHERE `entry` = 2131; +UPDATE `npc_trainer_greeting` SET `trainer_type` = 0 WHERE `entry` = 2485; +UPDATE `npc_trainer_greeting` SET `trainer_type` = 0 WHERE `entry` = 2489; +UPDATE `npc_trainer_greeting` SET `trainer_type` = 0 WHERE `entry` = 2492; +UPDATE `npc_trainer_greeting` SET `trainer_type` = 0 WHERE `entry` = 2704; +UPDATE `npc_trainer_greeting` SET `trainer_type` = 0 WHERE `entry` = 2818; +UPDATE `npc_trainer_greeting` SET `trainer_type` = 0 WHERE `entry` = 2878; +UPDATE `npc_trainer_greeting` SET `trainer_type` = 0 WHERE `entry` = 2879; +UPDATE `npc_trainer_greeting` SET `trainer_type` = 0 WHERE `entry` = 3030; +UPDATE `npc_trainer_greeting` SET `trainer_type` = 0 WHERE `entry` = 3031; +UPDATE `npc_trainer_greeting` SET `trainer_type` = 0 WHERE `entry` = 3032; +UPDATE `npc_trainer_greeting` SET `trainer_type` = 0 WHERE `entry` = 3033; +UPDATE `npc_trainer_greeting` SET `trainer_type` = 0 WHERE `entry` = 3034; +UPDATE `npc_trainer_greeting` SET `trainer_type` = 0 WHERE `entry` = 3036; +UPDATE `npc_trainer_greeting` SET `trainer_type` = 0 WHERE `entry` = 3038; +UPDATE `npc_trainer_greeting` SET `trainer_type` = 0 WHERE `entry` = 3039; +UPDATE `npc_trainer_greeting` SET `trainer_type` = 0 WHERE `entry` = 3040; +UPDATE `npc_trainer_greeting` SET `trainer_type` = 0 WHERE `entry` = 3041; +UPDATE `npc_trainer_greeting` SET `trainer_type` = 0 WHERE `entry` = 3042; +UPDATE `npc_trainer_greeting` SET `trainer_type` = 0 WHERE `entry` = 3043; +UPDATE `npc_trainer_greeting` SET `trainer_type` = 0 WHERE `entry` = 3044; +UPDATE `npc_trainer_greeting` SET `trainer_type` = 0 WHERE `entry` = 3045; +UPDATE `npc_trainer_greeting` SET `trainer_type` = 0 WHERE `entry` = 046; +UPDATE `npc_trainer_greeting` SET `trainer_type` = 0 WHERE `entry` = 3047; +UPDATE `npc_trainer_greeting` SET `trainer_type` = 0 WHERE `entry` = 3048; +UPDATE `npc_trainer_greeting` SET `trainer_type` = 0 WHERE `entry` = 3049; +UPDATE `npc_trainer_greeting` SET `trainer_type` = 0 WHERE `entry` = 3059; +UPDATE `npc_trainer_greeting` SET `trainer_type` = 0 WHERE `entry` = 3060; +UPDATE `npc_trainer_greeting` SET `trainer_type` = 0 WHERE `entry` = 3061; +UPDATE `npc_trainer_greeting` SET `trainer_type` = 0 WHERE `entry` = 3062; +UPDATE `npc_trainer_greeting` SET `trainer_type` = 0 WHERE `entry` = 3063; +UPDATE `npc_trainer_greeting` SET `trainer_type` = 0 WHERE `entry` = 3064; +UPDATE `npc_trainer_greeting` SET `trainer_type` = 0 WHERE `entry` = 3065; +UPDATE `npc_trainer_greeting` SET `trainer_type` = 0 WHERE `entry` = 3066; +UPDATE `npc_trainer_greeting` SET `trainer_type` = 0 WHERE `entry` = 3153; +UPDATE `npc_trainer_greeting` SET `trainer_type` = 0 WHERE `entry` = 3154; +UPDATE `npc_trainer_greeting` SET `trainer_type` = 0 WHERE `entry` = 3155; +UPDATE `npc_trainer_greeting` SET `trainer_type` = 0 WHERE `entry` = 3156; +UPDATE `npc_trainer_greeting` SET `trainer_type` = 0 WHERE `entry` = 3157; +UPDATE `npc_trainer_greeting` SET `trainer_type` = 0 WHERE `entry` = 3169; +UPDATE `npc_trainer_greeting` SET `trainer_type` = 0 WHERE `entry` = 3170; +UPDATE `npc_trainer_greeting` SET `trainer_type` = 0 WHERE `entry` = 3171; +UPDATE `npc_trainer_greeting` SET `trainer_type` = 0 WHERE `entry` = 3172; +UPDATE `npc_trainer_greeting` SET `trainer_type` = 0 WHERE `entry` = 3173; +UPDATE `npc_trainer_greeting` SET `trainer_type` = 0 WHERE `entry` = 3306; +UPDATE `npc_trainer_greeting` SET `trainer_type` = 0 WHERE `entry` = 3324; +UPDATE `npc_trainer_greeting` SET `trainer_type` = 0 WHERE `entry` = 3325; +UPDATE `npc_trainer_greeting` SET `trainer_type` = 0 WHERE `entry` = 3326; +UPDATE `npc_trainer_greeting` SET `trainer_type` = 0 WHERE `entry` = 3327; +UPDATE `npc_trainer_greeting` SET `trainer_type` = 0 WHERE `entry` = 3328; +UPDATE `npc_trainer_greeting` SET `trainer_type` = 0 WHERE `entry` = 3344; +UPDATE `npc_trainer_greeting` SET `trainer_type` = 0 WHERE `entry` = 3352; +UPDATE `npc_trainer_greeting` SET `trainer_type` = 0 WHERE `entry` = 3353; +UPDATE `npc_trainer_greeting` SET `trainer_type` = 0 WHERE `entry` = 3354; +UPDATE `npc_trainer_greeting` SET `trainer_type` = 0 WHERE `entry` = 3401; +UPDATE `npc_trainer_greeting` SET `trainer_type` = 0 WHERE `entry` = 3403; +UPDATE `npc_trainer_greeting` SET `trainer_type` = 0 WHERE `entry` = 3406; +UPDATE `npc_trainer_greeting` SET `trainer_type` = 0 WHERE `entry` = 3407; +UPDATE `npc_trainer_greeting` SET `trainer_type` = 0 WHERE `entry` = 3408; +UPDATE `npc_trainer_greeting` SET `trainer_type` = 0 WHERE `entry` = 3545; +UPDATE `npc_trainer_greeting` SET `trainer_type` = 0 WHERE `entry` = 3593; +UPDATE `npc_trainer_greeting` SET `trainer_type` = 0 WHERE `entry` = 3594; +UPDATE `npc_trainer_greeting` SET `trainer_type` = 0 WHERE `entry` = 3595; +UPDATE `npc_trainer_greeting` SET `trainer_type` = 0 WHERE `entry` = 3596; +UPDATE `npc_trainer_greeting` SET `trainer_type` = 0 WHERE `entry` = 3597; +UPDATE `npc_trainer_greeting` SET `trainer_type` = 0 WHERE `entry` = 3598; +UPDATE `npc_trainer_greeting` SET `trainer_type` = 0 WHERE `entry` = 3599; +UPDATE `npc_trainer_greeting` SET `trainer_type` = 0 WHERE `entry` = 3600; +UPDATE `npc_trainer_greeting` SET `trainer_type` = 0 WHERE `entry` = 3601; +UPDATE `npc_trainer_greeting` SET `trainer_type` = 0 WHERE `entry` = 3602; +UPDATE `npc_trainer_greeting` SET `trainer_type` = 0 WHERE `entry` = 3620; +UPDATE `npc_trainer_greeting` SET `trainer_type` = 0 WHERE `entry` = 3622; +UPDATE `npc_trainer_greeting` SET `trainer_type` = 0 WHERE `entry` = 3624; +UPDATE `npc_trainer_greeting` SET `trainer_type` = 0 WHERE `entry` = 3688; +UPDATE `npc_trainer_greeting` SET `trainer_type` = 0 WHERE `entry` = 3690; +UPDATE `npc_trainer_greeting` SET `trainer_type` = 0 WHERE `entry` = 3698; +UPDATE `npc_trainer_greeting` SET `trainer_type` = 0 WHERE `entry` = 3706; +UPDATE `npc_trainer_greeting` SET `trainer_type` = 0 WHERE `entry` = 3707; +UPDATE `npc_trainer_greeting` SET `trainer_type` = 0 WHERE `entry` = 3963; +UPDATE `npc_trainer_greeting` SET `trainer_type` = 0 WHERE `entry` = 4087; +UPDATE `npc_trainer_greeting` SET `trainer_type` = 0 WHERE `entry` = 4089; +UPDATE `npc_trainer_greeting` SET `trainer_type` = 0 WHERE `entry` = 4090; +UPDATE `npc_trainer_greeting` SET `trainer_type` = 0 WHERE `entry` = 4091; +UPDATE `npc_trainer_greeting` SET `trainer_type` = 0 WHERE `entry` = 4092; +UPDATE `npc_trainer_greeting` SET `trainer_type` = 0 WHERE `entry` = 4138; +UPDATE `npc_trainer_greeting` SET `trainer_type` = 0 WHERE `entry` = 4146; +UPDATE `npc_trainer_greeting` SET `trainer_type` = 0 WHERE `entry` = 4163; +UPDATE `npc_trainer_greeting` SET `trainer_type` = 0 WHERE `entry` = 4165; +UPDATE `npc_trainer_greeting` SET `trainer_type` = 0 WHERE `entry` = 4205; +UPDATE `npc_trainer_greeting` SET `trainer_type` = 0 WHERE `entry` = 4214; +UPDATE `npc_trainer_greeting` SET `trainer_type` = 0 WHERE `entry` = 4215; +UPDATE `npc_trainer_greeting` SET `trainer_type` = 0 WHERE `entry` = 4217; +UPDATE `npc_trainer_greeting` SET `trainer_type` = 0 WHERE `entry` = 4218; +UPDATE `npc_trainer_greeting` SET `trainer_type` = 0 WHERE `entry` = 4219; +UPDATE `npc_trainer_greeting` SET `trainer_type` = 0 WHERE `entry` = 4320; +UPDATE `npc_trainer_greeting` SET `trainer_type` = 0 WHERE `entry` = 4563; +UPDATE `npc_trainer_greeting` SET `trainer_type` = 0 WHERE `entry` = 4564; +UPDATE `npc_trainer_greeting` SET `trainer_type` = 0 WHERE `entry` = 4565; +UPDATE `npc_trainer_greeting` SET `trainer_type` = 0 WHERE `entry` = 4566; +UPDATE `npc_trainer_greeting` SET `trainer_type` = 0 WHERE `entry` = 4567; +UPDATE `npc_trainer_greeting` SET `trainer_type` = 0 WHERE `entry` = 4568; +UPDATE `npc_trainer_greeting` SET `trainer_type` = 0 WHERE `entry` = 4582; +UPDATE `npc_trainer_greeting` SET `trainer_type` = 0 WHERE `entry` = 4583; +UPDATE `npc_trainer_greeting` SET `trainer_type` = 0 WHERE `entry` = 4584; +UPDATE `npc_trainer_greeting` SET `trainer_type` = 0 WHERE `entry` = 4593; +UPDATE `npc_trainer_greeting` SET `trainer_type` = 0 WHERE `entry` = 4594; +UPDATE `npc_trainer_greeting` SET `trainer_type` = 0 WHERE `entry` = 4595; +UPDATE `npc_trainer_greeting` SET `trainer_type` = 0 WHERE `entry` = 4606; +UPDATE `npc_trainer_greeting` SET `trainer_type` = 0 WHERE `entry` = 4607; +UPDATE `npc_trainer_greeting` SET `trainer_type` = 0 WHERE `entry` = 4608; +UPDATE `npc_trainer_greeting` SET `trainer_type` = 0 WHERE `entry` = 4732; +UPDATE `npc_trainer_greeting` SET `trainer_type` = 0 WHERE `entry` = 4752; +UPDATE `npc_trainer_greeting` SET `trainer_type` = 0 WHERE `entry` = 4753; +UPDATE `npc_trainer_greeting` SET `trainer_type` = 0 WHERE `entry` = 4772; +UPDATE `npc_trainer_greeting` SET `trainer_type` = 0 WHERE `entry` = 4773; +UPDATE `npc_trainer_greeting` SET `trainer_type` = 0 WHERE `entry` = 5113; +UPDATE `npc_trainer_greeting` SET `trainer_type` = 0 WHERE `entry` = 5114; +UPDATE `npc_trainer_greeting` SET `trainer_type` = 0 WHERE `entry` = 5115; +UPDATE `npc_trainer_greeting` SET `trainer_type` = 0 WHERE `entry` = 5116; +UPDATE `npc_trainer_greeting` SET `trainer_type` = 0 WHERE `entry` = 5117; +UPDATE `npc_trainer_greeting` SET `trainer_type` = 0 WHERE `entry` = 5141; +UPDATE `npc_trainer_greeting` SET `trainer_type` = 0 WHERE `entry` = 5142; +UPDATE `npc_trainer_greeting` SET `trainer_type` = 0 WHERE `entry` = 5143; +UPDATE `npc_trainer_greeting` SET `trainer_type` = 0 WHERE `entry` = 5144; +UPDATE `npc_trainer_greeting` SET `trainer_type` = 0 WHERE `entry` = 5145; +UPDATE `npc_trainer_greeting` SET `trainer_type` = 0 WHERE `entry` = 5146; +UPDATE `npc_trainer_greeting` SET `trainer_type` = 0 WHERE `entry` = 5147; +UPDATE `npc_trainer_greeting` SET `trainer_type` = 0 WHERE `entry` = 5148; +UPDATE `npc_trainer_greeting` SET `trainer_type` = 0 WHERE `entry` = 5149; +UPDATE `npc_trainer_greeting` SET `trainer_type` = 0 WHERE `entry` = 5165; +UPDATE `npc_trainer_greeting` SET `trainer_type` = 0 WHERE `entry` = 5166; +UPDATE `npc_trainer_greeting` SET `trainer_type` = 0 WHERE `entry` = 5167; +UPDATE `npc_trainer_greeting` SET `trainer_type` = 0 WHERE `entry` = 5171; +UPDATE `npc_trainer_greeting` SET `trainer_type` = 0 WHERE `entry` = 5172; +UPDATE `npc_trainer_greeting` SET `trainer_type` = 0 WHERE `entry` = 5173; +UPDATE `npc_trainer_greeting` SET `trainer_type` = 0 WHERE `entry` = 5479; +UPDATE `npc_trainer_greeting` SET `trainer_type` = 0 WHERE `entry` = 5480; +UPDATE `npc_trainer_greeting` SET `trainer_type` = 0 WHERE `entry` = 5484; +UPDATE `npc_trainer_greeting` SET `trainer_type` = 0 WHERE `entry` = 5489; +UPDATE `npc_trainer_greeting` SET `trainer_type` = 0 WHERE `entry` = 5491; +UPDATE `npc_trainer_greeting` SET `trainer_type` = 0 WHERE `entry` = 5492; +UPDATE `npc_trainer_greeting` SET `trainer_type` = 0 WHERE `entry` = 5495; +UPDATE `npc_trainer_greeting` SET `trainer_type` = 0 WHERE `entry` = 5496; +UPDATE `npc_trainer_greeting` SET `trainer_type` = 0 WHERE `entry` = 5497; +UPDATE `npc_trainer_greeting` SET `trainer_type` = 0 WHERE `entry` = 5498; +UPDATE `npc_trainer_greeting` SET `trainer_type` = 0 WHERE `entry` = 5501; +UPDATE `npc_trainer_greeting` SET `trainer_type` = 0 WHERE `entry` = 5504; +UPDATE `npc_trainer_greeting` SET `trainer_type` = 0 WHERE `entry` = 5505; +UPDATE `npc_trainer_greeting` SET `trainer_type` = 0 WHERE `entry` = 5506; +UPDATE `npc_trainer_greeting` SET `trainer_type` = 0 WHERE `entry` = 5515; +UPDATE `npc_trainer_greeting` SET `trainer_type` = 0 WHERE `entry` = 5516; +UPDATE `npc_trainer_greeting` SET `trainer_type` = 0 WHERE `entry` = 5517; +UPDATE `npc_trainer_greeting` SET `trainer_type` = 0 WHERE `entry` = 5612; +UPDATE `npc_trainer_greeting` SET `trainer_type` = 0 WHERE `entry` = 5880; +UPDATE `npc_trainer_greeting` SET `trainer_type` = 0 WHERE `entry` = 5882; +UPDATE `npc_trainer_greeting` SET `trainer_type` = 0 WHERE `entry` = 5883; +UPDATE `npc_trainer_greeting` SET `trainer_type` = 0 WHERE `entry` = 5884; +UPDATE `npc_trainer_greeting` SET `trainer_type` = 0 WHERE `entry` = 5885; +UPDATE `npc_trainer_greeting` SET `trainer_type` = 0 WHERE `entry` = 5957; +UPDATE `npc_trainer_greeting` SET `trainer_type` = 0 WHERE `entry` = 5958; +UPDATE `npc_trainer_greeting` SET `trainer_type` = 0 WHERE `entry` = 5994; +UPDATE `npc_trainer_greeting` SET `trainer_type` = 0 WHERE `entry` = 6014; +UPDATE `npc_trainer_greeting` SET `trainer_type` = 0 WHERE `entry` = 6018; +UPDATE `npc_trainer_greeting` SET `trainer_type` = 0 WHERE `entry` = 6707; +UPDATE `npc_trainer_greeting` SET `trainer_type` = 0 WHERE `entry` = 7311; +UPDATE `npc_trainer_greeting` SET `trainer_type` = 0 WHERE `entry` = 7312; +UPDATE `npc_trainer_greeting` SET `trainer_type` = 0 WHERE `entry` = 7315; +UPDATE `npc_trainer_greeting` SET `trainer_type` = 0 WHERE `entry` = 7953; +UPDATE `npc_trainer_greeting` SET `trainer_type` = 0 WHERE `entry` = 7954; +UPDATE `npc_trainer_greeting` SET `trainer_type` = 0 WHERE `entry` = 8140; +UPDATE `npc_trainer_greeting` SET `trainer_type` = 0 WHERE `entry` = 8141; +UPDATE `npc_trainer_greeting` SET `trainer_type` = 0 WHERE `entry` = 8142; +UPDATE `npc_trainer_greeting` SET `trainer_type` = 0 WHERE `entry` = 8308; +UPDATE `npc_trainer_greeting` SET `trainer_type` = 0 WHERE `entry` = 9465; +UPDATE `npc_trainer_greeting` SET `trainer_type` = 0 WHERE `entry` = 10086; +UPDATE `npc_trainer_greeting` SET `trainer_type` = 0 WHERE `entry` = 10088; +UPDATE `npc_trainer_greeting` SET `trainer_type` = 0 WHERE `entry` = 10089; +UPDATE `npc_trainer_greeting` SET `trainer_type` = 0 WHERE `entry` = 10090; +UPDATE `npc_trainer_greeting` SET `trainer_type` = 0 WHERE `entry` = 10930; +UPDATE `npc_trainer_greeting` SET `trainer_type` = 0 WHERE `entry` = 11397; +UPDATE `npc_trainer_greeting` SET `trainer_type` = 0 WHERE `entry` = 11401; +UPDATE `npc_trainer_greeting` SET `trainer_type` = 0 WHERE `entry` = 11406; +UPDATE `npc_trainer_greeting` SET `trainer_type` = 0 WHERE `entry` = 11865; +UPDATE `npc_trainer_greeting` SET `trainer_type` = 0 WHERE `entry` = 11866; +UPDATE `npc_trainer_greeting` SET `trainer_type` = 0 WHERE `entry` = 11867; +UPDATE `npc_trainer_greeting` SET `trainer_type` = 0 WHERE `entry` = 11868; +UPDATE `npc_trainer_greeting` SET `trainer_type` = 0 WHERE `entry` = 11869; +UPDATE `npc_trainer_greeting` SET `trainer_type` = 0 WHERE `entry` = 11870; +UPDATE `npc_trainer_greeting` SET `trainer_type` = 0 WHERE `entry` = 12042; +UPDATE `npc_trainer_greeting` SET `trainer_type` = 0 WHERE `entry` = 13084; +UPDATE `npc_trainer_greeting` SET `trainer_type` = 0 WHERE `entry` = 13283; +UPDATE `npc_trainer_greeting` SET `trainer_type` = 0 WHERE `entry` = 13417; + +-- LANG_NPC_TAINER_HELLO is no longer used +DELETE FROM `mangos_string` WHERE `entry` = 51; + +-- End of migration. +END IF; +END?? +delimiter ; +CALL add_migration(); +DROP PROCEDURE IF EXISTS add_migration; diff --git a/src/game/Commands/CharacterCommands.cpp b/src/game/Commands/CharacterCommands.cpp index eb0393d6e96..dde52ae6026 100644 --- a/src/game/Commands/CharacterCommands.cpp +++ b/src/game/Commands/CharacterCommands.cpp @@ -34,6 +34,7 @@ #include "PlayerDump.h" #include "CharacterDatabaseCache.h" #include "Config/Config.h" +#include "Conditions.h" #include #include @@ -2819,32 +2820,58 @@ bool ChatHandler::HandleLearnAllTrainerCommand(char* args) if (!(cInfo->npc_flags & UNIT_NPC_FLAG_TRAINER)) continue; - switch (cInfo->trainer_type) + uint32 gossipMenuId = cInfo->gossip_menu_id; + if (!gossipMenuId) + continue; + + GossipMenuItemsMapBounds bounds = sObjectMgr.GetGossipMenuItemsMapBounds(gossipMenuId); + bool validTrainer = false; + for (auto itr = bounds.first; itr != bounds.second; ++itr) { - case TRAINER_TYPE_CLASS: + GossipMenuItems const& gMenuItem = itr->second; + if (gMenuItem.menu_id && gMenuItem.option_id == GOSSIP_OPTION_TRAINER) { - if (cInfo->trainer_class != pPlayer->GetClass()) - continue; - break; + if (uint32 conditionId = gMenuItem.condition_id) + { + validTrainer = IsConditionSatisfied(conditionId, pPlayer, pPlayer->GetMap(), pPlayer, CONDITION_FROM_GOSSIP_OPTION); + break; + } + else + { + validTrainer = true; + break; + } } - case TRAINER_TYPE_PETS: + else { - if (pPlayer->GetClass() != CLASS_HUNTER) - continue; + validTrainer = true; break; } } - if (TrainerSpellData const* cSpells = sObjectMgr.GetNpcTrainerSpells(itr.first)) + if (!validTrainer) + continue; + + TrainerSpellData const* cSpells = sObjectMgr.GetNpcTrainerSpells(itr.first); + TrainerSpellData const* tSpells = sObjectMgr.GetNpcTrainerTemplateSpells(trainerId); + TrainerSpellData const* trainerSpellList = cSpells ? cSpells : (tSpells ? tSpells : nullptr); + + if (!trainerSpellList) + continue; + + if (trainerSpellList->spellList.empty()) + continue; + + if (cSpells) HandleLearnTrainerHelper(pPlayer, cSpells); - if (trainerId = cInfo->trainer_id) // assignment + if (trainerId = cInfo->trainer_id) { if (checkedTrainerTemplates.find(trainerId) != checkedTrainerTemplates.end()) continue; checkedTrainerTemplates.insert(trainerId); - if (TrainerSpellData const* tSpells = sObjectMgr.GetNpcTrainerTemplateSpells(trainerId)) + if (tSpells) HandleLearnTrainerHelper(pPlayer, tSpells); } } diff --git a/src/game/Handlers/NPCHandler.cpp b/src/game/Handlers/NPCHandler.cpp index b725d960afc..33339ede540 100644 --- a/src/game/Handlers/NPCHandler.cpp +++ b/src/game/Handlers/NPCHandler.cpp @@ -148,7 +148,7 @@ void WorldSession::SendTrainerList(ObjectGuid guid) } // trainer list loaded at check; - if (!unit->IsTrainerOf(_player, true)) + if (!unit->IsTrainerOf(_player)) return; CreatureInfo const* ci = unit->GetCreatureInfo(); @@ -168,13 +168,14 @@ void WorldSession::SendTrainerList(ObjectGuid guid) GetPlayer()->RemoveAurasWithInterruptFlags(AURA_INTERRUPT_INTERACTING_CANCELS); uint32 maxcount = (cSpells ? cSpells->spellList.size() : 0) + (tSpells ? tSpells->spellList.size() : 0); - uint32 trainer_type = cSpells && cSpells->trainerType ? cSpells->trainerType : (tSpells ? tSpells->trainerType : 0); + uint32 trainerType; std::string strTitle; - if (TrainerGreetingLocale const* trainerGreeting = sObjectMgr.GetTrainerGreetingLocale(guid.GetEntry())) + if (TrainerGreeting const* trainerGreeting = sObjectMgr.GetTrainerGreeting(guid.GetEntry())) { - int locale_idx = GetSessionDbLocaleIndex(); + trainerType = trainerGreeting->trainerType; + int locale_idx = GetSessionDbLocaleIndex(); if ((int32)trainerGreeting->Content.size() > locale_idx + 1 && !trainerGreeting->Content[locale_idx + 1].empty()) strTitle = trainerGreeting->Content[locale_idx + 1]; else @@ -182,12 +183,13 @@ void WorldSession::SendTrainerList(ObjectGuid guid) } else { - strTitle = GetMangosString(LANG_NPC_TAINER_HELLO); + sLog.Out(LOG_BASIC, LOG_LVL_DEBUG, "WORLD: SendTrainerList - Trainer greeting not found for %s", guid.GetString().c_str()); + return; } WorldPacket data(SMSG_TRAINER_LIST, 8 + 4 + 4 + maxcount * 38 + strTitle.size() + 1); data << ObjectGuid(guid); - data << uint32(trainer_type); + data << uint32(trainerType); size_t count_pos = data.wpos(); data << uint32(maxcount); @@ -265,7 +267,7 @@ void WorldSession::HandleTrainerBuySpellOpcode(WorldPackets::Npc::TrainerBuySpel Creature* unit = GetPlayer()->GetNPCIfCanInteractWith(packet.guid, UNIT_NPC_FLAG_TRAINER); - if (!unit || !unit->IsTrainerOf(_player, true) || !unit->IsWithinLOSInMap(_player)) + if (!unit || !unit->IsTrainerOf(_player) || !unit->IsWithinLOSInMap(_player)) { SendTrainingFailure(packet.guid, packet.spellId, TRAIN_FAIL_UNAVAILABLE); sLog.Out(LOG_BASIC, LOG_LVL_DEBUG, "WORLD: HandleTrainerBuySpellOpcode - %s not found or you can't interact with him.", packet.guid.GetString().c_str()); diff --git a/src/game/Language.h b/src/game/Language.h index 28cf1b9e3d4..07242fb4647 100644 --- a/src/game/Language.h +++ b/src/game/Language.h @@ -77,7 +77,7 @@ enum MangosStrings LANG_FRIEND_IGNORE_UNKNOWN = 48, LANG_LEVEL_MINREQUIRED = 49, LANG_COMMAND_UNAVAILABLE = 50, - LANG_NPC_TAINER_HELLO = 51, + // = 51, not used LANG_COMMAND_INVALID_ITEM_COUNT = 52, LANG_COMMAND_MAIL_ITEMS_LIMIT = 53, LANG_NEW_PASSWORDS_NOT_MATCH = 54, diff --git a/src/game/ObjectMgr.cpp b/src/game/ObjectMgr.cpp index 538901ab54f..794302de0b8 100644 --- a/src/game/ObjectMgr.cpp +++ b/src/game/ObjectMgr.cpp @@ -1189,8 +1189,8 @@ struct SQLCreatureLoader : public SQLStorageLoaderBase result(WorldDatabase.PQuery("SELECT `entry`, `name`, `subname`, `level_min`, `level_max`, `faction`, `npc_flags`, `gossip_menu_id`, `display_id1`, `display_id2`, `display_id3`, `display_id4`, `display_scale1`, `display_scale2`, `display_scale3`, `display_scale4`, `display_probability1`, `display_probability2`, `display_probability3`, `display_probability4`, `display_total_probability`, `mount_display_id`, `speed_walk`, `speed_run`, `detection_range`, `call_for_help_range`, `leash_range`, `type`, `pet_family`, `rank`, `unit_class`, `xp_multiplier`, `health_multiplier`, `mana_multiplier`, `armor_multiplier`, `damage_multiplier`, `damage_variance`, `damage_school`, `base_attack_time`, `ranged_attack_time`, `holy_res`, `fire_res`, `nature_res`, `frost_res`, `shadow_res`, `arcane_res`, `trainer_type`, `trainer_spell`, `trainer_class`, `trainer_race`, `loot_id`, `pickpocket_loot_id`, `skinning_loot_id`, `gold_min`, `gold_max`, `spell_list_id`, `pet_spell_list_id`, `spawn_spell_id`, `totem_spell_id`, `auras`, `ai_name`, `movement_type`, `inhabit_type`, `civilian`, `racial_leader`, `equipment_id`, `trainer_id`, `vendor_id`, `mechanic_immune_mask`, `school_immune_mask`, `immunity_flags`, `static_flags1`, `static_flags2`, `flags_extra`, `script_name` FROM `creature_template` t1 WHERE `patch`=(SELECT max(`patch`) FROM `creature_template` t2 WHERE t1.`entry`=t2.`entry` && `patch` <= %u)", sWorld.GetWowPatch())); + // 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 + std::unique_ptr result(WorldDatabase.PQuery("SELECT `entry`, `name`, `subname`, `level_min`, `level_max`, `faction`, `npc_flags`, `gossip_menu_id`, `display_id1`, `display_id2`, `display_id3`, `display_id4`, `display_scale1`, `display_scale2`, `display_scale3`, `display_scale4`, `display_probability1`, `display_probability2`, `display_probability3`, `display_probability4`, `display_total_probability`, `mount_display_id`, `speed_walk`, `speed_run`, `detection_range`, `call_for_help_range`, `leash_range`, `type`, `pet_family`, `rank`, `unit_class`, `xp_multiplier`, `health_multiplier`, `mana_multiplier`, `armor_multiplier`, `damage_multiplier`, `damage_variance`, `damage_school`, `base_attack_time`, `ranged_attack_time`, `holy_res`, `fire_res`, `nature_res`, `frost_res`, `shadow_res`, `arcane_res`, `loot_id`, `pickpocket_loot_id`, `skinning_loot_id`, `gold_min`, `gold_max`, `spell_list_id`, `pet_spell_list_id`, `spawn_spell_id`, `totem_spell_id`, `auras`, `ai_name`, `movement_type`, `inhabit_type`, `civilian`, `racial_leader`, `equipment_id`, `trainer_id`, `vendor_id`, `mechanic_immune_mask`, `school_immune_mask`, `immunity_flags`, `static_flags1`, `static_flags2`, `flags_extra`, `script_name` FROM `creature_template` t1 WHERE `patch`=(SELECT max(`patch`) FROM `creature_template` t2 WHERE t1.`entry`=t2.`entry` && `patch` <= %u)", sWorld.GetWowPatch())); if (!result) return; @@ -1208,8 +1208,8 @@ void ObjectMgr::LoadCreatureTemplates() void ObjectMgr::LoadCreatureTemplate(uint32 entry) { - // 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 - std::unique_ptr result(WorldDatabase.PQuery("SELECT `entry`, `name`, `subname`, `level_min`, `level_max`, `faction`, `npc_flags`, `gossip_menu_id`, `display_id1`, `display_id2`, `display_id3`, `display_id4`, `display_scale1`, `display_scale2`, `display_scale3`, `display_scale4`, `display_probability1`, `display_probability2`, `display_probability3`, `display_probability4`, `display_total_probability`, `mount_display_id`, `speed_walk`, `speed_run`, `detection_range`, `call_for_help_range`, `leash_range`, `type`, `pet_family`, `rank`, `unit_class`, `xp_multiplier`, `health_multiplier`, `mana_multiplier`, `armor_multiplier`, `damage_multiplier`, `damage_variance`, `damage_school`, `base_attack_time`, `ranged_attack_time`, `holy_res`, `fire_res`, `nature_res`, `frost_res`, `shadow_res`, `arcane_res`, `trainer_type`, `trainer_spell`, `trainer_class`, `trainer_race`, `loot_id`, `pickpocket_loot_id`, `skinning_loot_id`, `gold_min`, `gold_max`, `spell_list_id`, `pet_spell_list_id`, `spawn_spell_id`, `totem_spell_id`, `auras`, `ai_name`, `movement_type`, `inhabit_type`, `civilian`, `racial_leader`, `equipment_id`, `trainer_id`, `vendor_id`, `mechanic_immune_mask`, `school_immune_mask`, `immunity_flags`, `static_flags1`, `static_flags2`, `flags_extra`, `script_name` FROM `creature_template` t1 WHERE `entry`=%u && `patch`=(SELECT max(`patch`) FROM `creature_template` t2 WHERE t1.`entry`=t2.`entry` && `patch` <= %u)", entry, sWorld.GetWowPatch())); + // 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 + std::unique_ptr result(WorldDatabase.PQuery("SELECT `entry`, `name`, `subname`, `level_min`, `level_max`, `faction`, `npc_flags`, `gossip_menu_id`, `display_id1`, `display_id2`, `display_id3`, `display_id4`, `display_scale1`, `display_scale2`, `display_scale3`, `display_scale4`, `display_probability1`, `display_probability2`, `display_probability3`, `display_probability4`, `display_total_probability`, `mount_display_id`, `speed_walk`, `speed_run`, `detection_range`, `call_for_help_range`, `leash_range`, `type`, `pet_family`, `rank`, `unit_class`, `xp_multiplier`, `health_multiplier`, `mana_multiplier`, `armor_multiplier`, `damage_multiplier`, `damage_variance`, `damage_school`, `base_attack_time`, `ranged_attack_time`, `holy_res`, `fire_res`, `nature_res`, `frost_res`, `shadow_res`, `arcane_res`, `loot_id`, `pickpocket_loot_id`, `skinning_loot_id`, `gold_min`, `gold_max`, `spell_list_id`, `pet_spell_list_id`, `spawn_spell_id`, `totem_spell_id`, `auras`, `ai_name`, `movement_type`, `inhabit_type`, `civilian`, `racial_leader`, `equipment_id`, `trainer_id`, `vendor_id`, `mechanic_immune_mask`, `school_immune_mask`, `immunity_flags`, `static_flags1`, `static_flags2`, `flags_extra`, `script_name` FROM `creature_template` t1 WHERE `entry`=%u && `patch`=(SELECT max(`patch`) FROM `creature_template` t2 WHERE t1.`entry`=t2.`entry` && `patch` <= %u)", entry, sWorld.GetWowPatch())); if (!result) return; @@ -1278,36 +1278,32 @@ void ObjectMgr::LoadCreatureInfo(Field* fields) pInfo->frost_res = fields[43].GetInt32(); pInfo->shadow_res = fields[44].GetInt32(); pInfo->arcane_res = fields[45].GetInt32(); - pInfo->trainer_type = fields[46].GetUInt32(); - pInfo->trainer_spell = fields[47].GetUInt32(); - pInfo->trainer_class = fields[48].GetUInt32(); - pInfo->trainer_race = fields[49].GetUInt32(); - pInfo->loot_id = fields[50].GetUInt32(); - pInfo->pickpocket_loot_id = fields[51].GetUInt32(); - pInfo->skinning_loot_id = fields[52].GetUInt32(); - pInfo->gold_min = fields[53].GetUInt32(); - pInfo->gold_max = fields[54].GetUInt32(); - pInfo->spell_list_id = fields[55].GetUInt32(); - pInfo->pet_spell_list_id = fields[56].GetUInt32(); - pInfo->spawn_spell_id = fields[57].GetUInt32(); - pInfo->totem_spell_id = fields[58].GetUInt32(); + pInfo->loot_id = fields[46].GetUInt32(); + pInfo->pickpocket_loot_id = fields[47].GetUInt32(); + pInfo->skinning_loot_id = fields[48].GetUInt32(); + pInfo->gold_min = fields[49].GetUInt32(); + pInfo->gold_max = fields[50].GetUInt32(); + pInfo->spell_list_id = fields[51].GetUInt32(); + pInfo->pet_spell_list_id = fields[52].GetUInt32(); + pInfo->spawn_spell_id = fields[53].GetUInt32(); + pInfo->totem_spell_id = fields[54].GetUInt32(); delete[] pInfo->auras; - pInfo->auras = (uint32*)(fields[59].GetString() ? mangos_strdup(fields[59].GetString()) : nullptr); - pInfo->ai_name = fields[60].GetCppString(); - pInfo->movement_type = fields[61].GetUInt32(); - pInfo->inhabit_type = fields[62].GetUInt32(); - pInfo->civilian = fields[63].GetBool(); - pInfo->racial_leader = fields[64].GetBool(); - pInfo->equipment_id = fields[65].GetUInt32(); - pInfo->trainer_id = fields[66].GetUInt32(); - pInfo->vendor_id = fields[67].GetUInt32(); - pInfo->mechanic_immune_mask = fields[68].GetUInt32(); - pInfo->school_immune_mask = fields[69].GetUInt32(); - pInfo->immunity_flags = fields[70].GetUInt32(); - pInfo->static_flags1 = fields[71].GetUInt32(); - pInfo->static_flags2 = fields[72].GetUInt32(); - pInfo->flags_extra = fields[73].GetUInt32(); - pInfo->script_id = sScriptMgr.GetScriptId(fields[74].GetString()); + pInfo->auras = (uint32*)(fields[55].GetString() ? mangos_strdup(fields[55].GetString()) : nullptr); + pInfo->ai_name = fields[56].GetCppString(); + pInfo->movement_type = fields[57].GetUInt32(); + pInfo->inhabit_type = fields[58].GetUInt32(); + pInfo->civilian = fields[59].GetBool(); + pInfo->racial_leader = fields[60].GetBool(); + pInfo->equipment_id = fields[61].GetUInt32(); + pInfo->trainer_id = fields[62].GetUInt32(); + pInfo->vendor_id = fields[63].GetUInt32(); + pInfo->mechanic_immune_mask = fields[64].GetUInt32(); + pInfo->school_immune_mask = fields[65].GetUInt32(); + pInfo->immunity_flags = fields[66].GetUInt32(); + pInfo->static_flags1 = fields[67].GetUInt32(); + pInfo->static_flags2 = fields[68].GetUInt32(); + pInfo->flags_extra = fields[69].GetUInt32(); + pInfo->script_id = sScriptMgr.GetScriptId(fields[70].GetString()); CheckCreatureTemplate(pInfo.get()); } @@ -1523,9 +1519,6 @@ void ObjectMgr::CheckCreatureTemplate(CreatureInfo* cInfo) cInfo->ranged_attack_time = BASE_ATTACK_TIME; } - if ((cInfo->npc_flags & UNIT_NPC_FLAG_TRAINER) && cInfo->trainer_type >= MAX_TRAINER_TYPE) - sLog.Out(LOG_DBERROR, LOG_LVL_MINIMAL, "Creature (Entry: %u) has wrong trainer type %u", cInfo->entry, cInfo->trainer_type); - if (cInfo->type && !sCreatureTypeStore.LookupEntry(cInfo->type)) { sLog.Out(LOG_DBERROR, LOG_LVL_MINIMAL, "Creature (Entry: %u) has invalid creature type (%u) in `type`", cInfo->entry, cInfo->type); @@ -10341,9 +10334,9 @@ bool ObjectMgr::LoadQuestGreetings() bool ObjectMgr::LoadTrainerGreetings() { - m_TrainerGreetingLocaleMap.clear(); + m_TrainerGreetingMap.clear(); - std::unique_ptr result(WorldDatabase.Query("SELECT `entry`, `content_default`, `content_loc1`, `content_loc2`, `content_loc3`, `content_loc4`, `content_loc5`, `content_loc6`, `content_loc7`, `content_loc8` FROM `npc_trainer_greeting`")); + std::unique_ptr result(WorldDatabase.Query("SELECT `entry`, `trainerType`, `content_default`, `content_loc1`, `content_loc2`, `content_loc3`, `content_loc4`, `content_loc5`, `content_loc6`, `content_loc7`, `content_loc8` FROM `npc_trainer_greeting`")); if (!result) { @@ -10371,17 +10364,26 @@ bool ObjectMgr::LoadTrainerGreetings() continue; } - TrainerGreetingLocale& data = m_TrainerGreetingLocaleMap[entry]; + uint8 trainerType = fields[1].GetUInt8(); + + if (trainerType != GREETING_TYPE_SMALL && trainerType != GREETING_TYPE_LARGE) + { + sLog.Out(LOG_DBERROR, LOG_LVL_ERROR, "Table `npc_trainer_greeting` has entry with invalid trainerType %u (Entry: %u), ignored", trainerType, entry); + continue; + } + TrainerGreeting& data = m_TrainerGreetingMap[entry]; + + data.trainerType = trainerType; data.Content.resize(1); ++count; - // 0 -> default, idx in to idx+1 - data.Content[0] = fields[1].GetCppString(); + // 0 -> default, idx in to idx+2 + data.Content[0] = fields[2].GetCppString(); for (int i = 1; i < MAX_LOCALE; ++i) { - std::string str = fields[i + 1].GetCppString(); + std::string str = fields[i + 2].GetCppString(); if (!str.empty()) { int idx = GetOrNewIndexForLocale(LocaleConstant(i)); @@ -10730,10 +10732,7 @@ void ObjectMgr::LoadTrainers(char const* tableName, bool isTemplates) } else trainerSpell.reqLevel = spellinfo->spellLevel; - - if (SpellMgr::IsProfessionSpell(spellinfo->EffectTriggerSpell[0]) || SpellMgr::IsTradeskillSpell(spellinfo->EffectTriggerSpell[0])) - data.trainerType = 2; - + ++count; } diff --git a/src/game/ObjectMgr.h b/src/game/ObjectMgr.h index 48d0a760c6a..7ea251d4598 100644 --- a/src/game/ObjectMgr.h +++ b/src/game/ObjectMgr.h @@ -189,9 +189,18 @@ enum QUESTGIVER_TYPE_MAX = 2, }; -struct TrainerGreetingLocale +// trainer greeting type from sniffs (valid values are 0 and 2) +// required to correctly display training UI on SMSG_TRAINER_LIST +enum TrainerType { - TrainerGreetingLocale() { } + GREETING_TYPE_SMALL = 0, + GREETING_TYPE_LARGE = 2, +}; + +struct TrainerGreeting +{ + TrainerGreeting() : trainerType(GREETING_TYPE_LARGE) {} + uint8 trainerType; std::vector Content; // 0 -> default, i -> i-1 locale index }; @@ -263,7 +272,7 @@ typedef std::unordered_map QuestGreetingLocaleMap; typedef std::unordered_map GossipMenuItemsLocaleMap; typedef std::unordered_map PointOfInterestLocaleMap; typedef std::unordered_map AreaLocaleMap; -typedef std::unordered_map TrainerGreetingLocaleMap; +typedef std::unordered_map TrainerGreetingMap; typedef std::multimap ExclusiveQuestGroupsMap; typedef std::multimap ItemRequiredTargetMap; @@ -1184,10 +1193,10 @@ class ObjectMgr return &itr->second; } - TrainerGreetingLocale const* GetTrainerGreetingLocale(uint32 entry) const + TrainerGreeting const* GetTrainerGreeting(uint32 entry) const { - auto itr = m_TrainerGreetingLocaleMap.find(entry); - if (itr == m_TrainerGreetingLocaleMap.end()) return nullptr; + auto itr = m_TrainerGreetingMap.find(entry); + if (itr == m_TrainerGreetingMap.end()) return nullptr; return &itr->second; } @@ -1615,7 +1624,7 @@ class ObjectMgr MangosStringLocaleMap m_MangosStringLocaleMap; BroadcastTextLocaleMap m_BroadcastTextLocaleMap; QuestGreetingLocaleMap m_QuestGreetingLocaleMap[QUESTGIVER_TYPE_MAX]; - TrainerGreetingLocaleMap m_TrainerGreetingLocaleMap; + TrainerGreetingMap m_TrainerGreetingMap; GossipMenuItemsLocaleMap m_GossipMenuItemsLocaleMap; PointOfInterestLocaleMap m_PointOfInterestLocaleMap; AreaLocaleMap m_AreaLocaleMap; diff --git a/src/game/Objects/Creature.cpp b/src/game/Objects/Creature.cpp index 3ef4ec9c28b..5d8c0de157b 100644 --- a/src/game/Objects/Creature.cpp +++ b/src/game/Objects/Creature.cpp @@ -1356,7 +1356,7 @@ bool Creature::Create(uint32 guidlow, CreatureCreatePos& cPos, CreatureInfo cons return true; } -bool Creature::IsTrainerOf(Player* pPlayer, bool msg) const +bool Creature::IsTrainerOf(Player* pPlayer) const { if (!IsTrainer()) return false; @@ -1364,7 +1364,7 @@ bool Creature::IsTrainerOf(Player* pPlayer, bool msg) const TrainerSpellData const* cSpells = GetTrainerSpells(); TrainerSpellData const* tSpells = GetTrainerTemplateSpells(); - // for not pet trainer expected not empty trainer list always + // all trainers should have a non-empty trainer list if ((!cSpells || cSpells->spellList.empty()) && (!tSpells || tSpells->spellList.empty())) { sLog.Out(LOG_DBERROR, LOG_LVL_MINIMAL, "Creature %u (Entry: %u) have UNIT_NPC_FLAG_TRAINER but have empty trainer spell list.", @@ -1372,121 +1372,42 @@ bool Creature::IsTrainerOf(Player* pPlayer, bool msg) const return false; } - switch (GetCreatureInfo()->trainer_type) + uint32 gossipMenuId = GetCreatureInfo()->gossip_menu_id; + if (!gossipMenuId) { - case TRAINER_TYPE_CLASS: - if (pPlayer->GetClass() != GetCreatureInfo()->trainer_class) - { - if (msg) - { - pPlayer->PlayerTalkClass->ClearMenus(); - switch (GetCreatureInfo()->trainer_class) - { - case CLASS_DRUID: - pPlayer->PlayerTalkClass->SendGossipMenu(4913, GetObjectGuid()); - break; - case CLASS_HUNTER: - pPlayer->PlayerTalkClass->SendGossipMenu(10090, GetObjectGuid()); - break; - case CLASS_MAGE: - pPlayer->PlayerTalkClass->SendGossipMenu(328, GetObjectGuid()); - break; - case CLASS_PALADIN: - pPlayer->PlayerTalkClass->SendGossipMenu(1635, GetObjectGuid()); - break; - case CLASS_PRIEST: - pPlayer->PlayerTalkClass->SendGossipMenu(4436, GetObjectGuid()); - break; - case CLASS_ROGUE: - pPlayer->PlayerTalkClass->SendGossipMenu(4797, GetObjectGuid()); - break; - case CLASS_SHAMAN: - pPlayer->PlayerTalkClass->SendGossipMenu(5003, GetObjectGuid()); - break; - case CLASS_WARLOCK: - pPlayer->PlayerTalkClass->SendGossipMenu(5836, GetObjectGuid()); - break; - case CLASS_WARRIOR: - pPlayer->PlayerTalkClass->SendGossipMenu(4985, GetObjectGuid()); - break; - } - } - return false; - } - break; - case TRAINER_TYPE_PETS: - if (pPlayer->GetClass() != CLASS_HUNTER) - { - if (msg) - { - pPlayer->PlayerTalkClass->ClearMenus(); - pPlayer->PlayerTalkClass->SendGossipMenu(3620, GetObjectGuid()); - } - return false; - } - break; - case TRAINER_TYPE_MOUNTS: - if (GetCreatureInfo()->trainer_race && pPlayer->GetRace() != GetCreatureInfo()->trainer_race) - { - // Allowed to train if exalted - if (FactionTemplateEntry const* faction_template = GetFactionTemplateEntry()) - { - if (pPlayer->GetReputationRank(faction_template->faction) == REP_EXALTED) - return true; - } + // no requirement to access training menu + return true; + } - if (msg) - { - pPlayer->PlayerTalkClass->ClearMenus(); - switch (GetCreatureInfo()->trainer_class) - { - case RACE_DWARF: - pPlayer->PlayerTalkClass->SendGossipMenu(5865, GetObjectGuid()); - break; - case RACE_GNOME: - pPlayer->PlayerTalkClass->SendGossipMenu(4881, GetObjectGuid()); - break; - case RACE_HUMAN: - pPlayer->PlayerTalkClass->SendGossipMenu(5861, GetObjectGuid()); - break; - case RACE_NIGHTELF: - pPlayer->PlayerTalkClass->SendGossipMenu(5862, GetObjectGuid()); - break; - case RACE_ORC: - pPlayer->PlayerTalkClass->SendGossipMenu(5863, GetObjectGuid()); - break; - case RACE_TAUREN: - pPlayer->PlayerTalkClass->SendGossipMenu(5864, GetObjectGuid()); - break; - case RACE_TROLL: - pPlayer->PlayerTalkClass->SendGossipMenu(5816, GetObjectGuid()); - break; - case RACE_UNDEAD: - pPlayer->PlayerTalkClass->SendGossipMenu(624, GetObjectGuid()); - break; - } - } - return false; + bool found = false; + + GossipMenuItemsMapBounds bounds = sObjectMgr.GetGossipMenuItemsMapBounds(gossipMenuId); + for (auto itr = bounds.first; itr != bounds.second; ++itr) + { + GossipMenuItems const& gMenuItem = itr->second; + if (gMenuItem.option_id == GOSSIP_OPTION_TRAINER) + { + found = true; + uint32 conditionId = gMenuItem.condition_id; + if (!conditionId) + { + return true; } - break; - case TRAINER_TYPE_TRADESKILLS: - if (GetCreatureInfo()->trainer_spell && !pPlayer->HasSpell(GetCreatureInfo()->trainer_spell)) + else { - if (msg) - { - pPlayer->PlayerTalkClass->ClearMenus(); - pPlayer->PlayerTalkClass->SendGossipMenu(11031, GetObjectGuid()); - } - return false; + return IsConditionSatisfied(conditionId, pPlayer, pPlayer->GetMap(), this, CONDITION_FROM_GOSSIP_OPTION); } - break; - default: - return false; // checked and error output at creature_template loading + } } - return true; + + if (!found) + sLog.Out(LOG_DBERROR, LOG_LVL_MINIMAL, "Creature %u (Entry: %u) has npc_flag UNIT_NPC_FLAG_TRAINER but does not have a GOSSIP_OPTION_TRAINER entry assigend to its gossip_menu (Entry: %u) in gossip_menu_option.", + GetGUIDLow(), GetEntry(), gossipMenuId); + + return false; } -bool Creature::CanInteractWithBattleMaster(Player* pPlayer, bool msg) const +bool Creature::CanInteractWithBattleMaster(Player* pPlayer) const { if (!IsBattleMaster()) return false; @@ -1495,36 +1416,7 @@ bool Creature::CanInteractWithBattleMaster(Player* pPlayer, bool msg) const if (bgTypeId == BATTLEGROUND_TYPE_NONE) return false; - if (!msg) - return pPlayer->GetBGAccessByLevel(bgTypeId); - - if (!pPlayer->GetBGAccessByLevel(bgTypeId)) - { - pPlayer->PlayerTalkClass->ClearMenus(); - switch (bgTypeId) - { - case BATTLEGROUND_AV: - pPlayer->PlayerTalkClass->SendGossipMenu(7616, GetObjectGuid()); - break; - case BATTLEGROUND_WS: - pPlayer->PlayerTalkClass->SendGossipMenu(7599, GetObjectGuid()); - break; - case BATTLEGROUND_AB: - pPlayer->PlayerTalkClass->SendGossipMenu(7642, GetObjectGuid()); - break; - default: - break; - } - return false; - } - return true; -} - -bool Creature::CanTrainAndResetTalentsOf(Player const* pPlayer) const -{ - return pPlayer->GetLevel() >= 10 - && GetCreatureInfo()->trainer_type == TRAINER_TYPE_CLASS - && pPlayer->GetClass() == GetCreatureInfo()->trainer_class; + return pPlayer->GetBGAccessByLevel(bgTypeId); } /** diff --git a/src/game/Objects/Creature.h b/src/game/Objects/Creature.h index fced4ecb137..a84111225a8 100644 --- a/src/game/Objects/Creature.h +++ b/src/game/Objects/Creature.h @@ -171,9 +171,8 @@ class Creature : public Unit bool HasCreatureReactState(ReactStates state) const { return (m_reactState == state); } void InitializeReactState(); - bool IsTrainerOf(Player* player, bool msg) const; - bool CanInteractWithBattleMaster(Player* player, bool msg) const; - bool CanTrainAndResetTalentsOf(Player const* pPlayer) const; + bool IsTrainerOf(Player* player) const; + bool CanInteractWithBattleMaster(Player* player) const; bool IsOutOfThreatArea(Unit const* pVictim) const; void FillGuidsListFromThreatList(std::vector& guids, uint32 maxamount = 0); diff --git a/src/game/Objects/CreatureDefines.h b/src/game/Objects/CreatureDefines.h index 9d3ff746e9e..7b7fb921e47 100644 --- a/src/game/Objects/CreatureDefines.h +++ b/src/game/Objects/CreatureDefines.h @@ -26,16 +26,6 @@ #include #include -enum TrainerType // this is important type for npcs! -{ - TRAINER_TYPE_CLASS = 0, - TRAINER_TYPE_MOUNTS = 1, // on blizz it's 2 - TRAINER_TYPE_TRADESKILLS = 2, - TRAINER_TYPE_PETS = 3 -}; - -#define MAX_TRAINER_TYPE 4 - // CreatureType.dbc enum CreatureType { @@ -269,10 +259,6 @@ struct CreatureInfo int32 frost_res = 0; int32 shadow_res = 0; int32 arcane_res = 0; - uint32 trainer_type = 0; - uint32 trainer_spell = 0; - uint32 trainer_class = 0; - uint32 trainer_race = 0; uint32 loot_id = 0; uint32 pickpocket_loot_id = 0; uint32 skinning_loot_id = 0; @@ -609,11 +595,9 @@ typedef std::unordered_map TrainerSpellMap; struct TrainerSpellData { - TrainerSpellData() : trainerType(0) {} - + TrainerSpellData() {} + TrainerSpellMap spellList; - uint32 trainerType; // trainer type based at trainer spells, can be different from creature_template value. - // req. for correct show non-prof. trainers like weaponmaster, allowed values 0 and 2. TrainerSpell const* Find(uint32 spell_id) const; void Clear() { spellList.clear(); } }; diff --git a/src/game/Objects/Object.cpp b/src/game/Objects/Object.cpp index 1e52a643ac7..d486a8f0056 100644 --- a/src/game/Objects/Object.cpp +++ b/src/game/Objects/Object.cpp @@ -707,7 +707,7 @@ void Object::BuildValuesUpdate(uint8 updatetype, ByteBuffer* data, UpdateMask* u { if (appendValue & UNIT_NPC_FLAG_TRAINER) { - if (!((Creature*)this)->IsTrainerOf(target, false)) + if (!((Creature*)this)->IsTrainerOf(target)) appendValue &= ~UNIT_NPC_FLAG_TRAINER; } diff --git a/src/game/Objects/Player.cpp b/src/game/Objects/Player.cpp index 2895905c11b..b1be7070d31 100644 --- a/src/game/Objects/Player.cpp +++ b/src/game/Objects/Player.cpp @@ -12114,15 +12114,15 @@ void Player::PrepareGossipMenu(WorldObject* pSource, uint32 menuId) break; } case GOSSIP_OPTION_TRAINER: - if (!pCreature->IsTrainerOf(this, false)) + if (!pCreature->IsTrainerOf(this)) hasMenuItem = false; break; case GOSSIP_OPTION_UNLEARNTALENTS: - if (!pCreature->CanTrainAndResetTalentsOf(this)) + if (!pCreature->IsTrainerOf(this) || this->GetLevel() < 10) hasMenuItem = false; break; case GOSSIP_OPTION_UNLEARNPETSKILLS: - if (!GetPet() || GetPet()->GetPetType() != HUNTER_PET || GetPet()->m_petSpells.size() <= 1 || pCreature->GetCreatureInfo()->trainer_type != TRAINER_TYPE_PETS || pCreature->GetCreatureInfo()->trainer_class != CLASS_HUNTER) + if (!GetPet() || GetPet()->GetPetType() != HUNTER_PET || GetPet()->m_petSpells.size() <= 1 || !pCreature->IsTrainerOf(this)) hasMenuItem = false; break; case GOSSIP_OPTION_TAXIVENDOR: @@ -12130,7 +12130,7 @@ void Player::PrepareGossipMenu(WorldObject* pSource, uint32 menuId) pMenu->GetGossipMenu().SetDiscoveredNode(); break; case GOSSIP_OPTION_BATTLEFIELD: - if (!pCreature->CanInteractWithBattleMaster(this, false)) + if (!pCreature->CanInteractWithBattleMaster(this)) hasMenuItem = false; break; case GOSSIP_OPTION_STABLEPET: diff --git a/src/game/Spells/SpellMgr.cpp b/src/game/Spells/SpellMgr.cpp index b6e03ee0266..33d1e7479ad 100644 --- a/src/game/Spells/SpellMgr.cpp +++ b/src/game/Spells/SpellMgr.cpp @@ -1316,21 +1316,21 @@ bool SpellMgr::IsNoStackSpellDueToSpell(uint32 spellId_1, uint32 spellId_2) cons return true; } -bool SpellMgr::IsProfessionOrRidingSpell(uint32 spellId) +bool SpellMgr::IsProfessionSpell(uint32 spellId) { SpellEntry const* spellInfo = sSpellMgr.GetSpellEntry(spellId); if (!spellInfo) return false; - if (spellInfo->Effect[1] != SPELL_EFFECT_SKILL) + if (spellInfo->Effect[EFFECT_INDEX_1] != SPELL_EFFECT_SKILL) return false; - uint32 skill = spellInfo->EffectMiscValue[1]; + uint32 skill = spellInfo->EffectMiscValue[EFFECT_INDEX_1]; - return IsProfessionOrRidingSkill(skill); + return IsProfessionSkill(skill); } -bool SpellMgr::IsProfessionSpell(uint32 spellId) +bool SpellMgr::IsProfessionOrRidingSpell(uint32 spellId) { SpellEntry const* spellInfo = sSpellMgr.GetSpellEntry(spellId); if (!spellInfo) @@ -1341,7 +1341,7 @@ bool SpellMgr::IsProfessionSpell(uint32 spellId) uint32 skill = spellInfo->EffectMiscValue[EFFECT_INDEX_1]; - return IsProfessionSkill(skill); + return IsProfessionOrRidingSkill(skill); } bool SpellMgr::IsTradeskillSpell(uint32 spellId) diff --git a/src/game/Spells/SpellMgr.h b/src/game/Spells/SpellMgr.h index c4f22cd32b0..9ff030d8f1a 100644 --- a/src/game/Spells/SpellMgr.h +++ b/src/game/Spells/SpellMgr.h @@ -604,7 +604,7 @@ class SpellMgr return true; return false; } - + static bool IsProfessionOrRidingSpell(uint32 spellId); static bool IsProfessionSpell(uint32 spellId); static bool IsTradeskillSpell(uint32 spellId);