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

Shutdown of bot after leveling to set number in config? Request #4624

Closed
xSidewinderx opened this issue Aug 23, 2016 · 4 comments
Closed

Shutdown of bot after leveling to set number in config? Request #4624

xSidewinderx opened this issue Aug 23, 2016 · 4 comments

Comments

@xSidewinderx
Copy link

Short Description

I would like to see an option to have to both either sleep or shutdown after a certain level was reached that was set by the user before starting the bot. Could even add on to this option by setting a certain level to reach, but having the bot calculate the xp needed and stretch the process of leveling over a a certain time frame to look more legit.

Possible solution

By using the sleep-schedule already implemented into bot and config.json

How it would help others

It would help improve the mimic of real players.

@drricksanchez321
Copy link

drricksanchez321 commented Aug 23, 2016

I actually did this on my own copy..

modify collect_level_up_reward.py

add to top:
import sys

add to initialize function:
self.quit_at_level = self.config.get("quit_at_level", 999)

Add to the bottom of the _collect_level_reward function (after the level_up_reward emit):

            if self.current_level >= self.quit_at_level:
                sys.exit()

I added my own emit_event, which required changes to other files which I excluded here for brevity.
then you can modify your config for the task to add a level cap:

{
    "type": "CollectLevelUpReward",
    "config":{
        "quit_at_level":28
    }
}

@alexyaoyang
Copy link
Contributor

@drricksanchez321 Do you want to submit a PR with your changes? This could benefit a lot of people on top of not having to change the files back after every bot update 👍

@drricksanchez321
Copy link

I would if I had a clue how to use git for more than pressing Download ZIP on the dev branch... .NET background, TFS user here.

The change is trivial anyhow -- and also not sure sys.exit() is the best to use, or if there's another preferred method to bubble up a workflow termination request from within a task.

@mjmadsen
Copy link
Contributor

Merged.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants