chavdave26

inventory.php

Oct 17th, 2012
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.16 KB | None | 0 0
  1. <?php
  2.  
  3.  
  4. include "globals.php";
  5. $q=$db->query("SELECT * FROM items WHERE itmid IN({$ir['equip_primary']}, {$ir['equip_secondary']}, {$ir['equip_armor']})");
  6.  
  7.  
  8. print '
  9.  
  10.  
  11. <div class="inventory_container"><div class="inventory_topbg">
  12.  
  13. ';
  14. while($r=$db->fetch_row($q))
  15. {
  16. $equip[$r['itmid']]=$r;
  17. }
  18. print '
  19.  
  20. <br> <br> <br> <br> <br> <br> <br> <br> <br> <br><br> <br> <br> <br> <br> <br>
  21.  
  22. <div class="generalinfo_txt">
  23. <div><img src="images/info_left.jpg" alt="" /></div>
  24. <div class="info_mid"><h2 style="padding-top:10px;"> Equipped Items</h2></div>
  25. <div><img src="images/info_right.jpg" alt="" /></div> </div>
  26. <div class="generalinfo_simple"><br> <br><br>
  27.  
  28.  
  29. <table width="80%" class="table" style="text-align: center;">
  30.  
  31. <tr>
  32. <th>Primary Weapon</th>
  33. <td>
  34.  
  35.  
  36.  
  37.  
  38. ';
  39. if($equip[$ir['equip_primary']]['itmid'])
  40. {
  41. print $equip[$ir['equip_primary']]['itmname']."</td><td><a href='unequip.php?type=equip_primary'>Unequip Item</a></td>";
  42. }
  43. else
  44. {
  45. print "None equipped.</td><td>&nbsp;</td>";
  46. }
  47. print "</tr>
  48. <tr>
  49. <th>Secondary Weapon</th>
  50. <td>";
  51. if($equip[$ir['equip_secondary']]['itmid'])
  52. {
  53. print $equip[$ir['equip_secondary']]['itmname']."</td><td><a href='unequip.php?type=equip_secondary'>Unequip Item</a></td>";
  54. }
  55. else
  56. {
  57. print "None equipped.</td><td>&nbsp;</td>";
  58. }
  59. print "</tr>
  60. <tr>
  61. <th>Armor</th>
  62. <td>";
  63. if($equip[$ir['equip_armor']]['itmid'])
  64. {
  65. print $equip[$ir['equip_armor']]['itmname']."</td><td><a href='unequip.php?type=equip_armor'>Unequip Item</a></td>";
  66. }
  67. else
  68. {
  69. print "None equipped.</td><td>&nbsp;</td>";
  70. }
  71. print "</tr>
  72. </table>
  73.  
  74.  
  75. <h2 style='padding-top:10px;'> Inventory</h2>
  76.  
  77.  
  78.  
  79. ";
  80. $inv=$db->query("SELECT iv.*,i.*,it.* FROM inventory iv LEFT JOIN items i ON iv.inv_itemid=i.itmid LEFT JOIN itemtypes it ON i.itmtype=it.itmtypeid WHERE iv.inv_userid={$userid} ORDER BY i.itmtype ASC, i.itmname ASC");
  81. if ($db->num_rows($inv) == 0)
  82. {
  83. print "<b>You have no items!</b>";
  84. }
  85. else
  86. {
  87. print "<b>Your items are listed below.</b><br />
  88. <table width=100% class=\"table\" border=\"0\" cellspacing=\"1\">
  89. <tr>
  90. <th >Item</th>
  91. <th >Sell Value</th>
  92. <th >Total Sell Value</th>
  93. <th >Links</th>
  94. </tr>";
  95. $lt="";
  96. while($i=$db->fetch_row($inv))
  97. {
  98. if($lt!=$i['itmtypename'])
  99. {
  100. $lt=$i['itmtypename'];
  101. print "\n<tr><th colspan=4><b>{$lt}</b></th></tr>";
  102. }
  103. if($i['weapon'])
  104. {
  105. $i['itmname']="<font color='red'>*</font>".$i['itmname'];
  106. }
  107. if($i['armor'])
  108. {
  109. $i['itmname']="<font color='green'>*</font>".$i['itmname'];
  110. }
  111. print "<tr><td>{$i['itmname']}";
  112. if ($i['inv_qty'] > 1)
  113. {
  114. print "&nbsp;x{$i['inv_qty']}";
  115. }
  116. print "</td><td>\${$i['itmsellprice']}</td><td>";
  117. print "$".($i['itmsellprice']*$i['inv_qty']);
  118. $usershop=$db->query("select * from usershops where userid=$userid");
  119. if(mysql_num_rows($usershop)!=0)
  120. {
  121. $addtoshop="[<a href='addtoshop.php?ID={$i['inv_id']}'>Put in Shop</a>]";
  122. }
  123. print "</td><td>[<a href='iteminfo.php?ID={$i['itmid']}'>Info</a>] [<a href='itemsend.php?ID={$i['inv_id']}'>Send</a>] [<a href='itemsell.php?ID={$i['inv_id']}'>Sell</a>] [<a href='imadd.php?ID={$i['inv_id']}'>Add To Market</a>] $addtoshop";
  124. $usershop=$db->query("select * from usershops where userid=$userid");
  125.  
  126. if($i['effect1_on'] || $i['effect2_on'] || $i['effect3_on']) {
  127. print " [<a href='itemuse.php?ID={$i['inv_id']}'>Use</a>]";
  128. }
  129. // -- Donation Module -- //
  130. require_once('gateway/donation_functions.php');
  131. $dset = getSettings();
  132.  
  133. if($i['itmtype'] == $dset['item_type']) {
  134. echo ' [<a href="donate.php?use_item='.$i['inv_id'].'">Use</a>]';
  135. }
  136. // -- Donation Module -- //
  137. if($i['weapon'])
  138. {
  139. print " [<a href='equip_weapon.php?ID={$i['inv_id']}'>Equip as Weapon</a>]";
  140. }
  141. if($i['armor'])
  142. {
  143. print " [<a href='equip_armor.php?ID={$i['inv_id']}'>Equip as Armor</a>]";
  144. }
  145. print "</td></tr> ";
  146. }
  147. print "<tr><th colspan=4></th></tr></table>";
  148. print "<small><b>NB:</b> Items with a small red </small><font color='red'>*</font><small> next to their name can be used as weapons in combat.<br />
  149. Items with a small green </small><font color='green'>*</font><small> next to their name can be used as armor in combat.</small>
  150. </div><div><img src='images/generalinfo_btm.jpg' alt='' /></div><br></div></div></div></div></div> ";
  151. }
  152. $h->endpage();
  153. ?>
Advertisement
Add Comment
Please, Sign In to add comment