How to use the osrsbox.monsters_api.load function in osrsbox

To help you get started, we’ve selected a few osrsbox examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github osrsbox / osrsbox-db / osrsbox / monsters_api_examples / print_all_monsters.py View on Github external
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program.  If not, see .
###############################################################################
"""

from osrsbox import monsters_api


if __name__ == "__main__":
    # Load all monsters
    all_db_monsters = monsters_api.load()

    # Loop through all monsters in the database and print the monster name for each monster
    for monster in all_db_monsters:
        # print(monster.id, monster.name)  # Old, simple printing method
        print(f"{monster.id:<6} {monster.name}")  # New, f-strings printing method