diff --git a/Source/Game/DungeonFinding/LFGManager.cs b/Source/Game/DungeonFinding/LFGManager.cs index 455d20b35..6d23fca4f 100644 --- a/Source/Game/DungeonFinding/LFGManager.cs +++ b/Source/Game/DungeonFinding/LFGManager.cs @@ -1486,6 +1486,22 @@ namespace Game.DungeonFinding return PlayersStore[guid].GetSelectedDungeons(); } + public uint GetSelectedRandomDungeon(ObjectGuid guid) + { + if (GetState(guid) != LfgState.None) + { + var dungeons = GetSelectedDungeons(guid); + if (!dungeons.Empty()) + { + LFGDungeonData dungeon = GetLFGDungeon(dungeons.First()); + if (dungeon != null && dungeon.type == LfgType.Raid) + return dungeons.First(); + } + } + + return 0; + } + public Dictionary GetLockedDungeons(ObjectGuid guid) { Dictionary lockDic = new Dictionary(); diff --git a/Source/Game/Groups/Group.cs b/Source/Game/Groups/Group.cs index 9638fe4f2..5ec433880 100644 --- a/Source/Game/Groups/Group.cs +++ b/Source/Game/Groups/Group.cs @@ -1426,23 +1426,20 @@ namespace Game.Groups partyUpdate.LfgInfos.Value.Aborted = false; partyUpdate.LfgInfos.Value.MyFlags = (byte)(Global.LFGMgr.GetState(m_guid) == LfgState.FinishedDungeon ? 2 : 0); - - uint randomSlot = 0; - var selectedDungeons = Global.LFGMgr.GetSelectedDungeons(player.GetGUID()); - if (selectedDungeons.Count == 1) - { - LFGDungeonsRecord dungeon = CliDB.LFGDungeonsStorage.LookupByKey(selectedDungeons.First()); - if (dungeon != null) - if (dungeon.TypeID == LfgType.RandomDungeon) - randomSlot= dungeon.Id; - } - - partyUpdate.LfgInfos.Value.MyRandomSlot = randomSlot; + partyUpdate.LfgInfos.Value.MyRandomSlot = Global.LFGMgr.GetSelectedRandomDungeon(player.GetGUID()); partyUpdate.LfgInfos.Value.MyPartialClear = 0; partyUpdate.LfgInfos.Value.MyGearDiff = 0.0f; partyUpdate.LfgInfos.Value.MyFirstReward = false; + DungeonFinding.LfgReward reward = Global.LFGMgr.GetRandomDungeonReward(partyUpdate.LfgInfos.Value.MyRandomSlot, player.GetLevel()); + if (reward != null) + { + Quest quest = Global.ObjectMgr.GetQuestTemplate(reward.firstQuest); + if (quest != null) + partyUpdate.LfgInfos.Value.MyFirstReward = player.CanRewardQuest(quest, false); + } + partyUpdate.LfgInfos.Value.MyStrangerCount = 0; partyUpdate.LfgInfos.Value.MyKickVoteCount = 0; }