Skip to main content

A CLI tool to help you beautify Guild War honors

Project description

Granblue Fantasay - Beautify Honors

A CLI tool to help you figure out how to beautify honors in the Guild War event. (古戦場の貢献度調整)

Read this in other languages: English, 中文.

sample_result

Prerequisites

Please read at least one of these well-written tutorials to known how to get the exact honors.

System requirements

  • Python 3.7+

Install requirements

You can use pip or poetry to install requirements.

pip

$ pip install -r requirements.txt

poetry

$ poetry install

How to use

  1. Solo the NM Bosses until the difference between your current honors and expected honors is roughly greater than one million. An appropriate gap is a good start because there may be a greater chance of finding a good way to achieve the goal.
  2. Run the cli tool in interactive mode or direct mode. Help page is simply shown below:
$ python gbf_beautify_honors/main.py --help
Usage: main.py [OPTIONS]

Options:
  --current INTEGER   Your current honors  [required]
  --expected INTEGER  Your expected honors  [required]
  --config PATH       Custom config path
  --help              Show this message and exit.

Interactive mode example

$ python gbf_beautify_honors/main.py
Your current honors : 1398542611
Your expected honors: 1400000000
Custom config path []:

Direct mode example

$ python gbf_beautify_honors/main.py --current=1398542611 --expected=1400000000

Examples

Next, we will use some examples to explain how to use this tool, and how to adjust the configuration file.

Case 1: There is a solution

$ python gbf_beautify_honors/main.py
Your current honors : 1398542611
Your expected honors: 1400000000
Custom config path []:
╒═══════════════════════════════════════╤═════════╤═════════════════╕
 Action                                   Honor    Optimal Times 
╞═══════════════════════════════════════╪═════════╪═════════════════╡
 Eyeball VH (0 button)                     8000                1 
├───────────────────────────────────────┼─────────┼─────────────────┤
 Meat Beast VH (0 button)                 21400                4 
├───────────────────────────────────────┼─────────┼─────────────────┤
 Meat Beast EX (0 button)                 50578                3 
├───────────────────────────────────────┼─────────┼─────────────────┤
 Meat Beast EX+ (0 button)                80800               10 
├───────────────────────────────────────┼─────────┼─────────────────┤
 Meat Beast EX+ (1 summon)                80810                5 
├───────────────────────────────────────┼─────────┼─────────────────┤
 Join raid and only use Break Assassin        1                5 
╘═══════════════════════════════════════╧═════════╧═════════════════╛

Case 2: There is no solution

Basically, there is always a solution because we can join raid and only use Break Assassin to get exactly 1 honor. However, this is usually an unrealistic approach, so the default config makes some constraints on the maximum time on each type of battle. This leads to the fact that sometimes it is not possible to find a solution.

$ python gbf_beautify_honors/main.py
Your current honors : 1399999900
Your expected honors: 1400000000
Custom config path []:
There is no solution to achieve the expected honors. Please relax the constraints and try again.

To solve this problem, we can use custom config to relax the constraints to find a solution.

  1. Download the example config.json.
  2. Modify the max_accepatable_times of the action "Join raid and only use Break Assassin" to 100.
  3. Re-run the script with custom config.
$ python gbf_beautify_honors/main.py
Your current honors : 1399999900
Your expected honors: 1400000000
Custom config path []: config.json
╒═══════════════════════════════════════╤═════════╤═════════════════╕
│ Action                                │   Honor │   Optimal Times │
╞═══════════════════════════════════════╪═════════╪═════════════════╡
│ Join raid and only use Break Assassin │       1100 │
╘═══════════════════════════════════════╧═════════╧═════════════════╛

The configuration is flexible and you can try to modify different values in it, re-run the script and see if there is an solution. You can also add self-defined action into the config.json as long as you know you can get the exact honor value from this action, e.g. you can add this object into the actions list,

{
    "name": "Some custom action for demo",
    "honor": 11,
    "max_accepatable_times": 10
}

Re-run the script, it just works!

$ python gbf_beautify_honors/main.py
Your current honors : 1399999900
Your expected honors: 1400000000
Custom config path []: config.json
╒═══════════════════════════════════════╤═════════╤═════════════════╕
│ Action                                │   Honor │   Optimal Times │
╞═══════════════════════════════════════╪═════════╪═════════════════╡
│ Join raid and only use Break Assassin │       1 │               1 │
├───────────────────────────────────────┼─────────┼─────────────────┤
│ Some custom action for demo           │      11 │               9 │
╘═══════════════════════════════════════╧═════════╧═════════════════╛

How it works

We can formulate this problem as an integer programming problem and solve it using the OR-Tools

Is this case, we use an integer variable hi to represent the exact honor earned from battle i (i can be Eyeball N, Wicked Rebel EX+, ...). And use another integer variable ni to represent the number of battles we need to fight for the battle i.

We want to get exact honors with minimum number of battles (more efficient), so the corresponding integer programming problem is:

formula

formula

Additionally, we can add additional constriants to the integer variable ni to limit the maximum number of each battle. e.g.,

formula

How to develop

Setup

Use poetry to setup dev environment.

$ poetry install
$ poetry shell

Use pre-commit hook to check coding style.

$ pre-commit install -t commit-msg -t pre-commit

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

gbf-beautify-honors-0.1.0.tar.gz (7.8 kB view hashes)

Uploaded source

Built Distribution

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Huawei Huawei PSF Sponsor Microsoft Microsoft PSF Sponsor NVIDIA NVIDIA PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page