EQEmulator Forums

EQEmulator Forums (https://www.eqemulator.org/forums/index.php)
-   Development::Server Code Submissions (https://www.eqemulator.org/forums/forumdisplay.php?f=669)
-   -   Out of combat regen rates. (https://www.eqemulator.org/forums/showthread.php?t=23595)

zydria 09-03-2007 12:50 PM

Out of combat regen rates.
 
I wanted to add the increased out of combat regen rates to my server like live. I coded it to check if there were variables called HPRegen, MPRegen and ENRegen in the variables table, if not it just defaults to normal regen rates. So admins can set thier regen rates however they like. Here is the code if anyone wants to use it.

change
Code:

void Client::DoHPRegen() {
        sint32 normal_regen = LevelRegen();
        sint32 item_regen = itembonuses.HPRegen;
        sint32 spell_regen = spellbonuses.HPRegen;
        sint32 total_regen = normal_regen + item_regen + spell_regen;
        total_regen = (total_regen * RuleI(Character, HPRegenMultiplier)) / 100;
        SetHP(GetHP() + total_regen);
        SendHPUpdate();
}

to
Code:

void Client::DoHPRegen() {
        /* Out of combat HP Regen Multiplier added by Zydria */

        /* Out of combat hp regen rate */
        /* Create variable in db called HPRegen */
        float HPRegen;
        HPRegen = (float)1;
        char tmp[10];
        char *tmp2;

        sint32 normal_regen = LevelRegen();
        sint32 item_regen = itembonuses.HPRegen;
        sint32 spell_regen = spellbonuses.HPRegen;
        sint32 total_regen = normal_regen + item_regen + spell_regen;
       
        // if the player is in combat... normal hp regen
        if (IsEngaged())
                {
                        total_regen = (total_regen * RuleI(Character, HPRegenMultiplier)) / 100;
                }
        // if they are out of combat... normal regen multiplied by variable HPRegen
        // Default: Normal Regen
        else
                {
                        if (database.GetVariable("HPRegen", tmp, 9))
                        HPRegen = strtod((const char*)tmp, &tmp2);
                        total_regen = ((total_regen * RuleI(Character, HPRegenMultiplier)) / 100) * HPRegen;
                }

        SetHP(GetHP() + total_regen);
        SendHPUpdate();
}

then change
Code:

void Client::DoManaRegen() {
        if (GetMana() >= max_mana)
                return;
        int32 level=GetLevel();
        int32 regen = 0;
        if (IsSitting()) {                //this should be changed so we dont med while camping, etc...
                if(HasSkill(MEDITATE)) {
                        medding = true;
                        regen = (((GetSkill(MEDITATE)/10)+(level-(level/4)))/4)+4;
                        regen += spellbonuses.ManaRegen + itembonuses.ManaRegen;
                        CheckIncreaseSkill(MEDITATE, -10);
                }
                else
                        regen = 2+spellbonuses.ManaRegen+itembonuses.ManaRegen+(level/5);
        }
        else {
                medding = false;
                regen = 2+spellbonuses.ManaRegen+itembonuses.ManaRegen+(level/5);
        }
        regen += GetAA(aaMentalClarity);
        regen += GetAA(aaBodyAndMindRejuvenation);
        regen = (regen * RuleI(Character, ManaRegenMultiplier)) / 100;
       
        SetMana(GetMana() + regen);
        SendManaUpdatePacket();
}

to
Code:

void Client::DoManaRegen() {
        /* Out of combat Mana Regen Multiplier added by Zydria */

        // Out of combat mp regen rate
        // Create variable in db called MPRegen
        float MPRegen;
        MPRegen = (float)1;

        char tmp[10];
        char *tmp2;

        if (GetMana() >= max_mana)
                return;
        int32 level=GetLevel();
        int32 regen = 0;
       
        if (IsSitting()) {                //this should be changed so we dont med while camping, etc...
                if(HasSkill(MEDITATE)) {
                        medding = true;
                        regen = (((GetSkill(MEDITATE)/10)+(level-(level/4)))/4)+4;
                        regen += spellbonuses.ManaRegen + itembonuses.ManaRegen;
                        CheckIncreaseSkill(MEDITATE, -10);
                }
                else
                        regen = 2+spellbonuses.ManaRegen+itembonuses.ManaRegen+(level/5);
        }
        else {
                medding = false;
                regen = 2+spellbonuses.ManaRegen+itembonuses.ManaRegen+(level/5);
        }
        regen += GetAA(aaMentalClarity);
        regen += GetAA(aaBodyAndMindRejuvenation);
       
        // if character is in combat
        if (IsEngaged())
                {       
                        // normal regen
                        regen = (regen * RuleI(Character, ManaRegenMultiplier)) / 100;
                }
        //if not
        else
                {
                        //if mpregen is set in variable db to higher than 1
                        if (database.GetVariable("MPRegen", tmp, 9))
                        MPRegen = strtod((const char*)tmp, &tmp2);
                        // regen at normal regen * mpregen value
                        regen = ((regen * RuleI(Character, ManaRegenMultiplier)) / 100) * MPRegen;
                }
       
        SetMana(GetMana() + regen);
        SendManaUpdatePacket();
}

then change
Code:

void Client::DoEnduranceRegen()
{
        if(GetEndurance() >= GetMaxEndurance())
                return;

        int32 level=GetLevel();
        int32 regen = 0;

        regen = int(level*4/10) + 2;
        regen += spellbonuses.EnduranceRegen + itembonuses.EnduranceRegen;
       
        regen = (regen * RuleI(Character, EnduranceRegenMultiplier)) / 100;

        SetEndurance(GetEndurance() + regen);
}

to
Code:

void Client::DoEnduranceRegen()
{
        /* Out of combat Endurance Regen Multiplier added by Zydria */

        // Out of combat mp regen rate
        // Create variable in db called MPRegen
        float ENRegen;
        ENRegen = (float)1;

        char tmp[10];
        char *tmp2;

        if(GetEndurance() >= GetMaxEndurance())
                return;

        int32 level=GetLevel();
        int32 regen = 0;

        regen = int(level*4/10) + 2;
        regen += spellbonuses.EnduranceRegen + itembonuses.EnduranceRegen;
        // if player is in combat...
        if (IsEngaged())
                {
                        // normal regen
                        regen = (regen * RuleI(Character, EnduranceRegenMultiplier)) / 100;
                }
        // if not...
        else
                {
                        // if ENRegen is set to higher than 1 in the variables db
                        if (database.GetVariable("ENRegen", tmp, 9))
                        ENRegen = strtod((const char*)tmp, &tmp2);
                        // regen at normal end regen * ENRegen value
                        regen = ((regen * RuleI(Character, EnduranceRegenMultiplier)) / 100) * ENRegen;
                }
        SetEndurance(GetEndurance() + regen);
}

then add the rows to your variables table
Code:

INSERT INTO `variables` (`varname`,`value`,`information`) VALUES ('HPRegen','1','Out of combat hit point regen is multiplied by this number. Default: 1');
INSERT INTO `variables` (`varname`,`value`,`information`) VALUES ('MPRegen','1','Out of combat mana regen is multiplied by this number. Default: 1');
INSERT INTO `variables` (`varname`,`value`,`information`) VALUES ('ENRegen','1','Out of combat endurance regen is multiplied by this number. Default: 1');

and set the values to whatever you would like them to be, they default to 1 (normal rates) and if the rows arent set in the variables table, then it also defaults to 1.


I also changed my server to allow players to meditate while standing. it is setup with a variable to turn it on or off too... if anyone wants it just use this code for the "void Client::DoManaRegen() "instead of the above code...

Code:

void Client::DoManaRegen() {
        /* Out of combat Mana Regen Multiplier and Med while standing added by Zydria */

        // Out of combat mp regen rate
        // Create variable in db called MPRegen
        float MPRegen;
        MPRegen = (float)1;

        // Allow characters to meditate while standing up
        // create variabe in db called SitToMed, value: 1 = med while standing. 0 = required to sit
        int SitToMed;
        SitToMed = 0;

        char tmp[10];
        char *tmp2;

        if (GetMana() >= max_mana)
                return;
        int32 level=GetLevel();
        int32 regen = 0;
       
        // checks to see if player can med while standing
        if (database.GetVariable("SitToMed", tmp, 9))
        SitToMed = strtod((const char*)tmp, &tmp2);
       
        // if not, make sure there sitting
        if (SitToMed == 0){
        if (IsSitting()) {                //this should be changed so we dont med while camping, etc...
                if(HasSkill(MEDITATE)) {
                        medding = true;
                        regen = (((GetSkill(MEDITATE)/10)+(level-(level/4)))/4)+4;
                        regen += spellbonuses.ManaRegen + itembonuses.ManaRegen;
                        CheckIncreaseSkill(MEDITATE, -10);
                }
                else
                        regen = 2+spellbonuses.ManaRegen+itembonuses.ManaRegen+(level/5);
        }
        else {
                medding = false;
                regen = 2+spellbonuses.ManaRegen+itembonuses.ManaRegen+(level/5);
        }
        }
        // if med while standing is enabled,
        else if (SitToMed == 1)
        {
                // always meditate
                if(HasSkill(MEDITATE)) {
                        medding = true;
                        regen = (((GetSkill(MEDITATE)/10)+(level-(level/4)))/4)+4;
                        regen += spellbonuses.ManaRegen + itembonuses.ManaRegen;
                        CheckIncreaseSkill(MEDITATE, -10);
                }
                else
                        regen = 2+spellbonuses.ManaRegen+itembonuses.ManaRegen+(level/5);
        }
        else {
                medding = false;
                regen = 2+spellbonuses.ManaRegen+itembonuses.ManaRegen+(level/5);
        }
        regen += GetAA(aaMentalClarity);
        regen += GetAA(aaBodyAndMindRejuvenation);
       
        // if character is in combat
        if (IsEngaged())
                {       
                        // normal regen
                        regen = (regen * RuleI(Character, ManaRegenMultiplier)) / 100;
                }
        //if not
        else
                {
                        //if mpregen is set in variable db to higher than 1
                        if (database.GetVariable("MPRegen", tmp, 9))
                        MPRegen = strtod((const char*)tmp, &tmp2);
                        // regen at normal regen * mpregen value
                        regen = ((regen * RuleI(Character, ManaRegenMultiplier)) / 100) * MPRegen;
                }
       
        SetMana(GetMana() + regen);
        SendManaUpdatePacket();
}

and add the variable...
Code:

INSERT INTO `variables` (`varname`,`value`,`information`) VALUES ('SitToMed','0','0 = Player has to sit to med. 1 = Player meditates while standing. Default: 0');
by default it is set to 0, (player must sit to med) change it to 1 to allow them to med while standing.

This is my first contribution, as I am relativly new to the eqemu scene, I hope someone will get some use out of this, and if you find any problems with it, just let me know and i'll try and get it fixed...

Zydria

WildcardX 09-03-2007 01:18 PM

This looks interesting.

I am going to move this for now into "Custom Code" until KLS weighs in and where she thinks this ought to go. I can see the argument for this getting integrating into the official code...

cavedude 09-03-2007 01:27 PM

Character:HPRegenMultiplier, Character:ManaRegenMultiplier, and Character:EnduranceRegenMultiplier are all already rules...

Though, your mana regen addition may be able to be modified to allow people to med while on horses.

zydria 09-03-2007 02:08 PM

I have tried to get those working, perhaps im not setting them properly, but they do not seem to have any effect on regen amounts. I have added them both though ingame commands and directly to the database, but each time i test it, my regen rates are just normal.

soulshot 09-04-2007 01:05 AM

Feature
 
This was implemented in live and I think its a great feature. The longer you sit the more hp/mana you gain over time. I think the delay between combat and rest mode is something like 10-15 seconds isnt it?

-Mard

zydria 09-04-2007 02:24 AM

Ok, I got the HPRegenMultiplier, ManaRegenMultiplier and EnduranceRegenMultiplier rules to work, so I change my code to work with those. The code now checks a variable to see if the server allows increase out of combat regen rates, if it does, it will increase the characters out of combat regen rate by the amount in the HP, Mana and EnduranceRegenMultiplier rules.
If the server is not using out of combat regen rates, but has the regenmultiplier rules set, then it will use them the way the worked before.

Here's the new code.

Code:

void Client::DoHPRegen() {
        /* Out of combat HP Regen Multiplier added by Zydria */

        //Set OOCRegen to default to off
        int OOCRegen;
        OOCRegen = 0;

        char tmp[10];
        char *tmp2;

        if (database.GetVariable("OOCRegen", tmp, 9))
        OOCRegen = strtod((const char*)tmp, &tmp2);

        sint32 normal_regen = LevelRegen();
        sint32 item_regen = itembonuses.HPRegen;
        sint32 spell_regen = spellbonuses.HPRegen;
        sint32 total_regen = normal_regen + item_regen + spell_regen;
       
        //if Out of Combat Regen is turned on
        if (OOCRegen = 1){

                // if the player is in combat... normal hp regen
                if (IsEngaged())
                        {
                                total_regen = total_regen / 100;
                        }
                // if they are out of combat... normal regen multiplied by variable HPRegen
                // Default: Normal Regen
                else
                        {
                                total_regen = (total_regen / 100) * RuleI(Character, HPRegenMultiplier);
                        }
        } else {
                total_regen = (total_regen * RuleI(Character, HPRegenMultiplier)) / 100;
        }

        SetHP(GetHP() + total_regen);
        SendHPUpdate();
}


Code:

void Client::DoManaRegen() {
        /* Out of combat Mana Regen Multiplier added by Zydria */
       
        //Set out of combat regen to default to off
        int OOCRegen;
        OOCRegen = 0;

        char tmp[10];
        char *tmp2;

        if (database.GetVariable("OOCRegen", tmp, 9))
        OOCRegen = strtod((const char*)tmp, &tmp2);

        if (GetMana() >= max_mana)
                return;
        int32 level=GetLevel();
        int32 regen = 0;
       
        if (IsSitting()) {                //this should be changed so we dont med while camping, etc...
                if(HasSkill(MEDITATE)) {
                        medding = true;
                        regen = (((GetSkill(MEDITATE)/10)+(level-(level/4)))/4)+4;
                        regen += spellbonuses.ManaRegen + itembonuses.ManaRegen;
                        CheckIncreaseSkill(MEDITATE, -10);
                }
                else
                        regen = 2+spellbonuses.ManaRegen+itembonuses.ManaRegen+(level/5);
        }
        else {
                medding = false;
                regen = 2+spellbonuses.ManaRegen+itembonuses.ManaRegen+(level/5);
        }
        regen += GetAA(aaMentalClarity);
        regen += GetAA(aaBodyAndMindRejuvenation);
       
        // if out of combat regen is turned on
        if (OOCRegen == 1) {

                // if character is in combat
                if (IsEngaged())
                        {       
                                // normal regen
                                regen = regen / 100;
                        }
                //if not
                else
                        {
                                // regen at normal regen * mpregen value
                                regen = (regen / 100) * RuleI(Character, ManaRegenMultiplier);
                        }
       
        } else {
                        regen = (regen * RuleI(Character, ManaRegenMultiplier)) / 100;
                }
       
       
        SetMana(GetMana() + regen);
        SendManaUpdatePacket();
}



Code:

void Client::DoEnduranceRegen()
{
        /* Out of combat Endurance Regen Multiplier added by Zydria */

        //Set out of combat regen to default to off
        int OOCRegen;
        OOCRegen = 0;

        char tmp[10];
        char *tmp2;

        if (database.GetVariable("OOCRegen", tmp, 9))
        OOCRegen = strtod((const char*)tmp, &tmp2);

        if(GetEndurance() >= GetMaxEndurance())
                return;

        int32 level=GetLevel();
        int32 regen = 0;

        regen = int(level*4/10) + 2;
        regen += spellbonuses.EnduranceRegen + itembonuses.EnduranceRegen;

        //if out of combar regen is on.
        if (OOCRegen == 1){
                // if player is in combat...
                if (IsEngaged())
                        {
                                // normal regen
                                regen = regen / 100;
                        }
                // if not...
                else
                        {
                                // regen at normal end regen * ENRegen value
                                regen = (regen / 100) * RuleI(Character, EnduranceRegenMultiplier);
                        }
        } else {
                regen = (regen * RuleI(Character, EnduranceRegenMultiplier)) / 100;
        }


        SetEndurance(GetEndurance() + regen);
}


and insert the variable in the db
Code:

INSERT INTO `variables` (`varname`,`value`,`information`) VALUES ('OOCRegen','0','Out Of Combat Regen Multiplier. If set to 1 characters hp, mana and endurance will regen at regular speed multiplied by the values entered in the HPRegenMultiplier, ManaRegenMultiplier and EnduranceRegenMultiplier rules. Default is 0 (Off), you must set the above rules or players will only recieve regular regen rates');
Be sure to setup the Rules, HPRegenMultiplier, ManaRegenMultiplier and EnduranceRegenMultiplier with a value higher than 1 to recieve regen bonus rates.

By default, the out of combat regen is turned off, so change the variable OOCRegen to 1 to turn it on


Zydria

zydria 09-04-2007 02:48 AM

Sorry for double post, I just update the code to check if players were mounted, if they are, meditate is always on....

just use this instead of the void Client::DoManaRegen() above
Code:

void Client::DoManaRegen() {
        /* Out of combat Mana Regen Multiplier added by Zydria */
       
        //Set out of combat regen to default to off
        int OOCRegen;
        OOCRegen = 0;

        char tmp[10];
        char *tmp2;

        if (database.GetVariable("OOCRegen", tmp, 9))
        OOCRegen = strtod((const char*)tmp, &tmp2);

        if (GetMana() >= max_mana)
                return;
        int32 level=GetLevel();
        int32 regen = 0;

        if (GetHorseId() != 0) {{       
                if(HasSkill(MEDITATE)) {
                        medding = true;
                        regen = (((GetSkill(MEDITATE)/10)+(level-(level/4)))/4)+4;
                        regen += spellbonuses.ManaRegen + itembonuses.ManaRegen;
                        CheckIncreaseSkill(MEDITATE, -10);
                }
                else
                        regen = 2+spellbonuses.ManaRegen+itembonuses.ManaRegen+(level/5);
        }
        else {
                medding = false;
                regen = 2+spellbonuses.ManaRegen+itembonuses.ManaRegen+(level/5);
        }
       
        if (IsSitting()){                //this should be changed so we dont med while camping, etc...
                if(HasSkill(MEDITATE)) {
                        medding = true;
                        regen = (((GetSkill(MEDITATE)/10)+(level-(level/4)))/4)+4;
                        regen += spellbonuses.ManaRegen + itembonuses.ManaRegen;
                        CheckIncreaseSkill(MEDITATE, -10);
                }
                else
                        regen = 2+spellbonuses.ManaRegen+itembonuses.ManaRegen+(level/5);
        }
        else {
                medding = false;
                regen = 2+spellbonuses.ManaRegen+itembonuses.ManaRegen+(level/5);
        }
        regen += GetAA(aaMentalClarity);
        regen += GetAA(aaBodyAndMindRejuvenation);
       
        // if out of combat regen is turned on
        if (OOCRegen == 1) {

                // if character is in combat
                if (IsEngaged())
                        {       
                                // normal regen
                                regen = regen / 100;
                        }
                //if not
                else
                        {
                                // regen at normal regen * mpregen value
                                regen = (regen / 100) * RuleI(Character, ManaRegenMultiplier) ;
                        }
       
        } else {
                        regen = (regen * RuleI(Character, ManaRegenMultiplier)) / 100;
                }
       
       
        SetMana(GetMana() + regen);
        SendManaUpdatePacket();
}


cavedude 09-04-2007 03:32 AM

Quote:

Originally Posted by zydria (Post 138021)
Ok, I got the HPRegenMultiplier, ManaRegenMultiplier and EnduranceRegenMultiplier rules to work, so I change my code to work with those. The code now checks a variable to see if the server allows increase out of combat regen rates, if it does, it will increase the characters out of combat regen rate by the amount in the HP, Mana and EnduranceRegenMultiplier rules.
If the server is not using out of combat regen rates, but has the regenmultiplier rules set, then it will use them the way the worked before.

I am not totally understanding the need for this, by default the rules are set to 100. If you were to change them to say 200, your regen would double, or to 50, they would half. Isn't that what you are doing? I am fairly certain the rules effect all regen, both in and out of combat. I feel as though I am missing somthing, so if you could explain that would be awesome.

I'm no developer, but I'm pretty sure the trend is to move away from the variables table and use rules instead. The benefit of course, is that they can be changed and refreshed in-game with a few commands. Most variables require a server reboot to take effect. Your OOCRegen variable probably should be made into a bool rule.

Quote:

Originally Posted by zydria (Post 138021)
Sorry for double post, I just update the code to check if players were mounted, if they are, meditate is always on....

No need to apologize, it's your thread :)

The mount change is a much needed one, and I am certain many people will appreciate it. However, I see you have the same if statement repeated twice. Couldn't you just combine sitting and mounted together, like:
Code:

if (IsSitting() || GetHorseId() != 0){
I'm no coder, so that's probably incorrect but you get the idea.

zydria 09-04-2007 03:40 AM

Quote:

Originally Posted by cavedude (Post 138026)
I am not totally understanding the need for this, by default the rules are set to 100. If you were to change them to say 200, your regen would double, or to 50, they would half. Isn't that what you are doing? I am fairly certain the rules effect all regen, both in and out of combat. I feel as though I am missing somthing, so if you could explain that would be awesome.

With the current rules, if you set them to 200 you get 2x regen all the time... Live setup a system where you get increased regen rates while your not in combat, to lower the amount of downtime, but you dont get the increased regen in combat so that it does not make the game unbalanced... Thats what im attempting to do.

cavedude 09-04-2007 03:49 AM

I actually thought that's how it already was, that's why I got confused. Sorry for the misunderstanding I understand now, thank you :)

WildcardX 09-04-2007 03:54 AM

I havent played on live for a year or two. I heard they did something like you just described, though. I'll look over your code in detail later tonight when i have some time to dedicate towards it. I'm beginning to think now that this should probably go into the server repository after all, but I want to look over it myself and hear what KLS thinks before I make that decision.

zydria 09-04-2007 06:33 AM

I went through the code and fixed a few mistakes i made in the other posts and cleaned it up a bit. I also switched from a variable to a rule to turn out of combat regen on or off...

Here's the new code...
client_process.cpp

Code:

void Client::DoHPRegen() {
        /* Out of combat HP Regen Multiplier added by Zydria */

        sint32 normal_regen = LevelRegen();
        sint32 item_regen = itembonuses.HPRegen;
        sint32 spell_regen = spellbonuses.HPRegen;
        sint32 total_regen = normal_regen + item_regen + spell_regen;
       
        //if Out of Combat Regen is turned on
        if (RuleB(Character, OutOfCombatRegen)){

                // if the player is in combat... normal hp regen
                if (IsEngaged())
                        {
                                total_regen = total_regen;
                        }
                // if they are out of combat... normal regen multiplied by HPRegenMultiplier Rule
                // Default: Normal Regen
                else
                        {
                                total_regen = (total_regen * RuleI(Character, HPRegenMultiplier)) / 100;
                        }
                //if out of combat regen is turned off, use normal regen rules.
        } else {
                total_regen = (total_regen * RuleI(Character, HPRegenMultiplier)) / 100;
        }

        SetHP(GetHP() + total_regen);
        SendHPUpdate();
}


Code:

void Client::DoManaRegen() {
        /* Out of combat Mana Regen Multiplier added by Zydria */

        if (GetMana() >= max_mana)
                return;
        int32 level=GetLevel();
        int32 regen = 0;
        //If player is sitting or riding a horse... they should meditate if they have it.
        if (IsSitting() ||(GetHorseId() != 0)) {                //this should be changed so we dont med while camping, etc...
                if(HasSkill(MEDITATE)) {
                        medding = true;
                        regen = (((GetSkill(MEDITATE)/10)+(level-(level/4)))/4)+4;
                        regen += spellbonuses.ManaRegen + itembonuses.ManaRegen;
                        CheckIncreaseSkill(MEDITATE, -10);
                }
                else
                        regen = 2+spellbonuses.ManaRegen+itembonuses.ManaRegen+(level/5);
        }
        else {
                medding = false;
                regen = 2+spellbonuses.ManaRegen+itembonuses.ManaRegen+(level/5);
        }
        regen += GetAA(aaMentalClarity);
        regen += GetAA(aaBodyAndMindRejuvenation);
       
        // if out of combat regen is turned on
        if (RuleB(Character, OutOfCombatRegen)) {

                // if character is in combat
                if (IsEngaged())
                        {       
                                // normal regen
                                regen = regen;
                        }
                //if not
                else
                        {
                                // regen at normal regen * mpregen value
                                regen = (regen * RuleI(Character, ManaRegenMultiplier)) / 100;
                        }
       
                // if out of combat regen is turned off, use normal regen rules
        } else {
                        regen = (regen * RuleI(Character, ManaRegenMultiplier)) / 100;
                }
       
        SetMana(GetMana() + regen);
        SendManaUpdatePacket();
}


Code:

void Client::DoEnduranceRegen()
{
        /* Out of combat Endurance Regen Multiplier added by Zydria */

        if(GetEndurance() >= GetMaxEndurance())
                return;

        int32 level=GetLevel();
        int32 regen = 0;

        regen = int(level*4/10) + 2;
        regen += spellbonuses.EnduranceRegen + itembonuses.EnduranceRegen;

        //if out of combat regen is on.
        if (RuleB(Character, OutOfCombatRegen)) {
                // if player is in combat...
                if (IsEngaged())
                        {
                                // normal regen
                                regen = regen;
                        }
                // if not...
                else
                        {
                                // regen at normal end regen * ENRegen value
                                regen = (regen * RuleI(Character, EnduranceRegenMultiplier))/ 100;
                        }
                // if out of combat regen is turned off, use normal regen rules.
        } else {
                regen = (regen * RuleI(Character, EnduranceRegenMultiplier)) / 100;
        }


        SetEndurance(GetEndurance() + regen);
}

then add this to ruletypes.h under the character section
Code:

RULE_BOOL( Character, OutOfCombatRegen, false ) // Whether or not to used increased regen rates while player is not in combat.
turn it off or on from the rules table in the db or the #rules command ingame.

KLS 09-04-2007 06:43 PM

hm.. im kinda conflicted.

I mean if we're going to go put something like this in we might as well go all the way and replicate eq live's system.

Yet the client doesn't support the window that tells us if we're resting or not.. at least not titanium or 6.2, anniv does but it currently is not fully functional by any means.. it's something we could put in that's on EQ live just not on the clients we support atm... I tend to lean toward adding it however because if we don't have it we aren't replicating EQlive gameplay.

From what I remember there were a couple different combat states that determined how you regenerated mana and health.

Code:

enum CombatState {
    csInCombat,
    csRecovering,
    csRestingButConflicted,
    csResting
};

Clearly in combat, you're fighting.

Recovering is the period from when you leave combat to when you can enter resting... I believe it varies depending on either the zone you're in or the mob you left combat with. I know at the lower levels it's pretty short, 5-10 seconds at most.

You can be in Resting but if you're conflicted (Have a detrimental spell on you) you will not be able to take advantage of the effects of Resting.

Once you're resting so long as you stay you regen health, mana and endurance at a much faster rate than normal and never any slower than your in combat sitting regeneration.

Wouldn't be much to work our really. Hardest part would be the transition from in combat to resting with the timers and that wouldn't be hard at all!

John Adams 09-04-2007 07:03 PM

KLS, is it possible to add the code in anticipation of Anniversary Edition support? And for those who do not have those clients, allow the admin to simply set a rule to handle it? I don't know what "resting" is in EQLive, as I have not actually played in 2 years... but I know the concept from other games.

Gimme mah fellowships, brotherhoods, and vitality xpz!! ;)

soulshot 09-05-2007 08:02 AM

I was testing (read playing) last night and tested this out on the phlarg fiends who notoriously have a ultra long disease effect on you during combat. I can verify that your hp regen rate does continue to rise the longer you sit even with detrimental spell effects on you. It just takes forever (a minute or two) for the regen rate to overcome the disease damage. There has to be some kind of multiplier over time. If you guys want I can always check it out some more for details if you want.


All times are GMT -4. The time now is 03:53 AM.

Powered by vBulletin®, Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.