diff --git a/data/sql/updates/pending_db_world/rev_1639624033697103469.sql b/data/sql/updates/pending_db_world/rev_1639624033697103469.sql new file mode 100644 index 000000000..4e07a06f0 --- /dev/null +++ b/data/sql/updates/pending_db_world/rev_1639624033697103469.sql @@ -0,0 +1,23 @@ +INSERT INTO `version_db_world` (`sql_rev`) VALUES ('1639624033697103469'); + +-- Delete Reported Missing game_event_creature +DELETE FROM `game_event_creature` WHERE `guid` IN ( 85635, 85636, 85701, 85702, 85703, 85704, 85705, 85706, 85707, 85708, 85709, 85710, +85711, 86165, 86849, 86850, 94513, 94586, 94696, 94715, 94716, 94717, 94724, 94726, 94733, 152261, 152262, 152263, 152264, 152265, 152266, +152267, 152268, 152269, 152270, 152271, 152272, 152273, 152274, 152275, 152276, 200002, 202863, 207170, 240400, 240401, 240402, 240403, +240404, 240405, 240406, 240407, 240408, 240409, 240410, 240411, 240412, 240421, 240422, 240423, 240424, 240425, 240426, 240436, 240437, +240438, 240439, 240440, 240441, 240442, 240443, 240444, 240445, 240446, 240447, 240448, 240449, 240450, 240451, 240452, 240453, 240454, +240465, 240466, 240467, 240468, 240470, 240471, 240472, 240473, 240474, 240475, 240476, 240477, 240478, 240479, 240480, 240481, 240482, +240483, 240484, 240485, 240486, 240498, 240499, 240500, 240501, 240502, 240503, 240504, 240505, 240506, 240507, 240508, 240509, 240510, +240511, 240512, 240513, 240514, 240515, 240516, 240517, 240527, 240528, 240529, 240530, 240537, 240538, 240539, 240540, 240541, 240542, +240543, 240544, 240545, 240546, 240547, 240548, 240549, 240550, 240551, 240552, 240557, 240558, 240559, 240560, 240561, 240562, 240563, +240564, 240565, 240566, 240567, 240568, 240569, 240570, 240571, 240572, 240573, 240574, 240575, 240576, 240587, 240588, 240589, 240590, +240591, 240592, 240593, 240594, 240595, 240596, 240597, 240598, 240599, 240600, 240601, 240602, 240603, 240604, 240605, 240606, 240620, +240621, 240622, 240623, 240624, 240625, 240626, 240627, 240628, 240629, 240630, 240631, 240632, 240633, 240634, 240635, 240636, 240637, +240638, 240639, 244399, 244500, 244510 ); + +-- Delete Reported Missing game_event_gameobject +DELETE FROM `game_event_gameobject` WHERE `guid` IN ( 36, 38, 40, 6559, 6613, 6613, 9729, 11140, 17834, 17857, 18015, 21018, 21498, +31641, 31645, 31668, 31669, 31671, 31672, 50552, 50553, 50554, 50574, 50582, 50642, 50643, 50644, 50645, 50646, 50647, 50648, 50649, 50675, +50676, 50677, 50678, 50679, 50680, 50681, 50682, 50683, 50684, 50685, 50686, 50687, 50688, 50689, 50690, 50691, 50692, 50693, 50694, 50695, +50696, 50810, 50828, 50940, 50957, 50972, 50973, 50974, 50975, 50976, 50977, 50978, 50979, 50981, 50984, 50985, 50986, 50987, 50988, 54315, +54316, 70547, 70594, 150706, 150857, 150868, 150995, 151015 ); diff --git a/src/server/game/Events/GameEventMgr.cpp b/src/server/game/Events/GameEventMgr.cpp index ca11e041a..8229a69d0 100644 --- a/src/server/game/Events/GameEventMgr.cpp +++ b/src/server/game/Events/GameEventMgr.cpp @@ -394,9 +394,8 @@ void GameEventMgr::LoadFromDB() { uint32 oldMSTime = getMSTime(); - // 1 2 - QueryResult result = WorldDatabase.Query("SELECT creature.guid, game_event_creature.eventEntry FROM creature" - " JOIN game_event_creature ON creature.guid = game_event_creature.guid"); + // 0 1 + QueryResult result = WorldDatabase.Query("SELECT guid, eventEntry FROM game_event_creature"); if (!result) { @@ -413,6 +412,13 @@ void GameEventMgr::LoadFromDB() ObjectGuid::LowType guid = fields[0].GetUInt32(); int16 event_id = fields[1].GetInt8(); + CreatureData const* data = sObjectMgr->GetCreatureData(guid); + if (!data) + { + LOG_ERROR("sql.sql", "`game_event_creature` contains creature (GUID: %u) not found in `creature` table.", guid); + continue; + } + int32 internal_event_id = mGameEvent.size() + event_id - 1; if (internal_event_id < 0 || internal_event_id >= int32(mGameEventCreatureGuids.size())) @@ -436,9 +442,8 @@ void GameEventMgr::LoadFromDB() { uint32 oldMSTime = getMSTime(); - // 0 1 - QueryResult result = WorldDatabase.Query("SELECT gameobject.guid, game_event_gameobject.eventEntry FROM gameobject" - " JOIN game_event_gameobject ON gameobject.guid=game_event_gameobject.guid"); + // 0 1 + QueryResult result = WorldDatabase.Query("SELECT guid, eventEntry FROM game_event_gameobject"); if (!result) { @@ -457,6 +462,13 @@ void GameEventMgr::LoadFromDB() int32 internal_event_id = mGameEvent.size() + event_id - 1; + GameObjectData const* data = sObjectMgr->GetGOData(guid); + if (!data) + { + LOG_ERROR("sql.sql", "`game_event_gameobject` contains gameobject (GUID: %u) not found in `gameobject` table.", guid); + continue; + } + if (internal_event_id < 0 || internal_event_id >= int32(mGameEventGameobjectGuids.size())) { LOG_ERROR("sql.sql", "`game_event_gameobject` game event id (%i) is out of range compared to max event id in `game_event`", event_id);