Core/LFG: Add convenience function to get which random dungeon was selected by queued player

Port From (https://github.com/TrinityCore/TrinityCore/commit/84a0b5569552a9f5a6074d102135933b9a4a52f4)
This commit is contained in:
hondacrx
2019-11-18 10:05:15 -05:00
parent b768173b34
commit 23fa2a5dc9
2 changed files with 25 additions and 12 deletions
+9 -12
View File
@@ -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;
}