diff options
author | Vincent-Michael <Vincent_Michael@gmx.de> | 2014-07-10 21:45:11 +0200 |
---|---|---|
committer | Vincent-Michael <Vincent_Michael@gmx.de> | 2014-07-10 21:45:11 +0200 |
commit | bb7233baa3b1b43584146e7883d32e53919f8502 (patch) | |
tree | 8a9c7a57dee16c4d31503c03c975e4a643565da0 /src/server | |
parent | b44f38ab5dfd1800c63fa0f2e08243853ac35b69 (diff) |
Core/LFG: Added support for display of required item level. for player / group member
Diffstat (limited to 'src/server')
-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 |
6 files changed, 68 insertions, 53 deletions
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]); |