eat food


/**
* Code used when a player eats some food.
*/

$info=object_info($id);
if(inventory_check($id) > 0)
{
if(!isset($text))
{
echo "
";
echo "";
echo "\n";
echo "
Result
";
}
if(isset($text))
$text.="You consumed some {$info['NAME']} restoring {$info['FOOD']} points.
\n";
else
echo "You consumed some {$info['NAME']} restoring {$info['FOOD']} points.
\n";

if($id == 7007 || $id == 7034)
{
if(isset($text))
$text.="You feel funny...
\n";
else
echo "You feel funny...
\n";
if($id ==7007)
$db->Execute("UPDATE PLAYER SET INVISIBILITY=30 WHERE ID = $userid");
else
$db->Execute("UPDATE PLAYER SET INVISIBILITY=300 WHERE ID = $userid");
}
else if($info["HP"]+$uservals["HP"] < 0 || $info["MP"]+$uservals["MP"] < 0)
{
if(isset($text))
$text.="You cannot eat this food at this time.
";
else
echo "You cannot eat this food at this time.
";
}
else
{
$hp=mt_rand(ceil($info["HP"]/2),$info["HP"]);
$uservals["HUNGRY"]+=$info["FOOD"];
if($uservals["HUNGRY"] > 100)
$uservals["HUNGRY"]=100;
$uservals["HP"]+=$hp;
if($uservals["HP"] > ($uservals["HPMOD"]+$uservals['MAXHP']))
$uservals["HP"]=($uservals["HPMOD"]+$uservals['MAXHP']);
$mp=mt_rand(ceil($info["MP"]/2),$info["MP"]);
$uservals["MP"]+=$mp;
if($uservals["MP"] > ($uservals["MPMOD"]+$uservals['MAXMP']))
$uservals["MP"]=($uservals["MPMOD"]+$uservals['MAXMP']);

$db->Execute("UPDATE PLAYER SET HP={$uservals['HP']}, MP={$uservals['MP']}, HUNGRY={$uservals['HUNGRY']} WHERE ID=$userid");
if($hp > 0)
{
if(isset($text))
$text.="You gain $hp HP (HP ".$uservals['HP']."/".($uservals["MAXHP"]+$uservals["HPMOD"]).")
\n";
else
echo "You gain $hp HP (HP ".$uservals['HP']."/".($uservals["MAXHP"]+$uservals["HPMOD"]).")
\n";
}
if($mp > 0)
{
if(isset($text))
$text.="You gain $mp MP (MP ".$uservals['MP']."/".($uservals["MAXMP"]+$uservals["MPMOD"]).")
\n";
else
echo "You gain $mp MP (MP ".$uservals['MP']."/".($uservals["MAXMP"]+$uservals["MPMOD"]).")
\n";
}
}
inventory_add($id,-1);
if(!isset($text))
{
echo "

\n";
}
}
?>

Wyszukiwarka

Podobne podstrony:
eat food
eat food
International Food Match
Food & Drinks (General) 2
What do they like (Food)
Emergency Survival Safety Prepa Food
Food Matters napisy
Food analysis Packaging Materials
mexican spanish food v1 m56577569830491278
Food 20 adjectives association
(ebook) Survival How To Dry Food
food few
Evans Frozen Food Science and Technology (Blackwell, 2008)

więcej podobnych podstron