/** * Returns list of known spells. * * <p> * You need global spells list resource loaded in order to use this method. * </p> * * @version 0.2.0+SVN * @since 0.1.4 * @return array List of known spells. * @throws E_OTS_NotLoaded If player is not loaded. * @throws PDOException On PDO operation error. */ public function getSpellsList() { if (!isset($this->data['id'])) { throw new E_OTS_NotLoaded(); } $spells = array(); $list = POT::getSpellsList(); // reads all known spells foreach ($this->db->query('SELECT ' . $this->db->fieldName('name') . ' FROM ' . $this->db->tableName('player_spells') . ' WHERE ' . $this->db->fieldName('player_id') . ' = ' . $this->data['id']) as $spell) { // checks if there is rune, instant or conjure spell with given name if ($list->hasRune($spell['name'])) { $spells[] = $list->getRune($spell['name']); } if ($list->hasInstant($spell['name'])) { $spells[] = $list->getInstant($spell['name']); } if ($list->hasConjure($spell['name'])) { $spells[] = $list->getConjure($spell['name']); } } return $spells; }