mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-02-16 06:58:52 +01:00
Core/Instances: corrected check added in last commit to ensure that heroic difficulty vanilla dungeons still get counted as valid dungeon for challenged
This commit is contained in:
@@ -726,6 +726,7 @@ void InstanceScript::UpdateEncounterState(EncounterCreditType type, uint32 credi
|
||||
uint32 dungeonId = 0;
|
||||
uint32 encounterId = 0;
|
||||
|
||||
bool isFinalEncounter = false;
|
||||
for (DungeonEncounter const* encounter : *encounters)
|
||||
{
|
||||
if (encounter->creditType != type || encounter->creditEntry != creditEntry)
|
||||
@@ -737,6 +738,7 @@ void InstanceScript::UpdateEncounterState(EncounterCreditType type, uint32 credi
|
||||
// Encounter is marked as final encounter of the dungeon
|
||||
if (encounter->lastEncounterDungeon)
|
||||
{
|
||||
isFinalEncounter = true;
|
||||
dungeonId = encounter->lastEncounterDungeon;
|
||||
|
||||
if (instance->GetDifficulty() != sLFGDungeonStore.LookupEntry(encounter->lastEncounterDungeon)->DifficultyID)
|
||||
@@ -745,6 +747,19 @@ void InstanceScript::UpdateEncounterState(EncounterCreditType type, uint32 credi
|
||||
TC_LOG_DEBUG("lfg", "UpdateEncounterState: Instance %s (instanceId %u) completed encounter %s. Credit Dungeon: %u", instance->GetMapName(), instance->GetInstanceId(), encounter->dbcEntry->Name, dungeonId);
|
||||
break;
|
||||
}
|
||||
else if (instance->IsRaid())
|
||||
{
|
||||
// Obtain a improvised dungeon ID to get level requirements for guild challenge rewards and news entry.
|
||||
for (LFGDungeonEntry const* dungeonEntry : sLFGDungeonStore)
|
||||
{
|
||||
uint8 difficulty = encounter->dbcEntry->DifficultyID != -1 ? encounter->dbcEntry->DifficultyID : instance->GetDifficulty();
|
||||
if (dungeonEntry->MapID != instance->GetId() || dungeonEntry->DifficultyID != instance->GetDifficulty())
|
||||
continue;
|
||||
|
||||
dungeonId = dungeonEntry->ID;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bool LFGRewarded = false;
|
||||
@@ -781,7 +796,7 @@ void InstanceScript::UpdateEncounterState(EncounterCreditType type, uint32 credi
|
||||
}
|
||||
|
||||
// Dungeon Reward handling
|
||||
if (group->isLFGGroup() && !LFGRewarded && dungeonId)
|
||||
if (group->isLFGGroup() && !LFGRewarded && dungeonId && isFinalEncounter)
|
||||
{
|
||||
sLFGMgr->FinishDungeon(group->GetGUID(), dungeonId, instance);
|
||||
LFGRewarded = true;
|
||||
@@ -789,14 +804,17 @@ void InstanceScript::UpdateEncounterState(EncounterCreditType type, uint32 credi
|
||||
}
|
||||
|
||||
// Reward eligible guild challenges
|
||||
uint8 appropriateMaxLevel = DBCManager::GetMaxLevelForExpansion(sMapStore.AssertEntry(instance->GetId())->Expansion());
|
||||
LFGDungeonEntry const* entry = sLFGDungeonStore.LookupEntry(dungeonId);
|
||||
if (!entry)
|
||||
return;
|
||||
|
||||
for (auto itr : minlevelByGuild)
|
||||
{
|
||||
Guild* guild = sGuildMgr->GetGuildById(itr.first);
|
||||
if (!guild)
|
||||
continue;
|
||||
|
||||
if (itr.second <= appropriateMaxLevel)
|
||||
if (itr.second <= entry->Maxlevel)
|
||||
{
|
||||
if (Player* player = playersByGuild[itr.first])
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user