Ok, for a rules based fix:
add the line in red to .\common\ruletypes.h
Code:
RULE_CATEGORY( NPC )
RULE_INT ( NPC, MinorNPCCorpseDecayTimeMS, 450000 ) //level<55
RULE_INT ( NPC, MajorNPCCorpseDecayTimeMS, 1500000 ) //level>=55
RULE_BOOL (NPC, UseItemBonusesForNonPets, true)
RULE_REAL ( NPC, OOCRegen, 0 ) //Lieka Edit: NPC Out of Combat Regen Percentage Per Tick
RULE_CATEGORY_END()
change these lines in the bool NPC::Process() function in .\zone\npc.cpp
Code:
if(GetHP() < GetMaxHP()) {
if(GetOwnerID()!=0 && !IsEngaged()) //pet
SetHP(GetHP()+hp_regen+bonus+(GetLevel()/5));
else
SetHP(GetHP()+hp_regen+bonus);
}
to
Code:
float NPCOOCRegen = 0;
if(RuleR(NPC, OOCRegen) >= 0){
NPCOOCRegen += RuleR(NPC, OOCRegen);
NPCOOCRegen *= 0.01;
NPCOOCRegen *= GetMaxHP();
}
//Lieka Edit: Fixing NPC regen. NPCs should regen to full during a set duration, not based on their HPs. Increase NPC's HPs by % of total HPs / tick.
if((GetHP() < GetMaxHP()) && !IsPet()) {
if(!IsEngaged()) //NPC out of combat
SetHP(GetHP() + hp_regen + NPCOOCRegen);
else
SetHP(GetHP()+hp_regen);
} else if(GetHP() < GetMaxHP() && GetOwnerID() !=0) {
if(!IsEngaged()) //pet
SetHP(GetHP()+hp_regen+bonus+(GetLevel()/5));
else
SetHP(GetHP()+hp_regen+bonus);
} else SetHP(GetHP()+hp_regen);
Required SQL:
Code:
insert into rule_values values (0, 'NPC:OOCRegen', 0);
The NPC Out of Combat Regen correction is disabled by default. The NPC will regen the rule value percentage of hps per tick once the rule is set. (e.g. NPC:OOCRegen to 5, and the mob will regen 5% health per tick when out of combat).
Dax