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

Reply
 
Thread Tools Display Modes
  #1  
Old 04-13-2009, 08:13 PM
trevius's Avatar
trevius
Developer
 
Join Date: Aug 2006
Location: USA
Posts: 5,946
Default

If you are going to put that on the SVN, you might want to set a rule to allow/disable it or adjust rates if needed. Just a suggestion anyway.
__________________
Trevazar/Trevius Owner of: Storm Haven
Everquest Emulator FAQ (Frequently Asked Questions) - Read It!
Reply With Quote
  #2  
Old 04-13-2009, 08:28 PM
drakelord
Hill Giant
 
Join Date: Nov 2002
Location: NC, USA
Posts: 182
Default

Quote:
Originally Posted by trevius View Post
If you are going to put that on the SVN, you might want to set a rule to allow/disable it or adjust rates if needed. Just a suggestion anyway.
As I said in my previous post, I made a rule for doing just that,

RestRegenPercent <--- Sets a percent for extra recovery
RestRegenTimeToActivate <---- Sets the wait timer before the recovery period begins

I've already hard coded them into the rules file. I'm just fixing one last bug before I upload
Reply With Quote
  #3  
Old 04-13-2009, 09:45 PM
trevius's Avatar
trevius
Developer
 
Join Date: Aug 2006
Location: USA
Posts: 5,946
Default

So, to disable it, I am guessing you can just set those rules to -1 or something?

Code:
RestRegenPercent <--- Sets a percent for extra recovery
RestRegenTimeToActivate <---- Sets the wait timer before the recovery period begins
I think being able to disable the feature is probably the main option some servers might want. I would definitely use it on Storm Haven, but I am sure some servers might not want to use it.
__________________
Trevazar/Trevius Owner of: Storm Haven
Everquest Emulator FAQ (Frequently Asked Questions) - Read It!
Reply With Quote
  #4  
Old 04-13-2009, 09:55 PM
drakelord
Hill Giant
 
Join Date: Nov 2002
Location: NC, USA
Posts: 182
Default

Quote:
Originally Posted by trevius View Post
So, to disable it, I am guessing you can just set those rules to -1 or something?

Code:
RestRegenPercent <--- Sets a percent for extra recovery
RestRegenTimeToActivate <---- Sets the wait timer before the recovery period begins
I think being able to disable the feature is probably the main option some servers might want. I would definitely use it on Storm Haven, but I am sure some servers might not want to use it.
Just set RestRegenPercent to 0. Then, no bonus. But don't use that code from my first post. It has changed a bit.
Reply With Quote
  #5  
Old 04-13-2009, 10:06 PM
trevius's Avatar
trevius
Developer
 
Join Date: Aug 2006
Location: USA
Posts: 5,946
Default

Also, just a question; Are you removing the current Out of Combat Regen functionality? Currently, there is already a rule for NPCs to regen when they are out of combat.

If you are removing the current rule for it, you might want to make separate rules for players and NPCs.

Also, if you are removing the current rule for NPC OOC Regen, please submit the SQL to remove the rule from the rule_values table and add in the new ones you are making.

Sorry, to be bugging you about this. I don't know who you are, and I know the number of people with direct access to update the SVN is very limited, so I am just not sure how familiar you are with the process. I am familiar with all of the people who have access to make commits to the SVN, so maybe you are one of them using another forum account? If you aren't one of them, then you won't be able to commit the code yourself.
__________________
Trevazar/Trevius Owner of: Storm Haven
Everquest Emulator FAQ (Frequently Asked Questions) - Read It!
Reply With Quote
  #6  
Old 04-13-2009, 10:37 PM
drakelord
Hill Giant
 
Join Date: Nov 2002
Location: NC, USA
Posts: 182
Default

Quote:
Originally Posted by trevius View Post
Also, just a question; Are you removing the current Out of Combat Regen functionality? Currently, there is already a rule for NPCs to regen when they are out of combat.

If you are removing the current rule for it, you might want to make separate rules for players and NPCs.

Also, if you are removing the current rule for NPC OOC Regen, please submit the SQL to remove the rule from the rule_values table and add in the new ones you are making.

Sorry, to be bugging you about this. I don't know who you are, and I know the number of people with direct access to update the SVN is very limited, so I am just not sure how familiar you are with the process. I am familiar with all of the people who have access to make commits to the SVN, so maybe you are one of them using another forum account? If you aren't one of them, then you won't be able to commit the code yourself.
Old OOCRegen code is staying in for NPC Functionality. Rest regen currently only applies to clients. If you need an sql for the adding of the two fields, I can give you one, but its set in the rules field in the program to default to it if its not already set in the database.

And as for the SVN, cavedude gave me access earlier today. This is my only forum account, but I've been on/off since 2002. Don't worry, I won't break the code, :];
Reply With Quote
  #7  
Old 04-13-2009, 11:13 PM
drakelord
Hill Giant
 
Join Date: Nov 2002
Location: NC, USA
Posts: 182
Default

Ok, so maybe he didn't give me access, , so here is a diff file I guess.

Code:
Index: common/ruletypes.h
===================================================================
--- common/ruletypes.h	(revision 432)
+++ common/ruletypes.h	(working copy)
@@ -54,7 +54,9 @@
 RULE_INT ( Character, ItemStrikethroughCap, 35)
 RULE_INT ( Character, SkillUpModifier, 100) //skill ups are at 100%
 RULE_BOOL ( Character, SharedBankPlat, false) //off by default to prevent duping for now
-RULE_BOOL ( Character, BindAnywhere, false)
+RULE_BOOL ( Character, BindAnywhere, false)
+RULE_INT ( Character, RestRegenPercent, 20)
+RULE_INT ( Character, RestRegenTimeToActivate, 30000)
 RULE_CATEGORY_END()
 
 RULE_CATEGORY( Guild )
Index: zone/mob.h
===================================================================
--- zone/mob.h	(revision 432)
+++ zone/mob.h	(working copy)
@@ -1182,7 +1182,12 @@
 
 	bool	m_hasRune;
 	bool	m_hasSpellRune;
-	bool	m_hasDeathSaveChance;
+	bool	m_hasDeathSaveChance;
+	
+	unsigned int	restregenhp;
+	unsigned int	restregenmp;
+	unsigned int	restregenrate;
+	Timer	rest_timer;
 
 private:
 	void	_StopSong();		//this is not what you think it is
Index: zone/entity.h
===================================================================
--- zone/entity.h	(revision 432)
+++ zone/entity.h	(working copy)
@@ -333,7 +333,9 @@
 	void    ReloadAllClientsTaskState(int TaskID=0);
 
 	void	CreateGroundObject(int32 itemid, float x, float y, float z, float heading, int32 decay_time = 300000);
-	void	ZoneWho(Client *c, Who_All_Struct* Who);
+	void	ZoneWho(Client *c, Who_All_Struct* Who);
+
+	bool	MobCheckHate(Mob* mobe);
 
 #ifdef EQBOTS
 
Index: zone/client_process.cpp
===================================================================
--- zone/client_process.cpp	(revision 432)
+++ zone/client_process.cpp	(working copy)
@@ -75,6 +75,13 @@
 extern bool spells_loaded;
 extern PetitionList petition_list;
 extern EntityList entity_list;
+
+bool Client::IsAgroed() {
+	if (entity_list.MobCheckHate(this))
+		return true;
+	else
+		return false;
+}
 
 bool Client::Process() {
 	_ZP(Client_Process);
@@ -536,8 +543,29 @@
 		adverrorinfo = 4;
 		if (endupkeep_timer.Check() && !dead){
 			DoEnduranceUpkeep();
-		}
+		}
+
+        if(IsAgroed())
+        {
+		    rest_timer.SetTimer(0);
+            restregenhp = 0;
+            restregenmp = 0;
+        }		
+		else
+		{
+            if (rest_timer.Check(false) && (restregenrate > 0))
+            {             
+                restregenhp = (GetMaxHP() * restregenrate / 100);
+                restregenmp = (GetMaxMana() * restregenrate / 100);
+            }
+            else
+            {
+                restregenhp = 0;
+                restregenmp = 0;
+            }
+        }
 
+
 		if (tic_timer.Check() && !dead) {
 			CalcMaxHP();
 			CalcMaxMana();
@@ -1676,7 +1704,7 @@
 	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);
+	SetHP(GetHP() + total_regen + restregenhp);
 	SendHPUpdate();
 }
 
@@ -1705,7 +1733,7 @@
 
 	regen = (regen * RuleI(Character, ManaRegenMultiplier)) / 100;
 	
-	SetMana(GetMana() + regen);
+	SetMana(GetMana() + regen + restregenmp);
 	SendManaUpdatePacket();
 }
 
Index: zone/mob.cpp
===================================================================
--- zone/mob.cpp	(revision 432)
+++ zone/mob.cpp	(working copy)
@@ -107,7 +107,8 @@
 		stunned_timer(0),
 		bardsong_timer(6000),
 		flee_timer(FLEE_CHECK_TIMER),
-		bindwound_timer(10000)
+		bindwound_timer(10000),
+		rest_timer(RuleI(Character, RestRegenTimeToActivate))
 	//	mezzed_timer(0)
 {
 	targeted = false;
@@ -157,8 +158,12 @@
 	level		= in_level;
 	npctype_id	= in_npctype_id; // rembrant, Dec. 20, 2001
 	size		= in_size;
-	runspeed   = in_runspeed;
+	runspeed   = in_runspeed;
+	restregenhp = 0;
+	restregenmp = 0;
+	restregenrate = (RuleI(Character, RestRegenPercent));
 
+
 	
     // neotokyo: sanity check
     if (runspeed < 0 || runspeed > 20)
Index: zone/client.h
===================================================================
--- zone/client.h	(revision 432)
+++ zone/client.h	(working copy)
@@ -867,7 +867,9 @@
 	inline int CompletedTasksInSet(int TaskSet)
 	 	   { return (taskstate ? taskstate->CompletedTasksInSet(TaskSet) :0); }
 
-	inline EQClientVersion GetClientVersion() { return ClientVersion; }
+	inline EQClientVersion GetClientVersion() { return ClientVersion; }
+
+	bool	IsAgroed();
 
 protected:
 	friend class Mob;
Index: zone/entity.cpp
===================================================================
--- zone/entity.cpp	(revision 432)
+++ zone/entity.cpp	(working copy)
@@ -289,7 +289,18 @@
     if (count <= 2)
         return true;
     return false;
-}
+}
+
+bool EntityList::MobCheckHate(Mob* mobe) {
+	LinkedListIterator<Mob*> iterator(mob_list);
+	for(iterator.Reset(); iterator.MoreElements(); iterator.Advance())
+	{
+		Mob* mobf = iterator.GetData();
+		if (mobf->CheckAggro(mobe))
+		return true;
+	}
+	return false;
+}
 
 void EntityList::AddClient(Client* client) {
 	client->SetID(GetFreeID());
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:13 AM.


 

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