| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107 |
- <?php
- /**
- * Artifact effect entity file.
- *
- * Creates the entity and makes it available.
- *
- * @category Entity
- */
- /**
- * Require dependent entities if not present.
- */
- require_once(PATH::ENTITY . "Entity.php");
- /**
- * Artifact effect.
- *
- * Represents an object from the table 'artifact_effect'.
- *
- * @category Entity
- */
- class Artifact_Effect extends Entity{
- /**
- * @var int Effect slot.
- *
- * @see ARTIFACT_EFFECT_SLOT_ID
- */
- public $slot;
- /**
- * @var int Effect identifier.
- *
- * @see ARTIFACT_EFFECT_ID
- */
- public $effect;
- /**
- * @var string Effect name (uppercase).
- */
- public $name = "";
- /**
- * @var int Effect value.
- */
- public $value;
- /**
- * @var int Ammount gained by effect grindstone.
- */
- public $grind;
- /**
- * @var int Indicates if a gem has been used.
- */
- public $enchant;
- /**
- * Constructor.
- *
- * Searches the database and retrieves the information about the
- * artifact effect, populating it and it's items.
- *
- * @param int $artifact Artifact id.
- * @param int $slot Artifact slot id.
- * @global resource Database connection.
- */
- public function __construct($artifact, $slot){
- global $db;
- $statement = $db->prepare("
- SELECT
- slot,
- effect,
- value,
- enchant,
- grind
- FROM artifact_effect
- WHERE
- artifact = :artifact AND
- slot = :slot;
- ");
- $statement->bindValue(':artifact', $artifact, SQLITE3_INTEGER);
- $statement->bindValue(':slot', $slot, SQLITE3_INTEGER);
- $r = $statement->execute()->fetchArray(SQLITE3_ASSOC);
- if ($r){
- $this->effect = $r["effect"];
- $this->value = $r["value"];
- $this->enchant = $r["enchant"];
- $this->grind = $r["grind"];
- $statement = $db->prepare("
- SELECT name
- FROM k_artifact_effect
- WHERE id = :id;
- ");
- $statement->bindValue(':id', $this->effect, SQLITE3_INTEGER);
- $r = $statement->execute()->fetchArray(SQLITE3_ASSOC);
- if ($r){
- $this->name = str_replace("{}", $this->value, $r["name"]);
- }
- }
- }
- }
- ?>
|