Browser MMO Video #20

Location of the Videos
countvoldermort
Posts: 165
Joined: Tue Oct 13, 2009 4:22 pm

Re: Video #20

Post by countvoldermort »

Cool, that solved some of it, prices are still wrong though, im now at video 25
Im dumb;)
User avatar
hallsofvallhalla
Site Admin
Posts: 12026
Joined: Wed Apr 22, 2009 11:29 pm

Re: Video #20

Post by hallsofvallhalla »

what do you mean the prices are wrong? As in they do not match the DB? That is because each stores prices are different by percentages. They will not match the items price as that is the base price. The stores adds a percentage. Some stores are cheaper than others.
countvoldermort
Posts: 165
Joined: Tue Oct 13, 2009 4:22 pm

Re: Video #20

Post by countvoldermort »

In the shops it sayes what it says(price) in the database but chages like 2 extra gold.
Im dumb;)
User avatar
hallsofvallhalla
Site Admin
Posts: 12026
Joined: Wed Apr 22, 2009 11:29 pm

Re: Video #20

Post by hallsofvallhalla »

i am still not understanding what you are meaning. The prices in the DB WILL NOT be the same as what shows up in the store. Stores charge a percentage more.

Show me a screen shot please.
countvoldermort
Posts: 165
Joined: Tue Oct 13, 2009 4:22 pm

Re: Video #20

Post by countvoldermort »

iI know the database price wont be the same as the shop because of the percentage thing. What i ment is in the store, weaponhop and armor shop say their prices on the in game screen table say they change 10 gold for a short sword, it take 11 gold from my Balence! Get it? Its costing me more than it says at each towns shops
Im dumb;)
User avatar
hallsofvallhalla
Site Admin
Posts: 12026
Joined: Wed Apr 22, 2009 11:29 pm

Re: Video #20

Post by hallsofvallhalla »

Code: Select all

 $percentage = $inninfo3['price'] / 100;
     $price = $invinfo3['price'] * $percentage;
          $newprice = $price + $invinfo3['price'];
     $newprice = (int)$newprice;

      print "<tr><td>$invinfo3[name]</td><td>$invinfo3[rating]</td><td>$newprice</td><td><A href='weaponshop.php?id=$invinfo3[id]&bought=1'>Buy Weapon</td></tr>";
your code is there so it should work.

Code: Select all

$percentage = $iteminfo3['price'] / 100;
     $price = $iteminfo3['price'] * $percentage;
      $newprice = $price + $iteminfo3['price'];
     $newprice = (int)$newprice;


$updateplayer="update players set gold=gold-'$newprice' where name='$player'";
  mysql_query($updateplayer) or die("Could not update player");
Henning12342
Posts: 9
Joined: Fri Feb 03, 2012 2:29 pm

Re: Video #20

Post by Henning12342 »

hey guys im trying to create an unequip item code but im stuggling usis halls code
User avatar
hallsofvallhalla
Site Admin
Posts: 12026
Joined: Wed Apr 22, 2009 11:29 pm

Re: Video #20

Post by hallsofvallhalla »

whats the error, show us code
krisna_cool
Posts: 1
Joined: Sat Mar 03, 2012 1:37 am

Re: Video #20

Post by krisna_cool »

My battle.php can's show creatures. It can show my profile though. What should I do?

Screenshots: Image



The code:

Code: Select all

<?php
include_once 'connect.php';
session_start();

include_once 'logo.php';
?>
 <link href="stylebattle.css" rel="stylesheet" type="text/css" />
<div id="login2" div align="center">


<?php

 


if (isset($_SESSION['player']))
{
  $player=$_SESSION['player'];
}
else
{
  echo "Not Logged in <br><br> <A href='login.php'>Login</a>";
  exit;
}
?>
</div>
<?php
$playerinfo="SELECT * from players where name='$player'";
$playerinfo2=mysql_query($playerinfo) or die("could not get player stats!");
$playerinfo3=mysql_fetch_array($playerinfo2);

include_once 'statpanel.php';

$pid = $playerinfo3['id'];
$name = $playerinfo3['name'];
$playerhp = $playerinfo3['hpoints'];
$playerattack = $playerinfo3['attack'];
$playerdefense = $playerinfo3['defense'];

?>
<div id="table">
<?php

 if (isset($_GET['randid']))
{
   $randid=$_GET['randid'];
   $iteminfo="SELECT * from inventory where randid='$randid' AND id ='$pid'";
$iteminfo2=mysql_query($iteminfo) or die("could not get item stats!");
$iteminfo3=mysql_fetch_array($iteminfo2);

if (!$iteminfo3['name'])
{
}
else
{

$iname = $iteminfo3['name'];
$stats = $iteminfo3['stats'];
$statadd = $iteminfo3['statadd'];
$type = $iteminfo3['type'];
 
 if ($type == "healing")
 {
   $newhp = $statadd + $playerhp;
   if ($newhp > $playerinfo3['maxhp'])
   {
    $newhp = $playerinfo3['maxhp'];
   }
    $updateplayer="update players set hpoints='$newhp' where id='$pid'";
  mysql_query($updateplayer) or die("Could not update player");

    $updateitem="DELETE from inventory where id='$pid' AND randid='$randid' limit 1";
  mysql_query($updateitem) or die("Could not delete item");
   
   $playerhp = $newhp;
  
  echo "Used " . $iname . " and recovered " . $statadd . ".<br>";
 }

}}

 
 


$creature = $playerinfo3['creature'];
 if ($creature != 0)
{
 $creatureinfo="SELECT * from creatures where id='$creature'";
$creatureinfo2=mysql_query($creatureinfo) or die("could not get the creature you were fighting!");
$creatureinfo3=mysql_fetch_array($creatureinfo2);

}
else
{
////////////////////new for video 20
$areaninfo="SELECT * from locations where location='$pllocation' AND type='arena'";
$areaninfo2=mysql_query($areaninfo) or die("could not get arena");
$areaninfo3=mysql_fetch_array($areaninfo2);
$arenalevel = $areaninfo3['level'];

  $creatureinfo="SELECT * from creatures where level <= '$arenalevel' order by rand() limit 1";
$creatureinfo2=mysql_query($creatureinfo) or die("could get a creature!");
$creatureinfo3=mysql_fetch_array($creatureinfo2);
$cid = $creatureinfo3['id'];
$updateplayer="update players set creature='$cid' where name='$name'";
  mysql_query($updateplayer) or die("Could not update player");
}

$creature = $creatureinfo3['name'];
$creaturehp = $creatureinfo3['hpoints'];
$creatureattack = $creatureinfo3['attack'];
$creaturedefense = $creatureinfo3['defense'];



?>
</div>
<div id="player">
<?php
/////player info
echo "<u> " . $playerinfo3['name'] . "</u><br>";
echo "Hit points = " . $playerhp . "<br>";
echo "Attack = " . $playerattack . "<br>";
echo "Defense = " . $playerdefense . "<br><br><br>";
?>
</div>
<div id="creature">
<?php
///////creature info
echo "<u> " . $creatureinfo3['name'] . "</u><br>";
echo "Hit points = " . $creaturehp . "<br>";
echo "Attack = " . $creatureattack . "<br>";
echo "Defense = " . $creaturedefense . "<br><br><br>";

echo "<a href='attack.php'>Attack</a>";
echo "<br><a href='usemagic.php'>Use Magic</a>";
echo "<br><a href='useitem.php'>Use Item</a>";
echo "<br><a href='index.php'>Exit Arena</a>";


?>
</div>

<div id="logout">
<?php
echo "<br><a href='logout.php'><img src='images/logout.gif'>";
?>
</div>
User avatar
hallsofvallhalla
Site Admin
Posts: 12026
Joined: Wed Apr 22, 2009 11:29 pm

Re: Video #20

Post by hallsofvallhalla »

what does your player show for a creature in the DB? Do you have available creatures for your players level?
Post Reply

Return to “Older Browser MMO Videos”