[DiscordArchive] Anyone want a challenge? lol
[DiscordArchive] Anyone want a challenge? lol
Archived author: Ghoulander • Posted: 2024-01-11T23:16:18.568000+00:00
Original source
Anyone want a challenge? lol
Here's the idea: Disable automatic level up triggers.
Replace it with a triggered command via a Quest Reward.
Xp will be gained normally but once the max XP for the level has been reached, XP gain stops until the quest is completed which triggers the level up process and the fun continues.
` uint32 curXP = GetUInt32Value(PLAYER_XP);
uint32 nextLvlXP = GetUInt32Value(PLAYER_NEXT_LEVEL_XP);
uint32 newXP = curXP + xp + bonus_xp;
while (newXP >= nextLvlXP && level < sWorld->getIntConfig(CONFIG_MAX_PLAYER_LEVEL))
{
newXP -= nextLvlXP;
if (level < sWorld->getIntConfig(CONFIG_MAX_PLAYER_LEVEL))
GiveLevel(level + 1);
level = GetLevel();
nextLvlXP = GetUInt32Value(PLAYER_NEXT_LEVEL_XP);
}
SetUInt32Value(PLAYER_XP, newXP);
}
This is the Player.cpp where the 'Automatic Level Up' happens.
Here is where my limited C++ comprehension freezes.
Is it possible to check for current XP from a quest objective?
If so, I was going to add a dummy aura (52) as a quest reward and change..
' while (newXP >= nextLvlXP && level < sWorld->getIntConfig(CONFIG_MAX_PLAYER_LEVEL))
to
' while (hasAura(52) && level < sWorld->getIntConfig(CONFIG_MAX_PLAYER_LEVEL))
{
removeAura(52);
newXP -= nextLvlXP;
if (level < sWorld->getIntConfig(CONFIG_MAX_PLAYER_LEVEL))
GiveLevel(level + 1);
level = GetLevel();
nextLvlXP = GetUInt32Value(PLAYER_NEXT_LEVEL_XP);
}
SetUInt32Value(PLAYER_XP, newXP);
}
Does this look like it will work or is there a better way to go about it?