示例#1
0
 public function getAllImageMatchEntriesForLocation($gameId, $intLocationID)
 {
     $query = "SELECT match_media_id FROM qrcodes WHERE game_id = {$gameId} AND link_id = {$intLocationID}";
     $result = Module::query($query);
     $medias = array();
     while ($mid = mysql_fetch_object($result)) {
         $medias[] = Media::getMediaObject($gameId, $mid->match_media_id);
     }
     return new returnData(0, $medias);
 }
示例#2
0
 private function getNoteContents($noteId)
 {
     $contentIds = Module::queryArray("SELECT * FROM note_content WHERE note_id = '{$noteId}'");
     $contents = array();
     for ($i = 0; $i < count($contentIds); $i++) {
         $media = Media::getMediaObject($contentIds[$i]->game_id, $contentIds[$i]->media_id)->data;
         $content = new stdClass();
         $content->content_id = $contentIds[$i]->content_id;
         $content->type = $contentIds[$i]->type;
         $content->media_id = $contentIds[$i]->media_id;
         $content->text = $contentIds[$i]->text;
         //LEGACY
         $content->file_path = $media->file_path;
         $content->thumb_file_path = $media->thumb_file_path;
         $content->url_path = $media->url_path;
         $content->url = $media->url;
         $content->thumb_url = $media->thumb_url;
         $contents[] = $content;
     }
     return $contents;
 }
示例#3
0
 private static function getSinglePlayerDataBP($gameId, $playerId, $individual = false, $getItems = true, $getAttributes = true, $getNotes = true)
 {
     $backpack = new stdClass();
     //Get owner information
     $query = "SELECT user_name, display_name, group_name, media_id FROM players WHERE player_id = '{$playerId}'";
     $result = Module::query($query);
     $name = mysql_fetch_object($result);
     if (!$name) {
         return "Invalid Player Id";
     }
     $backpack->owner = new stdClass();
     $backpack->owner->user_name = $name->user_name;
     $backpack->owner->display_name = $name->display_name;
     $backpack->owner->group_name = $name->group_name;
     $backpack->owner->player_id = $playerId;
     $playerpic = Media::getMediaObject('player', $name->media_id)->data;
     if ($playerpic) {
         $backpack->owner->player_pic_url = $playerpic->url_path . $playerpic->file_path;
         $backpack->owner->player_pic_thumb_url = $playerpic->url_path . $playerpic->thumb_file_path;
     } else {
         $backpack->owner->player_pic_url = null;
         $backpack->owner->player_pic_thumb_url = null;
     }
     /* ATTRIBUTES */
     if ($getAttributes) {
         $backpack->attributes = Items::getDetailedPlayerAttributes($playerId, $gameId);
     }
     /* OTHER ITEMS */
     if ($getItems) {
         $backpack->items = Items::getDetailedPlayerItems($playerId, $gameId);
     }
     /* NOTES */
     if ($getNotes) {
         $backpack->notes = Notes::getDetailedPlayerNotes($playerId, $gameId, $individual);
     }
     return $backpack;
 }
示例#4
0
文件: notes.php 项目: kimblemj/server
 function getNoteContents($noteId, $gameId)
 {
     $query = "SELECT * FROM note_content WHERE note_id = '{$noteId}'";
     $result = Module::query($query);
     if (mysql_error()) {
         return new returnData(1, NULL, mysql_error());
     }
     $contents = array();
     while ($content = mysql_fetch_object($result)) {
         $content->media = Media::getMediaObject($gameId, $content->media_id);
         $contents[] = $content;
     }
     return $contents;
 }
示例#5
0
 public function getFullGameObject($gameId, $intPlayerId, $boolGetLocationalInfo = 0, $intSkipAtDistance = 99999999, $latitude = 0, $longitude = 0)
 {
     $gameObj = Module::queryObject("SELECT * FROM games WHERE game_id = '{$gameId}' LIMIT 1");
     //Check if Game Has Been Played
     $query = "SELECT * FROM player_log WHERE game_id = '{$gameId}' AND player_id = '{$intPlayerId}' AND deleted = 0 LIMIT 1";
     $result = Module::query($query);
     if (mysql_num_rows($result) > 0) {
         $gameObj->has_been_played = true;
     } else {
         $gameObj->has_been_played = false;
     }
     //Get Locational Stuff
     if ($boolGetLocationalInfo) {
         if ($gameObj->is_locational == true) {
             $nearestLocation = Games::getNearestLocationOfGameToUser($latitude, $longitude, $gameId);
             $gameObj->latitude = $nearestLocation->latitude;
             $gameObj->longitude = $nearestLocation->longitude;
             $gameObj->distance = $nearestLocation->distance;
             if ($gameObj->distance == NULL || $gameObj->distance > $intSkipAtDistance) {
                 return NULL;
             }
         } else {
             $gameObj->latitude = 0;
             $gameObj->longitude = 0;
             $gameObj->distance = 0;
         }
     }
     //Get Quest Stuff
     //$questsReturnData = Quests::getQuestsForPlayer($gameId, $intPlayerId);
     //$gameObj->totalQuests = $questsReturnData->data->totalQuests;
     //$gameObj->completedQuests = count($questsReturnData->data->completed);
     //Get Editors
     $query = "SELECT editors.* FROM editors, game_editors\n            WHERE game_editors.editor_id = editors.editor_id\n            AND game_editors.game_id = {$gameId}";
     $editorsRs = Module::query($query);
     $editor = @mysql_fetch_array($editorsRs);
     $editorsString = $editor['name'];
     while ($editor = @mysql_fetch_array($editorsRs)) {
         $editorsString .= ', ' . $editor['name'];
     }
     $gameObj->editors = $editorsString;
     //Get Num Players
     $query = "SELECT * FROM players\n            WHERE last_game_id = {$gameId}";
     $playersRs = Module::query($query);
     $gameObj->numPlayers = @mysql_num_rows($playersRs);
     //Get the media URLs
     //Icon
     $icon_media_data = Media::getMediaObject($gameId, $gameObj->icon_media_id);
     $icon_media = $icon_media_data->data;
     $gameObj->icon_media_url = $icon_media->url_path . $icon_media->file_path;
     //Media
     $media_data = Media::getMediaObject($gameId, $gameObj->media_id);
     $media = $media_data->data;
     $gameObj->media_url = $media->url_path . $media->file_path;
     //Calculate the rating
     $query = "SELECT AVG(rating) AS rating FROM game_comments WHERE game_id = {$gameId}";
     $avRs = Module::query($query);
     $avRecord = @mysql_fetch_object($avRs);
     $gameObj->rating = $avRecord->rating;
     if ($gameObj->rating == NULL) {
         $gameObj->rating = 0;
     }
     //Getting Comments
     $query = "SELECT * FROM game_comments WHERE game_id = {$gameId}";
     $result = Module::query($query);
     $comments = array();
     $x = 0;
     while ($row = mysql_fetch_assoc($result)) {
         $comments[$x]->playerId = $row['player_id'];
         $query = "SELECT user_name FROM players WHERE player_id = '{$comments[$x]->playerId}'";
         $player = Module::query($query);
         $playerOb = mysql_fetch_assoc($player);
         $comments[$x]->username = $playerOb['user_name'];
         $comments[$x]->rating = $row['rating'];
         $comments[$x]->text = $row['comment'] == 'Comment' ? "" : $row['comment'];
         $x++;
     }
     $gameObj->comments = $comments;
     //Calculate score
     $gameObj->calculatedScore = ($gameObj->rating - 3) * $x;
     $gameObj->numComments = $x;
     return $gameObj;
 }
 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;
 }
示例#7
0
 public function getPlayerLogs($glob)
 {
     ini_set('display_errors', 1);
     error_reporting(E_ALL);
     //Grrr amfphp should take care of this...
     $data = file_get_contents("php://input");
     $glob = json_decode($data);
     $reqOutputFormat = $glob->output_format;
     $reqOutputToFile = $glob->output_to_file;
     $reqOutputFilename = $glob->output_filename;
     $reqGameId = $glob->game_id;
     $reqEditorId = $glob->editor_id;
     $reqEditorToken = $glob->editor_token;
     $reqGroup = $glob->groupname;
     $reqPlayers = $glob->players;
     $reqPlayer = $glob->player;
     $reqStartDate = $glob->start_date;
     $reqEndDate = $glob->end_date;
     $reqGetExpired = $glob->get_expired;
     $reqVerbose = $glob->verbose;
     $iknowwhatimdoing = $glob->i_know_what_im_doing == "yes";
     //minimal level of "security" to prevent massive data requests
     if ($iknowwhatimdoing) {
         set_time_limit(0);
         ignore_user_abort(1);
     }
     //validation
     $expectsNotice = 'Expects JSON argument of minimal form: {"output_format":"json","game_id":1,"editor_id":1,"editor_token":"abc123"}';
     if (!is_string($reqOutputFormat)) {
         $reqOutputFormat = "json";
     } else {
         $reqOutputFormat = strToLower($reqOutputFormat);
     }
     if ($reqOutputFormat != "json" && $reqOutputFormat != "csv" && $reqOutputFormat != "xml") {
         return new returnData(1, NULL, "Error- Invalid output format (" . $reqOutputFormat . ")\n" . $expectsNotice);
     }
     if (is_numeric($reqOutputToFile)) {
         $reqOutputToFile = intval($reqOutputToFile);
     } else {
         $reqOutputToFile = 0;
     }
     if (!is_string($reqOutputFilename)) {
         $reqOutputFilename = $reqOutputToFile ? "mostrecentlogrequest" : "tmpmostrecentlogrequest";
     }
     if (is_numeric($reqGameId)) {
         $reqGameId = intval($reqGameId);
     } else {
         return new returnData(1, NULL, "Error- Empty Game (" . $reqGameId . ")\n" . $expectsNotice);
     }
     if (is_numeric($reqEditorId)) {
         $reqEditorId = intval($reqEditorId);
     } else {
         return new returnData(1, NULL, "Error- Empty Editor (" . $reqEditorId . ")\n" . $expectsNotice);
     }
     if (!is_string($reqEditorToken)) {
         return new returnData(1, NULL, "Error- Invalid EditorToken (" . $reqEditorToken . ")\n" . $expectsNotice);
     }
     if (!Module::authenticateGameEditor($reqGameId, $reqEditorId, $reqEditorToken, "read_write")) {
         return new returnData(6, NULL, "Failed Authentication");
     }
     $filterMode = "none";
     if (is_string($reqGroup)) {
         $filterMode = "group";
     }
     if (is_array($reqPlayers)) {
         $filterMode = "players";
     }
     if (is_numeric($reqPlayer)) {
         $filterMode = "player";
     }
     if (!preg_match("/\\d{4}-\\d{2}-\\d{2} \\d{2}:\\d{2}:\\d{2}/", $reqStartDate)) {
         $reqStartDate = "0000-00-00 00:00:00";
     }
     if (!preg_match("/\\d{4}-\\d{2}-\\d{2} \\d{2}:\\d{2}:\\d{2}/", $reqEndDate)) {
         $reqEndDate = "9999-00-00 00:00:00";
     }
     if (!$iknowwhatimdoing && floor(abs(strtotime($reqEndDate) - strtotime($reqStartDate)) / (60 * 60 * 24 * 31)) > 0) {
         return new returnData(1, NULL, "Please don't ask for more than a month of data at a time!");
     }
     if (!is_numeric($reqGetExpired)) {
         $reqGetExpired = 0;
     } else {
         if (intval($reqGetExpired) > 0) {
             $reqGetExpired = 1;
         }
     }
     if (!is_numeric($reqVerbose)) {
         $reqVerbose = 0;
     } else {
         if (intval($reqVerbose) > 0) {
             $reqVerbose = 1;
         }
     }
     $playerLogs = array();
     if ($filterMode == "group") {
         $p = Module::queryArray("SELECT player_id, display_name, media_id, group_name from players WHERE group_name = '{$reqGroup}'");
         for ($i = 0; $i < count($p); $i++) {
             $log = new stdClass();
             $log->player = $p[$i];
             if ($log->player->display_name == "") {
                 $log->player->display_name = $log->player->user_name;
             }
             $log->player->pic_url = Media::getMediaObject("player", $p[$i]->media_id)->data->url;
             $playerLogs[] = $log;
         }
     } else {
         if ($filterMode == "players") {
             for ($i = 0; $i < count($reqPlayers); $i++) {
                 $p = Module::queryObject("SELECT player_id, display_name, media_id, group_name from players WHERE player_id = '{$reqPlayers[$i]}'");
                 $log = new stdClass();
                 $log->player = $p;
                 if ($log->player->display_name == "") {
                     $log->player->display_name = $log->player->user_name;
                 }
                 $log->player->pic_url = Media::getMediaObject("player", $p->media_id)->data->url;
                 $playerLogs[] = $log;
             }
         } else {
             if ($filterMode == "player") {
                 $p = Module::queryObject("SELECT player_id, display_name, media_id, group_name from players WHERE player_id = '{$reqPlayer}'");
                 $log = new stdClass();
                 $log->player = $p;
                 if ($log->player->display_name == "") {
                     $log->player->display_name = $log->player->user_name;
                 }
                 $log->player->pic_url = Media::getMediaObject("player", $p->media_id)->data->url;
                 $playerLogs[] = $log;
             } else {
                 $r = Module::queryArray("SELECT player_id FROM player_log WHERE game_id = '{$reqGameId}' AND timestamp BETWEEN '{$reqStartDate}' AND '{$reqEndDate}' AND (deleted = 0 OR deleted = {$reqGetExpired}) GROUP BY player_id");
                 for ($i = 0; $i < count($r); $i++) {
                     $p = Module::queryObject("SELECT player_id, user_name, display_name, media_id, group_name from players WHERE player_id = '{$r[$i]->player_id}'");
                     if (!$p) {
                         continue;
                     }
                     $log = new stdClass();
                     $log->player = $p;
                     if ($log->player->display_name == "") {
                         $log->player->display_name = $log->player->user_name;
                     }
                     $log->player->pic_url = Media::getMediaObject("player", intval($p->media_id))->data->url;
                     $playerLogs[] = $log;
                 }
             }
         }
     }
     //caches for quick content construction
     $questsA = Module::queryArray("SELECT quest_id, name FROM quests WHERE game_id = '{$reqGameId}'");
     $questsH = array();
     for ($i = 0; $i < count($questsA); $i++) {
         $questsH[$questsA[$i]->quest_id] = $questsA[$i];
     }
     $itemsA = Module::queryArray("SELECT item_id, name FROM items WHERE game_id = '{$reqGameId}'");
     $itemsH = array();
     for ($i = 0; $i < count($itemsA); $i++) {
         $itemsH[$itemsA[$i]->item_id] = $itemsA[$i];
     }
     $nodesA = Module::queryArray("SELECT node_id, title FROM nodes WHERE game_id = '{$reqGameId}'");
     $nodesH = array();
     for ($i = 0; $i < count($nodesA); $i++) {
         $nodesH[$nodesA[$i]->node_id] = $nodesA[$i];
     }
     $npcsA = Module::queryArray("SELECT npc_id, name FROM npcs WHERE game_id = '{$reqGameId}'");
     $npcsH = array();
     for ($i = 0; $i < count($npcsA); $i++) {
         $npcsH[$npcsA[$i]->npc_id] = $npcsA[$i];
     }
     $webpagesA = Module::queryArray("SELECT web_page_id, name FROM web_pages WHERE game_id = '{$reqGameId}'");
     $webpagesH = array();
     for ($i = 0; $i < count($webpagesA); $i++) {
         $webpagesH[$webpagesA[$i]->web_page_id] = $webpagesA[$i];
     }
     $locationsA = Module::queryArray("SELECT location_id, name FROM locations WHERE game_id = '{$reqGameId}'");
     $locationsH = array();
     for ($i = 0; $i < count($locationsA); $i++) {
         $locationsH[$locationsA[$i]->location_id] = $locationsA[$i];
     }
     $qrcodesA = Module::queryArray("SELECT qrcode_id, link_id, code FROM qrcodes WHERE game_id = '{$reqGameId}'");
     $qrcodesH = array();
     for ($i = 0; $i < count($qrcodesA); $i++) {
         $qrcodesH[$qrcodesA[$i]->code] = $qrcodesA[$i];
     }
     $webhooksA = Module::queryArray("SELECT web_hook_id, name FROM web_hooks WHERE game_id = '{$reqGameId}'");
     $webhooksH = array();
     for ($i = 0; $i < count($webhooksA); $i++) {
         $webhooksH[$webhooksA[$i]->web_hook_id] = $webhooksA[$i];
     }
     //used to segment writes so not too much memory is used
     $pagesize = 1000;
     $i = 0;
     $output_filename = Config::gamedataFSPath . "/" . $reqGameId . "/" . addslashes($reqOutputFilename) . "." . $reqOutputFormat;
     $output_fileurl = Config::gamedataWWWPath . "/" . $reqGameId . "/" . addslashes($reqOutputFilename) . "." . $reqOutputFormat;
     file_put_contents($output_filename, "", 0);
     //clear output file
     while ($i < count($playerLogs)) {
         $playerLogs[$i]->log = array();
         $r = Module::queryArray("SELECT * FROM player_log WHERE player_id = '{$playerLogs[$i]->player->player_id}' AND game_id = '{$reqGameId}' AND timestamp BETWEEN '{$reqStartDate}' AND '{$reqEndDate}' AND (deleted = 0 OR deleted = {$reqGetExpired});");
         for ($j = 0; $j < count($r); $j++) {
             $row = new stdClass();
             switch ($r[$j]->event_type) {
                 case "PICKUP_ITEM":
                     $row->event = "Received Item";
                     $row->object = $itemsH[$r[$j]->event_detail_1]->name;
                     $row->qty = $r[$j]->event_detail_2;
                     $row->timestamp = $r[$j]->timestamp;
                     $row->human = $playerLogs[$i]->player->display_name . " received " . $row->qty . " " . $row->object . " (Item).";
                     break;
                 case "DROP_ITEM":
                 case "DESTROY_ITEM":
                     $row->event = "Lost Item";
                     $row->object = $itemsH[$r[$j]->event_detail_1]->name;
                     $row->qty = $r[$j]->event_detail_2;
                     $row->timestamp = $r[$j]->timestamp;
                     $row->human = $playerLogs[$i]->player->display_name . " lost " . $row->qty . " " . $row->object . " (Item).";
                     break;
                 case "VIEW_ITEM":
                     $row->event = "Viewed Item";
                     $row->object = $itemsH[$r[$j]->event_detail_1]->name;
                     $row->timestamp = $r[$j]->timestamp;
                     $row->human = $playerLogs[$i]->player->display_name . " viewed " . $row->object . " (Item).";
                     break;
                 case "VIEW_NODE":
                     $row->event = "Viewed Node";
                     $row->object = $nodesH[$r[$j]->event_detail_1]->title;
                     $row->timestamp = $r[$j]->timestamp;
                     $row->human = $playerLogs[$i]->player->display_name . " viewed " . $row->object . " (Node).";
                     break;
                 case "VIEW_NPC":
                     $row->event = "Viewed NPC";
                     $row->object = $npcsH[$r[$j]->event_detail_1]->name;
                     $row->timestamp = $r[$j]->timestamp;
                     $row->human = $playerLogs[$i]->player->display_name . " viewed " . $row->object . " (Npc).";
                     break;
                 case "VIEW_WEBPAGE":
                     $row->event = "Viewed Web Page";
                     $row->object = $webpagesH[$r[$j]->event_detail_1]->name;
                     $row->timestamp = $r[$j]->timestamp;
                     $row->human = $playerLogs[$i]->player->display_name . " viewed " . $row->object . " (Web Page).";
                     break;
                 case "ENTER_QRCODE":
                     $row->event = "Entered QR";
                     $row->code = $r[$j]->event_detail_1;
                     $row->object = $locationsH[$qrcodesH[$r[$j]->event_detail_1]->link_id]->name;
                     $row->timestamp = $r[$j]->timestamp;
                     $row->human = $playerLogs[$i]->player->display_name . " scanned " . $row->object . ".";
                     break;
                 case "COMPLETE_QUEST":
                     $row->event = "Completed Quest";
                     $row->object = $questsH[$r[$j]->event_detail_1]->name;
                     $row->timestamp = $r[$j]->timestamp;
                     $row->human = $playerLogs[$i]->player->display_name . " completed quest '" . $row->object . "'.";
                     break;
                 case "VIEW_MAP":
                     $row->event = "Viewed Map";
                     $row->timestamp = $r[$j]->timestamp;
                     $row->human = $playerLogs[$i]->player->display_name . " viewed the map.";
                     break;
                 case "VIEW_QUESTS":
                     $row->event = "Viewed Quests";
                     $row->timestamp = $r[$j]->timestamp;
                     $row->human = $playerLogs[$i]->player->display_name . " viewed the quests.";
                     break;
                 case "VIEW_INVENTORY":
                     $row->event = "Viewed Inventory";
                     $row->timestamp = $r[$j]->timestamp;
                     $row->human = $playerLogs[$i]->player->display_name . " viewed the inventory.";
                     break;
                 case "MOVE":
                     $row->event = "Moved";
                     $row->lat = $r[$j]->event_detail_1;
                     $row->lon = $r[$j]->event_detail_2;
                     $row->timestamp = $r[$j]->timestamp;
                     $row->human = $playerLogs[$i]->player->display_name . " moved to (" . $row->lat . ($reqOutputFormat == "csv" ? " " : ",") . $row->lon . ")";
                     break;
                 case "RECEIVE_WEBHOOK":
                     $row->event = "Received Hook";
                     $row->object = $webhooksH[$r[$j]->event_detail_1]->name;
                     $row->timestamp = $r[$j]->timestamp;
                     $row->human = $playerLogs[$i]->player->display_name . " received hook '" . $row->object . "'";
                     break;
                 default:
                     $row->event = $r[$j]->event_type;
                     $row->timestamp = $r[$j]->timestamp;
                     $row->human = $playerLogs[$i]->player->display_name . " " . $row->event;
                     break;
             }
             if ($reqVerbose) {
                 $row->raw = new stdClass();
                 $row->raw->id = $r[$j]->id;
                 $row->raw->player_id = $r[$j]->player_id;
                 $row->raw->game_id = $r[$j]->game_id;
                 $row->raw->timestamp = $r[$j]->timestamp;
                 $row->raw->event_type = $r[$j]->event_type;
                 $row->raw->event_detail_1 = $r[$j]->event_detail_1;
                 $row->raw->event_detail_2 = $r[$j]->event_detail_2;
                 $row->raw->event_detail_3 = $r[$j]->event_detail_3;
                 $row->raw->deleted = $r[$j]->deleted;
             }
             $playerLogs[$i]->log[] = $row;
         }
         if ($reqOutputFormat == "json") {
             $json = "";
             if ($i == 0) {
                 $json .= "[";
             } else {
                 $json .= ",";
             }
             $json .= json_encode($playerLogs[$i]);
             file_put_contents($output_filename, $json, FILE_APPEND);
         }
         if ($reqOutputFormat == "csv") {
             $csv = "";
             if ($i == 0) {
                 $csv .= "group_name,";
                 $csv .= "player_id,";
                 $csv .= "display_name,";
                 $csv .= "timestamp,";
                 $csv .= "human" . ($reqVerbose ? "," : "\n");
                 if ($reqVerbose) {
                     $csv .= "player_log_id,";
                     $csv .= "player_id,";
                     $csv .= "game_id,";
                     $csv .= "timestamp,";
                     $csv .= "event_type,";
                     $csv .= "event_detail_1,";
                     $csv .= "event_detail_2,";
                     $csv .= "event_detail_3,";
                     $csv .= "deleted\n";
                 }
             }
             for ($j = 0; $j < count($playerLogs[$i]->log); $j++) {
                 $csv .= $playerLogs[$i]->player->group_name . ",";
                 $csv .= $playerLogs[$i]->player->player_id . ",";
                 $csv .= $playerLogs[$i]->player->display_name . ",";
                 $csv .= $playerLogs[$i]->log[$j]->timestamp . ",";
                 $csv .= $playerLogs[$i]->log[$j]->human . ($reqVerbose ? "," : "\n");
                 if ($reqVerbose) {
                     $csv .= $playerLogs[$i]->log[$j]->raw->id . ",";
                     $csv .= $playerLogs[$i]->log[$j]->raw->player_id . ",";
                     $csv .= $playerLogs[$i]->log[$j]->raw->game_id . ",";
                     $csv .= $playerLogs[$i]->log[$j]->raw->timestamp . ",";
                     $csv .= $playerLogs[$i]->log[$j]->raw->event_type . ",";
                     $csv .= $playerLogs[$i]->log[$j]->raw->event_detail_1 . ",";
                     $csv .= $playerLogs[$i]->log[$j]->raw->event_detail_2 . ",";
                     $csv .= $playerLogs[$i]->log[$j]->raw->event_detail_3 . ",";
                     $csv .= $playerLogs[$i]->log[$j]->raw->deleted . "\n";
                 }
             }
             file_put_contents($output_filename, $csv, FILE_APPEND);
         }
         $playerLogs[$i]->log = array();
         //clear data to save memory
         $i++;
     }
     if ($reqOutputFormat == "json" && count($playerLogs) > 0) {
         //closing ]
         file_put_contents($output_filename, "]", FILE_APPEND);
     }
     if ($reqOutputToFile) {
         return new returnData(0, $output_fileurl);
     } else {
         //literally json decodes valid json data so the framework can re-encode it...
         return new returnData(0, json_decode(file_get_contents(Config::gamedataFSPath . "/" . $reqGameId . "/" . addslashes($reqOutputFilename) . "." . $reqOutputFormat)));
     }
 }