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

Reply
 
Thread Tools Display Modes
  #1  
Old 07-13-2010, 12:17 AM
trevius's Avatar
trevius
Developer
 
Join Date: Aug 2006
Location: USA
Posts: 5,946
Default

Couple suggestions:

spell effects.cpp
Code:
@@ -272,6 +276,8 @@
                                         val = cap;
 
                                 if(val > 0)
+										if(caster)
+											val = GetHealRate(val, caster->GetTarget());
                                         HealDamage(val, caster);
 
                                 break;
I assume you intended this instead:
Code:
				if(val > 0)
				{
					if(caster && caster->GetTarget())
						val = GetHealRate(val, caster->GetTarget());
					HealDamage(val, caster);
				}
Needed the brackets surrounding it and I added a check to make sure the caster has a target before sending them to the function that does not appear to check for a null pointer in the target. Those null pointers can be nasty :P
__________________
Trevazar/Trevius Owner of: Storm Haven
Everquest Emulator FAQ (Frequently Asked Questions) - Read It!
Reply With Quote
  #2  
Old 07-15-2010, 08:34 AM
trevius's Avatar
trevius
Developer
 
Join Date: Aug 2006
Location: USA
Posts: 5,946
Default

I am still testing most of the effects you have submitted. I haven't been able to test this one or the skill attack one yet due to some crash issues in the latest source updates. I wanted to mention here that I was also getting some crashes that seemed to be caused by the heal code here. I think they were just related to a potential null pointer that is easily fixed by doing something like this:

Code:
@@ -3143,7 +3139,10 @@
 				//healing spell...
 				//healing aggro would go here; removed for now
 				if(caster)
+				{
+ 					if(caster->GetTarget())
+						effect_value = GetHealRate(effect_value, caster->GetTarget());
 					effect_value = caster->GetActSpellHealing(spell_id, effect_value);
+				}
 				HealDamage(effect_value, caster);
 			}
__________________
Trevazar/Trevius Owner of: Storm Haven
Everquest Emulator FAQ (Frequently Asked Questions) - Read It!
Reply With Quote
  #3  
Old 07-15-2010, 10:17 AM
Secrets's Avatar
Secrets
Demi-God
 
Join Date: May 2007
Location: b
Posts: 1,449
Default

Quote:
Originally Posted by trevius View Post
I am still testing most of the effects you have submitted. I haven't been able to test this one or the skill attack one yet due to some crash issues in the latest source updates. I wanted to mention here that I was also getting some crashes that seemed to be caused by the heal code here. I think they were just related to a potential null pointer that is easily fixed by doing something like this:

Code:
@@ -3143,7 +3139,10 @@
 				//healing spell...
 				//healing aggro would go here; removed for now
 				if(caster)
+				{
+ 					if(caster->GetTarget())
+						effect_value = GetHealRate(effect_value, caster->GetTarget());
 					effect_value = caster->GetActSpellHealing(spell_id, effect_value);
+				}
 				HealDamage(effect_value, caster);
 			}
Yeah, unfortunately there's no way to get a caster out of zone, so this is the best solution for now; same issues I ran into with Mythic, Timesfive, etc, when doing the spelldamage/healing code. It may be worth mentioning that it's probably better to add GetHealRate into GetActSpellHealing instead of that function. Also, it may be worth looking into making an NPC::GetActSpellHealing, for those times when NPCs calculate differently.
Reply With Quote
  #4  
Old 07-16-2010, 09:36 AM
trevius's Avatar
trevius
Developer
 
Join Date: Aug 2006
Location: USA
Posts: 5,946
Default

I think it was that NPCs don't change targets when self buffing, as far as I know. So, when NPCs started self buffing on zone startup and cast certain buffs that might run through this code, it crashed the zone. At least that is my best guess. It was definitely NPCs causing it.

Finally got to test it again with the latest source and it no longer crashes with the few changes I have made.
__________________
Trevazar/Trevius Owner of: Storm Haven
Everquest Emulator FAQ (Frequently Asked Questions) - Read It!
Reply With Quote
  #5  
Old 07-16-2010, 08:01 PM
Caryatis
Dragon
 
Join Date: May 2009
Location: Milky Way
Posts: 539
Default

thanks for the testing Trev, hopefully we can get these effects solid pretty soon.
Reply With Quote
  #6  
Old 11-05-2010, 02:19 AM
Caryatis
Dragon
 
Join Date: May 2009
Location: Milky Way
Posts: 539
Default

Rewrote this effect as well to use the bonus system as well as being incorporated into GetActSpellHealing.

Code:
Index: EQEmuServer/zone/bonuses.cpp
===================================================================
--- EQEmuServer/zone/bonuses.cpp	(revision 1713)
+++ EQEmuServer/zone/bonuses.cpp	(working copy)
@@ -1206,8 +1206,11 @@
 					newbon->Accuracy = effect_value;
 				break;
 			}
+			case SE_HealRate:
+			{
+				newbon->HealRate += effect_value;
+				break;
+			}
 		}
 	}
 }
Index: EQEmuServer/zone/effects.cpp
===================================================================
--- EQEmuServer/zone/effects.cpp	(revision 1713)
+++ EQEmuServer/zone/effects.cpp	(working copy)
@@ -219,12 +219,22 @@
 }
 
 sint32 Client::GetActSpellHealing(int16 spell_id, sint32 value) {
+
 	sint32 modifier = 100;
 
 	modifier += GetFocusEffect(focusImprovedHeal, spell_id);
-						
+	
+	// Instant Heals					
 	if(spells[spell_id].buffduration < 1) {
-		//non-dot
+		
+		// Check for buffs that affect the healrate of the target
+		if (this->GetTarget())
+		{
+			value += value * GetHealRate(this->GetTarget()) / 100;
+			if(value < 1)
+				return 0;
+		}
+		
 		switch(GetAA(aaHealingAdept)) {
 		case 1:
 			modifier += 2;
Index: EQEmuServer/zone/mob.cpp
===================================================================
--- EQEmuServer/zone/mob.cpp	(revision 1713)
+++ EQEmuServer/zone/mob.cpp	(working copy)
@@ -3323,34 +3323,12 @@
 	return damage;
 }
 
-int32 Mob::GetHealRate(uint32 amount, Mob *target)
+int32 Mob::GetHealRate(Mob *target)
 {
-
-	if(target) {
-		int slot = target->GetBuffSlotFromType(SE_HealRate);
-		if(slot >= 0)
-		{
-			sint32 modify_amount = amount;
-			for(int i = 0; i < EFFECT_COUNT; i++)
-			{
-				if (spells[buffs[slot].spellid].effectid[i] == SE_HealRate)
-				{
-					// if the effect reduces the heal amount below 0, return 0.
-					if(spells[buffs[slot].spellid].base[i] < -100)
-					{
-						amount = 0;
-						break;
-					}
-					else
-					{
-						amount += (modify_amount * spells[buffs[slot].spellid].base[i] / 100);
-						break;
-					}
-				}
-			}
-		}
-	}
-	return amount;
+	if(!target)
+		return 0;
+	
+	return (target->itembonuses.HealRate + target->spellbonuses.HealRate);
 }
 
 bool Mob::TryFadeEffect(int slot)
Index: EQEmuServer/zone/mob.h
===================================================================
--- EQEmuServer/zone/mob.h	(revision 1713)
+++ EQEmuServer/zone/mob.h	(working copy)
@@ -275,6 +275,7 @@
 
 	sint8 HundredHands;		//extra haste, stacks with all other haste  i
 	sint8 MeleeLifetap;
+	sint16 HealRate;
 	int XPRateMod;
 
 	sint8	Packrat;	//weight reduction for items, 1 point = 10%
@@ -796,7 +797,7 @@
 	void TryTwincast(Mob *caster, Mob *target, uint32 spell_id);
 	void TrySympatheticProc(Mob *target, uint32 spell_id);
 	bool TryFadeEffect(int slot);
-	int32 GetHealRate(uint32 amount, Mob *target);
+	int32 GetHealRate(Mob *target);
 	sint32 GetVulnerability(sint32 damage, Mob *caster, uint32 spell_id, int32 ticsremaining);
 	sint32 GetSkillDmgTaken(const SkillType skill_used, sint32 damage);
 	void DoKnockback(Mob *caster, uint32 pushback, uint32 pushup);
Index: EQEmuServer/zone/spell_effects.cpp
===================================================================
--- EQEmuServer/zone/spell_effects.cpp	(revision 1713)
+++ EQEmuServer/zone/spell_effects.cpp	(working copy)
@@ -213,10 +213,8 @@
 				else if(dmg > 0) {
 					//healing spell...
 					if(caster)
-					{
-						dmg = GetHealRate(dmg, caster->GetTarget());
 						dmg = caster->GetActSpellHealing(spell_id, dmg);
-					}
+
 					HealDamage(dmg, caster);
 				}
 
@@ -252,8 +250,6 @@
 					dmg = -dmg;
 					Damage(caster, dmg, spell_id, spell.skill, false, buffslot, false);
 				} else {
-					if(caster)
-						dmg = GetHealRate(dmg, caster->GetTarget());
 					HealDamage(dmg, caster);
 				}
 				break;
@@ -278,11 +274,7 @@
 					val = cap;
 
 				if(val > 0)
-				{
-					if(caster && caster->GetTarget())
-						val = GetHealRate(val, caster->GetTarget());
 					HealDamage(val, caster);
-				}
 
 				break;
 			}
@@ -3246,25 +3238,20 @@
 				effect_value = -effect_value;
 				Damage(caster, effect_value, spell_id, spell.skill, false, i, true);
 			} else if(effect_value > 0) {
-				//healing spell...
-				//healing aggro would go here; removed for now
-				if(caster)
-				{
-					if (caster->GetTarget())
-						effect_value = GetHealRate(effect_value, caster->GetTarget());
- 					effect_value = caster->GetActSpellHealing(spell_id, effect_value);
-				}
+				// Regen spell...
+				effect_value += effect_value * (itembonuses.HealRate + spellbonuses.HealRate) / 100;
 
 				HealDamage(effect_value, caster);
 			}
-
 			break;
 		}
 		case SE_HealOverTime:
 		{
 			effect_value = CalcSpellEffectValue(spell_id, i, caster_level);
-			effect_value = GetHealRate(effect_value, this);
-			//is this affected by stuff like GetActSpellHealing??
+			if(caster)
+				// Currently returns no change as there are no AAs that affect HoTs but soon.
+				effect_value = caster->GetActSpellHealing(spell_id, effect_value);
+			effect_value += effect_value * (itembonuses.HealRate + spellbonuses.HealRate) / 100;
 			HealDamage(effect_value, caster);
 			//healing aggro would go here; removed for now
 			break;
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 02:14 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