Go Back   EQEmulator Home > EQEmulator Forums > Development > Development::Server Code Submissions

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #12  
Old 09-04-2007, 06:33 AM
zydria
Fire Beetle
 
Join Date: Nov 2004
Posts: 12
Default

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.
Reply With Quote
 


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

   

All times are GMT -4. The time now is 07:47 PM.


 

Everquest is a registered trademark of Daybreak Game Company LLC.
EQEmulator is not associated or affiliated in any way with Daybreak Game Company LLC.
Except where otherwise noted, this site is licensed under a Creative Commons License.
       
Powered by vBulletin®, Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Template by Bluepearl Design and vBulletin Templates - Ver3.3