K_Guild_Skill.php 1.5 KB

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