Correctly update progression for group members

This commit is contained in:
郑佩茹
2022-12-07 17:13:18 -07:00
parent a405afeb6d
commit 51bcb6574a
3 changed files with 86 additions and 65 deletions

View File

@@ -202,6 +202,81 @@ bool IndividualProgression::hasCustomProgressionValue(uint32 creatureEntry)
}
void IndividualProgression::checkKillProgression(Player* killer, Creature* killed)
{
if (!enabled)
{
return;
}
if (hasCustomProgressionValue(killed->GetEntry()))
{
UpdateProgressionState(killer, static_cast<ProgressionState>(customProgressionMap[killed->GetEntry()]));
return;
}
if (disableDefaultProgression)
{
return;
}
switch (killed->GetEntry())
{
case RAGNAROS:
UpdateProgressionState(killer, PROGRESSION_MOLTEN_CORE);
break;
case ONYXIA:
UpdateProgressionState(killer, PROGRESSION_ONYXIA);
break;
case NEFARIAN:
if (requirePreAQQuests)
{
UpdateProgressionState(killer, PROGRESSION_BLACKWING_LAIR);
}
else
{
UpdateProgressionState(killer, PROGRESSION_PRE_AQ);
}
break;
case CTHUN:
UpdateProgressionState(killer, PROGRESSION_AQ);
break;
case KELTHUZAD_40:
UpdateProgressionState(killer, PROGRESSION_NAXX40);
break;
case MALCHEZAAR:
UpdateProgressionState(killer, PROGRESSION_TBC_TIER_1);
break;
case KAELTHAS:
UpdateProgressionState(killer, PROGRESSION_TBC_TIER_2);
break;
case ILLIDAN:
UpdateProgressionState(killer, PROGRESSION_TBC_TIER_3);
break;
case ZULJIN:
UpdateProgressionState(killer, PROGRESSION_TBC_TIER_4);
break;
case KILJAEDEN:
UpdateProgressionState(killer, PROGRESSION_TBC_TIER_5);
break;
case KELTHUZAD:
UpdateProgressionState(killer, PROGRESSION_WOTLK_TIER_1);
break;
case YOGGSARON:
UpdateProgressionState(killer, PROGRESSION_WOTLK_TIER_2);
break;
case ANUBARAK:
UpdateProgressionState(killer, PROGRESSION_WOTLK_TIER_3);
break;
case LICH_KING:
UpdateProgressionState(killer, PROGRESSION_WOTLK_TIER_4);
break;
case HALION:
UpdateProgressionState(killer, PROGRESSION_WOTLK_TIER_5);
break;
}
}
class IndividualPlayerProgression_WorldScript : public WorldScript
{
private:

View File

@@ -145,6 +145,7 @@ public:
void AdjustTBCStats(Player* player) const;
void AdjustWotLKStats(Player* player) const;
bool hasCustomProgressionValue(uint32 creatureEntry);
void checkKillProgression(Player* player, Creature* killed);
static void LoadCustomProgressionEntries(const std::string& customProgressionString);
static void AdjustStats(Player* player, float computedAdjustment, float computedHealingAdjustment);
static uint8 GetAccountProgression(uint32 accountId);

View File

@@ -260,75 +260,20 @@ public:
void OnCreatureKill(Player* killer, Creature* killed) override
{
if (!sIndividualProgression->enabled)
sIndividualProgression->checkKillProgression(killer, killed);
Group* group = killer->GetGroup();
if (!group)
{
return;
}
for (GroupReference* itr = group->GetFirstMember(); itr != nullptr; itr = itr->next())
{
Player* member = itr->GetSource();
if (!member)
continue;
if (sIndividualProgression->hasCustomProgressionValue(killed->GetEntry()))
{
sIndividualProgression->UpdateProgressionState(killer, static_cast<ProgressionState>(sIndividualProgression->customProgressionMap[killed->GetEntry()]));
return;
}
if (sIndividualProgression->disableDefaultProgression)
{
return;
}
switch (killed->GetEntry())
{
case RAGNAROS:
sIndividualProgression->UpdateProgressionState(killer, PROGRESSION_MOLTEN_CORE);
break;
case ONYXIA:
sIndividualProgression->UpdateProgressionState(killer, PROGRESSION_ONYXIA);
break;
case NEFARIAN:
if (sIndividualProgression->requirePreAQQuests)
{
sIndividualProgression->UpdateProgressionState(killer, PROGRESSION_BLACKWING_LAIR);
}
else
{
sIndividualProgression->UpdateProgressionState(killer, PROGRESSION_PRE_AQ);
}
break;
case CTHUN:
sIndividualProgression->UpdateProgressionState(killer, PROGRESSION_AQ);
break;
case KELTHUZAD_40:
sIndividualProgression->UpdateProgressionState(killer, PROGRESSION_NAXX40);
break;
case MALCHEZAAR:
sIndividualProgression->UpdateProgressionState(killer, PROGRESSION_TBC_TIER_1);
break;
case KAELTHAS:
sIndividualProgression->UpdateProgressionState(killer, PROGRESSION_TBC_TIER_2);
break;
case ILLIDAN:
sIndividualProgression->UpdateProgressionState(killer, PROGRESSION_TBC_TIER_3);
break;
case ZULJIN:
sIndividualProgression->UpdateProgressionState(killer, PROGRESSION_TBC_TIER_4);
break;
case KILJAEDEN:
sIndividualProgression->UpdateProgressionState(killer, PROGRESSION_TBC_TIER_5);
break;
case KELTHUZAD:
sIndividualProgression->UpdateProgressionState(killer, PROGRESSION_WOTLK_TIER_1);
break;
case YOGGSARON:
sIndividualProgression->UpdateProgressionState(killer, PROGRESSION_WOTLK_TIER_2);
break;
case ANUBARAK:
sIndividualProgression->UpdateProgressionState(killer, PROGRESSION_WOTLK_TIER_3);
break;
case LICH_KING:
sIndividualProgression->UpdateProgressionState(killer, PROGRESSION_WOTLK_TIER_4);
break;
case HALION:
sIndividualProgression->UpdateProgressionState(killer, PROGRESSION_WOTLK_TIER_5);
break;
if (killer->IsAtLootRewardDistance(member))
sIndividualProgression->checkKillProgression(member, killed);
}
}