-
Couldn't load subscription status.
- Fork 51
Description
While using Solocraft I noticed that if for some reason I logout while being in a dungeon/instance and then relog back in I do not get the buff from this module. To add insult to injury if I leave the instance my character gets debuffed again.
Looking at the code and doing some minor testing it appears it debuffs your character on login and then turns around and tries to add the buff to your character. I assume this is because of mapchange being called a few times on login.
I noticed it runs through this code both times:
// Adjust player stats
_unitDifficulty[player->GetGUID()] = difficulty;
for (int32 i = STAT_STRENGTH; i < MAX_STATS; ++i)
{
// Buff the player
player->HandleStatModifier(UnitMods(UNIT_MOD_STAT_START + i), TOTAL_PCT, float(difficulty * 100), true);
}
// Set player health
player->SetFullHealth();
if (player->getPowerType() == POWER_MANA)
{
// Buff the player's health
player->SetPower(POWER_MANA, player->GetMaxPower(POWER_MANA));
}
The first time it passes through the difficulty is 1. The second time it uses the set dungeon difficulty but it fails to apply the buff. I think it works only on a mapchange because the character goes through some sort of refresh. The HandleStatModifier and the SetFullHealth methods don't seem to do the refresh alone. I have been trying to fix this but can't find any documentation or any examples in the Azerothcore source code that has worked so far.
I have tried these methods with little (saw some stats refresh but not mana or hp changes) or no changes:
ApplyStatPercentBuffMod
UpdateAllStats
UpdateMaxHealth
If anyone who reads this has any clues or comments I would appreciate it.