equip weapon





PHPXRef 0.7 : NEABExplorer : /object_type_code/equip_weapon.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/ -> equip_weapon.php (source)

[Summary view]
[Print]
[Text view]


1 <?PHP
2 /**
3 * Code used when a player equips a weapon.
4 */
5
6 $info=object_info($id);
7 if(($uservals["WEAPON"]+0) != 0)
8 $prevobj=object_info($uservals["WEAPON"]);
9 if(inventory_check($id,$_GET["USED"]) > 0)
10 {
11 if($uservals["WEAPON"]+0 != 0 && $uservals["SCHOOL"] != "B")
12 {
13 echo "<BR><DIV ALIGN=CENTER><TABLE BORDER=0 CELLSPACING=1 CELLPADDING=2 BGCOLOR=#A00000>";
14 echo "<TR><TH><B><FONT COLOR=#FFFFFF>Result</FONT></B></TH></TR>\n";
15 echo "<TR><TD BGCOLOR=#E0E0E0>";
16 echo "You can only equip one weapon at a given time !\n";
17 echo "</TD></TR></TABLE></DIV><BR>\n";
18 }
19 else if($uservals["SHIELD"]+0 != 0 && $info["HANDS"]+0 != 1)
20 {
21 echo "<BR><DIV ALIGN=CENTER><TABLE BORDER=0 CELLSPACING=1 CELLPADDING=2 BGCOLOR=#A00000>";
22 echo "<TR><TH><B><FONT COLOR=#FFFFFF>Result</FONT></B></TH></TR>\n";
23 echo "<TR><TD BGCOLOR=#E0E0E0>";
24 echo "You cannot equip a two handed weapon while wearing a shield or another weapon!\n";
25 echo "</TD></TR></TABLE></DIV><BR>\n";
26 }
27 else if($uservals["WEAPON"]+0 != 0 && $info["HANDS"]+0 != 1)
28 {
29 echo "<BR><DIV ALIGN=CENTER><TABLE BORDER=0 CELLSPACING=1 CELLPADDING=2 BGCOLOR=#A00000>";
30 echo "<TR><TH><B><FONT COLOR=#FFFFFF>Result</FONT></B></TH></TR>\n";
31 echo "<TR><TD BGCOLOR=#E0E0E0>";
32 echo "You cannot equip a two handed weapon while wearing another weapon!\n";
33 echo "</TD></TR></TABLE></DIV><BR>\n";
34 }
35 else if($uservals["WEAPON"]+0 != 0 && $prevobj["HANDS"]+0 != 1)
36 {
37 echo "<BR><DIV ALIGN=CENTER><TABLE BORDER=0 CELLSPACING=1 CELLPADDING=2 BGCOLOR=#A00000>";
38 echo "<TR><TH><B><FONT COLOR=#FFFFFF>Result</FONT></B></TH></TR>\n";
39 echo "<TR><TD BGCOLOR=#E0E0E0>";
40 echo "You cannot equip another weapon or a shield while wearing a two handed weapon!\n";
41 echo "</TD></TR></TABLE></DIV><BR>\n";
42 }
43 else if($uservals["WEAPON"]+0 != 0 && $uservals["SHIELD"]+0 != 0 && $uservals["SCHOOL"] == "B")
44 {
45 echo "<BR><DIV ALIGN=CENTER><TABLE BORDER=0 CELLSPACING=1 CELLPADDING=2 BGCOLOR=#A00000>";
46 echo "<TR><TH><B><FONT COLOR=#FFFFFF>Result</FONT></B></TH></TR>\n";
47 echo "<TR><TD BGCOLOR=#E0E0E0>";
48 echo "Your two hands are already used!\n";
49 echo "</TD></TR></TABLE></DIV><BR>\n";
50 }
51 else
52 {
53 if($uservals["WEAPON"] == 0)
54 {
55 $uservals["WEAPON"]=$id;
56 $uservals["ATTACK"]+=$info["ATTACK"];
57 }
58 else
59 $uservals["SHIELD"]=$id;
60
61 $uservals["PROTECTION"]+=$info["PROTECTION"];
62 $uservals["BLOCK"]+=$info["BLOCK"];
63 $uservals["DEXMOD"]+=$info["DEXTERITY"];
64 $uservals["STRMOD"]+=$info["STRONGNESS"];
65 $uservals["CHAMOD"]+=$info["CHARISMA"];
66 $uservals["INTMOD"]+=$info["INTELLIGENCE"];
67 $uservals["HPMOD"]+=$info["HP"];
68 $uservals["MPMOD"]+=$info["MP"];
69
70
71 if(($uservals["HP"]+0) > ($uservals["HPMOD"]+$uservals["MAXHP"]))
72 $uservals["HP"]=$uservals["HPMOD"]+$uservals["MAXHP"];
73
74 if(($uservals["MP"]+0) > ($uservals["MPMOD"]+$uservals["MAXMP"]))
75 $uservals["MP"]=$uservals["MPMOD"]+$uservals["MAXMP"];
76
77 $db->Execute("UPDATE PLAYER SET ATTACK={$uservals['ATTACK']}, PROTECTION={$uservals['PROTECTION']},
78 DEXMOD={$uservals['DEXMOD']}, STRMOD={$uservals['STRMOD']}, CHAMOD={$uservals['CHAMOD']},
79 INTMOD={$uservals['INTMOD']}, HPMOD={$uservals['HPMOD']}, MPMOD={$uservals['MPMOD']},
80 HP={$uservals['HP']}, MP={$uservals['MP']}, BLOCK={$uservals['BLOCK']},
81 WEAPON={$uservals['WEAPON']},SHIELD={$uservals['SHIELD']} WHERE ID=$userid");
82
83 inventory_add($id,-1,$_GET["USED"]);
84 $db->Execute("REPLACE INTO USED_OBJECTS(USERID,OBJECTID,NBTIMES) VALUES($userid,$id,".$_GET["USED"].")");
85
86 echo "<BR><DIV ALIGN=CENTER><TABLE BORDER=0 CELLSPACING=1 CELLPADDING=2 BGCOLOR=#00A000>";
87 echo "<TR><TH><B><FONT COLOR=#FFFFFF>Result</FONT></B></TH></TR>\n";
88 echo "<TR><TD BGCOLOR=#E0E0E0>";
89 echo "You equipped your ".$info["NAME"]." successfully.\n";
90 echo "</TD></TR></TABLE></DIV><BR>\n";
91 }
92 }
93 ?>



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]};
CLASS_DATA={
};
CONST_DATA={
};

titleDescriptionBody
titleDescriptionBody
titleDescriptionBody
titleBody



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





Wyszukiwarka