mirror of
https://github.com/ZhengPeiRu21/mod-individual-progression
synced 2025-11-29 23:44:51 +08:00
Hp adjustments on player login (#588)
This commit is contained in:
@@ -66,6 +66,25 @@ void IndividualProgression::CheckAdjustments(Player* player) const
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void IndividualProgression::CheckHPAdjustments(Player* player) const
|
||||||
|
{
|
||||||
|
if (!enabled)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Player is still in Vanilla content - give Vanilla health adjustment
|
||||||
|
if (!hasPassedProgression(player, PROGRESSION_PRE_TBC) || (!hasPassedProgression(player, PROGRESSION_PRE_TBC) && (player->GetLevel() <= IP_LEVEL_VANILLA)))
|
||||||
|
{
|
||||||
|
player->SetMaxHealth(player->GetMaxHealth() * vanillaHealthAdjustment);
|
||||||
|
}
|
||||||
|
// Player is in TBC content - give TBC health adjustment
|
||||||
|
else if (!hasPassedProgression(player, PROGRESSION_TBC_TIER_5) || (!hasPassedProgression(player, PROGRESSION_TBC_TIER_5) && (player->GetLevel() <= IP_LEVEL_TBC)))
|
||||||
|
{
|
||||||
|
player->SetMaxHealth(player->GetMaxHealth() * tbcHealthAdjustment);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void IndividualProgression::ApplyGearStatsTuning(Player* player, float& computedAdjustment, ItemTemplate const* item) const
|
void IndividualProgression::ApplyGearStatsTuning(Player* player, float& computedAdjustment, ItemTemplate const* item) const
|
||||||
{
|
{
|
||||||
if (item->Quality != ITEM_QUALITY_EPIC) // Non-endgame gear is okay
|
if (item->Quality != ITEM_QUALITY_EPIC) // Non-endgame gear is okay
|
||||||
|
|||||||
@@ -253,6 +253,7 @@ public:
|
|||||||
void UpdateProgressionState(Player* player, ProgressionState newState) const;
|
void UpdateProgressionState(Player* player, ProgressionState newState) const;
|
||||||
static void ForceUpdateProgressionState(Player* player, ProgressionState newState);
|
static void ForceUpdateProgressionState(Player* player, ProgressionState newState);
|
||||||
void CheckAdjustments(Player* player) const;
|
void CheckAdjustments(Player* player) const;
|
||||||
|
void CheckHPAdjustments(Player* player) const;
|
||||||
void ApplyGearStatsTuning(Player* player, float& computedAdjustment, ItemTemplate const* item) const;
|
void ApplyGearStatsTuning(Player* player, float& computedAdjustment, ItemTemplate const* item) const;
|
||||||
void ComputeGearTuning(Player* player, float& computedAdjustment, ItemTemplate const* item) const;
|
void ComputeGearTuning(Player* player, float& computedAdjustment, ItemTemplate const* item) const;
|
||||||
void AdjustVanillaStats(Player* player) const;
|
void AdjustVanillaStats(Player* player) const;
|
||||||
|
|||||||
@@ -34,6 +34,7 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
sIndividualProgression->CheckAdjustments(player);
|
sIndividualProgression->CheckAdjustments(player);
|
||||||
|
sIndividualProgression->CheckHPAdjustments(player);
|
||||||
sIndividualProgression->checkIPProgression(player);
|
sIndividualProgression->checkIPProgression(player);
|
||||||
|
|
||||||
if ((sIndividualProgression->hasPassedProgression(player, PROGRESSION_MOLTEN_CORE)) && (player->GetQuestStatus(PROGRESSION_FLAG_MC) != QUEST_STATUS_REWARDED))
|
if ((sIndividualProgression->hasPassedProgression(player, PROGRESSION_MOLTEN_CORE)) && (player->GetQuestStatus(PROGRESSION_FLAG_MC) != QUEST_STATUS_REWARDED))
|
||||||
@@ -225,7 +226,7 @@ public:
|
|||||||
void OnPlayerMapChanged(Player* player) override
|
void OnPlayerMapChanged(Player* player) override
|
||||||
{
|
{
|
||||||
sIndividualProgression->CheckAdjustments(player);
|
sIndividualProgression->CheckAdjustments(player);
|
||||||
sIndividualProgression->checkIPProgression(player);
|
sIndividualProgression->checkIPProgression(player);
|
||||||
}
|
}
|
||||||
|
|
||||||
void OnPlayerLevelChanged(Player* player, uint8 /*oldLevel*/) override
|
void OnPlayerLevelChanged(Player* player, uint8 /*oldLevel*/) override
|
||||||
@@ -262,12 +263,14 @@ public:
|
|||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
float gearAdjustment = 0.0;
|
float gearAdjustment = 0.0;
|
||||||
for (uint8 i = EQUIPMENT_SLOT_START; i < EQUIPMENT_SLOT_END; ++i)
|
for (uint8 i = EQUIPMENT_SLOT_START; i < EQUIPMENT_SLOT_END; ++i)
|
||||||
{
|
{
|
||||||
if (Item* item = player->GetItemByPos(INVENTORY_SLOT_BAG_0, i))
|
if (Item* item = player->GetItemByPos(INVENTORY_SLOT_BAG_0, i))
|
||||||
sIndividualProgression->ComputeGearTuning(player, gearAdjustment, item->GetTemplate());
|
sIndividualProgression->ComputeGearTuning(player, gearAdjustment, item->GetTemplate());
|
||||||
}
|
}
|
||||||
|
|
||||||
// Player is still in Vanilla content - give Vanilla health adjustment
|
// Player is still in Vanilla content - give Vanilla health adjustment
|
||||||
if (!sIndividualProgression->hasPassedProgression(player, PROGRESSION_PRE_TBC) || (!sIndividualProgression->hasPassedProgression(player, PROGRESSION_PRE_TBC) && (player->GetLevel() <= IP_LEVEL_VANILLA)))
|
if (!sIndividualProgression->hasPassedProgression(player, PROGRESSION_PRE_TBC) || (!sIndividualProgression->hasPassedProgression(player, PROGRESSION_PRE_TBC) && (player->GetLevel() <= IP_LEVEL_VANILLA)))
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user