K_Skill_Level.php 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. <?php
  2. require_once($path["entity"] . "Entity.php");
  3. /**
  4. * Monster skill level.
  5. *
  6. * Represents an object from the table 'k_monster_skill_upgrade'.
  7. */
  8. class K_Skill_Level extends Entity{
  9. /**
  10. * Skill identifier.
  11. */
  12. public $skill;
  13. /**
  14. * Skill level.
  15. */
  16. public $level;
  17. /**
  18. * Upgrade description.
  19. */
  20. public $description;
  21. /**
  22. * Constructor.
  23. *
  24. * Searches the database and retrieves the information about the
  25. * skill level, populating it and it's items.
  26. *
  27. * @param SQLite3 $db Connection to the database.
  28. * @param int $skill Skill identifier.
  29. * @param int $level Skill level.
  30. */
  31. public function __construct($db, $skill, $level){
  32. global $path;
  33. parent::__construct($db);
  34. $s =
  35. "SELECT " .
  36. " skill, " .
  37. " level, " .
  38. " description " .
  39. "FROM k_skill_level " .
  40. "WHERE " .
  41. " skill = $skill AND " .
  42. " level = $level;";
  43. $q = $this->db->query($s);
  44. $r = $q->fetchArray(SQLITE3_ASSOC);
  45. if ($r){
  46. $this->skill = $r["skill"];
  47. $this->level = $r["level"];
  48. $this->description = $r["description"];
  49. }
  50. }
  51. }
  52. ?>