|
|
 |
 |
 |
 |
|
 |
 |
|
 |
 |
|
 |
|
 |
|
 |

09-04-2007, 02:24 AM
|
Fire Beetle
|
|
Join Date: Nov 2004
Posts: 12
|
|
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
|
 |
|
 |
 |
|
 |

09-04-2007, 02:48 AM
|
Fire Beetle
|
|
Join Date: Nov 2004
Posts: 12
|
|
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:  oManaRegen() 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();
}
|
 |
|
 |
 |
|
 |

09-04-2007, 03:32 AM
|
 |
The PEQ Dude
|
|
Join Date: Apr 2003
Location: -
Posts: 1,988
|
|
Quote:
Originally Posted by zydria
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
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.
|
 |
|
 |

09-04-2007, 03:40 AM
|
Fire Beetle
|
|
Join Date: Nov 2004
Posts: 12
|
|
Quote:
Originally Posted by cavedude
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.
|

09-04-2007, 03:49 AM
|
 |
The PEQ Dude
|
|
Join Date: Apr 2003
Location: -
Posts: 1,988
|
|
I actually thought that's how it already was, that's why I got confused. Sorry for the misunderstanding I understand now, thank you 
|

09-04-2007, 03:54 AM
|
Developer
|
|
Join Date: Apr 2003
Posts: 589
|
|
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.
__________________
Read my developer notes at my blog.
Quote:
If it's not on IRC, it ain't l33t!
|
|
 |
|
 |

09-04-2007, 06:33 AM
|
Fire Beetle
|
|
Join Date: Nov 2004
Posts: 12
|
|
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.
|
 |
|
 |
 |
|
 |

09-04-2007, 06:43 PM
|
Administrator
|
|
Join Date: Sep 2006
Posts: 1,348
|
|
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!
|
 |
|
 |
Thread Tools |
|
Display Modes |
Hybrid Mode
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
All times are GMT -4. The time now is 02:22 PM.
|
|
 |
|
 |
|
|
|
 |
|
 |
|
 |