Quote:
Originally Posted by ChaosSlayer
PS: Its about time we add PLAYER OOC regeneration =)
|
Just a random thought, but couldn't we do this with player quests? Start a timer when out of combat, stop it while in combat, and when the timer comes up, either cast a spell, #heal, etc.
As far as per-mob Out of Combat regen, I think the best way to handle this might be to set this in the Mob class (make it
sint32 oocregen or something like that), have it default to whatever the rule is set to, and make a function, say SetOOCRegen, to change it. Then, just wrap it into the quest code so you can trigger it via quest. That way, you can execute it on sub EVENT_SPAWN if you want it on by default instead of setting it in the database, and change it whenever/wherever you want. I think this should just about do it:
In zone/mob.h, around line 928, add
Code:
sint16 hp_regen;
sint16 mana_regen;
sint32 oocregen; //Out of Combat Regen, % per tick
void SetOOCRegen(sint32 newoocregen) {oocregen = newoocregen;}
In zone/mob.cpp, around line 29, add
Code:
#include "map.h"
#include "StringIDs.h"
#include "../common/rulesys.h"
and around line 206, add
Code:
hp_regen = in_hp_regen;
mana_regen = in_mana_regen;
oocregen = RuleI(NPC, OOCRegen); //default Out of Combat Regen
Then we just need to get it into the quests. I think this should do it:
in zone/perl_mob.cpp, around line 5569, add
Code:
XS(XS_Mob_SetOOCRegen); /* prototype to pass -Wmissing-prototypes */
XS(XS_Mob_SetOOCRegen)
{
dXSARGS;
if (items != 2)
Perl_croak(aTHX_ "Usage: Mob::SetOOCRegen(THIS, newoocregen)");
{
Mob * THIS;
sint32 newoocregen = (sint32)SvIV(ST(1));
if (sv_derived_from(ST(0), "Mob")) {
IV tmp = SvIV((SV*)SvRV(ST(0)));
THIS = INT2PTR(Mob *,tmp);
}
else
Perl_croak(aTHX_ "THIS is not of type Mob");
if(THIS == NULL)
Perl_croak(aTHX_ "THIS is NULL, avoiding crash.");
THIS->SetOOCRegen(newoocregen);
}
XSRETURN_EMPTY;
}
and around line 5813, add
Code:
newXSproto(strcpy(buf, "ClearFeignMemory"), XS_Mob_ClearFeignMemory, file, "$");
newXSproto(strcpy(buf, "SetOOCRegen"), XS_Mob_SetOOCRegen, file, "$$");
Now, you can change it using
$Mob->SetOOCRegen(0). If you decide to try it out, let me know how it works.