Go Back   EQEmulator Home > EQEmulator Forums > Misc > Misc::Off Topic

Misc::Off Topic Want to talk about something that has nothing to do with EverQuest or the emulator? Post here.

Reply
 
Thread Tools Display Modes
  #1  
Old 07-16-2008, 01:47 AM
spider661
Discordant
 
Join Date: Oct 2005
Location: michigain
Posts: 260
Default more php help

im trying to get the players hp mana and ac

i think the calculations are all wrong becuase there not coming up the same in the game as they are on my website. i used code from the old magelo clone and the server scorce file client_mods.cpp

her is what im using.

Code:
function getACmod($agility, $level) {
    if ($agility >=1 && $agility <=74){
	if ($agility == 1)
	  return -24;
	else if ($agility >=2 && $agility <=3)
	  return -23;
	else if ($agility == 4)
	  return -22;
	else if ($agility >=5 && $agility <=6)
	  return -21;
	else if ($agility >=7 && $agility <=8)
	  return -20;
	else if ($agility == 9)
	  return -19;
	else if ($agility >=10 && $agility <=11)
	  return -18;
	else if ($agility == 12)
	  return -17;
	else if ($agility >=13 && $agility <=14)
	  return -16;
	else if ($agility >=15 && $agility <=16)
	  return -15;
	else if ($agility == 17)
	  return -14;
	else if ($agility >=18 && $agility <=19)
	  return -13;
	else if ($agility == 20)
	  return -12;
	else if ($agility >=21 && $agility <=22)
	  return -11;
	else if ($agility >=23 && $agility <=24)
	  return -10;
	else if ($agility == 25)
	  return -9;
	else if ($agility >=26 && $agility <=27)
	  return -8;
	else if ($agility == 28)
	  return -7;
	else if ($agility >=29 && $agility <=30)
	  return -6;
	else if ($agility >=31 && $agility <=32)
	  return -5;
	else if ($agility == 33)
	  return -4;
	else if ($agility >=34 && $agility <=35)
	  return -3;
	else if ($agility == 36)
	  return -2;
	else if ($agility >=37 && $agility <=38)
	  return -1;
	else if ($agility >=39 && $agility <=65)
	  return 0;
	else if ($agility >=66 && $agility <=70)
	  return 1;
	else if ($agility >=71 && $agility <=74)
	  return 5;
    }
    else {
	if ($agility == 75){
	    if ($level >= 1 && $level <= 6)
	      return 9;
	    else if ($level >= 7 && $level <= 19)
	      return 23;
	    else if ($level >= 20 && $level <= 39)
	      return 33;
	    else if ($level >= 40)
	      return 39;
	}
	else if ($agility >= 76 && $agility <= 79){
	    if ($level >= 1 && $level <= 6)
	      return 10;
	    else if ($level >= 7 && $level <= 19)
	      return 23;
	    else if ($level >= 20 && $level <= 39)
	      return 33;
	    else if ($level >= 40)
	      return 40;
	}
	else if ($agility == 80){
	    if ($level >= 1 && $level <= 6)
	      return 11;
	    else if ($level >= 7 && $level <= 19)
	      return 24;
	    else if ($level >= 20 && $level <= 39)
	      return 34;
	    else if ($level >= 40)
	      return 41;
	}
	else if ($agility >= 81 && $agility <= 85){
	    if ($level >= 1 && $level <= 6)
	      return 12;
	    else if ($level >= 7 && $level <= 19)
	      return 25;
	    else if ($level >= 20 && $level <= 39)
	      return 35;
	    else if ($level >= 40)
	      return 42;
	}
	else if ($agility >= 86 && $agility <= 90){
	    if ($level >= 1 && $level <= 6)
	      return 12;
	    else if ($level >= 7 && $level <= 19)
	      return 26;
	    else if ($level >= 20 && $level <= 39)
	      return 36;
	    else if ($level >= 40)
	      return 42;
	}
	else if ($agility >= 91 && $agility <= 95){
	    if ($level >= 1 && $level <= 6)
	      return 13;
	    else if ($level >= 7 && $level <= 19)
	      return 26;
	    else if ($level >= 20 && $level <= 39)
	      return 36;
	    else if ($level >= 40)
	      return 43;
	}
	else if ($agility >= 96 && $agility <= 99){
	    if ($level >= 1 && $level <= 6)
	      return 14;
	    else if ($level >= 7 && $level <= 19)
	      return 27;
	    else if ($level >= 20 && $level <= 39)
	      return 37;
	    else if ($level >= 40)
	      return 44;
	}
	else if ($agility == 100 && $level >= 7){
	    if ($level >= 7 && $level <= 19)
	      return 28;
	    else if ($level >= 20 && $level <= 39)
	      return 38;
	    else if ($level >= 40)
	      return 45;
	}
	else if ($level >= 1 && $level <= 6) {
	    return 15;
	}
	else if ($agility >= 101 && $agility <= 105){
	    if ($level >= 7 && $level <= 19)
	      return 29;
	    else if ($level >= 20 && $level <= 39)
	      return 39;// not verified
	    else if ($level >= 40)
	      return 45;
	}
	else if ($agility >= 106 && $agility <= 110){
	    if ($level >= 7 && $level <= 19)
	      return 29;
	    else if ($level >= 20 && $level <= 39)
	      return 39;// not verified
	    else if ($level >= 40)
	      return 46;
	}
	else if ($agility >= 111 && $agility <= 115){
	    if ($level >= 7 && $level <= 19)
	      return 30;
	    else if ($level >= 20 && $level <= 39)
	      return 40;// not verified
	    else if ($level >= 40)
	      return 47;
	}
	else if ($agility >= 116 && $agility <= 119){
	    if ($level >= 7 && $level <= 19)
	      return 31;
	    else if ($level >= 20 && $level <= 39)
	      return 41;
	    else if ($level >= 40)
	      return 47;
	}
	else if ($agility == 120 && $level >= 20){
	    if ($level >= 20 && $level <= 39)
	      return 42;
	    else if ($level >= 40)
	      return 48;
	}
	else if ($level >= 7 && $level <= 19) {
	    return 32;
	}
	else if ($agility >= 121 && $agility <= 125){
	    if ($level >= 20 && $level <= 39)
	      return 42;
	    else if ($level >= 40)
	      return 49;
	}
	else if ($agility >= 126 && $agility <= 135){
	    if ($level >= 20 && $level <= 39)
	      return 42;
	    else if ($level >= 40)
	      return 50;
	}
	else if ($agility >= 136){
	    if ($level >= 20 && $level <= 39)
	      return 42;
	    else if ($level >= 40)
	      return 51;
	}
    }
}

function getAC($class, $agility, $level, $defense, $itemAC) {
    $avoidance = 0;
    $avoidance = getACmod($agility, $level) + (($defense * 17) / 9);
    
    if($avoidance < 0) {
	$avoidance = 0;
    }
    
    $mitigation = 0;
    if($class == 'Wizard' || $class == 'Magician' || $class == 'Necromancer' || $class == 'Echanter') {
	$mitigation = ($defense / 3) + (($itemAC * 4) / 3);
    } else {
	$mitigation = ($defense / 2) + ($itemAC + 1);
	
    }
    
    return floor((($avoidance + $mitigation) * 1000) / 800);    
}
function LevelFactor($class, $level){
	$multiplier = 0;
	$mlevel=$level;
	switch($class)
	{
		case '1':{
			if ($mlevel < 20)
				$multiplier = 220;
			else if ($mlevel < 30)
				$multiplier = 230;
			else if ($mlevel < 40)
				$multiplier = 250;
			else if ($mlevel < 53)
				$multiplier = 270;
			else if ($mlevel < 57)
				$multiplier = 280;
			else if ($mlevel < 60)
				$multiplier = 290;
			else if ($mlevel < 70)
				$multiplier = 300;
			else 
				$multiplier = 311;
			break;
		}
		case '6':
		case '2':
		case '10':{
			if ($mlevel < 70)
				$multiplier = 150;
			else
				$multiplier = 157;
			break;
		}
		case '16':
		case '3':
		case '5':{
			if ($mlevel < 35)
				$multiplier = 210;
			else if ($mlevel < 45)
				$multiplier = 220;
			else if ($mlevel < 51)
				$multiplier = 230;
			else if ($mlevel < 56)
				$multiplier = 240;
			else if ($mlevel < 60)
				$multiplier = 250;
			else if ($mlevel < 68)
				$multiplier = 260;
			else
				$multiplier = 270;
			break;
		}
		case '7':
		case '8':
		case '9':
		case '15':{
			if ($mlevel < 51)
				$multiplier = 180;
			else if ($mlevel < 58)
				$multiplier = 190;
			else if ($mlevel < 70)
				$multiplier = 200;
			else
				$multiplier = 210;
			break;
		}
		case '4':{
			if ($mlevel < 58)
				$multiplier = 200;
			else if ($mlevel < 70)
				$multiplier = 210;
			else
				$multiplier = 220;
			break;
		}
		case '13':
		case '12':
		case '11':
		case '14':{
			if ($mlevel < 70)
				$multiplier = 120;
			else
				$multiplier = 127;
			break;
		}
		default:{
			if ($mlevel < 35)
				$multiplier = 210;
			else if ($mlevel < 45)
				$multiplier = 220;
			else if ($mlevel < 51)
				$multiplier = 230;
			else if ($mlevel < 56)
				$multiplier = 240;
			else if ($mlevel < 60)
				$multiplier = 250;
			else
				$multiplier = 260;
			break;
		}
	}
	return $multiplier;
}

	$lm=LevelFactor($class, $level);
	$Post255;
	if(($sta-255)/2 > 0){
		$Post255 = ($sta-255)/2;
	}else{
		$Post255 = 0;
		}
$hpcal = floor((5)+($level*$lm/10)) + floor(((($sta-Post255)*$level*$lm/3000)));		
$hp = MaxHP($hpcal, $itemHP);
$mana = $Profile["mana"];
$mana += $itemMP;

$ac = getAC($class, $agi, $level, $defense, $itemAC);
im also useing code from the wiki at wiki
Reply With Quote
  #2  
Old 07-16-2008, 04:56 PM
spider661
Discordant
 
Join Date: Oct 2005
Location: michigain
Posts: 260
Default

think i got the ac and hp calculations working now.. have not fully tested will let you know.. have not got mana working right yet..

btw for all to know im working on a new version of the magelo clone.. using code from the old clone.. so if the person that made the old clone is still around and has a problem with that let me know before i get it done and post it for all.. but i did not see anything saying i could not.

anyways any help on mana would be nice?
Reply With Quote
  #3  
Old 07-16-2008, 11:30 PM
spider661
Discordant
 
Join Date: Oct 2005
Location: michigain
Posts: 260
Default

well it seems the hp caculation is not working.. its fine on low lvl chars and such but when i loaded up a monk lvl 75 with 760 aa's it is like 1k off anyone know y? do monks get a hp bonus at higher lvls or something? im checking for all the aas that give hp im pritty sure.. here is my hp code.

Code:
$hp = MaxHP($class, $level, $sta, $itemHP);

function LevelFactor($class, $level){
	$multiplier = 0;
	$mlevel=$level;
	switch($class)
	{
		case '1':{
			if ($mlevel < 20)
				$multiplier = 220;
			else if ($mlevel < 30)
				$multiplier = 230;
			else if ($mlevel < 40)
				$multiplier = 250;
			else if ($mlevel < 53)
				$multiplier = 270;
			else if ($mlevel < 57)
				$multiplier = 280;
			else if ($mlevel < 60)
				$multiplier = 290;
			else if ($mlevel < 70)
				$multiplier = 300;
			else 
				$multiplier = 311;
			break;
		}
		case '6':
		case '2':
		case '10':{
			if ($mlevel < 70)
				$multiplier = 150;
			else
				$multiplier = 157;
			break;
		}
		case '16':
		case '3':
		case '5':{
			if ($mlevel < 35)
				$multiplier = 210;
			else if ($mlevel < 45)
				$multiplier = 220;
			else if ($mlevel < 51)
				$multiplier = 230;
			else if ($mlevel < 56)
				$multiplier = 240;
			else if ($mlevel < 60)
				$multiplier = 250;
			else if ($mlevel < 68)
				$multiplier = 260;
			else
				$multiplier = 270;
			break;
		}
		case '7':
		case '8':
		case '9':
		case '15':{
			if ($mlevel < 51)
				$multiplier = 180;
			else if ($mlevel < 58)
				$multiplier = 190;
			else if ($mlevel < 70)
				$multiplier = 200;
			else
				$multiplier = 210;
			break;
		}
		case '4':{
			if ($mlevel < 58)
				$multiplier = 200;
			else if ($mlevel < 70)
				$multiplier = 210;
			else
				$multiplier = 220;
			break;
		}
		case '13':
		case '12':
		case '11':
		case '14':{
			if ($mlevel < 70)
				$multiplier = 120;
			else
				$multiplier = 127;
			break;
		}
		default:{
			if ($mlevel < 35)
				$multiplier = 210;
			else if ($mlevel < 45)
				$multiplier = 220;
			else if ($mlevel < 51)
				$multiplier = 230;
			else if ($mlevel < 56)
				$multiplier = 240;
			else if ($mlevel < 60)
				$multiplier = 250;
			else
				$multiplier = 260;
			break;
		}
	}
	return $multiplier;
}

function CalcBaseHP($class, $level, $sta)
{
	$lm=LevelFactor($class, $level);
	$Post255;
	if(($sta-255)/2 > 0)
		$Post255 = ($sta-255)/2;
	else
		$Post255 = 0;
		
	$base_hp = (5)+($level*$lm/10) + ((($sta-$Post255)*$level*$lm/3000));
	return $base_hp;
}


function MaxHP($class, $level, $sta, $itemHP) {
	$nd = 10000;
	$max_hp = (CalcBaseHP($class, $level, $sta) + $itemHP);

	//The AA desc clearly says it only applies to base hp..
	//but the actual effect sent on live causes the client
	//to apply it to (basehp + itemhp).. I will oblige to the client's whims over
	//the aa description
	switch($Profile["aa_array"][107]) {
	case 1:
		$nd += 200;
		break;
	case 2:
		$nd += 500;
		break;
	case 3:
		$nd += 1000;
		break;
	}
	
	if($Profile["aa_array"][279])
	{
		$nd += 200;
	}
	$nd += 150*$Profile["aa_array"][423];
	
	if($level == 75)
	{
	$max_hp = $max_hp-1;
	}
	$max_hp = floor($max_hp * $nd / 10000);		
	
	return $max_hp;
}
Reply With Quote
  #4  
Old 07-17-2008, 02:15 AM
spider661
Discordant
 
Join Date: Oct 2005
Location: michigain
Posts: 260
Default

also i have a problem with the ac calculation on a monk anyone got any info on that? seems they get a bonus with less weight and a penalty with more.
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 08:27 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