Exemplo n.º 1
0
 /**
  * @param $location_id
  * @return \Symfony\Component\HttpFoundation\JsonResponse
  */
 public function loadLocation($location_id)
 {
     $location = $this->em->find('riki34GameBundle:Location', $location_id);
     $res = $this->jsonLoader->loadFile($location->getFile());
     $location->setRes($res);
     $resources = array();
     $resources['NPC'] = JSONTransformer::arrayToJsonArray($this->em->getRepository('riki34GameBundle:NPC')->findBy(array('id' => $res['NPC'])));
     $resources['monsters'] = JSONTransformer::arrayToJsonArray($this->em->getRepository('riki34GameBundle:Monster')->findBy(array('id' => $res['monsters'])));
     $resources['decorations'] = JSONTransformer::arrayToJsonArray($this->em->getRepository('riki34GameBundle:Decoration')->findBy(array('id' => $res['decorations'])));
     $location->setResources($resources);
     return $location->getInArray();
 }
Exemplo n.º 2
0
 public function getInArray()
 {
     return array('id' => $this->id, 'name' => $this->name, 'created' => $this->created->format('Y-m-d H:i:s'), 'bag' => $this->bag, 'agility' => $this->agility, 'energy' => $this->energy, 'energyRegeneration' => $this->energyRegeneration, 'experience' => $this->experience, 'fraction' => $this->fraction, 'guild' => $this->guild, 'hp' => $this->hp, 'hpRegeneration' => $this->hpRegeneration, 'intelligence' => $this->intelligence, 'level' => $this->level, 'location' => $this->location, 'model' => $this->model, 'mp' => $this->mp, 'mpRegeneration' => $this->mpRegeneration, 'sex' => $this->sex, 'skills' => JSONTransformer::arrayToJsonArray($this->skills), 'specialization' => $this->specialization, 'strength' => $this->strength, 'userID' => $this->userID);
 }
Exemplo n.º 3
0
 /**
  * @param array|ConstraintViolationListInterface $messages
  * @return JsonResponse
  */
 public function generateErrorResponse($messages = array())
 {
     return new JsonResponse(array('error' => 1, 'object' => false, 'messages' => $messages instanceof ConstraintViolationListInterface ? JSONTransformer::errorsToJson($messages) : $messages));
 }
Exemplo n.º 4
0
 public function getInArray()
 {
     $resources = array();
     $resources['NPC'] = JSONTransformer::arrayToJsonArray($this->resources['NPC']);
     $resources['monsters'] = JSONTransformer::arrayToJsonArray($this->resources['monsters']);
     $resources['decorations'] = JSONTransformer::arrayToJsonArray($this->resources['decorations']);
     return array('id' => $this->id, 'name' => $this->name, 'file' => $this->file, 'height' => $this->height, 'width' => $this->width, 'levelRequired' => $this->levelRequired, 'resources' => $resources, 'res' => $this->res);
 }
Exemplo n.º 5
0
 /**
  * @return array
  */
 public function getInArray()
 {
     return array('id' => $this->id, 'name' => $this->name, 'active' => $this->active, 'avatar' => $this->avatar, 'chars' => JSONTransformer::getSingleInArray($this->chars), 'deleted' => $this->deleted, 'email' => $this->email, 'gainedAchievements' => JSONTransformer::arrayToJsonArray($this->gainedAchievements), 'languageID' => $this->languageID, 'lastactive' => $this->lastactive->format('Y-m-d H:i:s'), 'skype' => $this->skype, 'surname' => $this->surname, 'username' => $this->username, 'registered' => $this->registered->format('Y-m-d H:i:s'));
 }
Exemplo n.º 6
0
 public function getInArray()
 {
     return array('id' => $this->id, 'description' => $this->description, 'boss' => $this->boss, 'bossID' => $this->bossID, 'loot' => JSONTransformer::arrayToJsonArray($this->loot), 'lootCount' => $this->lootCount, 'lootID' => $this->lootID, 'monster' => $this->monster->getInArray(), 'monsterCount' => $this->monsterCount, 'monsterID' => $this->monsterID, 'playerCount' => $this->playerCount, 'playerFraction' => $this->playerFraction->getInArray(), 'playerFractionID' => $this->playerFractionID);
 }
Exemplo n.º 7
0
 /**
  * @Route("/api/get/chars", name="get_user_chars", options={"expose"=true})
  * @Security("has_role('ROLE_USER')")
  * @Method({"GET"})
  * @return JsonResponse
  */
 public function indexAction()
 {
     /** @var User $user */
     $user = $this->getUser();
     return new JsonResponse(JSONTransformer::arrayToJsonArray($user->getChars()));
 }
Exemplo n.º 8
0
 public function getInArray()
 {
     return array('id' => $this->id, 'armors' => JSONTransformer::arrayToJsonArray($this->armors), 'capacity' => $this->capacity, 'charID' => $this->charID, 'items' => JSONTransformer::arrayToJsonArray($this->items), 'weapons' => JSONTransformer::arrayToJsonArray($this->weapons));
 }