[11785] Implement dungeon encounters (DBC part), thanks to rsa for porting it to mangos

Signed-off-by: Laise <fenrisse@gmail.com>
This commit is contained in:
Shauren 2011-09-04 13:14:47 +03:00 committed by Laise
parent dc932024ab
commit 8e4c46ff2a
18 changed files with 1457 additions and 20 deletions

View file

@ -21,7 +21,7 @@
DROP TABLE IF EXISTS `character_db_version`; DROP TABLE IF EXISTS `character_db_version`;
CREATE TABLE `character_db_version` ( CREATE TABLE `character_db_version` (
`required_11716_10_characters_mail` bit(1) default NULL `required_11785_02_characters_instance` bit(1) default NULL
) ENGINE=MyISAM DEFAULT CHARSET=utf8 ROW_FORMAT=FIXED COMMENT='Last applied sql update to DB'; ) ENGINE=MyISAM DEFAULT CHARSET=utf8 ROW_FORMAT=FIXED COMMENT='Last applied sql update to DB';
-- --
@ -1420,6 +1420,7 @@ CREATE TABLE `instance` (
`map` int(11) unsigned NOT NULL default '0', `map` int(11) unsigned NOT NULL default '0',
`resettime` bigint(40) unsigned NOT NULL default '0', `resettime` bigint(40) unsigned NOT NULL default '0',
`difficulty` tinyint(1) unsigned NOT NULL default '0', `difficulty` tinyint(1) unsigned NOT NULL default '0',
`encountersMask` int(10) unsigned NOT NULL default '0',
`data` longtext, `data` longtext,
PRIMARY KEY (`id`), PRIMARY KEY (`id`),
KEY `map` (`map`), KEY `map` (`map`),

View file

@ -24,7 +24,7 @@ CREATE TABLE `db_version` (
`version` varchar(120) default NULL, `version` varchar(120) default NULL,
`creature_ai_version` varchar(120) default NULL, `creature_ai_version` varchar(120) default NULL,
`cache_id` int(10) default '0', `cache_id` int(10) default '0',
`required_11774_01_mangos_spell_proc_event` bit(1) default NULL `required_11785_01_mangos_instance_encounters` bit(1) default NULL
) ENGINE=MyISAM DEFAULT CHARSET=utf8 ROW_FORMAT=FIXED COMMENT='Used DB version notes'; ) ENGINE=MyISAM DEFAULT CHARSET=utf8 ROW_FORMAT=FIXED COMMENT='Used DB version notes';
-- --
@ -17977,6 +17977,641 @@ INSERT INTO `spell_threat` VALUES
/*!40000 ALTER TABLE `spell_threat` ENABLE KEYS */; /*!40000 ALTER TABLE `spell_threat` ENABLE KEYS */;
UNLOCK TABLES; UNLOCK TABLES;
--
-- Table structure for table `instance_encounters`
--
DROP TABLE IF EXISTS `instance_encounters`;
CREATE TABLE `instance_encounters` (
`entry` int(10) unsigned NOT NULL COMMENT 'Unique entry from DungeonEncounter.dbc',
`creditType` tinyint(3) unsigned NOT NULL DEFAULT '0',
`creditEntry` int(10) unsigned NOT NULL DEFAULT '0',
`lastEncounterDungeon` smallint(5) unsigned NOT NULL DEFAULT '0' COMMENT 'If not 0, LfgDungeon.dbc entry for the instance it is last encounter in',
PRIMARY KEY (`entry`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
--
-- Dumping data for table `transports`
--
LOCK TABLES `instance_encounters` WRITE;
/*!40000 ALTER TABLE `instance_encounters` DISABLE KEYS */;
INSERT INTO `instance_encounters` VALUES
(161,0,644,0),
(162,0,643,0),
(163,0,1763,0),
(164,0,646,0),
(165,0,645,0),
(166,0,647,0),
(167,0,639,6),
(201,0,18371,0),
(202,0,18373,149),
(203,0,18341,0),
(204,0,18343,0),
(205,0,18344,148),
(206,0,18472,0),
(207,0,18473,150),
(208,0,18731,0),
(209,0,18667,0),
(210,0,18732,0),
(211,0,18708,151),
(212,0,29309,0),
(213,0,29308,0),
(214,0,29310,0),
(215,0,29311,218),
(216,0,28684,0),
(217,0,28921,0),
(218,0,29120,204),
(219,0,4887,0),
(220,0,4831,0),
(221,0,6243,0),
(222,0,12902,0),
(224,0,4830,0),
(225,0,4832,0),
(226,0,4829,10),
(227,0,9018,30),
(228,0,9025,0),
(229,0,9319,0),
(230,0,10096,0),
(231,0,9024,0),
(232,0,9017,0),
(233,0,9041,0),
(234,0,9056,0),
(235,0,9016,0),
(236,0,9033,0),
(237,0,8983,0),
(238,0,9537,0),
(239,0,9502,0),
(240,0,9543,0),
(241,0,9499,0),
(242,0,9156,0),
(243,0,9035,0),
(244,0,9938,0),
(245,0,9019,276),
(246,0,18371,0),
(247,0,18373,178),
(248,0,18341,0),
(249,0,18343,0),
(250,0,22930,0),
(251,0,18344,179),
(252,0,18472,0),
(253,0,23035,0),
(254,0,18473,180),
(255,0,18731,0),
(256,0,18667,0),
(257,0,18732,0),
(258,0,18708,181),
(259,0,29309,0),
(260,0,29308,0),
(261,0,29310,0),
(262,0,30258,0),
(263,0,29311,219),
(264,0,28684,0),
(265,0,28921,0),
(266,0,29120,241),
(267,0,9196,0),
(268,0,9236,0),
(269,0,9237,0),
(270,0,10596,0),
(271,0,10584,0),
(272,0,9736,0),
(273,0,10268,0),
(274,0,10220,0),
(275,0,9568,32),
(276,0,9816,0),
(277,0,10264,0),
(278,0,10429,0),
(279,0,10430,0),
(280,0,10363,44),
(281,0,18096,170),
(282,0,18096,183),
(283,0,17862,0),
(284,0,17862,0),
(285,0,17848,0),
(286,0,17848,0),
(287,0,17879,0),
(288,0,17879,0),
(289,0,17880,0),
(290,0,17880,0),
(291,0,17881,171),
(292,0,17881,182),
(293,0,26529,0),
(294,0,26530,0),
(295,0,26532,0),
(296,1,58630,209),
(297,0,26529,0),
(298,0,26530,0),
(299,0,26532,0),
(300,1,58630,210),
(301,0,17941,0),
(302,0,17991,0),
(303,0,17942,140),
(304,0,17941,0),
(305,0,17991,0),
(306,0,17942,184),
(314,0,17797,0),
(315,0,17797,0),
(316,0,17796,0),
(317,0,17796,0),
(318,0,17798,147),
(319,0,17798,185),
(320,0,17770,0),
(321,0,17770,0),
(322,0,18105,0),
(323,0,18105,0),
(329,0,17826,0),
(330,0,17826,0),
(331,0,17882,146),
(332,0,17882,186),
(334,1,68572,0),
(336,1,68572,0),
(338,1,68574,0),
(339,1,68574,0),
(340,1,68663,245),
(341,1,68663,249),
(343,0,11490,0),
(344,0,13280,0),
(345,0,14327,0),
(346,0,11492,34),
(347,0,11488,0),
(348,0,11487,0),
(349,0,11496,0),
(350,0,11489,0),
(361,0,11486,36),
(362,0,14326,0),
(363,0,14322,0),
(364,0,14321,0),
(365,0,14323,0),
(366,0,14325,0),
(367,0,14324,0),
(368,0,11501,38),
(369,0,26630,0),
(370,0,26630,0),
(371,0,26631,0),
(372,0,26631,0),
(373,0,27483,0),
(374,0,27483,0),
(375,1,61863,214),
(376,1,61863,215),
(378,0,7079,0),
(379,0,7361,0),
(380,0,6235,0),
(381,0,6229,0),
(382,0,7800,14),
(383,0,29304,0),
(384,0,29304,0),
(385,0,29573,0),
(386,0,29573,0),
(387,0,29305,0),
(388,0,29305,0),
(389,0,29932,0),
(390,0,29306,216),
(391,0,29306,217),
(392,0,17306,0),
(393,0,17306,0),
(394,0,17308,0),
(395,0,17308,0),
(396,0,17537,136),
(397,0,17537,188),
(401,0,17381,0),
(402,0,17381,0),
(403,0,17380,0),
(404,0,17380,0),
(405,0,17377,137),
(406,0,17377,187),
(407,0,16807,0),
(408,0,16807,0),
(409,0,20923,0),
(410,0,16809,0),
(411,0,16809,0),
(412,0,16808,138),
(413,0,16808,189),
(414,0,24723,0),
(415,0,24723,0),
(416,0,24744,0),
(417,0,24744,0),
(418,0,24560,0),
(419,0,24560,0),
(420,0,24664,198),
(421,0,24664,201),
(422,0,13282,0),
(423,0,12258,26),
(424,0,12236,272),
(425,0,12225,0),
(426,0,12203,0),
(427,0,13601,0),
(428,0,13596,0),
(429,0,12201,273),
(430,0,11517,0),
(431,0,11520,4),
(432,0,11518,0),
(433,0,11519,0),
(434,0,7355,0),
(435,0,7357,0),
(436,0,8567,0),
(437,0,7358,20),
(438,0,6168,0),
(439,0,4424,0),
(440,0,4428,0),
(441,0,4420,0),
(443,0,4421,16),
(444,0,3983,0),
(445,0,4543,18),
(446,0,3974,0),
(447,0,6487,165),
(448,0,3975,163),
(449,0,4542,0),
(450,0,3977,164),
(451,0,10506,0),
(452,0,10503,0),
(453,0,11622,0),
(454,0,10433,0),
(455,0,10432,0),
(456,0,10508,0),
(457,0,10505,0),
(458,0,11261,0),
(459,0,10901,0),
(460,0,10507,0),
(461,0,10504,0),
(462,0,10502,0),
(463,0,1853,2),
(464,0,3914,0),
(465,0,3886,0),
(466,0,3887,0),
(467,0,4278,0),
(468,0,4279,0),
(469,0,4274,0),
(470,0,3927,0),
(471,0,4275,8),
(472,0,10516,0),
(473,0,10558,0),
(474,0,10808,0),
(475,0,10997,0),
(476,0,11032,0),
(477,0,10811,0),
(478,0,10813,40),
(479,0,10436,0),
(480,0,10437,0),
(481,0,10438,0),
(482,0,10435,0),
(483,0,10439,0),
(484,0,10440,274),
(485,0,8580,0),
(486,0,5721,0),
(487,0,5720,0),
(488,0,5710,0),
(490,0,5719,0),
(491,0,5722,0),
(492,0,8443,0),
(493,0,5709,28),
(494,0,20870,0),
(495,0,20870,0),
(496,0,20885,0),
(497,0,20885,0),
(498,0,20886,0),
(499,0,20886,0),
(500,0,20912,174),
(501,0,20912,190),
(502,0,17976,0),
(504,0,17976,0),
(505,0,17975,0),
(506,0,17975,0),
(507,0,17978,0),
(508,0,17978,0),
(509,0,17980,0),
(510,0,17980,0),
(511,0,17977,173),
(512,0,17977,191),
(513,0,19219,0),
(514,0,19219,0),
(515,0,19221,0),
(516,0,19221,0),
(517,0,19220,172),
(518,0,19220,192),
(519,0,26796,0),
(520,0,26731,0),
(521,0,26731,0),
(522,0,26763,0),
(523,0,26763,0),
(524,0,26794,0),
(525,0,26794,0),
(526,0,26723,225),
(527,0,26723,226),
(528,0,27654,0),
(529,0,27654,0),
(530,0,27447,0),
(531,0,27447,0),
(532,0,27655,0),
(533,0,27655,0),
(534,0,27656,206),
(535,0,27656,211),
(536,0,1696,0),
(537,0,1666,0),
(538,0,1717,0),
(539,0,1716,0),
(540,0,1663,12),
(541,0,29315,0),
(542,0,29315,0),
(543,0,29316,0),
(544,0,29316,0),
(545,0,31134,220),
(546,0,31134,221),
(547,0,6910,0),
(548,0,6906,0),
(549,0,7228,0),
(551,0,7206,0),
(552,0,7291,0),
(553,0,4854,0),
(554,0,2748,22),
(555,0,28586,0),
(556,0,28586,0),
(557,0,28587,0),
(558,0,28587,0),
(559,0,28546,0),
(560,0,28546,0),
(561,0,28923,207),
(562,0,28923,212),
(563,0,27977,0),
(564,0,27977,0),
(565,0,27975,0),
(566,0,27975,0),
(567,1,59046,0),
(568,1,59046,0),
(569,0,27978,208),
(570,0,27978,213),
(571,0,23953,0),
(572,0,23953,0),
(573,0,24201,0),
(574,0,24201,0),
(575,0,23954,202),
(576,0,23954,242),
(577,0,26668,0),
(578,0,26668,0),
(579,0,26687,0),
(580,0,26687,0),
(581,0,26693,0),
(582,0,26693,0),
(583,0,26861,203),
(584,0,26861,205),
(585,0,3671,0),
(586,0,3669,0),
(587,0,3653,0),
(588,0,3670,0),
(589,0,3674,0),
(590,0,3673,0),
(591,0,5775,0),
(592,0,3654,1),
(593,0,7795,0),
(594,0,7273,0),
(595,0,8127,0),
(596,0,7272,0),
(597,0,7271,0),
(598,0,7796,0),
(599,0,7275,0),
(600,0,7267,24),
(601,0,22887,0),
(602,0,22898,0),
(603,0,22841,0),
(604,0,22871,0),
(605,0,22948,0),
(606,0,23420,0),
(607,0,22947,0),
(608,0,23426,0),
(609,0,22917,196),
(610,0,12435,0),
(611,0,13020,0),
(612,0,12017,0),
(613,0,11983,0),
(614,0,14601,0),
(615,0,11981,0),
(616,0,14020,0),
(617,0,11583,50),
(618,0,17767,0),
(619,0,17808,0),
(620,0,17888,0),
(621,0,17842,0),
(622,0,17968,195),
(623,0,21216,0),
(624,0,21217,0),
(625,0,21215,0),
(626,0,21214,0),
(627,0,21213,0),
(628,0,21212,194),
(629,0,34797,0),
(630,0,34797,0),
(631,0,34797,0),
(632,0,34797,0),
(633,0,34780,0),
(634,0,34780,0),
(635,0,34780,0),
(636,0,34780,0),
(637,1,68184,0),
(638,1,68184,0),
(639,1,68184,0),
(640,1,68184,0),
(641,0,34496,0),
(642,0,34496,0),
(643,0,34496,0),
(644,0,34496,0),
(645,0,34564,246),
(646,0,34564,248),
(647,0,34564,247),
(648,0,34564,250),
(649,0,18831,0),
(650,0,19044,177),
(651,0,17257,176),
(652,0,15550,0),
(653,0,15687,0),
(654,0,16457,0),
(655,0,16812,0),
(656,0,15691,0),
(657,0,15688,0),
(658,0,16524,0),
(659,0,15689,0),
(660,0,22520,0),
(661,0,15690,175),
(662,0,17225,0),
(663,0,12118,0),
(664,0,11982,0),
(665,0,12259,0),
(666,0,12057,0),
(667,0,12264,0),
(668,0,12056,0),
(669,0,12098,0),
(670,0,11988,0),
(671,0,12018,0),
(672,0,11502,48),
(673,0,15956,0),
(674,0,15956,0),
(677,0,15953,0),
(678,0,15953,0),
(679,0,15952,0),
(680,0,15952,0),
(681,0,15954,0),
(682,0,15954,0),
(683,0,15936,0),
(684,0,15936,0),
(685,0,16011,0),
(686,0,16011,0),
(687,0,16061,0),
(689,0,16061,0),
(690,0,16060,0),
(691,0,16060,0),
(692,1,59450,0),
(693,1,59450,0),
(694,0,16028,0),
(695,0,16028,0),
(696,0,15931,0),
(697,0,15931,0),
(698,0,15932,0),
(699,0,15932,0),
(700,0,15928,0),
(701,0,15928,0),
(702,0,15989,0),
(703,0,15989,0),
(704,0,15990,159),
(706,0,15990,227),
(707,0,10184,46),
(708,0,10184,257),
(709,0,15263,0),
(710,0,15544,0),
(711,0,15516,0),
(712,0,15510,0),
(713,0,15299,0),
(714,0,15509,0),
(715,0,15275,0),
(716,0,15517,0),
(717,0,15727,161),
(718,0,15348,0),
(719,0,15341,0),
(720,0,15340,0),
(721,0,15370,0),
(722,0,15369,0),
(723,0,15339,160),
(724,0,24892,0),
(725,0,24882,0),
(726,0,25038,0),
(727,0,25165,0),
(728,0,25840,0),
(729,0,25315,199),
(730,0,19514,0),
(731,0,19516,0),
(732,0,18805,0),
(733,0,19622,193),
(734,0,28859,223),
(735,0,28859,237),
(736,0,30452,0),
(737,0,30452,0),
(738,0,30451,0),
(739,0,30451,0),
(740,0,30449,0),
(741,0,30449,0),
(742,0,28860,224),
(743,0,28860,238),
(744,0,33113,0),
(745,0,33118,0),
(746,0,33186,0),
(747,0,33293,0),
(748,1,65195,0),
(749,0,32930,0),
(750,0,33515,0),
(751,1,64899,0),
(752,1,64985,0),
(753,1,65074,0),
(754,0,33432,0),
(755,0,33271,0),
(756,0,33288,0),
(757,0,32871,243),
(758,0,33113,0),
(759,0,33118,0),
(760,0,33186,0),
(761,0,33293,0),
(762,1,65195,0),
(763,0,32930,0),
(764,0,33515,0),
(765,1,64899,0),
(766,1,64985,0),
(767,1,65074,0),
(768,0,33432,0),
(769,0,33271,0),
(770,0,33288,0),
(771,0,32871,244),
(772,0,31125,0),
(773,0,31125,0),
(774,0,33993,0),
(775,0,33993,0),
(776,0,35013,0),
(777,0,35013,0),
(778,0,23574,0),
(779,0,23576,0),
(780,0,23578,0),
(781,0,23577,0),
(782,0,24239,0),
(783,0,23863,197),
(784,0,14507,0),
(785,0,14517,0),
(786,0,14510,0),
(787,0,11382,0),
(788,0,15083,0),
(789,0,14509,0),
(790,0,15114,0),
(791,0,14515,0),
(792,0,11380,0),
(793,0,14834,42),
(829,0,36497,0),
(830,0,36497,0),
(831,0,36502,251),
(832,0,36502,252),
(833,0,36494,0),
(834,0,36494,0),
(835,0,36476,0),
(836,0,36476,0),
(837,0,36658,253),
(838,0,36658,254),
(839,0,38113,0),
(840,0,38113,0),
(841,0,38112,0),
(842,0,38112,0),
(843,1,72830,255),
(844,1,72830,256),
(845,0,36612,0),
(846,0,36855,0),
(847,1,72959,0),
(848,0,37813,0),
(849,0,36626,0),
(850,0,36627,0),
(851,0,36678,0),
(852,0,37970,0),
(853,0,37955,0),
(854,1,72706,0),
(855,0,36853,0),
(856,0,36597,279),
(857,0,36612,0),
(858,0,36855,0),
(859,1,72959,0),
(860,0,37813,0),
(861,0,36626,0),
(862,0,36627,0),
(863,0,36678,0),
(864,0,37970,0),
(865,0,37955,0),
(866,1,72706,0),
(867,0,36853,0),
(868,0,36597,280),
(883,0,4422,0),
(885,0,38433,239),
(886,0,38433,240),
(887,0,39863,293),
(888,0,39863,294),
(889,0,39751,0),
(890,0,39751,0),
(891,0,39747,0),
(892,0,39747,0),
(893,0,39746,0),
(894,0,39746,0);
/*!40000 ALTER TABLE `instance_encounters` ENABLE KEYS */;
UNLOCK TABLES;
-- --
-- Table structure for table `transports` -- Table structure for table `transports`
-- --

View file

@ -0,0 +1,632 @@
ALTER TABLE db_version CHANGE COLUMN required_11774_01_mangos_spell_proc_event required_11785_01_mangos_instance_encounters bit;
--
-- Table structure for table `instance_encounters`
--
DROP TABLE IF EXISTS `instance_encounters`;
CREATE TABLE `instance_encounters` (
`entry` int(10) unsigned NOT NULL COMMENT 'Unique entry from DungeonEncounter.dbc',
`creditType` tinyint(3) unsigned NOT NULL DEFAULT '0',
`creditEntry` int(10) unsigned NOT NULL DEFAULT '0',
`lastEncounterDungeon` smallint(5) unsigned NOT NULL DEFAULT '0' COMMENT 'If not 0, LfgDungeon.dbc entry for the instance it is last encounter in',
PRIMARY KEY (`entry`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
LOCK TABLES `instance_encounters` WRITE;
/*!40000 ALTER TABLE `instance_encounters` DISABLE KEYS */;
INSERT INTO `instance_encounters` VALUES
(161,0,644,0),
(162,0,643,0),
(163,0,1763,0),
(164,0,646,0),
(165,0,645,0),
(166,0,647,0),
(167,0,639,6),
(201,0,18371,0),
(202,0,18373,149),
(203,0,18341,0),
(204,0,18343,0),
(205,0,18344,148),
(206,0,18472,0),
(207,0,18473,150),
(208,0,18731,0),
(209,0,18667,0),
(210,0,18732,0),
(211,0,18708,151),
(212,0,29309,0),
(213,0,29308,0),
(214,0,29310,0),
(215,0,29311,218),
(216,0,28684,0),
(217,0,28921,0),
(218,0,29120,204),
(219,0,4887,0),
(220,0,4831,0),
(221,0,6243,0),
(222,0,12902,0),
(224,0,4830,0),
(225,0,4832,0),
(226,0,4829,10),
(227,0,9018,30),
(228,0,9025,0),
(229,0,9319,0),
(230,0,10096,0),
(231,0,9024,0),
(232,0,9017,0),
(233,0,9041,0),
(234,0,9056,0),
(235,0,9016,0),
(236,0,9033,0),
(237,0,8983,0),
(238,0,9537,0),
(239,0,9502,0),
(240,0,9543,0),
(241,0,9499,0),
(242,0,9156,0),
(243,0,9035,0),
(244,0,9938,0),
(245,0,9019,276),
(246,0,18371,0),
(247,0,18373,178),
(248,0,18341,0),
(249,0,18343,0),
(250,0,22930,0),
(251,0,18344,179),
(252,0,18472,0),
(253,0,23035,0),
(254,0,18473,180),
(255,0,18731,0),
(256,0,18667,0),
(257,0,18732,0),
(258,0,18708,181),
(259,0,29309,0),
(260,0,29308,0),
(261,0,29310,0),
(262,0,30258,0),
(263,0,29311,219),
(264,0,28684,0),
(265,0,28921,0),
(266,0,29120,241),
(267,0,9196,0),
(268,0,9236,0),
(269,0,9237,0),
(270,0,10596,0),
(271,0,10584,0),
(272,0,9736,0),
(273,0,10268,0),
(274,0,10220,0),
(275,0,9568,32),
(276,0,9816,0),
(277,0,10264,0),
(278,0,10429,0),
(279,0,10430,0),
(280,0,10363,44),
(281,0,18096,170),
(282,0,18096,183),
(283,0,17862,0),
(284,0,17862,0),
(285,0,17848,0),
(286,0,17848,0),
(287,0,17879,0),
(288,0,17879,0),
(289,0,17880,0),
(290,0,17880,0),
(291,0,17881,171),
(292,0,17881,182),
(293,0,26529,0),
(294,0,26530,0),
(295,0,26532,0),
(296,1,58630,209),
(297,0,26529,0),
(298,0,26530,0),
(299,0,26532,0),
(300,1,58630,210),
(301,0,17941,0),
(302,0,17991,0),
(303,0,17942,140),
(304,0,17941,0),
(305,0,17991,0),
(306,0,17942,184),
(314,0,17797,0),
(315,0,17797,0),
(316,0,17796,0),
(317,0,17796,0),
(318,0,17798,147),
(319,0,17798,185),
(320,0,17770,0),
(321,0,17770,0),
(322,0,18105,0),
(323,0,18105,0),
(329,0,17826,0),
(330,0,17826,0),
(331,0,17882,146),
(332,0,17882,186),
(334,1,68572,0),
(336,1,68572,0),
(338,1,68574,0),
(339,1,68574,0),
(340,1,68663,245),
(341,1,68663,249),
(343,0,11490,0),
(344,0,13280,0),
(345,0,14327,0),
(346,0,11492,34),
(347,0,11488,0),
(348,0,11487,0),
(349,0,11496,0),
(350,0,11489,0),
(361,0,11486,36),
(362,0,14326,0),
(363,0,14322,0),
(364,0,14321,0),
(365,0,14323,0),
(366,0,14325,0),
(367,0,14324,0),
(368,0,11501,38),
(369,0,26630,0),
(370,0,26630,0),
(371,0,26631,0),
(372,0,26631,0),
(373,0,27483,0),
(374,0,27483,0),
(375,1,61863,214),
(376,1,61863,215),
(378,0,7079,0),
(379,0,7361,0),
(380,0,6235,0),
(381,0,6229,0),
(382,0,7800,14),
(383,0,29304,0),
(384,0,29304,0),
(385,0,29573,0),
(386,0,29573,0),
(387,0,29305,0),
(388,0,29305,0),
(389,0,29932,0),
(390,0,29306,216),
(391,0,29306,217),
(392,0,17306,0),
(393,0,17306,0),
(394,0,17308,0),
(395,0,17308,0),
(396,0,17537,136),
(397,0,17537,188),
(401,0,17381,0),
(402,0,17381,0),
(403,0,17380,0),
(404,0,17380,0),
(405,0,17377,137),
(406,0,17377,187),
(407,0,16807,0),
(408,0,16807,0),
(409,0,20923,0),
(410,0,16809,0),
(411,0,16809,0),
(412,0,16808,138),
(413,0,16808,189),
(414,0,24723,0),
(415,0,24723,0),
(416,0,24744,0),
(417,0,24744,0),
(418,0,24560,0),
(419,0,24560,0),
(420,0,24664,198),
(421,0,24664,201),
(422,0,13282,0),
(423,0,12258,26),
(424,0,12236,272),
(425,0,12225,0),
(426,0,12203,0),
(427,0,13601,0),
(428,0,13596,0),
(429,0,12201,273),
(430,0,11517,0),
(431,0,11520,4),
(432,0,11518,0),
(433,0,11519,0),
(434,0,7355,0),
(435,0,7357,0),
(436,0,8567,0),
(437,0,7358,20),
(438,0,6168,0),
(439,0,4424,0),
(440,0,4428,0),
(441,0,4420,0),
(443,0,4421,16),
(444,0,3983,0),
(445,0,4543,18),
(446,0,3974,0),
(447,0,6487,165),
(448,0,3975,163),
(449,0,4542,0),
(450,0,3977,164),
(451,0,10506,0),
(452,0,10503,0),
(453,0,11622,0),
(454,0,10433,0),
(455,0,10432,0),
(456,0,10508,0),
(457,0,10505,0),
(458,0,11261,0),
(459,0,10901,0),
(460,0,10507,0),
(461,0,10504,0),
(462,0,10502,0),
(463,0,1853,2),
(464,0,3914,0),
(465,0,3886,0),
(466,0,3887,0),
(467,0,4278,0),
(468,0,4279,0),
(469,0,4274,0),
(470,0,3927,0),
(471,0,4275,8),
(472,0,10516,0),
(473,0,10558,0),
(474,0,10808,0),
(475,0,10997,0),
(476,0,11032,0),
(477,0,10811,0),
(478,0,10813,40),
(479,0,10436,0),
(480,0,10437,0),
(481,0,10438,0),
(482,0,10435,0),
(483,0,10439,0),
(484,0,10440,274),
(485,0,8580,0),
(486,0,5721,0),
(487,0,5720,0),
(488,0,5710,0),
(490,0,5719,0),
(491,0,5722,0),
(492,0,8443,0),
(493,0,5709,28),
(494,0,20870,0),
(495,0,20870,0),
(496,0,20885,0),
(497,0,20885,0),
(498,0,20886,0),
(499,0,20886,0),
(500,0,20912,174),
(501,0,20912,190),
(502,0,17976,0),
(504,0,17976,0),
(505,0,17975,0),
(506,0,17975,0),
(507,0,17978,0),
(508,0,17978,0),
(509,0,17980,0),
(510,0,17980,0),
(511,0,17977,173),
(512,0,17977,191),
(513,0,19219,0),
(514,0,19219,0),
(515,0,19221,0),
(516,0,19221,0),
(517,0,19220,172),
(518,0,19220,192),
(519,0,26796,0),
(520,0,26731,0),
(521,0,26731,0),
(522,0,26763,0),
(523,0,26763,0),
(524,0,26794,0),
(525,0,26794,0),
(526,0,26723,225),
(527,0,26723,226),
(528,0,27654,0),
(529,0,27654,0),
(530,0,27447,0),
(531,0,27447,0),
(532,0,27655,0),
(533,0,27655,0),
(534,0,27656,206),
(535,0,27656,211),
(536,0,1696,0),
(537,0,1666,0),
(538,0,1717,0),
(539,0,1716,0),
(540,0,1663,12),
(541,0,29315,0),
(542,0,29315,0),
(543,0,29316,0),
(544,0,29316,0),
(545,0,31134,220),
(546,0,31134,221),
(547,0,6910,0),
(548,0,6906,0),
(549,0,7228,0),
(551,0,7206,0),
(552,0,7291,0),
(553,0,4854,0),
(554,0,2748,22),
(555,0,28586,0),
(556,0,28586,0),
(557,0,28587,0),
(558,0,28587,0),
(559,0,28546,0),
(560,0,28546,0),
(561,0,28923,207),
(562,0,28923,212),
(563,0,27977,0),
(564,0,27977,0),
(565,0,27975,0),
(566,0,27975,0),
(567,1,59046,0),
(568,1,59046,0),
(569,0,27978,208),
(570,0,27978,213),
(571,0,23953,0),
(572,0,23953,0),
(573,0,24201,0),
(574,0,24201,0),
(575,0,23954,202),
(576,0,23954,242),
(577,0,26668,0),
(578,0,26668,0),
(579,0,26687,0),
(580,0,26687,0),
(581,0,26693,0),
(582,0,26693,0),
(583,0,26861,203),
(584,0,26861,205),
(585,0,3671,0),
(586,0,3669,0),
(587,0,3653,0),
(588,0,3670,0),
(589,0,3674,0),
(590,0,3673,0),
(591,0,5775,0),
(592,0,3654,1),
(593,0,7795,0),
(594,0,7273,0),
(595,0,8127,0),
(596,0,7272,0),
(597,0,7271,0),
(598,0,7796,0),
(599,0,7275,0),
(600,0,7267,24),
(601,0,22887,0),
(602,0,22898,0),
(603,0,22841,0),
(604,0,22871,0),
(605,0,22948,0),
(606,0,23420,0),
(607,0,22947,0),
(608,0,23426,0),
(609,0,22917,196),
(610,0,12435,0),
(611,0,13020,0),
(612,0,12017,0),
(613,0,11983,0),
(614,0,14601,0),
(615,0,11981,0),
(616,0,14020,0),
(617,0,11583,50),
(618,0,17767,0),
(619,0,17808,0),
(620,0,17888,0),
(621,0,17842,0),
(622,0,17968,195),
(623,0,21216,0),
(624,0,21217,0),
(625,0,21215,0),
(626,0,21214,0),
(627,0,21213,0),
(628,0,21212,194),
(629,0,34797,0),
(630,0,34797,0),
(631,0,34797,0),
(632,0,34797,0),
(633,0,34780,0),
(634,0,34780,0),
(635,0,34780,0),
(636,0,34780,0),
(637,1,68184,0),
(638,1,68184,0),
(639,1,68184,0),
(640,1,68184,0),
(641,0,34496,0),
(642,0,34496,0),
(643,0,34496,0),
(644,0,34496,0),
(645,0,34564,246),
(646,0,34564,248),
(647,0,34564,247),
(648,0,34564,250),
(649,0,18831,0),
(650,0,19044,177),
(651,0,17257,176),
(652,0,15550,0),
(653,0,15687,0),
(654,0,16457,0),
(655,0,16812,0),
(656,0,15691,0),
(657,0,15688,0),
(658,0,16524,0),
(659,0,15689,0),
(660,0,22520,0),
(661,0,15690,175),
(662,0,17225,0),
(663,0,12118,0),
(664,0,11982,0),
(665,0,12259,0),
(666,0,12057,0),
(667,0,12264,0),
(668,0,12056,0),
(669,0,12098,0),
(670,0,11988,0),
(671,0,12018,0),
(672,0,11502,48),
(673,0,15956,0),
(674,0,15956,0),
(677,0,15953,0),
(678,0,15953,0),
(679,0,15952,0),
(680,0,15952,0),
(681,0,15954,0),
(682,0,15954,0),
(683,0,15936,0),
(684,0,15936,0),
(685,0,16011,0),
(686,0,16011,0),
(687,0,16061,0),
(689,0,16061,0),
(690,0,16060,0),
(691,0,16060,0),
(692,1,59450,0),
(693,1,59450,0),
(694,0,16028,0),
(695,0,16028,0),
(696,0,15931,0),
(697,0,15931,0),
(698,0,15932,0),
(699,0,15932,0),
(700,0,15928,0),
(701,0,15928,0),
(702,0,15989,0),
(703,0,15989,0),
(704,0,15990,159),
(706,0,15990,227),
(707,0,10184,46),
(708,0,10184,257),
(709,0,15263,0),
(710,0,15544,0),
(711,0,15516,0),
(712,0,15510,0),
(713,0,15299,0),
(714,0,15509,0),
(715,0,15275,0),
(716,0,15517,0),
(717,0,15727,161),
(718,0,15348,0),
(719,0,15341,0),
(720,0,15340,0),
(721,0,15370,0),
(722,0,15369,0),
(723,0,15339,160),
(724,0,24892,0),
(725,0,24882,0),
(726,0,25038,0),
(727,0,25165,0),
(728,0,25840,0),
(729,0,25315,199),
(730,0,19514,0),
(731,0,19516,0),
(732,0,18805,0),
(733,0,19622,193),
(734,0,28859,223),
(735,0,28859,237),
(736,0,30452,0),
(737,0,30452,0),
(738,0,30451,0),
(739,0,30451,0),
(740,0,30449,0),
(741,0,30449,0),
(742,0,28860,224),
(743,0,28860,238),
(744,0,33113,0),
(745,0,33118,0),
(746,0,33186,0),
(747,0,33293,0),
(748,1,65195,0),
(749,0,32930,0),
(750,0,33515,0),
(751,1,64899,0),
(752,1,64985,0),
(753,1,65074,0),
(754,0,33432,0),
(755,0,33271,0),
(756,0,33288,0),
(757,0,32871,243),
(758,0,33113,0),
(759,0,33118,0),
(760,0,33186,0),
(761,0,33293,0),
(762,1,65195,0),
(763,0,32930,0),
(764,0,33515,0),
(765,1,64899,0),
(766,1,64985,0),
(767,1,65074,0),
(768,0,33432,0),
(769,0,33271,0),
(770,0,33288,0),
(771,0,32871,244),
(772,0,31125,0),
(773,0,31125,0),
(774,0,33993,0),
(775,0,33993,0),
(776,0,35013,0),
(777,0,35013,0),
(778,0,23574,0),
(779,0,23576,0),
(780,0,23578,0),
(781,0,23577,0),
(782,0,24239,0),
(783,0,23863,197),
(784,0,14507,0),
(785,0,14517,0),
(786,0,14510,0),
(787,0,11382,0),
(788,0,15083,0),
(789,0,14509,0),
(790,0,15114,0),
(791,0,14515,0),
(792,0,11380,0),
(793,0,14834,42),
(829,0,36497,0),
(830,0,36497,0),
(831,0,36502,251),
(832,0,36502,252),
(833,0,36494,0),
(834,0,36494,0),
(835,0,36476,0),
(836,0,36476,0),
(837,0,36658,253),
(838,0,36658,254),
(839,0,38113,0),
(840,0,38113,0),
(841,0,38112,0),
(842,0,38112,0),
(843,1,72830,255),
(844,1,72830,256),
(845,0,36612,0),
(846,0,36855,0),
(847,1,72959,0),
(848,0,37813,0),
(849,0,36626,0),
(850,0,36627,0),
(851,0,36678,0),
(852,0,37970,0),
(853,0,37955,0),
(854,1,72706,0),
(855,0,36853,0),
(856,0,36597,279),
(857,0,36612,0),
(858,0,36855,0),
(859,1,72959,0),
(860,0,37813,0),
(861,0,36626,0),
(862,0,36627,0),
(863,0,36678,0),
(864,0,37970,0),
(865,0,37955,0),
(866,1,72706,0),
(867,0,36853,0),
(868,0,36597,280),
(883,0,4422,0),
(885,0,38433,239),
(886,0,38433,240),
(887,0,39863,293),
(888,0,39863,294),
(889,0,39751,0),
(890,0,39751,0),
(891,0,39747,0),
(892,0,39747,0),
(893,0,39746,0),
(894,0,39746,0);
/*!40000 ALTER TABLE `instance_encounters` ENABLE KEYS */;
UNLOCK TABLES;

View file

@ -0,0 +1,6 @@
ALTER TABLE character_db_version CHANGE COLUMN required_11716_10_characters_mail required_11785_02_characters_instance bit;
-- dungeon DBC encounters support
ALTER TABLE `instance` ADD COLUMN `encountersMask`
INT(10) UNSIGNED NOT NULL DEFAULT '0' COMMENT 'Dungeon encounter bit mask'
AFTER `difficulty`;

View file

@ -76,6 +76,7 @@ DBCStorage <CreatureSpellDataEntry> sCreatureSpellDataStore(CreatureSpellDatafmt
DBCStorage <CreatureTypeEntry> sCreatureTypeStore(CreatureTypefmt); DBCStorage <CreatureTypeEntry> sCreatureTypeStore(CreatureTypefmt);
DBCStorage <CurrencyTypesEntry> sCurrencyTypesStore(CurrencyTypesfmt); DBCStorage <CurrencyTypesEntry> sCurrencyTypesStore(CurrencyTypesfmt);
DBCStorage <DungeonEncounterEntry> sDungeonEncounterStore(DungeonEncounterfmt);
DBCStorage <DurabilityQualityEntry> sDurabilityQualityStore(DurabilityQualityfmt); DBCStorage <DurabilityQualityEntry> sDurabilityQualityStore(DurabilityQualityfmt);
DBCStorage <DurabilityCostsEntry> sDurabilityCostsStore(DurabilityCostsfmt); DBCStorage <DurabilityCostsEntry> sDurabilityCostsStore(DurabilityCostsfmt);
@ -363,7 +364,7 @@ void LoadDBCStores(const std::string& dataPath)
exit(1); exit(1);
} }
const uint32 DBCFilesCount = 93; const uint32 DBCFilesCount = 94;
BarGoLink bar(DBCFilesCount); BarGoLink bar(DBCFilesCount);
@ -407,6 +408,7 @@ void LoadDBCStores(const std::string& dataPath)
LoadDBC(availableDbcLocales,bar,bad_dbc_files,sCreatureSpellDataStore, dbcPath,"CreatureSpellData.dbc"); LoadDBC(availableDbcLocales,bar,bad_dbc_files,sCreatureSpellDataStore, dbcPath,"CreatureSpellData.dbc");
LoadDBC(availableDbcLocales,bar,bad_dbc_files,sCreatureTypeStore, dbcPath,"CreatureType.dbc"); LoadDBC(availableDbcLocales,bar,bad_dbc_files,sCreatureTypeStore, dbcPath,"CreatureType.dbc");
LoadDBC(availableDbcLocales,bar,bad_dbc_files,sCurrencyTypesStore, dbcPath,"CurrencyTypes.dbc"); LoadDBC(availableDbcLocales,bar,bad_dbc_files,sCurrencyTypesStore, dbcPath,"CurrencyTypes.dbc");
LoadDBC(availableDbcLocales,bar,bad_dbc_files,sDungeonEncounterStore, dbcPath,"DungeonEncounter.dbc");
LoadDBC(availableDbcLocales,bar,bad_dbc_files,sDurabilityCostsStore, dbcPath,"DurabilityCosts.dbc"); LoadDBC(availableDbcLocales,bar,bad_dbc_files,sDurabilityCostsStore, dbcPath,"DurabilityCosts.dbc");
LoadDBC(availableDbcLocales,bar,bad_dbc_files,sDurabilityQualityStore, dbcPath,"DurabilityQuality.dbc"); LoadDBC(availableDbcLocales,bar,bad_dbc_files,sDurabilityQualityStore, dbcPath,"DurabilityQuality.dbc");
LoadDBC(availableDbcLocales,bar,bad_dbc_files,sEmotesStore, dbcPath,"Emotes.dbc"); LoadDBC(availableDbcLocales,bar,bad_dbc_files,sEmotesStore, dbcPath,"Emotes.dbc");

View file

@ -116,6 +116,7 @@ extern DBCStorage <CreatureFamilyEntry> sCreatureFamilyStore;
extern DBCStorage <CreatureSpellDataEntry> sCreatureSpellDataStore; extern DBCStorage <CreatureSpellDataEntry> sCreatureSpellDataStore;
extern DBCStorage <CreatureTypeEntry> sCreatureTypeStore; extern DBCStorage <CreatureTypeEntry> sCreatureTypeStore;
extern DBCStorage <CurrencyTypesEntry> sCurrencyTypesStore; extern DBCStorage <CurrencyTypesEntry> sCurrencyTypesStore;
extern DBCStorage <DungeonEncounterEntry> sDungeonEncounterStore;
extern DBCStorage <DurabilityCostsEntry> sDurabilityCostsStore; extern DBCStorage <DurabilityCostsEntry> sDurabilityCostsStore;
extern DBCStorage <DurabilityQualityEntry> sDurabilityQualityStore; extern DBCStorage <DurabilityQualityEntry> sDurabilityQualityStore;
extern DBCStorage <EmotesEntry> sEmotesStore; extern DBCStorage <EmotesEntry> sEmotesStore;

View file

@ -797,6 +797,18 @@ struct CurrencyTypesEntry
uint32 BitIndex; // 3 m_bitIndex bit index in PLAYER_FIELD_KNOWN_CURRENCIES (1 << (index-1)) uint32 BitIndex; // 3 m_bitIndex bit index in PLAYER_FIELD_KNOWN_CURRENCIES (1 << (index-1))
}; };
struct DungeonEncounterEntry
{
uint32 Id; // 0 unique id
uint32 mapId; // 1 map id
uint32 Difficulty; // 2 instance mode
uint32 encounterData; // 3 time to reach?
uint32 encounterIndex; // 4 encounter index for creating completed mask
char* encounterName[16]; // 5-20 encounter name
//uint32 nameFlags; // 21 language flags
//uint32 unk1; // 22
};
struct DurabilityCostsEntry struct DurabilityCostsEntry
{ {
uint32 Itemlvl; // 0 m_ID uint32 Itemlvl; // 0 m_ID

View file

@ -41,6 +41,7 @@ const char CreatureFamilyfmt[]="nfifiiiiixssssssssssssssssxx";
const char CreatureSpellDatafmt[]="niiiixxxx"; const char CreatureSpellDatafmt[]="niiiixxxx";
const char CreatureTypefmt[]="nxxxxxxxxxxxxxxxxxx"; const char CreatureTypefmt[]="nxxxxxxxxxxxxxxxxxx";
const char CurrencyTypesfmt[]="xnxi"; const char CurrencyTypesfmt[]="xnxi";
const char DungeonEncounterfmt[]="niiiissssssssssssssssxx";
const char DurabilityCostsfmt[]="niiiiiiiiiiiiiiiiiiiiiiiiiiiii"; const char DurabilityCostsfmt[]="niiiiiiiiiiiiiiiiiiiiiiiiiiiii";
const char DurabilityQualityfmt[]="nf"; const char DurabilityQualityfmt[]="nf";
const char EmotesEntryfmt[]="nxxiiix"; const char EmotesEntryfmt[]="nxxiiix";

View file

@ -206,8 +206,8 @@ bool WorldPersistentState::CanBeUnload() const
//== DungeonPersistentState functions ===================== //== DungeonPersistentState functions =====================
DungeonPersistentState::DungeonPersistentState( uint16 MapId, uint32 InstanceId, Difficulty difficulty, time_t resetTime, bool canReset ) DungeonPersistentState::DungeonPersistentState( uint16 MapId, uint32 InstanceId, Difficulty difficulty, time_t resetTime, bool canReset, uint32 completedEncountersMask)
: MapPersistentState(MapId, InstanceId, difficulty), m_resetTime(resetTime), m_canReset(canReset) : MapPersistentState(MapId, InstanceId, difficulty), m_resetTime(resetTime), m_canReset(canReset), m_completedEncountersMask(completedEncountersMask)
{ {
} }
@ -249,7 +249,7 @@ void DungeonPersistentState::SaveToDB()
} }
} }
CharacterDatabase.PExecute("INSERT INTO instance VALUES ('%u', '%u', '"UI64FMTD"', '%u', '%s')", GetInstanceId(), GetMapId(), (uint64)GetResetTimeForDB(), GetDifficulty(), data.c_str()); CharacterDatabase.PExecute("INSERT INTO instance VALUES ('%u', '%u', '"UI64FMTD"', '%u', '%u', '%s')", GetInstanceId(), GetMapId(), (uint64)GetResetTimeForDB(), GetDifficulty(), GetCompletedEncountersMask(), data.c_str());
} }
void DungeonPersistentState::DeleteRespawnTimes() void DungeonPersistentState::DeleteRespawnTimes()
@ -283,6 +283,31 @@ time_t DungeonPersistentState::GetResetTimeForDB() const
return GetResetTime(); return GetResetTime();
} }
void DungeonPersistentState::UpdateEncounterState(EncounterCreditType type, uint32 creditEntry)
{
DungeonEncounterMapBounds bounds = sObjectMgr.GetDungeonEncounterBounds(creditEntry);
for (DungeonEncounterMap::const_iterator iter = bounds.first; iter != bounds.second; ++iter)
{
DungeonEncounterEntry const* dbcEntry = iter->second->dbcEntry;
if (iter->second->creditType == type && dbcEntry->Difficulty == GetDifficulty() && dbcEntry->mapId == GetMapId())
{
m_completedEncountersMask |= 1 << dbcEntry->encounterIndex;
CharacterDatabase.PExecute("UPDATE instance SET encountersMask = '%u' WHERE id = '%u'", m_completedEncountersMask, GetInstanceId());
DEBUG_LOG("DungeonPersistentState: Dungeon %s (Id %u) completed encounter %s", GetMap()->GetMapName(), GetInstanceId(), dbcEntry->encounterName[sWorld.GetDefaultDbcLocale()]);
if (uint32 dungeonId = iter->second->lastEncounterDungeon)
{
DEBUG_LOG("DungeonPersistentState:: Dungeon %s (Id %u) completed last encounter %s", GetMap()->GetMapName(), GetInstanceId(), dbcEntry->encounterName[sWorld.GetDefaultDbcLocale()]);
// Place LFG reward here
}
return;
}
}
}
//== BattleGroundPersistentState functions ================= //== BattleGroundPersistentState functions =================
bool BattleGroundPersistentState::CanBeUnload() const bool BattleGroundPersistentState::CanBeUnload() const
@ -567,7 +592,7 @@ MapPersistentStateManager::~MapPersistentStateManager()
- adding instance into manager - adding instance into manager
- called from DungeonMap::Add, _LoadBoundInstances, LoadGroups - called from DungeonMap::Add, _LoadBoundInstances, LoadGroups
*/ */
MapPersistentState* MapPersistentStateManager::AddPersistentState(MapEntry const* mapEntry, uint32 instanceId, Difficulty difficulty, time_t resetTime, bool canReset, bool load /*=false*/, bool initPools /*= true*/) MapPersistentState* MapPersistentStateManager::AddPersistentState(MapEntry const* mapEntry, uint32 instanceId, Difficulty difficulty, time_t resetTime, bool canReset, bool load /*=false*/, bool initPools /*= true*/, uint32 completedEncountersMask /*= 0*/)
{ {
if (MapPersistentState *old_save = GetPersistentState(mapEntry->MapID, instanceId)) if (MapPersistentState *old_save = GetPersistentState(mapEntry->MapID, instanceId))
return old_save; return old_save;
@ -594,7 +619,7 @@ MapPersistentState* MapPersistentStateManager::AddPersistentState(MapEntry const
MapPersistentState *state; MapPersistentState *state;
if (mapEntry->IsDungeon()) if (mapEntry->IsDungeon())
{ {
DungeonPersistentState* dungeonState = new DungeonPersistentState(mapEntry->MapID, instanceId, difficulty, resetTime, canReset); DungeonPersistentState* dungeonState = new DungeonPersistentState(mapEntry->MapID, instanceId, difficulty, completedEncountersMask, resetTime, canReset);
if (!load) if (!load)
dungeonState->SaveToDB(); dungeonState->SaveToDB();
state = dungeonState; state = dungeonState;
@ -916,7 +941,7 @@ void MapPersistentStateManager::LoadCreatureRespawnTimes()
uint32 count = 0; uint32 count = 0;
QueryResult *result = CharacterDatabase.Query("SELECT guid, respawntime, map, instance, difficulty, resettime FROM creature_respawn LEFT JOIN instance ON instance = id"); QueryResult *result = CharacterDatabase.Query("SELECT guid, respawntime, map, instance, difficulty, resettime, encountersMask FROM creature_respawn LEFT JOIN instance ON instance = id");
if (!result) if (!result)
{ {
BarGoLink bar(1); BarGoLink bar(1);
@ -943,6 +968,8 @@ void MapPersistentStateManager::LoadCreatureRespawnTimes()
time_t resetTime = (time_t)fields[5].GetUInt64(); time_t resetTime = (time_t)fields[5].GetUInt64();
uint32 completedEncounters = fields[6].GetUInt32();
CreatureData const* data = sObjectMgr.GetCreatureData(loguid); CreatureData const* data = sObjectMgr.GetCreatureData(loguid);
if (!data) if (!data)
continue; continue;
@ -957,7 +984,7 @@ void MapPersistentStateManager::LoadCreatureRespawnTimes()
if(difficulty >= (!mapEntry->Instanceable() ? REGULAR_DIFFICULTY : (mapEntry->IsRaid() ? MAX_RAID_DIFFICULTY : MAX_DUNGEON_DIFFICULTY))) if(difficulty >= (!mapEntry->Instanceable() ? REGULAR_DIFFICULTY : (mapEntry->IsRaid() ? MAX_RAID_DIFFICULTY : MAX_DUNGEON_DIFFICULTY)))
continue; continue;
MapPersistentState* state = AddPersistentState(mapEntry, instanceId, Difficulty(difficulty), resetTime, mapEntry->IsDungeon(), true); MapPersistentState* state = AddPersistentState(mapEntry, instanceId, Difficulty(difficulty), resetTime, mapEntry->IsDungeon(), true, true, completedEncounters);
if (!state) if (!state)
continue; continue;
@ -980,7 +1007,7 @@ void MapPersistentStateManager::LoadGameobjectRespawnTimes()
uint32 count = 0; uint32 count = 0;
QueryResult *result = CharacterDatabase.Query("SELECT guid, respawntime, map, instance, difficulty, resettime FROM gameobject_respawn LEFT JOIN instance ON instance = id"); QueryResult *result = CharacterDatabase.Query("SELECT guid, respawntime, map, instance, difficulty, resettime, encountersMask FROM gameobject_respawn LEFT JOIN instance ON instance = id");
if (!result) if (!result)
{ {
@ -1008,6 +1035,8 @@ void MapPersistentStateManager::LoadGameobjectRespawnTimes()
time_t resetTime = (time_t)fields[5].GetUInt64(); time_t resetTime = (time_t)fields[5].GetUInt64();
uint32 completedEncounters = fields[6].GetUInt32();
GameObjectData const* data = sObjectMgr.GetGOData(loguid); GameObjectData const* data = sObjectMgr.GetGOData(loguid);
if (!data) if (!data)
continue; continue;
@ -1022,7 +1051,7 @@ void MapPersistentStateManager::LoadGameobjectRespawnTimes()
if(difficulty >= (!mapEntry->Instanceable() ? REGULAR_DIFFICULTY : (mapEntry->IsRaid() ? MAX_RAID_DIFFICULTY : MAX_DUNGEON_DIFFICULTY))) if(difficulty >= (!mapEntry->Instanceable() ? REGULAR_DIFFICULTY : (mapEntry->IsRaid() ? MAX_RAID_DIFFICULTY : MAX_DUNGEON_DIFFICULTY)))
continue; continue;
MapPersistentState* state = AddPersistentState(mapEntry, instanceId, Difficulty(difficulty), resetTime, mapEntry->IsDungeon(), true); MapPersistentState* state = AddPersistentState(mapEntry, instanceId, Difficulty(difficulty), resetTime, mapEntry->IsDungeon(), true, true, completedEncounters);
if (!state) if (!state)
continue; continue;

View file

@ -180,7 +180,7 @@ class DungeonPersistentState : public MapPersistentState
- any new instance is being generated - any new instance is being generated
- the first time a player bound to InstanceId logs in - the first time a player bound to InstanceId logs in
- when a group bound to the instance is loaded */ - when a group bound to the instance is loaded */
DungeonPersistentState(uint16 MapId, uint32 InstanceId, Difficulty difficulty, time_t resetTime, bool canReset); DungeonPersistentState(uint16 MapId, uint32 InstanceId, Difficulty difficulty, time_t resetTime, bool canReset, uint32 completedEncountersMask);
~DungeonPersistentState(); ~DungeonPersistentState();
@ -211,6 +211,12 @@ class DungeonPersistentState : public MapPersistentState
bool CanReset() const { return m_canReset; } bool CanReset() const { return m_canReset; }
void SetCanReset(bool canReset) { m_canReset = canReset; } void SetCanReset(bool canReset) { m_canReset = canReset; }
// DBC encounter state update at kill/spell cast
void UpdateEncounterState(EncounterCreditType type, uint32 creditEntry);
// mask of completed encounters
uint32 GetCompletedEncountersMask() { return m_completedEncountersMask; }
/* Saved when the instance is generated for the first time */ /* Saved when the instance is generated for the first time */
void SaveToDB(); void SaveToDB();
/* When the instance is being reset (permanently deleted) */ /* When the instance is being reset (permanently deleted) */
@ -236,6 +242,8 @@ class DungeonPersistentState : public MapPersistentState
GroupListType m_groupList; // lock MapPersistentState from unload GroupListType m_groupList; // lock MapPersistentState from unload
SpawnedPoolData m_spawnedPoolData; // Pools spawns state for map copy SpawnedPoolData m_spawnedPoolData; // Pools spawns state for map copy
uint32 m_completedEncountersMask; // completed encounter mask, bit indexes are DungeonEncounter.dbc boss numbers, used for packets
}; };
class BattleGroundPersistentState : public MapPersistentState class BattleGroundPersistentState : public MapPersistentState
@ -336,7 +344,7 @@ class MANGOS_DLL_DECL MapPersistentStateManager : public MaNGOS::Singleton<MapPe
// auto select appropriate MapPersistentState (sub)class by MapEntry, and autoselect appropriate way store (by instance/map id) // auto select appropriate MapPersistentState (sub)class by MapEntry, and autoselect appropriate way store (by instance/map id)
// always return != NULL // always return != NULL
MapPersistentState* AddPersistentState(MapEntry const* mapEntry, uint32 instanceId, Difficulty difficulty, time_t resetTime, bool canReset, bool load = false, bool initPools = true); MapPersistentState* AddPersistentState(MapEntry const* mapEntry, uint32 instanceId, Difficulty difficulty, time_t resetTime, bool canReset, bool load = false, bool initPools = true, uint32 completedEncountersMask = 0);
// search stored state, can be NULL in result // search stored state, can be NULL in result
MapPersistentState *GetPersistentState(uint32 mapId, uint32 InstanceId); MapPersistentState *GetPersistentState(uint32 mapId, uint32 InstanceId);

View file

@ -3533,8 +3533,8 @@ void ObjectMgr::LoadGroups()
"SELECT group_instance.leaderGuid, map, instance, permanent, instance.difficulty, resettime, " "SELECT group_instance.leaderGuid, map, instance, permanent, instance.difficulty, resettime, "
// 6 // 6
"(SELECT COUNT(*) FROM character_instance WHERE guid = group_instance.leaderGuid AND instance = group_instance.instance AND permanent = 1 LIMIT 1), " "(SELECT COUNT(*) FROM character_instance WHERE guid = group_instance.leaderGuid AND instance = group_instance.instance AND permanent = 1 LIMIT 1), "
// 7 // 7 8
" groups.groupId " " groups.groupId, instance.encountersMask "
"FROM group_instance LEFT JOIN instance ON instance = id LEFT JOIN groups ON groups.leaderGUID = group_instance.leaderGUID ORDER BY leaderGuid" "FROM group_instance LEFT JOIN instance ON instance = id LEFT JOIN groups ON groups.leaderGUID = group_instance.leaderGUID ORDER BY leaderGuid"
); );
@ -3583,7 +3583,7 @@ void ObjectMgr::LoadGroups()
diff = REGULAR_DIFFICULTY; // default for both difficaly types diff = REGULAR_DIFFICULTY; // default for both difficaly types
} }
DungeonPersistentState *state = (DungeonPersistentState*)sMapPersistentStateMgr.AddPersistentState(mapEntry, fields[2].GetUInt32(), Difficulty(diff), (time_t)fields[5].GetUInt64(), (fields[6].GetUInt32() == 0), true); DungeonPersistentState *state = (DungeonPersistentState*)sMapPersistentStateMgr.AddPersistentState(mapEntry, fields[2].GetUInt32(), Difficulty(diff), (time_t)fields[5].GetUInt64(), (fields[6].GetUInt32() == 0), true, true, fields[8].GetUInt32());
group->BindToInstance(state, fields[3].GetBool(), true); group->BindToInstance(state, fields[3].GetBool(), true);
}while( result->NextRow() ); }while( result->NextRow() );
delete result; delete result;
@ -4546,6 +4546,79 @@ void ObjectMgr::LoadPageTextLocales()
sLog.outString( ">> Loaded %lu PageText locale strings", (unsigned long)mPageTextLocaleMap.size() ); sLog.outString( ">> Loaded %lu PageText locale strings", (unsigned long)mPageTextLocaleMap.size() );
} }
void ObjectMgr::LoadInstanceEncounters()
{
m_DungeonEncounters.clear(); // need for reload case
QueryResult* result = WorldDatabase.Query("SELECT entry, creditType, creditEntry, lastEncounterDungeon FROM instance_encounters");
if (!result)
{
BarGoLink bar(1);
bar.step();
sLog.outString();
sLog.outString(">> Loaded 0 Instance Encounters. DB table `instance_encounters` is empty.");
return;
}
BarGoLink bar(result->GetRowCount());
do
{
Field *fields = result->Fetch();
bar.step();
uint32 entry = fields[0].GetUInt32();
DungeonEncounterEntry const* dungeonEncounter = sDungeonEncounterStore.LookupEntry(entry);
if (!dungeonEncounter)
{
sLog.outErrorDb("Table `instance_encounters` has an invalid encounter id %u, skipped!", entry);
continue;
}
uint8 creditType = fields[1].GetUInt8();
uint32 creditEntry = fields[2].GetUInt32();
switch (creditType)
{
case ENCOUNTER_CREDIT_KILL_CREATURE:
{
CreatureInfo const* cInfo = sCreatureStorage.LookupEntry<CreatureInfo>(creditEntry);
if (!cInfo)
{
sLog.outErrorDb("Table `instance_encounters` has an invalid creature (entry %u) linked to the encounter %u (%s), skipped!", creditEntry, entry, dungeonEncounter->encounterName[0]);
continue;
}
break;
}
case ENCOUNTER_CREDIT_CAST_SPELL:
{
if (!sSpellStore.LookupEntry(creditEntry))
{
// skip spells that aren't in dbc for now
//sLog.outErrorDb("Table `instance_encounters` has an invalid spell (entry %u) linked to the encounter %u (%s), skipped!", creditEntry, entry, dungeonEncounter->encounterName[0]);
continue;
}
break;
}
default:
sLog.outErrorDb("Table `instance_encounters` has an invalid credit type (%u) for encounter %u (%s), skipped!", creditType, entry, dungeonEncounter->encounterName[0]);
continue;
}
uint32 lastEncounterDungeon = fields[3].GetUInt32();
m_DungeonEncounters.insert(DungeonEncounterMap::value_type(creditEntry, new DungeonEncounter(dungeonEncounter, EncounterCreditType(creditType), creditEntry, lastEncounterDungeon)));
} while (result->NextRow());
delete result;
sLog.outString();
sLog.outString( ">> Loaded %lu Instance Encounters", (unsigned long)m_DungeonEncounters.size() );
}
struct SQLInstanceLoader : public SQLStorageLoaderBase<SQLInstanceLoader> struct SQLInstanceLoader : public SQLStorageLoaderBase<SQLInstanceLoader>
{ {
template<class D> template<class D>

View file

@ -312,6 +312,19 @@ struct WeatherZoneChances
WeatherSeasonChances data[WEATHER_SEASONS]; WeatherSeasonChances data[WEATHER_SEASONS];
}; };
struct DungeonEncounter
{
DungeonEncounter(DungeonEncounterEntry const* _dbcEntry, EncounterCreditType _creditType, uint32 _creditEntry, uint32 _lastEncounterDungeon)
: dbcEntry(_dbcEntry), creditType(_creditType), creditEntry(_creditEntry), lastEncounterDungeon(_lastEncounterDungeon) { }
DungeonEncounterEntry const* dbcEntry;
EncounterCreditType creditType;
uint32 creditEntry;
uint32 lastEncounterDungeon;
};
typedef std::multimap<uint32, DungeonEncounter const*> DungeonEncounterMap;
typedef std::pair<DungeonEncounterMap::const_iterator, DungeonEncounterMap::const_iterator> DungeonEncounterMapBounds;
struct GraveYardData struct GraveYardData
{ {
uint32 safeLocId; uint32 safeLocId;
@ -652,6 +665,7 @@ class ObjectMgr
void LoadPageTextLocales(); void LoadPageTextLocales();
void LoadGossipMenuItemsLocales(); void LoadGossipMenuItemsLocales();
void LoadPointOfInterestLocales(); void LoadPointOfInterestLocales();
void LoadInstanceEncounters();
void LoadInstanceTemplate(); void LoadInstanceTemplate();
void LoadWorldTemplate(); void LoadWorldTemplate();
void LoadMailLevelRewards(); void LoadMailLevelRewards();
@ -1007,6 +1021,11 @@ class ObjectMgr
return m_ItemRequiredTarget.equal_range(uiItemEntry); return m_ItemRequiredTarget.equal_range(uiItemEntry);
} }
DungeonEncounterMapBounds GetDungeonEncounterBounds(uint32 creditEntry) const
{
return m_DungeonEncounters.equal_range(creditEntry);
}
GossipMenusMapBounds GetGossipMenusMapBounds(uint32 uiMenuId) const GossipMenusMapBounds GetGossipMenusMapBounds(uint32 uiMenuId) const
{ {
return m_mGossipMenusMap.equal_range(uiMenuId); return m_mGossipMenusMap.equal_range(uiMenuId);
@ -1170,6 +1189,7 @@ class ObjectMgr
MangosStringLocaleMap mMangosStringLocaleMap; MangosStringLocaleMap mMangosStringLocaleMap;
GossipMenuItemsLocaleMap mGossipMenuItemsLocaleMap; GossipMenuItemsLocaleMap mGossipMenuItemsLocaleMap;
PointOfInterestLocaleMap mPointOfInterestLocaleMap; PointOfInterestLocaleMap mPointOfInterestLocaleMap;
DungeonEncounterMap m_DungeonEncounters;
// Storage for Conditions. First element (index 0) is reserved for zero-condition (nothing required) // Storage for Conditions. First element (index 0) is reserved for zero-condition (nothing required)
typedef std::vector<PlayerCondition> ConditionStore; typedef std::vector<PlayerCondition> ConditionStore;

View file

@ -2925,6 +2925,12 @@ enum TradeStatus
TRADE_STATUS_ONLY_CONJURED = 22 // You can only trade conjured items... (cross realm BG related). TRADE_STATUS_ONLY_CONJURED = 22 // You can only trade conjured items... (cross realm BG related).
}; };
enum EncounterCreditType
{
ENCOUNTER_CREDIT_KILL_CREATURE = 0,
ENCOUNTER_CREDIT_CAST_SPELL = 1
};
// we need to stick to 1 version or half of the stuff will work for someone // we need to stick to 1 version or half of the stuff will work for someone
// others will not and opposite // others will not and opposite
// will only support WoW, WoW:TBC and WoW:WotLK 3.3.5a client build 12340... // will only support WoW, WoW:TBC and WoW:WotLK 3.3.5a client build 12340...

View file

@ -3608,6 +3608,11 @@ void Spell::finish(bool ok)
// Stop Attack for some spells // Stop Attack for some spells
if( m_spellInfo->Attributes & SPELL_ATTR_STOP_ATTACK_TARGET ) if( m_spellInfo->Attributes & SPELL_ATTR_STOP_ATTACK_TARGET )
m_caster->AttackStop(); m_caster->AttackStop();
// update encounter state if needed
Map *map = m_caster->GetMap();
if (map->IsDungeon())
((DungeonMap*)map)->GetPersistanceState()->UpdateEncounterState(ENCOUNTER_CREDIT_CAST_SPELL, m_spellInfo->Id);
} }
void Spell::SendCastResult(SpellCastResult result) void Spell::SendCastResult(SpellCastResult result)

View file

@ -793,6 +793,9 @@ uint32 Unit::DealDamage(Unit *pVictim, uint32 damage, CleanDamage const* cleanDa
if (save->GetResetTime() < resettime) if (save->GetResetTime() < resettime)
save->SetResetTime(resettime); save->SetResetTime(resettime);
} }
// update encounter state if needed
((DungeonMap*)m)->GetPersistanceState()->UpdateEncounterState(ENCOUNTER_CREDIT_KILL_CREATURE, ((Creature*)cVictim)->GetEntry());
} }
} }
} }

View file

@ -1179,6 +1179,9 @@ void World::SetInitialWorldSettings()
sLog.outString( ">>> Achievements loaded" ); sLog.outString( ">>> Achievements loaded" );
sLog.outString(); sLog.outString();
sLog.outString( "Loading Instance encounters data..." ); // must be after Creature loading
sObjectMgr.LoadInstanceEncounters();
sLog.outString( "Loading Npc Text Id..." ); sLog.outString( "Loading Npc Text Id..." );
sObjectMgr.LoadNpcGossips(); // must be after load Creature and LoadGossipText sObjectMgr.LoadNpcGossips(); // must be after load Creature and LoadGossipText

View file

@ -1,4 +1,4 @@
#ifndef __REVISION_NR_H__ #ifndef __REVISION_NR_H__
#define __REVISION_NR_H__ #define __REVISION_NR_H__
#define REVISION_NR "11784" #define REVISION_NR "11785"
#endif // __REVISION_NR_H__ #endif // __REVISION_NR_H__

View file

@ -1,6 +1,6 @@
#ifndef __REVISION_SQL_H__ #ifndef __REVISION_SQL_H__
#define __REVISION_SQL_H__ #define __REVISION_SQL_H__
#define REVISION_DB_CHARACTERS "required_11716_10_characters_mail" #define REVISION_DB_CHARACTERS "required_11785_02_characters_instance"
#define REVISION_DB_MANGOS "required_11774_01_mangos_spell_proc_event" #define REVISION_DB_MANGOS "required_11785_01_mangos_instance_encounters"
#define REVISION_DB_REALMD "required_10008_01_realmd_realmd_db_version" #define REVISION_DB_REALMD "required_10008_01_realmd_realmd_db_version"
#endif // __REVISION_SQL_H__ #endif // __REVISION_SQL_H__