Go Back   EQEmulator Home > EQEmulator Forums > General > General::General Discussion

General::General Discussion General discussion about EverQuest(tm), EQEMu, and related topics.
Do not post support topics here.

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #2  
Old 10-30-2010, 03:06 PM
bad_captain
Developer
 
Join Date: Feb 2009
Location: Cincinnati, OH
Posts: 512
Default New SoD HP, Mana, End calculations support

Earlier this week, I posted changes to allow Bots to be viewed with CharBrowser. I have now added support for the new SoD HP, Mana, and Endurance calculations. The only thing I don't like about this code is that I had to pass in the $useSoDHPManaEnd variable to the functions, as I could not get them access to the variable I set in the config file even after including it in the calculatestats.php file. If anyone knows how to fix that, please let me know. Thanks! Oh, also, this will turn on the new calculations for everyone using the system, even if they use Titanium, but I assume anyone who would use this would be using a private server and would know if they are using SoD =).

Here are the changes.

/include/config.php

in the General Settings section, add rule for using SoD calcs
Code:
$useSoDHPManaEnd = 0 	;//use SoD calcs 0=no 1=yes


/include/calculatestats.php

add function GetClassHPFactor
Code:
//function copied/converted from EQEMU sourcecode oct 26, 2010
function GetClassHPFactor($class) {

	$multiplier = 0;

	$WARRIOR = 1;	
	$CLERIC = 2;
	$PALADIN = 3;
	$RANGER = 4;
	$SHADOWKNIGHT = 5;
	$DRUID = 6;
	$MONK = 7;
	$BARD = 8;
	$ROGUE = 9;
	$SHAMAN = 10;
	$NECROMANCER = 11;
	$WIZARD = 12;
	$MAGICIAN = 13;
	$ENCHANTER = 14;
	$BEASTLORD = 15;
	$BERSERKER = 16;

	
	switch($class)
	{
		case $DRUID:
		case $ENCHANTER:
		case $NECROMANCER:
		case $MAGICIAN:
		case $WIZARD:
			$multiplier = 240;
			break;
		case $BEASTLORD:
		case $BERSERKER:
		case $MONK:
		case $ROGUE:
		case $SHAMAN:
			$multiplier = 255;
			break;
		case $BARD:
		case $CLERIC:
			$multiplier = 264;
			break;
		case $SHADOWKNIGHT:
		case $PALADIN:
			$multiplier = 288;
			break;
		case $RANGER:
			$multiplier = 276;
			break;
		case $WARRIOR:
			$multiplier = 300;
			break;
		default:
			$multiplier = 240;
			break;
	}
	return $multiplier;
}
replace GetMaxHP
Code:
//function copied/converted from EQEMU sourcecode oct 26, 2010
function GetMaxHP($mlevel,$class,$sta,$ihp,$useSoDHPManaEnd)
{
	if($useSoDHPManaEnd == 1)
	{
		$SoDPost255 = 0;

		if((($sta- 255) / 2) > 0)
			$SoDPost255 = (($sta- 255) / 2);
		else
			$SoDPost255 = 0;

		$hp_factor = GetClassHPFactor($class);
		
		if ($mlevel < 41) {
			$base_hp = (5 + ($mlevel * $hp_factor / 12) + 
				(($sta- $SoDPost255) * $level * $hp_factor / 3600));
		}
		else if ($mlevel < 81) {
			$base_hp = (5 + (40 * hp_factor / 12) + (($mlevel - 40) * $hp_factor / 6) + 
				(($sta- $SoDPost255) * $hp_factor / 90) + 
				(($sta- $SoDPost255) * ($mlevel - 40) * $hp_factor / 1800));
		}
		else { 
			$base_hp = (5 + (80 * $hp_factor / 8) + (($mlevel - 80) * $hp_factor / 10) + 
				(($sta- $SoDPost255) * $hp_factor / 90) + 
				(($sta- $SoDPost255) * $hp_factor / 45));
		}

		$base_hp += $ihp;
	}
	else
	{
		$lm = GetClassLevelFactor($mlevel,$class);
		$Post255 = 0;
		if(($sta-255)/2 > 0)
			$Post255 = ($sta-255)/2;
		else
			$Post255 = 0;
		
		$base_hp = (5)+($mlevel*$lm/10) + ((($sta-$Post255)*$mlevel*$lm/3000)) + (($Post255*$mlevel)*$lm/6000);

		$base_hp += $ihp;
	}

	return floor($base_hp);
}
replace GetMaxMana
Code:
//function copied/converted from EQEMU sourcecode oct 26, 2010, was  named CalcMaxMana();
function GetMaxMana($level,$class,$int,$wis,$imana,$useSoDHPManaEnd)
{
	$WisInt = 0;
	$MindLesserFactor = 0;
	$MindFactor = 0;
	$max_m = 0;
	$wisint_mana = 0;
	$base_mana = 0;
	$ConvertedWisInt = 0;
	switch(GetCasterClass($class))
	{
		case 'I': 
			$WisInt = $int;

			if($useSoDHPManaEnd == 1)
			{
				if ($WisInt > 100) {
					$ConvertedWisInt = ((($WisInt - 100) * 5 / 2) + 100);
					if ($WisInt > 201) {
						$ConvertedWisInt -= (($WisInt - 201) * 5 / 4);
					}
				}
				else {
					$ConvertedWisInt = $WisInt;
				}
				if ($level < 41) { 
					$wisint_mana = ($level * 75 * $ConvertedWisInt / 1000);
					$base_mana = ($level * 15);
				}
				else if ($level < 81) {
					$wisint_mana = ((3 * $ConvertedWisInt) + (($level - 40) * 15 * $ConvertedWisInt / 100));
					$base_mana = (600 + (($level - 40) * 30));
				}
				else {
					$wisint_mana = (9 * $ConvertedWisInt);
					$base_mana = (1800 + (($level - 80) * 18));
				}
				$max_mana = $base_mana + $wisint_mana;
				$max_mana += $imana;
			}
			else
			{
				if((( $WisInt - 199 ) / 2) > 0)
					$MindLesserFactor = ( $WisInt - 199 ) / 2;
				else
					$MindLesserFactor = 0;

				$MindFactor = $WisInt - $MindLesserFactor;
				if($WisInt > 100)
					$max_mana = (((5 * ($MindFactor + 20)) / 2) * 3 * $level / 40);
				else
					$max_mana = (((5 * ($MindFactor + 200)) / 2) * 3 * $level / 100);	
				$max_mana += $imana;
			}
			break;

		case 'W':
			$WisInt = $wis;

			if($useSoDHPManaEnd == 1)
			{
				if ($WisInt > 100) {
					$ConvertedWisInt = ((($WisInt - 100) * 5 / 2) + 100);
					if ($WisInt > 201) {
						$ConvertedWisInt -= (($WisInt - 201) * 5 / 4);
					}
				}
				else {
					$ConvertedWisInt = $WisInt;
				}
				if ($level < 41) { 
					$wisint_mana = ($level * 75 * $ConvertedWisInt / 1000);
					$base_mana = ($level * 15);
				}
				else if ($level < 81) {
					$wisint_mana = ((3 * $ConvertedWisInt) + (($level - 40) * 15 * $ConvertedWisInt / 100));
					$base_mana = (600 + (($level - 40) * 30));
				}
				else {
					$wisint_mana = (9 * $ConvertedWisInt);
					$base_mana = (1800 + (($level - 80) * 18));
				}
				$max_mana = $base_mana + $wisint_mana;
				$max_mana += $imana;
			}
			else
			{
				if((( $WisInt - 199 ) / 2) > 0)
					$MindLesserFactor = ( $WisInt - 199 ) / 2;
				else
					$MindLesserFactor = 0;

				$MindFactor = $WisInt - $MindLesserFactor;
				if($WisInt > 100)
					$max_mana = (((5 * ($MindFactor + 20)) / 2) * 3 * $level / 40);
				else
					$max_mana = (((5 * ($MindFactor + 200)) / 2) * 3 * $level / 100);	
			
				$max_mana += $imana;
			}
			break;
				
		case 'N': {
			$max_mana = 0;
			break;
		}

	}

	return floor($max_mana);
}
replace GetMaxEndurance
Code:
//function copied/converted from EQEMU sourcecode oct 26, 2010
function GetMaxEndurance($STR,$STA,$DEX,$AGI,$level,$iendurance,$useSoDHPManaEnd)
{
	if ($useSoDHPManaEnd == 1)
	{
		$Stats = ($STR + $STA + $DEX + $AGI)/4;
		$base_endurance = 0;
		$ConvertedStats = 0;
		$sta_end = 0;

		if (($Stats) > 100) {
			$ConvertedStats = ((($Stats - 100) * 5 / 2) + 100);
			if ($Stats > 201) {
				$ConvertedStats -= (($Stats - 201) * 5 / 4);
			}
		}
		else {

			$ConvertedStats = $Stats;
		}

		if ($level < 41) { 
			$sta_end = ($level * 75 * $ConvertedStats / 1000);
			$base_endurance = ($level * 15);
		}
		else if ($level < 81) {
			$sta_end = ((3 * $ConvertedStats) + (($level - 40) * 15 * $ConvertedStats / 100));
			$base_endurance = (600 + (($level - 40) * 30));
		}
		else {
			$sta_end = (9 * $ConvertedStats);
			$base_endurance = (1800 + (($level - 80) * 18));
		}
		$max_end = ($base_endurance + $sta_end);
	}
	else
	{
		$Stats = $STR + $STA + $DEX + $AGI;
		$LevelBase = $level * 15;

		$at_most_800 = $Stats;
		if($at_most_800 > 800)
			$at_most_800 = 800;
	
		$Bonus400to800 = 0;
		$HalfBonus400to800 = 0;
		$Bonus800plus = 0;
		$HalfBonus800plus = 0;
	
		$BonusUpto800 = floor( $at_most_800 / 4 ) ;
		if($Stats > 400) {
			$Bonus400to800 = floor( ($at_most_800 - 400) / 4 );
			$HalfBonus400to800 = floor( max( ( $at_most_800 - 400 ), 0 ) / 8 );
		
			if($Stats > 800) {
				$Bonus800plus = floor( ($Stats - 800) / 8 ) * 2;
				$HalfBonus800plus = floor( ($Stats - 800) / 16 );
			}
		}
		$bonus_sum = $BonusUpto800 + $Bonus400to800 + $HalfBonus400to800 + $Bonus800plus + $HalfBonus800plus;
	
		$max_end = $LevelBase;

		//take all of the sums from above, then multiply by level*0.075
		$max_end += ( $bonus_sum * 3 * $level ) / 40;
	}
	
	$max_end += $iendurance;
	return floor($max_end);
}


/bot.php

within $template->assign_vars(array()), add parameter to GetMaxHP, GetMaxMana, and GetMaxEndurance that determines whether or not to use SoD calcs
Code:
  'HP' => GetMaxHP($level,$botclass,($baseSTA+$itemstats->STA()),$itemstats->hp(),$useSoDHPManaEnd),
  'MANA' => GetMaxMana($level,$botclass,($baseINT+$itemstats->INT()),($baseWIS+$itemstats->WIS()),+$itemstats->mana(),$useSoDHPManaEnd),
  'ENDR' => GetMaxEndurance(($baseSTR+$itemstats->STR()),($baseSTA+$itemstats->STA()),($baseDEX+$itemstats->DEX()),($baseAGI+$itemstats->AGI()),$level,$itemstats->endurance(),$useSoDHPManaEnd),


/character.php

within $template->assign_vars(array()), add parameters to GetManHP, GetMaxMana, GetMaxEndurance
Code:
  'HP' => GetMaxHP($level,$class,($baseSTA+$itemstats->STA()),$itemstats->hp(),$useSoDHPManaEnd),
  'MANA' => GetMaxMana($level,$class,($baseINT+$itemstats->INT()),($baseWIS+$itemstats->WIS()),+$itemstats->mana(),$useSoDHPManaEnd),
  'ENDR' => GetMaxEndurance(($baseSTR+$itemstats->STR()),($baseSTA+$itemstats->STA()),($baseDEX+$itemstats->DEX()),($baseAGI+$itemstats->AGI()),$level,$itemstats->endurance(),$useSoDHPManaEnd),
Reply With Quote
 

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 04:20 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