diff options
-rw-r--r-- | sql/updates/world/2014_07_10_01_world_lfg_dungeon_template_434.sql | 55 | ||||
-rw-r--r-- | src/server/game/DungeonFinding/LFG.h | 12 | ||||
-rw-r--r-- | src/server/game/DungeonFinding/LFGMgr.cpp | 55 | ||||
-rw-r--r-- | src/server/game/DungeonFinding/LFGMgr.h | 7 | ||||
-rw-r--r-- | src/server/game/Entities/Player/Player.h | 1 | ||||
-rw-r--r-- | src/server/game/Globals/ObjectMgr.cpp | 24 | ||||
-rw-r--r-- | src/server/game/Handlers/LFGHandler.cpp | 22 |
7 files changed, 123 insertions, 53 deletions
diff --git a/sql/updates/world/2014_07_10_01_world_lfg_dungeon_template_434.sql b/sql/updates/world/2014_07_10_01_world_lfg_dungeon_template_434.sql new file mode 100644 index 00000000000..1e2b7449337 --- /dev/null +++ b/sql/updates/world/2014_07_10_01_world_lfg_dungeon_template_434.sql @@ -0,0 +1,55 @@ +DROP TABLE IF EXISTS `lfg_entrances`; +ALTER TABLE `access_requirement` DROP `item_level`; + +DROP TABLE IF EXISTS `lfg_dungeon_template`; +CREATE TABLE IF NOT EXISTS `lfg_dungeon_template` ( + `dungeonId` int(10) unsigned NOT NULL DEFAULT '0' COMMENT 'Unique id from LFGDungeons.dbc', + `name` varchar(255) CHARACTER SET latin1 DEFAULT NULL, + `position_x` float NOT NULL DEFAULT '0', + `position_y` float NOT NULL DEFAULT '0', + `position_z` float NOT NULL DEFAULT '0', + `orientation` float NOT NULL DEFAULT '0', + `requiredItemLevel` smallint(5) NOT NULL DEFAULT '0', + `VerifiedBuild` smallint(5) DEFAULT '0' +) ENGINE=MyISAM DEFAULT CHARSET=utf8; + +ALTER TABLE `lfg_dungeon_template` + ADD PRIMARY KEY (`dungeonId`); + +INSERT INTO `lfg_dungeon_template` (`dungeonId`, `name`, `position_x`, `position_y`, `position_z`, `orientation`, `requiredItemLevel`, `VerifiedBuild`) VALUES +(18, 'Scarlet Monastery - Graveyard', 1688.99, 1053.48, 18.6775, 0.00117, 0, 0), +(26, 'Maraudon - Orange Crystals', 1019.69, -458.31, -43.43, 0.31, 0, 0), +(34, 'Dire Maul - East', 44.4499, -154.822, -2.71201, 0, 0, 0), +(36, 'Dire Maul - West', -62.9658, 159.867, -3.46206, 3.14788, 0, 0), +(38, 'Dire Maul - North', 255.249, -16.0561, -2.58737, 4.7, 0, 0), +(40, 'Stratholme - Main Gate', 3395.09, -3380.25, 142.702, 0.1, 0, 0), +(163, 'Scarlet Monastery - Armory', 1610.83, -323.433, 18.6738, 6.28022, 0, 0), +(164, 'Scarlet Monastery - Cathedral', 855.683, 1321.5, 18.6709, 0.001747, 0, 0), +(165, 'Scarlet Monastery - Library', 255.346, -209.09, 18.6773, 6.26656, 0, 0), +(272, 'Maraudon - Purple Crystals', 752.91, -616.53, -33.11, 1.37, 0, 0), +(273, 'Maraudon - Pristine Waters', 495.702, 17.3372, -96.3128, 3.11854, 0, 0), +(274, 'Stratholme - Service Entrance', 3593.15, -3646.56, 138.5, 5.33, 0, 0), +(285, 'The Headless Horseman', 1797.52, 1347.38, 18.8876, 3.142, 0, 0), +(286, 'The Frost Lord Ahune', -100.396, -95.9996, -4.28423, 4.71239, 0, 0), +(287, 'Coren Direbrew', 897.495, -141.976, -49.7563, 2.1255, 0, 0), +(288, 'The Crown Chemical Co.', -238.075, 2166.43, 88.853, 1.13446, 0, 0), +(210, 'Culling of Stratholme Heroic', 0, 0, 0, 0, 180, 0), +(205, 'Utgarde Pinnacle Heroic', 0, 0, 0, 0, 180, 0), +(211, 'Oculus Heroic', 0, 0, 0, 0, 180, 0), +(212, 'Halls of Lightning Heroic', 0, 0, 0, 0, 180, 0), +(213, 'Halls of Stone Heroic', 0, 0, 0, 0, 180, 0), +(215, 'Drak''Tharon Keep Heroic', 0, 0, 0, 0, 180, 0), +(217, 'Gundrak Heroic', 0, 0, 0, 0, 180, 0), +(219, 'Ahn''kahet: The Old Kingdom Heroic', 0, 0, 0, 0, 180, 0), +(221, 'Violet Hold Heroic', 0, 0, 0, 0, 180, 0), +(226, 'The Nexus Heroic', 0, 0, 0, 0, 180, 0), +(241, 'Azjol-Nerub Heroic', 0, 0, 0, 0, 180, 0), +(242, 'Utgarde Keep Heroic', 0, 0, 0, 0, 180, 0), +(245, 'Trial of the Champion', 0, 0, 0, 0, 200, 0), +(249, 'Trial of the Champion Heroic', 0, 0, 0, 0, 200, 0), +(251, 'Forge of Souls', 0, 0, 0, 0, 200, 0), +(252, 'Forge of Souls Heroic', 0, 0, 0, 0, 200, 0), +(253, 'Pit of Saron', 0, 0, 0, 0, 200, 0), +(254, 'Pit of Saron Heroic', 0, 0, 0, 0, 200, 0), +(255, 'Halls of Reflection (Normal)', 5239.01, 1932.64, 707.695, 0.800565, 219, 0), +(256, 'Halls of Reflection (Heroic)', 5239.01, 1932.64, 707.695, 0.800565, 219, 0); diff --git a/src/server/game/DungeonFinding/LFG.h b/src/server/game/DungeonFinding/LFG.h index 84f5a5ae821..efafd5d3afd 100644 --- a/src/server/game/DungeonFinding/LFG.h +++ b/src/server/game/DungeonFinding/LFG.h @@ -98,8 +98,18 @@ enum LfgAnswer LFG_ANSWER_AGREE = 1 }; +struct LfgLockInfoData +{ + LfgLockInfoData(uint32 _lockStatus = 0, uint16 _requiredItemLevel = 0, float _currentItemLevel = 0) : + lockStatus(_lockStatus), requiredItemLevel(_requiredItemLevel), currentItemLevel(_currentItemLevel) { } + + uint32 lockStatus; + uint16 requiredItemLevel; + float currentItemLevel; +}; + typedef std::set<uint32> LfgDungeonSet; -typedef std::map<uint32, uint32> LfgLockMap; +typedef std::map<uint32, LfgLockInfoData> LfgLockMap; typedef std::map<uint64, LfgLockMap> LfgLockPartyMap; typedef std::set<uint64> LfgGuidSet; typedef std::list<uint64> LfgGuidList; diff --git a/src/server/game/DungeonFinding/LFGMgr.cpp b/src/server/game/DungeonFinding/LFGMgr.cpp index dcf0dc53374..7afe8f9f757 100644 --- a/src/server/game/DungeonFinding/LFGMgr.cpp +++ b/src/server/game/DungeonFinding/LFGMgr.cpp @@ -194,10 +194,10 @@ void LFGMgr::LoadLFGDungeons(bool reload /* = false */) } // Fill teleport locations from DB - QueryResult result = WorldDatabase.Query("SELECT dungeonId, position_x, position_y, position_z, orientation FROM lfg_entrances"); + QueryResult result = WorldDatabase.Query("SELECT dungeonId, position_x, position_y, position_z, orientation, requiredItemLevel FROM lfg_dungeon_template"); if (!result) { - TC_LOG_ERROR("server.loading", ">> Loaded 0 lfg entrance positions. DB table `lfg_entrances` is empty!"); + TC_LOG_ERROR("server.loading", ">> Loaded 0 lfg dungeon templates. DB table `lfg_dungeon_template` is empty!"); return; } @@ -214,17 +214,18 @@ void LFGMgr::LoadLFGDungeons(bool reload /* = false */) continue; } - LFGDungeonData& data = dungeonItr->second; - data.x = fields[1].GetFloat(); - data.y = fields[2].GetFloat(); - data.z = fields[3].GetFloat(); - data.o = fields[4].GetFloat(); + LFGDungeonData& data = dungeonItr->second; + data.x = fields[1].GetFloat(); + data.y = fields[2].GetFloat(); + data.z = fields[3].GetFloat(); + data.o = fields[4].GetFloat(); + data.requiredItemLevel = fields[5].GetUInt16(); ++count; } while (result->NextRow()); - TC_LOG_INFO("server.loading", ">> Loaded %u lfg entrance positions in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + TC_LOG_INFO("server.loading", ">> Loaded %u lfg dungeon templates in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); // Fill all other teleport coords from areatriggers for (LFGDungeonContainer::iterator itr = LfgDungeonStore.begin(); itr != LfgDungeonStore.end(); ++itr) @@ -254,9 +255,7 @@ void LFGMgr::LoadLFGDungeons(bool reload /* = false */) } if (reload) - { CachedDungeonMapStore.clear(); - } } void LFGMgr::Update(uint32 diff) @@ -1563,39 +1562,39 @@ LfgLockMap const LFGMgr::GetLockedDungeons(uint64 guid) if (!dungeon) // should never happen - We provide a list from sLFGDungeonStore continue; - uint32 lockData = 0; + uint32 lockStatus = 0; if (denyJoin) - lockData = LFG_LOCKSTATUS_RAID_LOCKED; + lockStatus = LFG_LOCKSTATUS_RAID_LOCKED; else if (dungeon->expansion > expansion) - lockData = LFG_LOCKSTATUS_INSUFFICIENT_EXPANSION; + lockStatus = LFG_LOCKSTATUS_INSUFFICIENT_EXPANSION; else if (DisableMgr::IsDisabledFor(DISABLE_TYPE_MAP, dungeon->map, player)) - lockData = LFG_LOCKSTATUS_RAID_LOCKED; + lockStatus = LFG_LOCKSTATUS_RAID_LOCKED; else if (dungeon->difficulty > DUNGEON_DIFFICULTY_NORMAL && player->GetBoundInstance(dungeon->map, Difficulty(dungeon->difficulty))) - lockData = LFG_LOCKSTATUS_RAID_LOCKED; + lockStatus = LFG_LOCKSTATUS_RAID_LOCKED; else if (dungeon->minlevel > level) - lockData = LFG_LOCKSTATUS_TOO_LOW_LEVEL; + lockStatus = LFG_LOCKSTATUS_TOO_LOW_LEVEL; else if (dungeon->maxlevel < level) - lockData = LFG_LOCKSTATUS_TOO_HIGH_LEVEL; + lockStatus = LFG_LOCKSTATUS_TOO_HIGH_LEVEL; else if (dungeon->seasonal && !IsSeasonActive(dungeon->id)) - lockData = LFG_LOCKSTATUS_NOT_IN_SEASON; + lockStatus = LFG_LOCKSTATUS_NOT_IN_SEASON; + else if (dungeon->requiredItemLevel > player->GetAverageItemLevel()) + lockStatus = LFG_LOCKSTATUS_TOO_LOW_GEAR_SCORE; else if (AccessRequirement const* ar = sObjectMgr->GetAccessRequirement(dungeon->map, Difficulty(dungeon->difficulty))) { - if (ar->item_level && player->GetAverageItemLevel() < ar->item_level) - lockData = LFG_LOCKSTATUS_TOO_LOW_GEAR_SCORE; - else if (ar->achievement && !player->HasAchieved(ar->achievement)) - lockData = LFG_LOCKSTATUS_MISSING_ACHIEVEMENT; + if (ar->achievement && !player->HasAchieved(ar->achievement)) + lockStatus = LFG_LOCKSTATUS_MISSING_ACHIEVEMENT; else if (player->GetTeam() == ALLIANCE && ar->quest_A && !player->GetQuestRewardStatus(ar->quest_A)) - lockData = LFG_LOCKSTATUS_QUEST_NOT_COMPLETED; + lockStatus = LFG_LOCKSTATUS_QUEST_NOT_COMPLETED; else if (player->GetTeam() == HORDE && ar->quest_H && !player->GetQuestRewardStatus(ar->quest_H)) - lockData = LFG_LOCKSTATUS_QUEST_NOT_COMPLETED; + lockStatus = LFG_LOCKSTATUS_QUEST_NOT_COMPLETED; else if (ar->item) { if (!player->HasItemCount(ar->item) && (!ar->item2 || !player->HasItemCount(ar->item2))) - lockData = LFG_LOCKSTATUS_MISSING_ITEM; + lockStatus = LFG_LOCKSTATUS_MISSING_ITEM; } else if (ar->item2 && !player->HasItemCount(ar->item2)) - lockData = LFG_LOCKSTATUS_MISSING_ITEM; + lockStatus = LFG_LOCKSTATUS_MISSING_ITEM; } /* @todo VoA closed if WG is not under team control (LFG_LOCKSTATUS_RAID_LOCKED) @@ -1604,8 +1603,8 @@ LfgLockMap const LFGMgr::GetLockedDungeons(uint64 guid) lockData = LFG_LOCKSTATUS_ATTUNEMENT_TOO_HIGH_LEVEL; */ - if (lockData) - lock[dungeon->Entry()] = lockData; + if (lockStatus) + lock[dungeon->Entry()] = LfgLockInfoData(lockStatus, dungeon->requiredItemLevel, player->GetAverageItemLevel()); } return lock; diff --git a/src/server/game/DungeonFinding/LFGMgr.h b/src/server/game/DungeonFinding/LFGMgr.h index f163f5f15ad..bca19a6b627 100644 --- a/src/server/game/DungeonFinding/LFGMgr.h +++ b/src/server/game/DungeonFinding/LFGMgr.h @@ -269,12 +269,14 @@ struct LfgPlayerBoot struct LFGDungeonData { LFGDungeonData(): id(0), name(""), map(0), type(0), expansion(0), group(0), minlevel(0), - maxlevel(0), difficulty(REGULAR_DIFFICULTY), seasonal(false), x(0.0f), y(0.0f), z(0.0f), o(0.0f) + maxlevel(0), difficulty(REGULAR_DIFFICULTY), seasonal(false), x(0.0f), y(0.0f), z(0.0f), o(0.0f), + requiredItemLevel(0) { } LFGDungeonData(LFGDungeonEntry const* dbc): id(dbc->ID), name(dbc->name), map(dbc->map), type(dbc->type), expansion(dbc->expansion), group(dbc->grouptype), minlevel(dbc->minlevel), maxlevel(dbc->maxlevel), difficulty(Difficulty(dbc->difficulty)), - seasonal(dbc->flags & LFG_FLAG_SEASONAL), x(0.0f), y(0.0f), z(0.0f), o(0.0f) + seasonal(dbc->flags & LFG_FLAG_SEASONAL), x(0.0f), y(0.0f), z(0.0f), o(0.0f), + requiredItemLevel(0) { } uint32 id; @@ -288,6 +290,7 @@ struct LFGDungeonData Difficulty difficulty; bool seasonal; float x, y, z, o; + uint16 requiredItemLevel; // Helpers uint32 Entry() const { return id + (type << 24); } diff --git a/src/server/game/Entities/Player/Player.h b/src/server/game/Entities/Player/Player.h index 302cb058851..ca3b0ddd695 100644 --- a/src/server/game/Entities/Player/Player.h +++ b/src/server/game/Entities/Player/Player.h @@ -929,7 +929,6 @@ struct AccessRequirement { uint8 levelMin; uint8 levelMax; - uint16 item_level; uint32 item; uint32 item2; uint32 quest_A; diff --git a/src/server/game/Globals/ObjectMgr.cpp b/src/server/game/Globals/ObjectMgr.cpp index 48dc6ae70c5..9cf70892ddc 100644 --- a/src/server/game/Globals/ObjectMgr.cpp +++ b/src/server/game/Globals/ObjectMgr.cpp @@ -6200,8 +6200,8 @@ void ObjectMgr::LoadAccessRequirements() _accessRequirementStore.clear(); // need for reload case } - // 0 1 2 3 4 5 6 7 8 9 10 - QueryResult result = WorldDatabase.Query("SELECT mapid, difficulty, level_min, level_max, item_level, item, item2, quest_done_A, quest_done_H, completed_achievement, quest_failed_text FROM access_requirement"); + // 0 1 2 3 4 5 6 7 8 9 + QueryResult result = WorldDatabase.Query("SELECT mapid, difficulty, level_min, level_max, item, item2, quest_done_A, quest_done_H, completed_achievement, quest_failed_text FROM access_requirement"); if (!result) { @@ -6221,17 +6221,15 @@ void ObjectMgr::LoadAccessRequirements() uint8 difficulty = fields[1].GetUInt8(); uint32 requirement_ID = MAKE_PAIR32(mapid, difficulty); - AccessRequirement* ar = new AccessRequirement(); - - ar->levelMin = fields[2].GetUInt8(); - ar->levelMax = fields[3].GetUInt8(); - ar->item_level = fields[4].GetUInt16(); - ar->item = fields[5].GetUInt32(); - ar->item2 = fields[6].GetUInt32(); - ar->quest_A = fields[7].GetUInt32(); - ar->quest_H = fields[8].GetUInt32(); - ar->achievement = fields[9].GetUInt32(); - ar->questFailedText = fields[10].GetString(); + AccessRequirement* ar = new AccessRequirement(); + ar->levelMin = fields[2].GetUInt8(); + ar->levelMax = fields[3].GetUInt8(); + ar->item = fields[4].GetUInt32(); + ar->item2 = fields[5].GetUInt32(); + ar->quest_A = fields[6].GetUInt32(); + ar->quest_H = fields[7].GetUInt32(); + ar->achievement = fields[8].GetUInt32(); + ar->questFailedText = fields[9].GetString(); if (ar->item) { diff --git a/src/server/game/Handlers/LFGHandler.cpp b/src/server/game/Handlers/LFGHandler.cpp index 5f941027571..7c865c107a5 100644 --- a/src/server/game/Handlers/LFGHandler.cpp +++ b/src/server/game/Handlers/LFGHandler.cpp @@ -28,10 +28,13 @@ void BuildPlayerLockDungeonBlock(WorldPacket& data, lfg::LfgLockMap const& lock) data << uint32(lock.size()); // Size of lock dungeons for (lfg::LfgLockMap::const_iterator it = lock.begin(); it != lock.end(); ++it) { - data << uint32(it->first); // Dungeon entry (id + type) - data << uint32(it->second); // Lock status - data << uint32(0); // Required itemLevel - data << uint32(0); // Current itemLevel + TC_LOG_ERROR("misc", "DungeonID: %u Lock status: %u Required itemLevel: %u Current itemLevel: %f", + (it->first & 0x00FFFFFF), it->second.lockStatus, it->second.requiredItemLevel, it->second.currentItemLevel); + + data << uint32(it->first); // Dungeon entry (id + type) + data << uint32(it->second.lockStatus); // Lock status + data << uint32(it->second.requiredItemLevel); // Required itemLevel + data << uint32(it->second.currentItemLevel); // Current itemLevel } } @@ -596,10 +599,13 @@ void WorldSession::SendLfgJoinResult(lfg::LfgJoinResultData const& joinData) ObjectGuid playerGuid = it->first; for (lfg::LfgLockMap::const_iterator itr = it->second.begin(); itr != it->second.end(); ++itr) { - data << uint32(itr->second); // Lock status - data << uint32(0); // Current itemLevel - data << uint32(0); // Required itemLevel - data << uint32(itr->first); // Dungeon entry (id + type) + TC_LOG_ERROR("misc", "DungeonID: %u Lock status: %u Required itemLevel: %u Current itemLevel: %f", + (itr->first & 0x00FFFFFF), itr->second.lockStatus, itr->second.requiredItemLevel, itr->second.currentItemLevel); + + data << uint32(itr->second.lockStatus); // Lock status + data << uint32(itr->second.currentItemLevel); // Current itemLevel + data << uint32(itr->second.requiredItemLevel); // Required itemLevel + data << uint32(itr->first); // Dungeon entry (id + type) } data.WriteByteSeq(playerGuid[2]); |