diff options
Diffstat (limited to 'src/server')
| -rw-r--r-- | src/server/game/DataStores/DBCStores.cpp | 22 | ||||
| -rw-r--r-- | src/server/game/DataStores/DBCStores.h | 2 | ||||
| -rw-r--r-- | src/server/game/Entities/Player/Player.cpp | 21 | ||||
| -rw-r--r-- | src/server/game/Entities/Player/Player.h | 4 | ||||
| -rw-r--r-- | src/server/game/Maps/MapInstanced.cpp | 2 | 
5 files changed, 34 insertions, 17 deletions
| diff --git a/src/server/game/DataStores/DBCStores.cpp b/src/server/game/DataStores/DBCStores.cpp index 9789574c23d..540d4cf6d9e 100644 --- a/src/server/game/DataStores/DBCStores.cpp +++ b/src/server/game/DataStores/DBCStores.cpp @@ -883,9 +883,9 @@ void Map2ZoneCoordinates(float& x, float& y, uint32 zone)      std::swap(x, y);                                         // client have map coords swapped  } -MapDifficultyEntry const* GetDefaultMapDifficulty(uint32 mapID) +MapDifficultyEntry const* GetDefaultMapDifficulty(uint32 mapId, Difficulty* difficulty /*= nullptr*/)  { -    auto itr = sMapDifficultyMap.find(mapID); +    auto itr = sMapDifficultyMap.find(mapId);      if (itr == sMapDifficultyMap.end())          return nullptr; @@ -894,14 +894,22 @@ MapDifficultyEntry const* GetDefaultMapDifficulty(uint32 mapID)      for (auto& p : itr->second)      { -        DifficultyEntry const* difficulty = sDifficultyStore.LookupEntry(p.first); -        if (!difficulty) +        DifficultyEntry const* difficultyEntry = sDifficultyStore.LookupEntry(p.first); +        if (!difficultyEntry)              continue; -        if (difficulty->Flags & DIFFICULTY_FLAG_DEFAULT) +        if (difficultyEntry->Flags & DIFFICULTY_FLAG_DEFAULT) +        { +            if (difficulty) +                *difficulty = Difficulty(p.first); +              return p.second; +        }      } +    if (difficulty) +        *difficulty = Difficulty(itr->second.begin()->first); +      return itr->second.begin()->second;  } @@ -922,7 +930,7 @@ MapDifficultyEntry const* GetDownscaledMapDifficultyData(uint32 mapId, Difficult  {      DifficultyEntry const* diffEntry = sDifficultyStore.LookupEntry(difficulty);      if (!diffEntry) -        return GetDefaultMapDifficulty(mapId); +        return GetDefaultMapDifficulty(mapId, &difficulty);      uint32 tmpDiff = difficulty;      MapDifficultyEntry const* mapDiff = GetMapDifficultyData(mapId, Difficulty(tmpDiff)); @@ -931,7 +939,7 @@ MapDifficultyEntry const* GetDownscaledMapDifficultyData(uint32 mapId, Difficult          tmpDiff = diffEntry->FallbackDifficultyID;          diffEntry = sDifficultyStore.LookupEntry(tmpDiff);          if (!diffEntry) -            return GetDefaultMapDifficulty(mapId); +            return GetDefaultMapDifficulty(mapId, &difficulty);          // pull new data          mapDiff = GetMapDifficultyData(mapId, Difficulty(tmpDiff)); // we are 10 normal or 25 normal diff --git a/src/server/game/DataStores/DBCStores.h b/src/server/game/DataStores/DBCStores.h index 286c4d5e6c3..5ad47549351 100644 --- a/src/server/game/DataStores/DBCStores.h +++ b/src/server/game/DataStores/DBCStores.h @@ -66,7 +66,7 @@ void Zone2MapCoordinates(float &x, float &y, uint32 zone);  void Map2ZoneCoordinates(float &x, float &y, uint32 zone);  typedef std::unordered_map<uint32, std::unordered_map<uint32, MapDifficultyEntry const*>> MapDifficultyMap; -MapDifficultyEntry const* GetDefaultMapDifficulty(uint32 mapID); +MapDifficultyEntry const* GetDefaultMapDifficulty(uint32 mapId, Difficulty* difficulty = nullptr);  MapDifficultyEntry const* GetMapDifficultyData(uint32 mapId, Difficulty difficulty);  MapDifficultyEntry const* GetDownscaledMapDifficultyData(uint32 mapId, Difficulty &difficulty); diff --git a/src/server/game/Entities/Player/Player.cpp b/src/server/game/Entities/Player/Player.cpp index a24283d75d6..96e58f41fc6 100644 --- a/src/server/game/Entities/Player/Player.cpp +++ b/src/server/game/Entities/Player/Player.cpp @@ -802,7 +802,7 @@ Player::Player(WorldSession* session): Unit(true)      m_dungeonDifficulty = DIFFICULTY_NORMAL;      m_raidDifficulty = DIFFICULTY_NORMAL_RAID;      m_legacyRaidDifficulty = DIFFICULTY_10_N; -    m_raidMapDifficulty = DIFFICULTY_NORMAL_RAID; +    m_prevMapDifficulty = DIFFICULTY_NORMAL_RAID;      m_lastPotionId = 0;      _talentMgr = new PlayerTalentInfo(); @@ -19990,10 +19990,10 @@ void Player::SendExplorationExperience(uint32 Area, uint32 Experience)      GetSession()->SendPacket(WorldPackets::Misc::ExplorationExperience(Experience, Area).Write());  } -void Player::SendDungeonDifficulty() +void Player::SendDungeonDifficulty(int32 forcedDifficulty /*= -1*/)  {      WorldPackets::Misc::DungeonDifficultySet dungeonDifficultySet; -    dungeonDifficultySet.DifficultyID = GetDungeonDifficultyID(); +    dungeonDifficultySet.DifficultyID = forcedDifficulty == -1 ? GetDungeonDifficultyID() : forcedDifficulty;      GetSession()->SendPacket(dungeonDifficultySet.Write());  } @@ -22642,11 +22642,20 @@ void Player::SendInitialPacketsAfterAddToMap()      if (GetMap()->IsRaid())      { -        DifficultyEntry const* difficulty = sDifficultyStore.AssertEntry(GetMap()->GetDifficultyID()); -        SendRaidDifficulty((difficulty->Flags & DIFFICULTY_FLAG_LEGACY) != 0, GetMap()->GetDifficultyID()); +        m_prevMapDifficulty = GetMap()->GetDifficultyID(); +        DifficultyEntry const* difficulty = sDifficultyStore.AssertEntry(m_prevMapDifficulty); +        SendRaidDifficulty((difficulty->Flags & DIFFICULTY_FLAG_LEGACY) != 0, m_prevMapDifficulty);      }      else if (GetMap()->IsNonRaidDungeon()) -        SendDungeonDifficulty(); +    { +        m_prevMapDifficulty = GetMap()->GetDifficultyID(); +        SendDungeonDifficulty(m_prevMapDifficulty); +    } +    else if (!GetMap()->Instanceable()) +    { +        DifficultyEntry const* difficulty = sDifficultyStore.AssertEntry(m_prevMapDifficulty); +        SendRaidDifficulty((difficulty->Flags & DIFFICULTY_FLAG_LEGACY) != 0); +    }      if (_garrison)          _garrison->SendRemoteInfo(); diff --git a/src/server/game/Entities/Player/Player.h b/src/server/game/Entities/Player/Player.h index f8518f3dacc..5bae50edb68 100644 --- a/src/server/game/Entities/Player/Player.h +++ b/src/server/game/Entities/Player/Player.h @@ -2132,7 +2132,7 @@ class Player : public Unit, public GridObject<Player>          void SendAutoRepeatCancel(Unit* target);          void SendExplorationExperience(uint32 Area, uint32 Experience); -        void SendDungeonDifficulty(); +        void SendDungeonDifficulty(int32 forcedDifficulty = -1);          void SendRaidDifficulty(bool legacy, int32 forcedDifficulty = -1);          void ResetInstances(uint8 method, bool isRaid, bool isLegacy);          void SendResetInstanceSuccess(uint32 MapId); @@ -2760,7 +2760,7 @@ class Player : public Unit, public GridObject<Player>          Difficulty m_dungeonDifficulty;          Difficulty m_raidDifficulty;          Difficulty m_legacyRaidDifficulty; -        Difficulty m_raidMapDifficulty; +        Difficulty m_prevMapDifficulty;          uint32 m_atLoginFlags; diff --git a/src/server/game/Maps/MapInstanced.cpp b/src/server/game/Maps/MapInstanced.cpp index 473e3163216..bd69844ae7c 100644 --- a/src/server/game/Maps/MapInstanced.cpp +++ b/src/server/game/Maps/MapInstanced.cpp @@ -214,7 +214,7 @@ InstanceMap* MapInstanced::CreateInstance(uint32 InstanceId, InstanceSave* save,      // some instances only have one difficulty      GetDownscaledMapDifficultyData(GetId(), difficulty); -    TC_LOG_DEBUG("maps", "MapInstanced::CreateInstance: %s map instance %d for %d created with difficulty %s", save?"":"new ", InstanceId, GetId(), difficulty?"heroic":"normal"); +    TC_LOG_DEBUG("maps", "MapInstanced::CreateInstance: %s map instance %d for %d created with difficulty %s", save ? "" : "new ", InstanceId, GetId(), difficulty ? "heroic" : "normal");      InstanceMap* map = new InstanceMap(GetId(), GetGridExpiry(), InstanceId, difficulty, this);      ASSERT(map->IsDungeon()); | 
