@Override
public void run()
{
try
{
final CharStat charstat = getActiveChar().getStat();
// Modify the current CP of the L2Character and broadcast Server->Client packet StatusUpdate
if(getCurrentCp() < charstat.getMaxCp())
{
setCurrentCp(getCurrentCp() + Formulas.calcCpRegen(getActiveChar()), false);
}
// Modify the current HP of the L2Character and broadcast Server->Client packet StatusUpdate
if(getCurrentHp() < charstat.getMaxHp())
{
setCurrentHp(getCurrentHp() + Formulas.calcHpRegen(getActiveChar()), false);
}
// Modify the current MP of the L2Character and broadcast Server->Client packet StatusUpdate
if(getCurrentMp() < charstat.getMaxMp())
{
setCurrentMp(getCurrentMp() + Formulas.calcMpRegen(getActiveChar()), false);
}
if(!getActiveChar().isInActiveRegion())
{
// no broadcast necessary for characters that are in inactive regions.
// stop regeneration for characters who are filled up and in an inactive region.
if(getCurrentCp() == charstat.getMaxCp() && getCurrentHp() == charstat.getMaxHp() && getCurrentMp() == charstat.getMaxMp())
{
stopHpMpRegeneration();
}
}
else