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

Reply
 
Thread Tools Display Modes
  #1  
Old 06-07-2013, 05:32 PM
Hateborne
Hill Giant
 
Join Date: May 2010
Posts: 125
Default MaxHPChange Tweak

We were having issues on EZ server due to the MaxHPChange being both int16 and due to some of the math involved. Thanks to Paldail and lerxst2112, we've produced a slightly more usable form that should resolve our problems while maintaining original functionality.

Code:
diff --git "a/.\\Server\\zone\\/bot.cpp" "b/.\\Server-Original\\zone\\/bot.cpp"
index b54fe70..c88ad72 100644
--- "a/.\\Server\\zone\\/bot.cpp"
+++ "b/.\\Server-Original\\zone\\/bot.cpp"
@@ -11043,7 +11043,7 @@ int32 Bot::CalcMaxHP() {
 
 	bot_hp += GroupLeadershipAAHealthEnhancement();
 
-	bot_hp += bot_hp * (spellbonuses.MaxHPChange + itembonuses.MaxHPChange) / 10000;
+	bot_hp += bot_hp * ((spellbonuses.MaxHPChange + itembonuses.MaxHPChange) / 10000.0f);
 	max_hp = bot_hp;
 
 	if (cur_hp > max_hp)
diff --git "a/.\\Server\\zone\\/client_mods.cpp" "b/.\\Server-Original\\zone\\/client_mods.cpp"
index 1e27185..eaab0ba 100644
--- "a/.\\Server\\zone\\/client_mods.cpp"
+++ "b/.\\Server-Original\\zone\\/client_mods.cpp"
@@ -250,7 +250,7 @@ int32 Client::CalcMaxHP() {
 
 	max_hp += GroupLeadershipAAHealthEnhancement();

-	max_hp += max_hp * (spellbonuses.MaxHPChange + itembonuses.MaxHPChange) / 10000;	
+	max_hp += max_hp * ((spellbonuses.MaxHPChange + itembonuses.MaxHPChange) / 10000.0f);
 
 	if (cur_hp > max_hp)
 		cur_hp = max_hp;
diff --git "a/.\\Server\\zone\\/common.h" "b/.\\Server-Original\\zone\\/common.h"
index f7716c9..ddc1711 100644
--- "a/.\\Server\\zone\\/common.h"
+++ "b/.\\Server-Original\\zone\\/common.h"
@@ -283,7 +283,7 @@ struct StatBonuses {
 	int16	HundredHands;						//extra haste, stacks with all other haste	i
 	int8	MeleeLifetap;						//i
 	int16	HealRate;							// Spell effect that influences effectiveness of heals
-	int16	MaxHPChange;						// Spell Effect
+	int32	MaxHPChange;						// Spell Effect
 	int16	SkillDmgTaken[HIGHEST_SKILL+2];		// All Skills + -1
 	int32	HealAmt;							// Item Effect
 	int32	SpellDmg;							// Item Effect
diff --git "a/.\\Server\\zone\\/merc.cpp" "b/.\\Server-Original\\zone\\/merc.cpp"
index 3709524..0e652ff 100644
--- "a/.\\Server\\zone\\/merc.cpp"
+++ "b/.\\Server-Original\\zone\\/merc.cpp"
@@ -918,7 +918,7 @@ int32 Merc::CalcMaxHP() {
 
 	max_hp += GroupLeadershipAAHealthEnhancement();
 
-	max_hp += max_hp * (spellbonuses.MaxHPChange + itembonuses.MaxHPChange) / 10000;
+	max_hp += max_hp * ((spellbonuses.MaxHPChange + itembonuses.MaxHPChange) / 10000.0f);
 
 	if (cur_hp > max_hp)
 		cur_hp = max_hp;
diff --git "a/.\\Server\\zone\\/mob.cpp" "b/.\\Server-Original\\zone\\/mob.cpp"
index bce504a..33560ed 100644
--- "a/.\\Server\\zone\\/mob.cpp"
+++ "b/.\\Server-Original\\zone\\/mob.cpp"
@@ -615,8 +615,7 @@ int32 Mob::CalcMaxMana() {
 
 int32 Mob::CalcMaxHP() {
 	max_hp = (base_hp + itembonuses.HP + spellbonuses.HP);
-	max_hp += max_hp * (aabonuses.MaxHPChange + spellbonuses.MaxHPChange + itembonuses.MaxHPChange) / 10000;
+	max_hp += max_hp * ((aabonuses.MaxHPChange + spellbonuses.MaxHPChange + itembonuses.MaxHPChange) / 10000.0f);
 	return max_hp;
 }
I've never created a git diff, so please don't crucify me too hard if it's wrong. (I've got medium-low resists to it!)


-Hate
Reply With Quote
  #2  
Old 06-08-2013, 03:20 PM
NatedogEZ's Avatar
NatedogEZ
Developer
 
Join Date: Dec 2012
Posts: 515
Default

This tweak works nicely!
Reply With Quote
  #3  
Old 06-12-2013, 03:13 PM
KLS
Administrator
 
Join Date: Sep 2006
Posts: 1,348
Default

Merged this, thanks.

Might be easier to use pull requests on github over diffs. Though I realize some people are a little wary of git still so we will still accept diffs for a long time.
Reply With Quote
  #4  
Old 06-12-2013, 07:45 PM
Hateborne
Hill Giant
 
Join Date: May 2010
Posts: 125
Default

Quote:
Originally Posted by KLS View Post
Merged this, thanks.

Might be easier to use pull requests on github over diffs. Though I realize some people are a little wary of git still so we will still accept diffs for a long time.
Ok, I will look into it and try to submit anything further in this manner. Thanks for the commit!


-Hate
Reply With Quote
Reply


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:01 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 - 2024, Jelsoft Enterprises Ltd.
Template by Bluepearl Design and vBulletin Templates - Ver3.3