News:

Holy shit, it's 2018 2019 2020 2021 2022 2023 2024, and the US isn't a fascist country! What a time to be alive.

Main Menu

Experience Calculator

Started by Joe, January 19, 2007, 05:50:01 PM

Previous topic - Next topic

0 Members and 3 Guests are viewing this topic.

Joe

http://www.joetheodd.com/random/xp.php

I don't garauntee it to be correct, but of course I'm not coming right out and saying it'll always be wrong, either. As you'll see from my comment at the top, I don't claim full credit.

<?PHP
/*************************
* Mob Level Calculator   *
* Function from WoWWiki  *
* Wrapper by Joe[x86]    *
*************************/
?>

<HTML>
<HEAD>
<TITLE>Experience Calculator</TITLE>
</HEAD>

<BODY>
<?PHP
if (array_key_exists('charLevel', $_POST) && array_key_exists('mobLevel', $_POST))
{
echo("At level " . $_POST['charLevel'] . " you will receive " . calculateXP($_POST['charLevel'], $_POST['mobLevel'], $_POST['elite'], $_POST['rested']) .
" experience from fighting a " . $_POST['mobLevel'] . " mob (elite: " . $_POST['elite'] . ").");
}
?>
<FORM METHOD="POST" ACTION="<?PHP echo($_SERVER['PHP_SELF']); ?>">
<TABLE><TBODY>
<TR><TD>Character Level:</TD> <TD><INPUT NAME="charLevel" TYPE="text" /></TD></TR>
<TR><TD>Mob Level:</TD>       <TD><INPUT NAME="mobLevel"  TYPE="text" /></TD></TR>
<TR><TD>Elite:</TD>           <TD><INPUT NAME="elite"     TYPE="checkbox" /></TD></TR>
<INPUT TYPE="SUBMIT" NAME="Calculate Experience" />
</TBODY></TABLE>
</FORM>
</BODY>
</HTML>

<?PHP

function calculateXP($playerlevel, $moblevel, $elite, $rested = false)
{
if($playerlevel < $moblevel)
{
if($moblevel - $playerlevel > 4)
$moblevel = $playerlevel + 4;
$xp = ($playerlevel * 5 + 45) * (1 + 0.05 * ($moblevel - $playerlevel));
}
elseif($playerlevel == $moblevel)
{
$xp = $playerlevel * 5 + 45;
}
elseif($playerlevel > $moblevel)
{
if($moblevel <= calculateGrayLevel($playerlevel))
$xp = 0;
else
{
if($playerlevel >= 1 && $playerlevel <= 7)
$zd = 5;
elseif($playerlevel >= 8 && $playerlevel <= 9)
$zd = 6;
elseif($playerlevel >= 10 && $playerlevel <= 11)
$zd = 7;
elseif($playerlevel >= 12 && $playerlevel <= 15)
$zd = 8;
elseif($playerlevel >= 16 && $playerlevel <= 19)
$zd = 9;
elseif($playerlevel >= 20 && $playerlevel <= 29)
$zd = 11;
elseif($playerlevel >= 30 && $playerlevel <= 39)
$zd = 12;
elseif($playerlevel >= 40 && $playerlevel <= 44)
$zd = 13;
elseif($playerlevel >= 45 && $playerlevel <= 49)
$zd = 14;
elseif($playerlevel >= 50 && $playerlevel <= 54)
$zd = 15;
elseif($playerlevel >= 55 && $playerlevel <= 59)
$zd = 16;
elseif($playerlevel == 60)
$zd = 17;
$xp = ($playerlevel * 5 + 45) * (1 - ($playerlevel - $moblevel) / $zd);
}
}
if($elite == true)
$xp *= 2;
if($rested == true)
$xp *= 2;
return round($xp);
}

/**
function calculateGrayLevel($playerlevel)
{
if($playerlevel >= 1 && $playerlevel <= 5)
return 0;
elseif($playerlevel >= 6 && $playerlevel <= 39)
return $playerlevel - 5 - floor($playerlevel / 10);
elseif($playerlevel >= 40 && $playerlevel <= 60)
return $playerlevel - 1 - floor($playerlevel / 5);
}
function calculateDifficulty($playerlevel, $moblevel)
{
$leveldiff = $moblevel - $playerlevel;
if($moblevel <= calculateGrayLevel($playerlevel))
return 'Gray';
else
{
if($leveldiff >= 5)
return 'Red';
elseif($leveldiff >= 3 && $leveldiff <= 4)
return 'Orange';
elseif($leveldiff >= -2 && $leveldiff <= 2)
return 'Yello';
elseif($leveldiff <= -3)
return 'Green';
}
}
*/
?>
Quote from: Camel on June 09, 2009, 04:12:23 PMI'd personally do as Joe suggests

Quote from: AntiVirus on October 19, 2010, 02:36:52 PM
You might be right about that, Joe.


kalaka

Looks like a good tool. I'm getting this error though:
Fatal error: Call to undefined function calculateGrayLevel() in /home/joe/public_html/xp.php on line 49

Joe

Quote from: Camel on June 09, 2009, 04:12:23 PMI'd personally do as Joe suggests

Quote from: AntiVirus on October 19, 2010, 02:36:52 PM
You might be right about that, Joe.


warz

so, the function is from wowwiki, and the html form is yours? i dont think you can claim any credit :p
http://www.chyea.org/ - web based markup debugger

kalaka

How about you do a number of characters and number of monsters thing, which could be set all at different levels. If you do that a friend of mine could make an add-on, I think

Sidoh

It would be a trivial task (in php, lua (wow addon), javascript, whatever).  I'm pretty sure all of the equations are on wowwiki.

Joe

Quote from: warz on January 28, 2007, 07:31:46 PM
so, the function is from wowwiki, and the html form is yours? i dont think you can claim any credit :p

I had to write PHP to make sure it called the function correctly! :P
Quote from: Camel on June 09, 2009, 04:12:23 PMI'd personally do as Joe suggests

Quote from: AntiVirus on October 19, 2010, 02:36:52 PM
You might be right about that, Joe.


ZeroX

QuoteAt level 1 you will receive 120 experience from fighting a 60 mob (elite: on).

How do you figure that?
Zeroforce
Zeroforce
Zeroforce





Quotemutsumibear: David's coming over Sunday so we can have mad sex all day.
zxdropoff: lucky you
mutsumibear: :D I know.
mutsumibear: I just pray I don't start my period before then.
zxdropoff: omfg
zxdropoff: stfu
zxdropoff: now please
mutsumibear: HAHA
mutsumibear: I love disturbing you.

Blaze

Quote from: ZeroX on February 07, 2007, 12:11:18 AM
QuoteAt level 1 you will receive 120 experience from fighting a 60 mob (elite: on).

How do you figure that?

At level 1 you will receive 120 experience from fighting a 70 mob (elite: on).
And like a fool I believed myself, and thought I was somebody else...

Joe

Yeah. You don't get any more benefit from killing a 70 elite than you would a level 6 elite, if you're level 1. Blizzard got tired of you damn power-levelers and reflected it in their algorithm (read the code).

I assure you they actually did that. If you can find a way to aggro a level 60 mob at level 1, tap it, and then have a buddy kill it (without you dying in the process), I assure you that it will give you 120 experience.
Quote from: Camel on June 09, 2009, 04:12:23 PMI'd personally do as Joe suggests

Quote from: AntiVirus on October 19, 2010, 02:36:52 PM
You might be right about that, Joe.


Omen

Run with a priest and get shielded when they come near you so there might be a chance he catches the aggo.
- Omen of The Order
- Priest of Dark Elements

Krazed

Any ranged magic creature. Greater Fire/Shadow/Frost/Nature protection potion ftw.
It is good to be good, but it is better to be lucky.

Joe

Quote from: Krazed on February 08, 2007, 09:15:39 AM
Any ranged magic creature. Greater Fire/Shadow/Frost/Nature protection potion ftw.

Requires level 45.

Quote from: Omen on February 08, 2007, 08:54:20 AM
Run with a priest and get shielded when they come near you so there might be a chance he catches the aggo.

Any level 60 elite could bash through Power Word: Shield rank 1 easily. Each rank has a minimum target level.
Quote from: Camel on June 09, 2009, 04:12:23 PMI'd personally do as Joe suggests

Quote from: AntiVirus on October 19, 2010, 02:36:52 PM
You might be right about that, Joe.


ZeroX

#13
Quote from: Joex86] link=topic=8444.msg109119#msg109119 date=1171663071]
Quote from: Krazed on February 08, 2007, 09:15:39 AM
Any ranged magic creature. Greater Fire/Shadow/Frost/Nature protection potion ftw.

Requires level 45.

Quote from: Omen on February 08, 2007, 08:54:20 AM
Run with a priest and get shielded when they come near you so there might be a chance he catches the aggo.

Any level 60 elite could bash through Power Word: Shield rank 1 easily. Each rank has a minimum target level.

Roll a mage. Get a warlock to summon you to like the tainted scar or something. Run close to a 60 elite mob and then hit it with your rank 1 bullshit that you get. As he runs towards you have a warrior Charge the dude and there you go you taped him =].
Zeroforce
Zeroforce
Zeroforce





Quotemutsumibear: David's coming over Sunday so we can have mad sex all day.
zxdropoff: lucky you
mutsumibear: :D I know.
mutsumibear: I just pray I don't start my period before then.
zxdropoff: omfg
zxdropoff: stfu
zxdropoff: now please
mutsumibear: HAHA
mutsumibear: I love disturbing you.

Joe

A level 1 mage would aggro the entire tainted scar from Nethergarde Keep, lol.

By the way, you totally fux0vered your quote. I fixed it for you.
Quote from: Camel on June 09, 2009, 04:12:23 PMI'd personally do as Joe suggests

Quote from: AntiVirus on October 19, 2010, 02:36:52 PM
You might be right about that, Joe.