| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687 |
- <?php
- /**
- * Effect key entity file.
- *
- * Creates the entity and makes it available.
- *
- * @category Entity
- */
- /**
- * Require dependent entities if not present.
- */
- require_once(PATH::ENTITY . "Entity.php");
- /**
- * Skill effect.
- *
- * Represents an object from the table 'k_effect'.
- *
- * @category Entity
- */
- class K_Effect extends Entity{
- /**
- * @var int Effect identifier.
- */
- public $id;
- /**
- * @var string Effect name.
- */
- public $name;
- /**
- * @var bool Indicates if the effect is a buff.
- */
- public $is_buff;
- /**
- * @var string Effect description.
- */
- public $description;
- /**
- * Constructor.
- *
- * Searches the database and retrieves the information about the
- * skill level, populating it and it's items.
- *
- * @param int $id Effect identifier.
- * @global resource Database connection.
- */
- public function __construct($id){
- global $db;
- $statement = $db->prepare("
- SELECT
- id,
- name,
- is_buff,
- description
- FROM k_effect
- WHERE id = :id;
- ");
- $statement->bindValue(':id', $id, SQLITE3_INTEGER);
- $r = $statement->execute()->fetchArray(SQLITE3_ASSOC);
- if ($r){
- $this->id = $r["id"];
- $this->name = HTML::e($r["name"]);
- $this->is_buff = $r["is_buff"];
- $this->description = HTML::e($r["description"]);
- }
- }
- /**
- * Gets the pathto the monster image. The image must be in the
- * img/effect/ directory, and its name must be the effect id,
- * padded with '0' to 4 digits, and the extension must be '.png'.
- *
- * @return string Image URL, or a fixed unknown image.
- */
- public function get_image(){
- return APPLICATION::img("EFFECT", $this->id);
- }
- }
- ?>
|