View Single Post
  #9  
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