Guild_Skill.php 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. <?php
  2. /**
  3. * Guild skill entity file.
  4. *
  5. * Creates the entity and makes it available.
  6. *
  7. * @category Entity
  8. */
  9. /**
  10. * Require dependent entities if not present.
  11. */
  12. require_once(PATH::ENTITY . "Entity.php");
  13. /**
  14. * Guild skill.
  15. *
  16. * Represents an object from the table 'guild_skill'.
  17. *
  18. * @category Entity
  19. */
  20. class Guild_Skill extends Entity{
  21. private $id;
  22. private $group;
  23. private $level;
  24. private $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 int $id Skill identifier.
  32. */
  33. public function __construct($id){
  34. $statement = get_context()->get_db()->prepare("
  35. SELECT
  36. id,
  37. skill_group,
  38. level,
  39. effect
  40. FROM key.guild_skill
  41. WHERE id = :id;
  42. ");
  43. $statement->bindValue(':id', $id, SQLITE3_TEXT);
  44. $r = $statement->execute()->fetchArray(SQLITE3_ASSOC);
  45. if ($r){
  46. $this->id = $r["id"];
  47. $this->group = $r["skill_group"];
  48. $this->level = $r["level"];
  49. $this->effect = HTML::e($r["effect"]);
  50. }
  51. }
  52. /**
  53. * Retrieves the guild skill identifier.
  54. *
  55. * @return int Skill ID.
  56. */
  57. public function get_id(){
  58. return $this->id;
  59. }
  60. /**
  61. * Retrieves the skill group identifier.
  62. *
  63. * @return int Group ID.
  64. */
  65. public function get_group(){
  66. return $this->group;
  67. }
  68. /**
  69. * Retrieves the skill level.
  70. *
  71. * @return int Skill level.
  72. */
  73. public function get_level(){
  74. return $this->level;
  75. }
  76. /**
  77. * Retrieves the skill efect description.
  78. *
  79. * @return string Skill description.
  80. */
  81. public function get_effect(){
  82. return $this->effect;
  83. }
  84. }
  85. ?>