/** * Creates a register with attributes * * @param $level integer Level of the character in the guild * @param $rank integer Rank of the character ni the guild * @param $member Charac Character to be in the guild * @param $guild Guild Guild the character is in * @return Register The newly created register instance */ public static function withAttributes($level, $rank, $member, $guild) { $instance = new self(); $instance->setLevel($level); $instance->setRank($rank); $instance->setMember($member); $instance->setGuild($guild); return $instance; }
/** * Creates a stuff with attributes * * @param $owner Charac The stuff owner * @param $name string Name of the stuff * @param $rarity integer Rarity of the stuff * @param $level integer Level of the stuff * @param $weight integer Weight of the stuff * @return Stuff The newly created stuff */ public static function withAttributes($owner, $name, $rarity, $level, $weight) { $instance = new self(); $instance->setOwner($owner); $instance->setName($name); $instance->setRarity($rarity); $instance->setLevel($level); $instance->setWeight($weight); return $instance; }
/** * Returns a node from the array provided * * @param array $data * * @return boolean|\Tree\NestedSet\Node */ public static function fromArray($data) { if (!isset($data['id'], $data['left'], $data['right'])) { return false; } $node = new self($data['id'], $data['left'], $data['right']); if (isset($data['level'])) { $node->setLevel($data['level']); } return $node; }
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; }
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; }
/** * Creates a character with attributes * * @param $name string Name of the character * @param $level integer Level of the character * @param $class string Class of the character * @param $race string Race of the character * @param $gender string Gender of the character * @return Charac The newly created instance of Charac */ public static function withAttributes($name, $level, $class, $race, $gender) { $instance = new self(); $instance->setName($name); $instance->setLevel($level); $instance->setClass($class); $instance->setRace($race); $instance->setGender($gender); return $instance; }
/** * {@inheritdoc} */ public static function fromArray(array $values) { $message = new self(); $values = array_merge(['level' => null], $values); $message->setLevel($values['level']); return $message; }
/** * {@inheritdoc} */ public static function fromArray(array $values) { $message = new self(); $values = array_merge(['badge_type' => null, 'level' => null, 'next_equip_change_allowed_timestamp_ms' => null], $values); $message->setBadgeType($values['badge_type']); $message->setLevel($values['level']); $message->setNextEquipChangeAllowedTimestampMs($values['next_equip_change_allowed_timestamp_ms']); return $message; }
/** * {@inheritdoc} */ public static function fromArray(array $values) { $message = new self(); $values = array_merge(['level' => null, 'experience' => null, 'prev_level_xp' => null, 'next_level_xp' => null, 'km_walked' => null, 'pokemons_encountered' => null, 'unique_pokedex_entries' => null, 'pokemons_captured' => null, 'evolutions' => null, 'poke_stop_visits' => null, 'pokeballs_thrown' => null, 'eggs_hatched' => null, 'big_magikarp_caught' => null, 'battle_attack_won' => null, 'battle_attack_total' => null, 'battle_defended_won' => null, 'battle_training_won' => null, 'battle_training_total' => null, 'prestige_raised_total' => null, 'prestige_dropped_total' => null, 'pokemon_deployed' => null, 'pokemon_caught_by_type' => [], 'small_rattata_caught' => null], $values); $message->setLevel($values['level']); $message->setExperience($values['experience']); $message->setPrevLevelXp($values['prev_level_xp']); $message->setNextLevelXp($values['next_level_xp']); $message->setKmWalked($values['km_walked']); $message->setPokemonsEncountered($values['pokemons_encountered']); $message->setUniquePokedexEntries($values['unique_pokedex_entries']); $message->setPokemonsCaptured($values['pokemons_captured']); $message->setEvolutions($values['evolutions']); $message->setPokeStopVisits($values['poke_stop_visits']); $message->setPokeballsThrown($values['pokeballs_thrown']); $message->setEggsHatched($values['eggs_hatched']); $message->setBigMagikarpCaught($values['big_magikarp_caught']); $message->setBattleAttackWon($values['battle_attack_won']); $message->setBattleAttackTotal($values['battle_attack_total']); $message->setBattleDefendedWon($values['battle_defended_won']); $message->setBattleTrainingWon($values['battle_training_won']); $message->setBattleTrainingTotal($values['battle_training_total']); $message->setPrestigeRaisedTotal($values['prestige_raised_total']); $message->setPrestigeDroppedTotal($values['prestige_dropped_total']); $message->setPokemonDeployed($values['pokemon_deployed']); $message->setSmallRattataCaught($values['small_rattata_caught']); foreach ($values['pokemon_caught_by_type'] as $item) { $message->addPokemonCaughtByType($item); } return $message; }
/** * {@inheritdoc} */ public static function fromArray(array $values) { $message = new self(); $values = array_merge(['name' => null, 'level' => null, 'avatar' => null], $values); $message->setName($values['name']); $message->setLevel($values['level']); $message->setAvatar($values['avatar']); return $message; }