Core/LFG: Change InstanceScript::UpdateLfgEncounterState to only pass valid dungeon encounter ids to LFGMgr
Port From (https://github.com/TrinityCore/TrinityCore/commit/db4af7ca4cd105b5a1dd1493fb1740cdd27329bb)
This commit is contained in:
@@ -1339,9 +1339,9 @@ namespace Game.DungeonFinding
|
|||||||
/// Check if dungeon can be rewarded, if any.
|
/// Check if dungeon can be rewarded, if any.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="gguid">Group guid</param>
|
/// <param name="gguid">Group guid</param>
|
||||||
/// <param name="dungeonEncounterIds">DungeonEncounter that was just completed</param>
|
/// <param name="dungeonEncounters">DungeonEncounter that was just completed</param>
|
||||||
/// <param name="currMap">Map of the instance where encounter was completed</param>
|
/// <param name="currMap">Map of the instance where encounter was completed</param>
|
||||||
public void OnDungeonEncounterDone(ObjectGuid gguid, uint[] dungeonEncounterIds, Map currMap)
|
public void OnDungeonEncounterDone(ObjectGuid gguid, uint[] dungeonEncounters, Map currMap)
|
||||||
{
|
{
|
||||||
if (GetState(gguid) == LfgState.FinishedDungeon) // Shouldn't happen. Do not reward multiple times
|
if (GetState(gguid) == LfgState.FinishedDungeon) // Shouldn't happen. Do not reward multiple times
|
||||||
{
|
{
|
||||||
@@ -1352,7 +1352,7 @@ namespace Game.DungeonFinding
|
|||||||
uint gDungeonId = GetDungeon(gguid);
|
uint gDungeonId = GetDungeon(gguid);
|
||||||
LFGDungeonData dungeonDone = GetLFGDungeon(gDungeonId);
|
LFGDungeonData dungeonDone = GetLFGDungeon(gDungeonId);
|
||||||
// LFGDungeons can point to a DungeonEncounter from any difficulty so we need this kind of lenient check
|
// LFGDungeons can point to a DungeonEncounter from any difficulty so we need this kind of lenient check
|
||||||
if (dungeonDone.finalDungeonEncounterId == 0 || !dungeonEncounterIds.Contains(dungeonDone.finalDungeonEncounterId))
|
if (dungeonDone.finalDungeonEncounterId == 0 || !dungeonEncounters.Contains(dungeonDone.finalDungeonEncounterId))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
FinishDungeon(gguid, gDungeonId, currMap);
|
FinishDungeon(gguid, gDungeonId, currMap);
|
||||||
|
|||||||
@@ -138,8 +138,9 @@ namespace Game.Maps
|
|||||||
void LoadDungeonEncounterData(uint bossId, uint[] dungeonEncounterIds)
|
void LoadDungeonEncounterData(uint bossId, uint[] dungeonEncounterIds)
|
||||||
{
|
{
|
||||||
if (bossId < bosses.Count)
|
if (bossId < bosses.Count)
|
||||||
for (int i = 0; i < dungeonEncounterIds.Length && i < MapConst.MaxDungeonEncountersPerBoss; ++i)
|
for (int i = 0, j = 0; i < dungeonEncounterIds.Length && i < MapConst.MaxDungeonEncountersPerBoss; ++i)
|
||||||
bosses[bossId].DungeonEncounters[i] = CliDB.DungeonEncounterStorage.LookupByKey(dungeonEncounterIds[i]);
|
if (dungeonEncounterIds[i] != 0)
|
||||||
|
bosses[bossId].DungeonEncounters[j++] = CliDB.DungeonEncounterStorage.LookupByKey(dungeonEncounterIds[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public virtual void UpdateDoorState(GameObject door)
|
public virtual void UpdateDoorState(GameObject door)
|
||||||
@@ -724,10 +725,9 @@ namespace Game.Maps
|
|||||||
|
|
||||||
public bool IsEncounterCompleted(uint dungeonEncounterId)
|
public bool IsEncounterCompleted(uint dungeonEncounterId)
|
||||||
{
|
{
|
||||||
for (uint i = 0; i < bosses.Count; ++i)
|
foreach (var (_, boss) in bosses)
|
||||||
for (var j = 0; j < bosses[i].DungeonEncounters.Length; ++j)
|
if (boss.DungeonEncounters.Any(p => p.Id == dungeonEncounterId))
|
||||||
if (bosses[i].DungeonEncounters[j] != null && bosses[i].DungeonEncounters[j].Id == dungeonEncounterId)
|
return boss.state == EncounterState.Done;
|
||||||
return bosses[i].state == EncounterState.Done;
|
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user