Example #1
0
 public static function getPokemon($where = null, $order = null, $limit = null)
 {
     if (!is_null($where)) {
         $where = ' WHERE ' . $where;
     }
     if (!is_null($order)) {
         $order = ' ORDER BY ' . $order;
     }
     if (!is_null($limit)) {
         $limit = ' LIMIT ' . $limit;
     }
     $getPokemon = TPP::db()->query("SELECT\r\n\t\t\tp.`id`, p.`pokemon`, p.`name`, p.`level`, p.`nickname`, p.`gender`, p.`hold_item`, p.`status`, p.`box_id`, p.`poke_ball`, p.`comment`,\r\n\t\t\tGROUP_CONCAT(DISTINCT m.`name` SEPARATOR ',') as `moves`,\r\n\t\t\ts.`status` as `status_name`\r\n\t\t\tFROM `pokemon` p\r\n\t\t\tLEFT JOIN `move` m\r\n\t\t\tON m.`pokemon` = p.`id`\r\n\t\t\tJOIN `status` s\r\n\t\t\tON s.`id` = p.`status`\r\n\t\t\t" . $where . " GROUP BY p.`id`" . $order . $limit) or die(TPP::db()->error);
     while ($pok = $getPokemon->fetch_assoc()) {
         $newPokemon = new self();
         $newPokemon->setAttributes(array('id' => $pok['id'], 'name' => $newPokemon->setName($pok['name'], $pok['pokemon']), 'pokemon' => $newPokemon->setPokemon($pok['pokemon']), 'level' => $newPokemon->setLevel($pok['level']), 'nickname' => $newPokemon->setNickname($pok['nickname']), 'poke_ball' => $newPokemon->setPokeBall($pok['poke_ball']), 'gender' => $newPokemon->setGender($pok['gender']), 'hold_item' => $newPokemon->setHoldItem($pok['hold_item']), 'status' => $pok['status_name'], 'comment' => FuncHelp::getDateTime($pok['comment']), 'moves' => $newPokemon->setMoves($pok['moves'])));
         $newPokemon->setAttributes($newPokemon->getFields());
         $return[] = $newPokemon;
     }
     return $return;
 }
Example #2
0
 public static function queryPokemon($where = null, $order = null, $limit = null)
 {
     if (!is_null($where)) {
         $where = ' WHERE ' . $where;
     }
     if (!is_null($order)) {
         $order = ' ORDER BY ' . $order;
     }
     if (!is_null($limit)) {
         $limit = ' LIMIT ' . $limit;
     }
     $getPokemon = TPP::db()->query("SELECT\n\t\t\tp.`id`, p.`pokemon`, p.`name`, p.`level`, p.`nickname`, p.`gender`, p.`hold_item`, p.`status`, p.`box_id`, p.`poke_ball`, p.`comment`,\n\t\t\tGROUP_CONCAT(DISTINCT m.`name` SEPARATOR ',') AS `moves`,\n\t\t\ts.`status` AS `status_name`\n\t\t\tFROM `pokemon` p\n\t\t\tLEFT JOIN `move` m\n\t\t\tON m.`pokemon` = p.`id`\n\t\t\tJOIN `status` s\n\t\t\tON s.`id` = p.`status`\n\t\t\t" . $where . " GROUP BY p.`id`" . $order . $limit);
     $return = [];
     while ($pok = $getPokemon->fetch()) {
         $newPokemon = new self();
         $newPokemon->setAttributes(['id' => $pok['id'], 'name' => $newPokemon->setName($pok['name'], $pok['pokemon']), 'pokemon' => $newPokemon->setPokemon($pok['pokemon']), 'level' => $newPokemon->setLevel($pok['level']), 'nickname' => $newPokemon->setNickname($pok['nickname']), 'poke_ball' => $newPokemon->setPokeBall($pok['poke_ball']), 'gender' => $newPokemon->setGender($pok['gender']), 'hold_item' => $newPokemon->setHoldItem($pok['hold_item']), 'box' => (int) $pok['box_id'], 'status' => $pok['status_name'], 'comment' => Helper::getDateTime($pok['comment']), 'moves' => $newPokemon->setMoves($pok['moves'])]);
         $return[$newPokemon->id] = $newPokemon;
     }
     $return = self::getFieldsAll($return);
     return $return;
 }
 /**
  * {@inheritdoc}
  */
 public static function fromArray(array $values)
 {
     $message = new self();
     $values = array_merge(['pokemon_id' => null, 'nickname' => null], $values);
     $message->setPokemonId($values['pokemon_id']);
     $message->setNickname($values['nickname']);
     return $message;
 }
Example #4
0
 /**
  * {@inheritdoc}
  */
 public static function fromArray(array $values)
 {
     $message = new self();
     $values = array_merge(['id' => null, 'pokemon_id' => null, 'cp' => null, 'stamina' => null, 'stamina_max' => null, 'move_1' => null, 'move_2' => null, 'deployed_fort_id' => null, 'owner_name' => null, 'is_egg' => null, 'egg_km_walked_target' => null, 'egg_km_walked_start' => null, 'origin' => null, 'height_m' => null, 'weight_kg' => null, 'individual_attack' => null, 'individual_defense' => null, 'individual_stamina' => null, 'cp_multiplier' => null, 'pokeball' => null, 'captured_cell_id' => null, 'battles_attacked' => null, 'battles_defended' => null, 'egg_incubator_id' => null, 'creation_time_ms' => null, 'num_upgrades' => null, 'additional_cp_multiplier' => null, 'favorite' => null, 'nickname' => null, 'from_fort' => null, 'buddy_candy_awarded' => null, 'buddy_total_km_walked' => null, 'display_pokemon_id' => null, 'display_cp' => null], $values);
     $message->setId($values['id']);
     $message->setPokemonId($values['pokemon_id']);
     $message->setCp($values['cp']);
     $message->setStamina($values['stamina']);
     $message->setStaminaMax($values['stamina_max']);
     $message->setMove1($values['move_1']);
     $message->setMove2($values['move_2']);
     $message->setDeployedFortId($values['deployed_fort_id']);
     $message->setOwnerName($values['owner_name']);
     $message->setIsEgg($values['is_egg']);
     $message->setEggKmWalkedTarget($values['egg_km_walked_target']);
     $message->setEggKmWalkedStart($values['egg_km_walked_start']);
     $message->setOrigin($values['origin']);
     $message->setHeightM($values['height_m']);
     $message->setWeightKg($values['weight_kg']);
     $message->setIndividualAttack($values['individual_attack']);
     $message->setIndividualDefense($values['individual_defense']);
     $message->setIndividualStamina($values['individual_stamina']);
     $message->setCpMultiplier($values['cp_multiplier']);
     $message->setPokeball($values['pokeball']);
     $message->setCapturedCellId($values['captured_cell_id']);
     $message->setBattlesAttacked($values['battles_attacked']);
     $message->setBattlesDefended($values['battles_defended']);
     $message->setEggIncubatorId($values['egg_incubator_id']);
     $message->setCreationTimeMs($values['creation_time_ms']);
     $message->setNumUpgrades($values['num_upgrades']);
     $message->setAdditionalCpMultiplier($values['additional_cp_multiplier']);
     $message->setFavorite($values['favorite']);
     $message->setNickname($values['nickname']);
     $message->setFromFort($values['from_fort']);
     $message->setBuddyCandyAwarded($values['buddy_candy_awarded']);
     $message->setBuddyTotalKmWalked($values['buddy_total_km_walked']);
     $message->setDisplayPokemonId($values['display_pokemon_id']);
     $message->setDisplayCp($values['display_cp']);
     return $message;
 }