eat food





PHPXRef 0.7 : NEABExplorer : /object_type_code/eat_food.php source









[ Index ]


PHP Cross Reference of NEABExplorer














if (gwGetCookie('xrefnav')=='off')
document.write('[ Show Explorer ]');
else
document.write('[ Hide Explorer ]');



[ Show Explorer ]
[ Hide Navbar ]





titleBody[close]
/object_type_code/ -> eat_food.php (source)

[Summary view]
[Print]
[Text view]


1 <?PHP
2 /**
3 * Code used when a player eats some food.
4 */
5
6 $info=object_info($id);
7 if(inventory_check($id) > 0)
8 {
9 if(!isset($text))
10 {
11 echo "<BR><DIV ALIGN=CENTER>";
12 echo "<TABLE BORDER=0 CELLSPACING=1 CELLPADDING=1 BGCOLOR=#000000 WIDTH=300>";
13 echo "<TR><TH><B><FONT COLOR=#FFFFFF>Result</FONT></B></TH></TR>\n";
14 echo "<TR><TD BGCOLOR=#E0E0E0>";
15 }
16 if(isset($text))
17 $text.="You consumed some {$info['NAME']} restoring {$info['FOOD']} points.<BR>\n";
18 else
19 echo "You consumed some {$info['NAME']} restoring {$info['FOOD']} points.<BR>\n";
20
21 if($id == 7007 || $id == 7034)
22 {
23 if(isset($text))
24 $text.="You feel funny... <BR>\n";
25 else
26 echo "You feel funny... <BR>\n";
27 if($id ==7007)
28 $db->Execute("UPDATE PLAYER SET INVISIBILITY=30 WHERE ID = $userid");
29 else
30 $db->Execute("UPDATE PLAYER SET INVISIBILITY=300 WHERE ID = $userid");
31 }
32 else if($info["HP"]+$uservals["HP"] < 0 || $info["MP"]+$uservals["MP"] < 0)
33 {
34 if(isset($text))
35 $text.="You cannot eat this food at this time.<BR>";
36 else
37 echo "You cannot eat this food at this time.<BR>";
38 }
39 else
40 {
41 $hp=mt_rand(ceil($info["HP"]/2),$info["HP"]);
42 $uservals["HUNGRY"]+=$info["FOOD"];
43 if($uservals["HUNGRY"] > 100)
44 $uservals["HUNGRY"]=100;
45 $uservals["HP"]+=$hp;
46 if($uservals["HP"] > ($uservals["HPMOD"]+$uservals['MAXHP']))
47 $uservals["HP"]=($uservals["HPMOD"]+$uservals['MAXHP']);
48 $mp=mt_rand(ceil($info["MP"]/2),$info["MP"]);
49 $uservals["MP"]+=$mp;
50 if($uservals["MP"] > ($uservals["MPMOD"]+$uservals['MAXMP']))
51 $uservals["MP"]=($uservals["MPMOD"]+$uservals['MAXMP']);
52
53 $db->Execute("UPDATE PLAYER SET HP={$uservals['HP']}, MP={$uservals['MP']}, HUNGRY={$uservals['HUNGRY']} WHERE ID=$userid");
54 if($hp > 0)
55 {
56 if(isset($text))
57 $text.="You gain $hp HP (HP ".$uservals['HP']."/".($uservals["MAXHP"]+$uservals["HPMOD"]).")<BR>\n";
58 else
59 echo "You gain $hp HP (HP ".$uservals['HP']."/".($uservals["MAXHP"]+$uservals["HPMOD"]).")<BR>\n";
60 }
61 if($mp > 0)
62 {
63 if(isset($text))
64 $text.="You gain $mp MP (MP ".$uservals['MP']."/".($uservals["MAXMP"]+$uservals["MPMOD"]).")<BR>\n";
65 else
66 echo "You gain $mp MP (MP ".$uservals['MP']."/".($uservals["MAXMP"]+$uservals["MPMOD"]).")<BR>\n";
67 }
68 }
69 inventory_add($id,-1);
70 if(!isset($text))
71 {
72 echo "</TD></TR></TABLE></DIV><BR>\n";
73 }
74 }
75 ?>



FUNC_DATA={
'inventory_add': ['inventory_add', 'Adds an item to the inventory. (no message) ', [['libs','objects_util.php',359]], 49],
'inventory_check': ['inventory_check', 'Checks if the player have this item. ', [['libs','objects_util.php',425]], 44],
'execute': ['execute', '', [['libs','db_conn_5.php',37],['libs','db_conn_4.php',37]], 652],
'object_info': ['object_info', 'Retreive the information about an object. ', [['libs','objects_util.php',457]], 20],
'mt_rand': ['mt_rand', '', [], 102],
'ceil': ['ceil', '', [], 66]};
CLASS_DATA={
};
CONST_DATA={
};

titleDescriptionBody
titleDescriptionBody
titleDescriptionBody
titleBody



Generated: Sun Jul 8 18:11:25 2007
Cross-referenced by PHPXref 0.7





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