diff --git a/sql/migrations/20171127001449_world.sql b/sql/migrations/20171127001449_world.sql new file mode 100644 index 000000000..eae75e1dd --- /dev/null +++ b/sql/migrations/20171127001449_world.sql @@ -0,0 +1,245 @@ +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`='20171127001449'); +IF v=0 THEN +INSERT INTO `migrations` VALUES ('20171127001449'); +-- Add your query below. + + +-- Fix gameobject templates for the Meeting Stones. +REPLACE INTO `gameobject_template` (`entry`, `type`, `displayId`, `name`, `faction`, `flags`, `size`, `data0`, `data1`, `data2`, `data3`, `data4`, `data5`, `data6`, `data7`, `data8`, `data9`, `data10`, `data11`, `data12`, `data13`, `data14`, `data15`, `data16`, `data17`, `data18`, `data19`, `data20`, `data21`, `data22`, `data23`, `mingold`, `maxgold`) VALUES (178824, 23, 5491, 'Meeting Stone', 35, 0, 1, 37, 46, 722, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0); +REPLACE INTO `gameobject_template` (`entry`, `type`, `displayId`, `name`, `faction`, `flags`, `size`, `data0`, `data1`, `data2`, `data3`, `data4`, `data5`, `data6`, `data7`, `data8`, `data9`, `data10`, `data11`, `data12`, `data13`, `data14`, `data15`, `data16`, `data17`, `data18`, `data19`, `data20`, `data21`, `data22`, `data23`, `mingold`, `maxgold`) VALUES (178825, 23, 5491, 'Meeting Stone', 35, 0, 1, 29, 38, 491, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0); +REPLACE INTO `gameobject_template` (`entry`, `type`, `displayId`, `name`, `faction`, `flags`, `size`, `data0`, `data1`, `data2`, `data3`, `data4`, `data5`, `data6`, `data7`, `data8`, `data9`, `data10`, `data11`, `data12`, `data13`, `data14`, `data15`, `data16`, `data17`, `data18`, `data19`, `data20`, `data21`, `data22`, `data23`, `mingold`, `maxgold`) VALUES (178826, 23, 5492, 'Meeting Stone', 35, 0, 0.94, 56, 60, 2557, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0); +REPLACE INTO `gameobject_template` (`entry`, `type`, `displayId`, `name`, `faction`, `flags`, `size`, `data0`, `data1`, `data2`, `data3`, `data4`, `data5`, `data6`, `data7`, `data8`, `data9`, `data10`, `data11`, `data12`, `data13`, `data14`, `data15`, `data16`, `data17`, `data18`, `data19`, `data20`, `data21`, `data22`, `data23`, `mingold`, `maxgold`) VALUES (178827, 23, 5491, 'Meeting Stone', 35, 0, 1, 40, 52, 2100, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0); +REPLACE INTO `gameobject_template` (`entry`, `type`, `displayId`, `name`, `faction`, `flags`, `size`, `data0`, `data1`, `data2`, `data3`, `data4`, `data5`, `data6`, `data7`, `data8`, `data9`, `data10`, `data11`, `data12`, `data13`, `data14`, `data15`, `data16`, `data17`, `data18`, `data19`, `data20`, `data21`, `data22`, `data23`, `mingold`, `maxgold`) VALUES (178828, 23, 5494, 'Meeting Stone', 35, 0, 1, 24, 32, 719, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0); +REPLACE INTO `gameobject_template` (`entry`, `type`, `displayId`, `name`, `faction`, `flags`, `size`, `data0`, `data1`, `data2`, `data3`, `data4`, `data5`, `data6`, `data7`, `data8`, `data9`, `data10`, `data11`, `data12`, `data13`, `data14`, `data15`, `data16`, `data17`, `data18`, `data19`, `data20`, `data21`, `data22`, `data23`, `mingold`, `maxgold`) VALUES (178829, 23, 5491, 'Meeting Stone', 35, 0, 1, 44, 54, 978, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0); +REPLACE INTO `gameobject_template` (`entry`, `type`, `displayId`, `name`, `faction`, `flags`, `size`, `data0`, `data1`, `data2`, `data3`, `data4`, `data5`, `data6`, `data7`, `data8`, `data9`, `data10`, `data11`, `data12`, `data13`, `data14`, `data15`, `data16`, `data17`, `data18`, `data19`, `data20`, `data21`, `data22`, `data23`, `mingold`, `maxgold`) VALUES (178831, 23, 5495, 'Meeting Stone', 35, 0, 1, 58, 60, 2017, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0); +REPLACE INTO `gameobject_template` (`entry`, `type`, `displayId`, `name`, `faction`, `flags`, `size`, `data0`, `data1`, `data2`, `data3`, `data4`, `data5`, `data6`, `data7`, `data8`, `data9`, `data10`, `data11`, `data12`, `data13`, `data14`, `data15`, `data16`, `data17`, `data18`, `data19`, `data20`, `data21`, `data22`, `data23`, `mingold`, `maxgold`) VALUES (178832, 23, 5494, 'Meeting Stone', 35, 0, 1, 58, 60, 2057, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0); +REPLACE INTO `gameobject_template` (`entry`, `type`, `displayId`, `name`, `faction`, `flags`, `size`, `data0`, `data1`, `data2`, `data3`, `data4`, `data5`, `data6`, `data7`, `data8`, `data9`, `data10`, `data11`, `data12`, `data13`, `data14`, `data15`, `data16`, `data17`, `data18`, `data19`, `data20`, `data21`, `data22`, `data23`, `mingold`, `maxgold`) VALUES (178833, 23, 5491, 'Meeting Stone', 35, 0, 1, 41, 51, 1517, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0); +REPLACE INTO `gameobject_template` (`entry`, `type`, `displayId`, `name`, `faction`, `flags`, `size`, `data0`, `data1`, `data2`, `data3`, `data4`, `data5`, `data6`, `data7`, `data8`, `data9`, `data10`, `data11`, `data12`, `data13`, `data14`, `data15`, `data16`, `data17`, `data18`, `data19`, `data20`, `data21`, `data22`, `data23`, `mingold`, `maxgold`) VALUES (178834, 23, 5494, 'Meeting Stone', 35, 0, 1, 17, 26, 1581, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0); +REPLACE INTO `gameobject_template` (`entry`, `type`, `displayId`, `name`, `faction`, `flags`, `size`, `data0`, `data1`, `data2`, `data3`, `data4`, `data5`, `data6`, `data7`, `data8`, `data9`, `data10`, `data11`, `data12`, `data13`, `data14`, `data15`, `data16`, `data17`, `data18`, `data19`, `data20`, `data21`, `data22`, `data23`, `mingold`, `maxgold`) VALUES (178844, 23, 5492, 'Meeting Stone', 35, 0, 1, 34, 45, 796, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0); +REPLACE INTO `gameobject_template` (`entry`, `type`, `displayId`, `name`, `faction`, `flags`, `size`, `data0`, `data1`, `data2`, `data3`, `data4`, `data5`, `data6`, `data7`, `data8`, `data9`, `data10`, `data11`, `data12`, `data13`, `data14`, `data15`, `data16`, `data17`, `data18`, `data19`, `data20`, `data21`, `data22`, `data23`, `mingold`, `maxgold`) VALUES (178845, 23, 5498, 'Meeting Stone', 35, 0, 1, 22, 30, 209, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0); +REPLACE INTO `gameobject_template` (`entry`, `type`, `displayId`, `name`, `faction`, `flags`, `size`, `data0`, `data1`, `data2`, `data3`, `data4`, `data5`, `data6`, `data7`, `data8`, `data9`, `data10`, `data11`, `data12`, `data13`, `data14`, `data15`, `data16`, `data17`, `data18`, `data19`, `data20`, `data21`, `data22`, `data23`, `mingold`, `maxgold`) VALUES (178884, 23, 5491, 'Meeting Stone', 35, 0, 1, 17, 24, 718, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0); +REPLACE INTO `gameobject_template` (`entry`, `type`, `displayId`, `name`, `faction`, `flags`, `size`, `data0`, `data1`, `data2`, `data3`, `data4`, `data5`, `data6`, `data7`, `data8`, `data9`, `data10`, `data11`, `data12`, `data13`, `data14`, `data15`, `data16`, `data17`, `data18`, `data19`, `data20`, `data21`, `data22`, `data23`, `mingold`, `maxgold`) VALUES (179554, 23, 5498, 'Meeting Stone', 35, 0, 1, 50, 60, 1477, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0); +REPLACE INTO `gameobject_template` (`entry`, `type`, `displayId`, `name`, `faction`, `flags`, `size`, `data0`, `data1`, `data2`, `data3`, `data4`, `data5`, `data6`, `data7`, `data8`, `data9`, `data10`, `data11`, `data12`, `data13`, `data14`, `data15`, `data16`, `data17`, `data18`, `data19`, `data20`, `data21`, `data22`, `data23`, `mingold`, `maxgold`) VALUES (179555, 23, 5491, 'Meeting Stone', 35, 0, 1, 29, 38, 133, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0); +REPLACE INTO `gameobject_template` (`entry`, `type`, `displayId`, `name`, `faction`, `flags`, `size`, `data0`, `data1`, `data2`, `data3`, `data4`, `data5`, `data6`, `data7`, `data8`, `data9`, `data10`, `data11`, `data12`, `data13`, `data14`, `data15`, `data16`, `data17`, `data18`, `data19`, `data20`, `data21`, `data22`, `data23`, `mingold`, `maxgold`) VALUES (179584, 23, 5495, 'Meeting Stone', 35, 0, 1, 52, 60, 1584, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0); +REPLACE INTO `gameobject_template` (`entry`, `type`, `displayId`, `name`, `faction`, `flags`, `size`, `data0`, `data1`, `data2`, `data3`, `data4`, `data5`, `data6`, `data7`, `data8`, `data9`, `data10`, `data11`, `data12`, `data13`, `data14`, `data15`, `data16`, `data17`, `data18`, `data19`, `data20`, `data21`, `data22`, `data23`, `mingold`, `maxgold`) VALUES (179585, 23, 5495, 'Meeting Stone', 35, 0, 1, 55, 60, 1583, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0); +REPLACE INTO `gameobject_template` (`entry`, `type`, `displayId`, `name`, `faction`, `flags`, `size`, `data0`, `data1`, `data2`, `data3`, `data4`, `data5`, `data6`, `data7`, `data8`, `data9`, `data10`, `data11`, `data12`, `data13`, `data14`, `data15`, `data16`, `data17`, `data18`, `data19`, `data20`, `data21`, `data22`, `data23`, `mingold`, `maxgold`) VALUES (179586, 23, 5495, 'Meeting Stone', 0, 0, 1, 48, 60, 1584, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0); +REPLACE INTO `gameobject_template` (`entry`, `type`, `displayId`, `name`, `faction`, `flags`, `size`, `data0`, `data1`, `data2`, `data3`, `data4`, `data5`, `data6`, `data7`, `data8`, `data9`, `data10`, `data11`, `data12`, `data13`, `data14`, `data15`, `data16`, `data17`, `data18`, `data19`, `data20`, `data21`, `data22`, `data23`, `mingold`, `maxgold`) VALUES (179587, 23, 5495, 'Meeting Stone', 0, 0, 1, 55, 60, 1583, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0); +REPLACE INTO `gameobject_template` (`entry`, `type`, `displayId`, `name`, `faction`, `flags`, `size`, `data0`, `data1`, `data2`, `data3`, `data4`, `data5`, `data6`, `data7`, `data8`, `data9`, `data10`, `data11`, `data12`, `data13`, `data14`, `data15`, `data16`, `data17`, `data18`, `data19`, `data20`, `data21`, `data22`, `data23`, `mingold`, `maxgold`) VALUES (179595, 23, 5494, 'Meeting Stone', 35, 0, 1, 24, 32, 717, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0); +REPLACE INTO `gameobject_template` (`entry`, `type`, `displayId`, `name`, `faction`, `flags`, `size`, `data0`, `data1`, `data2`, `data3`, `data4`, `data5`, `data6`, `data7`, `data8`, `data9`, `data10`, `data11`, `data12`, `data13`, `data14`, `data15`, `data16`, `data17`, `data18`, `data19`, `data20`, `data21`, `data22`, `data23`, `mingold`, `maxgold`) VALUES (179596, 23, 5498, 'Meeting Stone', 35, 0, 1, 13, 20, 2437, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0); + +-- Add conditions for the innkeeper gossip options. +INSERT INTO `conditions` VALUES (4013, 37, 3, 1); +INSERT INTO `conditions` VALUES (402, 15, 17, 1); +INSERT INTO `conditions` VALUES (403, 15, 13, 1); +INSERT INTO `conditions` VALUES (404, 15, 20, 2); +INSERT INTO `conditions` VALUES (405, -1, 403, 404); +INSERT INTO `conditions` VALUES (406, 15, 26, 2); +INSERT INTO `conditions` VALUES (407, -1, 402, 406); +INSERT INTO `conditions` VALUES (408, 15, 24, 2); +INSERT INTO `conditions` VALUES (409, -1, 402, 408); +INSERT INTO `conditions` VALUES (410, 15, 22, 1); +INSERT INTO `conditions` VALUES (411, 15, 30, 2); +INSERT INTO `conditions` VALUES (412, -1, 410, 411); +INSERT INTO `conditions` VALUES (414, 15, 32, 2); +INSERT INTO `conditions` VALUES (415, -1, 168, 414); +INSERT INTO `conditions` VALUES (416, 15, 29, 1); +INSERT INTO `conditions` VALUES (417, 15, 38, 2); +INSERT INTO `conditions` VALUES (418, -1, 416, 417); +INSERT INTO `conditions` VALUES (419, 15, 34, 1); +INSERT INTO `conditions` VALUES (420, 15, 45, 2); +INSERT INTO `conditions` VALUES (421, -1, 419, 420); +INSERT INTO `conditions` VALUES (422, 15, 37, 1); +INSERT INTO `conditions` VALUES (423, 15, 46, 2); +INSERT INTO `conditions` VALUES (424, -1, 422, 423); +INSERT INTO `conditions` VALUES (426, 15, 52, 2); +INSERT INTO `conditions` VALUES (427, -1, 178, 426); +INSERT INTO `conditions` VALUES (428, 15, 41, 1); +INSERT INTO `conditions` VALUES (429, 15, 51, 2); +INSERT INTO `conditions` VALUES (430, -1, 428, 429); +INSERT INTO `conditions` VALUES (431, 15, 44, 1); +INSERT INTO `conditions` VALUES (432, 15, 55, 2); +INSERT INTO `conditions` VALUES (433, -1, 431, 432); +INSERT INTO `conditions` VALUES (434, 15, 52, 1); +INSERT INTO `conditions` VALUES (435, 15, 50, 1); +INSERT INTO `conditions` VALUES (436, 15, 55, 1); +INSERT INTO `conditions` VALUES (437, 15, 56, 1); +INSERT INTO `conditions` VALUES (438, 15, 58, 1); +INSERT INTO `conditions` VALUES (4500, -1, 402, 4013); + +-- Main dungeon gossip menu. +INSERT INTO `gossip_menu` VALUES (6029, 7180, 0); +INSERT INTO `gossip_menu_option` (`menu_id`, `id`, `option_icon`, `option_text`, `option_id`, `npc_option_npcflag`, `action_menu_id`, `action_poi_id`, `action_script_id`, `box_coded`, `box_money`, `box_text`, `condition_id`) VALUES (6029, 0, 0, 'Ragefire', 1, 1, 6037, 0, 0, 0, 0, NULL, 405); +INSERT INTO `gossip_menu_option` (`menu_id`, `id`, `option_icon`, `option_text`, `option_id`, `npc_option_npcflag`, `action_menu_id`, `action_poi_id`, `action_script_id`, `box_coded`, `box_money`, `box_text`, `condition_id`) VALUES (6029, 1, 0, 'Deadmines', 1, 1, 50200, 0, 0, 0, 0, NULL, 407); +INSERT INTO `gossip_menu_option` (`menu_id`, `id`, `option_icon`, `option_text`, `option_id`, `npc_option_npcflag`, `action_menu_id`, `action_poi_id`, `action_script_id`, `box_coded`, `box_money`, `box_text`, `condition_id`) VALUES (6029, 2, 0, 'Wailing Caverns', 1, 1, 50202, 0, 0, 0, 0, NULL, 409); +INSERT INTO `gossip_menu_option` (`menu_id`, `id`, `option_icon`, `option_text`, `option_id`, `npc_option_npcflag`, `action_menu_id`, `action_poi_id`, `action_script_id`, `box_coded`, `box_money`, `box_text`, `condition_id`) VALUES (6029, 3, 0, 'Shadowfang Keep', 1, 1, 50204, 0, 0, 0, 0, NULL, 412); +INSERT INTO `gossip_menu_option` (`menu_id`, `id`, `option_icon`, `option_text`, `option_id`, `npc_option_npcflag`, `action_menu_id`, `action_poi_id`, `action_script_id`, `box_coded`, `box_money`, `box_text`, `condition_id`) VALUES (6029, 4, 0, 'Blackfathom Deeps', 1, 1, 50206, 0, 0, 0, 0, NULL, 415); +INSERT INTO `gossip_menu_option` (`menu_id`, `id`, `option_icon`, `option_text`, `option_id`, `npc_option_npcflag`, `action_menu_id`, `action_poi_id`, `action_script_id`, `box_coded`, `box_money`, `box_text`, `condition_id`) VALUES (6029, 5, 0, 'Stormwind Stockade', 1, 1, 50208, 0, 0, 0, 0, NULL, 415); +INSERT INTO `gossip_menu_option` (`menu_id`, `id`, `option_icon`, `option_text`, `option_id`, `npc_option_npcflag`, `action_menu_id`, `action_poi_id`, `action_script_id`, `box_coded`, `box_money`, `box_text`, `condition_id`) VALUES (6029, 6, 0, 'Razorfen Kraul', 1, 1, 50210, 0, 0, 0, 0, NULL, 418); +INSERT INTO `gossip_menu_option` (`menu_id`, `id`, `option_icon`, `option_text`, `option_id`, `npc_option_npcflag`, `action_menu_id`, `action_poi_id`, `action_script_id`, `box_coded`, `box_money`, `box_text`, `condition_id`) VALUES (6029, 7, 0, 'Gnomeregan', 1, 1, 50212, 0, 0, 0, 0, NULL, 418); +INSERT INTO `gossip_menu_option` (`menu_id`, `id`, `option_icon`, `option_text`, `option_id`, `npc_option_npcflag`, `action_menu_id`, `action_poi_id`, `action_script_id`, `box_coded`, `box_money`, `box_text`, `condition_id`) VALUES (6029, 8, 0, 'Scarlet Monastery', 1, 1, 50214, 0, 0, 0, 0, NULL, 421); +INSERT INTO `gossip_menu_option` (`menu_id`, `id`, `option_icon`, `option_text`, `option_id`, `npc_option_npcflag`, `action_menu_id`, `action_poi_id`, `action_script_id`, `box_coded`, `box_money`, `box_text`, `condition_id`) VALUES (6029, 9, 0, 'Razorfen Downs', 1, 1, 50216, 0, 0, 0, 0, NULL, 424); +INSERT INTO `gossip_menu_option` (`menu_id`, `id`, `option_icon`, `option_text`, `option_id`, `npc_option_npcflag`, `action_menu_id`, `action_poi_id`, `action_script_id`, `box_coded`, `box_money`, `box_text`, `condition_id`) VALUES (6029, 10, 0, 'Maraudon', 1, 1, 50218, 0, 0, 0, 0, NULL, 427); +INSERT INTO `gossip_menu_option` (`menu_id`, `id`, `option_icon`, `option_text`, `option_id`, `npc_option_npcflag`, `action_menu_id`, `action_poi_id`, `action_script_id`, `box_coded`, `box_money`, `box_text`, `condition_id`) VALUES (6029, 11, 0, 'Uldaman', 1, 1, 50220, 0, 0, 0, 0, NULL, 430); +INSERT INTO `gossip_menu_option` (`menu_id`, `id`, `option_icon`, `option_text`, `option_id`, `npc_option_npcflag`, `action_menu_id`, `action_poi_id`, `action_script_id`, `box_coded`, `box_money`, `box_text`, `condition_id`) VALUES (6029, 12, 0, 'Zul\'Farrak', 1, 1, 50222, 0, 0, 0, 0, NULL, 433); +INSERT INTO `gossip_menu_option` (`menu_id`, `id`, `option_icon`, `option_text`, `option_id`, `npc_option_npcflag`, `action_menu_id`, `action_poi_id`, `action_script_id`, `box_coded`, `box_money`, `box_text`, `condition_id`) VALUES (6029, 13, 0, 'Blackrock Depths', 1, 1, 50224, 0, 0, 0, 0, NULL, 434); +INSERT INTO `gossip_menu_option` (`menu_id`, `id`, `option_icon`, `option_text`, `option_id`, `npc_option_npcflag`, `action_menu_id`, `action_poi_id`, `action_script_id`, `box_coded`, `box_money`, `box_text`, `condition_id`) VALUES (6029, 14, 0, 'Sunken Temple', 1, 1, 50226, 0, 0, 0, 0, NULL, 435); +INSERT INTO `gossip_menu_option` (`menu_id`, `id`, `option_icon`, `option_text`, `option_id`, `npc_option_npcflag`, `action_menu_id`, `action_poi_id`, `action_script_id`, `box_coded`, `box_money`, `box_text`, `condition_id`) VALUES (6029, 15, 0, 'Blackrock Spire', 1, 1, 50228, 0, 0, 0, 0, NULL, 436); +INSERT INTO `gossip_menu_option` (`menu_id`, `id`, `option_icon`, `option_text`, `option_id`, `npc_option_npcflag`, `action_menu_id`, `action_poi_id`, `action_script_id`, `box_coded`, `box_money`, `box_text`, `condition_id`) VALUES (6029, 16, 0, 'Dire Maul', 1, 1, 50230, 0, 0, 0, 0, NULL, 437); +INSERT INTO `gossip_menu_option` (`menu_id`, `id`, `option_icon`, `option_text`, `option_id`, `npc_option_npcflag`, `action_menu_id`, `action_poi_id`, `action_script_id`, `box_coded`, `box_money`, `box_text`, `condition_id`) VALUES (6029, 17, 0, 'Stratholme', 1, 1, 50232, 0, 0, 0, 0, NULL, 438); +INSERT INTO `gossip_menu_option` (`menu_id`, `id`, `option_icon`, `option_text`, `option_id`, `npc_option_npcflag`, `action_menu_id`, `action_poi_id`, `action_script_id`, `box_coded`, `box_money`, `box_text`, `condition_id`) VALUES (6029, 18, 0, 'Scholomance', 1, 1, 50234, 0, 0, 0, 0, NULL, 438); +-- Ragefire Chasm +INSERT INTO `gossip_menu` VALUES (6037, 7191, 0); +INSERT INTO `gossip_menu_option` (`menu_id`, `id`, `option_icon`, `option_text`, `option_id`, `npc_option_npcflag`, `action_menu_id`, `action_poi_id`, `action_script_id`, `box_coded`, `box_money`, `box_text`, `condition_id`) VALUES (6037, 0, 5, 'Join a group going to this dungeon. ', 1, 1, -1, 0, 2000, 0, 0, NULL, 0); +INSERT INTO `gossip_menu_option` (`menu_id`, `id`, `option_icon`, `option_text`, `option_id`, `npc_option_npcflag`, `action_menu_id`, `action_poi_id`, `action_script_id`, `box_coded`, `box_money`, `box_text`, `condition_id`) VALUES (6037, 1, 0, 'Can you tell me more about this place?', 1, 1, 6024, 0, 0, 0, 0, NULL, 0); +INSERT INTO `gossip_menu` VALUES (6024, 7177, 0); +-- Deadmines +INSERT INTO `gossip_menu` VALUES (50200, 7227, 0); +INSERT INTO `gossip_menu_option` (`menu_id`, `id`, `option_icon`, `option_text`, `option_id`, `npc_option_npcflag`, `action_menu_id`, `action_poi_id`, `action_script_id`, `box_coded`, `box_money`, `box_text`, `condition_id`) VALUES (50200, 0, 5, 'Join a group going to this dungeon. ', 1, 1, -1, 0, 2001, 0, 0, NULL, 0); +INSERT INTO `gossip_menu_option` (`menu_id`, `id`, `option_icon`, `option_text`, `option_id`, `npc_option_npcflag`, `action_menu_id`, `action_poi_id`, `action_script_id`, `box_coded`, `box_money`, `box_text`, `condition_id`) VALUES (50200, 1, 0, 'Can you tell me more about this place?', 1, 1, 50201, 0, 0, 0, 0, NULL, 0); +INSERT INTO `gossip_menu` VALUES (50201, 7187, 0); +-- Wailing Caverns +INSERT INTO `gossip_menu` VALUES (50202, 7192, 0); +INSERT INTO `gossip_menu_option` (`menu_id`, `id`, `option_icon`, `option_text`, `option_id`, `npc_option_npcflag`, `action_menu_id`, `action_poi_id`, `action_script_id`, `box_coded`, `box_money`, `box_text`, `condition_id`) VALUES (50202, 0, 5, 'Join a group going to this dungeon. ', 1, 1, -1, 0, 2002, 0, 0, NULL, 0); +INSERT INTO `gossip_menu_option` (`menu_id`, `id`, `option_icon`, `option_text`, `option_id`, `npc_option_npcflag`, `action_menu_id`, `action_poi_id`, `action_script_id`, `box_coded`, `box_money`, `box_text`, `condition_id`) VALUES (50202, 1, 0, 'Can you tell me more about this place?', 1, 1, 50203, 0, 0, 0, 0, NULL, 0); +INSERT INTO `gossip_menu` VALUES (50203, 7183, 0); +-- Shadowfang Keep +INSERT INTO `gossip_menu` VALUES (50204, 7197, 0); +INSERT INTO `gossip_menu_option` (`menu_id`, `id`, `option_icon`, `option_text`, `option_id`, `npc_option_npcflag`, `action_menu_id`, `action_poi_id`, `action_script_id`, `box_coded`, `box_money`, `box_text`, `condition_id`) VALUES (50204, 0, 5, 'Join a group going to this dungeon. ', 1, 1, -1, 0, 2003, 0, 0, NULL, 0); +INSERT INTO `gossip_menu_option` (`menu_id`, `id`, `option_icon`, `option_text`, `option_id`, `npc_option_npcflag`, `action_menu_id`, `action_poi_id`, `action_script_id`, `box_coded`, `box_money`, `box_text`, `condition_id`) VALUES (50204, 1, 0, 'Can you tell me more about this place?', 1, 1, 50205, 0, 0, 0, 0, NULL, 0); +INSERT INTO `gossip_menu` VALUES (50205, 7185, 0); +-- Blackfathom Depths +INSERT INTO `gossip_menu` VALUES (50206, 7200, 0); +INSERT INTO `gossip_menu_option` (`menu_id`, `id`, `option_icon`, `option_text`, `option_id`, `npc_option_npcflag`, `action_menu_id`, `action_poi_id`, `action_script_id`, `box_coded`, `box_money`, `box_text`, `condition_id`) VALUES (50206, 0, 5, 'Join a group going to this dungeon. ', 1, 1, -1, 0, 2004, 0, 0, NULL, 0); +INSERT INTO `gossip_menu_option` (`menu_id`, `id`, `option_icon`, `option_text`, `option_id`, `npc_option_npcflag`, `action_menu_id`, `action_poi_id`, `action_script_id`, `box_coded`, `box_money`, `box_text`, `condition_id`) VALUES (50206, 1, 0, 'Can you tell me more about this place?', 1, 1, 50207, 0, 0, 0, 0, NULL, 0); +INSERT INTO `gossip_menu` VALUES (50207, 7201, 0); +-- Stormwind Stockade +INSERT INTO `gossip_menu` VALUES (50208, 7229, 0); +INSERT INTO `gossip_menu_option` (`menu_id`, `id`, `option_icon`, `option_text`, `option_id`, `npc_option_npcflag`, `action_menu_id`, `action_poi_id`, `action_script_id`, `box_coded`, `box_money`, `box_text`, `condition_id`) VALUES (50208, 0, 5, 'Join a group going to this dungeon. ', 1, 1, -1, 0, 2005, 0, 0, NULL, 0); +INSERT INTO `gossip_menu_option` (`menu_id`, `id`, `option_icon`, `option_text`, `option_id`, `npc_option_npcflag`, `action_menu_id`, `action_poi_id`, `action_script_id`, `box_coded`, `box_money`, `box_text`, `condition_id`) VALUES (50208, 1, 0, 'Can you tell me more about this place?', 1, 1, 50209, 0, 0, 0, 0, NULL, 0); +INSERT INTO `gossip_menu` VALUES (50209, 7230, 0); +-- Razorfen Kraul +INSERT INTO `gossip_menu` VALUES (50210, 7204, 0); +INSERT INTO `gossip_menu_option` (`menu_id`, `id`, `option_icon`, `option_text`, `option_id`, `npc_option_npcflag`, `action_menu_id`, `action_poi_id`, `action_script_id`, `box_coded`, `box_money`, `box_text`, `condition_id`) VALUES (50210, 0, 5, 'Join a group going to this dungeon. ', 1, 1, -1, 0, 2006, 0, 0, NULL, 0); +INSERT INTO `gossip_menu_option` (`menu_id`, `id`, `option_icon`, `option_text`, `option_id`, `npc_option_npcflag`, `action_menu_id`, `action_poi_id`, `action_script_id`, `box_coded`, `box_money`, `box_text`, `condition_id`) VALUES (50210, 1, 0, 'Can you tell me more about this place?', 1, 1, 50211, 0, 0, 0, 0, NULL, 0); +INSERT INTO `gossip_menu` VALUES (50211, 7205, 0); +-- Gnomeregan +INSERT INTO `gossip_menu` VALUES (50212, 7202, 0); +INSERT INTO `gossip_menu_option` (`menu_id`, `id`, `option_icon`, `option_text`, `option_id`, `npc_option_npcflag`, `action_menu_id`, `action_poi_id`, `action_script_id`, `box_coded`, `box_money`, `box_text`, `condition_id`) VALUES (50212, 0, 5, 'Join a group going to this dungeon. ', 1, 1, -1, 0, 2007, 0, 0, NULL, 0); +INSERT INTO `gossip_menu_option` (`menu_id`, `id`, `option_icon`, `option_text`, `option_id`, `npc_option_npcflag`, `action_menu_id`, `action_poi_id`, `action_script_id`, `box_coded`, `box_money`, `box_text`, `condition_id`) VALUES (50212, 1, 0, 'Can you tell me more about this place?', 1, 1, 50213, 0, 0, 0, 0, NULL, 0); +INSERT INTO `gossip_menu` VALUES (50213, 7203, 0); +-- Scarlet Monestary +INSERT INTO `gossip_menu` VALUES (50214, 7206, 0); +INSERT INTO `gossip_menu_option` (`menu_id`, `id`, `option_icon`, `option_text`, `option_id`, `npc_option_npcflag`, `action_menu_id`, `action_poi_id`, `action_script_id`, `box_coded`, `box_money`, `box_text`, `condition_id`) VALUES (50214, 0, 5, 'Join a group going to this dungeon. ', 1, 1, -1, 0, 2008, 0, 0, NULL, 0); +INSERT INTO `gossip_menu_option` (`menu_id`, `id`, `option_icon`, `option_text`, `option_id`, `npc_option_npcflag`, `action_menu_id`, `action_poi_id`, `action_script_id`, `box_coded`, `box_money`, `box_text`, `condition_id`) VALUES (50214, 1, 0, 'Can you tell me more about this place?', 1, 1, 50215, 0, 0, 0, 0, NULL, 0); +INSERT INTO `gossip_menu` VALUES (50215, 7207, 0); +-- Razorfen Downs +INSERT INTO `gossip_menu` VALUES (50216, 7208, 0); +INSERT INTO `gossip_menu_option` (`menu_id`, `id`, `option_icon`, `option_text`, `option_id`, `npc_option_npcflag`, `action_menu_id`, `action_poi_id`, `action_script_id`, `box_coded`, `box_money`, `box_text`, `condition_id`) VALUES (50216, 0, 5, 'Join a group going to this dungeon. ', 1, 1, -1, 0, 2009, 0, 0, NULL, 0); +INSERT INTO `gossip_menu_option` (`menu_id`, `id`, `option_icon`, `option_text`, `option_id`, `npc_option_npcflag`, `action_menu_id`, `action_poi_id`, `action_script_id`, `box_coded`, `box_money`, `box_text`, `condition_id`) VALUES (50216, 1, 0, 'Can you tell me more about this place?', 1, 1, 50217, 0, 0, 0, 0, NULL, 0); +INSERT INTO `gossip_menu` VALUES (50217, 7209, 0); +-- Maraudon +INSERT INTO `gossip_menu` VALUES (50218, 7215, 0); +INSERT INTO `gossip_menu_option` (`menu_id`, `id`, `option_icon`, `option_text`, `option_id`, `npc_option_npcflag`, `action_menu_id`, `action_poi_id`, `action_script_id`, `box_coded`, `box_money`, `box_text`, `condition_id`) VALUES (50218, 0, 5, 'Join a group going to this dungeon. ', 1, 1, -1, 0, 2010, 0, 0, NULL, 0); +INSERT INTO `gossip_menu_option` (`menu_id`, `id`, `option_icon`, `option_text`, `option_id`, `npc_option_npcflag`, `action_menu_id`, `action_poi_id`, `action_script_id`, `box_coded`, `box_money`, `box_text`, `condition_id`) VALUES (50218, 1, 0, 'Can you tell me more about this place?', 1, 1, 50219, 0, 0, 0, 0, NULL, 0); +INSERT INTO `gossip_menu` VALUES (50219, 7216, 0); +-- Uldaman +INSERT INTO `gossip_menu` VALUES (50220, 7210, 0); +INSERT INTO `gossip_menu_option` (`menu_id`, `id`, `option_icon`, `option_text`, `option_id`, `npc_option_npcflag`, `action_menu_id`, `action_poi_id`, `action_script_id`, `box_coded`, `box_money`, `box_text`, `condition_id`) VALUES (50220, 0, 5, 'Join a group going to this dungeon. ', 1, 1, -1, 0, 2011, 0, 0, NULL, 0); +INSERT INTO `gossip_menu_option` (`menu_id`, `id`, `option_icon`, `option_text`, `option_id`, `npc_option_npcflag`, `action_menu_id`, `action_poi_id`, `action_script_id`, `box_coded`, `box_money`, `box_text`, `condition_id`) VALUES (50220, 1, 0, 'Can you tell me more about this place?', 1, 1, 50221, 0, 0, 0, 0, NULL, 0); +INSERT INTO `gossip_menu` VALUES (50221, 7212, 0); +-- Zul'Farrak +INSERT INTO `gossip_menu` VALUES (50222, 7213, 0); +INSERT INTO `gossip_menu_option` (`menu_id`, `id`, `option_icon`, `option_text`, `option_id`, `npc_option_npcflag`, `action_menu_id`, `action_poi_id`, `action_script_id`, `box_coded`, `box_money`, `box_text`, `condition_id`) VALUES (50222, 0, 5, 'Join a group going to this dungeon. ', 1, 1, -1, 0, 2012, 0, 0, NULL, 0); +INSERT INTO `gossip_menu_option` (`menu_id`, `id`, `option_icon`, `option_text`, `option_id`, `npc_option_npcflag`, `action_menu_id`, `action_poi_id`, `action_script_id`, `box_coded`, `box_money`, `box_text`, `condition_id`) VALUES (50222, 1, 0, 'Can you tell me more about this place?', 1, 1, 50223, 0, 0, 0, 0, NULL, 0); +INSERT INTO `gossip_menu` VALUES (50223, 7214, 0); +-- Blackrock Depths +INSERT INTO `gossip_menu` VALUES (50224, 7218, 0); +INSERT INTO `gossip_menu_option` (`menu_id`, `id`, `option_icon`, `option_text`, `option_id`, `npc_option_npcflag`, `action_menu_id`, `action_poi_id`, `action_script_id`, `box_coded`, `box_money`, `box_text`, `condition_id`) VALUES (50224, 0, 5, 'Join a group going to this dungeon. ', 1, 1, -1, 0, 2013, 0, 0, NULL, 0); +INSERT INTO `gossip_menu_option` (`menu_id`, `id`, `option_icon`, `option_text`, `option_id`, `npc_option_npcflag`, `action_menu_id`, `action_poi_id`, `action_script_id`, `box_coded`, `box_money`, `box_text`, `condition_id`) VALUES (50224, 1, 0, 'Can you tell me more about this place?', 1, 1, 50225, 0, 0, 0, 0, NULL, 0); +INSERT INTO `gossip_menu` VALUES (50225, 7219, 0); +-- Sunken Temple +INSERT INTO `gossip_menu` VALUES (50226, 7217, 0); +INSERT INTO `gossip_menu_option` (`menu_id`, `id`, `option_icon`, `option_text`, `option_id`, `npc_option_npcflag`, `action_menu_id`, `action_poi_id`, `action_script_id`, `box_coded`, `box_money`, `box_text`, `condition_id`) VALUES (50226, 0, 5, 'Join a group going to this dungeon. ', 1, 1, -1, 0, 2014, 0, 0, NULL, 0); +INSERT INTO `gossip_menu_option` (`menu_id`, `id`, `option_icon`, `option_text`, `option_id`, `npc_option_npcflag`, `action_menu_id`, `action_poi_id`, `action_script_id`, `box_coded`, `box_money`, `box_text`, `condition_id`) VALUES (50226, 1, 0, 'Can you tell me more about this place?', 1, 1, 50227, 0, 0, 0, 0, NULL, 0); +INSERT INTO `gossip_menu` VALUES (50227, 7228, 0); +INSERT INTO `npc_text` (`ID`, `BroadcastTextID0`, `Probability0`) VALUES (7228, 9936, 1); +-- Blackrock Spire +INSERT INTO `gossip_menu` VALUES (50228, 7218, 0); +INSERT INTO `gossip_menu_option` (`menu_id`, `id`, `option_icon`, `option_text`, `option_id`, `npc_option_npcflag`, `action_menu_id`, `action_poi_id`, `action_script_id`, `box_coded`, `box_money`, `box_text`, `condition_id`) VALUES (50228, 0, 5, 'Join a group going to this dungeon. ', 1, 1, -1, 0, 2015, 0, 0, NULL, 0); +INSERT INTO `gossip_menu_option` (`menu_id`, `id`, `option_icon`, `option_text`, `option_id`, `npc_option_npcflag`, `action_menu_id`, `action_poi_id`, `action_script_id`, `box_coded`, `box_money`, `box_text`, `condition_id`) VALUES (50228, 1, 0, 'Can you tell me more about this place?', 1, 1, 50229, 0, 0, 0, 0, NULL, 0); +INSERT INTO `gossip_menu` VALUES (50229, 7220, 0); +-- Dire Maul +INSERT INTO `gossip_menu` VALUES (50230, 7221, 0); +INSERT INTO `gossip_menu_option` (`menu_id`, `id`, `option_icon`, `option_text`, `option_id`, `npc_option_npcflag`, `action_menu_id`, `action_poi_id`, `action_script_id`, `box_coded`, `box_money`, `box_text`, `condition_id`) VALUES (50230, 0, 5, 'Join a group going to this dungeon. ', 1, 1, -1, 0, 2016, 0, 0, NULL, 0); +INSERT INTO `gossip_menu_option` (`menu_id`, `id`, `option_icon`, `option_text`, `option_id`, `npc_option_npcflag`, `action_menu_id`, `action_poi_id`, `action_script_id`, `box_coded`, `box_money`, `box_text`, `condition_id`) VALUES (50230, 1, 0, 'Can you tell me more about this place?', 1, 1, 50231, 0, 0, 0, 0, NULL, 0); +INSERT INTO `gossip_menu` VALUES (50231, 7222, 0); +INSERT INTO `npc_text` (`ID`, `BroadcastTextID0`, `Probability0`) VALUES (7222, 9944, 1); +-- Strattholme +INSERT INTO `gossip_menu` VALUES (50232, 7225, 0); +INSERT INTO `gossip_menu_option` (`menu_id`, `id`, `option_icon`, `option_text`, `option_id`, `npc_option_npcflag`, `action_menu_id`, `action_poi_id`, `action_script_id`, `box_coded`, `box_money`, `box_text`, `condition_id`) VALUES (50232, 0, 5, 'Join a group going to this dungeon. ', 1, 1, -1, 0, 2017, 0, 0, NULL, 0); +INSERT INTO `gossip_menu_option` (`menu_id`, `id`, `option_icon`, `option_text`, `option_id`, `npc_option_npcflag`, `action_menu_id`, `action_poi_id`, `action_script_id`, `box_coded`, `box_money`, `box_text`, `condition_id`) VALUES (50232, 1, 0, 'Can you tell me more about this place?', 1, 1, 50233, 0, 0, 0, 0, NULL, 0); +INSERT INTO `gossip_menu` VALUES (50233, 7226, 0); +-- Scholomance +INSERT INTO `gossip_menu` VALUES (50234, 7223, 0); +INSERT INTO `gossip_menu_option` (`menu_id`, `id`, `option_icon`, `option_text`, `option_id`, `npc_option_npcflag`, `action_menu_id`, `action_poi_id`, `action_script_id`, `box_coded`, `box_money`, `box_text`, `condition_id`) VALUES (50234, 0, 5, 'Join a group going to this dungeon. ', 1, 1, -1, 0, 2018, 0, 0, NULL, 0); +INSERT INTO `gossip_menu_option` (`menu_id`, `id`, `option_icon`, `option_text`, `option_id`, `npc_option_npcflag`, `action_menu_id`, `action_poi_id`, `action_script_id`, `box_coded`, `box_money`, `box_text`, `condition_id`) VALUES (50234, 1, 0, 'Can you tell me more about this place?', 1, 1, 50235, 0, 0, 0, 0, NULL, 0); +INSERT INTO `gossip_menu` VALUES (50235, 7224, 0); +INSERT INTO `npc_text` (`ID`, `BroadcastTextID0`, `Probability0`) VALUES (7224, 9947, 1); +-- Add the gossip option to all the innkeepers. +INSERT INTO `gossip_menu_option` (`menu_id`, `id`, `option_icon`, `option_text`, `option_id`, `npc_option_npcflag`, `action_menu_id`, `action_poi_id`, `action_script_id`, `box_coded`, `box_money`, `box_text`, `condition_id`) VALUES (342, 4, 0, 'Tell me about dungeons I could explore.', 1, 1, 6029, 0, 0, 0, 0, NULL, 4500); +INSERT INTO `gossip_menu_option` (`menu_id`, `id`, `option_icon`, `option_text`, `option_id`, `npc_option_npcflag`, `action_menu_id`, `action_poi_id`, `action_script_id`, `box_coded`, `box_money`, `box_text`, `condition_id`) VALUES (344, 4, 0, 'Tell me about dungeons I could explore.', 1, 1, 6029, 0, 0, 0, 0, NULL, 4500); +INSERT INTO `gossip_menu_option` (`menu_id`, `id`, `option_icon`, `option_text`, `option_id`, `npc_option_npcflag`, `action_menu_id`, `action_poi_id`, `action_script_id`, `box_coded`, `box_money`, `box_text`, `condition_id`) VALUES (345, 4, 0, 'Tell me about dungeons I could explore.', 1, 1, 6029, 0, 0, 0, 0, NULL, 4500); +INSERT INTO `gossip_menu_option` (`menu_id`, `id`, `option_icon`, `option_text`, `option_id`, `npc_option_npcflag`, `action_menu_id`, `action_poi_id`, `action_script_id`, `box_coded`, `box_money`, `box_text`, `condition_id`) VALUES (347, 4, 0, 'Tell me about dungeons I could explore.', 1, 1, 6029, 0, 0, 0, 0, NULL, 4500); +INSERT INTO `gossip_menu_option` (`menu_id`, `id`, `option_icon`, `option_text`, `option_id`, `npc_option_npcflag`, `action_menu_id`, `action_poi_id`, `action_script_id`, `box_coded`, `box_money`, `box_text`, `condition_id`) VALUES (349, 4, 0, 'Tell me about dungeons I could explore.', 1, 1, 6029, 0, 0, 0, 0, NULL, 4500); +INSERT INTO `gossip_menu_option` (`menu_id`, `id`, `option_icon`, `option_text`, `option_id`, `npc_option_npcflag`, `action_menu_id`, `action_poi_id`, `action_script_id`, `box_coded`, `box_money`, `box_text`, `condition_id`) VALUES (1290, 5, 0, 'Tell me about dungeons I could explore.', 1, 1, 6029, 0, 0, 0, 0, NULL, 4500); +INSERT INTO `gossip_menu_option` (`menu_id`, `id`, `option_icon`, `option_text`, `option_id`, `npc_option_npcflag`, `action_menu_id`, `action_poi_id`, `action_script_id`, `box_coded`, `box_money`, `box_text`, `condition_id`) VALUES (1291, 5, 0, 'Tell me about dungeons I could explore.', 1, 1, 6029, 0, 0, 0, 0, NULL, 4500); +INSERT INTO `gossip_menu_option` (`menu_id`, `id`, `option_icon`, `option_text`, `option_id`, `npc_option_npcflag`, `action_menu_id`, `action_poi_id`, `action_script_id`, `box_coded`, `box_money`, `box_text`, `condition_id`) VALUES (1293, 4, 0, 'Tell me about dungeons I could explore.', 1, 1, 6029, 0, 0, 0, 0, NULL, 4500); +INSERT INTO `gossip_menu_option` (`menu_id`, `id`, `option_icon`, `option_text`, `option_id`, `npc_option_npcflag`, `action_menu_id`, `action_poi_id`, `action_script_id`, `box_coded`, `box_money`, `box_text`, `condition_id`) VALUES (1294, 4, 0, 'Tell me about dungeons I could explore.', 1, 1, 6029, 0, 0, 0, 0, NULL, 4500); +INSERT INTO `gossip_menu_option` (`menu_id`, `id`, `option_icon`, `option_text`, `option_id`, `npc_option_npcflag`, `action_menu_id`, `action_poi_id`, `action_script_id`, `box_coded`, `box_money`, `box_text`, `condition_id`) VALUES (1296, 5, 0, 'Tell me about dungeons I could explore.', 1, 1, 6029, 0, 0, 0, 0, NULL, 4500); +INSERT INTO `gossip_menu_option` (`menu_id`, `id`, `option_icon`, `option_text`, `option_id`, `npc_option_npcflag`, `action_menu_id`, `action_poi_id`, `action_script_id`, `box_coded`, `box_money`, `box_text`, `condition_id`) VALUES (1297, 4, 0, 'Tell me about dungeons I could explore.', 1, 1, 6029, 0, 0, 0, 0, NULL, 4500); +INSERT INTO `gossip_menu_option` (`menu_id`, `id`, `option_icon`, `option_text`, `option_id`, `npc_option_npcflag`, `action_menu_id`, `action_poi_id`, `action_script_id`, `box_coded`, `box_money`, `box_text`, `condition_id`) VALUES (1581, 4, 0, 'Tell me about dungeons I could explore.', 1, 1, 6029, 0, 0, 0, 0, NULL, 4500); +INSERT INTO `gossip_menu_option` (`menu_id`, `id`, `option_icon`, `option_text`, `option_id`, `npc_option_npcflag`, `action_menu_id`, `action_poi_id`, `action_script_id`, `box_coded`, `box_money`, `box_text`, `condition_id`) VALUES (2890, 4, 0, 'Tell me about dungeons I could explore.', 1, 1, 6029, 0, 0, 0, 0, NULL, 4500); +INSERT INTO `gossip_menu_option` (`menu_id`, `id`, `option_icon`, `option_text`, `option_id`, `npc_option_npcflag`, `action_menu_id`, `action_poi_id`, `action_script_id`, `box_coded`, `box_money`, `box_text`, `condition_id`) VALUES (6059, 4, 0, 'Tell me about dungeons I could explore.', 1, 1, 6029, 0, 0, 0, 0, NULL, 4500); +INSERT INTO `gossip_menu_option` (`menu_id`, `id`, `option_icon`, `option_text`, `option_id`, `npc_option_npcflag`, `action_menu_id`, `action_poi_id`, `action_script_id`, `box_coded`, `box_money`, `box_text`, `condition_id`) VALUES (6525, 4, 0, 'Tell me about dungeons I could explore.', 1, 1, 6029, 0, 0, 0, 0, NULL, 4500); + +-- Scripts to queue for the dungeons. +INSERT INTO `gossip_scripts` (`id`, `delay`, `command`, `datalong`, `datalong2`, `datalong3`, `datalong4`, `data_flags`, `dataint`, `dataint2`, `dataint3`, `dataint4`, `x`, `y`, `z`, `o`, `comments`) VALUES (2000, 0, 36, 2437, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 'Meetingstone - Ragefire Chasm'); +INSERT INTO `gossip_scripts` (`id`, `delay`, `command`, `datalong`, `datalong2`, `datalong3`, `datalong4`, `data_flags`, `dataint`, `dataint2`, `dataint3`, `dataint4`, `x`, `y`, `z`, `o`, `comments`) VALUES (2001, 0, 36, 1581, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 'Meetingstone - The Deadmines'); +INSERT INTO `gossip_scripts` (`id`, `delay`, `command`, `datalong`, `datalong2`, `datalong3`, `datalong4`, `data_flags`, `dataint`, `dataint2`, `dataint3`, `dataint4`, `x`, `y`, `z`, `o`, `comments`) VALUES (2002, 0, 36, 718, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 'Meetingstone - Wailing Caverns'); +INSERT INTO `gossip_scripts` (`id`, `delay`, `command`, `datalong`, `datalong2`, `datalong3`, `datalong4`, `data_flags`, `dataint`, `dataint2`, `dataint3`, `dataint4`, `x`, `y`, `z`, `o`, `comments`) VALUES (2003, 0, 36, 209, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 'Meetingstone - Shadowfang Keep'); +INSERT INTO `gossip_scripts` (`id`, `delay`, `command`, `datalong`, `datalong2`, `datalong3`, `datalong4`, `data_flags`, `dataint`, `dataint2`, `dataint3`, `dataint4`, `x`, `y`, `z`, `o`, `comments`) VALUES (2004, 0, 36, 719, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 'Meetingstone - Blackfathom Depths'); +INSERT INTO `gossip_scripts` (`id`, `delay`, `command`, `datalong`, `datalong2`, `datalong3`, `datalong4`, `data_flags`, `dataint`, `dataint2`, `dataint3`, `dataint4`, `x`, `y`, `z`, `o`, `comments`) VALUES (2005, 0, 36, 717, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 'Meetingstone - The Stockade'); +INSERT INTO `gossip_scripts` (`id`, `delay`, `command`, `datalong`, `datalong2`, `datalong3`, `datalong4`, `data_flags`, `dataint`, `dataint2`, `dataint3`, `dataint4`, `x`, `y`, `z`, `o`, `comments`) VALUES (2006, 0, 36, 491, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 'Meetingstone - Razorfen Kraul'); +INSERT INTO `gossip_scripts` (`id`, `delay`, `command`, `datalong`, `datalong2`, `datalong3`, `datalong4`, `data_flags`, `dataint`, `dataint2`, `dataint3`, `dataint4`, `x`, `y`, `z`, `o`, `comments`) VALUES (2007, 0, 36, 133, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 'Meetingstone - Gnomeregan'); +INSERT INTO `gossip_scripts` (`id`, `delay`, `command`, `datalong`, `datalong2`, `datalong3`, `datalong4`, `data_flags`, `dataint`, `dataint2`, `dataint3`, `dataint4`, `x`, `y`, `z`, `o`, `comments`) VALUES (2008, 0, 36, 796, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 'Meetingstone - Scarlet Monastery'); +INSERT INTO `gossip_scripts` (`id`, `delay`, `command`, `datalong`, `datalong2`, `datalong3`, `datalong4`, `data_flags`, `dataint`, `dataint2`, `dataint3`, `dataint4`, `x`, `y`, `z`, `o`, `comments`) VALUES (2009, 0, 36, 722, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 'Meetingstone - Razorfen Downs'); +INSERT INTO `gossip_scripts` (`id`, `delay`, `command`, `datalong`, `datalong2`, `datalong3`, `datalong4`, `data_flags`, `dataint`, `dataint2`, `dataint3`, `dataint4`, `x`, `y`, `z`, `o`, `comments`) VALUES (2010, 0, 36, 2100, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 'Meetingstone - Maraudon'); +INSERT INTO `gossip_scripts` (`id`, `delay`, `command`, `datalong`, `datalong2`, `datalong3`, `datalong4`, `data_flags`, `dataint`, `dataint2`, `dataint3`, `dataint4`, `x`, `y`, `z`, `o`, `comments`) VALUES (2011, 0, 36, 1517, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 'Meetingstone - Uldaman'); +INSERT INTO `gossip_scripts` (`id`, `delay`, `command`, `datalong`, `datalong2`, `datalong3`, `datalong4`, `data_flags`, `dataint`, `dataint2`, `dataint3`, `dataint4`, `x`, `y`, `z`, `o`, `comments`) VALUES (2012, 0, 36, 978, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 'Meetingstone - Zul\'Farrak'); +INSERT INTO `gossip_scripts` (`id`, `delay`, `command`, `datalong`, `datalong2`, `datalong3`, `datalong4`, `data_flags`, `dataint`, `dataint2`, `dataint3`, `dataint4`, `x`, `y`, `z`, `o`, `comments`) VALUES (2013, 0, 36, 1584, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 'Meetingstone - Blackrock Depths'); +INSERT INTO `gossip_scripts` (`id`, `delay`, `command`, `datalong`, `datalong2`, `datalong3`, `datalong4`, `data_flags`, `dataint`, `dataint2`, `dataint3`, `dataint4`, `x`, `y`, `z`, `o`, `comments`) VALUES (2014, 0, 36, 1477, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 'Meetingstone - Sunken Temple'); +INSERT INTO `gossip_scripts` (`id`, `delay`, `command`, `datalong`, `datalong2`, `datalong3`, `datalong4`, `data_flags`, `dataint`, `dataint2`, `dataint3`, `dataint4`, `x`, `y`, `z`, `o`, `comments`) VALUES (2015, 0, 36, 1583, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 'Meetingstone - Blackrock Spire'); +INSERT INTO `gossip_scripts` (`id`, `delay`, `command`, `datalong`, `datalong2`, `datalong3`, `datalong4`, `data_flags`, `dataint`, `dataint2`, `dataint3`, `dataint4`, `x`, `y`, `z`, `o`, `comments`) VALUES (2016, 0, 36, 2557, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 'Meetingstone - Dire Maul'); +INSERT INTO `gossip_scripts` (`id`, `delay`, `command`, `datalong`, `datalong2`, `datalong3`, `datalong4`, `data_flags`, `dataint`, `dataint2`, `dataint3`, `dataint4`, `x`, `y`, `z`, `o`, `comments`) VALUES (2017, 0, 36, 2017, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 'Meetingstone - Stratholme'); +INSERT INTO `gossip_scripts` (`id`, `delay`, `command`, `datalong`, `datalong2`, `datalong3`, `datalong4`, `data_flags`, `dataint`, `dataint2`, `dataint3`, `dataint4`, `x`, `y`, `z`, `o`, `comments`) VALUES (2018, 0, 36, 2057, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 'Meetingstone - Scholomance'); + +-- Add min and max patch support to gameobject table. +ALTER TABLE `gameobject` + ADD COLUMN `patch_min` TINYINT(3) UNSIGNED NOT NULL DEFAULT '0' AFTER `visibilitymod`, + ADD COLUMN `patch_max` TINYINT(3) UNSIGNED NOT NULL DEFAULT '10' AFTER `patch_min`; + +-- Assign minimum patch to meeting stone spawns. +UPDATE `gameobject` SET `patch_min`=1 WHERE `id` IN (178824, 178825, 178826, 178827, 178828, 178829, 178831, 178832, 178833, 178834, 178844, 178845, 178884, 179554, 179555, 179584, 179585, 179595, 179596); + + +-- End of migration. +END IF; +END?? +delimiter ; +CALL add_migration(); +DROP PROCEDURE IF EXISTS add_migration; diff --git a/src/game/CMakeLists.txt b/src/game/CMakeLists.txt index 9ab5ef3d3..417fa3f9e 100644 --- a/src/game/CMakeLists.txt +++ b/src/game/CMakeLists.txt @@ -121,6 +121,7 @@ set (game_SRCS Handlers/GroupHandler.cpp Handlers/GuildHandler.cpp Handlers/ItemHandler.cpp + Handlers/LFGHandler.cpp Handlers/LootHandler.cpp Handlers/MailHandler.cpp Handlers/MiscHandler.cpp @@ -134,6 +135,7 @@ set (game_SRCS Handlers/SpellHandler.cpp Handlers/TaxiHandler.cpp Handlers/TradeHandler.cpp + LFG/LFGMgr.cpp Mail/Mail.cpp Mail/MassMailMgr.cpp MapNodes/AbstractPlayer.cpp @@ -309,6 +311,8 @@ set (game_SRCS Guild/GuildMgr.h Handlers/AddonHandler.h Handlers/NPCHandler.h + Handlers/LFGHandler.h + LFG/LFGMgr.h Mail/Mail.h Mail/MassMailMgr.h MapNodes/AbstractPlayer.h @@ -476,6 +480,7 @@ include_directories( ${CMAKE_CURRENT_SOURCE_DIR}/Group ${CMAKE_CURRENT_SOURCE_DIR}/Guild ${CMAKE_CURRENT_SOURCE_DIR}/Handlers + ${CMAKE_CURRENT_SOURCE_DIR}/LFG ${CMAKE_CURRENT_SOURCE_DIR}/Mail ${CMAKE_CURRENT_SOURCE_DIR}/MapNodes ${CMAKE_CURRENT_SOURCE_DIR}/MapNodes/Handlers diff --git a/src/game/Group/Group.cpp b/src/game/Group/Group.cpp index ce6e49dc9..39005c339 100644 --- a/src/game/Group/Group.cpp +++ b/src/game/Group/Group.cpp @@ -36,6 +36,8 @@ #include "Util.h" #include "LootMgr.h" #include "SpellMgr.h" +#include "LFGMgr.h" +#include "LFGHandler.h" GroupMemberStatus GetGroupMemberStatus(const Player *member = nullptr) { @@ -77,7 +79,7 @@ void Roll::targetObjectBuildLink() Group::Group() : m_Id(0), m_groupType(GROUPTYPE_NORMAL), m_bgGroup(NULL), m_lootMethod(FREE_FOR_ALL), m_lootThreshold(ITEM_QUALITY_UNCOMMON), - m_subGroupsCounts(NULL), m_groupTeam(TEAM_NONE), m_leaderLastOnline(0) + m_subGroupsCounts(NULL), m_groupTeam(TEAM_NONE), m_leaderLastOnline(0), m_LFGAreaId(0) { } @@ -307,7 +309,7 @@ Player* Group::GetInvited(const std::string& name) const return NULL; } -bool Group::AddMember(ObjectGuid guid, const char* name) +bool Group::AddMember(ObjectGuid guid, const char* name, uint8 joinMethod) { if (!_addMember(guid, name)) return false; @@ -336,6 +338,21 @@ bool Group::AddMember(ObjectGuid guid, const char* name) // quest related GO state dependent from raid membership if (isRaidGroup()) player->UpdateForQuestWorldObjects(); + + if (isInLFG()) + { + if (joinMethod == GROUP_LFG) + { + + } + else + { + player->GetSession()->SendMeetingstoneSetqueue(m_LFGAreaId, MEETINGSTONE_STATUS_JOINED_QUEUE); + + sLFGMgr.UpdateGroup(m_Id); + } + } + // Cancel instance reset Map* map = player->GetMap(); if (map->IsDungeon()) @@ -351,7 +368,7 @@ bool Group::AddMember(ObjectGuid guid, const char* name) return true; } -uint32 Group::RemoveMember(ObjectGuid guid, uint8 method) +uint32 Group::RemoveMember(ObjectGuid guid, uint8 removeMethod) { // remove member and change leader (if need) only if strong more 2 members _before_ member remove if (GetMembersCount() > GetMembersMinCount()) @@ -366,10 +383,31 @@ uint32 Group::RemoveMember(ObjectGuid guid, uint8 method) WorldPacket data; - if (method == 1) + if (removeMethod == GROUP_KICK) { data.Initialize(SMSG_GROUP_UNINVITE, 0); player->GetSession()->SendPacket(&data); + + if (isInLFG()) + { + data.Initialize(SMSG_MEETINGSTONE_SETQUEUE, 5); + data << 0 << uint8(MEETINGSTONE_STATUS_PARTY_MEMBER_REMOVED_PARTY_REMOVED); + + BroadcastPacket(&data, true); + sLFGMgr.RemoveGroupFromQueue(m_Id); + + player->GetSession()->SendMeetingstoneSetqueue(m_LFGAreaId, MEETINGSTONE_STATUS_LOOKING_FOR_NEW_PARTY_IN_QUEUE); + sLFGMgr.AddToQueue(player, m_LFGAreaId); + } + } + + if (removeMethod == GROUP_LEAVE && isInLFG()) + { + player->GetSession()->SendMeetingstoneSetqueue(0, MEETINGSTONE_STATUS_NONE); + + data.Initialize(SMSG_MEETINGSTONE_SETQUEUE, 5); + data << m_LFGAreaId << uint8(MEETINGSTONE_STATUS_PARTY_MEMBER_LEFT_LFG); + BroadcastPacket(&data, true); } //we already removed player from group and in player->GetGroup() is his original group! @@ -390,8 +428,13 @@ uint32 Group::RemoveMember(ObjectGuid guid, uint8 method) WorldPacket data(SMSG_GROUP_SET_LEADER, (m_leaderName.size() + 1)); data << m_leaderName; BroadcastPacket(&data, true); + + sLFGMgr.RemoveGroupFromQueue(m_Id); } + if (isInLFG()) + sLFGMgr.UpdateGroup(m_Id); + SendUpdate(); } // if group before remove <= 2 disband it @@ -460,6 +503,16 @@ void Group::Disband(bool hideDestroy) data.Initialize(SMSG_GROUP_LIST, 24); data << uint64(0) << uint64(0) << uint64(0); player->GetSession()->SendPacket(&data); + + if (isInLFG()) + { + sLFGMgr.RemoveGroupFromQueue(m_Id); + + data.Initialize(SMSG_MEETINGSTONE_SETQUEUE, 5); + data << 0 << MEETINGSTONE_STATUS_NONE; + + player->GetSession()->SendPacket(&data); + } } _homebindIfInstance(player); @@ -483,6 +536,132 @@ void Group::Disband(bool hideDestroy) m_leaderName = ""; } +/*********************************************************/ +/*** LFG SYSTEM ***/ +/*********************************************************/ + +void Group::CalculateLFGRoles(LFGGroupQueueInfo& data) +{ + uint32 m_initRoles = (LFG_ROLE_TANK | LFG_ROLE_DPS | LFG_ROLE_HEALER); + std::vector m_processed; + uint32 dpsCount = 0; + + for (member_citerator citr = GetMemberSlots().begin(); citr != GetMemberSlots().end(); ++citr) + { + ClassRoles lfgRole; + + lfgRole = sLFGMgr.CalculateRoles((Classes)sObjectMgr.GetPlayerClassByGUID(citr->guid)); + + if ((sLFGMgr.canPerformRole(lfgRole, LFG_ROLE_TANK) & m_initRoles) == LFG_ROLE_TANK && !inLFGGroup(m_processed, citr->guid)) + { + FillPremadeLFG(citr->guid, LFG_ROLE_TANK, m_initRoles, dpsCount, m_processed); + } + + if ((sLFGMgr.canPerformRole(lfgRole, LFG_ROLE_HEALER) & m_initRoles) == LFG_ROLE_HEALER && !inLFGGroup(m_processed, citr->guid)) + { + FillPremadeLFG(citr->guid, LFG_ROLE_HEALER, m_initRoles, dpsCount, m_processed); + } + + if ((sLFGMgr.canPerformRole(lfgRole, LFG_ROLE_DPS) & m_initRoles) == LFG_ROLE_DPS && !inLFGGroup(m_processed, citr->guid)) + { + FillPremadeLFG(citr->guid, LFG_ROLE_DPS, m_initRoles, dpsCount, m_processed); + } + } + + data.availableRoles = (ClassRoles)m_initRoles; + data.dpsCount = dpsCount; +} + +void Group::FillPremadeLFG(ObjectGuid plrGuid, ClassRoles requiredRole, uint32& InitRoles, uint32& DpsCount, std::vector& playersProcessed) +{ + Classes plrClass = (Classes)sObjectMgr.GetPlayerClassByGUID(plrGuid); + + if (sLFGMgr.getPriority(plrClass, requiredRole) >= LFG_PRIORITY_HIGH && !inLFGGroup(playersProcessed, plrGuid)) + { + switch (requiredRole) + { + case LFG_ROLE_TANK: + { + InitRoles &= ~LFG_ROLE_TANK; + break; + } + + case LFG_ROLE_HEALER: + { + InitRoles &= ~LFG_ROLE_HEALER; + break; + } + + case LFG_ROLE_DPS: + { + if (DpsCount < 3) + { + ++DpsCount; + + if (DpsCount >= 3) + InitRoles &= ~LFG_ROLE_DPS; + } + break; + } + default: + break; + } + playersProcessed.push_back(plrGuid); + } + else if (sLFGMgr.getPriority(plrClass, requiredRole) < LFG_PRIORITY_HIGH && !inLFGGroup(playersProcessed, plrGuid)) + { + bool hasFoundPriority = false; + + for (member_citerator citr = GetMemberSlots().begin(); citr != GetMemberSlots().end(); ++citr) + { + if (plrGuid == citr->guid) + continue; + + Classes memberClass = (Classes)sObjectMgr.GetPlayerClassByGUID(plrGuid); + + if (sLFGMgr.getPriority(plrClass, requiredRole) < sLFGMgr.getPriority(memberClass, requiredRole) && !inLFGGroup(playersProcessed, plrGuid)) + { + hasFoundPriority = true; + } + } + + if (!hasFoundPriority) + { + switch (requiredRole) + { + case LFG_ROLE_TANK: + { + InitRoles &= ~LFG_ROLE_TANK; + break; + } + + case LFG_ROLE_HEALER: + { + InitRoles &= ~LFG_ROLE_HEALER; + break; + + } + + case LFG_ROLE_DPS: + { + if (DpsCount < 3) + { + ++DpsCount; + + if (DpsCount >= 3) + InitRoles &= ~LFG_ROLE_DPS; + } + break; + } + default: + break; + } + + playersProcessed.push_back(plrGuid); + } + } +} + /*********************************************************/ /*** LOOT SYSTEM ***/ /*********************************************************/ diff --git a/src/game/Group/Group.h b/src/game/Group/Group.h index 584fec4a4..3713e40a9 100644 --- a/src/game/Group/Group.h +++ b/src/game/Group/Group.h @@ -30,6 +30,8 @@ #include "LootMgr.h" #include "DBCEnums.h" #include "SharedDefines.h" +#include "LFGHandler.h" +#include "LFGMgr.h" #include #include @@ -55,6 +57,18 @@ enum LootMethod NEED_BEFORE_GREED = 4 }; +enum RemoveMethod +{ + GROUP_LEAVE = 0, + GROUP_KICK = 1 +}; + +enum InviteMethod +{ + GROUP_JOIN = 0, + GROUP_LFG = 1 +}; + enum RollVote { ROLL_PASS = 0, @@ -188,8 +202,8 @@ class MANGOS_DLL_SPEC Group uint32 RemoveInvite(Player *player); void RemoveAllInvites(); bool AddLeaderInvite(Player *player); - bool AddMember(ObjectGuid guid, const char* name); - uint32 RemoveMember(ObjectGuid guid, uint8 method); // method: 0=just remove, 1=kick + bool AddMember(ObjectGuid guid, const char* name, uint8 joinMethod = GROUP_JOIN); + uint32 RemoveMember(ObjectGuid guid, uint8 removeMethod); // method: 0=just remove, 1=kick void ChangeLeader(ObjectGuid guid); void SetLootMethod(LootMethod method) { m_lootMethod = method; } void SetLooterGuid(ObjectGuid guid) { m_looterGuid = guid; } @@ -310,6 +324,30 @@ class MANGOS_DLL_SPEC Group void RewardGroupAtKill(Unit* pVictim, Player* player_tap); + /*********************************************************/ + /*** LFG SYSTEM ***/ + /*********************************************************/ + + void SetLFGAreaId(uint32 areaId) { m_LFGAreaId = areaId; } + uint32 GetLFGAreaId() { return m_LFGAreaId; } + bool isInLFG() { return (m_LFGAreaId > 0) ? true : false; } + + void CalculateLFGRoles(LFGGroupQueueInfo& data); + void FillPremadeLFG(ObjectGuid plrGuid, ClassRoles requiredRole, uint32& InitRoles, uint32& DpsCount, std::vector& playersProcessed); + + bool inLFGGroup(std::vector processed, ObjectGuid plr) + { + for (uint32 i = 0; i < processed.size(); ++i) + { + if (processed[i] == plr) + { + return true; + } + } + + return false; + } + /*********************************************************/ /*** LOOT SYSTEM ***/ /*********************************************************/ @@ -417,5 +455,6 @@ class MANGOS_DLL_SPEC Group BoundInstancesMap m_boundInstances; uint8* m_subGroupsCounts; Team m_groupTeam; // ALLIANCE / HORDE / TEAM_NONE / TEAM_CROSSFACTION + uint32 m_LFGAreaId; }; #endif diff --git a/src/game/Handlers/CharacterHandler.cpp b/src/game/Handlers/CharacterHandler.cpp index e991a7946..c13688988 100644 --- a/src/game/Handlers/CharacterHandler.cpp +++ b/src/game/Handlers/CharacterHandler.cpp @@ -791,15 +791,6 @@ void WorldSession::HandleSetFactionAtWarOpcode(WorldPacket & recv_data) GetPlayer()->GetReputationMgr().SetAtWar(repListID, flag); } -void WorldSession::HandleMeetingStoneInfoOpcode(WorldPacket & /*recv_data*/) -{ - DEBUG_LOG("WORLD: Received CMSG_MEETING_STONE_INFO"); - - WorldPacket data(SMSG_MEETINGSTONE_SETQUEUE, 5); - data << uint32(0) << uint8(6); - SendPacket(&data); -} - void WorldSession::HandleTutorialFlagOpcode(WorldPacket & recv_data) { uint32 iFlag; diff --git a/src/game/Handlers/LFGHandler.cpp b/src/game/Handlers/LFGHandler.cpp new file mode 100644 index 000000000..7ab2b7de1 --- /dev/null +++ b/src/game/Handlers/LFGHandler.cpp @@ -0,0 +1,147 @@ +/** + * MaNGOS is a full featured server for World of Warcraft, supporting + * the following clients: 1.12.x, 2.4.3, 3.3.5a, 4.3.4a and 5.4.8 + * + * Copyright (C) 2005-2017 MaNGOS project + * + * 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 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * World of Warcraft, and all World of Warcraft or Warcraft art, images, + * and lore are copyrighted by Blizzard Entertainment, Inc. + */ + +#include "Common.h" +#include "WorldPacket.h" +#include "Opcodes.h" +#include "Log.h" +#include "Player.h" +#include "ObjectMgr.h" +#include "WorldSession.h" +#include "Object.h" +#include "Chat.h" +#include "Language.h" +#include "ScriptMgr.h" +#include "World.h" +#include "Group.h" +#include "LFGHandler.h" +#include "LFGMgr.h" + +void WorldSession::HandleMeetingStoneJoinOpcode(WorldPacket& recv_data) +{ + ObjectGuid guid; + + recv_data >> guid; + + DEBUG_LOG("WORLD: Recvd CMSG_MEETINGSTONE_JOIN Message guid: %s", guid.GetString().c_str()); + + // ignore for remote control state + if (!_player->IsSelfMover()) + { return; } + + GameObject *obj = GetPlayer()->GetMap()->GetGameObject(guid); + + if (!obj) + { return; } + + // Never expect this opcode for some type GO's + if (obj->GetGoType() != GAMEOBJECT_TYPE_MEETINGSTONE) + { + sLog.outError("HandleMeetingStoneJoinOpcode: CMSG_MEETINGSTONE_JOIN for not allowed GameObject type %u (Entry %u), didn't expect this to happen.", obj->GetGoType(), obj->GetEntry()); + return; + } + + if (Group* grp = _player->GetGroup()) + { + if (!grp->IsLeader(_player->GetObjectGuid())) + { + SendMeetingstoneFailed(MEETINGSTONE_FAIL_PARTYLEADER); + + return; + } + + if (grp->isRaidGroup()) + { + SendMeetingstoneFailed(MEETINGSTONE_FAIL_RAID_GROUP); + return; + } + + if (grp->IsFull()) + { + SendMeetingstoneFailed(MEETINGSTONE_FAIL_FULL_GROUP); + return; + } + } + + + GameObjectInfo const* gInfo = ObjectMgr::GetGameObjectInfo(obj->GetEntry()); + + sLFGMgr.AddToQueue(_player, gInfo->meetingstone.areaID); +} + +void WorldSession::HandleMeetingStoneLeaveOpcode(WorldPacket& /*recv_data*/) +{ + DEBUG_LOG("WORLD: Recvd CMSG_MEETINGSTONE_LEAVE"); + if(Group *grp = _player->GetGroup()) + { + if(grp->IsLeader(_player->GetObjectGuid()) && grp->isInLFG()) + { + sLFGMgr.RemoveGroupFromQueue(grp->GetId()); + } + else + { + SendMeetingstoneSetqueue(0, MEETINGSTONE_STATUS_NONE); + } + } + else + { + sLFGMgr.RemovePlayerFromQueue(_player->GetObjectGuid()); + } +} + +void WorldSession::HandleMeetingStoneInfoOpcode(WorldPacket & /*recv_data*/) +{ + DEBUG_LOG("WORLD: Received CMSG_MEETING_STONE_INFO"); + + if(Group *grp = _player->GetGroup()) + { + if(grp->isInLFG()) + { + SendMeetingstoneSetqueue(grp->GetLFGAreaId(), MEETINGSTONE_STATUS_JOINED_QUEUE); + } + else + { + SendMeetingstoneSetqueue(0, MEETINGSTONE_STATUS_NONE); + } + } + else + { + sLFGMgr.RestoreOfflinePlayer(_player->GetObjectGuid()); + } +} + +void WorldSession::SendMeetingstoneFailed(uint8 status) +{ + WorldPacket data(SMSG_MEETINGSTONE_JOINFAILED, 1); + data << uint8(status); + SendPacket(&data); +} + +void WorldSession::SendMeetingstoneSetqueue(uint32 areaid, uint8 status) +{ + WorldPacket data(SMSG_MEETINGSTONE_SETQUEUE, 5); + data << uint32(areaid); + data << uint8(status); + SendPacket(&data); +} diff --git a/src/game/Handlers/LFGHandler.h b/src/game/Handlers/LFGHandler.h new file mode 100644 index 000000000..5e090daa9 --- /dev/null +++ b/src/game/Handlers/LFGHandler.h @@ -0,0 +1,48 @@ +/** + * MaNGOS is a full featured server for World of Warcraft, supporting + * the following clients: 1.12.x, 2.4.3, 3.3.5a, 4.3.4a and 5.4.8 + * + * Copyright (C) 2005-2017 MaNGOS project + * + * 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 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * World of Warcraft, and all World of Warcraft or Warcraft art, images, + * and lore are copyrighted by Blizzard Entertainment, Inc. + */ + + +#ifndef MANGOSSERVER_LFGHANDLER_H +#define MANGOSSERVER_LFGHANDLER_H + +enum MeetingstoneQueueStatus +{ + MEETINGSTONE_STATUS_LEAVE_QUEUE = 0, + MEETINGSTONE_STATUS_JOINED_QUEUE = 1, + MEETINGSTONE_STATUS_PARTY_MEMBER_LEFT_LFG = 2, + MEETINGSTONE_STATUS_PARTY_MEMBER_REMOVED_PARTY_REMOVED = 3, + MEETINGSTONE_STATUS_LOOKING_FOR_NEW_PARTY_IN_QUEUE = 4, + MEETINGSTONE_STATUS_NONE = 5 +}; + +enum MeetingstoneFailedStatus +{ + MEETINGSTONE_FAIL_NONE = 0, // custom, not to be sent + MEETINGSTONE_FAIL_PARTYLEADER = 1, + MEETINGSTONE_FAIL_FULL_GROUP = 2, + MEETINGSTONE_FAIL_RAID_GROUP = 3, + //MEETINGSTONE_FAIL_NONE_UNK = 4 [-ZERO] +}; + +#endif diff --git a/src/game/Handlers/SpellHandler.cpp b/src/game/Handlers/SpellHandler.cpp index dddfd4009..1031d16c0 100644 --- a/src/game/Handlers/SpellHandler.cpp +++ b/src/game/Handlers/SpellHandler.cpp @@ -281,30 +281,6 @@ void WorldSession::HandleGameObjectUseOpcode(WorldPacket & recv_data) } } -void WorldSession::HandleMeetingStoneJoinOpcode(WorldPacket & recv_data) -{ - ObjectGuid guid; - - recv_data >> guid; - - DEBUG_LOG("WORLD: Recvd CMSG_MEETINGSTONE_JOIN Message guid: %s", guid.GetString().c_str()); - - // ignore for remote control state - if (!_player->IsSelfMover()) - return; - - GameObject *obj = GetPlayer()->GetMap()->GetGameObject(guid); - if (!obj) - return; - - // Never expect this opcode for some type GO's - if (obj->GetGoType() != GAMEOBJECT_TYPE_MEETINGSTONE) - return; - - _player->RemoveAurasWithInterruptFlags(AURA_INTERRUPT_FLAG_USE); - obj->Use(_player); -} - void WorldSession::HandleCastSpellOpcode(WorldPacket& recvPacket) { uint32 spellId; diff --git a/src/game/LFG/LFGMgr.cpp b/src/game/LFG/LFGMgr.cpp new file mode 100644 index 000000000..ab5bbad20 --- /dev/null +++ b/src/game/LFG/LFGMgr.cpp @@ -0,0 +1,608 @@ +/** + * MaNGOS is a full featured server for World of Warcraft, supporting + * the following clients: 1.12.x, 2.4.3, 3.3.5a, 4.3.4a and 5.4.8 + * + * Copyright (C) 2005-2017 MaNGOS project + * + * 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 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * World of Warcraft, and all World of Warcraft or Warcraft art, images, + * and lore are copyrighted by Blizzard Entertainment, Inc. + */ + +#include "Policies/SingletonImp.h" +#include "Common.h" +#include "ProgressBar.h" +#include "SharedDefines.h" +#include "Player.h" +#include "Map.h" +#include "ObjectMgr.h" +#include "Chat.h" +#include "World.h" +#include "WorldPacket.h" +#include "WorldSession.h" +#include "Language.h" +#include "Group.h" +#include "LFGMgr.h" +#include "LFGHandler.h" + +INSTANTIATE_SINGLETON_1(LFGQueue); + +// Add group or player into queue. If player has group and he's a leader then whole party will be added to queue. +void LFGQueue::AddToQueue(Player* leader, uint32 queAreaID) +{ + if(!leader) + return; + + if (sWorld.GetWowPatch() < WOW_PATCH_103) + return; + + Group* grp = leader->GetGroup(); + + //add players from group to queue list & group to group list + // Calculate what roles group need and add it to the GroupQueueList, (DONT'ADD PLAYERS!) + if (grp && grp->IsLeader(leader->GetObjectGuid())) + { + // Add group to queued groups list + LFGGroupQueueInfo& i_Group = m_QueuedGroups[grp->GetId()]; + + grp->CalculateLFGRoles(i_Group); + i_Group.team = leader->GetTeam(); + i_Group.areaId = queAreaID; + i_Group.groupTimer = 5 * MINUTE * IN_MILLISECONDS; // Minute timer for SMSG_MEETINGSTONE_IN_PROGRESS + + grp->SetLFGAreaId(queAreaID); + + WorldPacket data; + BuildSetQueuePacket(data, queAreaID, MEETINGSTONE_STATUS_JOINED_QUEUE); + + grp->BroadcastPacket(&data, true); + } + else if(!grp) + { + // Add player to queued players list + LFGPlayerQueueInfo& i_Player = m_QueuedPlayers[leader->GetObjectGuid()]; + + i_Player.roleMask = CalculateRoles((Classes)leader->getClass()); + i_Player.team = leader->GetTeam(); + i_Player.areaId = queAreaID; + i_Player.hasQueuePriority = false; + + leader->GetSession()->SendMeetingstoneSetqueue(queAreaID, MEETINGSTONE_STATUS_JOINED_QUEUE); + } +} + +void LFGQueue::RestoreOfflinePlayer(ObjectGuid plrGuid) +{ + Player* plr = sObjectMgr.GetPlayer(plrGuid); + + // Should not happen, but there's always chance of quick disconnection + if(!plr) + return; + + QueuedPlayersMap::iterator offlinePlr = m_OfflinePlayers.find(plrGuid); + + if(offlinePlr != m_OfflinePlayers.end()) + { + plr->GetSession()->SendMeetingstoneSetqueue(offlinePlr->second.areaId, MEETINGSTONE_STATUS_JOINED_QUEUE); + m_QueuedPlayers[plrGuid] = offlinePlr->second; + m_OfflinePlayers.erase(offlinePlr); + } + else + { + plr->GetSession()->SendMeetingstoneSetqueue(0, MEETINGSTONE_STATUS_NONE); + } +} + +ClassRoles LFGQueue::CalculateRoles(Classes playerClass) +{ + switch (playerClass) + { + case CLASS_DRUID: return (ClassRoles)(LFG_ROLE_TANK | LFG_ROLE_DPS | LFG_ROLE_HEALER); + case CLASS_HUNTER: return (ClassRoles)(LFG_ROLE_DPS); + case CLASS_MAGE: return (ClassRoles)(LFG_ROLE_DPS); + case CLASS_PALADIN: return (ClassRoles)(LFG_ROLE_TANK | LFG_ROLE_DPS | LFG_ROLE_HEALER); + case CLASS_PRIEST: return (ClassRoles)(LFG_ROLE_DPS | LFG_ROLE_HEALER); + case CLASS_ROGUE: return (ClassRoles)(LFG_ROLE_DPS); + case CLASS_SHAMAN: return (ClassRoles)(LFG_ROLE_DPS | LFG_ROLE_HEALER); + case CLASS_WARLOCK: return (ClassRoles)(LFG_ROLE_DPS); + case CLASS_WARRIOR: return (ClassRoles)(LFG_ROLE_TANK | LFG_ROLE_DPS); + default: return (ClassRoles)(LFG_ROLE_NONE); + } +} + +RolesPriority LFGQueue::getPriority(Classes playerClass, ClassRoles playerRoles) +{ + switch (playerRoles) + { + case LFG_ROLE_TANK: + { + switch (playerClass) + { + case CLASS_DRUID: return LFG_PRIORITY_NORMAL; + case CLASS_PALADIN: return LFG_PRIORITY_NORMAL; + case CLASS_WARRIOR: return LFG_PRIORITY_HIGH; + default: return LFG_PRIORITY_NONE; + } + break; + } + + case LFG_ROLE_HEALER: + { + switch (playerClass) + { + case CLASS_DRUID: return LFG_PRIORITY_HIGH; + case CLASS_PALADIN: return LFG_PRIORITY_HIGH; + case CLASS_PRIEST: return LFG_PRIORITY_HIGH; + case CLASS_SHAMAN: return LFG_PRIORITY_HIGH; + default: return LFG_PRIORITY_NONE; + } + + break; + } + + case LFG_ROLE_DPS: + { + switch (playerClass) + { + case CLASS_DRUID: return LFG_PRIORITY_NORMAL; + case CLASS_HUNTER: return LFG_PRIORITY_HIGH; + case CLASS_MAGE: return LFG_PRIORITY_HIGH; + case CLASS_PALADIN: return LFG_PRIORITY_NORMAL; + case CLASS_PRIEST: return LFG_PRIORITY_LOW; + case CLASS_ROGUE: return LFG_PRIORITY_HIGH; + case CLASS_SHAMAN: return LFG_PRIORITY_NORMAL; + case CLASS_WARLOCK: return LFG_PRIORITY_HIGH; + case CLASS_WARRIOR: return LFG_PRIORITY_NORMAL; + default: return LFG_PRIORITY_NONE; + } + + break; + } + default: return LFG_PRIORITY_NONE; + } +} + +void LFGQueue::UpdateGroup(uint32 groupId) +{ + QueuedGroupsMap::iterator qGroup = m_QueuedGroups.find(groupId); + + if(qGroup != m_QueuedGroups.end()) + { + Group* grp = sObjectMgr.GetGroupById(qGroup->first); + + if(grp) + { + grp->CalculateLFGRoles(qGroup->second); + } + + } +} + +void LFGQueue::Update(uint32 diff) +{ + if(m_QueuedGroups.empty() && m_QueuedPlayers.empty()) + return; + + // Iterate over QueuedPlayersMap to update players timers and remove offline/disconnected players. + for(QueuedPlayersMap::iterator qPlayer = m_QueuedPlayers.begin(); qPlayer != m_QueuedPlayers.end(); ++qPlayer) + { + Player* plr = sObjectMgr.GetPlayer(qPlayer->first); + + // Player could have been disconnected + if(!plr ||!plr->IsInWorld()) + { + m_OfflinePlayers[qPlayer->first] = qPlayer->second; + m_QueuedPlayers.erase(qPlayer); + break; + } + + qPlayer->second.timeInLFG += diff; + + // Update player timer and give him queue priority. + if(qPlayer->second.timeInLFG >= (30 * MINUTE * IN_MILLISECONDS)) + { + qPlayer->second.hasQueuePriority = true; + } + } + + if(!m_QueuedGroups.empty()) + { + // Iterate over QueuedGroupsMap to fill groups with roles they're missing. + for(QueuedGroupsMap::iterator qGroup = m_QueuedGroups.begin(); qGroup != m_QueuedGroups.end(); ++qGroup) + { + Group* grp = sObjectMgr.GetGroupById(qGroup->first); + + // Safe check + if(!grp) + return; + + // Remove group from Queue if it's full + if(grp->IsFull()) + { + RemoveGroupFromQueue(qGroup->first, GROUP_SYSTEM_LEAVE); + break; + } + + // Iterate over QueuedPlayersMap to find suitable player to join group + for(QueuedPlayersMap::iterator qPlayer = m_QueuedPlayers.begin(); qPlayer != m_QueuedPlayers.end(); ++qPlayer) + { + Player* plr = sObjectMgr.GetPlayer(qPlayer->first); + + // Check here that players team and areaId they're in queue are same + if(qPlayer->second.team == qGroup->second.team && + qPlayer->second.areaId == qGroup->second.areaId) + { + // Check if player can perform tank role + if((canPerformRole(qPlayer->second.roleMask, LFG_ROLE_TANK) & qGroup->second.availableRoles) == LFG_ROLE_TANK) + { + if(FindRoleToGroup(plr, grp, LFG_ROLE_TANK)) + { + break; + } + else + { + continue; + } + } + + // Check if player can perform healer role + if((canPerformRole(qPlayer->second.roleMask, LFG_ROLE_HEALER) & qGroup->second.availableRoles) == LFG_ROLE_HEALER) + { + if(FindRoleToGroup(plr, grp, LFG_ROLE_HEALER)) + { + break; + } + else + { + continue; + } + } + + // Check if player can perform dps role + if((canPerformRole(qPlayer->second.roleMask, LFG_ROLE_DPS) & qGroup->second.availableRoles) == LFG_ROLE_DPS) + { + if(FindRoleToGroup(plr, grp, LFG_ROLE_DPS)) + { + break; + } + else + { + continue; + } + } + + // Check if group is full, no need to try to iterate same group if it's already full. + if(grp->IsFull()) + { + RemoveGroupFromQueue(qGroup->first, GROUP_SYSTEM_LEAVE); + break; + } + } + } + + // Update group timer. After each 5 minutes group will be broadcasted they're still waiting more members. + if (qGroup->second.groupTimer <= diff) + { + WorldPacket data; + BuildInProgressPacket(data); + + grp->BroadcastPacket(&data, true); + + qGroup->second.groupTimer = 5 * MINUTE * IN_MILLISECONDS; + } + else + { + qGroup->second.groupTimer -= diff; + } + } + } + + // Pick first 2 players and form group out of them also inserting them into queue as group. + if(m_QueuedPlayers.size() > 5) + { + // Pick Leader as first target. + QueuedPlayersMap::iterator nPlayer1 = m_QueuedPlayers.begin(); + + if(findInArea(nPlayer1->second.areaId) > 5) + { + Group* newQueueGroup = new Group; + + // Iterate of QueuedPlayersMap and pick first member to accompany leader. + for(QueuedPlayersMap::iterator nPlayer2 = m_QueuedPlayers.begin(); nPlayer2 != m_QueuedPlayers.end(); ++nPlayer2) + { + if(nPlayer1->first == nPlayer2->first) + continue; + + if(nPlayer1->second.team == nPlayer2->second.team && + nPlayer1->second.areaId == nPlayer2->second.areaId) + { + Player* leader = sObjectMgr.GetPlayer(nPlayer1->first); + Player* member = sObjectMgr.GetPlayer(nPlayer2->first); + uint32 areaId = nPlayer1->second.areaId; + + if(!newQueueGroup->IsCreated()) + { + if(newQueueGroup->Create(leader->GetObjectGuid(), leader->GetName())) + sObjectMgr.AddGroup(newQueueGroup); + else + return; + } + + WorldPacket data; + BuildMemberAddedPacket(data, member->GetObjectGuid()); + + leader->GetSession()->SendPacket(&data); + + // Add member to the group. Leader is already added upon creation of group. + newQueueGroup->AddMember(member->GetObjectGuid(), member->GetName(), GROUP_LFG); + + // Add this new group to GroupQueue now and remove players from PlayerQueue + RemovePlayerFromQueue(nPlayer1->first, PLAYER_SYSTEM_LEAVE); + RemovePlayerFromQueue(nPlayer2->first, PLAYER_SYSTEM_LEAVE); + AddToQueue(leader, areaId); + + break; + } + } + } + } +} + +bool LFGQueue::FindRoleToGroup(Player* plr, Group* grp, ClassRoles role) +{ + // Safe check + if(!plr || !grp) + return false; + + QueuedGroupsMap::iterator qGroup = m_QueuedGroups.find(grp->GetId()); + QueuedPlayersMap::iterator qPlayer = m_QueuedPlayers.find(plr->GetObjectGuid()); + + if(qGroup != m_QueuedGroups.end() && qPlayer != m_QueuedPlayers.end()) + { + if (getPriority((Classes)plr->getClass(), role) >= LFG_PRIORITY_HIGH || qPlayer->second.hasQueuePriority) + { + bool hasBeenLongerInQueue = false; + + // Iterate over QueuedPlayersMap to find if players have been longer in Queue. + for (QueuedPlayersMap::iterator qPlayer_loop = m_QueuedPlayers.begin(); qPlayer_loop != m_QueuedPlayers.end(); ++qPlayer_loop) + { + if (qPlayer->first == qPlayer_loop->first) + continue; + + if(qPlayer->second.timeInLFG > qPlayer_loop->second.timeInLFG) + hasBeenLongerInQueue = true; + } + + if(hasBeenLongerInQueue) + { + switch(role) + { + case LFG_ROLE_TANK: + { + // Remove tank flag if player can perform tank role. + qGroup->second.availableRoles &= ~LFG_ROLE_TANK; + break; + } + + case LFG_ROLE_HEALER: + { + // Remove healer flag if player can perform healer role. + qGroup->second.availableRoles &= ~LFG_ROLE_HEALER; + break; + } + + case LFG_ROLE_DPS: + { + if(qGroup->second.dpsCount < 3) + { + // Update dps count first. + ++qGroup->second.dpsCount; + + // Remove dps flag if there is enough dps in group. + if(qGroup->second.dpsCount >= 3) + qGroup->second.availableRoles &= ~LFG_ROLE_DPS; + } + break; + } + + default: + { + return false; + } + } + } + + WorldPacket data; + BuildMemberAddedPacket(data, plr->GetObjectGuid()); + grp->BroadcastPacket(&data, true); + + // Add member to the group. + grp->AddMember(plr->GetObjectGuid(), plr->GetName(), GROUP_LFG); + + // Remove player from queue. + RemovePlayerFromQueue(qPlayer->first, PLAYER_SYSTEM_LEAVE); + + // Found player return true. + return true; + } + else if (getPriority((Classes)plr->getClass(), role) < LFG_PRIORITY_HIGH) + { + bool hasFoundPriority = false; + bool hasBeenLongerInQueue = false; + + // Iterate over QueuedPlayersMap to find if players in queue have higher priority or they have been longer in Queue. + for (QueuedPlayersMap::iterator qPlayer_loop = m_QueuedPlayers.begin(); qPlayer_loop != m_QueuedPlayers.end(); ++qPlayer_loop) + { + if (qPlayer->first == qPlayer_loop->first) + continue; + + Player* m_loopMember = sObjectMgr.GetPlayer(qPlayer_loop->first); + + // If there is anyone in group for class with higher priority then ignore current member. + if (getPriority((Classes)plr->getClass(), role) < getPriority((Classes)m_loopMember->getClass(), role)) + hasFoundPriority = true; + + if(qPlayer->second.timeInLFG > qPlayer_loop->second.timeInLFG) + hasBeenLongerInQueue = true; + } + + // If there were no one in group for role with higher priority add this member to group + if(!hasFoundPriority && hasBeenLongerInQueue) + { + switch(role) + { + case LFG_ROLE_TANK: + { + // Remove tank flag if player can perform tank role. + qGroup->second.availableRoles &= ~LFG_ROLE_TANK; + break; + } + + case LFG_ROLE_HEALER: + { + // Remove healer flag if player can perform healer role. + qGroup->second.availableRoles &= ~LFG_ROLE_HEALER; + break; + } + + case LFG_ROLE_DPS: + { + if(qGroup->second.dpsCount < 3) + { + // Update dps count first. + ++qGroup->second.dpsCount; + + // Remove dps flag if there is enough dps in group. + if(qGroup->second.dpsCount >= 3) + qGroup->second.availableRoles &= ~LFG_ROLE_DPS; + } + break; + } + + // This is impossible... + default: + { + return false; + } + } + + WorldPacket data; + BuildMemberAddedPacket(data, plr->GetObjectGuid()); + grp->BroadcastPacket(&data, true); + + // Add member to the group. + grp->AddMember(plr->GetObjectGuid(), plr->GetName(), GROUP_LFG); + + // Now remove player from queue + RemovePlayerFromQueue(qPlayer->first, PLAYER_SYSTEM_LEAVE); + + // found player return true + return true; + } + } + } + + return false; +} + +bool LFGQueue::IsPlayerInQueue(ObjectGuid plrGuid) const +{ + if (m_QueuedPlayers.find(plrGuid) != m_QueuedPlayers.end()) + return true; + + return false; +} + +void LFGQueue::RemovePlayerFromQueue(ObjectGuid plrGuid, PlayerLeaveMethod leaveMethod) +{ + Player * plr = sObjectMgr.GetPlayer(plrGuid); + + if(!plr) + return; + + QueuedPlayersMap::iterator qPlayer; + qPlayer = m_QueuedPlayers.find(plrGuid); + + if(qPlayer != m_QueuedPlayers.end()) + { + if(leaveMethod == PLAYER_CLIENT_LEAVE) + { + WorldPacket data; + BuildSetQueuePacket(data, 0, MEETINGSTONE_STATUS_LEAVE_QUEUE); + plr->GetSession()->SendPacket(&data); + } + + m_QueuedPlayers.erase(qPlayer); + } +} + +void LFGQueue::RemoveGroupFromQueue(uint32 groupId, GroupLeaveMethod leaveMethod) +{ + Group* grp = sObjectMgr.GetGroupById(groupId); + + if(!grp) + return; + + QueuedGroupsMap::iterator qGroup; + qGroup = m_QueuedGroups.find(groupId); + + if(qGroup != m_QueuedGroups.end()) + { + if(leaveMethod == GROUP_CLIENT_LEAVE) + { + WorldPacket data; + BuildSetQueuePacket(data, 0, MEETINGSTONE_STATUS_LEAVE_QUEUE); + grp->BroadcastPacket(&data, true); + } + else + { + // Send complete information to party + WorldPacket data; + BuildCompletePacket(data); + grp->BroadcastPacket(&data, true); + + // Reset UI for party + BuildSetQueuePacket(data, 0, MEETINGSTONE_STATUS_NONE); + grp->BroadcastPacket(&data, true); + } + + grp->SetLFGAreaId(0); + m_QueuedGroups.erase(qGroup); + } +} + +void LFGQueue::BuildSetQueuePacket(WorldPacket &data, uint32 areaId, uint8 status) +{ + data.Initialize(SMSG_MEETINGSTONE_SETQUEUE, 5); + data << uint32(areaId); + data << uint8(status); +} + +void LFGQueue::BuildMemberAddedPacket(WorldPacket &data, ObjectGuid plrGuid) +{ + data.Initialize(SMSG_MEETINGSTONE_MEMBER_ADDED, 8); + data << uint64(plrGuid); +} + +void LFGQueue::BuildInProgressPacket(WorldPacket &data) +{ + data.Initialize(SMSG_MEETINGSTONE_IN_PROGRESS, 0); +} + +void LFGQueue::BuildCompletePacket(WorldPacket &data) +{ + data.Initialize(SMSG_MEETINGSTONE_COMPLETE, 0); +} diff --git a/src/game/LFG/LFGMgr.h b/src/game/LFG/LFGMgr.h new file mode 100644 index 000000000..21d662570 --- /dev/null +++ b/src/game/LFG/LFGMgr.h @@ -0,0 +1,137 @@ +/** + * MaNGOS is a full featured server for World of Warcraft, supporting + * the following clients: 1.12.x, 2.4.3, 3.3.5a, 4.3.4a and 5.4.8 + * + * Copyright (C) 2005-2017 MaNGOS project + * + * 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 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * World of Warcraft, and all World of Warcraft or Warcraft art, images, + * and lore are copyrighted by Blizzard Entertainment, Inc. + */ + +#ifndef MANGOSSERVER_LFGMGR_H +#define MANGOSSERVER_LFGMGR_H + +#include +#include + +#include "Policies/Singleton.h" +#include "Common.h" + +enum ClassRoles +{ + LFG_ROLE_NONE = 0x00, + LFG_ROLE_TANK = 0x01, + LFG_ROLE_HEALER = 0x02, + LFG_ROLE_DPS = 0x04 +}; + +enum RolesPriority +{ + LFG_PRIORITY_NONE = 0, + LFG_PRIORITY_LOW = 1, + LFG_PRIORITY_NORMAL = 2, + LFG_PRIORITY_HIGH = 3 +}; + +enum PlayerLeaveMethod +{ + PLAYER_CLIENT_LEAVE = 0, + PLAYER_SYSTEM_LEAVE = 1 +}; + +enum GroupLeaveMethod +{ + GROUP_CLIENT_LEAVE = 0, + GROUP_SYSTEM_LEAVE = 1 +}; + +#define MAX_DPS_COUNT = 3 + +struct LFGPlayerQueueInfo +{ + ClassRoles roleMask; + uint32 team; + uint32 areaId; + uint32 timeInLFG; + bool hasQueuePriority; +}; + +struct LFGGroupQueueInfo +{ + uint32 availableRoles; + uint32 dpsCount; + uint32 team; + uint32 areaId; + uint32 groupTimer; +}; + +class LFGQueue +{ + public: + LFGQueue() {} + ~LFGQueue() {} + + void AddToQueue(Player* leader, uint32 queAreaID); + void RestoreOfflinePlayer(ObjectGuid plrGuid); + bool FindRoleToGroup(Player* plr, Group* grp, ClassRoles role); + bool IsPlayerInQueue(ObjectGuid plrGuid) const; + void RemovePlayerFromQueue(ObjectGuid plrGuid, PlayerLeaveMethod leaveMethod = PLAYER_CLIENT_LEAVE); // 0 == by default system (cmsg, leader leave), 1 == by lfg system (no need report text you left queu) + void RemoveGroupFromQueue(uint32 groupId, GroupLeaveMethod leaveMethod = GROUP_CLIENT_LEAVE); + void Update(uint32 diff); + void UpdateGroup(uint32 groupId); + + static void BuildSetQueuePacket(WorldPacket &data, uint32 areaId, uint8 status); + static void BuildMemberAddedPacket(WorldPacket &data, ObjectGuid plrGuid); + static void BuildInProgressPacket(WorldPacket &data); + static void BuildCompletePacket(WorldPacket &data); + + ClassRoles CalculateRoles(Classes playerClass); + ClassRoles canPerformRole(ClassRoles playerRole, ClassRoles requiredRole) + { + if ((playerRole & requiredRole) == requiredRole) + return requiredRole; + + return playerRole; + } + + RolesPriority getPriority(Classes playerClass, ClassRoles playerRoles); + + private: + typedef std::map QueuedPlayersMap; + QueuedPlayersMap m_QueuedPlayers; + QueuedPlayersMap m_OfflinePlayers; + + typedef std::map QueuedGroupsMap; + QueuedGroupsMap m_QueuedGroups; + + uint32 findInArea(uint32 areaId) + { + uint32 m_QueueSize = 0; + + for(QueuedPlayersMap::iterator itr = m_QueuedPlayers.begin(); itr != m_QueuedPlayers.end(); ++itr) + { + if(itr->second.areaId == areaId) + ++m_QueueSize; + } + + return m_QueueSize; + } +}; + +#define sLFGMgr MaNGOS::Singleton::Instance() + +#endif diff --git a/src/game/Maps/Map.cpp b/src/game/Maps/Map.cpp index 1ac85b93c..10d01c462 100644 --- a/src/game/Maps/Map.cpp +++ b/src/game/Maps/Map.cpp @@ -52,6 +52,7 @@ #include "AuraRemovalMgr.h" #include "GameEventMgr.h" #include "world/world_event_wareffort.h" +#include "LFGMgr.h" #define MAX_GRID_LOAD_TIME 50 @@ -3991,6 +3992,26 @@ void Map::ScriptsProcess() } break; } + case SCRIPT_COMMAND_MEETINGSTONE: + { + Player* pPlayer = nullptr; + + if (target && target->IsPlayer()) + pPlayer = (Player*)target; + else if (source && source->IsPlayer()) + pPlayer = (Player*)source; + + // only Player + if (!pPlayer) + { + sLog.outError("SCRIPT_COMMAND_MEETINGSTONE (script id %u) call for non-player, skipping.", step.script->id); + break; + } + + if (!sLFGMgr.IsPlayerInQueue(pPlayer->GetObjectGuid())) + sLFGMgr.AddToQueue(pPlayer, step.script->meetingstone.areaId); + break; + } default: sLog.outError("Unknown SCRIPT_COMMAND_ %u called for script id %u.", step.script->command, step.script->id); break; diff --git a/src/game/ObjectMgr.cpp b/src/game/ObjectMgr.cpp index d9183d168..72ee023df 100644 --- a/src/game/ObjectMgr.cpp +++ b/src/game/ObjectMgr.cpp @@ -614,6 +614,28 @@ Team ObjectMgr::GetPlayerTeamByGUID(ObjectGuid guid) const return TEAM_NONE; } +uint8 ObjectMgr::GetPlayerClassByGUID(ObjectGuid guid) const +{ + // prevent DB access for online player + if (Player* player = GetPlayer(guid)) + { + return player->getClass(); + } + + uint32 lowguid = guid.GetCounter(); + + QueryResult* result = CharacterDatabase.PQuery("SELECT class FROM characters WHERE guid = '%u'", lowguid); + + if (result) + { + uint8 pClass = (*result)[0].GetUInt8(); + delete result; + return pClass; + } + + return 0; +} + uint32 ObjectMgr::GetPlayerAccountIdByGUID(ObjectGuid guid) const { if (auto player = GetPlayer(guid)) @@ -1635,8 +1657,8 @@ void ObjectMgr::LoadGameobjects(bool reload) QueryResult *result = WorldDatabase.Query("SELECT gameobject.guid, gameobject.id, map, position_x, position_y, position_z, orientation," // 7 8 9 10 11 12 13 14 "rotation0, rotation1, rotation2, rotation3, spawntimesecs, animprogress, state, event, " - // 15 16 17 18 - "pool_gameobject.pool_entry, pool_gameobject_template.pool_entry, spawnFlags, visibilitymod " + // 15 16 17 18 19 20 + "pool_gameobject.pool_entry, pool_gameobject_template.pool_entry, spawnFlags, visibilitymod, patch_min, patch_max " "FROM gameobject " "LEFT OUTER JOIN game_event_gameobject ON gameobject.guid = game_event_gameobject.guid " "LEFT OUTER JOIN pool_gameobject ON gameobject.guid = pool_gameobject.guid " @@ -1662,6 +1684,19 @@ void ObjectMgr::LoadGameobjects(bool reload) uint32 guid = fields[ 0].GetUInt32(); uint32 entry = fields[ 1].GetUInt32(); + uint8 patch_min = fields[19].GetUInt8(); + uint8 patch_max = fields[20].GetUInt8(); + + if ((patch_min > patch_max) || (patch_max > 10)) + { + sLog.outErrorDb("Table `gameobject` GUID %u (entry %u) has invalid values min_patch=%u, max_patch=%u.", guid, entry, patch_min, patch_max); + sLog.out(LOG_DBERRFIX, "UPDATE gameobject SET min_patch=0, max_patch=10 WHERE guid=%u AND id=%u;", guid, entry); + patch_min = 0; + patch_max = 10; + } + + if (!((sWorld.GetWowPatch() >= patch_min) && (sWorld.GetWowPatch() <= patch_max))) + continue; GameObjectInfo const* gInfo = GetGameObjectInfo(entry); if (!gInfo) diff --git a/src/game/ObjectMgr.h b/src/game/ObjectMgr.h index 03a2063b4..bfc5b4410 100644 --- a/src/game/ObjectMgr.h +++ b/src/game/ObjectMgr.h @@ -706,6 +706,7 @@ class ObjectMgr ObjectGuid GetPlayerGuidByName(const std::string& name) const; bool GetPlayerNameByGUID(ObjectGuid guid, std::string &name) const; Team GetPlayerTeamByGUID(ObjectGuid guid) const; + uint8 GetPlayerClassByGUID(ObjectGuid guid) const; uint32 GetPlayerAccountIdByGUID(ObjectGuid guid) const; uint32 GetPlayerAccountIdByPlayerName(const std::string& name) const; diff --git a/src/game/Protocol/Opcodes.cpp b/src/game/Protocol/Opcodes.cpp index ee7e9b971..b70eb9830 100644 --- a/src/game/Protocol/Opcodes.cpp +++ b/src/game/Protocol/Opcodes.cpp @@ -711,7 +711,7 @@ void Opcodes::BuildOpcodeList() /*0x290*/ StoreOpcode(CMSG_BUYBACK_ITEM, "CMSG_BUYBACK_ITEM", STATUS_LOGGEDIN, PACKET_PROCESS_SELF_ITEMS, &WorldSession::HandleBuybackItem); /*0x291*/ StoreOpcode(SMSG_SERVER_MESSAGE, "SMSG_SERVER_MESSAGE", STATUS_NEVER, PACKET_PROCESS_MAX_TYPE, &WorldSession::Handle_ServerSide); /*0x292*/ StoreOpcode(CMSG_MEETINGSTONE_JOIN, "CMSG_MEETINGSTONE_JOIN", STATUS_LOGGEDIN, PACKET_PROCESS_WORLD, &WorldSession::HandleMeetingStoneJoinOpcode); - /*0x293*/ StoreOpcode(CMSG_MEETINGSTONE_LEAVE, "CMSG_MEETINGSTONE_LEAVE", STATUS_NEVER, PACKET_PROCESS_MAX_TYPE, &WorldSession::Handle_NULL); + /*0x293*/ StoreOpcode(CMSG_MEETINGSTONE_LEAVE, "CMSG_MEETINGSTONE_LEAVE", STATUS_LOGGEDIN, PACKET_PROCESS_WORLD, &WorldSession::HandleMeetingStoneLeaveOpcode); /*0x294*/ StoreOpcode(CMSG_MEETINGSTONE_CHEAT, "CMSG_MEETINGSTONE_CHEAT", STATUS_NEVER, PACKET_PROCESS_MAX_TYPE, &WorldSession::Handle_NULL); /*0x295*/ StoreOpcode(SMSG_MEETINGSTONE_SETQUEUE, "SMSG_MEETINGSTONE_SETQUEUE", STATUS_NEVER, PACKET_PROCESS_MAX_TYPE, &WorldSession::Handle_ServerSide); /*0x296*/ StoreOpcode(CMSG_MEETINGSTONE_INFO, "CMSG_MEETINGSTONE_INFO", STATUS_LOGGEDIN, PACKET_PROCESS_WORLD, &WorldSession::HandleMeetingStoneInfoOpcode); diff --git a/src/game/ScriptMgr.cpp b/src/game/ScriptMgr.cpp index c89dbf33e..d18df1990 100644 --- a/src/game/ScriptMgr.cpp +++ b/src/game/ScriptMgr.cpp @@ -660,6 +660,15 @@ void ScriptMgr::LoadScripts(ScriptMapMap& scripts, const char* tablename) } break; } + case SCRIPT_COMMAND_MEETINGSTONE: + { + if (!sAreaStorage.LookupEntry(tmp.meetingstone.areaId)) + { + sLog.outErrorDb("Table `%s` has datalong = %u in SCRIPT_COMMAND_MEETINGSTONE for script id %u, but there is no area with this Id.", tablename, tmp.meetingstone.areaId, tmp.id); + continue; + } + break; + } } if (scripts.find(tmp.id) == scripts.end()) diff --git a/src/game/ScriptMgr.h b/src/game/ScriptMgr.h index 647bb8157..c34284f4a 100644 --- a/src/game/ScriptMgr.h +++ b/src/game/ScriptMgr.h @@ -129,6 +129,7 @@ enum eScriptCommand // datalong2 = 0, change source's orientation, ELSE change traget's orientation // datalong3 = search for npc entry if provided // datalong4 = search distance + SCRIPT_COMMAND_MEETINGSTONE = 36, // datalong = area id }; @@ -396,6 +397,11 @@ struct ScriptInfo uint32 searchRadius; // datalong4 } turnTo; + struct // SCRIPT_COMMAND_MEETINGSTONE (36) + { + uint32 areaId; // datalong + } meetingstone; + struct { uint32 data[9]; diff --git a/src/game/World.cpp b/src/game/World.cpp index f46b98f5b..767d028e8 100644 --- a/src/game/World.cpp +++ b/src/game/World.cpp @@ -64,7 +64,7 @@ #include "GMTicketMgr.h" #include "Util.h" #include "CharacterDatabaseCleaner.h" - +#include "LFGMgr.h" #include "AutoBroadCastMgr.h" #include "AuctionHouseBotMgr.h" #include "AutoTesting/AutoTestingMgr.h" @@ -1806,6 +1806,7 @@ void World::Update(uint32 diff) sMapMgr.Update(diff); sBattleGroundMgr.Update(diff); + sLFGMgr.Update(diff); sZoneScriptMgr.Update(diff); sAutoTestingMgr->Update(diff); sNodesMgr->OnWorldUpdate(diff); diff --git a/src/game/WorldSession.h b/src/game/WorldSession.h index bcc78fb44..7a02335a8 100644 --- a/src/game/WorldSession.h +++ b/src/game/WorldSession.h @@ -424,6 +424,10 @@ class MANGOS_DLL_SPEC WorldSession void SendSaveGuildEmblem( uint32 msg ); void SendBattleGroundJoinError(uint8 err); + // Meetingstone + void SendMeetingstoneFailed(uint8 status); + void SendMeetingstoneSetqueue(uint32 areaid, uint8 status); + void BuildPartyMemberStatsChangedPacket(Player *player, WorldPacket *data); void BuildPartyMemberStatsPacket(Player* player, WorldPacket* data, uint32 updateMask, bool sendAllAuras); @@ -630,6 +634,7 @@ class MANGOS_DLL_SPEC WorldSession void HandleGameObjectUseOpcode(WorldPacket& recPacket); void HandleMeetingStoneJoinOpcode(WorldPacket& recPacket); + void HandleMeetingStoneLeaveOpcode(WorldPacket& recPacket); void HandleMeetingStoneInfoOpcode(WorldPacket& recPacket); void HandleNameQueryOpcode(WorldPacket& recvPacket); diff --git a/src/mangosd/CMakeLists.txt b/src/mangosd/CMakeLists.txt index f650671ef..93355a3af 100644 --- a/src/mangosd/CMakeLists.txt +++ b/src/mangosd/CMakeLists.txt @@ -64,6 +64,7 @@ include_directories( ${CMAKE_SOURCE_DIR}/src/game/Group ${CMAKE_SOURCE_DIR}/src/game/Guild ${CMAKE_SOURCE_DIR}/src/game/Handlers + ${CMAKE_SOURCE_DIR}/src/game/LFG ${CMAKE_SOURCE_DIR}/src/game/Mail ${CMAKE_SOURCE_DIR}/src/game/MapNodes ${CMAKE_SOURCE_DIR}/src/game/Maps diff --git a/src/scripts/CMakeLists.txt b/src/scripts/CMakeLists.txt index 5facc375a..5a2861908 100644 --- a/src/scripts/CMakeLists.txt +++ b/src/scripts/CMakeLists.txt @@ -333,6 +333,7 @@ include_directories( ${CMAKE_SOURCE_DIR}/src/game/Group ${CMAKE_SOURCE_DIR}/src/game/Guild ${CMAKE_SOURCE_DIR}/src/game/Handlers + ${CMAKE_SOURCE_DIR}/src/game/LFG ${CMAKE_SOURCE_DIR}/src/game/Mail ${CMAKE_SOURCE_DIR}/src/game/Maps ${CMAKE_SOURCE_DIR}/src/game/Maps/Pool