From 4a84c311b26b4e1e38d1295acf1e1c085f9116aa Mon Sep 17 00:00:00 2001 From: Paul Coene Date: Wed, 5 Jul 2017 18:26:50 -0400 Subject: [PATCH 1/2] Change to allow pets to use better of db/oocregen if oocregen is turned on in the rule_set. --- zone/npc.cpp | 47 ++++++++++++++++++++++++++++++++--------------- 1 file changed, 32 insertions(+), 15 deletions(-) diff --git a/zone/npc.cpp b/zone/npc.cpp index de4ad4e7c..269f3fb84 100644 --- a/zone/npc.cpp +++ b/zone/npc.cpp @@ -615,37 +615,54 @@ bool NPC::Process() if (currently_fleeing) ProcessFlee(); - uint32 bonus = 0; + uint32 sitting_bonus = 0; + uint32 petbonus = 0; + uint32 bestregen = 0; + int32 dbregen = GetNPCHPRegen(); if (GetAppearance() == eaSitting) - bonus += 3; + sitting_bonus += 3; int32 OOCRegen = 0; if (oocregen > 0) { //should pull from Mob class OOCRegen += GetMaxHP() * oocregen / 100; } - //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. + + //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. + // + // Noudess Edit: If oocregen set in db, apply to pets as well. + // This allows the obscene #s for pets in the db to be tweaked + // while maintaining a decent ooc regen. + + bestregen = std::max(dbregen,OOCRegen); + if ((GetHP() < GetMaxHP()) && !IsPet()) { - if (!IsEngaged()) {//NPC out of combat - if (GetNPCHPRegen() > OOCRegen) - SetHP(GetHP() + GetNPCHPRegen()); - else - SetHP(GetHP() + OOCRegen); - } + if (!IsEngaged()) + SetHP(GetHP() + bestregen + sitting_bonus); else - SetHP(GetHP() + GetNPCHPRegen()); + SetHP(GetHP() + dbregen); } else if (GetHP() < GetMaxHP() && GetOwnerID() != 0) { - if (!IsEngaged()) //pet - SetHP(GetHP() + GetNPCHPRegen() + bonus + (GetLevel() / 5)); + if (!IsEngaged()) { + if (oocregen > 0) { + petbonus = std::max(OOCRegen,dbregen); + } + else { + petbonus = dbregen + (GetLevel() / 5); + } + + SetHP(GetHP() + sitting_bonus + petbonus); + } else - SetHP(GetHP() + GetNPCHPRegen() + bonus); + SetHP(GetHP() + dbregen); } else - SetHP(GetHP() + GetNPCHPRegen()); + SetHP(GetHP() + dbregen + sitting_bonus); if (GetMana() < GetMaxMana()) { - SetMana(GetMana() + mana_regen + bonus); + SetMana(GetMana() + mana_regen + sitting_bonus); } From 5542107f02581537b08c8a512514a8770faa496b Mon Sep 17 00:00:00 2001 From: Paul Coene Date: Wed, 5 Jul 2017 21:26:10 -0400 Subject: [PATCH 2/2] Remove names --- zone/npc.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/zone/npc.cpp b/zone/npc.cpp index 269f3fb84..97dd647ec 100644 --- a/zone/npc.cpp +++ b/zone/npc.cpp @@ -628,11 +628,11 @@ bool NPC::Process() OOCRegen += GetMaxHP() * oocregen / 100; } - //Lieka Edit:Fixing NPC regen.NPCs should regen to full during + // 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. // - // Noudess Edit: If oocregen set in db, apply to pets as well. + // If oocregen set in db, apply to pets as well. // This allows the obscene #s for pets in the db to be tweaked // while maintaining a decent ooc regen.