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

Add autoAchievement #240

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

Add autoAchievement #240

wants to merge 2 commits into from

Conversation

Dionisos94
Copy link
Contributor

Auto complete achievements feature for Route, Gyms and Dungeons

For the region the user is on, if button is green:

  1. For routes, fight until 10 000 achievement is successful, then move to next road (only on same region)
  2. For gyms, fight until 1 000 achievement is successful, then move to next gym (only on same region)
  3. For dungeons, fight until 500 achievement is successful, then move to next dungeon(only on same region)

image

I tested the code at my best but there may be some bugs. Do not hesitate to test, raise concerns/issues or correct.

Original Credit: Bowbylone (https://github.com/Bowbylone/UpgradedAutoClicker/blob/63376c3027845f3b9d74aa435fc19afad416e549/upgradedAutoClicker.js)

Script Modified by: Dionisos94 (added Gyms, updated to match v2.7)

Auto complete achievements for Route, Gyms and Dungeons

Original Credit: Bowbylone
Script Modified by: Dionisos94
- Move player subregion to match gym or dungeon subregion
- deactivate autogym/dungeon if autoachievement is deactivated
Comment on lines +481 to +483
currentDungeon = newDungeon;
player.subregion = TownList[newDungeon].subRegion;
MapHelper.moveToTown(newDungeon);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this really work?
When you go from a dungeon to another, does the script keep working?
When playing around with it, I needed to leave the dungeon before going to another one...
So I added this:

                // DungeonRunner.dungeonLeave()
                DungeonRunner.dungeonFinished(true);
                DungeonRunner.fighting(false);
                DungeonRunner.fightingBoss(false);
                MapHelper.moveToTown(DungeonRunner.dungeon.name);

If you want to take a look: AreaDestroyer

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for flagging it, I will have a look during the day !

Copy link
Contributor Author

@Dionisos94 Dionisos94 Oct 28, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just did a test.
Are you talking about the next dungeon not starting or the fact the character is not physically moved to the right subregion ?

In Galar, I went from Rose Tower to Dusty Bowl to Courageous Cavern without trouble.
Only issue I had is that my character was not on the Courageous Cavern but on Hammerlocke city when I quitted.

image

Copy link
Contributor

@kevingrillet kevingrillet Oct 28, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, sometimes when you go from a dungeon to another one the script just freezes and autodungeon stop to work.
image

But If you don't have the problem, it's all good :p

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could it be that you beated all Dungeons to more than 500 (assuming you didn't change the value in the code) ?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Enter a dungeon, then try to enter it again ;)
MapHelper.moveToTown(player.town().dungeon.name);

It end up breaking something

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will try ! Thanks for raising it

let regionDungeons = GameConstants.RegionDungeons[player.region];
for(let j = 0; j < regionDungeons.length; j ++)
{
if(getDefeatedOnDungeon(regionDungeons[j]) < GameConstants.ACHIEVEMENT_DEFEAT_DUNGEON_VALUES[GameConstants.ACHIEVEMENT_DEFEAT_DUNGEON_VALUES.length-1])
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you need to check if it's unlocked: dungeonList[dgs[j]].isUnlocked()

let regionGyms = GameConstants.RegionGyms[player.region];
for(let j = 0; j < regionGyms.length; j ++)
{
if(getDefeatedOnGym(regionGyms[j]) < GameConstants.ACHIEVEMENT_DEFEAT_GYM_VALUES[GameConstants.ACHIEVEMENT_DEFEAT_GYM_VALUES.length-1])
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you need to check if it's unlocked: GymList[gym[j]].isUnlocked()

let regionRoutes = Routes.getRoutesByRegion(player.region);
for(let j = 0; j < regionRoutes.length; j ++)
{
if(getDefeatedOnRoute(player.region, regionRoutes[j].number) < GameConstants.ACHIEVEMENT_DEFEAT_ROUTE_VALUES[GameConstants.ACHIEVEMENT_DEFEAT_ROUTE_VALUES.length-1])
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you need to check if it's unlocked: regionRoutes[j].isUnlocked()

@ahlfred
Copy link

ahlfred commented Nov 9, 2022

Route achievement don't seem to be working in johto up to kalos. Kanto, alola and galar is working fine.

@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
@TirOFlanc TirOFlanc mentioned this pull request May 22, 2023
@Ephenia Ephenia added sufficient votes This means the PR has enough votes and passes approval and removed Insufficient votes This means the PR lacks votes and requires more attention for a decision to be made labels Aug 1, 2023
@Ephenia
Copy link
Owner

Ephenia commented Aug 1, 2023

This now has enough votes, but it requires attention still due to merge conflicts.

@NAFEDUDE
Copy link
Contributor

would also like to say it's bugged for Hoenn, likely due to Orre

@JohnyDL
Copy link

JohnyDL commented Apr 10, 2024

Gotta try this one, this is getting very close to an auto-play script XD even if it's once per minute something like this could move regions/routes/dungeons/safari and find the first one with an active quest, PKRS, achieve, etc and try to complete that

Keep up the amazing work

Do we know where about in the code the conflict is? I can take a peek.

@MrPandaa
Copy link

I am working on a version where I took the code from this pr and try to fix everything. Right now I am testing if my changed code still works there were quite a few bugs as it was originally maybe due to changes in the game code since the original Code was quite old at this point. If anyone is interested in helping me test the code if there are any bugs please tell me. I am quite new to the game and I don't have all of Kanto at 100% achievements so I cannot test everything.

@VincentPS
Copy link

I am working on a version where I took the code from this pr and try to fix everything. Right now I am testing if my changed code still works there were quite a few bugs as it was originally maybe due to changes in the game code since the original Code was quite old at this point. If anyone is interested in helping me test the code if there are any bugs please tell me. I am quite new to the game and I don't have all of Kanto at 100% achievements so I cannot test everything.

Any update on this one? Im very interested in this script :)

@MrPandaa
Copy link

it had quite some bugs I am still working on trying to fix Routes seem to be at least working and gyms mostly Auto Dungeon some times stops working I am working on fixing it.
If you want I can give you an Beta Version to see how it works for you

@VincentPS
Copy link

I won't have a lot of time to test things this weekend, but sure. If you can send me the branch i can make sure to check it out and test the functionalities.

@MrPandaa
Copy link

ok my fork is up and public go take a look if everything seems fine i can make a PR (from my testing everything seems fine) but i would help if had some input. unfortunately i used vscode with my auto Format on save so the file looks completely different. is there some guide lines on this because it makes the Diff unreadable since nearly every line is affected.

@VincentPS
Copy link

Thank you, im going to start testing it out today. I will keep you updated!

@VincentPS
Copy link

@MrPandaa

As I'm not a professional Front-end developer but instead a professional Back-end developer i won't be able to easily resolve the issues listed below. I am going to try nonetheless, but keep it in mind.

  • When auto achievement is handling a dungeon, and you switch to handling routes it wont continue to the next pokemon. There is no exception or anything, so i recon this is unintended behavior and needs to be checked for. After further investigating this, it happens when in a dungeon you try to catch a pokemon and then try to switch to the routes option.
  • ^ Issue above has been resolved by adding
// can't do anything if we're catching a pokemon
if (App.game.gameState === GameConstants.GameState.dungeon && DungeonBattle.catching()) {
    return;
}

image

This was the only issue i found after a couple hours of testing.

i made a PR for this here MrPandaa#1

Not sure why i couldn't create a branch and just a PR so i forked it and created a PR like that.

I also updated the file with the newest version from this repository as it was quite behind, and made sure the autoachievement changes are still included, also fixed a bug where switching to autocomplete routes while catching a pokemon in a dungeon the game would freeze. (The bug i reported here earlier)

If you'd like then please take the updated code from https://github.com/VincentPS/Pokeclicker-Scripts/tree/newest-version-and-bug-fix and make a PR in this repository. I think that will also resolve the weird path I've created with the extra fork.

@VincentPS
Copy link

@MrPandaa were you able to take a look at the code?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Merge Conflicting This means that this PR has a merge conflict and it will need to be revised sufficient votes This means the PR has enough votes and passes approval
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants