i was bored of the standard gym so i made this one instead :)
so just replace gym.php with this
<?php
$macropage = "gym.php";
require_once "globals.php";
echo "<hr><h1> Gym </h1>";
print "<h3>Current Stats:</h3>";
$ts=$ir['strength']+$ir['agility']+$ir['guard']+$ir['labour']+$ir['IQ'];
$ir['strank']=get_rank($ir['strength'],'strength');
$ir['agirank']=get_rank($ir['agility'],'agility');
$ir['guarank']=get_rank($ir['guard'],'guard');
$ir['labrank']=get_rank($ir['labour'],'labour');
$ir['IQrank']=get_rank($ir['IQ'],'IQ');
$tsrank=get_rank($ts,'strength+agility+guard+labour+IQ');
$ir['strength']=number_format($ir['strength']);
$ir['agility']=number_format($ir['agility']);
$ir['guard']=number_format($ir['guard']);
$ir['labour']=number_format($ir['labour']);
$ir['IQ']=number_format($ir['IQ']);
$ts=number_format($ts);
print "<table><tr><td><b>Strength:</b> {$ir['strength']} [Ranked: {$ir['strank']}]</td><td><b>Agility:</b> {$ir['agility']} [Ranked: {$ir['agirank']}]</td></tr>
<tr><td><b>Guard:</b> {$ir['guard']} [Ranked: {$ir['guarank']}]</td><td><b>Labour:</b> {$ir['labour']} [Ranked: {$ir['labrank']}]</td></tr>
<tr><td><b>IQ: </b> {$ir['IQ']} [Ranked: {$ir['IQrank']}]</td><td><b>Total stats:</b> {$ts} [Ranked: $tsrank]</td></tr></table>";
($ir['hospital'] ? die("This page cannot be accessed while in hospital.") : FALSE);
$statnames = array
(
'Strength' => 'strength',
'Agility' => 'agility',
'Guard' => 'guard',
'Labour' => 'labour'
);
$_POST['amnt'] = (!empty($_POST['amnt']) && ctype_digit($_POST['amnt']) && isset($_POST['amnt']) ? abs(@intval($_POST['amnt'])) : "");
$_POST['stat'] = (!empty($_POST['stat']) && ctype_alpha($_POST['stat']) && isset($_POST['amnt']) ? htmlentities(trim($_POST['stat'])) : "");
$gymname = ($ir['jail'] ? "Jail Gym" : "Gym");
if($_POST['stat'] && $_POST['amnt'])
{
$stat = $statnames[$_POST['stat']];
(!$stat ? die("This stat cannot be trained or it does not exist") : FALSE);
if($_POST['amnt'] > $ir['energy'])
{
echo "You do not have enough energy to train that much";
}
else
{
$gain = 0;
for($i=0; $i<$_POST['amnt']; $i++)
{
$gain += mt_rand(1,3) / mt_rand(800,1000) * mt_rand(800,1000) * (($ir['will'] + 20) / 150);
$ir['will'] -= mt_rand(1,3);
($ir['will'] < 0 ? $ir['will'] = 0 : $ir['will'] = $ir['will']);
}
($ir['jail'] ? $gain /= 2 : FALSE);
$statUp = sprintf("UPDATE `userstats` SET `%s` = `%s` + %d WHERE (`userid` = %u)", $stat, $stat, abs(@intval($gain)), abs(@intval($userid)));
$do_statUp = mysql_query($statUp);
if($do_statUp === FALSE) { echo "".mysql_error().""; }
$adjUser = sprintf("UPDATE `users` SET `will` = %d, `energy` = `energy` - %d WHERE (`userid` = %u)", abs(@intval($ir['will'])), $_POST['amnt'], abs(@intval($userid)));
$do_adjUser = mysql_query($adjUser);
if($do_adjUser === FALSE) { echo "".mysql_error().""; }
$inc = abs(@intval($ir[$stat] + $gain));
$inc2 = abs(@intval($ir['energy'] - $_POST['amnt']));
if($stat == "strength")
{
printf("
You begin lifting some weights. You have gained %d strength, by doing %d sets of weights.
You now have %d strength and %d energy left. </p>", abs(@intval($gain)), $_POST['amnt'], $inc, $inc2);
$_SESSION['checked'] = 1;
}
elseif($stat == "agility")
{
printf("
You begin running on a treadmill. You have gained %d agility, by doing %d minutes of running.
You now have %d agility and %d energy left. </p>", abs(@intval($gain)), $_POST['amnt'], $inc, $inc2);
$_SESSION['checked'] = 2;
}
elseif($stat == "guard")
{
printf("
You jump into the pool, and begin swimming. You have gained %d guard, by doing %d minutes of swimming.
You now have %d guard and %d energy left. </p>", abs(@intval($gain)), $_POST['amnt'], $inc, $inc2);
$_SESSION['checked'] = 3;
}
elseif($stat == "labour")
{
printf("
You walk over to some boxes filled with gym equipment and start moving them.
You have gained %d labour, by moving %d boxes.
You now have %d labour and %d energy left. </p>", abs(@intval($gain)), $_POST['amnt'], $inc, $inc2);
$_SESSION['checked'] = 4;
}
$ir['energy'] -= $_POST['amnt'];
$ir[$stat] += $gain;
}
}
$checked1 = (($_SESSION['checked'] == 1) ? "checked='checked' />" : "/>");
$checked2 = (($_SESSION['checked'] == 2) ? "checked='checked' />" : "/>");
$checked3 = (($_SESSION['checked'] == 3) ? "checked='checked' />" : "/>");
$checked4 = (($_SESSION['checked'] == 4) ? "checked='checked' />" : "/>");
$ir['strank'] = get_rank($ir['strength'],'strength');
$ir['agirank'] = get_rank($ir['agility'],'agility');
$ir['guarank'] = get_rank($ir['guard'],'guard');
$ir['labrank'] = get_rank($ir['labour'],'labour');
echo <<<EOF2
<h3> Choose the stat you want to train and the times you would like to train it</h3>
<h3> You can train up to {$ir['energy']} times </h3>
<form action="gym.php" method="POST">
<table width=50% cellspacing=1 class='table'><tr> <td>
<input type="radio" name="stat" value="Strength" $checked1
<label for="strength"> Strength </label>
-increases your attack damage.
</td> </tr>
<tr> <td>
<input type="radio" name="stat" value="Agility" $checked2
<label for="agility"> Agility </label>
-increases your chances of hitting your opponent.
</td> </tr>
<tr> <td>
<input type="radio" name="stat" value="Guard" $checked3
<label for="guard"> Guard </label>
-reduces damage taken.
</td> </tr>
<tr> <td>
<input type="radio" name="stat" value="Labour" $checked4
<label for="labour"> Labour </label>
-allows you to upgrade jobs.
</td> </tr>
<tr> <td><label for="amnt"> Times to <span class="highlight">Train</span> </label>
<input type="text" name="amnt" value="{$ir['energy']}" />
</td> </tr>
<tr> <td>
<div align='center'> <input type='submit' value='Train' /></div>
</td> </tr>
</table>
</form>
<br />
<br />
<br />
<div align='center'><a href='crystaltemple.php?spend=refill' /><font color='black'>[Refill your energy]</font></a>
EOF2;
$h->endpage();
?>
heres a screenshot :)
[ATTACH=CONFIG]515[/ATTACH]
the colour scheme will be whatever you have in your headers :)
post what you think of it please :P