Code Monkey home page Code Monkey logo

bank-graph-for-hypixel-skyblock's Introduction

Bank graph for Hypixel SkyBlock

Description

Bank graph for Hypixel SkyBlock is a small program which I wrote to get the bank account balance of my coop SkyBlock world and print it to a graph to visualize our progress.

You can also use Discord bot for SkyBlock graph to make a Discord bot which uses this program and generates a graph when you type a command in Discord.

Table of Contents

How to install

The bank graph program requires:

Installing the libraries

The libraries pickle, time and os are pre-installed with Python.

The remaining libraries can be installed with pip using this command:

pip install requests matplotlib

You can also install them with requirements.txt.

How to get a Hypixel API key

To get an API key you have to go to the following website: https://developer.hypixel.net. On this side you have to login to your account (or create a new one), afterwards you can generate an API Key, which is needed to reach the Hypixel API, make sure to save it to make sure you do not loose it and NEVER give it to somebody else.

Installing Bank graph

To install this program simply download this repository as a .zip file and unpack it in a folder.

How to use

Setup in Hypixel

First of all, you need to enable the Banking API in Hypixel.

To do that you have to join the profile you want this program to work on and open your SkyBlock Menu with the Nether Star in you hotbar. In there you have to open the Settings (Picture 1).


Picture 1 - SkyBlock Menu

From the settings page you have to navigate to your island settings (Picture 2).




Picture 2 - Settings

Then you can activate the Banking API by clicking on the icon below the gold ingot (Picture 3). Make sure that the icon is green because otherwise the Hypixel API will not give the required informations needed for the program to work.




Picture 3 - Settings - Island Settings

Customize program

When you open main.py with an editor of your choice you will see the following part of the program:

apiKey = '[YOUR HYPIXEL API KEY HERE]'
playerUsername = '[YOUR MINECRAFT USERNAME HERE]'

Where you have to put your Hypixel API key and the name of the Minecraft Account you have your SkyBlock profile on.

Additionally, you need to specify the SkyBlock-Account you want for the program to get the data from. For this you need to change the number ( [0] ) in this line:

filteredData = data['profiles'][0]['banking']['balance']

You can get this number by subtracting 1 from the Slot number of your SkyBlock-Account.

Example:

  • SkyBlock Slot 1 -> 1 - 1 = 0
  • SkyBlock Slot 3 -> 3 - 1 = 2

Note: Hypixel changed something about how the API works, so for our profile the number randomly changed (don't ask me how or why), so if you have multiple accounts and the program fails to get the banking data or gathers the data from a wrong account, try another number.

You can also turn on dark mode by adding True or darkmode = True as third parameter in generateGraph(). Examples:

generateGraph(apiKey, playerUsername, True)

OR

generateGraph(apiKey, playerUsername, darkmode = True)

Run the program

After running the program you should see that one new file was created in the main directory of the program and two new files in the data folder.

The two files in the data directory store your previously recorded bank balances and the timestamps they were recorded. You should leave these files alone, unless you want to restart the graph, then you just have to delete these files.

The file in the main directory is your graph. If you ran the program only once you will not see much in it, but if you rerun the program when the balance of your bank account in SkyBlock changed, you will see that the graph now actually contains a graph.

Especially when you run the program for the first time or when you changed something in the program, you should watch the terminal because some error messages might be printed there.

How it works

This program is desinged in a way which allows you to incorporate it in one of your own programs. You can also get Discord bot for SkyBlock graph which is another program I wrote which uses this program to generate and send the graph to you when you type a command in Discord.

When you start the program it first checks if the files balanceHistory.dat and timeHistory.dat exist in the data folder. When they exist the program loads these files as they contain your previous Bank data informations otherwise it will create new files to save your bank history.

Then it connects to the Mojyng API using your player name to recieve your UUID. After that it connects to the Hypixel API to recieve the SkyBlock data of the player with the just recieved UUID and then it filters the recieved json file so that it just adds the balance to the balanceHistory.dat. During that process it also gets the current time (Format: YYYY.MM.DD-hh:mm) and saves to to timeHistory.dat.

Using these data it creates a graph and saves it as graph.png to the main directory. Please be aware that this file will be overwritten everytime you rerun the program, so if you like a graph make sure that you copy-paste it to somewhere else.

A generated graph looks like this:

Light Mode:

Dark Mode:

Tests and results

Tested in Python 3.10.7 and Python 3.11.0, but I recommend Python 3.11.0 as it contains some optimizations allowing for faster code.

Problems and future plans

  • Bug: When there are too many entries the labels on the x-Axis will overlap each other.
  • Improvement idea: Add multiple different except ways to allow for better error handling.
  • Visual change: Add a dark mode.
    • Visual change: Improve dark mode.
  • Improvement idea: Replace the required Minecraft Player UUID with just a required Minecraft username.

License and credits

This work is made available under the GNU Affero General Public License v3.0.

Project made by TechLife.



bank-graph-for-hypixel-skyblock's People

Contributors

tachlaif avatar

Stargazers

 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.