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

Reply
 
Thread Tools Display Modes
  #1  
Old 09-04-2007, 03:54 AM
WildcardX
Developer
 
Join Date: Apr 2003
Posts: 589
Default

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!
Reply With Quote
  #2  
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
  #3  
Old 09-04-2007, 06:43 PM
KLS
Administrator
 
Join Date: Sep 2006
Posts: 1,348
Default

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!
Reply With Quote
  #4  
Old 09-04-2007, 07:03 PM
John Adams
Demi-God
 
Join Date: Jul 2006
Posts: 1,552
Default

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!!
Reply With Quote
  #5  
Old 09-05-2007, 08:02 AM
soulshot
Hill Giant
 
Join Date: Jun 2006
Posts: 142
Default

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.
Reply With Quote
  #6  
Old 09-05-2007, 05:10 PM
KLS
Administrator
 
Join Date: Sep 2006
Posts: 1,348
Default

I think we can add something in, though it probably wont be right away. Regardless of that: thanks for the code submission... even if we don't use the exact code it got us talking about it and hopefully it brings with it a solution to the problem.
Reply With Quote
  #7  
Old 09-11-2007, 03:27 PM
Irreverent
The Solo Server
 
Join Date: May 2007
Posts: 416
Default

This would be great on the solo server, since its hard to balance a hit vs. regen and the up time between battles.
__________________
OP of Irreverent Server (The Solo Server)
Our Forums
Reply With Quote
  #8  
Old 01-13-2008, 06:28 AM
Annihilator
Sarnak
 
Join Date: May 2007
Posts: 47
Default OOC regen

OOC regen should not be active if you have a dot or are diseased. Atleast that is the way it works on Live. I would like to see OOC regen implemented into the Emu. That is one of the features I actually miss.
Reply With Quote
  #9  
Old 01-13-2008, 06:36 AM
ChaosSlayer
Demi-God
 
Join Date: May 2007
Posts: 1,032
Default

while I have not writen any custom code, I find an alternative fix for out of combat regeneration. I gave my players clicky heal stones, which heal for large ammount of hp but take a WHILE to cast. Thsi basicly substitutes out of combat recovery, while preventing you from using such stone in combat due to very long cast time
Reply With Quote
Reply

Thread Tools
Display Modes

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 11:12 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