Big code, with open </div> <div style='blah'> ta
Posted: Mon Dec 18, 2006 10:25 pm
Subject, not too great eh? what can I say its a large description o_O
ok dont say I haven't tried because i've gone through this code atleast 40 times, i've used HTML editor, PHP editor search and find things, yet I cant seem to get it WORKING, soon as I click the button 'attack' all my
buttons from dex, int, foc, def, last fight, and attack itself all get really large spacing between them, I know what causes it, either having a <div style='position: absolute; top:x; left:x;'> tag that isnt closed with </div> (and it encounters another <div style> tag before being closed, Messing everything up)
Now, I swear theres nothing wrong
I've counted, I have 8 total </div> tags and only 6 </div> tags, but if I remove the last 2 </div> tags it goes WAY off the screen when I click attack
BTW is there any other cause of this problem?
I know probably NO one will help me:/ but I gotta try -.-
btw some <div style> tags can go a while...
this file is included from my main one 'indexg.php'
perhaps it would be best for me to post the actual php docs
<<Problem area below I think>>
large eh? if I remove baddy (6) or (7) but leave one of them, it stays how it currently is (which is bad), but if I remove both it MESSES up badly
I've gone through my code, line by line, slowly, hoping, yet I cant seem to find the problem...
I no for fact no one will go through this but o well
heres the 1307 line code o_O woo
oh Lord God help me lolz
ok dont say I haven't tried because i've gone through this code atleast 40 times, i've used HTML editor, PHP editor search and find things, yet I cant seem to get it WORKING, soon as I click the button 'attack' all my
buttons from dex, int, foc, def, last fight, and attack itself all get really large spacing between them, I know what causes it, either having a <div style='position: absolute; top:x; left:x;'> tag that isnt closed with </div> (and it encounters another <div style> tag before being closed, Messing everything up)
Now, I swear theres nothing wrong
I've counted, I have 8 total </div> tags and only 6 </div> tags, but if I remove the last 2 </div> tags it goes WAY off the screen when I click attack
BTW is there any other cause of this problem?
I know probably NO one will help me:/ but I gotta try -.-
btw some <div style> tags can go a while...
this file is included from my main one 'indexg.php'
perhaps it would be best for me to post the actual php docs
<<Problem area below I think>>
Code: Select all
if ($_POST['attack']=='attk') //attk1
{
?>
<div style='Position: absolute; top: 200; left: 325;'>
<?php
if ($phd==false)//phd1
{
?>
<table border='3' width='325'>
<tr>
<td align='center'>
<?php
$con = mysql_connect("localhost","root","");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
mysql_select_db("chars", $con);
$result = mysql_query("SELECT * FROM chars");
$row = mysql_fetch_array($result);
$currmonster=$row['currmonster'];
mysql_close($con);
$currmonster=$currmonster+1;
echo '<b>Level '.$currmonster.' '. $mon1[$currmonster-1].'</b><br />';
echo '<b>You attack a '.$mon1[$currmonster-1]. ':</b><br />';
$currmonster=$currmonster-1;
/////////////////////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////////////////////
///////////Below is loading monster string and text for dmg and so on
/////////////////////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////////////////////
$sa=true;
$mlmon=$currmonster+1;
$strlvlmon=$mlmon * 4;
$strdmgmon=$strlvlmon / 4;
$strdmgmon=rand(0, $strdmgmon * 1.3);
$strdmgmon=round($strdmgmon);
//strength
$dexlvlmon=$mlmon * 5;
$dexcthmon=rand($dexlvlmon - $dexlvl, 100);
//$dexcthmon=$dexcthmon/100;
$_SESSION['lc']=$currlifemon;//$_SESSION['lc']+$currlifemon;
//dexterity
$currlifemon=$mlmon * 13;
$_SESSSION['lc2']=$currmaxlifemon;//$_SESSION['lc2']+$currlifemon;
$currmaxlifemon=$mlmon * 13;
$currlifemon=$_SESSION['lc'];
//life
$deflvlmon=$mlmon * 3;
//defense
$defdamon=$mlmon * $deflvlmon;
$defdamon=$defdamon/15;
//int
$intlvlmon=$mlmon * 4;
//focus
$foclvlmon=$mlmon * 4;
//mag
$magmon=$mlmon * 9;
$magmaxmon=$mlmon * 9;
$con = mysql_connect("localhost","root","");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
mysql_select_db("chars", $con);
{mysql_query("UPDATE chars SET currmonster = $currmonster
");}
mysql_close($con);
$con = mysql_connect("localhost","root","");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
mysql_select_db("monsters", $con);
{mysql_query("UPDATE m_l SET currlifemon = $currmaxlifemon
");}
mysql_query("UPDATE chars SET mlmon = $mlmon
");
mysql_query("UPDATE chars SET strlvlmon = $strlvlmon
");
mysql_query("UPDATE chars SET strdmgmon = $strdmgmon
");
mysql_query("UPDATE chars SET dexlvlmon = $dexlvlmon
");
mysql_query("UPDATE chars SET dexcthmon = $dexcthmon
");
mysql_query("UPDATE chars SET currlifemon = $currlifemon
");
mysql_query("UPDATE chars SET currmaxlifemon = $currmaxlifemon
");
mysql_query("UPDATE chars SET deflvlmon = $deflvlmon
");
mysql_query("UPDATE chars SET defdamon = $defdamon
");
mysql_query("UPDATE chars SET intlvlmon = $intlvlmon
");
mysql_query("UPDATE chars SET foclvlmon = $foclvlmon
");
mysql_query("UPDATE chars SET magmon = $magmon
");
mysql_query("UPDATE chars SET magmaxmon = $magmaxmon
");
mysql_query("UPDATE chars SET currlife = $currlife
");
/*
echo $br;
echo $dexcthmon.' dexcthmon';
echo $br;
echo $dexcth.' dexcth';
echo $br;
echo $mlmon.'ML';
echo $br;
echo $dexlvlmon.'dex';
echo $br;
echo $strlvlmon.'str';
echo $br;
echo $deflvlmon.'def';
echo $br;
echo $intlvlmon.'int';
echo $br;
echo $foclvlmon.'foc';
echo $br;
*/
if ($dexcth > $dexcthmon)
{
echo "You attack with your ".$weapon." and hit for ".$strdmg." damage";
$currlifemon=$currlifemon-$strdmg;
}
else
{
echo "You attack with your ".$weapon." and you miss"; $strdmg=0;
}
echo '<br /> Current Life is '.$currlifemon. '<br />';
if ($dexcthmon > $dexcth)
{ //a4
echo '<b>'.$mon1[$currmonster]. "</b> attacks you and hits you for ".$strdmgmon; //later add .dmg
$currlife=$currlife-$strdmgmon;
}
else
{
echo '<b>'.$mon1[$currmonster]. "</b> attacks you and misses"; $strdmgmon=0;
}
}
?>
</td>
</tr>
</table>
</font>
<?php
/////////////////////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////////////////////
///////////Levels and XP below////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////////////////////
if ($phd==false)//phd 12
{
// damage delt (to increase XP) below MUST stay at bottom
if ($tstr==true)
{
$strxp=$strxp+$strdmg;
}
if ($tdex==true)
{
$dexxp=$dexxp+$strdmg;
}
if ($tdef==true)
{
$defxp=$defxp+$strdmg;
}
if ($tint==true)
{
$intxp=$intxp+$strdmg;
}
if ($tfoc==true)
{
$focxp=$focxp+$strdmg;
}
// damage delt (to increase XP) above MUST STAY huh
//XP check below
if ($strxp>=$strlvl * $strdiv * $strlvl)
{
$strlvl=$strlvl+1;
$strdiv=$strdiv+1;
}
if ($dexxp>=$dexlvl * $dexdiv * $dexlvl)
{
$dexlvl=$dexlvl+1;
$dexdiv=$dexdiv+1;
}
if ($defxp>=$deflvl * $defdiv * $deflvl)
{
$deflvl=$deflvl+1;
$defdiv=$defdiv+1;
}
if ($intxp>=$intlvl * $intdiv * $intlvl)
{
$intlvl=$intlvl+1;
$intdiv=$intdiv+1;
}
if ($focxp>=$foclvl * $focdiv * $foclvl)
{
$foclvl=$foclvl+1;
$focdiv=$focdiv+1;
}
}//attk2 // I think it may be PHD2 //phd13 I think
if ($currlife < 1)
{
?>
</div>
<DIV STYLE='Position: absolute; Top: 200; Left: 325;'>
<?php
echo '<table border=\'3\' width=\'325\'> <tr> <td align="center"><b><font color=\'maroon\'>You are dead</font></b></td></tr></table>';
$phd=true;
?>
</div>
<?php
}//currlife from just above
?>
</div><!--///////////////////////////////////POSSIBLE BADDY (6)</div>-->
<?php
}//attk4
?><!--/////////////////////////////////////POSSIBLE BADDY (7) </div> they seem to be work 6,7-->I've gone through my code, line by line, slowly, hoping, yet I cant seem to find the problem...
I no for fact no one will go through this but o well
heres the 1307 line code o_O woo
Code: Select all
<html>
<body>
<head>
<STYLE TYPE="text/css">
<!--
A {text-decoration:none}
-->
</STYLE>
<style type='text/css'>
body
{
background-image:
url('SilverBG.jpg')
}
</style>
</head>
<?php
if (isset($_SESSION['islogged']))//islogged3
{
if ($_SESSION['islogged']==true)//islogged1
{
$id=$_SESSION['id'];
$con = mysql_connect("localhost","root","");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
mysql_select_db("chars", $con);
$result = mysql_query("SELECT * FROM chars
WHERE idcount = $id");
$row = mysql_fetch_array($result);
$inv=$row['inv'];
$inv=unserialize($inv);
$invmax=50;
mysql_close($con);
$equipment=false;
$_SESSION['lc']=0;
$_SESSION['lc2']=0;
$_SESSION['cm']=0;
$con = mysql_connect("localhost","root","");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
mysql_select_db("monsters", $con);
$result = mysql_query("SELECT * FROM m_l");
$row = mysql_fetch_array($result);
$mlmon=$row['mlvl'];
$strlvlmon=$row['strlvlmon'];
$strdmgmon=$strlvlmon / 4;
$strdmgmon=rand(0, $strdmgmon * 1.3);
$strdmgmon=round($strdmgmon);
//strength
mysql_close($con);
$con = mysql_connect("localhost","root","");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
mysql_select_db("chars", $con);
$result = mysql_query("SELECT * FROM chars WHERE idcount = $id");
$row = mysql_fetch_array($result);
$dexlvl=$row['dexlvl'];
mysql_close($con);
$con = mysql_connect("localhost","root","");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
mysql_select_db("monsters", $con);
$result = mysql_query("SELECT * FROM m_l"); //monster
$row = mysql_fetch_array($result);
$dexlvlmon=$row['dexlvlmon'];
$dexcthmon=rand($dexlvlmon - $dexlvl, 100);
$dexcthmon=$dexcthmon/100;
//dexterity
$currlifemon=$row['currlifemon'];
$currmaxlifemon=$row['currmaxlifemon'];
//life
$deflvlmon=$row['deflvlmon'];
//defense
$defdamon=$mlmon * $deflvlmon;
$defdamon=$defdamon/100;
//int
$intlvlmon=$row['intlvlmon'];
//focus
$foclvlmon=$row['foclvlmon'];
//mag
$magmon=$row['magmon'];
$mhs=$row['mhs'];
//userstuff
mysql_close($con);
$con = mysql_connect("localhost","root","");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
mysql_select_db("chars", $con);
$result = mysql_query("SELECT * FROM chars WHERE idcount = $id");
$row = mysql_fetch_array($result);
$ml=$row['mlvl'];
$strlvl=$row['strlvl'];
$strdmg=$strlvl/4;
$strdmg=rand(0, $strdmg * 1.3);
$strdmg=round($strdmg);
$strxp=$row['strxp'];
$strdiv=$row['strdiv'];
//str
$dexlvl=$row['dexlvl'];
$dexxp=$row['dexxp'];
$dexcth=rand($ml, $dexlvl * 10);
$dexcth=$dexcth/100;
$dexdiv=$row['dexdiv'];
//dex
$deflvl=$row['deflvl'];
$defxp=$row['defxp'];
$defda=$ml * $deflvl;
$defda=$defda/100;
$defdiv=$row['defdiv'];
//def
$currlife=$row['currlife'];
$maxlife=$row['maxlife'];
//life
$gold=$row['gold'];
$intlvl=$row['intlvl'];
$intxp=$row['intxp'];
$foclvl=$row['foclvl'];
$focxp=$row['focxp'];
$mag=$row['mag'];
$intdiv=$row['intdiv'];
$focdiv=$row['focdiv'];
$bank=$row['bankedgold'];
$magmax=$row['magmax'];
//other
$tdex=$row['tdex'];
$tstr=$row['tstr'];
$tdef=$row['tdef'];
$tint=$row['tint'];
$tfoc=$row['tfoc'];
$phd=$row['phd'];
$sa=$row['sa'];
$currmonster='0';
$sa=$row['sa'];
$lastfight=$row['lastfight'];
$helm=$row['helm'];
$bp=$row['bp'];
$lp=$row['lp'];
$shield=$row['shield'];
$weapon=$row['weapon'];
$weapontype=$row['weapontype'];
$spell=$row['spell'];
$spelltype=$row['spelltype'];
$boots=$row['boots'];
$amulet=$row['amulet'];
$ring=$row['ring'];
$misc=$row['misc'];
$wdmg=$row['wdmg'];
$vert=$row['vert'];
$horz=$row['horz'];
$currtown=$row['currtown'];
$wdmg=$row['wdmg'];
$weaponprices=array(36, 86, 201);
$weapondmg=array(0.5, 1.75, 3);
$spellprices=array(36,86,201);
$spelldmg=array(0.5, 1.75, 3);
$weaponlist = array('Iron Dagger'=>true, 'Iron Sword'=>false, 'Steel Sword'=>false, 'Titan Sword' => false);
$spelllist=array('Ignite');
$armorlist=array('Iron Breast Plate'); ////////////////////TRY and have a 3 dimension-4 dimension
$leglist=array('Iron Leg Plates'); ///////////////////////array holding damage aswell and price
$helmlist=array('Iron Full Helm');
$bootlist=array('Iron Boots');
$gauntletlist=array('Iron Gauntlets');
/////////////////////////////////////////////CLEAR ABOVE
if (isset($_POST['eq1']))
{
if ($_POST['eq1']=='eq2')
{
if (isset($_POST['inv']))
{
$x=$_POST['inv'];
foreach ($weaponlist as $is => $q)
{
if ($is == $inv[$x])
{
if ($weaponlist[$q]==true)
{
$weaponlist[$x]=false;
$wdmg=$weapondmg[$x];
$weapon=$is;
echo 'set';
}
else
{
$weaponlist[$q]=true;
$wdmg=0;
$weapon='Fists';
echo 'unset <br />';
}
}
}
}
}
}
$br="<br />";
//may have to change phd later
if (!isset($phd))
{
$phd=false;
}
if(isset($_POST['strBTN']))
{
if($_POST['strBTN'] == 'Str')
{
$tstr = true;
$tdex = false;
$tdef = false;
$tint = false;
$tfoc = false;
}
}
if(isset($_POST['dexBTN']))
{
if($_POST['dexBTN'] == 'Dex')
{
$tstr = false;
$tdex = true;
$tdef = false;
$tint = false;
$tfoc = false;
}
}
if(isset($_POST['defBTN']))
{
if($_POST['defBTN'] == 'Def')
{
$tstr = false;
$tdex = false;
$tdef = true;
$tint = false;
$tfoc = false;
}
}
if(isset($_POST['intBTN']))
{
if($_POST['intBTN'] == 'Int')
{
$tstr = false;
$tdex = false;
$tdef = false;
$tint = true;
$tfoc = false;
}
}
if(isset($_POST['focBTN']))
{
if($_POST['focBTN'] == 'Foc')
{
$tstr = false;
$tdex = false;
$tdef = false;
$tint = false;
$tfoc = true;//possibly add if ($equipment==true) $equipment == true)
}
}
if (isset($_POST['ceq1']))
{
if ($_POST['ceq1']=='ceq2')
{
$equipment=true;
}
}
if (isset($_POST['ceq3']))
{
if ($_POST['ceq3']=='ceq4')
{
$equipment=false;
}
}
////////////////////////////////////////////////////CLEAR ABOVE from the </div> problem
$con = mysql_connect("localhost","root","");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
mysql_select_db("chars", $con);
$mon1 = array('Baby Elf', 'Wood Elf', 'Dark Elf', 'Blood Elf');
mysql_close($con);
if (isset($_POST['lc1']))
{
if ($_POST['lc1']=='lc2')
{
?>
<DIV STYLE='Position: absolute; Top: 200; Left: 325;'>
<?php
$_SESSION['lc']=0;
$_SESSION['lc2']=0;
$currmonster=$lastfight;
$currmonster=$currmonster+1;
echo '<table border=\'3\' width="325"> <tr> <td align=\'center\'><b>Level '.$currmonster.' '.$mon1[$currmonster-1].'</b><br />';
echo '<b>You challenge a '.$mon1[$currmonster-1].'</b></td></tr></table>';
$currmonster=$currmonster-1;
$currlifemon=$currmaxlifemon;
$sa=true;
$_SESSION['lc']=0;
$_SESSION['lc2']=0;
$mlmon=$currmonster+1;
$strlvlmon=$mlmon * 4;
$strdmgmon=$strlvlmon / 4;
$strdmgmon=rand(0, $strdmgmon * 1.3);
$strdmgmon=round($strdmgmon);
//strength
$dexlvlmon=$mlmon * 7;
$dexcthmon=rand($dexlvlmon - $dexlvl, 100);
$dexcthmon=$dexcthmon/100;
//dexterity
$currlifemon=$mlmon * 9;
$currmaxlifemon=$mlmon * 9;
//life
$deflvlmon=$mlmon * 5;
//defense
$defdamon=$mlmon * $deflvlmon;
$defdamon=$defdamon/100;
//int
$intlvlmon=$mlmon * 7;
//focus
$foclvlmon=$mlmon * 7;
//mag
$magmon=$mlmon * 9;
$magmaxmon=$mlmon * 9;
$con = mysql_connect("localhost","root","");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
mysql_select_db("chars", $con);
{mysql_query("UPDATE chars SET currmonster = $currmonster
");}
mysql_close($con);
$con = mysql_connect("localhost","root","");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
mysql_select_db("monsters", $con);
{mysql_query("UPDATE m_l SET currlifemon = $currmaxlifemon
");}
mysql_query("UPDATE chars SET mlmon = $mlmon
");
mysql_query("UPDATE chars SET strlvlmon = $strlvlmon
");
mysql_query("UPDATE chars SET strdmgmon = $strdmgmon
");
mysql_query("UPDATE chars SET dexlvlmon = $dexlvlmon
");
mysql_query("UPDATE chars SET dexcthmon = $dexcthmon
");
mysql_query("UPDATE chars SET currlifemon = $currlifemon
");
mysql_query("UPDATE chars SET currmaxlifemon = $currmaxlifemon
");
mysql_query("UPDATE chars SET deflvlmon = $deflvlmon
");
mysql_query("UPDATE chars SET defdamon = $defdamon
");
mysql_query("UPDATE chars SET intlvlmon = $intlvlmon
");
mysql_query("UPDATE chars SET foclvlmon = $foclvlmon
");
mysql_query("UPDATE chars SET magmon = $magmon
");
mysql_query("UPDATE chars SET magmaxmon = $magmaxmon
");
?>
</div>
<?php
}
}
///////
//locations
//locations
if (isset($_POST['nf']))
{ //a1
if ($_POST['nf'] == 'nf2')
{
if ($phd==false)
{
?>
<DIV STYLE='Position: absolute; Top: 200; Left: 325;'><!--325-->
<?php
// may have to remove the BIG stat text
$currmonster=$_POST['monsters'];
$currlifemon=$currmaxlifemon;
$sa=true;
$_SESSION['lc']=0;
$_SESSION['lc2']=0;
$mlmon=$currmonster+1;
$strlvlmon=$mlmon * 4;
$strdmgmon=$strlvlmon / 4;
$strdmgmon=rand(0, $strdmgmon * 1.3);
$strdmgmon=round($strdmgmon);
//strength
$dexlvlmon=$mlmon * 7;
$dexcthmon=rand($dexlvlmon - $dexlvl, 100);
$dexcthmon=$dexcthmon/100;
//dexterity
$currlifemon=$mlmon * 9;
$currmaxlifemon=$mlmon * 9;
//life
$deflvlmon=$mlmon * 5;
//defense
$defdamon=$mlmon * $deflvlmon;
$defdamon=$defdamon/100;
//int
$intlvlmon=$mlmon * 7;
//focus
$foclvlmon=$mlmon * 7;
//mag
$magmon=$mlmon * 9;
$magmaxmon=$mlmon * 9;
$con = mysql_connect("localhost","root","");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
mysql_select_db("chars", $con);
{mysql_query("UPDATE chars SET currmonster = $currmonster
");}
mysql_close($con);
$con = mysql_connect("localhost","root","");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
mysql_select_db("monsters", $con);
{mysql_query("UPDATE m_l SET currlifemon = $currmaxlifemon
");}
mysql_query("UPDATE chars SET mlmon = $mlmon
");
mysql_query("UPDATE chars SET strlvlmon = $strlvlmon
");
mysql_query("UPDATE chars SET strdmgmon = $strdmgmon
");
mysql_query("UPDATE chars SET dexlvlmon = $dexlvlmon
");
mysql_query("UPDATE chars SET dexcthmon = $dexcthmon
");
mysql_query("UPDATE chars SET currlifemon = $currlifemon
");
mysql_query("UPDATE chars SET currmaxlifemon = $currmaxlifemon
");
mysql_query("UPDATE chars SET deflvlmon = $deflvlmon
");
mysql_query("UPDATE chars SET defdamon = $defdamon
");
mysql_query("UPDATE chars SET intlvlmon = $intlvlmon
");
mysql_query("UPDATE chars SET foclvlmon = $foclvlmon
");
mysql_query("UPDATE chars SET magmon = $magmon
");
mysql_query("UPDATE chars SET magmaxmon = $magmaxmon
");
mysql_query("UPDATE chars SET currlife = $currlife
");
$currmonster=$currmonster+1;
echo '<table border=\'3\' width="325"> <tr> <td align=\'center\'><b>Level '.$currmonster.' '.$mon1[$currmonster-1].'</b><br />';
echo '<b>You challenge a '.$mon1[$currmonster-1].'</b></td></tr></table>';
mysql_close($con);
$currmonster=$currmonster-1;
$lastfight=$currmonster;
?>
</div>
<?php
}
}
}
$br='<br />';
//damage goes here
$strdmg=$strlvl / 4;
//damage goes above
//deal dmg below
$strdmg=rand(0, $strdmg * 1.1);
$strdmg=round($strdmg);
$strdmg=$strdmg+$wdmg;
//ar (armor reduction), //hr helm reduction, //bpr (r = reduction) //lpr, //shieldR, //bootr
//amuletb(bonus) //ringb(bonus)
$defdamon=$mlmon * $deflvlmon;
$defdamon=$defdamon/15;
//$strdmg=$strdmg-$defdamon;
//$strdmg=round($_SESSION['strdmg']);
//monster stuff below
$strdmgmon=$strlvlmon / 4;
//damage goes above
//deal dmg below
$strdmgmon=rand(0, $strdmgmon * 1.1);
$strdmgmon=round($strdmgmon);
$defda=$ml * $deflvl;
$defda=$defda/15;
$strdmgmon=$strdmgmon-$defda; //later add the if ($strdmgmon < 0) set $strdmgmon =0; so we dont get minus dmg
$strdmgmon=round($strdmgmon);
if ($strdmgmon <= 0)
{
$strdmgmon=0;
}
//monster stuff
$dexcth=rand($deflvl - $deflvlmon, 100);
$dexcthmon=rand($deflvlmon - $deflvl, 100);
//damage above
//$dexcth=$dexcth/100;
//$dexptm=$dexptm/100;
$dropgold=$mlmon;
$dropgold=rand($dropgold, $dropgold * 2.3);
$dropgold=round($dropgold);
$con = mysql_connect("localhost","root","");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
mysql_select_db("monsters", $con);
mysql_query("UPDATE m_l SET currlifemon = $currlifemon
");
mysql_query("UPDATE m_l SET dexcthmon = $dexcthmon
");
mysql_close($con);
$con = mysql_connect("localhost","root","");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
mysql_select_db("chars", $con);
mysql_query("UPDATE chars SET dexcth = $dexcth
");
mysql_close($con);
/////////////////////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////////////////////
/////////Check to see if you've clicked attk button below////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////////////////////
if ($currlife < 1)
{ $gold=0;
$phd=true;
}
//dealdmg above
echo $br;
?>
<font color='darkblue' size='3'>
<?php
if (isset($_POST['attack'])) //attk3
{
if ($currlifemon < 1)
{
?>
<div style='Position: absolute; top: 200; left: 325;'><!--325-->
<?php
echo '<table border=\'3\' width="325"> <tr> <td align="center"><b>The monster is dead</b></td> </tr> </table>';
$mhs=true;
?>
</div>
<?php
}
if ($currlifemon >= 1)//currlifemon1
{
//a2
if ($_POST['attack']=='attk') //attk1
{
?>
<div style='Position: absolute; top: 200; left: 325;'>
<?php
if ($phd==false)//phd1
{
?>
<table border='3' width='325'>
<tr>
<td align='center'>
<?php
$con = mysql_connect("localhost","root","");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
mysql_select_db("chars", $con);
$result = mysql_query("SELECT * FROM chars");
$row = mysql_fetch_array($result);
$currmonster=$row['currmonster'];
mysql_close($con);
$currmonster=$currmonster+1;
echo '<b>Level '.$currmonster.' '. $mon1[$currmonster-1].'</b><br />';
echo '<b>You attack a '.$mon1[$currmonster-1]. ':</b><br />';
$currmonster=$currmonster-1;
/////////////////////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////////////////////
///////////Below is loading monster string and text for dmg and so on
/////////////////////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////////////////////
$sa=true;
$mlmon=$currmonster+1;
$strlvlmon=$mlmon * 4;
$strdmgmon=$strlvlmon / 4;
$strdmgmon=rand(0, $strdmgmon * 1.3);
$strdmgmon=round($strdmgmon);
//strength
$dexlvlmon=$mlmon * 5;
$dexcthmon=rand($dexlvlmon - $dexlvl, 100);
//$dexcthmon=$dexcthmon/100;
$_SESSION['lc']=$currlifemon;//$_SESSION['lc']+$currlifemon;
//dexterity
$currlifemon=$mlmon * 13;
$_SESSSION['lc2']=$currmaxlifemon;//$_SESSION['lc2']+$currlifemon;
$currmaxlifemon=$mlmon * 13;
$currlifemon=$_SESSION['lc'];
//life
$deflvlmon=$mlmon * 3;
//defense
$defdamon=$mlmon * $deflvlmon;
$defdamon=$defdamon/15;
//int
$intlvlmon=$mlmon * 4;
//focus
$foclvlmon=$mlmon * 4;
//mag
$magmon=$mlmon * 9;
$magmaxmon=$mlmon * 9;
$con = mysql_connect("localhost","root","");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
mysql_select_db("chars", $con);
{mysql_query("UPDATE chars SET currmonster = $currmonster
");}
mysql_close($con);
$con = mysql_connect("localhost","root","");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
mysql_select_db("monsters", $con);
{mysql_query("UPDATE m_l SET currlifemon = $currmaxlifemon
");}
mysql_query("UPDATE chars SET mlmon = $mlmon
");
mysql_query("UPDATE chars SET strlvlmon = $strlvlmon
");
mysql_query("UPDATE chars SET strdmgmon = $strdmgmon
");
mysql_query("UPDATE chars SET dexlvlmon = $dexlvlmon
");
mysql_query("UPDATE chars SET dexcthmon = $dexcthmon
");
mysql_query("UPDATE chars SET currlifemon = $currlifemon
");
mysql_query("UPDATE chars SET currmaxlifemon = $currmaxlifemon
");
mysql_query("UPDATE chars SET deflvlmon = $deflvlmon
");
mysql_query("UPDATE chars SET defdamon = $defdamon
");
mysql_query("UPDATE chars SET intlvlmon = $intlvlmon
");
mysql_query("UPDATE chars SET foclvlmon = $foclvlmon
");
mysql_query("UPDATE chars SET magmon = $magmon
");
mysql_query("UPDATE chars SET magmaxmon = $magmaxmon
");
mysql_query("UPDATE chars SET currlife = $currlife
");
/*
echo $br;
echo $dexcthmon.' dexcthmon';
echo $br;
echo $dexcth.' dexcth';
echo $br;
echo $mlmon.'ML';
echo $br;
echo $dexlvlmon.'dex';
echo $br;
echo $strlvlmon.'str';
echo $br;
echo $deflvlmon.'def';
echo $br;
echo $intlvlmon.'int';
echo $br;
echo $foclvlmon.'foc';
echo $br;
*/
if ($dexcth > $dexcthmon)
{
echo "You attack with your ".$weapon." and hit for ".$strdmg." damage";
$currlifemon=$currlifemon-$strdmg;
}
else
{
echo "You attack with your ".$weapon." and you miss"; $strdmg=0;
}
echo '<br /> Current Life is '.$currlifemon. '<br />';
if ($dexcthmon > $dexcth)
{ //a4
echo '<b>'.$mon1[$currmonster]. "</b> attacks you and hits you for ".$strdmgmon; //later add .dmg
$currlife=$currlife-$strdmgmon;
}
else
{
echo '<b>'.$mon1[$currmonster]. "</b> attacks you and misses"; $strdmgmon=0;
}
}
?>
</td>
</tr>
</table>
</font>
<?php
/////////////////////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////////////////////
///////////Levels and XP below////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////////////////////
if ($phd==false)//phd 12
{
// damage delt (to increase XP) below MUST stay at bottom
if ($tstr==true)
{
$strxp=$strxp+$strdmg;
}
if ($tdex==true)
{
$dexxp=$dexxp+$strdmg;
}
if ($tdef==true)
{
$defxp=$defxp+$strdmg;
}
if ($tint==true)
{
$intxp=$intxp+$strdmg;
}
if ($tfoc==true)
{
$focxp=$focxp+$strdmg;
}
// damage delt (to increase XP) above MUST STAY huh
//XP check below
if ($strxp>=$strlvl * $strdiv * $strlvl)
{
$strlvl=$strlvl+1;
$strdiv=$strdiv+1;
}
if ($dexxp>=$dexlvl * $dexdiv * $dexlvl)
{
$dexlvl=$dexlvl+1;
$dexdiv=$dexdiv+1;
}
if ($defxp>=$deflvl * $defdiv * $deflvl)
{
$deflvl=$deflvl+1;
$defdiv=$defdiv+1;
}
if ($intxp>=$intlvl * $intdiv * $intlvl)
{
$intlvl=$intlvl+1;
$intdiv=$intdiv+1;
}
if ($focxp>=$foclvl * $focdiv * $foclvl)
{
$foclvl=$foclvl+1;
$focdiv=$focdiv+1;
}
}//attk2 // I think it may be PHD2 //phd13 I think
if ($currlife < 1)
{
?>
</div>
<DIV STYLE='Position: absolute; Top: 200; Left: 325;'>
<?php
echo '<table border=\'3\' width=\'325\'> <tr> <td align="center"><b><font color=\'maroon\'>You are dead</font></b></td></tr></table>';
$phd=true;
?>
</div>
<?php
}//currlife from just above
?>
</div><!--///////////////////////////////////POSSIBLE BADDY (6)</div>-->
<?php
}//attk4
?><!--/////////////////////////////////////POSSIBLE BADDY (7) </div> they seem to work 6,7-->
<?php
if ($currlifemon < 1)
{
$mhs=true;
$curlifemon=0;
}
if ($mhs==true)
{ //a3
$gold=$gold+$dropgold;
$mhs=false;
$_SESSION['lc']=0;
$_SESSION['lc2']=0;
}
}//currlifemon2
}
// STAT INCREASING ABOVE, Must be huh
//XP check above//
?>
<?php
//movement system
//////////////////////////////////////////////////////////BREAK
$f='</font>';
$d='</div>';
//equipment and such
///////////////////////////////////////Displays Stat Bars/////////////////////////////////////////
////////////////Increases main level//////////
if ($strlvl + $dexlvl + $deflvl + $intlvl + $foclvl - 25 >=$ml * 15)
{
$ml=$ml+1;
$maxlife=$maxlife+$strlvl/2 + $ml;
$magmax=$magmax+$intlvl/2 + $ml;//may not use magic later on
$currlife=$maxlife;
$mag=$magmax; //or maxmag
}
/////////////Increases main level////////////
/////////////////////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////////////////////
///////////Below/is/Forms/buttons/and/so/on//////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////////////////////
$con = mysql_connect("localhost","root","");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
mysql_select_db("chars", $con);
mysql_query("UPDATE chars SET gold = $gold
");
mysql_query("UPDATE chars SET bankedgold = $bank
");
mysql_query("UPDATE chars SET strxp = $strxp
");
mysql_query("UPDATE chars SET dexxp = $dexxp
");
mysql_query("UPDATE chars SET defxp = $defxp
");
mysql_query("UPDATE chars SET currlife = $currlife
");
mysql_query("UPDATE chars SET maxlife = $maxlife
");
mysql_query("UPDATE chars SET strlvl = $strlvl
");
mysql_query("UPDATE chars SET deflvl = $deflvl
");
mysql_query("UPDATE chars SET dexlvl = $dexlvl
");
//mysql_query("UPDATE chars SET sa = $sa //unneeded?
//");
if ($phd==true)
{mysql_query("UPDATE chars SET phd = 1
");}
else
{mysql_query("UPDATE chars SET phd = 0
");}
if ($tdex==true)
{mysql_query("UPDATE chars SET tdex = 1
");}
else
{mysql_query("UPDATE chars SET tdex = 0
");}
if ($tstr==true)
{mysql_query("UPDATE chars SET tstr = 1
");}
else
{mysql_query("UPDATE chars SET tstr = 0
");}
if ($tdef==true)
{mysql_query("UPDATE chars SET tdef = 1
");}
else
{mysql_query("UPDATE chars SET tdef = 0
");}
mysql_query("UPDATE chars SET mlvl = $ml
");
if ($tint==true)
{mysql_query("UPDATE chars SET tint = 1
");}
else
{mysql_query("UPDATE chars SET tint = 0
");}
if ($tfoc==true)
{mysql_query("UPDATE chars SET tfoc = 1
");}
else
{mysql_query("UPDATE chars SET tfoc = 0
");}
mysql_query("UPDATE chars SET mlvl = $ml
");
mysql_query("UPDATE chars SET dexdiv = $dexdiv
");
mysql_query("UPDATE chars SET strdiv = $strdiv
");
mysql_query("UPDATE chars SET defdiv = $defdiv
");
mysql_query("UPDATE chars SET magmax = $magmax
");
mysql_query("UPDATE chars SET intdiv = $intdiv
");
mysql_query("UPDATE chars SET focdiv = $focdiv
");
mysql_query("UPDATE chars SET intlvl = $intlvl
");
mysql_query("UPDATE chars SET foclvl = $foclvl
");
mysql_query("UPDATE chars SET intxp = $intxp
");
mysql_query("UPDATE chars SET focxp = $focxp
");
mysql_query("UPDATE chars SET lastfight = $lastfight
");
mysql_query("UPDATE chars SET vert = $vert
");
mysql_query("UPDATE chars SET horz = $horz
");
$inv=serialize($inv);
mysql_query("UPDATE chars SET inv = $inv
");
mysql_query("UPDATE chars SET wdmg = $wdmg
");
mysql_close($con);
$con = mysql_connect("localhost","root","");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
mysql_select_db("weapons", $con);
mysql_close($con);
$con = mysql_connect("localhost","root","");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
mysql_select_db("monsters", $con);
mysql_query("UPDATE m_l SET currlifemon = $currlifemon
");
if ($mhs==false)
{
mysql_query("UPDATE chars SET mhs = 0
");
}
else
{
mysql_query("UPDATE chars SET mhs = 1
");
}
} //islogged2
}//islogged4
else
{
?>
<DIV STYLE='Position: absolute; Top: 250; Left: 380;'>
<?php
echo '<table border=\'3\'><tr><td><b><font size="5">You are not logged in</font></b></td></tr><tr><td align="center"> Please click below to login<br /><form action="home.php" method="post"><input type=\'submit\' value="Login"></form></td></tr></table>';
?>
</div>
<?php
}
?>
<!-- NOTES, later on load the monsters to array, and load the dmg str ALL of it, into an array stat variable matching the monster array and use that for monsters-->
</body>
</html>