PokemonGoF / PokemonGo-Bot

The Pokemon Go Bot, baking with community.
MIT License
3.86k stars 1.54k forks source link

Cleaning up JSON files. #6154

Open ghost opened 7 years ago

ghost commented 7 years ago

Short Description

Cleaner .json files.

catch.json

"catch": {
"x":"y",
"a":"b"
}

evolve.json

"evolve": {
"x":"y",
"a":"b"
}

Possible solution

By cleaning up the config, you not only make it easier to diagnose json errors, but also make it easy to find and write. Plus you would have easier understanded variables:

bot.config.evolve['rattata'] = evolve()

How it would help others

By creating cleaner json files, and not bundling up all the data into one huge file, it limits issues like JSON errors, and also makes it easier to modify what is needed instead of searching through a wall of text.

MerlionRock commented 7 years ago

The json files for item and pokemon are auto generated with a tool that grab the gamemaster.

I can point you to the tool to generate this two files if you need it

MerlionRock commented 7 years ago

I misunderstood the original post meaning.

It's for the config.json.

What are the views of the rest of dev?

davidakachaos commented 7 years ago

On one end it will cleanup the config for a end user. But how often do you change the config? We currently have code in place that will restart the bot/reload the task config when the config file is adjusted. I don't know if it can scale to multiple files, and if so what impact that will have on the bot?

ghost commented 7 years ago

As per our chat: The idea is to do: { "pokemons": { "Bulbasaur": { "catch": true, "evolve": false } "Ivysaur": { "catch": true, "evolve": false } "Venusaur": { "catch": true } }

davidakachaos commented 7 years ago

So you want to extract things like

"catch": {
        "any": {
            "candy_threshold": 100000,
            "catch_above_cp": 0,
            "catch_above_iv": 0,
            "logic": "or"
        },
        "// Murkrow": {
          "// only_catch_better_cp": true,
          "// only_catch_better_iv": true
        },
        "Magikarp": {
            "always_catch": true
        },
        "// Always catch 'trash' mons:": {},
        "Caterpie": {
            "always_catch": true
        },
        "Weedle": {
            "always_catch": true
        },
        "Pidgey": {
            "always_catch": true
        },
        "Rattata": {
            "always_catch": true
        },
        "Nidoran F": {
            "always_catch": true
        },
        "Nidoran M": {
            "always_catch": true
        },
        "Zubat": {
            "always_catch": true
        },
        "Oddish": {
            "always_catch": true
        },
        "Paras": {
            "always_catch": true
        },
        "Venonat": {
            "always_catch": true
        },
        "Psyduck": {
            "always_catch": true
        },
        "Tentacool": {
            "always_catch": true
        },
        "Magnemite": {
            "always_catch": true
        },
        "Krabby": {
            "always_catch": true
        },
        "Voltorb": {
            "always_catch": true
        },
        "Goldeen": {
            "always_catch": true
        },
        "Staryu": {
            "always_catch": true
        },
        "Eevee": {
            "always_catch": true
        }
    }

in their own files, or do you want to combine them? I'm used to the one config file now 😉 So that why my question was; how often do you adjust your config?

ghost commented 7 years ago

We would remove the catch config, and move it to a seperate .json file. This would allow easier and cleaner access to the file. I personally modify the capture part very intensively when I reach a max pokemon! The reason to that is after I get the perfect (lets say) Starmie, I don't want anymore of those and I'll remove them from my list. Same with say Charmander. Agian we can clean it up and things like: "Do you want to evolve Charmanders or wait?"

davidakachaos commented 7 years ago

Would #6162 help you?

ghost commented 7 years ago

Again the idea is to seperate the files. For cleaner modfication. Sepereate the "User modfiyble" from the core parts. I did have a intresting recommendation for this, but again new modfication does create a larger hardship. This idea would be relating to YAML. (YAML is basically JSON). My thinking agian is to make these config scripts user friendly. Again, I can create the .json/yaml files for the pokemon and modfication if someoen wants to change the variables for reading an extra file.

MerlionRock commented 7 years ago

Actually the concern here is to make it user friendly...

Json file by itself is already not user friendly.... I know there are online json file editors, why not recommend those to user instead?

ghost commented 7 years ago

I can suggest YAML. http://yaml.org/ <--- The YAML website is literately the syntax. (Plus it supports the .JSON files) unless we create a ".json generator for the pokemons and make it user friendly." I can work on .rb format. I think if User friendly is the issue, then the website will be a great choice.