q("SELECT * FROM classes"); return $res->fetchAll() ?: false; } public static function get(int $id): array|false { $res = App::$db->do("SELECT * FROM classes WHERE id = ?", [$id]); return $res->fetch() ?: false; } // Spell definitions are in the DB under the spell columns; // level:spell_id,spell_id|level:spell_id // This means that as level increases, more spells are available. public static function spellsToArray(string $spells): array { $list = []; $groups = explode('|', $spells); foreach ($groups as $group) { $parts = explode(':', $group); // first part will be level, second part will be spell_ids $list[$parts[0]] = explode(',', $parts[1]); } return $list; } }