| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131 |
- <?php
- /**
- * Rune stat entity file.
- *
- * Creates the entity and makes it available.
- *
- * @category Entity
- */
- /**
- * Require dependent entities if not present.
- */
- require_once(PATH::ENTITY . "Entity.php");
- /**
- * Rune_stat.
- *
- * Represents an object from the table 'rune'.
- *
- * @category Entity
- */
- class Rune_Stat extends Entity{
- /**
- * @var int Stat slot.
- *
- * @see RUNE_STAT_SLOT_ID
- */
- public $slot;
- /**
- * @var int Substat 1 of the rune.
- *
- * @see RUNE_STAT_ID
- */
- public $stat;
- /**
- * @var string Substat 1 name (uppercase).
- */
- public $stat_name = "";
- /**
- * @var int Substat 1 value of the rune.
- */
- public $value;
- /**
- * @var int Ammount gained by the substat 1 enchant.
- */
- public $grind;
- /**
- * @var int Indicates if a gem has been used.
- */
- public $enchant;
- /**
- * Constructor.
- *
- * Searches the database and retrieves the information about the
- * rune, populating it and it's items.
- *
- * @param int $id Rune id.
- * @global resource Database connection.
- */
- public function __construct($rune, $slot){
- global $db;
- $statement = $db->prepare("
- SELECT
- slot,
- stat,
- value,
- enchant,
- grind
- FROM rune_stat
- WHERE
- rune = :rune AND
- slot = :slot;
- ");
- $statement->bindValue(':rune', $rune, SQLITE3_TEXT);
- $statement->bindValue(':slot', $slot, SQLITE3_TEXT);
- $r = $statement->execute()->fetchArray(SQLITE3_ASSOC);
- if ($r){
- $this->slot = $r["slot"];
- $this->stat = $r["stat"];
- $this->value = $r["value"];
- $this->enchant = $r["enchant"];
- $this->grind = $r["grind"];
- switch ($this->stat){
- case RUNE_STAT_ID::HP:
- $this->stat_name = "HP";
- break;
- case RUNE_STAT_ID::HP_P:
- $this->stat_name = "HP%";
- break;
- case RUNE_STAT_ID::ATK:
- $this->stat_name = "ATK";
- break;
- case RUNE_STAT_ID::ATK_P:
- $this->stat_name = "ATK%";
- break;
- case RUNE_STAT_ID::DEF:
- $this->stat_name = "DEF";
- break;
- case RUNE_STAT_ID::DEF_P:
- $this->stat_name = "DEF%";
- break;
- case RUNE_STAT_ID::SPD:
- $this->stat_name = "SPD";
- break;
- case RUNE_STAT_ID::CRR:
- $this->stat_name = "CRR";
- break;
- case RUNE_STAT_ID::CRD:
- $this->stat_name = "CRD";
- break;
- case RUNE_STAT_ID::RES:
- $this->stat_name = "RES";
- break;
- case RUNE_STAT_ID::ACC:
- $this->stat_name = "ACC";
- break;
- }
- }
- }
- }
- ?>
|