Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enhancement of auto quest #134

Open
wants to merge 20 commits into
base: master
Choose a base branch
from
Open

Enhancement of auto quest #134

wants to merge 20 commits into from

Conversation

Sorrow81
Copy link

@Sorrow81 Sorrow81 commented May 31, 2022

This commit adds the completion of quests with a location.

It saves the last state of the player to reset it to its initial position with the initial state of the autoclicker if it is installed.

In the future I also plan to add the sorting change of the breeding if the autohatchery is enabled.

I'm also looking into the possibility of completing pokéball quests so as not to ruin all the dungeon tokens when you active DefeatDungeonQuest in autoquest.

This PR resolve partially issue #121

@Sorrow81 Sorrow81 marked this pull request as ready for review June 1, 2022 07:02
@akwawa
Copy link
Contributor

akwawa commented Jun 1, 2022

Hello,

You use const to subregions in Alola.
Can you use the component Region/Subregion to find the subregion?

Look here:

@Sorrow81
Copy link
Author

Sorrow81 commented Jun 1, 2022

This is the first attempt I made, but I didn't make it.

So I got the information from here:
https://github.com/pokeclicker/pokeclicker/blob/ff8b53478cf714c61de8b33d73cd1275ce785688/src/components/AlolaSVG.html

I tried something like this, but it's shit

const alolaRoutesSubRegion0 = Routes.getRoutesByRegion(GameConstants.Region.alola).filter(x => x.subRegion === 0);
const alolaRoutesSubRegion1 = Routes.getRoutesByRegion(GameConstants.Region.alola).filter(x => x.subRegion === 1);
const alolaRoutesSubRegion2 = Routes.getRoutesByRegion(GameConstants.Region.alola).filter(x => x.subRegion === 2);

let alolaTownsSubRegion0 = []
let alolaTownsSubRegion1 = []
let alolaTownsSubRegion2 = []

// recupère les villes qui ont besoins d'avoir une route débloqués
for (const town in TownList) {
    if (TownList[town].region === 6) {
        let routeRequired = TownList[town].requirements[0].route;
        let badgeRequired = TownList[town].requirements[0].badge;
        let difficultyRoute = null;
        if (TownList[town].dungeon) {
            difficultyRoute = TownList[town].dungeon.difficultyRoute;
        }
        let dungeonRequired = TownList[town].requirements[0].dungeonIndex

        if (routeRequired) {
            if (alolaRoutesSubRegion0.filter(x => x.number === routeRequired).length > 0) {
                alolaTownsSubRegion0.push(town)
            } else if (alolaRoutesSubRegion1.filter(x => x.number === routeRequired).length > 0) {
                alolaTownsSubRegion1.push(town)
            } else if (alolaRoutesSubRegion2.filter(x => x.number === routeRequired).length > 0) {
                alolaTownsSubRegion2.push(town)
            }
        }
        else if (badgeRequired) {
            for (const gym in GymList) {
                const gymTown = GymList[gym].town
                if (GymList[gym].badgeReward === badgeRequired) {
                    if (alolaTownsSubRegion0.filter(x => x === gymTown).length > 0) {
                        alolaTownsSubRegion0.push(town)
                    } else if (alolaTownsSubRegion1.filter(x => x === gymTown).length > 0) {
                        alolaTownsSubRegion1.push(town)
                    } else if (alolaTownsSubRegion2.filter(x => x === gymTown).length > 0) {
                        alolaTownsSubRegion2.push(town)
                    }
                }
            }
        }
        else if (difficultyRoute) {
            if (alolaRoutesSubRegion0.filter(x => x.number === difficultyRoute).length > 0) {
                alolaTownsSubRegion0.push(town)
            } else if (alolaRoutesSubRegion1.filter(x => x.number === difficultyRoute).length > 0) {
                alolaTownsSubRegion1.push(town)
            } else if (alolaRoutesSubRegion2.filter(x => x.number === difficultyRoute).length > 0) {
                alolaTownsSubRegion2.push(town)
            }
        }
        else if (dungeonRequired) {
            if (alolaTownsSubRegion0.filter(x => GameConstants.getDungeonIndex(x) === TownList[town].requirements[0].dungeonIndex)) {
                alolaTownsSubRegion0.push(town)
            } else if (alolaTownsSubRegion1.filter(x => GameConstants.getDungeonIndex(x) === TownList[town].requirements[0].dungeonIndex)) {
                alolaTownsSubRegion1.push(town)
            } else if (alolaTownsSubRegion2.filter(x => GameConstants.getDungeonIndex(x) === TownList[town].requirements[0].dungeonIndex)) {
                alolaTownsSubRegion2.push(town)
            }
        } else {
            console.log(TownList[town])
        }
    }
}

Do you have any ideas to get subRegion of towns ?

@Sorrow81
Copy link
Author

Sorrow81 commented Jun 3, 2022

I've added several features, I'll keep adding them. Still related to quest resolution.

If you have a solution to get the location of the sub-regions of alola do not hesitate.

For the version number, I don't know if it's better to increment by 1 each time, or to go to 2.0 once it's finished (knowing that I didn't necessarily think to increment the version).

@Sorrow81 Sorrow81 changed the title Auto quest location Enhancement of auto quest Jun 3, 2022
@Sorrow81
Copy link
Author

Sorrow81 commented Jun 4, 2022

I have done most of the quests, I still have the OakItem quests with the Magicball and the dungeon token quests.

I have to admit that I usually turn off the farm type quests because they take too long.

Has anyone been able to try these improvements?

@Sorrow81
Copy link
Author

Sorrow81 commented Jun 8, 2022

I refactored the code to use only one loop.

Edit: Need more test

@Sorrow81
Copy link
Author

I need feedback on enhancement ✌️ 📝

@Plantim
Copy link
Contributor

Plantim commented Jun 14, 2022

Hello, i don't know if it's the place but, how can i add auto location for gem quest ? Thx

@Sorrow81
Copy link
Author

Hello, i don't know if it's the place but, how can i add auto location for gem quest ? Thx

You need to manually install to Tampermonkey.

Raw file: https://raw.githubusercontent.com/Ephenia/Pokeclicker-Scripts/2c188c8e0e52303a723871a6fea2e0be410b5240/custom/autoquestcompleter.user.js

@Plantim
Copy link
Contributor

Plantim commented Jun 15, 2022

Hello, i don't know if it's the place but, how can i add auto location for gem quest ? Thx

You need to manually install to Tampermonkey.

Raw file: https://raw.githubusercontent.com/Ephenia/Pokeclicker-Scripts/2c188c8e0e52303a723871a6fea2e0be410b5240/custom/autoquestcompleter.user.js

i did but it's still don't work, the script doesn't know where to go to do the quest gems

@Sorrow81
Copy link
Author

Sorrow81 commented Jun 15, 2022

You may need to change the namespace and name of the script so that it is not updated from the original source.
You then have to restart pokeclicker after the manipulation.

Edit: When you say Gem Quest, are you refering to the quest below ?
image
I did not manage this kind of quest. I would have to find a programmatic way to retrieve the most suitable location

@Plantim
Copy link
Contributor

Plantim commented Jun 15, 2022

Edit: When you say Gem Quest, are you refering to the quest below ? image I did not manage this kind of quest. I would have to find a programmatic way to retrieve the most suitable location

Yes that's what i'm talking to.

Devs already did what you search : https://pokeclicker.miraheze.org/wiki/Gems

I have access to all locations, i wanted to custom your script for personnal use.

@Sorrow81
Copy link
Author

Edit: When you say Gem Quest, are you refering to the quest below ? image I did not manage this kind of quest. I would have to find a programmatic way to retrieve the most suitable location

Yes that's what i'm talking to.

Devs already did what you search : https://pokeclicker.miraheze.org/wiki/Gems

I have access to all locations, i wanted to custom your script for personnal use.

To do this you would need all this information in JSON format for example.

Click to expand
[
    {
        "Gem Type": "Normal",
        "Amount": "10",
        "Droprate": "1",
        "Town": "Violet City",
        "Elite": "null"
    },
    {
        "Gem Type": "Normal",
        "Amount": "20",
        "Droprate": "1",
        "Town": "Petalburg City",
        "Elite": "null"
    },
    {
        "Gem Type": "Normal",
        "Amount": "15",
        "Droprate": "1",
        "Town": "Aspertia City",
        "Elite": "null"
    },
    {
        "Gem Type": "Fire",
        "Amount": "15",
        "Droprate": "1",
        "Town": "Cinnabar Island",
        "Elite": "null"
    },
    {
        "Gem Type": "Fire",
        "Amount": "20",
        "Droprate": "1",
        "Town": "Lavaridge Town",
        "Elite": "null"
    },
    {
        "Gem Type": "Fire",
        "Amount": "25",
        "Droprate": "1",
        "Town": "Pokémon League Sinnoh",
        "Elite": "Elite Flint "
    },
    {
        "Gem Type": "Fire",
        "Amount": "20",
        "Droprate": "1",
        "Town": "Pokémon League Kalos",
        "Elite": "Elite Malva"
    },
    {
        "Gem Type": "Water",
        "Amount": "10",
        "Droprate": "1",
        "Town": "Cerulean City",
        "Elite": "null"
    },
    {
        "Gem Type": "Water",
        "Amount": "20",
        "Droprate": "0,8",
        "Town": "Johto Indigo Plateau",
        "Elite": "Elite Lorelei"
    },
    {
        "Gem Type": "Water",
        "Amount": "10",
        "Droprate": "0,66",
        "Town": "Mahogany Town",
        "Elite": "null"
    },
    {
        "Gem Type": "Water",
        "Amount": "25",
        "Droprate": "1",
        "Town": "Sootopolis City",
        "Elite": "null"
    },
    {
        "Gem Type": "Water",
        "Amount": "15",
        "Droprate": "0,6",
        "Town": "Pokémon League Hoenn",
        "Elite": "Elite Glacia"
    },
    {
        "Gem Type": "Water",
        "Amount": "30",
        "Droprate": "1",
        "Town": "Pokémon League Hoenn",
        "Elite": "null"
    },
    {
        "Gem Type": "Water",
        "Amount": "15",
        "Droprate": "1",
        "Town": "Pastoria City",
        "Elite": "null"
    },
    {
        "Gem Type": "Water",
        "Amount": "20",
        "Droprate": "1",
        "Town": "Humilau City",
        "Elite": "null"
    },
    {
        "Gem Type": "Water",
        "Amount": "20",
        "Droprate": "1",
        "Town": "Pokémon League Kalos",
        "Elite": "Elite Siebold"
    },
    {
        "Gem Type": "Electric",
        "Amount": "10",
        "Droprate": "0,66",
        "Town": "Olivine City",
        "Elite": "null"
    },
    {
        "Gem Type": "Electric",
        "Amount": "20",
        "Droprate": "1",
        "Town": "Mauville City",
        "Elite": "null"
    },
...
    {
        "Gem Type": "Electric",
        "Amount": "20",
        "Droprate": "1",
        "Town": "Sunyshore City",
        "Elite": "null"
    }

We could also have the list of routes in case the player has not unlocked the gyms.

Click to expand
[
    {
        "Gem Type": "Normal",
        "Route": "Kanto 1",
        "Chance": "1"
    },
    {
        "Gem Type": "Normal",
        "Route": "Kanto 16",
        "Chance": "1"
    },
    {
        "Gem Type": "Normal",
        "Route": "Kalos 1",
        "Chance": "1"
    },
    {
        "Gem Type": "Fire",
        "Route": "Hoenn 112",
        "Chance": "0,5"
    },
    {
        "Gem Type": "Water",
        "Route": "Kanto 19",
        "Chance": "1"
    },
    {
        "Gem Type": "Water",
        "Route": "Kanto 20",
        "Chance": "1"
    },
    {
        "Gem Type": "Water",
        "Route": "Johto 40",
        "Chance": "1"
    },
    {
        "Gem Type": "Water",
        "Route": "Johto 41",
        "Chance": "1"
    },
    {
        "Gem Type": "Water",
        "Route": "Hoenn 105",
        "Chance": "1"
    },
    {
        "Gem Type": "Water",
        "Route": "Hoenn 106",
        "Chance": "1"
    },
    {
        "Gem Type": "Water",
        "Route": "Hoenn 107",
        "Chance": "1"
    },
    {
        "Gem Type": "Water",
        "Route": "Hoenn 108",
        "Chance": "1"
    },
    {
        "Gem Type": "Water",
        "Route": "Hoenn 109",
        "Chance": "1"
    },
...
    {
        "Gem Type": "Water",
        "Route": "Hoenn 122",
        "Chance": "1"
    }
]

But it would be better to be able to generate this list programmatically and the JSON format could be optimized in this example.

@Plantim
Copy link
Contributor

Plantim commented Jun 16, 2022

Ok thank you for your answer. I will see latter then.

By the way, you wanted feedback, your script is totaly working. Sometimes, for no reasons, it stop and tp to a dungeon (nothing to do with quests). Change location and toggle the button "autoquest" make it working again.

@Ephenia Ephenia added the Merge Conflicting This means that this PR has a merge conflict and it will need to be revised label Apr 19, 2023
@Ephenia Ephenia added the Insufficient votes This means the PR lacks votes and requires more attention for a decision to be made label Apr 29, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Insufficient votes This means the PR lacks votes and requires more attention for a decision to be made Merge Conflicting This means that this PR has a merge conflict and it will need to be revised
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants