View Full Version : Yet another Stats/Level Hack
Knoman
Mon 29th Oct '01, 10:58pm
After my rantings in the other thread about people posting my codes, I've decided to forget everything that happen and post my version of the EXP/HP/MP hack. Most people will not need this hack because it will only apply to gaming forums; specifically RPG forums.
This hack works in such a way that:
HP drops and rises according to the members activeness.
MP determins how long a user has been with the forums, and how active they are.
EXP determins how close a user is to reaching the next level.
The files you need to edit is
showthread.php for version 2.0.2 and under
or
/admin/functions.php for version 2.0.3
Find the code
if ($post['receivepm'] and $enablepms==1) {
eval("\$post[pmlink] = \"".gettemplate("postbit_sendpm")."\";");
} else {
$post[pmlink] = "";
}
**I haven't used version 2.0.2 in quite a while... but I'm sure the code looks similar to that**
and under it, put in this code:
$level = pow (log10 ($post[posts]), 3);
$ep = floor (100 * ($level - floor ($level)));
$showlevel = floor ($level + 1);
$hpmulti =round ($postsperday / 6, 1);
if ($hpmulti > 1.5) {
$hpmulti = 1.5;
}
if ($hpmulti < 1) {
$hpmulti = 1;
}
$maxhp = $level * 25 * $hpmulti;
$hp= $postsperday / 10;
if ($hp >= 1) {
$hp= $maxhp;
} else {
$hp= floor ($hp * $maxhp);
}
$hp= floor ($hp);
$maxhp= floor ($maxhp);
if ($maxhp <= 0) {
$zhp = 1;
} else {
$zhp = $maxhp;
}
$hpf= floor (100 * ($hp / $zhp)) - 1;
$maxmp= ($jointime * $level) / 5;
$mp= $post[posts] / 3;
if ($mp >= $maxmp) {
$mp = $maxmp;
}
$maxmp = floor ($maxmp);
$mp = floor ($mp);
if ($maxmp <= 0) {
$zmp = 1;
} else {
$zmp = $maxmp;
}
$mpf= floor (100 * ($mp / $zmp)) - 1;
Now, you see where it says:
$hp= $postsperday / 10;
Well, for my forums, if a user fails to achieve at least 10 posts per day, the hp starts to drop. You can change that code to anything you like.
now go to www.allsquare.net/avalon/bar and download all the images there.
place them in /forums/images/bar
sorry, but i'm too lazy to zip :D
Now, get into the CP and open up the postbits template.
Find:
$post[avatar]<p>
<smallfont>
put this under it:
<br>
<p> <b>Level: $showlevel<br>
Member ID: $post[userid]</b><br>
HP: $hp / $maxhp
<table width="100" border="1" cellspacing="0" cellpadding="0" bordercolor="#000000">
<tr>
<td bgcolor="#9999FF"><img src="images/bar/bhg.gif" width="$hpf%" height="9"><img src="images/bar/bhb.gif" width="1" height="9"></td>
</tr>
</table>
MP: $mp / $maxmp
<table width="100" border="1" cellspacing="0" cellpadding="0" bordercolor="#000000">
<tr>
<td bgcolor="#9999FF"><img src="images/bar/bmg.gif" width="$mpf%" height="9"><img src="images/bar/bmb.gif" width="1" height="9"></td>
</tr>
</table>
Exp: $ep%
<table width="100" border="1" cellspacing="0" cellpadding="0" bordercolor="#000000">
<tr>
<td bgcolor="#9999FF"><img src="images/bar/bxg.gif" width="$ep%" height="9"><img src="images/bar/bxb.gif" width="1" height="9"></td>
</tr>
Now, I've played a lot with my postbit templates... so you might experience some cosmetic abnormalities... just use your html abilities to fix it. :)
UOSaint
Mon 29th Oct '01, 11:34pm
Nice Hack!
Thanks for sharing.
UOSaint
Mon 29th Oct '01, 11:44pm
I don't seems to be able to see the Exp calculations included
and do I need to include the level too?
Pls help.
neogeniseva
Tue 30th Oct '01, 12:03am
im not worthy, im not worthy, im scum, i suck,
i own a role playing forum, thank you so much this will really help me out;)
thanks again for this, here is the zip file i made for it, with the images.
Knoman
Tue 30th Oct '01, 12:18am
UOSaint, the EXP would be calculated in the variable $EP. And yes, you need to use my levels code because all the other parts requires the $levels variable.
Edit:
but if you mean that if you should add each and every level in by hand, no you shouldn't. This code should create the levels automatically.
$level*=*pow*(log10*($post[posts]),*3);
UOSaint
Tue 30th Oct '01, 12:23am
cool thanks
Team36
Tue 30th Oct '01, 12:41am
Written by Dunny, moded by NanoEntity, idea by square forums.
// ##################### L E V E L S #####################
$level = "";
$level13 = '48';
$level12 = '44';
$level11 = '40';
$level10 = '36';
$level9 = '32';
$level8 = '28';
$level7 = '24';
$level6 = '20';
$level5 = '16';
$level4 = '12';
$level3 = '8';
$level2 = '4';
$level1 = '1';
if ($post[posts] > 500) {
$level .= $level13;
}
elseif ($post[posts] > 430) {
$level .= $level12;
}
elseif ($post[posts] > 390) {
$level .= $level11;
}
elseif ($post[posts] > 330) {
$level .= $level10;
}
elseif ($post[posts] > 280) {
$level .= $level9;
}
elseif ($post[posts] > 250) {
$level .= $level8;
}
elseif ($post[posts] > 190) {
$level .= $level7;
}
elseif ($post[posts] > 150) {
$level .= $level6;
}
elseif ($post[posts] > 100) {
$level .= $level5;
}
elseif ($post[posts] > 70) {
$level .= $level4;
}
elseif ($post[posts] > 30) {
$level .= $level3;
}
elseif ($post[posts] > 10) {
$level .= $level2;
}
else // ($post[posts] > 0)
{ $level .= $level1; }
$exp10 = $DB_site->query_first("SELECT SUM(views) AS views FROM thread WHERE postuserid='$userinfo[userid]' AND open!='10'");
//SET MP LEVEL
$maxmp= ($exp10[views] * $level) / 20;
$mp= $post[posts] / 3;
if ($mp >= $maxmp) {
$mp = $maxmp;
}
$maxmp = floor ($maxmp);
$maxmp2= ($exp10[views] * $level) / 7;
$mp2= $post[posts] / 3;
if ($mp2 >= $maxmp2) {
$mp2 = $maxmp2;
}
$maxmp2 = floor ($maxmp2);
//SET HP LEVEL
$hp= $post[posts] / 5;
$hp = floor ($hp);
$hp2= $post[posts] / 2;
$hp2 = floor ($hp2);
//SET EXP LEVEL
$exp= ($mp * $hp) / 100;
$exp = floor ($exp);
$exp2= ($mp2 * $hp2) / 60;
$exp2 = floor ($exp2);
if ($exp10 == ""):
$exp10 = "0";
endif;
Knoman
Tue 30th Oct '01, 12:49am
Yes, we've all seen that code before. But the problem with that is that you have to type in every levels by hand and also, the EXP will eventually surpass 100%
I've made mines so that when the exp reaches 100%, you would "level up" and the EXP starts all over.
Edit: Also in my version, I've included an HP bonus multiplyer for those who greatly exceeds the 10 post per day average. This way, it's impossible for people with the same level to get the same stats
Team36
Tue 30th Oct '01, 1:00am
I dont know how this code got out, I havent posted it anywhere, anyhow I just had to post it, I will do a mod to your code, your is well written, I just didnt think, was going for that admin could set its own vars the way he/she wants them displayed.
Was thinking about costum administration.
same thing with my stars hack, its edited by hand for full control, and well sames a hell of a time when upgrading to new version of the forum.
make stars.php
insert and call it by where ever you want it, include('./stars.php'); in any .php file
<?php
// ################################################## #####
// #
// # NanoEntity
// #
// # Stars Hack
// # Version: 2.0.1
// #
// # ©Copyright 2001 HOLOLITH.COM.
// # Created: 10/07/2001
// #
// ################################################## #####
// #
// # COPYRIGHT NOTICE:
// #
// # Copyright 2001 HOLOLITH.COM, All Rights Reserved.
// #
// # Selling the code for this script
// # without prior written consent is
// # expressly forbidden. In all cases
// # copyright and header must remain intact.
// #
// ################################################## #####
unset($stars);
// ##################### S T A R S G I F #####################
// Stars Mod
$rankstarmod1 = '<img src="{imagesfolder}/titles/star.gif"><img src="{imagesfolder}/titles/star.gif"><img src="{imagesfolder}/titles/star.gif"><img src="{imagesfolder}/titles/star.gif"><img src="{imagesfolder}/titles/star.gif"><img src="{imagesfolder}/titles/star.gif"><img src="{imagesfolder}/titles/star.gif"><img src="{imagesfolder}/titles/star.gif"><img src="{imagesfolder}/titles/star.gif"><img src="{imagesfolder}/titles/star.gif"><img src="{imagesfolder}/titles/star.gif"><img src="{imagesfolder}/titles/star.gif"><img src="{imagesfolder}/titles/star.gif"><P>';
// Stars Super Mod
$rankstarsmod1 = '<img src="{imagesfolder}/titles/star.gif"><img src="{imagesfolder}/titles/star.gif"><img src="{imagesfolder}/titles/star.gif"><img src="{imagesfolder}/titles/star.gif"><img src="{imagesfolder}/titles/star.gif"><img src="{imagesfolder}/titles/star.gif"><img src="{imagesfolder}/titles/star.gif"><img src="{imagesfolder}/titles/star.gif"><img src="{imagesfolder}/titles/star.gif"><img src="{imagesfolder}/titles/star.gif"><img src="{imagesfolder}/titles/star.gif"><img src="{imagesfolder}/titles/star.gif"><img src="{imagesfolder}/titles/star.gif"><P>';
// Stars Admin
$rankstaradmin1 = '<img src="{imagesfolder}/titles/star.gif"><img src="{imagesfolder}/titles/star.gif"><img src="{imagesfolder}/titles/star.gif"><img src="{imagesfolder}/titles/star.gif"><img src="{imagesfolder}/titles/star.gif"><img src="{imagesfolder}/titles/star.gif"><img src="{imagesfolder}/titles/star.gif"><img src="{imagesfolder}/titles/star.gif"><img src="{imagesfolder}/titles/star.gif"><img src="{imagesfolder}/titles/star.gif"><img src="{imagesfolder}/titles/star.gif"><img src="{imagesfolder}/titles/star.gif"><img src="{imagesfolder}/titles/star.gif"><img src="{imagesfolder}/titles/star.gif"><P>';
// Stars Everyone Else
$rankstarelse1 = '<img src="{imagesfolder}/titles/star.gif"><P>';
$rankstarelse2 = '<img src="{imagesfolder}/titles/star.gif"><img src="{imagesfolder}/titles/star.gif"><P>';
$rankstarelse3 = '<img src="{imagesfolder}/titles/star.gif"><img src="{imagesfolder}/titles/star.gif"><img src="{imagesfolder}/titles/star.gif"><P>';
$rankstarelse4 = '<img src="{imagesfolder}/titles/star.gif"><img src="{imagesfolder}/titles/star.gif"><img src="{imagesfolder}/titles/star.gif"><img src="{imagesfolder}/titles/star.gif"><P>';
$rankstarelse5 = '<img src="{imagesfolder}/titles/star.gif"><img src="{imagesfolder}/titles/star.gif"><img src="{imagesfolder}/titles/star.gif"><img src="{imagesfolder}/titles/star.gif"><img src="{imagesfolder}/titles/star.gif"><P>';
$rankstarelse6 = '<img src="{imagesfolder}/titles/star.gif"><img src="{imagesfolder}/titles/star.gif"><img src="{imagesfolder}/titles/star.gif"><img src="{imagesfolder}/titles/star.gif"><img src="{imagesfolder}/titles/star.gif"><img src="{imagesfolder}/titles/star.gif"><P>';
$rankstarelse7 = '<img src="{imagesfolder}/titles/star.gif"><img src="{imagesfolder}/titles/star.gif"><img src="{imagesfolder}/titles/star.gif"><img src="{imagesfolder}/titles/star.gif"><img src="{imagesfolder}/titles/star.gif"><img src="{imagesfolder}/titles/star.gif"><img src="{imagesfolder}/titles/star.gif"><P>';
$rankstarelse8 = '<img src="{imagesfolder}/titles/star.gif"><img src="{imagesfolder}/titles/star.gif"><img src="{imagesfolder}/titles/star.gif"><img src="{imagesfolder}/titles/star.gif"><img src="{imagesfolder}/titles/star.gif"><img src="{imagesfolder}/titles/star.gif"><img src="{imagesfolder}/titles/star.gif"><img src="{imagesfolder}/titles/star.gif"><P>';
$rankstarelse9 = '<img src="{imagesfolder}/titles/star.gif"><img src="{imagesfolder}/titles/star.gif"><img src="{imagesfolder}/titles/star.gif"><img src="{imagesfolder}/titles/star.gif"><img src="{imagesfolder}/titles/star.gif"><img src="{imagesfolder}/titles/star.gif"><img src="{imagesfolder}/titles/star.gif"><img src="{imagesfolder}/titles/star.gif"><img src="{imagesfolder}/titles/star.gif"><P>';
$rankstarelse10 = '<img src="{imagesfolder}/titles/star.gif"><img src="{imagesfolder}/titles/star.gif"><img src="{imagesfolder}/titles/star.gif"><img src="{imagesfolder}/titles/star.gif"><img src="{imagesfolder}/titles/star.gif"><img src="{imagesfolder}/titles/star.gif"><img src="{imagesfolder}/titles/star.gif"><img src="{imagesfolder}/titles/star.gif"><img src="{imagesfolder}/titles/star.gif"><img src="{imagesfolder}/titles/star.gif"><P>';
$rankstarelse11 = '<img src="{imagesfolder}/titles/star.gif"><img src="{imagesfolder}/titles/star.gif"><img src="{imagesfolder}/titles/star.gif"><img src="{imagesfolder}/titles/star.gif"><img src="{imagesfolder}/titles/star.gif"><img src="{imagesfolder}/titles/star.gif"><img src="{imagesfolder}/titles/star.gif"><img src="{imagesfolder}/titles/star.gif"><img src="{imagesfolder}/titles/star.gif"><img src="{imagesfolder}/titles/star.gif"><img src="{imagesfolder}/titles/star.gif"><P>';
$rankstarelse12 = '<img src="{imagesfolder}/titles/star.gif"><img src="{imagesfolder}/titles/star.gif"><img src="{imagesfolder}/titles/star.gif"><img src="{imagesfolder}/titles/star.gif"><img src="{imagesfolder}/titles/star.gif"><img src="{imagesfolder}/titles/star.gif"><img src="{imagesfolder}/titles/star.gif"><img src="{imagesfolder}/titles/star.gif"><img src="{imagesfolder}/titles/star.gif"><img src="{imagesfolder}/titles/star.gif"><img src="{imagesfolder}/titles/star.gif"><img src="{imagesfolder}/titles/star.gif"><P>';
$rankstarelse13 = '<img src="{imagesfolder}/titles/star.gif"><img src="{imagesfolder}/titles/star.gif"><img src="{imagesfolder}/titles/star.gif"><img src="{imagesfolder}/titles/star.gif"><img src="{imagesfolder}/titles/star.gif"><img src="{imagesfolder}/titles/star.gif"><img src="{imagesfolder}/titles/star.gif"><img src="{imagesfolder}/titles/star.gif"><img src="{imagesfolder}/titles/star.gif"><img src="{imagesfolder}/titles/star.gif"><img src="{imagesfolder}/titles/star.gif"><img src="{imagesfolder}/titles/star.gif"><img src="{imagesfolder}/titles/star.gif"><P>';
// ##################### S T A R S G I F #####################
// ##################### S T A R S A L L #####################
if ($post[usergroupid]==7) {
$stars .= $rankstarmod1;
}
elseif ($post[usergroupid]==5) {
$stars .= $rankstarsmod1;
}
elseif ($post[usergroupid]==6) {
$stars .= $rankstaradmin1;
}
elseif ($post[posts] > 500) {
$stars .= $rankstarelse13;
}
elseif ($post[posts] > 430) {
$stars .= $rankstarelse12;
}
elseif ($post[posts] > 390) {
$stars .= $rankstarelse11;
}
elseif ($post[posts] > 330) {
$stars .= $rankstarelse10;
}
elseif ($post[posts] > 280) {
$stars .= $rankstarelse9;
}
elseif ($post[posts] > 250) {
$stars .= $rankstarelse8;
}
elseif ($post[posts] > 190) {
$stars .= $rankstarelse7;
}
elseif ($post[posts] > 150) {
$stars .= $rankstarelse6;
}
elseif ($post[posts] > 100) {
$stars .= $rankstarelse5;
}
elseif ($post[posts] > 70) {
$stars .= $rankstarelse4;
}
elseif ($post[posts] > 30) {
$stars .= $rankstarelse3;
}
elseif ($post[posts] > 10) {
$stars .= $rankstarelse2;
}
elseif ($post[posts] > 0) {
$stars .= $rankstarelse1;
}
// ##################### S T A R S A L L #####################
if (!$stars)
$stars = '<br>';
else
$stars .= '';
// ##################### L E V E L S #####################
$level = "";
$level13 = '48';
$level12 = '44';
$level11 = '40';
$level10 = '36';
$level9 = '32';
$level8 = '28';
$level7 = '24';
$level6 = '20';
$level5 = '16';
$level4 = '12';
$level3 = '8';
$level2 = '4';
$level1 = '1';
if ($post[posts] > 500) {
$level .= $level13;
}
elseif ($post[posts] > 430) {
$level .= $level12;
}
elseif ($post[posts] > 390) {
$level .= $level11;
}
elseif ($post[posts] > 330) {
$level .= $level10;
}
elseif ($post[posts] > 280) {
$level .= $level9;
}
elseif ($post[posts] > 250) {
$level .= $level8;
}
elseif ($post[posts] > 190) {
$level .= $level7;
}
elseif ($post[posts] > 150) {
$level .= $level6;
}
elseif ($post[posts] > 100) {
$level .= $level5;
}
elseif ($post[posts] > 70) {
$level .= $level4;
}
elseif ($post[posts] > 30) {
$level .= $level3;
}
elseif ($post[posts] > 10) {
$level .= $level2;
}
else // ($post[posts] > 0)
{ $level .= $level1; }
$exp10 = $DB_site->query_first("SELECT SUM(views) AS views FROM thread WHERE postuserid='$userinfo[userid]' AND open!='10'");
//SET MP LEVEL
$maxmp= ($exp10[views] * $level) / 20;
$mp= $post[posts] / 3;
if ($mp >= $maxmp) {
$mp = $maxmp;
}
$maxmp = floor ($maxmp);
$maxmp2= ($exp10[views] * $level) / 7;
$mp2= $post[posts] / 3;
if ($mp2 >= $maxmp2) {
$mp2 = $maxmp2;
}
$maxmp2 = floor ($maxmp2);
//SET HP LEVEL
$hp= $post[posts] / 5;
$hp = floor ($hp);
$hp2= $post[posts] / 2;
$hp2 = floor ($hp2);
//SET EXP LEVEL
$exp= ($mp * $hp) / 100;
$exp = floor ($exp);
$exp2= ($mp2 * $hp2) / 60;
$exp2 = floor ($exp2);
if ($exp10 == ""):
$exp10 = "0";
endif;
?>
Knoman
Tue 30th Oct '01, 1:11am
modify the code as much as you want.
i never added in a custom admin or cutom mod stats
because i treat all my members the same way.
the reason why i'm willing to give up my hack is
because i'm currently expanding it myself.
soon, people will be able to use their mp to "heal"
themselves and other members. afterwards, i'm
creating a money system where members are
awarded cash for allowances and for completing
quests. this money can be used to buy upgrades
in amor and weapons in the local shops in the Role
Playing Forums.
UOSaint
Tue 30th Oct '01, 1:25am
Originally posted by Knoman
the reason why i'm willing to give up my hack is
because i'm currently expanding it myself.
soon, people will be able to use their mp to "heal"
themselves and other members.
Can you share just the healing code pls?
Knoman
Tue 30th Oct '01, 1:33am
nope :p
i'm keeping my RPG forums one step above the rest
Dakota
Tue 30th Oct '01, 1:59am
This is great, but you may want to add a
</table>
to the end of the postbits template part other wise you will have really screwed up frames.
Knoman
Tue 30th Oct '01, 2:15am
:P
Now, I've played a lot with my postbit templates... so you might experience some cosmetic abnormalities... just use your html abilities to fix it.
Mega
Tue 30th Oct '01, 3:15am
Damn..
That MAxHP thingy is some code..
Never could have guessed that ! :D
Team37
Tue 30th Oct '01, 9:38am
Cool, care to shair it with me, i have some cool hacks too that are not released to public, : )
Email me sometime webmaster@hololith.com
DNS move, server might be down for 2 days till mail works.
Originally posted by Knoman
modify the code as much as you want.
i never added in a custom admin or cutom mod stats
because i treat all my members the same way.
the reason why i'm willing to give up my hack is
because i'm currently expanding it myself.
soon, people will be able to use their mp to "heal"
themselves and other members. afterwards, i'm
creating a money system where members are
awarded cash for allowances and for completing
quests. this money can be used to buy upgrades
in amor and weapons in the local shops in the Role
Playing Forums.
merltock
Tue 30th Oct '01, 11:12am
Thanks alot for the code avalon/knoman...:D
merltock
Tue 30th Oct '01, 12:33pm
I've made a complete zip version of this hack, for 2.0.3. :)
neogeniseva
Tue 30th Oct '01, 1:10pm
did you see the zip version i made on the first page;)
neogeniseva
Tue 30th Oct '01, 1:48pm
hey i was think for this hack, since i run on a role playing that there could be a stats under the levels, it would be a small pop up and would contain strength, magic power, speed, evade, stamana, hit rating, you know things like that. i think it would be a nice add to it
vBulletin® v3.8.0 Beta 4, Copyright ©2000-2008, Jelsoft Enterprises Ltd.