コード例 #1
0
 private function hydrateContent($content, $gameId)
 {
     if ($content->content_type == 'Node') {
         $contentDetails = Nodes::getNode($gameId, $content->content_id)->data;
         $content->name = $contentDetails->title;
     } else {
         if ($content->content_type == 'Item') {
             $contentDetails = Items::getItem($gameId, $content->content_id)->data;
             $content->name = $contentDetails->name;
         } else {
             if ($content->content_type == 'Npc') {
                 $contentDetails = Npcs::getNpc($gameId, $content->content_id)->data;
                 $content->name = $contentDetails->name;
             } else {
                 if ($content->content_type == 'WebPage') {
                     $contentDetails = WebPages::getWebPage($gameId, $content->content_id)->data;
                     $content->name = $contentDetails->name;
                     $content->media = NULL;
                     $content->media_id = NULL;
                 } else {
                     if ($content->content_type == 'AugBubble') {
                         $contentDetails = AugBubbles::getAugBubble($gameId, $content->content_id)->data;
                         $content->name = $contentDetails->name;
                         $content->media = NULL;
                         $content->media_id = NULL;
                     } else {
                         if ($content->content_type == 'CustomMap') {
                             $contentDetails = Overlays::getOverlay($gameId, $content->content_id)->data;
                             $content->name = $contentDetails->name;
                         } else {
                             if ($content->content_type == 'PlayerNote') {
                                 $contentDetails = Notes::getNoteById($content->content_id)->data;
                                 $content->name = $contentDetails->title;
                                 $content->icon_media_id = 5;
                                 $content->media = NULL;
                                 $content->media_id = NULL;
                             }
                         }
                     }
                 }
             }
         }
     }
     //Get the Icon Media
     $mediaHelper = new Media();
     $mediaReturnObject = $mediaHelper->getMediaObject($gameId, $contentDetails->icon_media_id);
     $media = $mediaReturnObject->data;
     $content->icon_media = $media;
     $content->icon_media_id = $contentDetails->icon_media_id;
     $content->is_spawnable = Spawnables::hasActiveSpawnable($gameId, $content->content_type, $content->content_id);
     if ($content->content_type != 'WebPage' && $content->content_type != 'PlayerNote' && $content->content_type != 'AugBubble' && $content->content_type != 'CustomMap') {
         //Get the Media
         $mediaHelper = new Media();
         $mediaReturnObject = $mediaHelper->getMediaObject($gameId, $contentDetails->media_id);
         $media = $mediaReturnObject->data;
         $content->media = $media;
         $content->media_id = $contentDetails->media_id;
     }
     /* Depricated
           if ($content->content_type == 'AugBubble'){
        //Get the Alignment Media
        $mediaHelper = new Media;
        $mediaReturnObject = $mediaHelper->getMediaObject($gameId, $contentDetails->alignment_media_id);
        $alignmentMedia = $mediaReturnObject->data;
        $content->alignment_media = $alignmentMedia;
        $content->alignment_media_id = $alignmentMedia->media_id;
        }
         */
     return $content;
 }