| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495 |
- <?php
- /**
- * Skill level entity file.
- *
- * Creates the entity and makes it available.
- *
- * @author Iñigo Valentin <i@inigovalentin.com>
- * @license https://www.gnu.org/licenses/gpl-3.0.en.html GNU General Public License V3
- * @package SWDB
- */
- require_once(PATH::ENTITY . "Entity.php");
- /**
- * Monster skill level.
- *
- * Represents an upgrade of a skill
- *
- * @category Entity
- */
- class Skill_Level extends Entity{
- /**
- * @var int Skill identifier.
- */
- private $skill;
- /**
- * @var int Skill level.
- */
- private $level;
- /**
- * @var string Upgrade description.
- */
- private $description;
- /**
- * Constructor.
- *
- * Searches the database and retrieves the information about the
- * skill level, populating it and it's items.
- *
- * @param int $skill Skill identifier.
- * @param int $level Skill level.
- */
- public function __construct($skill, $level){
- $statement = get_context()->get_db()->prepare("
- SELECT
- skill,
- level,
- description
- FROM skill_level
- WHERE
- skill = :skill AND
- level = :level;
- ");
- $statement->bindValue(':skill', $skill, SQLITE3_TEXT);
- $statement->bindValue(':level', $level, SQLITE3_TEXT);
- $r = $statement->execute()->fetchArray(SQLITE3_ASSOC);
- if ($r){
- $this->skill = $r["skill"];
- $this->level = $r["level"];
- $this->description = HTML::e($r["description"]);
- }
- }
- /**
- * Retrieves the skill identifier.
- *
- * @return int Skill ID.
- */
- public function get_skill(){
- return $this->skill;
- }
- /**
- * Retrieves the skill level.
- *
- * @return int Skill level.
- */
- public function get_level(){
- return $this->level;
- }
- /**
- * Retrieves the upgrade at this level.
- *
- * @return string Skill level description.
- */
- public function get_description(){
- return $this->description;
- }
- }
|