Ejemplo n.º 1
0
 public static function getDetailedPlayerItems($playerId, $gameId)
 {
     /* OTHER ITEMS */
     $query = "SELECT DISTINCT i.item_id, i.name, i.description, i.max_qty_in_inventory, i.weight, i.type, i.url, pi.qty, m.file_path as media_url, m.game_id as media_game_id, im.file_path as icon_url, im.game_id as icon_game_id FROM (SELECT * FROM player_items WHERE game_id={$gameId} AND player_id = {$playerId}) as pi LEFT JOIN (SELECT * FROM items WHERE game_id = {$gameId}) as i ON pi.item_id = i.item_id LEFT JOIN media as m ON i.media_id = m.media_id LEFT JOIN media as im ON i.icon_media_id = im.media_id WHERE i.type != 'ATTRIB' GROUP BY i.item_id";
     $result = Module::query($query);
     $contents = array();
     while ($content = mysql_fetch_object($result)) {
         if ($content->media_url) {
             $content->media_url = Config::gamedataWWWPath . '/' . $content->media_url;
             $content->media_thumb_url = substr($content->media_url, 0, strrpos($content->media_url, '.')) . '_128' . substr($content->media_url, strrpos($content->media_url, '.'));
         }
         if ($content->icon_url) {
             $content->icon_url = Config::gamedataWWWPath . '/' . $content->icon_url;
             $content->icon_thumb_url = substr($content - icon_url, 0, strrpos($content - icon_url, '.')) . '_128' . substr($content - icon_url, strrpos($content - icon_url, '.'));
         }
         $content->tags = Items::getItemTags($content->item_id)->data;
         $contents[] = $content;
     }
     return $contents;
 }