'strength',
'Agility' => 'agility',
'Guard' => 'guard',
'Labour' => 'labour');
$_POST['amnt']=abs((int) $_POST['amnt']);
if($ir['validated'] == 0)
{
die("
You need to go validate.Please Click Here To Validate");
}
if(!$ir['jail'])
{
print "Gym
";
}
else
{
print "Prison Gym
";
}
if($_POST['stat'] && $_POST['amnt'])
{
$stat=$statnames[$_POST['stat']];
if(!$stat)
{
die("This stat cannot be trained.");
}
if($_POST['amnt'] > $ir['energy'])
{
print("You do not have enough energy to train that much.
");
}
else
{
$gain=0;
for($i=0; $i<$_POST['amnt']; $i++)
{
$gain+=round(rand(1,3)/rand(800,1000)*rand(800,1000)*(($ir['will']+20)/450));
$ir['will']-=rand(1,4);
if($ir['will'] < 0) { $ir['will']=0; }
}
if($ir['jail']) { $gain/=2; }
$db->query("UPDATE `userstats` SET `{$stat}` = `{$stat}` + $gain WHERE `userid` = $userid");
$db->query("UPDATE `users` SET `will` = {$ir['will']}, energy = energy - {$_POST['amnt']} WHERE `userid` = $userid");
$inc=$ir[$stat]+$gain;
$inc2=$ir['energy']-$_POST['amnt'];
if($stat=="strength")
{
print "You begin lifting some weights.
You have gained {$gain} strength by doing {$_POST['amnt']} sets of weights.
You now have {$inc} strength and {$inc2} energy left.";
}
elseif($stat=="agility")
{
print "You begin running on a treadmill.
You have gained {$gain} agility by doing {$_POST['amnt']} minutes of running.
You now have {$inc} agility and {$inc2} energy left.";
}
elseif($stat=="guard")
{
print "You jump into the pool and begin swimming.
You have gained {$gain} guard by doing {$_POST['amnt']} minutes of swimming.
You now have {$inc} guard and {$inc2} energy left.";
}
elseif($stat=="labour")
{
print "You walk over to some boxes filled with gym equipment and start moving them.
You have gained {$gain} labour by moving {$_POST['amnt']} boxes.
You now have {$inc} labour and {$inc2} energy left.";
}
print "
";
$ir['energy']-=$_POST['amnt'];
$ir[$stat]+=$gain;
}
}
$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');
print "Choose the stat you want to train and the times you want to train it.
You can train up to {$ir['energy']} times.
";
$h->endpage();
?>