PageRenderTime 62ms CodeModel.GetById 23ms RepoModel.GetById 0ms app.codeStats 0ms

/lib/commons/encyclopedialib.php

https://github.com/BenMakesGames/PsyPets
PHP | 636 lines | 572 code | 63 blank | 1 comment | 108 complexity | ddd4b3f332dbdc1030e8dc0332283260 MD5 | raw file
  1. <?php
  2. require_once 'commons/museumlib.php';
  3. require_once 'commons/petlib.php';
  4. require_once 'commons/blimplib.php';
  5. $CUSTOM_DESC = array(
  6. 'no' => 'Common',
  7. 'yes' => 'Custom',
  8. 'limited' => 'Limited',
  9. 'monthly' => 'Erstwhile',
  10. 'recurring' => 'Favor',
  11. 'x-game' => 'Cross-game',
  12. );
  13. function wiki_link($itemname)
  14. {
  15. global $SETTINGS;
  16. $link = str_replace(array('#', '&', '+', '"'), array('no. ', ' and ', ' ', '%22'), $itemname);
  17. $link = trim($link);
  18. //$link = link_safe($link);
  19. return '<a href="http://' . $SETTINGS['wiki_domain'] . '/' . $link . '">View PsyHelp entry</a>';
  20. }
  21. function get_profile_item_ranking($userid, $itemid)
  22. {
  23. return fetch_single('SELECT * FROM psypets_profile_treasures WHERE userid=' . (int)$userid . ' AND itemid=' . (int)$itemid . ' LIMIT 1');
  24. }
  25. function RenderEncyclopediaItem(&$item, &$user, &$pets)
  26. {
  27. global $CUSTOM_DESC, $PET_STAT_DESCRIPTIONS, $now;
  28. $is_edible = ($item['is_edible'] == 'yes');
  29. $is_equip = ($item['is_equipment'] == 'yes');
  30. $is_key = ($item['key_id'] > 0);
  31. $is_useable = (strlen($item['action']) > 0);
  32. $is_toy = (strlen($item['playdesc']) > 0);
  33. $is_hourly = ($item['hourlyfood'] != 0 || $item['hourlysafety'] != 0 || $item['hourlylove'] != 0 || $item['hourlyesteem'] != 0);
  34. $is_recyclable = ($item['can_recycle'] == 'yes');
  35. $can_pawn_with = ($item['can_pawn_with'] == 'yes');
  36. $can_pawn_for = ($item['can_pawn_for'] == 'yes');
  37. if($is_useable > 0)
  38. $action = explode(';', $item['action']);
  39. if($is_equip)
  40. $equip_level = EquipLevel($item);
  41. $durability = durability_group($item['durability']);
  42. $command = 'SELECT COUNT(*) FROM monster_inventory WHERE itemname=' . quote_smart($item['itemname']);
  43. $data = fetch_single($command, 'encyclopedia2.php');
  44. $number_in_game = (int)$data['COUNT(*)'];
  45. $command = 'SELECT SUM(quantity) FROM psypets_basement WHERE itemname=' . quote_smart($item['itemname']) . ' GROUP BY itemname';
  46. $data = fetch_single($command, 'encyclopedia2.php');
  47. $number_in_basements = (int)$data['SUM(quantity)'];
  48. $number_in_museum = get_museum_item_count($item['idnum']);
  49. $total_in_existance = $number_in_game + $number_in_basements;
  50. if(substr($item['itemtype'], 0, 10) == 'print/book')
  51. {
  52. $books_in_libraries = fetch_single('
  53. SELECT SUM(quantity) AS q
  54. FROM psypets_libraries
  55. WHERE itemid=' . $item['idnum'] . '
  56. ');
  57. $total_in_existance += (int)$books_in_libraries['q'];
  58. }
  59. $highbid = get_highbid_byitem($item['itemname']);
  60. if(strlen($user['user']) > 0 && $item['custom'] == 'no' && $user['museumcount'] > 0)
  61. {
  62. require_once 'commons/museumlib.php';
  63. $museum_item = get_museum_item($user['idnum'], $item['idnum']);
  64. if($museum_item === false)
  65. $museum_note = true;
  66. else
  67. $donated_to_museum = $museum_item['timestamp'];
  68. }
  69. else
  70. $donated_to_museum = false;
  71. $item_types = take_apart('/', $item['itemtype']);
  72. $these_types = array();
  73. $linked_item_types = array();
  74. foreach($item_types as $type)
  75. {
  76. $these_types[] = $type;
  77. $linked_item_types[] = '<a href="/encyclopedia.php?submit=Search&itemtype=' . implode('/', $these_types) . '">' . $type . '</a>';
  78. }
  79. ?>
  80. <ul>
  81. <li><?= wiki_link($item['itemname']) ?></li>
  82. </ul>
  83. <table class="nomargin">
  84. <tr>
  85. <td valign="top"><img src="/gfx/items/<?= $item['graphic'] ?>" height="32" /></td>
  86. <td>
  87. <p><?= $item['itemname'] ?><br /><?= implode('/', $linked_item_types) ?></p>
  88. <?php
  89. echo '<p style="font-style: italic">';
  90. if($total_in_existance > 0)
  91. {
  92. echo $total_in_existance . ' exist' . ($total_in_existance == 1 ? 's' : '') . ' in the game';
  93. if($number_in_museum > 0)
  94. echo '; ', ($number_in_museum > 1 ? $number_in_museum . ' more have' : '1 more has'), ' been donated to <a href="/museum/donators.php?item=' . $item['idnum'] . '">The Museum</a>';
  95. }
  96. else
  97. {
  98. echo '0 exist in the game';
  99. if($number_in_museum > 0)
  100. echo '; ', ($number_in_museum > 1 ? $number_in_museum . ' have' : '1 has'), ' been donated to <a href="/museum/donators.php?item=' . $item['idnum'] . '">The Museum</a>';
  101. }
  102. echo '.</p>';
  103. echo '</td></tr></table>';
  104. if($museum_note)
  105. echo '<p><i>You have not donated one to <a href="/museum/">The Museum</a> yet.</i></p>';
  106. if(strlen($item['enc_entry']) > 0)
  107. {
  108. echo '<hr />' .
  109. '<p>' . format_text($item['enc_entry']) . '</p>';
  110. }
  111. echo '<hr />';
  112. ?>
  113. <table>
  114. <tr><th>Size / Weight</th><td><?= ($item['bulk'] / 10) . ' / ' . ($item['weight'] / 10) ?></td></tr>
  115. <?php
  116. if($item['durability'] > 0 || $is_equip)
  117. echo '<tr><th>Durability</th><td>' . $durability . ($item['norepair'] == 'yes' ? '; cannot be repaired' : '') . '</td></tr>';
  118. if($user['idnum'] > 0)
  119. {
  120. echo '<tr><th>Profile Display<a href="/help/profile_items.php" class="help">?</a></th><td>';
  121. $profile_display = get_profile_item_ranking($user['idnum'], $item['idnum']);
  122. echo '<select id="ranking">';
  123. for($x = 1000; $x > 0; $x -= 100)
  124. {
  125. $label = ($x / 100);
  126. if($x == 1000)
  127. $label .= ' - highest';
  128. else if($x == 100)
  129. $label .= ' - lowest';
  130. if($x == $profile_display['ranking'])
  131. echo '<option value="' . $x . '" selected>' . $label . '</option>';
  132. else
  133. echo '<option value="' . $x . '">' . $label . '</option>';
  134. }
  135. if($profile_display === false)
  136. echo '<option value="0" selected>None</option>';
  137. else
  138. echo '<option value="0">None</option>';
  139. echo '</select> <span id="enc_throbber" style="display:none;"><img src="/gfx/throbber.gif" alt="waiting..." height="16" weight="16" /></span>';
  140. ?>
  141. <script type="text/javascript">
  142. $(function() {
  143. $('#ranking').change(function() {
  144. $('#ranking').attr('disabled', 'disabled');
  145. $('#enc_throbber').show();
  146. $.post(
  147. '/ajax_profile_item_ranking.php',
  148. {
  149. 'itemid': <?= $item['idnum'] ?>,
  150. 'ranking': $('#ranking').val()
  151. },
  152. function(data)
  153. {
  154. $('#ranking').val(parseInt(data));
  155. $('#ranking').removeAttr('disabled');
  156. $('#enc_throbber').hide();
  157. }
  158. );
  159. });
  160. });
  161. </script>
  162. <?php
  163. } // if logged in
  164. echo '</td></tr>',
  165. '<tr><th>Availability<a href="/help/item_availability.php" class="help">?</a></th><td>', $CUSTOM_DESC[$item['custom']], '</td></tr>',
  166. '</table>';
  167. if($is_recyclable) $properties[] = '<li>Can be <a href="/recycling.php">Recycled</a></li>';
  168. if($is_edible) $properties[] = '<li>Is edible' . ($user['idnum'] > 0 ? ' (see below)' : '') . '</li>';
  169. if($is_equip) $properties[] = '<li>Is a tool for pets<a href="/help/equipment.php" class="help">?</a> (equipment details below)</li>';
  170. if($is_key) $properties[] = '<li>Is a key for pets<a href="/help/equipment.php" class="help">?</a></li>';
  171. if($is_useable) $properties[] = '<li>Can be used: "' . $action[0] . '"</li>';
  172. if($is_toy)
  173. {
  174. $property = '<li>Is a toy: "' . $item['playdesc'] . '"<ul class="nomargin">';
  175. if($item['playbed'] == 'yes')
  176. $property .= '<li>Is a bed</li>';
  177. if($item['playfood'] > 0)
  178. $property .= '<li>Makes pets less hungry</li>';
  179. else if($item['playfood'] < 0)
  180. $property .= '<li class="failure">Makes pets more hungry</li>';
  181. if($item['playsafety'] > 0)
  182. $property .= '<li>Makes pets feel safe</li>';
  183. else if($item['playsafety'] < 0)
  184. $property .= '<li class="failure">Makes pets feel less safe</li>';
  185. if($item['playlove'] > 0)
  186. $property .= '<li>Makes pets feel loved</li>';
  187. else if($item['playlove'] < 0)
  188. $property .= '<li class="failure">Makes pets feel less loved</li>';
  189. if($item['playesteem'] > 0)
  190. $property .= '<li>Makes pets feel esteemed</li>';
  191. else if($item['playesteem'] < 0)
  192. $property .= '<li class="failure">Makes pets feel less esteemed</li>';
  193. if($item['playstat'] != '')
  194. {
  195. if(array_key_exists($item['playstat'], $PET_STAT_DESCRIPTIONS))
  196. $property .= '<li>Teaches ' . $PET_STAT_DESCRIPTIONS[$item['playstat']] . '</li>';
  197. else
  198. $property .= '<li class="failure">Bugged play action. Please let ' . $SETTINGS['author_resident_name'] . ' know.</li>';
  199. }
  200. $property .= '</ul></li>';
  201. $properties[] = $property;
  202. }
  203. if($is_hourly)
  204. {
  205. $property = '<li>Has hourly effects on pets:<ul class="nomargin">';
  206. if($item['hourlyfood'] > 0)
  207. $property .= '<li>Makes pets less hungry</li>';
  208. else if($item['hourlyfood'] < 0)
  209. $property .= '<li class="failure">Makes pets more hungry</li>';
  210. if($item['hourlysafety'] > 0)
  211. $property .= '<li>Makes pets feel safe</li>';
  212. else if($item['hourlysafety'] < 0)
  213. $property .= '<li class="failure">Makes pets feel less safe</li>';
  214. if($item['hourlylove'] > 0)
  215. $property .= '<li>Makes pets feel loved</li>';
  216. else if($item['hourlylove'] < 0)
  217. $property .= '<li class="failure">Makes pets feel less loved</li>';
  218. if($item['hourlyesteem'] > 0)
  219. $property .= '<li>Makes pets feel esteemed</li>';
  220. else if($item['hourlyesteem'] < 0)
  221. $property .= '<li class="failure">Makes pets feel less esteemed</li>';
  222. if($item['hourlystat'] != '')
  223. {
  224. if(array_key_exists($item['hourlystat'], $PET_STAT_DESCRIPTIONS))
  225. $property .= '<li>Teaches ' . $PET_STAT_DESCRIPTIONS[$item['hourlystat']] . '</li>';
  226. else
  227. $property .= '<li class="failure">Bugged hourly action. Please let ' . $SETTINGS['author_resident_name'] . ' know.</li>';
  228. }
  229. $property .= '</ul></li>';
  230. $properties[] = $property;
  231. }
  232. if($item['cursed'] == 'yes') $properties[] = '<li>Is "cursed" (cannot be moved out of the house)</li>';
  233. if($item['cancombine'] == 'yes') $properties[] = '<li>Can be combined at the <a href="/af_combinationstation3.php">Combination Station</a></li>';
  234. if($item['questitem'] == 'yes')
  235. $properties[] = '<li>This item is important! Hold on to it!</li>';
  236. else if($item['nosellback'] == 'yes' && $item['noexchange'] == 'yes')
  237. $properties[] = '<li>This item may not be sold to the game, or exchanged with other players.</li>';
  238. if(count($properties) > 0)
  239. echo '<ul>' . implode('', $properties) . '</ul>';
  240. $pawn_shop = array();
  241. if($can_pawn_with && $can_pawn_for)
  242. $pawn_avail = '<b>Can get</b> at the Pawn Shop;<br /><b>can give</b> to the Pawn Shop (and Greenhouse)';
  243. else if($can_pawn_with)
  244. $pawn_avail = '<b>Cannot get</b> at the Pawn Shop;<br /><b>can give</b> to the Pawn Shop (and Greenhouse)';
  245. else if($can_pawn_for)
  246. $pawn_avail = '<b>Can get</b> at the Pawn Shop;<br /><b>cannot give</b> to the Pawn Shop (or Greenhouse)';
  247. else
  248. $pawn_avail = '<b>Cannot get</b> at the Pawn Shop;<br /><b>cannot give</b> to the Pawn Shop (or Greenhouse)';
  249. echo '
  250. <hr />
  251. <h5>Current Market Information</h5>
  252. <table>
  253. ';
  254. if($item['custom'] == 'yes')
  255. {
  256. $command = 'SELECT markup,ownerid FROM psypets_custom_item_store WHERE itemid=' . $item['idnum'] . ' LIMIT 1';
  257. $selling = $GLOBALS['database']->FetchSingle($command);
  258. if($selling !== false)
  259. {
  260. $seller = get_user_byid($selling['ownerid']);
  261. echo '<tr><th valign="top"><nobr>Custom Item Store Listing</nobr></th><td><a href="/favorstore.php?resident=' . link_safe($seller['display']) . '">' . $seller['display'] . ' is selling copies for ' . ($selling['markup'] + 300) . ' Favor</a></td></tr>';
  262. }
  263. }
  264. ?>
  265. <tr><th valign="top"><nobr>Gamesell Value<a href="/help/gamesell.php" class="help">?</a></nobr></th><td><?= ($item['nosellback'] == 'yes' ? 'may not be sold to the game' : ceil($item['value'] * sellback_rate()) . '<span class="money">m</span>') ?></td></tr>
  266. <tr><th valign="top"><nobr><a href="/pawnshop.php">Pawn Shop</a> Availability</nobr></th><td><?= $pawn_avail ?></td></tr>
  267. <?php
  268. if($item['noexchange'] == 'no')
  269. {
  270. $command = 'SELECT monster_inventory.forsale AS min_price,monster_users.display AS display FROM monster_inventory JOIN monster_users WHERE monster_inventory.user=monster_users.user AND monster_inventory.forsale>0 AND monster_users.openstore=\'yes\' AND monster_inventory.itemname=' . quote_smart($item['itemname']) . ' ORDER BY min_price ASC LIMIT 1';
  271. $fm_item = fetch_single($command, 'marketsquare.php');
  272. if($fm_item === false)
  273. $store_note = 'none';
  274. else
  275. $store_note = '<a href="/userstore.php?user=' . $fm_item['display'] . '">' . $fm_item['min_price'] . '<span class="money">m</span></a> (from ' . resident_link($fm_item['display']) . ')';
  276. $command = 'SELECT idnum,bidvalue FROM monster_auctions WHERE claimed=\'no\' AND bidtime>' . $now . ' AND itemname=' . quote_smart($item['itemname']) . ' ORDER BY bidvalue ASC LIMIT 1';
  277. $ah_item = fetch_single($command, 'fetching lowest bid');
  278. if($ah_item === false)
  279. $auction_note = 'none';
  280. else
  281. $auction_note = '<a href="/auctiondetails.php?auction=' . $ah_item['idnum'] . '">' . $ah_item['bidvalue'] . '<span class="money">m</span></a>';
  282. ?>
  283. <tr><th valign="top"><nobr><a href="/reversemarket.php">Seller's Market</a> High Bid</nobr></th><td><?= $highbid === false ? 'none' : $highbid['bid'] . '<span class="money">m</span>' ?></td></tr>
  284. <tr><th valign="top"><nobr><a href="/auctionhouse.php">Auction House</a> Lowest Bid</nobr></th><td><?= $auction_note ?></td></tr>
  285. <tr><th valign="top"><nobr><a href="/fleamarket/">Flea Market</a> Lowest Offer</nobr></th><td><?= $store_note ?></td></tr>
  286. <?php
  287. }
  288. if($item['nosellback'] == 'no')
  289. {
  290. if($item['is_grocery'] == 'yes')
  291. {
  292. $command = 'SELECT COUNT(idnum) AS c FROM monster_inventory WHERE user=\'grocerystore\' AND itemname=' . quote_smart($item['itemname']);
  293. $data = fetch_single($command, 'fetching refuse store inventory');
  294. $count = (int)$data['c'];
  295. if($count == 0)
  296. echo '<tr><th><a href="/grocerystore_gamesold.php">Farmer\'s Market</a> Inventory</th><td>none</td></tr>';
  297. else
  298. echo '<tr><th><a href="/grocerystore_gamesold.php">Farmer\'s Market</a> Inventory</th><td><a href="/grocerystore_gamesold.php">' . ceil($item['value'] / 5.0 * 4) . '<span class="money">m</span></a> (' . $count . ' available)</td></tr>';
  299. }
  300. else
  301. {
  302. $command = 'SELECT COUNT(idnum) AS c FROM monster_inventory WHERE user=\'ihobbs\' AND itemname=' . quote_smart($item['itemname']);
  303. $data = fetch_single($command, 'fetching refuse store inventory');
  304. $count = (int)$data['c'];
  305. if($count == 0)
  306. echo '<tr><th><a href="/recycling_gamesell.php?letter=' . $item['itemname'][0] . '">Refuse Store</a> Inventory</th><td>none</td></tr>';
  307. else
  308. echo '<tr><th><a href="/recycling_gamesell.php?letter=' . $item['itemname'][0] . '">Refuse Store</a> Inventory</th><td><a href="/recycling_gamesell.php?letter=' . $item['itemname'][0] . '">' . $item['value'] . '<span class="money">m</span></a> (' . $count . ' available)</td></tr>';
  309. }
  310. }
  311. echo '</table>';
  312. if($item['noexchange'] == 'yes')
  313. echo '<p><i>This item may not be exchanged with other players.</i></p>';
  314. else if($item['nomarket'] == 'yes')
  315. echo ' <p><i>This item may not be placed into Basements.</i></p>';
  316. if($is_edible)
  317. {
  318. if($user['idnum'] > 0)
  319. {
  320. echo '<hr /><h5>Meal Information</h5>';
  321. if($item['ediblecaffeine'] > 0)
  322. echo '<ul><li>Contains caffeine<a href="/help/energy.php" class="help">?</a></li></ul>';
  323. if($item['ediblehealing'] > 0)
  324. echo '<ul><li>Has healing properties</li></ul>';
  325. ?>
  326. <table>
  327. <tr class="titlerow">
  328. <th>Pet</th>
  329. <th><nobr>Meal Size</nobr></th>
  330. </tr>
  331. <?php
  332. $rowclass = begin_row_class();
  333. foreach($pets as $pet)
  334. {
  335. if($item['ediblefood'] > 0)
  336. {
  337. $ratio = max_food($pet) / $item['ediblefood'];
  338. if($ratio < .80)
  339. $food_size = 'Too much';
  340. else if($ratio < 1.5)
  341. $food_size = 'A full meal';
  342. else if($ratio < 3)
  343. $food_size = 'A light meal';
  344. else
  345. $food_size = 'A snack';
  346. }
  347. else
  348. $food_size = 'Unfilling';
  349. ?>
  350. <tr class="<?= $rowclass ?>">
  351. <td><?= $pet['petname'] ?></td>
  352. <td><?= $food_size ?></td>
  353. </tr>
  354. <?php
  355. $rowclass = alt_row_class($rowclass);
  356. }
  357. echo '</table>';
  358. } // if logged in
  359. } // if edible
  360. if($is_equip)
  361. {
  362. echo '<hr />';
  363. $bonus = EquipBonusDesc($equip_level);
  364. if($bonus)
  365. echo '<h5>Equipment (' . $bonus . ')</h5>';
  366. else
  367. echo '<h5>Equipment</h5>';
  368. if($item['equip_is_revised'] == 'no')
  369. {
  370. if($item['custom'] == 'yes')
  371. echo '<p>This custom item has not been updated to work with the new equipment system. If you are the creator of this item, <a href="/recombination.php">have it recombined for free!</a></p>';
  372. else
  373. echo '<p>' . $SETTINGS['author_resident_name'] . ' should update this equipment to work with the new equipment system.</p>';
  374. }
  375. $stats = array(
  376. 'str' => 'strength',
  377. 'dex' => 'dexterity',
  378. 'sta' => 'toughness',
  379. 'int' => 'intelligence',
  380. 'per' => 'perception',
  381. 'wit' => 'fast thinking',
  382. 'athletics' => 'athletics',
  383. 'stealth' => 'stealth',
  384. 'fertility' => 'fertility',
  385. 'adventuring' => 'adventuring',
  386. 'hunting' => 'hunting',
  387. 'fishing' => 'fishing',
  388. 'gathering' => 'gathering',
  389. 'lumberjacking' => 'lumberjacking',
  390. 'mining' => 'mining',
  391. 'crafting' => 'handicrafting',
  392. 'tailoring' => 'tailoring',
  393. 'leather' => 'leather-working',
  394. 'painting' => 'painting',
  395. 'jeweling' => 'jeweling',
  396. 'sculpting' => 'sculpting',
  397. 'carpentry' => 'carpenting',
  398. 'smithing' => 'smithing',
  399. 'electronics' => 'electrical engineering',
  400. 'mechanics' => 'mechanical engineering',
  401. 'chemistry' => 'chemistry',
  402. 'binding' => 'magic-binding',
  403. 'gardening' => 'gardening',
  404. 'piloting' => 'airship piloting',
  405. );
  406. echo '<ul>';
  407. if($item['equip_open'] > 0)
  408. echo '<li>Inspires openness!</li>';
  409. else if($item['equip_open'] < 0)
  410. echo '<li>Inspires conservativeness!</li>';
  411. if($item['equip_extraverted'] > 0)
  412. echo '<li>Inspires outgoingness!</li>';
  413. else if($item['equip_extraverted'] < 0)
  414. echo '<li>Inspires introvertedness!</li>';
  415. if($item['equip_conscientious'] > 0)
  416. echo '<li>Inspires conscientiousness!</li>';
  417. else if($item['equip_conscientious'] < 0)
  418. echo '<li>Inspires a laid-back attitude!</li>';
  419. if($item['equip_playful'] > 0)
  420. echo '<li>Inspires playfulness!</li>';
  421. else if($item['equip_playful'] < 0)
  422. echo '<li>Inspires seriousness!</li>';
  423. if($item['equip_independent'] > 0)
  424. echo '<li>Inspires independence!</li>';
  425. else if($item['equip_independent'] < 0)
  426. echo '<li>Inspires dependence!</li>';
  427. foreach($stats as $field=>$stat)
  428. {
  429. $bonus = $item['equip_' . $field];
  430. if($bonus != 0)
  431. echo '<li' . ($bonus < 0 ? ' class="failure"' : '') . '>' . ucfirst(EquipBonusDesc($bonus)) . ' for ' . $stat . '!</li>';
  432. }
  433. if($item['equip_more_dreams'] == 'yes')
  434. echo '<li>Increases the likelihood of remembering dreams</li>';
  435. if($item['equip_goldenmushroom'] == 'yes')
  436. echo '<li>Does something weird (but good!)</li>';
  437. if($item['equip_vampire_slayer'] == 'yes')
  438. echo '<li>Vampires recoil in its presence</li>';
  439. if($item['equip_were_killer'] == 'yes')
  440. echo '<li>Werecreatures recoil in its presence</li>';
  441. if($item['equip_berry_craft'] == 'yes')
  442. echo '<li>Grants an affinity for berries</li>';
  443. if($item['equip_pressurized'] == 'yes')
  444. echo '<li>Protects from very high or very low-pressure environments</li>';
  445. if($item['equip_flight'] == 'yes')
  446. echo '<li>Allows the user to fly</li>';
  447. if($item['equip_fire_immunity'] == 'yes')
  448. echo '<li>Protects from extremely high temperatures</li>';
  449. if($item['equip_chill_touch'] == 'yes')
  450. echo '<li>Chills and freezes things</li>';
  451. if($item['equip_healing'] == 'yes')
  452. echo '<li>Speeds healing</li>';
  453. echo '</ul>';
  454. if($user['idnum'] > 0)
  455. {
  456. ?>
  457. <table>
  458. <tr class="titlerow">
  459. <th>Pet</th>
  460. <th>Can&nbsp;Equip?</th>
  461. </tr>
  462. <?php
  463. $rowclass = begin_row_class();
  464. foreach($pets as $pet)
  465. {
  466. $reason = get_equip_message($item, $pet);
  467. if($reason == '')
  468. $reason = '<td class="success">yes</td>';
  469. else
  470. $reason = '<td class="failure">' . $reason . '</td>';
  471. ?>
  472. <tr class="<?= $rowclass ?>">
  473. <td><?= $pet['petname'] ?></td>
  474. <?= $reason ?>
  475. </tr>
  476. <?php
  477. $rowclass = alt_row_class($rowclass);
  478. }
  479. echo '</table>';
  480. } // if logged in
  481. } // if an equipment
  482. if($number_in_game > 0 && $number_in_game <= 12)
  483. {
  484. $search_time = microtime(true);
  485. $owners = $GLOBALS['database']->FetchMultiple('SELECT user FROM monster_inventory WHERE user!=\'psypets\' AND itemname=' . quote_smart($item['itemname']));
  486. $owner_list = array();
  487. foreach($owners as $owner)
  488. $owner_list[] = $owner['user'];
  489. if(count($owner_list) > 0)
  490. {
  491. $user_list = $GLOBALS['database']->FetchMultiple('
  492. SELECT graphic,is_a_whale,display
  493. FROM monster_users
  494. WHERE user ' . $GLOBALS['database']->In($owner_list) . '
  495. LIMIT ' . count($owner_list) . '
  496. ');
  497. }
  498. else
  499. $user_list = array();
  500. $search_time = microtime(true) - $search_time;
  501. $footer_note = '<br />Took ' . round($search_time, 4) . 's looking up the items\' owners.';
  502. echo '<hr /><h5>Owners</h5>';
  503. if(count($user_list) < $number_in_game)
  504. echo '<p><i>(Copies of the item which are stashed in a Basement will not have their owner reported here.)</i></p>';
  505. if(count($user_list) > 0)
  506. {
  507. echo '<table><tr>';
  508. $count = 0;
  509. foreach($user_list as $this_user)
  510. {
  511. $count++;
  512. echo '<td><img src="' . user_avatar($this_user) . '" alt="" /></td><td style="padding-right: 1em;"><a href="/residentprofile.php?resident=' . link_safe($this_user['display']) . '">' . $this_user['display'] . '</a></td>' . "\n";
  513. if($count % 3 == 0 && $count != count($user_list))
  514. echo '</tr><tr>';
  515. }
  516. echo '</tr></table>';
  517. }
  518. } // if there's between 1 and 12 in the game
  519. }
  520. ?>