├── requirements.txt ├── .wiki ├── _Footer.md ├── _Sidebar.md ├── Contribute.md ├── ToDo.md ├── Requirements.md ├── Sources.md ├── Advanced.md ├── Debug.md ├── Config.md ├── Home.md ├── Get Started.md └── Images.md ├── images ├── default.jpg ├── en │ ├── skip.jpg │ ├── buy_car.jpg │ ├── colors.jpg │ ├── search.jpg │ ├── value.jpg │ ├── new_rare.jpg │ ├── not_owned.jpg │ ├── race_skip.jpg │ ├── race_type.jpg │ ├── new_common.jpg │ ├── race_reward.jpg │ ├── value_menu.jpg │ ├── race_continue.jpg │ ├── value_selected.jpg │ ├── 0_spins_remaining.jpg │ ├── auction_complete.jpg │ ├── auction_house_won.jpg │ ├── auctions_options.jpg │ ├── buyout_successful.jpg │ ├── car_already_owned.jpg │ ├── insufficient_cr.jpg │ ├── processing_photo.jpg │ ├── cannot_afford_perk.jpg │ ├── loading_please_wait.jpg │ └── collect_prize_and_spin_again.jpg ├── fr │ ├── skip.jpg │ ├── buy_car.jpg │ ├── colors.jpg │ ├── value.jpg │ ├── new_rare.jpg │ ├── not_owned.jpg │ ├── race_skip.jpg │ ├── race_type.jpg │ ├── new_common.jpg │ ├── race_reward.jpg │ ├── value_menu.jpg │ ├── race_continue.jpg │ ├── value_selected.jpg │ ├── 0_spins_remaining.jpg │ ├── car_already_owned.jpg │ ├── insufficient_cr.jpg │ ├── processing_photo.jpg │ ├── cannot_afford_perk.jpg │ ├── loading_please_wait.jpg │ └── collect_prize_and_spin_again.jpg ├── common │ ├── mg.jpg │ ├── ford.jpg │ ├── home.jpg │ ├── autoshow.jpg │ ├── mg_name.jpg │ ├── my_cars.jpg │ ├── pontiac.jpg │ ├── porsche.jpg │ ├── accolades.jpg │ ├── ford_name.jpg │ ├── race_quit.jpg │ ├── race_start.jpg │ ├── 999_mastery.jpg │ ├── already_done.jpg │ ├── pontiac_name.jpg │ ├── porsche_name.jpg │ ├── ford_name_selected.jpg │ ├── lamborghini_name.jpg │ ├── mg_name_selected.jpg │ ├── 999_super_wheelspins.jpg │ ├── auction_house_waiting.jpg │ ├── pontiac_name_selected.jpg │ ├── porsche_name_selected.jpg │ ├── lamborghini_name_selected.jpg │ └── last_car_manufacturer_selected.jpg └── .old │ ├── en │ ├── skip.jpg │ ├── 0_spins_remaining.jpg │ └── campaign_selected.jpg │ └── fr │ ├── filter.jpg │ ├── my_cars.jpg │ ├── salon_auto.jpg │ ├── 0_spins_remaining.jpg │ └── campaign_selected.jpg ├── .github ├── dependabot.yml ├── workflows │ ├── links.yml │ ├── wiki.yml │ ├── dependabot-auto-merge.yml │ └── codeql-analysis.yml └── ISSUE_TEMPLATE │ ├── feature_request.md │ └── bug_report.md ├── utils ├── constant.py ├── superintenum.py ├── superdecorator.py ├── handlerconfig.py ├── handlertime.py ├── common.py ├── handlercv2.py └── handlerwin32.py ├── game ├── constant.py ├── autocarbuy.py ├── autowheelspins.py ├── autogpsdestination.py ├── autocarbuyleastexpensive.py ├── autoracerestart.py ├── autocarbuyauction.py ├── autophotoallmycars.py ├── autolabreplay.py ├── common.py └── autocarmastery.py ├── .gitattributes ├── .gitignore ├── README.md ├── main.py └── LICENSE /requirements.txt: -------------------------------------------------------------------------------- 1 | numpy 2 | PyAutoGUI 3 | opencv-python 4 | pywin32 -------------------------------------------------------------------------------- /.wiki/_Footer.md: -------------------------------------------------------------------------------- 1 | *Thank you very much to everyone who has ever used or contributed to this project.* 2 | -------------------------------------------------------------------------------- /images/default.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kevingrillet/Py-ForzaHorizon5-Tools/HEAD/images/default.jpg -------------------------------------------------------------------------------- /images/en/skip.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kevingrillet/Py-ForzaHorizon5-Tools/HEAD/images/en/skip.jpg -------------------------------------------------------------------------------- /images/fr/skip.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kevingrillet/Py-ForzaHorizon5-Tools/HEAD/images/fr/skip.jpg -------------------------------------------------------------------------------- /images/common/mg.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kevingrillet/Py-ForzaHorizon5-Tools/HEAD/images/common/mg.jpg -------------------------------------------------------------------------------- /images/en/buy_car.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kevingrillet/Py-ForzaHorizon5-Tools/HEAD/images/en/buy_car.jpg -------------------------------------------------------------------------------- /images/en/colors.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kevingrillet/Py-ForzaHorizon5-Tools/HEAD/images/en/colors.jpg -------------------------------------------------------------------------------- /images/en/search.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kevingrillet/Py-ForzaHorizon5-Tools/HEAD/images/en/search.jpg -------------------------------------------------------------------------------- /images/en/value.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kevingrillet/Py-ForzaHorizon5-Tools/HEAD/images/en/value.jpg -------------------------------------------------------------------------------- /images/fr/buy_car.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kevingrillet/Py-ForzaHorizon5-Tools/HEAD/images/fr/buy_car.jpg -------------------------------------------------------------------------------- /images/fr/colors.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kevingrillet/Py-ForzaHorizon5-Tools/HEAD/images/fr/colors.jpg -------------------------------------------------------------------------------- /images/fr/value.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kevingrillet/Py-ForzaHorizon5-Tools/HEAD/images/fr/value.jpg -------------------------------------------------------------------------------- /images/.old/en/skip.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kevingrillet/Py-ForzaHorizon5-Tools/HEAD/images/.old/en/skip.jpg -------------------------------------------------------------------------------- /images/common/ford.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kevingrillet/Py-ForzaHorizon5-Tools/HEAD/images/common/ford.jpg -------------------------------------------------------------------------------- /images/common/home.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kevingrillet/Py-ForzaHorizon5-Tools/HEAD/images/common/home.jpg -------------------------------------------------------------------------------- /images/en/new_rare.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kevingrillet/Py-ForzaHorizon5-Tools/HEAD/images/en/new_rare.jpg -------------------------------------------------------------------------------- /images/en/not_owned.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kevingrillet/Py-ForzaHorizon5-Tools/HEAD/images/en/not_owned.jpg -------------------------------------------------------------------------------- /images/en/race_skip.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kevingrillet/Py-ForzaHorizon5-Tools/HEAD/images/en/race_skip.jpg -------------------------------------------------------------------------------- /images/en/race_type.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kevingrillet/Py-ForzaHorizon5-Tools/HEAD/images/en/race_type.jpg -------------------------------------------------------------------------------- /images/fr/new_rare.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kevingrillet/Py-ForzaHorizon5-Tools/HEAD/images/fr/new_rare.jpg -------------------------------------------------------------------------------- /images/fr/not_owned.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kevingrillet/Py-ForzaHorizon5-Tools/HEAD/images/fr/not_owned.jpg -------------------------------------------------------------------------------- /images/fr/race_skip.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kevingrillet/Py-ForzaHorizon5-Tools/HEAD/images/fr/race_skip.jpg -------------------------------------------------------------------------------- /images/fr/race_type.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kevingrillet/Py-ForzaHorizon5-Tools/HEAD/images/fr/race_type.jpg -------------------------------------------------------------------------------- /images/.old/fr/filter.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kevingrillet/Py-ForzaHorizon5-Tools/HEAD/images/.old/fr/filter.jpg -------------------------------------------------------------------------------- /images/.old/fr/my_cars.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kevingrillet/Py-ForzaHorizon5-Tools/HEAD/images/.old/fr/my_cars.jpg -------------------------------------------------------------------------------- /images/common/autoshow.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kevingrillet/Py-ForzaHorizon5-Tools/HEAD/images/common/autoshow.jpg -------------------------------------------------------------------------------- /images/common/mg_name.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kevingrillet/Py-ForzaHorizon5-Tools/HEAD/images/common/mg_name.jpg -------------------------------------------------------------------------------- /images/common/my_cars.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kevingrillet/Py-ForzaHorizon5-Tools/HEAD/images/common/my_cars.jpg -------------------------------------------------------------------------------- /images/common/pontiac.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kevingrillet/Py-ForzaHorizon5-Tools/HEAD/images/common/pontiac.jpg -------------------------------------------------------------------------------- /images/common/porsche.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kevingrillet/Py-ForzaHorizon5-Tools/HEAD/images/common/porsche.jpg -------------------------------------------------------------------------------- /images/en/new_common.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kevingrillet/Py-ForzaHorizon5-Tools/HEAD/images/en/new_common.jpg -------------------------------------------------------------------------------- /images/en/race_reward.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kevingrillet/Py-ForzaHorizon5-Tools/HEAD/images/en/race_reward.jpg -------------------------------------------------------------------------------- /images/en/value_menu.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kevingrillet/Py-ForzaHorizon5-Tools/HEAD/images/en/value_menu.jpg -------------------------------------------------------------------------------- /images/fr/new_common.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kevingrillet/Py-ForzaHorizon5-Tools/HEAD/images/fr/new_common.jpg -------------------------------------------------------------------------------- /images/fr/race_reward.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kevingrillet/Py-ForzaHorizon5-Tools/HEAD/images/fr/race_reward.jpg -------------------------------------------------------------------------------- /images/fr/value_menu.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kevingrillet/Py-ForzaHorizon5-Tools/HEAD/images/fr/value_menu.jpg -------------------------------------------------------------------------------- /images/common/accolades.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kevingrillet/Py-ForzaHorizon5-Tools/HEAD/images/common/accolades.jpg -------------------------------------------------------------------------------- /images/common/ford_name.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kevingrillet/Py-ForzaHorizon5-Tools/HEAD/images/common/ford_name.jpg -------------------------------------------------------------------------------- /images/common/race_quit.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kevingrillet/Py-ForzaHorizon5-Tools/HEAD/images/common/race_quit.jpg -------------------------------------------------------------------------------- /images/common/race_start.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kevingrillet/Py-ForzaHorizon5-Tools/HEAD/images/common/race_start.jpg -------------------------------------------------------------------------------- /images/en/race_continue.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kevingrillet/Py-ForzaHorizon5-Tools/HEAD/images/en/race_continue.jpg -------------------------------------------------------------------------------- /images/en/value_selected.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kevingrillet/Py-ForzaHorizon5-Tools/HEAD/images/en/value_selected.jpg -------------------------------------------------------------------------------- /images/fr/race_continue.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kevingrillet/Py-ForzaHorizon5-Tools/HEAD/images/fr/race_continue.jpg -------------------------------------------------------------------------------- /images/fr/value_selected.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kevingrillet/Py-ForzaHorizon5-Tools/HEAD/images/fr/value_selected.jpg -------------------------------------------------------------------------------- /images/.old/fr/salon_auto.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kevingrillet/Py-ForzaHorizon5-Tools/HEAD/images/.old/fr/salon_auto.jpg -------------------------------------------------------------------------------- /images/common/999_mastery.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kevingrillet/Py-ForzaHorizon5-Tools/HEAD/images/common/999_mastery.jpg -------------------------------------------------------------------------------- /images/common/already_done.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kevingrillet/Py-ForzaHorizon5-Tools/HEAD/images/common/already_done.jpg -------------------------------------------------------------------------------- /images/common/pontiac_name.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kevingrillet/Py-ForzaHorizon5-Tools/HEAD/images/common/pontiac_name.jpg -------------------------------------------------------------------------------- /images/common/porsche_name.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kevingrillet/Py-ForzaHorizon5-Tools/HEAD/images/common/porsche_name.jpg -------------------------------------------------------------------------------- /images/en/0_spins_remaining.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kevingrillet/Py-ForzaHorizon5-Tools/HEAD/images/en/0_spins_remaining.jpg -------------------------------------------------------------------------------- /images/en/auction_complete.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kevingrillet/Py-ForzaHorizon5-Tools/HEAD/images/en/auction_complete.jpg -------------------------------------------------------------------------------- /images/en/auction_house_won.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kevingrillet/Py-ForzaHorizon5-Tools/HEAD/images/en/auction_house_won.jpg -------------------------------------------------------------------------------- /images/en/auctions_options.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kevingrillet/Py-ForzaHorizon5-Tools/HEAD/images/en/auctions_options.jpg -------------------------------------------------------------------------------- /images/en/buyout_successful.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kevingrillet/Py-ForzaHorizon5-Tools/HEAD/images/en/buyout_successful.jpg -------------------------------------------------------------------------------- /images/en/car_already_owned.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kevingrillet/Py-ForzaHorizon5-Tools/HEAD/images/en/car_already_owned.jpg -------------------------------------------------------------------------------- /images/en/insufficient_cr.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kevingrillet/Py-ForzaHorizon5-Tools/HEAD/images/en/insufficient_cr.jpg -------------------------------------------------------------------------------- /images/en/processing_photo.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kevingrillet/Py-ForzaHorizon5-Tools/HEAD/images/en/processing_photo.jpg -------------------------------------------------------------------------------- /images/fr/0_spins_remaining.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kevingrillet/Py-ForzaHorizon5-Tools/HEAD/images/fr/0_spins_remaining.jpg -------------------------------------------------------------------------------- /images/fr/car_already_owned.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kevingrillet/Py-ForzaHorizon5-Tools/HEAD/images/fr/car_already_owned.jpg -------------------------------------------------------------------------------- /images/fr/insufficient_cr.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kevingrillet/Py-ForzaHorizon5-Tools/HEAD/images/fr/insufficient_cr.jpg -------------------------------------------------------------------------------- /images/fr/processing_photo.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kevingrillet/Py-ForzaHorizon5-Tools/HEAD/images/fr/processing_photo.jpg -------------------------------------------------------------------------------- /images/en/cannot_afford_perk.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kevingrillet/Py-ForzaHorizon5-Tools/HEAD/images/en/cannot_afford_perk.jpg -------------------------------------------------------------------------------- /images/en/loading_please_wait.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kevingrillet/Py-ForzaHorizon5-Tools/HEAD/images/en/loading_please_wait.jpg -------------------------------------------------------------------------------- /images/fr/cannot_afford_perk.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kevingrillet/Py-ForzaHorizon5-Tools/HEAD/images/fr/cannot_afford_perk.jpg -------------------------------------------------------------------------------- /images/fr/loading_please_wait.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kevingrillet/Py-ForzaHorizon5-Tools/HEAD/images/fr/loading_please_wait.jpg -------------------------------------------------------------------------------- /images/.old/en/0_spins_remaining.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kevingrillet/Py-ForzaHorizon5-Tools/HEAD/images/.old/en/0_spins_remaining.jpg -------------------------------------------------------------------------------- /images/.old/en/campaign_selected.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kevingrillet/Py-ForzaHorizon5-Tools/HEAD/images/.old/en/campaign_selected.jpg -------------------------------------------------------------------------------- /images/.old/fr/0_spins_remaining.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kevingrillet/Py-ForzaHorizon5-Tools/HEAD/images/.old/fr/0_spins_remaining.jpg -------------------------------------------------------------------------------- /images/.old/fr/campaign_selected.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kevingrillet/Py-ForzaHorizon5-Tools/HEAD/images/.old/fr/campaign_selected.jpg -------------------------------------------------------------------------------- /images/common/ford_name_selected.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kevingrillet/Py-ForzaHorizon5-Tools/HEAD/images/common/ford_name_selected.jpg -------------------------------------------------------------------------------- /images/common/lamborghini_name.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kevingrillet/Py-ForzaHorizon5-Tools/HEAD/images/common/lamborghini_name.jpg -------------------------------------------------------------------------------- /images/common/mg_name_selected.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kevingrillet/Py-ForzaHorizon5-Tools/HEAD/images/common/mg_name_selected.jpg -------------------------------------------------------------------------------- /images/common/999_super_wheelspins.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kevingrillet/Py-ForzaHorizon5-Tools/HEAD/images/common/999_super_wheelspins.jpg -------------------------------------------------------------------------------- /images/common/auction_house_waiting.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kevingrillet/Py-ForzaHorizon5-Tools/HEAD/images/common/auction_house_waiting.jpg -------------------------------------------------------------------------------- /images/common/pontiac_name_selected.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kevingrillet/Py-ForzaHorizon5-Tools/HEAD/images/common/pontiac_name_selected.jpg -------------------------------------------------------------------------------- /images/common/porsche_name_selected.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kevingrillet/Py-ForzaHorizon5-Tools/HEAD/images/common/porsche_name_selected.jpg -------------------------------------------------------------------------------- /images/common/lamborghini_name_selected.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kevingrillet/Py-ForzaHorizon5-Tools/HEAD/images/common/lamborghini_name_selected.jpg -------------------------------------------------------------------------------- /images/en/collect_prize_and_spin_again.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kevingrillet/Py-ForzaHorizon5-Tools/HEAD/images/en/collect_prize_and_spin_again.jpg -------------------------------------------------------------------------------- /images/fr/collect_prize_and_spin_again.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kevingrillet/Py-ForzaHorizon5-Tools/HEAD/images/fr/collect_prize_and_spin_again.jpg -------------------------------------------------------------------------------- /images/common/last_car_manufacturer_selected.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kevingrillet/Py-ForzaHorizon5-Tools/HEAD/images/common/last_car_manufacturer_selected.jpg -------------------------------------------------------------------------------- /.github/dependabot.yml: -------------------------------------------------------------------------------- 1 | version: 2 2 | updates: 3 | # Maintain dependencies for GitHub Actions 4 | - package-ecosystem: "github-actions" 5 | directory: "/" 6 | schedule: 7 | interval: "daily" 8 | -------------------------------------------------------------------------------- /.wiki/_Sidebar.md: -------------------------------------------------------------------------------- 1 | ## General 2 | 3 | 1. [[Home]] 4 | 2. [[Config]] 5 | 3. [[Requirements]] 6 | 4. [[Get Started]] 7 | 5. [[Advanced]] 8 | 6. [[Sources]] 9 | 10 | ## Development 11 | 12 | - [[Contribute]] 13 | - [[Debug]] 14 | - [[Images]] 15 | - [[ToDo]] 16 | -------------------------------------------------------------------------------- /utils/constant.py: -------------------------------------------------------------------------------- 1 | from enum import auto, Enum 2 | 3 | from utils.superintenum import SuperIntEnum 4 | 5 | 6 | class DebugLevel(SuperIntEnum): 7 | ALWAYS = auto() 8 | INFO = auto() 9 | CLASS = auto() 10 | FUNCTIONS = auto() 11 | DEBUG = auto() 12 | 13 | 14 | class Lang(Enum): 15 | ENGLISH = 'en' 16 | FRENCH = 'fr' 17 | -------------------------------------------------------------------------------- /.github/workflows/links.yml: -------------------------------------------------------------------------------- 1 | name: Links 2 | 3 | on: 4 | push: 5 | paths: 6 | - '**/*.md' 7 | pull_request: 8 | paths: 9 | - '**/*.md' 10 | schedule: 11 | - cron: '0 0 * * SUN' 12 | 13 | jobs: 14 | linkChecker: 15 | runs-on: ubuntu-latest 16 | steps: 17 | - uses: actions/checkout@v3 18 | 19 | - name: Link Checker 20 | uses: lycheeverse/lychee-action@v1.6.1 21 | with: 22 | args: --verbose --no-progress **/*.md 23 | env: 24 | GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}} 25 | -------------------------------------------------------------------------------- /.wiki/Contribute.md: -------------------------------------------------------------------------------- 1 | If you want to contribute, please pick an [issue](https://github.com/kevingrillet/Py-ForzaHorizon5-Tools/issues) and 2 | send a PR :feelsgood: 3 | 4 | You can also look at the [ToDo](https://github.com/kevingrillet/Py-ForzaHorizon5-Tools/wiki/ToDo). 5 | 6 | I'm using `PyCharm` to dev this tool. 7 | 8 |
9 | 10 |
11 | Previous page 12 | | 13 | Next page 14 |
15 | -------------------------------------------------------------------------------- /.wiki/ToDo.md: -------------------------------------------------------------------------------- 1 | ## High priority 2 | 3 | ## Medium priority 4 | 5 | - Remove or find max? `GameCommon.check_super_wheelspins` and `999_super_wheelspins`because 999 is not the max : 6 | trollface: 7 | 8 | ## Low priority 9 | 10 | ## Bonus 11 | 12 | - Add tkinter label top left corner to show which step is running: 13 | - 14 | - 15 | 16 |
17 | 18 |
19 | Previous page 20 | | 21 | Next page 22 |
23 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/feature_request.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Feature request 3 | about: Suggest an idea for this project 4 | title: '' 5 | labels: 'enhancement' 6 | assignees: '' 7 | 8 | --- 9 | 10 | **Is your feature request related to a problem? Please describe.** 11 | A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] 12 | 13 | **Describe the solution you'd like** 14 | A clear and concise description of what you want to happen. 15 | 16 | **Describe alternatives you've considered** 17 | A clear and concise description of any alternative solutions or features you've considered. 18 | 19 | **Additional context** 20 | Add any other context or screenshots about the feature request here. 21 | -------------------------------------------------------------------------------- /.github/workflows/wiki.yml: -------------------------------------------------------------------------------- 1 | name: Deploy Wiki 2 | 3 | on: 4 | push: 5 | paths: 6 | # Trigger only when wiki directory changes 7 | - '.wiki/**' 8 | branches: 9 | # And only on master branch 10 | - main 11 | 12 | jobs: 13 | deploy-wiki: 14 | runs-on: ubuntu-latest 15 | steps: 16 | - uses: actions/checkout@v3 17 | 18 | - name: Push Wiki Changes 19 | uses: Andrew-Chen-Wang/github-wiki-action@v3 20 | env: 21 | # Make sure you have that / at the end. We use rsync 22 | WIKI_DIR: .wiki/ 23 | GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} 24 | GH_MAIL: ${{ secrets.GH_MAIL }} 25 | GH_NAME: ${{ github.repository_owner }} 26 | -------------------------------------------------------------------------------- /.wiki/Requirements.md: -------------------------------------------------------------------------------- 1 | - Forza Horizon 5 running in fullscreen 2 | - Keyboard layout: 3 | - English 4 | - **French** 5 | - Language: 6 | - English 7 | - **French** 8 | - Resolution: 9 | - **QHD: `2560x1440`** 10 | - HD 1080p: `1920x1080` 11 | 12 | ## Other language 13 | 14 | If you want to use another language, please set it with [[Config]]. 15 | 16 | ## Other resolution 17 | 18 | If you want to use another resolution, please set it with [[Config]]. 19 | 20 |
21 | 22 |
23 | Previous page 24 | | 25 | Next page 26 |
27 | -------------------------------------------------------------------------------- /.github/workflows/dependabot-auto-merge.yml: -------------------------------------------------------------------------------- 1 | name: Dependabot auto-merge 2 | on: pull_request 3 | 4 | permissions: 5 | contents: write 6 | pull-requests: write 7 | 8 | jobs: 9 | dependabot: 10 | runs-on: ubuntu-latest 11 | if: ${{ github.actor == 'dependabot[bot]' }} 12 | steps: 13 | - name: Dependabot metadata 14 | id: metadata 15 | uses: dependabot/fetch-metadata@v1.3.6 16 | with: 17 | github-token: "${{ secrets.GITHUB_TOKEN }}" 18 | - name: Enable auto-merge for Dependabot PRs 19 | run: gh pr merge --auto --merge "$PR_URL" 20 | env: 21 | PR_URL: ${{github.event.pull_request.html_url}} 22 | GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}} 23 | 24 | -------------------------------------------------------------------------------- /game/constant.py: -------------------------------------------------------------------------------- 1 | from enum import auto, Enum 2 | 3 | from utils.constant import DebugLevel, Lang 4 | from utils.superintenum import SuperIntEnum 5 | 6 | 7 | class AlreadyOwnedChoice(SuperIntEnum): 8 | ADD_TO_GARAGE = auto() 9 | SELL = auto() 10 | 11 | 12 | class Car(Enum): 13 | FORD = 'ford' 14 | MG = 'mg' 15 | PONTIAC = 'pontiac' 16 | PORSCHE = 'porsche' 17 | 18 | 19 | class RaceStep(SuperIntEnum): 20 | INIT = auto() 21 | PREPARING = auto() 22 | RACING = auto() 23 | REWARDS = auto() 24 | CHECK = auto() 25 | RESTART = auto() 26 | 27 | 28 | CAR = Car.PONTIAC 29 | DEBUG_LEVEL = DebugLevel.ALWAYS 30 | DEV_MODE = False 31 | LANG = Lang.FRENCH 32 | SCALE = 1 33 | OWNED = AlreadyOwnedChoice.SELL 34 | WINDOW_NAME = 'Forza Horizon 5' 35 | -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | # Auto detect text files and perform LF normalization 2 | * text=auto 3 | 4 | # Basic .gitattributes for a python repo. 5 | 6 | # Source files 7 | # ============ 8 | *.pxd text diff=python 9 | *.py text diff=python 10 | *.py3 text diff=python 11 | *.pyw text diff=python 12 | *.pyx text diff=python 13 | *.pyz text diff=python 14 | *.pyi text diff=python 15 | 16 | # Binary files 17 | # ============ 18 | *.db binary 19 | *.p binary 20 | *.pkl binary 21 | *.pickle binary 22 | *.pyc binary 23 | *.pyd binary 24 | *.pyo binary 25 | 26 | # Jupyter notebook 27 | *.ipynb text 28 | 29 | # Note: .db, .p, and .pkl files are associated 30 | # with the python modules ``pickle``, ``dbm.*``, 31 | # ``shelve``, ``marshal``, ``anydbm``, & ``bsddb`` 32 | # (among others). 33 | -------------------------------------------------------------------------------- /.wiki/Sources.md: -------------------------------------------------------------------------------- 1 | - Learn Code By Gaming: 2 | - Sentdex: 3 | - Stoodjarguar6577: & 4 | - `strfdelta`: 5 | - `get_keyboard_language`: 6 | - `fps`: 7 | - `scroll`: 8 | - `logging`: 9 | - Decorator: 10 | - 11 | - 12 | - 13 | 14 |
15 | 16 |
17 | Previous page 18 | | 19 | Next page 20 |
21 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/bug_report.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Bug report 3 | about: Create a report to help us improve 4 | title: '' 5 | labels: 'bug' 6 | assignees: '' 7 | 8 | --- 9 | 10 | **Describe the bug** 11 | A clear and concise description of what the bug is. 12 | 13 | **To Reproduce** 14 | Steps to reproduce the behavior: 15 | 1. Go to '...' 16 | 2. Click on '....' 17 | 3. Scroll down to '....' 18 | 4. See error 19 | 20 | **Expected behavior** 21 | A clear and concise description of what you expected to happen. 22 | 23 | **Screenshots** 24 | If applicable, add screenshots to help explain your problem. 25 | 26 | **Desktop (please complete the following information):** 27 | - OS: [e.g. iOS] 28 | - Browser [e.g. chrome, safari] 29 | - Version [e.g. 22] 30 | 31 | **Smartphone (please complete the following information):** 32 | - Device: [e.g. iPhone6] 33 | - OS: [e.g. iOS8.1] 34 | - Browser [e.g. stock browser, safari] 35 | - Version [e.g. 22] 36 | 37 | **Additional context** 38 | Add any other context about the problem here. 39 | -------------------------------------------------------------------------------- /game/autocarbuy.py: -------------------------------------------------------------------------------- 1 | from utils import common, superdecorator 2 | from utils.handlercv2 import HandlerCv2 3 | from utils.handlertime import HandlerTime 4 | 5 | 6 | @superdecorator.decorate_all_functions() 7 | class AutoCarBuy: 8 | 9 | def __init__(self, hcv2: HandlerCv2 = None): 10 | """ 11 | Prepare to auto buy cars 12 | :param hcv2: 13 | """ 14 | self.hcv2 = hcv2 if hcv2 else HandlerCv2() 15 | self.images = self.hcv2.load_images(['buy_car', 'insufficient_cr']) 16 | self.ht = HandlerTime() 17 | self.running = False 18 | 19 | def run(self, max_try: int = 50): 20 | """ 21 | Buys the car where you are placed (in car collection) 22 | :param max_try: 23 | """ 24 | common.sleep(5, 'Waiting 5 secs, please focus Forza Horizon 5.') 25 | common.moveTo((10, 10)) 26 | count = 0 27 | self.running = True 28 | self.ht.start() 29 | while self.running and count < max_try: 30 | if self.hcv2.check_match(self.images['insufficient_cr'], True): 31 | common.press('esc') 32 | common.press('esc') 33 | self.running = False 34 | elif self.hcv2.check_match(self.images['buy_car']): 35 | common.press('enter') 36 | count += 1 37 | common.info('Car bought! [' + str(count) + '/' + str(max_try) + ' in ' + self.ht.stringify() + ']') 38 | else: 39 | common.press('y') 40 | common.sleep(1) 41 | common.press('esc', 2) 42 | -------------------------------------------------------------------------------- /game/autowheelspins.py: -------------------------------------------------------------------------------- 1 | from game.common import GameCommon 2 | from utils import common, superdecorator 3 | from utils.handlercv2 import HandlerCv2 4 | from utils.handlertime import HandlerTime 5 | 6 | 7 | @superdecorator.decorate_all_functions() 8 | class AutoWheelspins: 9 | def __init__(self, hcv2: HandlerCv2 = None, gc: GameCommon = None): 10 | """ 11 | Prepare to auto wheelspin 12 | :param hcv2: 13 | """ 14 | self.hcv2 = hcv2 if hcv2 else HandlerCv2() 15 | self.gc = gc if gc else GameCommon(self.hcv2) 16 | self.images = self.hcv2.load_images(['0_spins_remaining', 'collect_prize_and_spin_again', 'skip']) 17 | self.ht = HandlerTime() 18 | self.running = False 19 | 20 | def run(self): 21 | """ 22 | Need to be run in the spin window 23 | """ 24 | common.sleep(5, 'Waiting 5 secs, please focus Forza Horizon 5.') 25 | common.moveTo((10, 10)) 26 | count = 0 27 | self.running = True 28 | self.ht.start() 29 | while self.running: 30 | if self.hcv2.check_match(self.images['collect_prize_and_spin_again'], True): 31 | common.press('enter') 32 | count += 1 33 | common.info('Collect [' + str(count) + ' in ' + self.ht.stringify() + ']') 34 | elif self.hcv2.check_match(self.images['skip']): 35 | common.press('enter') 36 | elif self.gc.check_car_already_own(): 37 | pass 38 | elif self.hcv2.check_match(self.images['0_spins_remaining']): 39 | common.sleep(2) 40 | if self.hcv2.check_match(self.images['0_spins_remaining'], True): 41 | common.press('enter') 42 | self.running = False 43 | -------------------------------------------------------------------------------- /game/autogpsdestination.py: -------------------------------------------------------------------------------- 1 | from utils import common, superdecorator 2 | from utils.handlercv2 import HandlerCv2 3 | 4 | 5 | @superdecorator.decorate_all_functions() 6 | class AutoGPSDestination: 7 | def __init__(self, hcv2: HandlerCv2 = None): 8 | """ 9 | Prepare to drive to destination 10 | :param hcv2: 11 | """ 12 | self.hcv2 = hcv2 if hcv2 else HandlerCv2() 13 | color_d = 20 # delta 14 | color_gps = (255, 237, 62) # [255 237 62] in BGR 15 | self.color_range_lower = (color_gps[0] - color_d, color_gps[1] - color_d, color_gps[2] - color_d) 16 | self.color_range_upper = (color_gps[0] + color_d, color_gps[1] + color_d, color_gps[2] + color_d) 17 | cursor_loc = (260, 1230) # Location 18 | map_d = 200 # delta 19 | self.map_rect = (cursor_loc[0] - map_d, cursor_loc[1] - map_d, cursor_loc[0] + map_d, cursor_loc[1] + map_d) 20 | self.running = False 21 | 22 | def run(self): 23 | """ 24 | Need to be run from game esc menu 25 | """ 26 | common.sleep(5, 'Waiting 5 secs, please focus Forza Horizon 5.') 27 | common.moveTo((10, 10)) 28 | common.press('esc') 29 | common.keyDown('z', 2) 30 | count = 0 31 | self.running = True 32 | while self.running: 33 | self.hcv2.require_new_capture = True 34 | if not self.hcv2.check_color(self.color_range_lower, self.color_range_upper, self.map_rect): 35 | common.info('Path not found: ' + str(count)) 36 | count += 1 37 | if count >= 2: 38 | common.debug('Stop') 39 | self.running = False 40 | else: 41 | count = 0 42 | common.sleep(.25) 43 | common.keyDown('z') 44 | common.press('esc', 0) 45 | -------------------------------------------------------------------------------- /.wiki/Advanced.md: -------------------------------------------------------------------------------- 1 | *:construction: means probably broken...* 2 | 3 | - [AutoCarBuy + AutoCarMastery](#autocarbuy--autocarmastery) 4 | - [AutoCarBuy + AutoCarMastery + AutoLabReplay :construction:](#autocarbuy--autocarmastery--autolabreplay-construction) 5 | - [AutoCarBuy + AutoCarMastery + AutoRaceRestart](#autocarbuy--autocarmastery--autoracerestart) 6 | - [Just press z](#just-press-z) 7 | 8 | ## AutoCarBuy + AutoCarMastery 9 | 10 | Choice `45`. 11 | 12 | *The car you buy "need" to correspond to the car chosen in config.* 13 | 14 | - Place on the car you want to buy in car collection 15 | 16 | ![](https://user-images.githubusercontent.com/7203617/143294156-0c9c793d-3cbb-4f04-8396-8de6423ba5d0.jpg) 17 | 18 | - Launch the script 19 | - Set focus on Forza 20 | 21 | ## AutoCarBuy + AutoCarMastery + AutoLabReplay :construction: 22 | 23 | Choice `453`. 24 | 25 | **Require to have a Lamborghini as favorite car, and be in it at the start.** 26 | 27 | Need to be started from game default esc menu. 28 | 29 | Will alt tab, check if max mastery, if `true` then AutoCarBuy + AutoCarMastery 30 | 31 | Then loop 32 | 33 | - AutoLabReplay 34 | - Check mastery 35 | - AutoCarBuy + AutoCarMastery 36 | 37 | ## AutoCarBuy + AutoCarMastery + AutoRaceRestart 38 | 39 | Choice `457`. 40 | 41 | **Require to have a Lamborghini as favorite car, and be in it at the start.** 42 | 43 | Need to be started from game default esc menu. 44 | 45 | Will alt tab, check if max mastery, if `true` then AutoCarBuy + AutoCarMastery 46 | 47 | Then loop 48 | 49 | - AutoRaceRestart (will run the last lab race) 50 | - Check mastery 51 | - AutoCarBuy + AutoCarMastery 52 | 53 | ## Just press z 54 | 55 | Choice `99`. 56 | 57 | Will alt tab, press `esc`, then hold `z` 58 | 59 |
60 | 61 |
62 | Previous page 63 | | 64 | Next page 65 |
66 | -------------------------------------------------------------------------------- /utils/superintenum.py: -------------------------------------------------------------------------------- 1 | from enum import IntEnum 2 | 3 | 4 | class SuperIntEnum(IntEnum): 5 | def __eq__(self, other): 6 | if self.__class__ is other.__class__: 7 | return self.value == other.value 8 | return NotImplemented 9 | 10 | def __gt__(self, other): 11 | if self.__class__ is other.__class__: 12 | return self.value > other.value 13 | return NotImplemented 14 | 15 | def __lt__(self, other): 16 | if self.__class__ is other.__class__: 17 | return self.value < other.value 18 | return NotImplemented 19 | 20 | def _generate_next_value_(self, start, count, last_values): 21 | return count 22 | 23 | def first(self): 24 | """ 25 | return first element of the enum 26 | """ 27 | cls = self.__class__ 28 | members = list(cls) 29 | if len(members) == 0: 30 | raise ValueError('Enumeration has no values') 31 | return members[0] 32 | 33 | def last(self): 34 | """ 35 | return last element of the enum 36 | """ 37 | cls = self.__class__ 38 | members = list(cls) 39 | if len(members) == 0: 40 | raise ValueError('Enumeration has no values') 41 | return members[-1] 42 | 43 | def prev(self, step: int = 1): 44 | """ 45 | return previous element of the enum 46 | """ 47 | cls = self.__class__ 48 | members = list(cls) 49 | index = members.index(self) - step 50 | if index < 0: 51 | raise StopIteration('Enumeration ended') 52 | return members[index] 53 | 54 | def next(self, step: int = 1): 55 | """ 56 | return next element of the enum 57 | """ 58 | cls = self.__class__ 59 | members = list(cls) 60 | index = members.index(self) + step 61 | if index >= len(members): 62 | raise StopIteration('Enumeration ended') 63 | return members[index] 64 | -------------------------------------------------------------------------------- /utils/superdecorator.py: -------------------------------------------------------------------------------- 1 | import time 2 | from functools import wraps 3 | 4 | from utils import common 5 | from utils.constant import DebugLevel 6 | from utils.handlertime import HandlerTime 7 | 8 | 9 | def print_on_call(func): 10 | @wraps(func) 11 | def wrapper(*args, **kwargs): 12 | is__init__ = func.__qualname__.find('__init__') != -1 13 | name = func.__qualname__.replace('.__init__', '') if is__init__ else func.__qualname__ 14 | debugLevel = DebugLevel.CLASS if is__init__ else DebugLevel.FUNCTIONS 15 | my_args = list(filter(lambda x: not hasattr(x, '__dict__'), args)) 16 | common.debug('{} {}{}'.format( 17 | name, 18 | 'created' if is__init__ else 'called', 19 | ' [{}{}{}]'.format('args: {}'.format(my_args) if my_args else '', 20 | ', ' if my_args and kwargs else '', 21 | 'kwargs: {}'.format(kwargs) if kwargs else '' 22 | ) if my_args or kwargs else ''), debugLevel) 23 | start_time = time.time() 24 | res = None 25 | try: 26 | res = func(*args, **kwargs) 27 | finally: 28 | if not is__init__: 29 | common.debug( 30 | '{} finished in {}{}'.format(name, 31 | HandlerTime.handle_stringify(time.time() - start_time), 32 | ' [return: {}]'.format(str(res)) if (res is not None) else ''), 33 | debugLevel) 34 | return res 35 | 36 | return wrapper 37 | 38 | 39 | def decorate_all_functions(function_decorator=print_on_call): 40 | def decorator(cls): 41 | for name, obj in vars(cls).items(): 42 | if callable(obj): 43 | try: 44 | obj = obj.__func__ # unwrap Python 2 unbound method 45 | except AttributeError: 46 | pass # not needed in Python 3 47 | setattr(cls, name, function_decorator(obj)) 48 | return cls 49 | 50 | return decorator 51 | -------------------------------------------------------------------------------- /utils/handlerconfig.py: -------------------------------------------------------------------------------- 1 | import os 2 | from configparser import SafeConfigParser 3 | 4 | from game import constant 5 | 6 | 7 | class HandlerConfig: 8 | def __init__(self, path: str): 9 | """ 10 | Create handler and read config from path 11 | :param path: 12 | """ 13 | self.path = None 14 | self.config: SafeConfigParser = SafeConfigParser() 15 | self.set_path(path) 16 | self.create_default() 17 | 18 | def create_default(self): 19 | """ 20 | Create default config.ini file 21 | """ 22 | if not os.path.isfile(self.path): 23 | self.set_value('car', str(constant.CAR.value)) 24 | self.set_value('debug', str(constant.DEBUG_LEVEL.value)) 25 | self.set_value('dev', str(constant.DEV_MODE)) 26 | self.set_value('language', str(constant.LANG.value)) 27 | self.set_value('owned', str(constant.OWNED.value)) 28 | self.set_value('scale', str(constant.SCALE)) 29 | 30 | def get_value(self, key: str = None, default: str = None, section: str = 'main') -> str: 31 | """ 32 | Get value from config 33 | :param key: 34 | :param default: 35 | :param section: 36 | :return: 37 | """ 38 | if not self.config: 39 | raise NameError('No config file loaded') 40 | if not (section and key): 41 | raise NameError('Missing parameter') 42 | return self.config.get(section, key, fallback=default) 43 | 44 | def set_path(self, path: str = None): 45 | """ 46 | Set path to config and load it in self.config 47 | :param path: 48 | """ 49 | self.path = path 50 | if not path: 51 | raise NameError('Missing path') 52 | self.config.read(self.path) 53 | if not self.config.has_section('main'): 54 | self.config.add_section('main') 55 | 56 | def set_value(self, key: str = None, value: str = None, section: str = 'main'): 57 | """ 58 | Set value and save config.ini 59 | :param key: 60 | :param value: 61 | :param section: 62 | """ 63 | if not (section and key and value): 64 | raise NameError('Missing parameter') 65 | self.config.set(section, key, value) 66 | self.config.write(open(self.path, 'w')) 67 | -------------------------------------------------------------------------------- /.wiki/Debug.md: -------------------------------------------------------------------------------- 1 | - [Dev tools](#dev-tools) 2 | - [Image debug](#image-debug) 3 | 4 | ## Dev tools 5 | 6 | Choice `0`. 7 | 8 | ## Image debug 9 | 10 | Choice `98`. 11 | 12 | Then choose your image to find. 13 | 14 | ``` 15 | Your choice: 16 | 98 17 | 18 | List of images: 19 | 0_spins_remaining 999_mastery 999_super_wheelspins accolades 20 | already_done auction_complete auction_house_waiting auction_house_won 21 | auctions_options autoshow buy_car buyout_successful 22 | cannot_afford_perk car_already_owned collect_prize_and_spin_again colors 23 | ford ford_name ford_name_selected home 24 | insufficient_cr lamborghini_name lamborghini_name_selected last_car_manufacturer_selected 25 | loading_please_wait my_cars new_common new_rare 26 | not_owned pontiac pontiac_name pontiac_name_selected 27 | porsche porsche_name porsche_name_selected processing_photo 28 | race_continue race_quit race_reward race_skip 29 | race_start race_type search skip 30 | value value_menu value_selected 31 | 32 | Choose image to search: 33 | car_already_owned 34 | 35 | find: True 36 | find_max_val: 0.9993559122085571 37 | find_start: (1072, 248) 38 | find_end: (1488, 301) 39 | ``` 40 | 41 |
42 | 43 |
44 | Previous page 45 | | 46 | Next page 47 |
48 | -------------------------------------------------------------------------------- /.github/workflows/codeql-analysis.yml: -------------------------------------------------------------------------------- 1 | # For most projects, this workflow file will not need changing; you simply need 2 | # to commit it to your repository. 3 | # 4 | # You may wish to alter this file to override the set of languages analyzed, 5 | # or to provide custom queries or build logic. 6 | # 7 | # ******** NOTE ******** 8 | # We have attempted to detect the languages in your repository. Please check 9 | # the `language` matrix defined below to confirm you have the correct set of 10 | # supported CodeQL languages. 11 | # 12 | name: "CodeQL" 13 | 14 | on: 15 | push: 16 | branches: [ main ] 17 | pull_request: 18 | # The branches below must be a subset of the branches above 19 | branches: [ main ] 20 | schedule: 21 | - cron: '0 0 * * SUN' 22 | 23 | jobs: 24 | analyze: 25 | name: Analyze 26 | runs-on: ubuntu-latest 27 | permissions: 28 | actions: read 29 | contents: read 30 | security-events: write 31 | 32 | strategy: 33 | fail-fast: false 34 | matrix: 35 | language: [ 'python' ] 36 | # CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python', 'ruby' ] 37 | # Learn more about CodeQL language support at https://git.io/codeql-language-support 38 | 39 | steps: 40 | - name: Checkout repository 41 | uses: actions/checkout@v3 42 | 43 | # Initializes the CodeQL tools for scanning. 44 | - name: Initialize CodeQL 45 | uses: github/codeql-action/init@v2 46 | with: 47 | languages: ${{ matrix.language }} 48 | # If you wish to specify custom queries, you can do so here or in a config file. 49 | # By default, queries listed here will override any specified in a config file. 50 | # Prefix the list here with "+" to use these queries and those in the config file. 51 | # queries: ./path/to/local/query, your-org/your-repo/queries@main 52 | 53 | # Autobuild attempts to build any compiled languages (C/C++, C#, or Java). 54 | # If this step fails, then you should remove it and run the build manually (see below) 55 | - name: Autobuild 56 | uses: github/codeql-action/autobuild@v2 57 | 58 | # ℹ️ Command-line programs to run using the OS shell. 59 | # 📚 https://git.io/JvXDl 60 | 61 | # ✏️ If the Autobuild fails above, remove it and uncomment the following three lines 62 | # and modify them (or add more) to build your code if your project 63 | # uses a compiled language 64 | 65 | #- run: | 66 | # make bootstrap 67 | # make release 68 | 69 | - name: Perform CodeQL Analysis 70 | uses: github/codeql-action/analyze@v2 71 | -------------------------------------------------------------------------------- /game/autocarbuyleastexpensive.py: -------------------------------------------------------------------------------- 1 | from utils import common, superdecorator 2 | from utils.handlercv2 import HandlerCv2 3 | from utils.handlertime import HandlerTime 4 | 5 | 6 | @superdecorator.decorate_all_functions() 7 | class AutoCarBuyLeastExpensive: 8 | def __init__(self, hcv2: HandlerCv2 = None): 9 | """ 10 | Prepare to auto buy lest expensive car 11 | :param hcv2: 12 | """ 13 | self.hcv2 = hcv2 if hcv2 else HandlerCv2() 14 | self.images = self.hcv2.load_images( 15 | ['autoshow', 'colors', 'not_owned', 'insufficient_cr', 'value', 'value_menu', 'value_selected']) 16 | self.ht = HandlerTime() 17 | self.running = False 18 | 19 | def run(self, max_try: int = 25): 20 | """ 21 | Need to be run from home buy/sell tab 22 | :param max_try: 23 | """ 24 | common.sleep(5, 'Waiting 5 secs, please focus Forza Horizon 5.') 25 | common.sleep(5) 26 | common.moveTo((10, 10)) 27 | self.running = True 28 | count = 0 29 | self.ht.start() 30 | while self.running and count < max_try: 31 | # Enter salon 32 | if not self.hcv2.check_match(self.images['autoshow'], True): 33 | raise NameError('Not at autoshow [autoshow]') 34 | common.press('enter', 2) 35 | # Filter not buy 36 | common.press('y') 37 | if not self.hcv2.check_match(self.images['not_owned'], True): 38 | raise NameError('Filter not found [not_owned]') 39 | common.click(self.hcv2.random_find(), .125) 40 | common.press('esc', 2) 41 | # Sort 42 | common.press('x') 43 | if not self.hcv2.check_match(self.images['value'], True): 44 | raise NameError('Sort not found [value]') 45 | common.click(self.hcv2.random_find(), .125) 46 | if self.hcv2.check_match(self.images['value_selected'], True): 47 | common.press('enter') 48 | common.sleep(1) 49 | # GoTo the least expensive 50 | common.press('backspace') 51 | if not self.hcv2.check_match(self.images['value_menu'], True): 52 | raise NameError('Jump to value not found [value_menu]') 53 | common.click((570, self.hcv2.find_end[2] + 54)) 54 | if self.hcv2.check_match(self.images['value_menu'], True): 55 | common.press('enter', 2) 56 | # Buy 57 | common.press('enter', 1) 58 | while not self.hcv2.check_match(self.images['colors'], True): 59 | common.sleep(.1) 60 | common.press('y', 2) 61 | common.press('enter', 1) 62 | common.press('enter', 1) 63 | if self.hcv2.check_match(self.images['insufficient_cr'], True): 64 | raise NameError('Not enough CR [insufficient_cr]') 65 | common.press('enter', 20) 66 | common.press('esc', 3) 67 | 68 | count += 1 69 | common.info('Car bought! [' + str(count) + '/' + str(max_try) + ' in ' + self.ht.stringify() + ']') 70 | common.sleep(1) 71 | -------------------------------------------------------------------------------- /.wiki/Config.md: -------------------------------------------------------------------------------- 1 | Edit `config.ini` next to `main.py`. The file is created at first launch. 2 | 3 | ## Default values 4 | 5 | ```ini 6 | [main] 7 | car = pontiac 8 | debug = 0 9 | dev = False 10 | language = fr 11 | owned = 1 12 | scale = 1 13 | ``` 14 | 15 | ## Description 16 | 17 | | Options | Type | Nullable | Description | Values | 18 | |------------|---------|----------|---------------------------------------------------------------------|------------------------------------| 19 | | `car` | `str` | Yes | Set the car to buy / master. | `ford`, `mg`, `pontiac`, `porsche` | 20 | | `debug` | `int` | Yes | Set the verbosity of the script. Higher values will have more text. | `0`-`4` | 21 | | `dev` | `bool` | Yes | Set dev mode. Will save images in `.temp/` folder. | `True`, `False` | 22 | | `language` | `str` | Yes | Set language for the image folder. | `en`, `fr` | 23 | | `owned` | `int` | Yes | Set the action if car already owned. | `0`-`1` | 24 | | `scale` | `float` | Yes | Set scale. | `1`, `0.75` | 25 | 26 | ## More info 27 | 28 | ### Car 29 | 30 | Car enum can be found here: 31 | 32 | | Name | Value | 33 | |:---------:|:---------:| 34 | | `FORD` | `ford` | 35 | | `MG` | `mg` | 36 | | `PONTIAC` | `pontiac` | 37 | | `PORSCHE` | `porsche` | 38 | | | | 39 | 40 | ### Debug 41 | 42 | Debug enum can be found here: 43 | 44 | | Name | Value | 45 | |:-----------:|:-----:| 46 | | `ALWAYS` | `0` | 47 | | `INFO` | `1` | 48 | | `CLASS` | `2` | 49 | | `FUNCTIONS` | `3` | 50 | | `DEBUG` | `4` | 51 | | | | 52 | 53 | ### Language 54 | 55 | Lang enum can be found here: 56 | 57 | | Name | Value | 58 | |:---------:|:-----:| 59 | | `ENGLISH` | `en` | 60 | | `FRENCH` | `fr` | 61 | | | | 62 | 63 | ### Owned 64 | 65 | Owned enum can be found here: 66 | 67 | | Name | Value | 68 | |:---------------:|:-----:| 69 | | `ADD_TO_GARAGE` | `0` | 70 | | `SELL` | `1` | 71 | | | | 72 | 73 | ### Scale 74 | 75 | Scale is based on mine: `QHD` which is: `2560x1440`. 76 | 77 | | Name | Resolution | Scale | 78 | |:------------------------:|:-----------:|:------:| 79 | | `WQHD` / `QHD` / `1440p` | `2560x1440` | `1` | 80 | | `HD 1080` / `1080p` | `1920x1080` | `0.75` | 81 | 82 |
83 | 84 |
85 | Previous page 86 | | 87 | Next page 88 |
89 | -------------------------------------------------------------------------------- /game/autoracerestart.py: -------------------------------------------------------------------------------- 1 | from game.constant import RaceStep 2 | from utils import common, superdecorator 3 | from utils.handlercv2 import HandlerCv2 4 | from utils.handlertime import HandlerTime 5 | 6 | 7 | @superdecorator.decorate_all_functions() 8 | class AutoRaceRestart: 9 | 10 | def __init__(self, hcv2: HandlerCv2 = None): 11 | """ 12 | Prepare for farming races 13 | :param hcv2: 14 | """ 15 | self.hcv2 = hcv2 if hcv2 else HandlerCv2() 16 | self.images = self.hcv2.load_images(['race_continue', 'race_quit', 'race_start']) 17 | self.ht = HandlerTime() 18 | self.count = 0 19 | self.running = False 20 | self.step = RaceStep.INIT 21 | 22 | def next_step(self, step: RaceStep = None): 23 | """ 24 | Set next step and reset count 25 | :param step: 26 | """ 27 | next_step: RaceStep = step if step else self.step.next() 28 | common.info( 29 | 'Step done: ' + self.step.name + ' [' + str(self.count) + ' in ' + self.ht.stringify() + '] -> next: ' + 30 | next_step.name) 31 | self.step = next_step 32 | self.count = 0 33 | 34 | def run(self, max_try: int = 100): 35 | """ 36 | Need to be started from race, or esc menu, or race preparation menu 37 | :param max_try: 38 | """ 39 | common.sleep(5, 'Waiting 5 secs, please focus Forza Horizon 5.') 40 | common.moveTo((10, 10)) 41 | count_try = 0 42 | self.ht.start() 43 | self.whereami() 44 | self.running = True 45 | while self.running and count_try < max_try: 46 | self.hcv2.require_new_capture = True 47 | 48 | if self.step == RaceStep.PREPARING: 49 | if self.hcv2.check_match(self.images['race_start']): 50 | common.click(self.hcv2.random_find()) 51 | common.keyDown('z') 52 | self.next_step() 53 | else: 54 | common.sleep(1) 55 | self.count += 1 56 | if self.count > 10: 57 | self.whereami() 58 | 59 | elif self.step == RaceStep.RACING: 60 | if self.hcv2.check_match(self.images['race_continue']): 61 | common.keyUp('z') 62 | self.next_step() 63 | 64 | elif self.step == RaceStep.REWARDS: 65 | common.sleep(1) 66 | if self.hcv2.check_match(self.images['race_continue']): 67 | count_try += 1 68 | common.info('Race done. [' + str(count_try) + '/' + str(max_try) + ']') 69 | common.press('x') 70 | common.press('enter', 5) 71 | self.next_step(RaceStep.PREPARING) 72 | 73 | def whereami(self): 74 | """ 75 | Check where am I to set initial step 76 | """ 77 | if self.hcv2.check_match(self.images['race_quit']): 78 | common.press('esc') 79 | common.keyDown('z') 80 | self.next_step(RaceStep.RACING) 81 | elif self.hcv2.check_match(self.images['race_start']): 82 | self.next_step(RaceStep.PREPARING) 83 | else: 84 | raise NameError('Not where I am supposed to be [race_quit, race_start]') 85 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Project 2 | .temp/ 3 | logs/ 4 | config.ini 5 | 6 | # Byte-compiled / optimized / DLL files 7 | __pycache__/ 8 | *.py[cod] 9 | *$py.class 10 | 11 | # C extensions 12 | *.so 13 | 14 | # Distribution / packaging 15 | .Python 16 | build/ 17 | develop-eggs/ 18 | dist/ 19 | downloads/ 20 | eggs/ 21 | .eggs/ 22 | lib/ 23 | lib64/ 24 | parts/ 25 | sdist/ 26 | var/ 27 | wheels/ 28 | *.egg-info/ 29 | .installed.cfg 30 | *.egg 31 | MANIFEST 32 | 33 | # PyInstaller 34 | # Usually these files are written by a python script from a template 35 | # before PyInstaller builds the exe, so as to inject date/other infos into it. 36 | *.manifest 37 | *.spec 38 | 39 | # Installer logs 40 | pip-log.txt 41 | pip-delete-this-directory.txt 42 | 43 | # Unit test / coverage reports 44 | htmlcov/ 45 | .tox/ 46 | .nox/ 47 | .coverage 48 | .coverage.* 49 | .cache 50 | nosetests.xml 51 | coverage.xml 52 | *.cover 53 | .hypothesis/ 54 | .pytest_cache/ 55 | 56 | # Translations 57 | *.mo 58 | *.pot 59 | 60 | # Django stuff: 61 | *.log 62 | local_settings.py 63 | db.sqlite3 64 | 65 | # Flask stuff: 66 | instance/ 67 | .webassets-cache 68 | 69 | # Scrapy stuff: 70 | .scrapy 71 | 72 | # Sphinx documentation 73 | docs/_build/ 74 | 75 | # PyBuilder 76 | target/ 77 | 78 | # Jupyter Notebook 79 | .ipynb_checkpoints 80 | 81 | # IPython 82 | profile_default/ 83 | ipython_config.py 84 | 85 | # pyenv 86 | .python-version 87 | 88 | # celery beat schedule file 89 | celerybeat-schedule 90 | 91 | # SageMath parsed files 92 | *.sage.py 93 | 94 | # Environments 95 | .env 96 | .venv 97 | env/ 98 | venv/ 99 | ENV/ 100 | env.bak/ 101 | venv.bak/ 102 | 103 | # Spyder project settings 104 | .spyderproject 105 | .spyproject 106 | 107 | # Rope project settings 108 | .ropeproject 109 | 110 | # mkdocs documentation 111 | /site 112 | 113 | # mypy 114 | .mypy_cache/ 115 | .dmypy.json 116 | dmypy.json 117 | 118 | # Pyre type checker 119 | .pyre/ 120 | 121 | ### VirtualEnv template 122 | # Virtualenv 123 | # http://iamzed.com/2009/05/07/a-primer-on-virtualenv/ 124 | .Python 125 | [Bb]in 126 | [Ii]nclude 127 | [Ll]ib 128 | [Ll]ib64 129 | [Ll]ocal 130 | [Ss]cripts 131 | pyvenv.cfg 132 | .venv 133 | pip-selfcheck.json 134 | ### JetBrains template 135 | # Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio and Webstorm 136 | # Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839 137 | 138 | # User-specific stuff: 139 | .idea/workspace.xml 140 | .idea/tasks.xml 141 | .idea/dictionaries 142 | .idea/vcs.xml 143 | .idea/jsLibraryMappings.xml 144 | 145 | # Sensitive or high-churn files: 146 | .idea/dataSources.ids 147 | .idea/dataSources.xml 148 | .idea/dataSources.local.xml 149 | .idea/sqlDataSources.xml 150 | .idea/dynamic.xml 151 | .idea/uiDesigner.xml 152 | 153 | # Gradle: 154 | .idea/gradle.xml 155 | .idea/libraries 156 | 157 | # Mongo Explorer plugin: 158 | .idea/mongoSettings.xml 159 | 160 | .idea/ 161 | 162 | ## File-based project format: 163 | *.iws 164 | 165 | ## Plugin-specific files: 166 | 167 | # IntelliJ 168 | /out/ 169 | 170 | # mpeltonen/sbt-idea plugin 171 | .idea_modules/ 172 | 173 | # JIRA plugin 174 | atlassian-ide-plugin.xml 175 | 176 | # Crashlytics plugin (for Android Studio and IntelliJ) 177 | com_crashlytics_export_strings.xml 178 | crashlytics.properties 179 | crashlytics-build.properties 180 | fabric.properties 181 | -------------------------------------------------------------------------------- /.wiki/Home.md: -------------------------------------------------------------------------------- 1 | 2 |
3 | 4 | 5 | 6 |
7 | 8 | Language 9 | 10 | 11 | Discord 12 | 13 |

14 | 15 | Deploy Wiki 16 | 17 | 18 | Links 19 | 20 | 21 | CodeQL 22 | 23 |
24 |
25 | 26 | Welcome to the Py-ForzaHorizon5-Tools wiki! 27 | 28 | ## Description 29 | 30 | ```cmd 31 | ┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓ 32 | ┃ Py-ForzaHorizon5-Tools ┃ 33 | ┣━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┫ 34 | ┃ Basic ┃ Advanced ┃ 35 | ┃ 1 - AutoWheelspins ┃ 45 - AutoCarBuy ┃ 36 | ┃ 2 - AutoGPSDestination ┃ + AutoCarMastery ┃ 37 | ┃ 3 - AutoLabReplay ┃ ┃ 38 | ┃ 4 - AutoCarBuy ┃ 453 - 45 + AutoLabReplay ┃ 39 | ┃ 5 - AutoCarMastery ┃ ┃ 40 | ┃ 6 - AutoCarBuyLeastExpensive ┃ 457 - 45 + AutoRaceRestart ┃ 41 | ┃ 7 - AutoRaceRestart ┃ ┃ 42 | ┃ 8 - AutoPhotoAllMyCars ┃ 99 - Just press z ┃ 43 | ┃ 9 - AutoCarBuyAuction ┃ ┃ 44 | ┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┻━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛ 45 | Your choice: 46 | ``` 47 | 48 | For more info, please check the [wiki](https://github.com/kevingrillet/Py-ForzaHorizon5-Tools/wiki) :goberserk: 49 | 50 | If you still have a problem, please contact me on [Discord](https://discord.gg/scdUu3SUQm). 51 | 52 | ## Licence 53 | 54 | ``` 55 | /* 56 | * ---------------------------------------------------------------------------- 57 | * "THE BEER-WARE LICENSE" (Revision 42): 58 | * kevingrillet wrote this file. As long as you retain this notice you can do 59 | * whatever you want with this stuff. If we meet some day, and you think this 60 | * stuff is worth it, you can buy me a beer in return. 61 | * ---------------------------------------------------------------------------- 62 | */ 63 | ``` 64 | 65 | 66 |
67 | 68 | 69 | 70 |
71 | 72 |
73 | 74 |
75 | Previous page 76 | | 77 | Next page 78 |
79 | -------------------------------------------------------------------------------- /game/autocarbuyauction.py: -------------------------------------------------------------------------------- 1 | from utils import common, superdecorator 2 | from utils.handlercv2 import HandlerCv2 3 | from utils.handlertime import HandlerTime 4 | 5 | 6 | @superdecorator.decorate_all_functions() 7 | class AutoCarBuyAuction: 8 | 9 | def __init__(self, hcv2: HandlerCv2 = None): 10 | """ 11 | Prepare to auto buy cars 12 | :param hcv2: 13 | """ 14 | self.hcv2 = hcv2 if hcv2 else HandlerCv2() 15 | self.images = self.hcv2.load_images( 16 | ['auction_complete', 'auction_house_won', 'auctions_options', 'auction_house_waiting', 'buyout_successful', 17 | 'search']) 18 | self.ht = HandlerTime() 19 | self.running = False 20 | 21 | def run(self, nb_car_to_buy: int = 1): 22 | """ 23 | Buys the car where you are placed (in car collection) 24 | :param nb_car_to_buy: 25 | """ 26 | common.sleep(5, 'Waiting 5 secs, please focus Forza Horizon 5.') 27 | common.moveTo((10, 10)) 28 | count = 0 29 | self.running = True 30 | self.ht.start() 31 | while self.running and count < nb_car_to_buy: 32 | # Search 33 | if not self.hcv2.check_match(self.images['search'], True): 34 | self.hcv2.save_image(None, 'logs') 35 | raise NameError('Not in auction house search [search]') 36 | common.press('enter', 2) 37 | # While not bought all 38 | while count < nb_car_to_buy: 39 | # Wait for cars to appear 40 | while self.hcv2.check_match(self.images['auction_house_waiting'], True): 41 | common.sleep(1) 42 | # If seeing an already sold car or auction complete 43 | if self.hcv2.check_match(self.images['auction_complete'], True) or self.hcv2.check_match( 44 | self.images['auction_house_won'], True): 45 | common.info('Car already sold, refresh! [' + str(count) + '/' + str( 46 | nb_car_to_buy) + ' in ' + self.ht.stringify() + ']') 47 | break 48 | # Check if Auctions Options available 49 | if not self.hcv2.check_match(self.images['auctions_options'], True): 50 | # If not, there is no car, just escape 51 | common.info('No car to buy, refresh! [' + str(count) + '/' + str( 52 | nb_car_to_buy) + ' in ' + self.ht.stringify() + ']') 53 | # common.info('Waiting 30 secs...') 54 | # common.sleep(30) 55 | # Exit parent loop to quit Auction House 56 | break 57 | # Auction Options 58 | common.press('y', 1) 59 | # Buy 60 | common.press('down') 61 | common.press('enter', 1) 62 | common.press('enter') 63 | attempt = 0 64 | while not self.hcv2.check_match(self.images['buyout_successful'], True): 65 | attempt += 1 66 | common.sleep(1) 67 | if attempt > 30: 68 | self.hcv2.save_image(None, 'logs') 69 | raise NameError('Failed to buy! [buyout_successful]') 70 | common.press('enter', 1) 71 | # Get back to Auction List 72 | common.press('esc', 1) 73 | count += 1 74 | common.info( 75 | 'Car bought! [' + str(count) + '/' + str(nb_car_to_buy) + ' in ' + self.ht.stringify() + ']') 76 | # Place on next one 77 | common.press('down') 78 | # Exit Auction house 79 | common.press('esc', 2) 80 | # Enter search 81 | common.press('enter', 1) 82 | -------------------------------------------------------------------------------- /utils/handlertime.py: -------------------------------------------------------------------------------- 1 | import time 2 | from datetime import timedelta 3 | from string import Formatter 4 | 5 | 6 | class HandlerTime: 7 | def __init__(self): 8 | self.my_timer = time.time() 9 | 10 | def get_timer(self) -> float: 11 | """ 12 | Get time since start 13 | :return: difference in seconds 14 | """ 15 | return time.time() - self.my_timer 16 | 17 | @staticmethod 18 | def handle_stringify(timer: float) -> str: 19 | """ 20 | Beautify output 21 | :param timer: time to beautify 22 | :return: time formated 23 | """ 24 | if timer >= 3600: 25 | fmt = '{H:02}h {M:2}m {S:02.02f}s' 26 | elif timer >= 60: 27 | fmt = '{M:02}m {S:02.02f}s' 28 | else: 29 | fmt = '{S:02.02f}s' 30 | return HandlerTime.strfdelta(timedelta(seconds=timer), fmt) 31 | 32 | def start(self): 33 | """ 34 | Start timer 35 | """ 36 | self.my_timer = time.time() 37 | 38 | def stringify(self) -> str: 39 | """ 40 | Beautify output 41 | :return: time formated 42 | """ 43 | ret = HandlerTime.handle_stringify(self.get_timer()) 44 | self.start() 45 | return ret 46 | 47 | @staticmethod 48 | # https://stackoverflow.com/questions/538666/format-timedelta-to-string/63198084#63198084 49 | def strfdelta(tdelta, fmt='{D:02}d {H:02}h {M:02}m {S:02.0f}s', inputtype='timedelta') -> str: 50 | """ 51 | Convert a datetime.timedelta object or a regular number to a custom- 52 | formated string, just like the stftime() method does for datetime.datetime 53 | objects. 54 | 55 | The fmt argument allows custom formatting to be specified. Fields can 56 | include seconds, minutes, hours, days, and weeks. Each field is optional. 57 | 58 | Some examples: 59 | '{D:02}d {H:02}h {M:02}m {S:02.0f}s' --> '05d 08h 04m 02s' (default) 60 | '{W}w {D}d {H}:{M:02}:{S:02.0f}' --> '4w 5d 8:04:02' 61 | '{D:2}d {H:2}:{M:02}:{S:02.0f}' --> ' 5d 8:04:02' 62 | '{H}h {S:.0f}s' --> '72h 800s' 63 | 64 | The inputtype argument allows tdelta to be a regular number instead of the 65 | default, which is a datetime.timedelta object. Valid inputtype strings: 66 | 's', 'seconds', 67 | 'm', 'minutes', 68 | 'h', 'hours', 69 | 'd', 'days', 70 | 'w', 'weeks' 71 | """ 72 | 73 | # Convert tdelta to integer seconds. 74 | if inputtype == 'timedelta': 75 | remainder = tdelta.total_seconds() 76 | elif inputtype in ['s', 'seconds']: 77 | remainder = float(tdelta) 78 | elif inputtype in ['m', 'minutes']: 79 | remainder = float(tdelta) * 60 80 | elif inputtype in ['h', 'hours']: 81 | remainder = float(tdelta) * 3600 82 | elif inputtype in ['d', 'days']: 83 | remainder = float(tdelta) * 86400 84 | elif inputtype in ['w', 'weeks']: 85 | remainder = float(tdelta) * 604800 86 | else: 87 | remainder = 0 88 | 89 | f = Formatter() 90 | desired_fields = [field_tuple[1] for field_tuple in f.parse(fmt)] 91 | possible_fields = ('Y', 'm', 'W', 'D', 'H', 'M', 'S', 'mS', 'µS') 92 | constants = {'Y': 86400 * 365.24, 'm': 86400 * 30.44, 'W': 604800, 'D': 86400, 'H': 3600, 'M': 60, 'S': 1, 93 | 'mS': 1 / pow(10, 3), 'µS': 1 / pow(10, 6)} 94 | values = {} 95 | for field in possible_fields: 96 | if field in desired_fields and field in constants: 97 | Quotient, remainder = divmod(remainder, constants[field]) 98 | values[field] = int(Quotient) if field != 'S' else Quotient + remainder 99 | return f.format(fmt, **values) 100 | -------------------------------------------------------------------------------- /game/autophotoallmycars.py: -------------------------------------------------------------------------------- 1 | from game.common import GameCommon 2 | from utils import common, superdecorator 3 | from utils.handlercv2 import HandlerCv2 4 | from utils.handlertime import HandlerTime 5 | 6 | 7 | @superdecorator.decorate_all_functions() 8 | class AutoPhotoAllMyCars: 9 | def __init__(self, hcv2: HandlerCv2 = None, gc: GameCommon = None): 10 | """ 11 | Prepare to AutoPhotoAllMyCars 12 | :param hcv2: 13 | :param gc: 14 | """ 15 | self.hcv2 = hcv2 if hcv2 else HandlerCv2() 16 | self.gc = gc if gc else GameCommon(self.hcv2) 17 | self.images = self.hcv2.load_images( 18 | ['home', 'last_car_manufacturer_selected', 'loading_please_wait', 'processing_photo']) 19 | self.ht = HandlerTime() 20 | self.running = False 21 | 22 | def run(self, nb_right: int = 1): 23 | """ 24 | Take a photo of all my cars 25 | :param nb_right: 26 | """ 27 | common.sleep(5, 'Waiting 5 secs, please focus Forza Horizon 5.') 28 | common.moveTo((10, 10)) 29 | common.press('esc', 3) 30 | count = 0 31 | count_try = 0 32 | # Should be able to get all cars, but will be so slow :/ 33 | # 0 => nb_right 34 | # 1 => nb_right again 35 | # 2 => nb_right + Down 36 | nb_right = nb_right 37 | self.running = True 38 | self.ht.start() 39 | while self.running: 40 | old_count_try = count_try 41 | old_nb_right = nb_right 42 | common.press('esc', 3) 43 | common.press('pagedown') # Cars 44 | common.press('left', .125) # Change car 45 | common.press('enter', 2) # Select 46 | 47 | # Go to next car 48 | for _ in range(nb_right): 49 | common.press('right', .125) 50 | if count_try == 2: 51 | common.press('down', .125) 52 | count_try = 0 53 | nb_right += 1 54 | else: 55 | count_try += 1 56 | 57 | common.sleep(1) 58 | if self.hcv2.check_match(self.images['last_car_manufacturer_selected'], True): 59 | common.info('LAST!') 60 | self.running = False 61 | 62 | # Get in the car 63 | common.press('enter', .75) # Select 64 | common.press('enter', .75) # Get in car 65 | common.press('enter', 2) # Deliver Car 66 | self.wait('home', 'Not outside home', False) 67 | 68 | # Take photo 69 | common.press('p', 2) # Enter photo mode 70 | self.wait('loading_please_wait', "Loading didn't end?") 71 | common.sleep(2) 72 | common.press('enter') # Take photo 73 | self.wait('processing_photo', "Processing didn't end?") 74 | common.sleep(2) 75 | common.press('esc', .75) # Exit horizon promo 76 | common.press('esc', .75) # Exit photo 77 | common.press('enter', 2) # Exit photo mode > Yes 78 | self.wait('loading_please_wait', "Loading didn't end?") 79 | self.wait('home', 'Not outside home', False) 80 | 81 | count += 1 82 | common.info('Photo taken! [' + str(count) + ' (' + str(old_nb_right) + '/' + str( 83 | old_count_try) + ') in ' + self.ht.stringify() + ']') 84 | 85 | def wait(self, image_name: str, err_msg: str, expected: bool = True): 86 | """ 87 | Wait until image_name match is in expected result, if 15 fail, then err_msg 88 | :param image_name: 89 | :param err_msg: 90 | :param expected: 91 | """ 92 | cnt = 0 93 | while self.hcv2.check_match(self.images[image_name], True) == expected: 94 | common.sleep(1) 95 | cnt += 1 96 | if cnt > 15: 97 | if image_name == 'home': 98 | common.warn(err_msg + ' [' + image_name + ']') 99 | self.gc.go_home_garage() 100 | common.press('esc') 101 | self.wait('home', 'Not outside home', False) 102 | else: 103 | raise NameError(err_msg + ' [' + image_name + ']') 104 | -------------------------------------------------------------------------------- /utils/common.py: -------------------------------------------------------------------------------- 1 | import logging 2 | import time 3 | from datetime import datetime 4 | 5 | import pyautogui 6 | 7 | from game import constant 8 | from utils.constant import DebugLevel 9 | from utils.handlerwin32 import HandlerWin32 10 | 11 | 12 | def alt_f4(): 13 | """ 14 | send alt + f4 15 | """ 16 | keyDown('alt', .125) 17 | press('f4', 0) 18 | keyUp('alt') 19 | 20 | 21 | def alt_tab(): 22 | """ 23 | send alt tab 24 | """ 25 | keyDown('alt', .125) 26 | press('tab', 0) 27 | keyUp('alt') 28 | 29 | 30 | def click(location: (int, int) = (0, 0), secs: float = .5, scale: float = 1): 31 | """ 32 | click at location then sleep 33 | :param location: 34 | :param secs: 35 | :param scale: 36 | """ 37 | if scale != 1: 38 | location = (int(location[0] * scale), int(location[1] * scale)) 39 | moveTo(location) 40 | pyautogui.mouseDown() 41 | time.sleep(secs) 42 | pyautogui.mouseUp() 43 | moveTo((10, 10)) 44 | 45 | 46 | def convert_layout(inpt: str) -> str: 47 | """ 48 | If keyboard is not in AZERTY, switch input to QWERTY 49 | :param inpt: 50 | :return: 51 | """ 52 | if not ('France' or 'Belgium') in HandlerWin32.get_keyboard_language(): 53 | inpt = inpt.translate(str.maketrans('z', 'w')) 54 | return inpt 55 | 56 | 57 | def debug(msg: str = '', debug_level: int = DebugLevel.ALWAYS): 58 | """ 59 | print debug if enough level 60 | :param msg: 61 | :param debug_level: 62 | """ 63 | msg = '[DEBUG] ' + str(datetime.now().strftime('%d/%m/%Y %H:%M:%S')) + ' - ' + msg 64 | if debug_level <= constant.DEBUG_LEVEL: 65 | # print(msg) 66 | logging.debug(msg) 67 | 68 | 69 | def fps() -> float: 70 | """ 71 | :return: fps 72 | """ 73 | new_frame = time.time() 74 | timer = 1 / (new_frame - fps.frame) 75 | fps.frame = new_frame 76 | return timer 77 | 78 | 79 | def info(msg: str = ''): 80 | """ 81 | print info 82 | :param msg: 83 | """ 84 | msg = '[INFO ] ' + str(datetime.now().strftime('%d/%m/%Y %H:%M:%S')) + ' - ' + msg 85 | # print(msg) 86 | logging.info(msg) 87 | 88 | 89 | def keyDown(key: str, secs: float = 0): 90 | """ 91 | press key then sleep x secs 92 | :param key: 93 | :param secs: 94 | """ 95 | pyautogui.keyDown(convert_layout(key)) 96 | sleep(secs) 97 | 98 | 99 | def keyUp(key: str): 100 | """ 101 | release key 102 | :param key: 103 | """ 104 | pyautogui.keyUp(convert_layout(key)) 105 | 106 | 107 | def log(msg: str = ''): 108 | """ 109 | print log 110 | :param msg: 111 | """ 112 | # print(msg) 113 | logging.info(''.join([i if ord(i) < 128 else ' ' for i in msg])) 114 | 115 | 116 | def moveTo(location: (int, int) = (0, 0), secs: float = 0, scale: float = 1): 117 | """ 118 | move mouse to location then sleep 119 | :param location: 120 | :param secs: 121 | :param scale: 122 | """ 123 | if scale != 1: 124 | location = (int(location[0] * scale), int(location[1] * scale)) 125 | pyautogui.moveTo(location) 126 | sleep(secs) 127 | 128 | 129 | def press(key: str, secs: float = .5): 130 | """ 131 | press key then sleep x secs 132 | :param key: 133 | :param secs: 134 | """ 135 | pyautogui.press(convert_layout(key)) 136 | sleep(secs) 137 | 138 | 139 | def scroll(clicks: int = 1, location: (int, int) = (0, 0), secs: float = .5, scale=1): 140 | """ 141 | Scroll at location then sleep x secs 142 | :param scale: 143 | :param clicks: 144 | :param location: 145 | :param secs: 146 | """ 147 | if scale != 1: 148 | location = (int(location[0] * scale), int(location[1] * scale)) 149 | moveTo(location) 150 | # for _ in range(abs(clicks)): 151 | # pyautogui.scroll(1 if clicks > 0 else -1) 152 | # sleep(.1) 153 | HandlerWin32.scroll(clicks, delay_between_ticks=.1) 154 | moveTo((10, 10), secs) 155 | 156 | 157 | def sleep(secs: float = 0, msg: str = ''): 158 | """ 159 | sleep for x secs 160 | :param msg: 161 | :param secs: 162 | """ 163 | if msg: 164 | info(msg) 165 | time.sleep(secs) 166 | 167 | 168 | def warn(msg: str = ''): 169 | """ 170 | print warn 171 | :param msg: 172 | """ 173 | msg = '[WARN ] ' + str(datetime.now().strftime('%d/%m/%Y %H:%M:%S')) + ' - ' + msg 174 | # print(msg) 175 | logging.warning(msg) 176 | 177 | 178 | # https://stackoverflow.com/questions/279561/what-is-the-python-equivalent-of-static-variables-inside-a-function 179 | fps.frame = time.time() 180 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | 2 |
3 | 4 | 5 | 6 |
7 | 8 | Language 9 | 10 | 11 | Discord 12 | 13 | 25 |
26 |
27 | 28 | Welcome to the **Py-ForzaHorizon5-Tools** 29 | 30 | ## Information :pushpin: 31 | 32 | > **:warning::finnadie: 08/02/2023: Looks to be spotted since the ban hammer just hit someone. :finnadie::warning:** 33 | 34 | > ~:warning: Since the last game [update (December 3rd, 2021)](https://support.forzamotorsport.net/hc/en-us/articles/4411898144659-FH5-Release-Notes-December-3rd-2021), 35 | > the script has been working less effectively, I'm trying to fix it, but it seems that `AutoLabReplay` will is beyond 36 | > repair since they did something to auto-steering... sames goes for `AutoGPSDestination` and `AutoRaceRestart`... 37 | > If it's not a straight line, the assist is just driving too badly... :see_no_evil:~ 38 | > 39 | > ~I think they did also change the number of mastery points won by destroying objectects, with 100 run I'm "only" 40 | > getting 800 points instead of 1000, and it's taking more time (2h30 instead of 1h30) :wheelchair:~ 41 | > 42 | > ~They also broke something in `AutoCarMastery`, sometimes it will remove cars that are not down because filter then 43 | > sort is not working properly...~ 44 | 45 | > ~In Winter, it's required to change 2 values in `AutoCarMastery`.~ 46 | 47 | ## Description 48 | 49 | ```cmd 50 | ┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓ 51 | ┃ Py-ForzaHorizon5-Tools ┃ 52 | ┣━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┫ 53 | ┃ Basic ┃ Advanced ┃ 54 | ┃ 1 - AutoWheelspins ┃ 45 - AutoCarBuy ┃ 55 | ┃ 2 - AutoGPSDestination ┃ + AutoCarMastery ┃ 56 | ┃ 3 - AutoLabReplay ┃ ┃ 57 | ┃ 4 - AutoCarBuy ┃ 453 - 45 + AutoLabReplay ┃ 58 | ┃ 5 - AutoCarMastery ┃ ┃ 59 | ┃ 6 - AutoCarBuyLeastExpensive ┃ 457 - 45 + AutoRaceRestart ┃ 60 | ┃ 7 - AutoRaceRestart ┃ ┃ 61 | ┃ 8 - AutoPhotoAllMyCars ┃ 99 - Just press z ┃ 62 | ┃ 9 - AutoCarBuyAuction ┃ ┃ 63 | ┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┻━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛ 64 | Your choice: 65 | ``` 66 | 67 | For more info, please check the [wiki](https://github.com/kevingrillet/Py-ForzaHorizon5-Tools/wiki) :goberserk: 68 | 69 | If you still have a problem, please contact me on [Discord](https://discord.gg/scdUu3SUQm). 70 | 71 | ## Licence 72 | 73 | ``` 74 | /* 75 | * ---------------------------------------------------------------------------- 76 | * "THE BEER-WARE LICENSE" (Revision 42): 77 | * kevingrillet wrote this file. As long as you retain this notice you can do 78 | * whatever you want with this stuff. If we meet some day, and you think this 79 | * stuff is worth it, you can buy me a beer in return. 80 | * ---------------------------------------------------------------------------- 81 | */ 82 | ``` 83 | 84 | 85 |
86 | 87 | 88 | 89 |
90 | -------------------------------------------------------------------------------- /game/autolabreplay.py: -------------------------------------------------------------------------------- 1 | from game.common import GameCommon 2 | from game.constant import RaceStep, AlreadyOwnedChoice 3 | from utils import common, superdecorator 4 | from utils.handlercv2 import HandlerCv2 5 | from utils.handlertime import HandlerTime 6 | 7 | 8 | @superdecorator.decorate_all_functions() 9 | class AutoLabReplay: 10 | 11 | def __init__(self, hcv2: HandlerCv2 = None, gc: GameCommon = None, stop_on_max_mastery: bool = False): 12 | """ 13 | Prepare for farming lab races 14 | :param hcv2: 15 | :param gc: 16 | :param stop_on_max_mastery: (False) 17 | """ 18 | self.hcv2 = hcv2 if hcv2 else HandlerCv2() 19 | self.gc = gc if gc else GameCommon(self.hcv2) 20 | self.images = self.hcv2.load_images( 21 | ['accolades', 'race_continue', 'race_quit', 'race_reward', 'race_skip', 'race_start']) 22 | self.stop_on_max_mastery = stop_on_max_mastery 23 | self.ht = HandlerTime() 24 | self.already_owned_choice = AlreadyOwnedChoice.SELL 25 | self.count = 0 26 | self.running = False 27 | self.step = RaceStep.INIT 28 | 29 | def esc_to_menu(self): 30 | """ 31 | If lost, get back to menu (at least try) 32 | """ 33 | common.warn("I'm lost!!!") 34 | lost = True 35 | cnt = 0 36 | while lost: 37 | if cnt < 5: 38 | common.press('esc', 2) 39 | cnt += 1 40 | else: 41 | common.press('enter', 2) 42 | cnt = 0 43 | if self.hcv2.check_match(self.images['accolades'], True) or self.hcv2.check_match( 44 | self.images['race_start']): 45 | lost = False 46 | 47 | def next_step(self, step: RaceStep = None): 48 | """ 49 | Set next step and reset count 50 | :param step: 51 | """ 52 | next_step: RaceStep = step if step else self.step.next() 53 | common.info( 54 | 'Step done: ' + self.step.name + ' [' + str(self.count) + ' in ' + self.ht.stringify() + '] -> next: ' + 55 | next_step.name) 56 | self.step = next_step 57 | self.count = 0 58 | 59 | def run(self, max_try: int = 10): 60 | """ 61 | Need to be started from race, or esc menu, or race preparation menu 62 | :param max_try: 63 | """ 64 | common.sleep(5, 'Waiting 5 secs, please focus Forza Horizon 5.') 65 | common.moveTo((10, 10)) 66 | self.ht.start() 67 | self.whereami() 68 | count_try = 0 69 | self.running = True 70 | while self.running and count_try < max_try: 71 | self.hcv2.require_new_capture = True 72 | 73 | if self.step == RaceStep.PREPARING: 74 | if self.hcv2.check_match(self.images['race_start']): 75 | common.click(self.hcv2.random_find()) 76 | common.keyDown('z') 77 | self.next_step() 78 | else: 79 | common.sleep(1) 80 | self.count += 1 81 | if self.count > 10: 82 | self.count = 0 83 | self.esc_to_menu() 84 | self.whereami() 85 | 86 | elif self.step == RaceStep.RACING: 87 | if self.hcv2.check_match(self.images['race_continue']) \ 88 | or self.hcv2.check_match(self.images['race_skip']) \ 89 | or self.hcv2.check_match(self.images['race_reward']): 90 | common.keyUp('z') 91 | self.next_step() 92 | 93 | elif self.step == RaceStep.REWARDS: 94 | common.sleep(1) 95 | if self.hcv2.check_match(self.images['race_continue']) \ 96 | or self.hcv2.check_match(self.images['race_skip']) \ 97 | or self.hcv2.check_match(self.images['race_reward']): 98 | common.press('enter') 99 | self.gc.check_car_already_own() 100 | self.count = 0 101 | else: 102 | self.count += 1 103 | if self.count >= 3: 104 | count_try += 1 105 | common.info('Race done. [' + str(count_try) + '/' + str(max_try) + ']') 106 | self.next_step() 107 | 108 | elif self.step == RaceStep.CHECK: 109 | if self.stop_on_max_mastery and self.gc: 110 | self.running = not self.gc.check_mastery() 111 | self.next_step() 112 | 113 | elif self.step == RaceStep.RESTART: 114 | self.gc.go_to_last_lab_race() 115 | self.next_step(RaceStep.PREPARING) 116 | 117 | common.sleep(1) 118 | 119 | def whereami(self): 120 | """ 121 | Check where am I to set initial step 122 | """ 123 | if self.hcv2.check_match(self.images['race_quit']): 124 | common.press('esc') 125 | common.keyDown('z') 126 | self.next_step(RaceStep.RACING) 127 | elif self.hcv2.check_match(self.images['race_start']): 128 | self.next_step(RaceStep.PREPARING) 129 | else: 130 | common.press('esc') 131 | self.next_step(RaceStep.RESTART) 132 | -------------------------------------------------------------------------------- /.wiki/Get Started.md: -------------------------------------------------------------------------------- 1 | *:construction: means probably broken...* 2 | 3 | 1. [AutoWheelSpins](#autowheelspins) 4 | 2. [AutoGPSDestination :construction:](#autogpsdestination-construction) 5 | 3. [AutoLabReplay :construction:](#autolabreplay-construction) 6 | 4. [AutoCarBuy](#autocarbuy) 7 | 5. [AutoCarMastery](#autocarmastery) 8 | * [`1987 Pontiac Firebird Trans Am GTA`](#1987-pontiac-firebird-trans-am-gta) 9 | * [`2005 MG XPower SV-R`](#2005-mg-xpower-sv-r) 10 | * [`2014 Ford Fiesta ST`](#2014-ford-fiesta-st) 11 | * [`2015 Porsche Cayman GTS`](#2015-porsche-cayman-gts) 12 | 6. [AutoCarBuyLeastExpensive](#autocarbuyleastexpensive) 13 | 7. [AutoRaceRestart](#autoracerestart) 14 | 8. [AutoPhotoAllMyCars](#autoracerestart) 15 | 9. [AutoCarBuyAuction](#autocarbuyauction) 16 | 17 | ## AutoWheelSpins 18 | 19 | Choice `1`. 20 | 21 | Works fot WheelSpins and SuperWheelSpins! 22 | 23 | Will spin until no more remain. 24 | 25 | Will sell duplicates cars. 26 | 27 | - Launch a first spin 28 | 29 | ![](https://user-images.githubusercontent.com/7203617/143293552-aab176f5-2a37-46ff-b417-a757b2ba81a9.jpg) 30 | 31 | - Launch the script 32 | - Set focus on Forza 33 | 34 | ## AutoGPSDestination :construction: 35 | 36 | Choice `2`. 37 | 38 | Will go to destination then press `esc`. 39 | 40 | - SetUp full assist 41 | 42 | ![](https://user-images.githubusercontent.com/7203617/143285703-30f8c0ee-c8d8-42b8-aaa9-06734fde6ffc.jpg) 43 | 44 | - Set your destination 45 | - Launch the script 46 | - Set focus on Forza 47 | 48 | ## AutoLabReplay :construction: 49 | 50 | Choice `3`. 51 | 52 | Will redo the last lab race done. 53 | 54 | ![](https://user-images.githubusercontent.com/7203617/143293466-835bca70-004b-498b-853d-511cf2d6b6b7.jpg) 55 | 56 | Can be started from esc menu, esc menu in race or race preparation. 57 | 58 | - SetUp full assist 59 | - Launch the script 60 | - Set focus on Forza 61 | 62 | Example of codes from : 63 | 64 | - :construction: 1 Lap | 206 340 638 65 | - :construction: 15 Laps | 127 405 648 66 | - :construction: 50 Laps | 430 730 853 67 | - :construction: 50 Laps WITH MAX AI FOR CREDITS! | 473 350 397 68 | 69 | ## AutoCarBuy 70 | 71 | Choice `4`. 72 | 73 | Buys car from collection. 74 | 75 | - Place on the car you want to buy in car collection 76 | 77 | ![](https://user-images.githubusercontent.com/7203617/143294156-0c9c793d-3cbb-4f04-8396-8de6423ba5d0.jpg) 78 | 79 | - Launch the script 80 | - Set focus on Forza 81 | 82 | ## AutoCarMastery 83 | 84 | Choice `5`. 85 | 86 | Delete car after mastery, so it's **RISKY**! 87 | 88 | ### `1987 Pontiac Firebird Trans Am GTA` 89 | 90 | Will get super wheelspins for 14 points: 91 | 92 | ![](https://user-images.githubusercontent.com/7203617/143293559-7a901f3e-0450-44e4-a45e-4924d5381356.jpg) 93 | 94 | The `1987 Pontiac Firebird Trans Am GTA` needs to be the 3rd car of the `Pontiac` constructor. 95 | 96 | ![](https://user-images.githubusercontent.com/7203617/143285495-8d88e725-64ee-4261-95fb-240b96b28ebe.jpg) 97 | 98 | - At the home page of the house 99 | - Launch the script 100 | - Set focus on Forza 101 | 102 | ### `2005 MG XPower SV-R` 103 | 104 | Will get super wheelspins & wheelspins for 16 points: 105 | 106 | ![](https://user-images.githubusercontent.com/7203617/160232403-393dc4f0-28ee-47c4-a5ce-5b43f7f158c0.png) 107 | 108 | The `2005 MG XPower SV-R` needs to be the first car of the `MG` constructor. 109 | 110 | ![](https://user-images.githubusercontent.com/7203617/160233008-e88e17d3-9c27-4b23-94eb-6362f86ecca2.png) 111 | 112 | - At the home page of the house 113 | - Launch the script 114 | - Set focus on Forza 115 | 116 | ### `2014 Ford Fiesta ST` 117 | 118 | Will get 10 Forzathon Points for 5 points: 119 | 120 | ![](https://user-images.githubusercontent.com/7203617/143456768-e4c6a39d-ba7a-4391-85a6-c9f86ab28713.png) 121 | 122 | The `2014 Ford Fiesta ST` needs to be the only car of the `Ford` constructor with filter `B` and `Hot Hatch`. 123 | 124 | ![](https://user-images.githubusercontent.com/7203617/143456955-41545796-77b0-4227-b962-1b2350aeae4c.png) 125 | 126 | - At the home page of the house 127 | - Launch the script 128 | - Set focus on Forza 129 | 130 | ### `2015 Porsche Cayman GTS` 131 | 132 | Will get super wheelspins for 11 points: 133 | 134 | ![](https://user-images.githubusercontent.com/7203617/143869702-1dfd2708-8b98-4fa1-adbe-72cdb09b0181.jpg) 135 | 136 | The `2015 Porsche Cayman GTS` needs to be the only car of the `Porsche` constructor with filter `A` 137 | and `Modern Sport Car`. 138 | 139 | ![](https://user-images.githubusercontent.com/7203617/143869701-09accdd1-e904-4375-9551-de9c6ce643d1.jpg) 140 | 141 | - At the home page of the house 142 | - Launch the script 143 | - Set focus on Forza 144 | 145 | ## AutoCarBuyLeastExpensive 146 | 147 | Choice `6`. 148 | 149 | - At the home page of the house 150 | - Launch the script 151 | - Set focus on Forza 152 | 153 | ## AutoRaceRestart 154 | 155 | Choice `7`. 156 | 157 | Will restart the current race at the end. 158 | 159 | Can be started from esc menu in race or race preparation. 160 | 161 | ![](https://user-images.githubusercontent.com/7203617/143869700-f018b844-598c-440f-9b48-56881decbe51.jpg) 162 | 163 | - SetUp full assist 164 | - Launch the script 165 | - Set focus on Forza 166 | 167 | Example of codes: 168 | 169 | - :construction: 10sp in 30 secs | 743 324 179 | 170 | - 10 sp in 30 sec straight road | 497 519 560 171 | 172 | ## AutoPhotoAllMyCars 173 | 174 | Choice `8`. 175 | 176 | *It takes HOURS or even DAYS!* 177 | 178 | If I want to continue with this example, I need to write `120`. 179 | 180 | ``` 181 | Photo taken! [1 (120/0) in 01m 6.79s] 182 | ``` 183 | 184 | Need to be started from esc menu outside the house. 185 | 186 | - Launch the script 187 | - Set focus on Forza 188 | 189 | ## AutoCarBuyAuction 190 | 191 | Need to be started at auction house after setting the filter. 192 | 193 | ![](https://user-images.githubusercontent.com/7203617/148805292-5ef02640-9e34-4c5d-9d4e-befbf36a4f0b.png) 194 | Choice `9` buy 1 car. 195 | 196 | Choice `90` ask how many cars you want to buy. 197 | 198 |
199 | 200 |
201 | Previous page 202 | | 203 | Next page 204 |
205 | -------------------------------------------------------------------------------- /utils/handlercv2.py: -------------------------------------------------------------------------------- 1 | import os 2 | import random 3 | from datetime import datetime 4 | from pathlib import Path 5 | 6 | from cv2 import cv2 7 | 8 | from game import constant 9 | from utils import common 10 | from utils.common import debug, fps 11 | from utils.handlerwin32 import HandlerWin32 12 | 13 | 14 | class HandlerCv2: 15 | find_start = None 16 | find_max_val = None 17 | find_end = None 18 | image_read_flag = cv2.IMREAD_COLOR 19 | method = cv2.TM_CCOEFF_NORMED 20 | require_new_capture = True 21 | target_image = None 22 | target_image_debug = None 23 | threshold = 0.9 24 | 25 | def __init__(self, show_debug_image=False, scale=1): 26 | self.hwin32 = HandlerWin32(window_name=constant.WINDOW_NAME, fullscreen=True, sos=True) 27 | self.scale = scale 28 | self.show_debug_image = show_debug_image 29 | 30 | def check_color(self, crl: (int, int, int) = None, cru: (int, int, int) = None, 31 | rect: (int, int, int, int) = None) -> bool: 32 | """ 33 | Take capture & check if image match 34 | :param crl: color_range_lower (B,G,R) 35 | :param cru: color_range_upper (B,G,R) 36 | :param rect: rect 37 | """ 38 | self.get_image() 39 | for x in range(rect[0], rect[2]): 40 | for y in range(rect[1], rect[3]): 41 | c = self.target_image[y, x] 42 | if crl[0] < c[0] < cru[0] and crl[1] < c[1] < cru[1] and crl[2] < c[2] < cru[2]: 43 | return True 44 | return False 45 | 46 | def check_match(self, data_image, force: bool = False) -> bool: 47 | """ 48 | Take capture & check if image match 49 | coordinates can be accessed with find_start / find_end or directly tap with tap_find 50 | :param data_image: Image to find 51 | :param force: force capture 52 | :return: true / false 53 | """ 54 | 55 | self.get_image(force) 56 | return self.match(data_image) 57 | 58 | def dev(self): 59 | """ 60 | Run dev mode, showing the capture 61 | """ 62 | debug('dev > s to save, q to quit') 63 | while True: 64 | self.get_image(True) 65 | cv2.namedWindow('dev', cv2.WINDOW_NORMAL) 66 | cv2.resizeWindow('dev', 1600, 900) 67 | cv2.imshow('dev', self.target_image) # Show image in window 68 | debug(str(fps())) # Print FPS (crappy rate yeah) 69 | k = cv2.waitKey(25) # Get key pressed every 25ms 70 | if k == ord('s'): # If 's' is pressed 71 | # Save the image in .temp/ 72 | Path('.temp/').mkdir(parents=True, exist_ok=True) 73 | cv2.imwrite('.temp/' + str(datetime.now()).replace(':', '.') + '.jpg', self.target_image) 74 | elif k == ord('q'): # If 'q' is pressed 75 | cv2.destroyWindow('dev') # Destroy the window 76 | break 77 | 78 | def draw_debug(self): 79 | """ 80 | Draw rect on find & show 81 | """ 82 | self.target_image_debug = cv2.rectangle(self.target_image_debug, self.find_start, self.find_end, (0, 255, 0), 5) 83 | self.show_image() 84 | 85 | def get_image(self, force: bool = False): 86 | """ 87 | take capture & show 88 | :param force: force capture, else use require_new_capture 89 | """ 90 | if self.require_new_capture or force: 91 | self.require_new_capture = False 92 | self.target_image = self.hwin32.screenshot() 93 | self.target_image_debug = self.hwin32.screenshot() 94 | self.show_image() 95 | 96 | def load_images(self, images_list: list[str] = None) -> dict: 97 | """ 98 | Load images and return dictionary 99 | :param images_list: [path_to_image, ...] 100 | :return: dict[path]={image, h, w} 101 | """ 102 | if images_list is None: 103 | images_list = [] 104 | res = {} 105 | for image in images_list: 106 | # common.debug('load_images > ' + image, -1) 107 | if os.path.isfile('./images/' + str(constant.LANG.value) + '/' + image + '.jpg'): 108 | img = cv2.imread('./images/' + str(constant.LANG.value) + '/' + image + '.jpg', self.image_read_flag) 109 | elif os.path.isfile('./images/common/' + image + '.jpg'): 110 | img = cv2.imread('./images/common/' + image + '.jpg', self.image_read_flag) 111 | else: 112 | common.warn('Image not found [' + image + ']') 113 | img = cv2.imread('./images/default.jpg', self.image_read_flag) 114 | if self.scale != 1: 115 | img = cv2.resize(img, (int(img.shape[1] * self.scale), int(img.shape[0] * self.scale)), 116 | interpolation=cv2.INTER_AREA) 117 | if img is not None: 118 | h, w = img.shape[:2] 119 | res[image] = (img, h, w) 120 | return res 121 | 122 | def log(self) -> str: 123 | """ 124 | Return logs 125 | :return: 126 | """ 127 | ret = ('{0:20} {1}'.format('\nfind:', str(self.find_max_val >= self.threshold))) 128 | ret += ('{0:20} {1}'.format('\nfind_max_val:', str(self.find_max_val))) 129 | if self.find_start: 130 | ret += ('{0:20} {1}'.format('\nfind_start:', str(self.find_start))) 131 | if self.find_end: 132 | ret += ('{0:20} {1}'.format('\nfind_end:', str(self.find_end))) 133 | return ret 134 | 135 | def match_template(self, find_image) -> bool: 136 | """ 137 | return true if image match 138 | :param find_image: Image to find 139 | :return: true / false 140 | """ 141 | return cv2.matchTemplate(self.target_image, find_image, self.method) 142 | 143 | def match(self, data_image) -> bool: 144 | """ 145 | return true if image match & set find_start & find_end 146 | :param data_image: Image to find 147 | :return: true / false 148 | """ 149 | find_image, h, w = data_image 150 | min_val, self.find_max_val, min_loc, max_loc = cv2.minMaxLoc(self.match_template(find_image)) 151 | if self.find_max_val < self.threshold: 152 | self.find_start = None 153 | self.find_end = None 154 | return False 155 | self.find_start = max_loc 156 | self.find_end = (int(max_loc[0] + w), int(max_loc[1] + h)) 157 | self.draw_debug() 158 | return True 159 | 160 | def random_find(self) -> (int, int): 161 | """ 162 | return random coords (x,y) between find_start & find_end 163 | :return: 164 | """ 165 | x1, y1 = self.find_start 166 | x2, y2 = self.find_end 167 | return random.randint(x1, x2), random.randint(y1, y2) 168 | 169 | def save_image(self, image=None, folder: str = '.temp'): 170 | """ 171 | Save image in param or target_image 172 | :param image: 173 | :param folder: path to save image 174 | """ 175 | Path(folder + '/').mkdir(parents=True, exist_ok=True) 176 | cv2.imwrite(folder + '/' + str(datetime.now()).replace(':', '.') + '.jpg', 177 | image if image else self.target_image) 178 | 179 | def show_image(self, image=None): 180 | """ 181 | show image if show_debug_image is set to True 182 | :param image: Image to show 183 | """ 184 | if not self.show_debug_image: 185 | return 186 | image = image if image else self.target_image_debug 187 | cv2.namedWindow('show_image', cv2.WINDOW_NORMAL) 188 | cv2.resizeWindow('show_image', 1600, 900) 189 | cv2.imshow('show_image', image) 190 | k = cv2.waitKey(0) 191 | if k == ord('s'): 192 | Path('.temp/').mkdir(parents=True, exist_ok=True) 193 | cv2.imwrite('.temp/' + str(datetime.now()).replace(':', '.') + '.jpg', self.target_image) 194 | cv2.destroyWindow('show_image') 195 | -------------------------------------------------------------------------------- /game/common.py: -------------------------------------------------------------------------------- 1 | from game import constant 2 | from game.constant import AlreadyOwnedChoice 3 | from utils import common, superdecorator 4 | from utils.handlercv2 import HandlerCv2 5 | from utils.handlertime import HandlerTime 6 | 7 | 8 | @superdecorator.decorate_all_functions() 9 | class GameCommon: 10 | def __init__(self, hcv2: HandlerCv2 = None): 11 | """ 12 | Game common things 13 | :param hcv2: 14 | """ 15 | self.car = constant.CAR.value 16 | self.hcv2 = hcv2 if hcv2 else HandlerCv2() 17 | self.images = self.hcv2.load_images( 18 | ['999_mastery', '999_super_wheelspins', 'accolades', 'car_already_owned', 'lamborghini_name', 19 | 'lamborghini_name_selected', 'my_cars', self.car + '_name', self.car + '_name_selected', 'race_start', 20 | 'race_type']) 21 | self.ht = HandlerTime() 22 | 23 | def check_car_already_own(self, aoc: AlreadyOwnedChoice = constant.OWNED) -> bool: 24 | """ 25 | From anywhere where you can get a new car :) 26 | """ 27 | ret = self.hcv2.check_match(self.images['car_already_owned'], True) 28 | if ret: 29 | if constant.DEV_MODE: 30 | self.hcv2.save_image() 31 | if aoc == AlreadyOwnedChoice.SELL: 32 | common.press('down', .125) 33 | common.press('down', .125) 34 | common.press('enter', 1) 35 | return ret 36 | 37 | def check_mastery(self) -> bool: 38 | """ 39 | From game, check if mastery is at 999 40 | :return: True/False 41 | """ 42 | # Open menu 43 | common.press('esc', 2) 44 | # Go to Mastery 45 | common.press('pagedown') 46 | common.press('right', .125) 47 | common.press('down', .125) 48 | common.press('enter', 2) 49 | # Check number of points 50 | ret = self.hcv2.check_match(self.images['999_mastery'], True) 51 | # Get back to esc menu 52 | common.press('esc', 1) 53 | common.press('esc', 2) 54 | return ret 55 | 56 | def check_super_wheelspins(self) -> bool: 57 | """ 58 | From game, check if SuperWheelSpins is at 999 59 | :return: True/False 60 | """ 61 | common.press('esc', 2) 62 | common.press('pagedown') 63 | common.press('left', .125) 64 | common.press('down', .125) 65 | common.press('enter', 2) 66 | return not self.hcv2.check_match(self.images['999_super_wheelspins'], True) 67 | 68 | def enter_car(self): 69 | """ 70 | Enter the car 71 | """ 72 | common.press('enter') 73 | common.press('enter', 3) 74 | cnt = 0 75 | while not self.hcv2.check_match(self.images['my_cars'], True): 76 | common.press('esc', 1) 77 | cnt += 1 78 | if cnt > 10: 79 | common.warn('My cars not found') 80 | self.go_home_garage() 81 | 82 | def go_home_garage(self): 83 | """ 84 | From game, to home > garage 85 | """ 86 | if not self.hcv2.check_match(self.images['accolades'], True): 87 | common.press('esc', 2) 88 | if not self.hcv2.check_match(self.images['accolades'], True): 89 | raise NameError('Not in menu [accolades]') 90 | common.press('pagedown') 91 | common.press('pagedown') 92 | common.press('enter') 93 | common.press('enter', 10) 94 | common.press('pageup') 95 | 96 | def go_to_car_to_buy(self): 97 | """ 98 | Starting in garage, get in car collection, then filter pontiac and go to firebird 99 | """ 100 | common.press('right', .125) 101 | common.press('enter', 2) 102 | common.press('backspace', 1) 103 | if not self.hcv2.check_match(self.images[self.car + '_name'], True): 104 | common.scroll(10, (450, 450), .125, constant.SCALE) 105 | if not self.hcv2.check_match(self.images[self.car + '_name'], True): 106 | common.scroll(-10, (450, 450), .125, constant.SCALE) 107 | if not self.hcv2.check_match(self.images[self.car + '_name'], True): 108 | raise NameError(self.car.capitalize() + ' name not found [' + self.car + '_name') 109 | common.click(self.hcv2.random_find(), .125) 110 | if self.hcv2.check_match(self.images[self.car + '_name_selected'], True): 111 | common.press('enter', 1) 112 | common.sleep(1) 113 | if self.car == constant.Car.FORD.value: 114 | for _ in range(5): 115 | common.press('down', .125) 116 | for _ in range(5): 117 | common.press('right', .125) 118 | elif self.car == constant.Car.MG.value: 119 | common.press('right', .125) 120 | elif self.car == constant.Car.PONTIAC.value: 121 | for _ in range(3): 122 | common.press('right', .125) 123 | elif self.car == constant.Car.PORSCHE.value: 124 | for _ in range(2): 125 | common.press('down', .125) 126 | for _ in range(3): 127 | common.press('right', .125) 128 | else: 129 | raise NameError('Unknow car') 130 | 131 | def go_to_last_lab_race(self, default_sleep: float = 5): 132 | """ 133 | Starting in game, go to last lab race 134 | :param default_sleep: 135 | """ 136 | common.info('Restarting the race (after 30 secs)') 137 | common.sleep(30) 138 | # Open menu 139 | common.press('esc', default_sleep) 140 | # GoTo Creation 141 | for _ in range(4): 142 | common.press('pagedown', .25) 143 | # Enter Lab 144 | common.press('enter', default_sleep) 145 | # Enter my races 146 | common.press('right', .25) 147 | common.press('enter', default_sleep) 148 | # GoTo History 149 | common.press('pagedown', .25) 150 | common.press('pagedown', default_sleep) 151 | # Select last race 152 | common.press('enter', default_sleep) 153 | # Solo 154 | if self.hcv2.check_match(self.images['race_type'], True): 155 | common.press('enter', default_sleep) 156 | # Same car 157 | common.press('enter', default_sleep) 158 | while not self.hcv2.check_match(self.images['race_start'], True): 159 | common.sleep(1) 160 | 161 | def home_getmycar(self): 162 | """ 163 | Starting in garage, get in my lambo then get back to garage 164 | """ 165 | self.home_goinmycars() 166 | self.home_mycars_getinlambo() 167 | 168 | def home_goinmycars(self): 169 | """ 170 | Starting in garage, get in my cars 171 | """ 172 | if not self.hcv2.check_match(self.images['my_cars'], True): 173 | raise NameError('Not in home [my_cars]') 174 | common.press('enter', 2) 175 | 176 | def home_mycars_getinlambo(self): 177 | """ 178 | Starting in garage > my cars, filter favorite & lambo, then get in, then esc to garage 179 | """ 180 | # Filter favorites 181 | common.press('y') 182 | common.press('enter') 183 | common.press('esc', 2) 184 | # Constructor 185 | common.press('backspace', 1) 186 | if not self.hcv2.check_match(self.images['lamborghini_name'], True): 187 | raise NameError('No lambo in favorites [lamborghini_name]') 188 | common.click(self.hcv2.random_find(), .125) 189 | if self.hcv2.check_match(self.images['lamborghini_name_selected'], True): 190 | common.press('enter', 1) 191 | self.enter_car() 192 | 193 | def quit_race(self): 194 | """ 195 | From race preparation screen, leave race 196 | """ 197 | while not self.hcv2.check_match(self.images['race_start'], True): 198 | common.sleep(1) 199 | common.press('right', .125) 200 | common.press('down', .125) 201 | common.press('down', .125) 202 | common.press('enter') 203 | common.press('enter', 30) 204 | -------------------------------------------------------------------------------- /game/autocarmastery.py: -------------------------------------------------------------------------------- 1 | from game import constant 2 | from game.common import GameCommon 3 | from game.constant import Car 4 | from utils import common, superdecorator 5 | from utils.handlercv2 import HandlerCv2 6 | from utils.handlertime import HandlerTime 7 | 8 | 9 | @superdecorator.decorate_all_functions() 10 | class AutoCarMastery: 11 | def __init__(self, hcv2: HandlerCv2 = None, gc: GameCommon = None): 12 | """ 13 | Prepare to auto master car 14 | :param hcv2: 15 | """ 16 | self.car = constant.CAR.value 17 | self.hcv2 = hcv2 if hcv2 else HandlerCv2() 18 | self.gc = gc if gc else GameCommon(self.hcv2) 19 | self.images = self.hcv2.load_images( 20 | ['already_done', 'cannot_afford_perk', 'my_cars', 'new_common', 'new_rare', self.car, self.car + '_name', 21 | self.car + '_name_selected']) 22 | self.count = 0 23 | self.count_done = 0 24 | self.ht = HandlerTime() 25 | self.running = False 26 | 27 | def check_buy(self): 28 | """ 29 | Check if the mastery had been bought 30 | """ 31 | if self.hcv2.check_match(self.images['cannot_afford_perk'], True): 32 | common.press('enter') 33 | common.press('esc', 2) 34 | common.press('esc', 1.5) 35 | common.press('right', .125) 36 | common.warn("Can't buy, not enough mastery points [cannot_afford_perk]") 37 | self.running = False 38 | 39 | def delete(self, fast_sleep: float = .125) -> bool: 40 | """ 41 | Delete car after selecting it 42 | :param fast_sleep: 43 | :return: If car has been deleted 44 | """ 45 | if constant.CAR == Car.FORD or constant.CAR == Car.PONTIAC: 46 | result = not self.hcv2.check_match(self.images['new_common'], True) 47 | elif constant.CAR == Car.PORSCHE: # or constant.CAR == Car.MG 48 | result = not self.hcv2.check_match(self.images['new_rare'], True) 49 | else: 50 | raise NameError('Unknow car') 51 | 52 | if result: 53 | common.press('enter') 54 | for _ in range(4): 55 | common.press('down', fast_sleep) 56 | common.press('enter') 57 | common.press('enter', 1) 58 | 59 | return result 60 | 61 | @staticmethod 62 | def filter(fast_sleep: float = .125): 63 | """ 64 | Apply filter to find the car 65 | :param fast_sleep: 66 | """ 67 | if constant.CAR == Car.FORD or constant.CAR == Car.PORSCHE: 68 | common.press('y', 1) 69 | if constant.CAR == Car.FORD: 70 | # Filter B & HotHatch 71 | for _ in range(4): # Warn: May change during Winter -> 4 or 6 here 72 | common.press('down', fast_sleep / 2) 73 | common.press('enter', fast_sleep) 74 | for _ in range(16): 75 | common.press('down', fast_sleep / 2) 76 | common.press('enter', fast_sleep) 77 | elif constant.CAR == Car.PORSCHE: 78 | # Filter A & HotHatch 79 | for _ in range(5): # Warn: May change during Winter -> 5 or 7 here 80 | common.press('down', fast_sleep / 2) 81 | common.press('enter', fast_sleep) 82 | for _ in range(10): 83 | common.press('down', fast_sleep / 2) 84 | common.press('enter', fast_sleep) 85 | common.press('esc', 1) 86 | 87 | def do_path(self, path: str = ''): 88 | """ 89 | Do the path in mastery. 90 | Example: _erereuerel_ue 91 | Equivalent to: Enter, Right Enter, Right Enter, Up Enter, Right Enter, Left Up Enter 92 | :param path: 93 | """ 94 | path = list(path) 95 | while len(path) > 0 and self.running: 96 | step = path.pop(0) 97 | enter = path.pop(0) == 'e' 98 | self.do_step(step, enter) 99 | 100 | def do_step(self, step: str = '', enter: bool = True, fast_sleep: float = .125): 101 | """ 102 | Do step, then enter if required, then check if buy did work 103 | :param step: _, l, r, u, d 104 | :param enter: True, False 105 | :param fast_sleep: .125 106 | """ 107 | if step == 'l': 108 | common.press('left', fast_sleep) 109 | elif step == 'r': 110 | common.press('right', fast_sleep) 111 | elif step == 'u': 112 | common.press('up', fast_sleep) 113 | elif step == 'd': 114 | common.press('down', fast_sleep) 115 | 116 | if enter: 117 | common.press('enter', .75) 118 | self.check_buy() 119 | 120 | def find_car(self, fast_sleep: float = .125): 121 | """ 122 | Look for the car 123 | :param fast_sleep: 124 | """ 125 | if constant.CAR == Car.PONTIAC: 126 | deleted = True 127 | # Find car to delete 128 | if self.count > 1: # Need to skip it 2 times to begin 129 | if not self.hcv2.check_match(self.images[self.car], True): 130 | raise NameError(self.car.capitalize() + ' to delete not found [' + self.car + ']') 131 | common.press('right', fast_sleep) 132 | deleted = self.delete() 133 | # Find car to use 134 | if not self.hcv2.check_match(self.images[self.car], True): 135 | raise NameError(self.car.capitalize() + ' to drive not found [' + self.car + ']') 136 | if deleted: 137 | common.press('up', fast_sleep) 138 | common.press('right', fast_sleep) 139 | 140 | elif constant.CAR == Car.FORD or constant.CAR == Car.PORSCHE: 141 | # Find car to delete 142 | if self.count > 1: # Need to skip it 2 times to begin 143 | if not self.hcv2.check_match(self.images[self.car], True): 144 | raise NameError(self.car.capitalize() + ' to delete not found [' + self.car + ']') 145 | if self.delete(): 146 | common.press('up', fast_sleep) 147 | common.press('right', fast_sleep) 148 | # Find car to use 149 | common.sleep(fast_sleep * 2) 150 | if not self.hcv2.check_match(self.images[self.car], True): 151 | raise NameError(self.car.capitalize() + ' to drive not found [' + self.car + ']') 152 | 153 | def go_to_manufacturer(self): 154 | """ 155 | Go to the manufacturer 156 | """ 157 | common.press('backspace') 158 | if self.hcv2.check_match(self.images[self.car + '_name_selected'], True): 159 | common.press('enter', 1) 160 | else: 161 | if not self.hcv2.check_match(self.images[self.car + '_name'], True): 162 | common.press('up') 163 | if not self.hcv2.check_match(self.images[self.car + '_name'], True): 164 | raise NameError(self.car.capitalize() + ' name not found [' + self.car + '_name]') 165 | common.click(self.hcv2.random_find(), .125) 166 | if self.hcv2.check_match(self.images[self.car + '_name_selected'], True): 167 | common.press('enter', 1) 168 | common.sleep(1) 169 | 170 | @staticmethod 171 | def go_to_mastery(fast_sleep: float = .125): 172 | """ 173 | Go to mastery page 174 | :param fast_sleep: 175 | """ 176 | # Boost 177 | common.press('left', fast_sleep) 178 | common.press('enter', 1.5) 179 | # Mastery 180 | common.press('right', fast_sleep) 181 | common.press('right', fast_sleep) 182 | common.press('down', fast_sleep) 183 | common.press('enter', 2.5) 184 | 185 | def run(self, max_try: int = 50): 186 | """ 187 | Need to be run from home garage 188 | :param max_try: 189 | """ 190 | common.sleep(5, 'Waiting 5 secs, please focus Forza Horizon 5.') 191 | common.moveTo((10, 10)) 192 | self.count = 0 193 | self.count_done = 0 194 | self.running = True 195 | self.ht.start() 196 | while self.running and self.count < max_try: 197 | if not self.hcv2.check_match(self.images['my_cars'], True): 198 | raise NameError('Not in home [my_cars]') 199 | # My cars 200 | common.press('enter', 2) 201 | self.filter() 202 | self.go_to_manufacturer() 203 | self.find_car() 204 | self.gc.enter_car() 205 | AutoCarMastery.go_to_mastery() 206 | if not self.hcv2.check_match(self.images['already_done'], True): 207 | if constant.CAR == Car.FORD: 208 | self.do_path('_ereue') 209 | elif constant.CAR == Car.MG: 210 | self.do_path('_ereuereued_re') 211 | elif constant.CAR == Car.PONTIAC: 212 | self.do_path('_erereuereue') 213 | elif constant.CAR == Car.PORSCHE: 214 | self.do_path('_erereuerel_ue') 215 | else: 216 | raise NameError('Unknow car') 217 | 218 | if self.running: 219 | self.count_done += 1 220 | 221 | if self.running: 222 | # Get back to menu 223 | common.press('esc', 2) 224 | common.press('esc', 1.5) 225 | common.press('right', .125) 226 | self.count += 1 227 | common.info( 228 | 'Car done! [' + str(self.count) + '(' + str(self.count_done) + ')/' + str( 229 | max_try) + ' in ' + self.ht.stringify() + ']') 230 | -------------------------------------------------------------------------------- /main.py: -------------------------------------------------------------------------------- 1 | import logging 2 | import math 3 | import os 4 | import sys 5 | import time 6 | from datetime import datetime 7 | from pathlib import Path 8 | 9 | from game import constant 10 | from game.autocarbuy import AutoCarBuy 11 | from game.autocarbuyauction import AutoCarBuyAuction 12 | from game.autocarbuyleastexpensive import AutoCarBuyLeastExpensive 13 | from game.autocarmastery import AutoCarMastery 14 | from game.autogpsdestination import AutoGPSDestination 15 | from game.autolabreplay import AutoLabReplay 16 | from game.autophotoallmycars import AutoPhotoAllMyCars 17 | from game.autoracerestart import AutoRaceRestart 18 | from game.autowheelspins import AutoWheelspins 19 | from game.common import GameCommon 20 | from game.constant import Car, AlreadyOwnedChoice 21 | from utils import common 22 | from utils.constant import DebugLevel, Lang 23 | from utils.handlerconfig import HandlerConfig 24 | from utils.handlercv2 import HandlerCv2 25 | from utils.handlertime import HandlerTime 26 | from utils.handlerwin32 import HandlerWin32 27 | 28 | 29 | def AutoCarBuy_Then_AutoCarMastery(_acb: AutoCarBuy, _acm: AutoCarMastery, nbcar: int = None): 30 | """ 31 | From main, used to do AutoCarBuy (already places on the pontiac) then AutoCarMastery 32 | :param _acb: 33 | :param _acm: 34 | :param nbcar: 35 | """ 36 | if nbcar is None: 37 | if constant.CAR.value == Car.FORD.value: 38 | nbcar = math.floor(999 / 5) 39 | elif constant.CAR.value == Car.PONTIAC.value: 40 | nbcar = math.floor(999 / 14) 41 | elif constant.CAR.value == Car.PORSCHE.value: 42 | nbcar = math.floor(999 / 14) # 11 43 | else: 44 | raise NameError('Unknow car') 45 | common.info('AutoCarBuy + AutoCarMastery for ' + str(nbcar) + ' cars') 46 | _acb.run(nbcar) 47 | common.press('left') 48 | _acm.run(nbcar) # 1rst car is 'always' already done 49 | 50 | 51 | def AutoCarBuy_Then_AutoCarMastery_from_menu_to_menu(_gc: GameCommon, _acb: AutoCarBuy, _acm: AutoCarMastery, 52 | nbcar: int = None): 53 | """ 54 | From main, used to do AutoCarBuy (from game) then AutoCarMastery then get in my lambo :) 55 | :param _gc: 56 | :param _acb: 57 | :param _acm: 58 | :param nbcar: 59 | """ 60 | _gc.go_home_garage() 61 | _gc.go_to_car_to_buy() 62 | AutoCarBuy_Then_AutoCarMastery(_acb, _acm, nbcar) 63 | _gc.home_getmycar() 64 | common.press('esc', 10) 65 | 66 | 67 | def load_config(): 68 | """ 69 | Load config from config file 70 | Create it if not existing 71 | :return: 72 | """ 73 | hcfg = HandlerConfig('config.ini') 74 | constant.CAR = Car(hcfg.get_value('car', str(constant.CAR.value))) 75 | constant.DEBUG_LEVEL = DebugLevel(int(hcfg.get_value('debug', str(constant.DEBUG_LEVEL.value)))) 76 | constant.DEV_MODE = hcfg.get_value('dev', str(constant.DEV_MODE)) == 'True' 77 | constant.LANG = Lang(hcfg.get_value('language', str(constant.LANG.value))) 78 | constant.OWNED = AlreadyOwnedChoice(int(hcfg.get_value('owned', str(constant.OWNED.value)))) 79 | constant.SCALE = float(hcfg.get_value('scale', str(constant.SCALE))) 80 | 81 | 82 | def quit_game(): 83 | """ 84 | Quit game after 30 secs 85 | """ 86 | common.sleep(30) 87 | common.alt_f4() 88 | 89 | 90 | def show_menu(): 91 | """ 92 | Show menu 93 | """ 94 | print(' ┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓') 95 | print(' ┃ Py-ForzaHorizon5-Tools ┃') 96 | print(' ┣━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┫') 97 | print(' ┃ Basic ┃ Advanced ┃') 98 | print(' ┃ 1 - AutoWheelspins ┃ 45 - AutoCarBuy ┃') 99 | print(' ┃ 2 - AutoGPSDestination ┃ + AutoCarMastery ┃') 100 | print(' ┃ 3 - AutoLabReplay ┃ ┃') 101 | print(' ┃ 4 - AutoCarBuy ┃ 453 - 45 + AutoLabReplay ┃') 102 | print(' ┃ 5 - ⚠ AutoCarMastery ⚠ ┃ ┃') 103 | print(' ┃ 6 - AutoCarBuyLeastExpensive ┃ 457 - 45 + AutoRaceRestart ┃') 104 | print(' ┃ 7 - AutoRaceRestart ┃ ┃') 105 | print(' ┃ 8 - AutoPhotoAllMyCars ┃ 99 - Just press z ┃') 106 | print(' ┃ 9 - AutoCarBuyAuction ┃ ┃') 107 | print(' ┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┻━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛') 108 | common.log('Your choice:') 109 | 110 | 111 | if __name__ == '__main__': 112 | try: 113 | Path('logs/').mkdir(parents=True, exist_ok=True) 114 | logging.basicConfig(handlers=[logging.StreamHandler(sys.stdout), 115 | logging.FileHandler('logs/' + str(datetime.now()).replace(':', '.') + '.log')], 116 | format='%(message)s', level=logging.DEBUG) 117 | common.info('Started') 118 | start_time = time.time() 119 | 120 | load_config() 121 | show_menu() 122 | intinput = int(input() or '-1') 123 | common.log(str(intinput)) 124 | hcv2 = HandlerCv2(scale=constant.SCALE) 125 | hcv2.threshold = 0.9 if constant.SCALE == 1 else 0.8 126 | 127 | # Menu 128 | if intinput == 1: 129 | AutoWheelspins(hcv2).run() 130 | elif intinput == 2: 131 | AutoGPSDestination(hcv2).run() 132 | elif intinput == 3: 133 | AutoLabReplay(hcv2).run() 134 | elif intinput == 4: 135 | common.log('Number of cars to buy: (default: 50)') 136 | nb_buy = int(input() or '50') 137 | AutoCarBuy(hcv2).run(nb_buy) 138 | elif intinput == 5: 139 | common.log('Number of cars to master: (default: 50)') 140 | nb_mastery = int(input() or '50') 141 | AutoCarMastery(hcv2).run(nb_mastery) 142 | elif intinput == 6: 143 | common.log('Number of cars to buy: (default: 50)') 144 | nb_buy = int(input() or '50') 145 | AutoCarBuyLeastExpensive(hcv2).run(nb_buy) 146 | elif intinput == 7: 147 | common.log('Number of restart: (default: 100)') 148 | nb_restart = int(input() or '100') 149 | AutoRaceRestart(hcv2).run(nb_restart) 150 | elif intinput == 8: 151 | common.log('Where to start: (default: 1)') 152 | nb_start = int(input() or '1') 153 | AutoPhotoAllMyCars(hcv2).run(nb_start) 154 | elif intinput == 9: 155 | common.log('Number of cars to buy: (default: 1)') 156 | nb_car_to_buy = int(input() or '1') 157 | AutoCarBuyAuction(hcv2).run(nb_car_to_buy) 158 | 159 | # Just press Z 160 | elif intinput == 99: 161 | common.alt_tab() 162 | common.moveTo((10, 10)) 163 | common.press('esc', 0) 164 | common.keyDown('z') 165 | 166 | # Advanced 167 | elif intinput == 45: 168 | common.log('Number of cars to buy & master: (default: None)') 169 | nb_cars = int(input() or None) 170 | common.alt_tab() 171 | common.moveTo((10, 10)) 172 | AutoCarBuy_Then_AutoCarMastery(AutoCarBuy(hcv2), AutoCarMastery(hcv2), nb_cars) 173 | elif intinput == 453: 174 | common.debug('AutoCarBuy + AutoCarMastery + AutoLabReplay') 175 | gc = GameCommon(hcv2) 176 | acb = AutoCarBuy(hcv2) 177 | acm = AutoCarMastery(hcv2, gc) 178 | alr = AutoLabReplay(hcv2, gc, True) 179 | common.alt_tab() 180 | common.moveTo((10, 10)) 181 | common.press('esc', 2) 182 | if gc.check_mastery(): 183 | AutoCarBuy_Then_AutoCarMastery_from_menu_to_menu(gc, acb, acm) 184 | running = True 185 | while running: 186 | alr.run() 187 | AutoCarBuy_Then_AutoCarMastery_from_menu_to_menu(gc, acb, acm) 188 | # running = gc.check_super_wheelspins() 189 | quit_game() 190 | elif intinput == 457: 191 | common.debug('AutoCarBuy + AutoCarMastery + AutoRaceRestart') 192 | common.log('Number of restart: (default: 100)') 193 | nb_restart = int(input() or '100') 194 | gc = GameCommon(hcv2) 195 | acb = AutoCarBuy(hcv2) 196 | acm = AutoCarMastery(hcv2, gc) 197 | arr = AutoRaceRestart(hcv2) 198 | common.alt_tab() 199 | common.moveTo((10, 10)) 200 | common.press('esc', 2) 201 | if gc.check_mastery(): 202 | AutoCarBuy_Then_AutoCarMastery_from_menu_to_menu(gc, acb, acm) 203 | running = True 204 | while running: 205 | gc.go_to_last_lab_race() 206 | arr.run(nb_restart) 207 | gc.quit_race() 208 | AutoCarBuy_Then_AutoCarMastery_from_menu_to_menu(gc, acb, acm) 209 | # running = gc.check_super_wheelspins() 210 | quit_game() 211 | 212 | # Dev 213 | elif intinput == 0: 214 | common.log(HandlerWin32.get_keyboard_language()) 215 | common.log(common.convert_layout('z')) 216 | hcv2.hwin32.list_window_names() 217 | hcv2.dev() 218 | elif intinput == 98: 219 | arr = os.listdir('./images/common/') 220 | arr.extend(os.listdir('./images/' + str(constant.LANG.value) + '/')) 221 | arr = [s.replace('.jpg', '') for s in arr] 222 | arr.sort() 223 | common.log('\nList of images:') 224 | for i in range(0, len(arr), 4): 225 | s1 = arr[i] if i < len(arr) else '' 226 | s2 = arr[i + 1] if i + 1 < len(arr) else '' 227 | s3 = arr[i + 2] if i + 2 < len(arr) else '' 228 | s4 = arr[i + 3] if i + 3 < len(arr) else '' 229 | common.log('{0:40} {1:40} {2:40} {3:40}'.format(s1, s2, s3, s4)) 230 | common.log('\nChoose image to search:') 231 | img_name = input() or 'default' 232 | common.log(img_name) 233 | common.log('How many times?') 234 | repeat = int(input() or '1') 235 | common.log(str(repeat)) 236 | cnt = 0 237 | for i in range(repeat): 238 | found = hcv2.check_match(hcv2.load_images([img_name])[img_name], True) 239 | if found: 240 | cnt += 1 241 | common.log(hcv2.log()) 242 | if repeat > 1: 243 | common.log('\nFound: ' + str(cnt) + '/' + str(repeat)) 244 | elif intinput == 97: 245 | common.log('Number of mastery points: (default: 999)') 246 | nb_mastery = int(input() or '999') 247 | common.log(str(nb_mastery)) 248 | common.log('Number of race until 999: ' + str(math.ceil((999 - nb_mastery) / 10))) 249 | if constant.CAR.value == Car.FORD.value: 250 | cost_per_car = 5 251 | elif constant.CAR.value == Car.PONTIAC.value: 252 | cost_per_car = 14 253 | elif constant.CAR.value == Car.PORSCHE.value: 254 | cost_per_car = 14 # 11 255 | else: 256 | raise NameError('Unknow car') 257 | common.log('Number of car mastery intil 0: ' + str(math.floor(nb_mastery / cost_per_car))) 258 | 259 | else: 260 | raise NameError('Not an option') 261 | 262 | common.info('Finished after ' + HandlerTime.handle_stringify(time.time() - start_time)) 263 | except Exception as e: 264 | log = logging.getLogger() 265 | for hdlr in log.handlers[:]: # remove the existing file handlers 266 | if not isinstance(hdlr, logging.FileHandler): 267 | log.removeHandler(hdlr) 268 | handler = logging.StreamHandler(sys.stderr) 269 | log.addHandler(handler) 270 | logging.error(e, exc_info=True) 271 | -------------------------------------------------------------------------------- /utils/handlerwin32.py: -------------------------------------------------------------------------------- 1 | import ctypes 2 | import time 3 | 4 | import numpy as np 5 | import win32api 6 | import win32con 7 | import win32gui 8 | import win32ui 9 | 10 | 11 | class HandlerWin32: 12 | width = height = left = top = 0 13 | hwin = region = None 14 | 15 | def __init__(self, window_name: str = None, fullscreen: bool = True, sos: bool = False, 16 | region: (int, int, int, int) = None): 17 | """ 18 | Prepare for capture 19 | :param window_name: Name of window 20 | :param fullscreen: Is it in fullscreen 21 | :param sos: Help if capture is black instead of using window handler 22 | :param region: 23 | """ 24 | self.sos = sos 25 | if window_name: 26 | self.hwin = win32gui.FindWindow(None, window_name) 27 | if not self.hwin: 28 | raise Exception('Window not found: {}'.format(window_name)) 29 | self.fullscreen = fullscreen 30 | region = win32gui.GetWindowRect(self.hwin) 31 | if sos: 32 | self.hwin = win32gui.GetDesktopWindow() 33 | else: 34 | self.hwin = win32gui.GetDesktopWindow() 35 | self.set_region(region) 36 | 37 | @staticmethod 38 | def get_keyboard_language() -> str: 39 | # https://stackoverflow.com/a/66756115 40 | """ 41 | Gets the keyboard language in use by the current 42 | active window process. 43 | """ 44 | 45 | languages = {'0x436': 'Afrikaans - South Africa', '0x041c': 'Albanian - Albania', 46 | '0x045e': 'Amharic - Ethiopia', '0x401': 'Arabic - Saudi Arabia', '0x1401': 'Arabic - Algeria', 47 | '0x3c01': 'Arabic - Bahrain', '0x0c01': 'Arabic - Egypt', '0x801': 'Arabic - Iraq', 48 | '0x2c01': 'Arabic - Jordan', '0x3401': 'Arabic - Kuwait', '0x3001': 'Arabic - Lebanon', 49 | '0x1001': 'Arabic - Libya', '0x1801': 'Arabic - Morocco', '0x2001': 'Arabic - Oman', 50 | '0x4001': 'Arabic - Qatar', '0x2801': 'Arabic - Syria', '0x1c01': 'Arabic - Tunisia', 51 | '0x3801': 'Arabic - U.A.E.', '0x2401': 'Arabic - Yemen', '0x042b': 'Armenian - Armenia', 52 | '0x044d': 'Assamese', '0x082c': 'Azeri (Cyrillic)', '0x042c': 'Azeri (Latin)', '0x042d': 'Basque', 53 | '0x423': 'Belarusian', '0x445': 'Bengali (India)', '0x845': 'Bengali (Bangladesh)', 54 | '0x141A': 'Bosnian (Bosnia/Herzegovina)', '0x402': 'Bulgarian', '0x455': 'Burmese', 55 | '0x403': 'Catalan', '0x045c': 'Cherokee - United States', 56 | '0x804': "Chinese - People's Republic of China", '0x1004': 'Chinese - Singapore', 57 | '0x404': 'Chinese - Taiwan', '0x0c04': 'Chinese - Hong Kong SAR', '0x1404': 'Chinese - Macao SAR', 58 | '0x041a': 'Croatian', '0x101a': 'Croatian (Bosnia/Herzegovina)', '0x405': 'Czech', 59 | '0x406': 'Danish', '0x465': 'Divehi', '0x413': 'Dutch - Netherlands', '0x813': 'Dutch - Belgium', 60 | '0x466': 'Edo', '0x409': 'English - United States', '0x809': 'English - United Kingdom', 61 | '0x0c09': 'English - Australia', '0x2809': 'English - Belize', '0x1009': 'English - Canada', 62 | '0x2409': 'English - Caribbean', '0x3c09': 'English - Hong Kong SAR', '0x4009': 'English - India', 63 | '0x3809': 'English - Indonesia', '0x1809': 'English - Ireland', '0x2009': 'English - Jamaica', 64 | '0x4409': 'English - Malaysia', '0x1409': 'English - New Zealand', 65 | '0x3409': 'English - Philippines', '0x4809': 'English - Singapore', 66 | '0x1c09': 'English - South Africa', '0x2c09': 'English - Trinidad', '0x3009': 'English - Zimbabwe', 67 | '0x425': 'Estonian', '0x438': 'Faroese', '0x429': 'Farsi', '0x464': 'Filipino', 68 | '0x040b': 'Finnish', '0x040c': 'French - France', '0x080c': 'French - Belgium', 69 | '0x2c0c': 'French - Cameroon', '0x0c0c': 'French - Canada', 70 | '0x240c': 'French - Democratic Rep. of Congo', '0x300c': "French - Cote d'Ivoire", 71 | '0x3c0c': 'French - Haiti', '0x140c': 'French - Luxembourg', '0x340c': 'French - Mali', 72 | '0x180c': 'French - Monaco', '0x380c': 'French - Morocco', '0xe40c': 'French - North Africa', 73 | '0x200c': 'French - Reunion', '0x280c': 'French - Senegal', '0x100c': 'French - Switzerland', 74 | '0x1c0c': 'French - West Indies', '0x462': 'Frisian - Netherlands', '0x467': 'Fulfulde - Nigeria', 75 | '0x042f': 'FYRO Macedonian', '0x083c': 'Gaelic (Ireland)', '0x043c': 'Gaelic (Scotland)', 76 | '0x456': 'Galician', '0x437': 'Georgian', '0x407': 'German - Germany', 77 | '0x0c07': 'German - Austria', '0x1407': 'German - Liechtenstein', '0x1007': 'German - Luxembourg', 78 | '0x807': 'German - Switzerland', '0x408': 'Greek', '0x474': 'Guarani - Paraguay', 79 | '0x447': 'Gujarati', '0x468': 'Hausa - Nigeria', '0x475': 'Hawaiian - United States', 80 | '0x040d': 'Hebrew', '0x439': 'Hindi', '0x040e': 'Hungarian', '0x469': 'Ibibio - Nigeria', 81 | '0x040f': 'Icelandic', '0x470': 'Igbo - Nigeria', '0x421': 'Indonesian', '0x045d': 'Inuktitut', 82 | '0x410': 'Italian - Italy', '0x810': 'Italian - Switzerland', '0x411': 'Japanese', 83 | '0x044b': 'Kannada', '0x471': 'Kanuri - Nigeria', '0x860': 'Kashmiri', 84 | '0x460': 'Kashmiri (Arabic)', '0x043f': 'Kazakh', '0x453': 'Khmer', '0x457': 'Konkani', 85 | '0x412': 'Korean', '0x440': 'Kyrgyz (Cyrillic)', '0x454': 'Lao', '0x476': 'Latin', 86 | '0x426': 'Latvian', '0x427': 'Lithuanian', '0x043e': 'Malay - Malaysia', 87 | '0x083e': 'Malay - Brunei Darussalam', '0x044c': 'Malayalam', '0x043a': 'Maltese', 88 | '0x458': 'Manipuri', '0x481': 'Maori - New Zealand', '0x044e': 'Marathi', 89 | '0x450': 'Mongolian (Cyrillic)', '0x850': 'Mongolian (Mongolian)', '0x461': 'Nepali', 90 | '0x861': 'Nepali - India', '0x414': 'Norwegian (Bokmål)', '0x814': 'Norwegian (Nynorsk)', 91 | '0x448': 'Oriya', '0x472': 'Oromo', '0x479': 'Papiamentu', '0x463': 'Pashto', '0x415': 'Polish', 92 | '0x416': 'Portuguese - Brazil', '0x816': 'Portuguese - Portugal', '0x446': 'Punjabi', 93 | '0x846': 'Punjabi (Pakistan)', '0x046B': 'Quecha - Bolivia', '0x086B': 'Quecha - Ecuador', 94 | '0x0C6B': 'Quecha - Peru', '0x417': 'Rhaeto-Romanic', '0x418': 'Romanian', 95 | '0x818': 'Romanian - Moldava', '0x419': 'Russian', '0x819': 'Russian - Moldava', 96 | '0x043b': 'Sami (Lappish)', '0x044f': 'Sanskrit', '0x046c': 'Sepedi', 97 | '0x0c1a': 'Serbian (Cyrillic)', '0x081a': 'Serbian (Latin)', '0x459': 'Sindhi - India', 98 | '0x859': 'Sindhi - Pakistan', '0x045b': 'Sinhalese - Sri Lanka', '0x041b': 'Slovak', 99 | '0x424': 'Slovenian', '0x477': 'Somali', '0x042e': 'Sorbian', 100 | '0x0c0a': 'Spanish - Spain (Modern Sort)', '0x040a': 'Spanish - Spain (Traditional Sort)', 101 | '0x2c0a': 'Spanish - Argentina', '0x400a': 'Spanish - Bolivia', '0x340a': 'Spanish - Chile', 102 | '0x240a': 'Spanish - Colombia', '0x140a': 'Spanish - Costa Rica', 103 | '0x1c0a': 'Spanish - Dominican Republic', '0x300a': 'Spanish - Ecuador', 104 | '0x440a': 'Spanish - El Salvador', '0x100a': 'Spanish - Guatemala', '0x480a': 'Spanish - Honduras', 105 | '0xe40a': 'Spanish - Latin America', '0x080a': 'Spanish - Mexico', '0x4c0a': 'Spanish - Nicaragua', 106 | '0x180a': 'Spanish - Panama', '0x3c0a': 'Spanish - Paraguay', '0x280a': 'Spanish - Peru', 107 | '0x500a': 'Spanish - Puerto Rico', '0x540a': 'Spanish - United States', 108 | '0x380a': 'Spanish - Uruguay', '0x200a': 'Spanish - Venezuela', '0x430': 'Sutu', 109 | '0x441': 'Swahili', '0x041d': 'Swedish', '0x081d': 'Swedish - Finland', '0x045a': 'Syriac', 110 | '0x428': 'Tajik', '0x045f': 'Tamazight (Arabic)', '0x085f': 'Tamazight (Latin)', '0x449': 'Tamil', 111 | '0x444': 'Tatar', '0x044a': 'Telugu', '0x041e': 'Thai', '0x851': 'Tibetan - Bhutan', 112 | '0x451': "Tibetan - People's Republic of China", '0x873': 'Tigrigna - Eritrea', 113 | '0x473': 'Tigrigna - Ethiopia', '0x431': 'Tsonga', '0x432': 'Tswana', '0x041f': 'Turkish', 114 | '0x442': 'Turkmen', '0x480': 'Uighur - China', '0x422': 'Ukrainian', '0x420': 'Urdu', 115 | '0x820': 'Urdu - India', '0x843': 'Uzbek (Cyrillic)', '0x443': 'Uzbek (Latin)', '0x433': 'Venda', 116 | '0x042a': 'Vietnamese', '0x452': 'Welsh', '0x434': 'Xhosa', '0x478': 'Yi', '0x043d': 'Yiddish', 117 | '0x046a': 'Yoruba', '0x435': 'Zulu', '0x04ff': 'HID (Human Interface Device)'} 118 | 119 | user32 = ctypes.WinDLL('user32', use_last_error=True) 120 | 121 | # Get the current active window handle 122 | handle = user32.GetForegroundWindow() 123 | 124 | # Get the thread id from that window handle 125 | threadid = user32.GetWindowThreadProcessId(handle, 0) 126 | 127 | # Get the keyboard layout id from the threadid 128 | layout_id = user32.GetKeyboardLayout(threadid) 129 | 130 | # Extract the keyboard language id from the keyboard layout id 131 | language_id = layout_id & (2 ** 16 - 1) 132 | 133 | # Convert the keyboard language id from decimal to hexadecimal 134 | language_id_hex = "0x{:04x}".format(int(hex(language_id), 16)) 135 | 136 | # Check if the hex value is in the dictionary. 137 | if language_id_hex in languages.keys(): 138 | return languages[language_id_hex] 139 | else: 140 | # Return language id hexadecimal value if not found. 141 | return str(language_id_hex) 142 | 143 | @staticmethod 144 | def list_window_names(): 145 | """ 146 | List all process 147 | """ 148 | 149 | def winEnumHandler(hwnd, ctx): 150 | if win32gui.IsWindowVisible(hwnd): 151 | print(hex(hwnd), win32gui.GetWindowText(hwnd)) 152 | 153 | win32gui.EnumWindows(winEnumHandler, None) 154 | 155 | def screenshot(self): 156 | """ 157 | Take a screenshot of region / hwin 158 | :return: image: ndarray 159 | """ 160 | hwindc = win32gui.GetWindowDC(self.hwin) 161 | srcdc = win32ui.CreateDCFromHandle(hwindc) 162 | memdc = srcdc.CreateCompatibleDC() 163 | bmp = win32ui.CreateBitmap() 164 | bmp.CreateCompatibleBitmap(srcdc, self.width, self.height) 165 | memdc.SelectObject(bmp) 166 | memdc.BitBlt((0, 0), (self.width, self.height), srcdc, (self.left, self.top), win32con.SRCCOPY) 167 | 168 | signedIntsArray = bmp.GetBitmapBits(True) 169 | img = np.fromstring(signedIntsArray, dtype='uint8') 170 | img.shape = (self.height, self.width, 4) 171 | 172 | srcdc.DeleteDC() 173 | memdc.DeleteDC() 174 | win32gui.ReleaseDC(self.hwin, hwindc) 175 | win32gui.DeleteObject(bmp.GetHandle()) 176 | 177 | img = img[..., :3] 178 | img = np.ascontiguousarray(img) 179 | 180 | return img 181 | 182 | @staticmethod 183 | def scroll(clicks=0, delta_x=0, delta_y=0, delay_between_ticks=0): 184 | # https://stackoverflow.com/a/61436447 185 | """ 186 | Source: https://docs.microsoft.com/en-gb/windows/win32/api/winuser/nf-winuser-mouse_event?redirectedfrom=MSDN 187 | 188 | void mouse_event( 189 | DWORD dwFlags, 190 | DWORD dx, 191 | DWORD dy, 192 | DWORD dwData, 193 | ULONG_PTR dwExtraInfo 194 | ); 195 | 196 | If dwFlags contains MOUSEEVENTF_WHEEL, 197 | then dwData specifies the amount of wheel movement. 198 | A positive value indicates that the wheel was rotated forward, away from the user; 199 | A negative value indicates that the wheel was rotated backward, toward the user. 200 | One wheel click is defined as WHEEL_DELTA, which is 120. 201 | 202 | :param delay_between_ticks: 203 | :param delta_y: 204 | :param delta_x: 205 | :param clicks: 206 | :return: 207 | """ 208 | 209 | if clicks > 0: 210 | increment = win32con.WHEEL_DELTA 211 | else: 212 | increment = win32con.WHEEL_DELTA * -1 213 | 214 | for _ in range(abs(clicks)): 215 | win32api.mouse_event(win32con.MOUSEEVENTF_WHEEL, delta_x, delta_y, increment, 0) 216 | time.sleep(delay_between_ticks) 217 | 218 | def set_region(self, region: (int, int, int, int) = None): 219 | """ 220 | Define the capture region 221 | :param region: rect 222 | """ 223 | self.region = region 224 | 225 | if self.region: 226 | if self.hwin or self.sos: 227 | self.width = self.region[2] - self.region[0] 228 | self.height = self.region[3] - self.region[1] 229 | if self.fullscreen: 230 | self.left = 0 231 | self.top = 0 232 | else: 233 | border_pixels = 8 234 | titlebar_pixels = 30 235 | self.width = self.width - (border_pixels * 2) 236 | self.height = self.height - titlebar_pixels - border_pixels 237 | self.left = border_pixels 238 | self.top = titlebar_pixels 239 | 240 | else: 241 | self.left, self.top, x2, y2 = self.region 242 | self.width = x2 - self.left + 1 243 | self.height = y2 - self.top + 1 244 | else: 245 | self.width = win32api.GetSystemMetrics(win32con.SM_CXVIRTUALSCREEN) 246 | self.height = win32api.GetSystemMetrics(win32con.SM_CYVIRTUALSCREEN) 247 | self.left = win32api.GetSystemMetrics(win32con.SM_XVIRTUALSCREEN) 248 | self.top = win32api.GetSystemMetrics(win32con.SM_YVIRTUALSCREEN) 249 | -------------------------------------------------------------------------------- /.wiki/Images.md: -------------------------------------------------------------------------------- 1 | If you want to use another language, please add the missing captures into the corresponding folder: `images/[LANG]` 2 | 3 | Lang enum can be found here: 4 | 5 | The script tries to load the image from `images/[LANG]`, then `images/common`. If an image is missing, will display a 6 | warning and use `images/default.jpg`. 7 | 8 | ## Common 9 | 10 | | Image | Name | From | Description | Used in | 11 | |---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|--------------------------------------|------------------------|---------------------------------------|--------------------------------------------------| 12 | | [![`999_mastery.jpg`](https://github.com/kevingrillet/Py-ForzaHorizon5-Tools/blob/main/images/common/999_mastery.jpg)](https://github.com/kevingrillet/Py-ForzaHorizon5-Tools/blob/main/images/common/999_mastery.jpg) | `999_mastery.jpg` | Car mastery page | Check if max mastery points | `GameCommon` | 13 | | [![`999_super_wheelspins.jpg`](https://github.com/kevingrillet/Py-ForzaHorizon5-Tools/blob/main/images/common/999_super_wheelspins.jpg)](https://github.com/kevingrillet/Py-ForzaHorizon5-Tools/blob/main/images/common/999_super_wheelspins.jpg) | `999_super_wheelspins.jpg` | Wheelspins page | Check if max super wheelspins | `GameCommon` | 14 | | [![`accolades.jpg`](https://github.com/kevingrillet/Py-ForzaHorizon5-Tools/blob/main/images/common/accolades.jpg)](https://github.com/kevingrillet/Py-ForzaHorizon5-Tools/blob/main/images/common/accolades.jpg) | `accolades.jpg` | Esc menu (unselected) | If lost, to detect esc menu | `AutoLabReplay`, `GameCommon` | 15 | | [![`auction_house_waiting.jpg`](https://github.com/kevingrillet/Py-ForzaHorizon5-Tools/blob/main/images/common/auction_house_waiting.jpg)](https://github.com/kevingrillet/Py-ForzaHorizon5-Tools/blob/main/images/common/auction_house_waiting.jpg) | `auction_house_waiting.jpg` | Auction house | Waiting card | `AutoCarBuyAuction` | 16 | | [![`already_done.jpg`](https://github.com/kevingrillet/Py-ForzaHorizon5-Tools/blob/main/images/common/already_done.jpg)](https://github.com/kevingrillet/Py-ForzaHorizon5-Tools/blob/main/images/common/already_done.jpg) | `already_done.jpg` | Car mastery page | Check if car is already mastered | `AutoCarMastery` | 17 | | [![`autoshow.jpg`](https://github.com/kevingrillet/Py-ForzaHorizon5-Tools/blob/main/images/common/autoshow.jpg)](https://github.com/kevingrillet/Py-ForzaHorizon5-Tools/blob/main/images/common/autoshow.jpg) | `autoshow.jpg` | Home garagearage | Wait until car change video end | `AutoCarBuyLeastExpensive` | 18 | | [![`ford.jpg`](https://github.com/kevingrillet/Py-ForzaHorizon5-Tools/blob/main/images/common/ford.jpg)](https://github.com/kevingrillet/Py-ForzaHorizon5-Tools/blob/main/images/common/ford.jpg) | `ford.jpg` | Garage > My cars | Check if there is a firebird | `AutoCarMastery` | 19 | | [![`ford_name.jpg`](https://github.com/kevingrillet/Py-ForzaHorizon5-Tools/blob/main/images/common/ford_name.jpg)](https://github.com/kevingrillet/Py-ForzaHorizon5-Tools/blob/main/images/common/ford_name.jpg) | `ford_name.jpg` | Jump to constructor | Jump to constructor | `AutoCarMastery`, `GameCommon` | 20 | | [![`ford_name_selected.jpg`](https://github.com/kevingrillet/Py-ForzaHorizon5-Tools/blob/main/images/common/ford_name_selected.jpg)](https://github.com/kevingrillet/Py-ForzaHorizon5-Tools/blob/main/images/common/ford_name_selected.jpg) | `ford_name_selected.jpg` | Jump to constructor | Check if jump menu click works | `AutoCarMastery`, `GameCommon` | 21 | | [![`home.jpg`](https://github.com/kevingrillet/Py-ForzaHorizon5-Tools/blob/main/images/common/home.jpg)](https://github.com/kevingrillet/Py-ForzaHorizon5-Tools/blob/main/images/common/home.jpg) | `home.jpg` | Outside home | Check if outside home | `AutoPhotoAllMyCars` | 22 | | [![`lamborghini_name.jpg`](https://github.com/kevingrillet/Py-ForzaHorizon5-Tools/blob/main/images/common/lamborghini_name.jpg)](https://github.com/kevingrillet/Py-ForzaHorizon5-Tools/blob/main/images/common/lamborghini_name.jpg) | `lamborghini_name.jpg` | Jump to constructor | Jump to constructor | `GameCommon` | 23 | | [![`lamborghini_name_selected.jpg`](https://github.com/kevingrillet/Py-ForzaHorizon5-Tools/blob/main/images/common/lamborghini_name_selected.jpg)](https://github.com/kevingrillet/Py-ForzaHorizon5-Tools/blob/main/images/common/lamborghini_name_selected.jpg) | `lamborghini_name_selected.jpg` | Jump to constructor | Check if jump menu click works | `GameCommon` | 24 | | [![`last_car_manufacturer_selected.jpg`](https://github.com/kevingrillet/Py-ForzaHorizon5-Tools/blob/main/images/common/last_car_manufacturer_selected.jpg)](https://github.com/kevingrillet/Py-ForzaHorizon5-Tools/blob/main/images/common/last_car_manufacturer_selected.jpg) | `last_car_manufacturer_selected.jpg` | Change cars | Check if car manufacturer is selected | `AutoPhotoAllMyCars` | 25 | | [![`my_cars.jpg`](https://github.com/kevingrillet/Py-ForzaHorizon5-Tools/blob/main/images/common/my_cars.jpg)](https://github.com/kevingrillet/Py-ForzaHorizon5-Tools/blob/main/images/common/my_cars.jpg) | `my_cars.jpg` | Garage (selected) | Detect that I'm at garage | `AutoCarMastery` | 26 | | [![`pontiac.jpg`](https://github.com/kevingrillet/Py-ForzaHorizon5-Tools/blob/main/images/common/pontiac.jpg)](https://github.com/kevingrillet/Py-ForzaHorizon5-Tools/blob/main/images/common/pontiac.jpg) | `pontiac.jpg` | Garage > My cars | Check if there is a firebird | `AutoCarMastery` | 27 | | [![`pontiac_name.jpg`](https://github.com/kevingrillet/Py-ForzaHorizon5-Tools/blob/main/images/common/pontiac_name.jpg)](https://github.com/kevingrillet/Py-ForzaHorizon5-Tools/blob/main/images/common/pontiac_name.jpg) | `pontiac_name.jpg` | Jump to constructor | Jump to constructor | `AutoCarMastery`, `GameCommon` | 28 | | [![`pontiac_name_selected.jpg`](https://github.com/kevingrillet/Py-ForzaHorizon5-Tools/blob/main/images/common/pontiac_name_selected.jpg)](https://github.com/kevingrillet/Py-ForzaHorizon5-Tools/blob/main/images/common/pontiac_name_selected.jpg) | `pontiac_name_selected.jpg` | Jump to constructor | Check if jump menu click works | `AutoCarMastery`, `GameCommon` | 29 | | [![`porsche.jpg`](https://github.com/kevingrillet/Py-ForzaHorizon5-Tools/blob/main/images/common/porsche.jpg)](https://github.com/kevingrillet/Py-ForzaHorizon5-Tools/blob/main/images/common/porsche.jpg) | `porsche.jpg` | Garage > My cars | Check if there is a firebird | `AutoCarMastery` | 30 | | [![`porsche_name.jpg`](https://github.com/kevingrillet/Py-ForzaHorizon5-Tools/blob/main/images/common/porsche_name.jpg)](https://github.com/kevingrillet/Py-ForzaHorizon5-Tools/blob/main/images/common/porsche_name.jpg) | `porsche_name.jpg` | Jump to constructor | Jump to constructor | `AutoCarMastery`, `GameCommon` | 31 | | [![`porsche_name_selected.jpg`](https://github.com/kevingrillet/Py-ForzaHorizon5-Tools/blob/main/images/common/porsche_name_selected.jpg)](https://github.com/kevingrillet/Py-ForzaHorizon5-Tools/blob/main/images/common/porsche_name_selected.jpg) | `porsche_name_selected.jpg` | Jump to constructor | Check if jump menu click works | `AutoCarMastery`, `GameCommon` | 32 | | [![`race_quit.jpg`](https://github.com/kevingrillet/Py-ForzaHorizon5-Tools/blob/main/images/common/race_quit.jpg)](https://github.com/kevingrillet/Py-ForzaHorizon5-Tools/blob/main/images/common/race_quit.jpg) | `race_quit.jpg` | Esc race (unselected) | If lost, to detect race esc menu | `AutoLabReplay`, `AutoRaceRestart` | 33 | | [![`race_start.jpg`](https://github.com/kevingrillet/Py-ForzaHorizon5-Tools/blob/main/images/common/race_start.jpg)](https://github.com/kevingrillet/Py-ForzaHorizon5-Tools/blob/main/images/common/race_start.jpg) | `race_start.jpg` | Before race (selected) | Check before start race | `AutoLabReplay`, `AutoRaceRestart`, `GameCommon` | 34 | | | | | | | 35 | 36 | ## Language dependant 37 | 38 | | Image | Name | From | Description | Used in | 39 | |-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|------------------------------------|----------------------|------------------------------------------|------------------------------------------| 40 | | [![`0_spins_remaining.jpg`](https://github.com/kevingrillet/Py-ForzaHorizon5-Tools/blob/main/images/en/0_spins_remaining.jpg)](https://github.com/kevingrillet/Py-ForzaHorizon5-Tools/blob/main/images/en/0_spins_remaining.jpg) | `0_spins_remaining.jpg` | Wheelspins page | Select button + text when 0 spins remain | `AutoWheelspins` | 41 | | [![`auction_complete.jpg`](https://github.com/kevingrillet/Py-ForzaHorizon5-Tools/blob/main/images/en/auction_complete.jpg)](https://github.com/kevingrillet/Py-ForzaHorizon5-Tools/blob/main/images/common/auction_complete.jpg) | `auction_complete.jpg` | Auction house | Check auction is completed | `AutoCarBuyAuction` | 42 | | [![`auction_house_won.jpg`](https://github.com/kevingrillet/Py-ForzaHorizon5-Tools/blob/main/images/en/auction_house_won.jpg)](https://github.com/kevingrillet/Py-ForzaHorizon5-Tools/blob/main/images/common/auction_house_won.jpg) | `auction_house_won.jpg` | Auction house | Check if car is won | `AutoCarBuyAuction` | 43 | | [![`auctions_options.jpg`](https://github.com/kevingrillet/Py-ForzaHorizon5-Tools/blob/main/images/en/auctions_options.jpg)](https://github.com/kevingrillet/Py-ForzaHorizon5-Tools/blob/main/images/common/auctions_options.jpg) | `auctions_options.jpg` | Auction house | Find option butotn | `AutoCarBuyAuction` | 44 | | [![`buy_car.jpg`](https://github.com/kevingrillet/Py-ForzaHorizon5-Tools/blob/main/images/en/buy_car.jpg)](https://github.com/kevingrillet/Py-ForzaHorizon5-Tools/blob/main/images/en/buy_car.jpg) | `buy_car.jpg` | Bought car | Check if click works | `AutoCarBuy` | 45 | | [![`buyout_successful.jpg`](https://github.com/kevingrillet/Py-ForzaHorizon5-Tools/blob/main/images/en/buyout_successful.jpg)](https://github.com/kevingrillet/Py-ForzaHorizon5-Tools/blob/main/images/common/buyout_successful.jpg) | `buyout_successful.jpg` | Auction house | Check buyout | `AutoCarBuyAuction` | 46 | | [![`cannot_afford_perk.jpg`](https://github.com/kevingrillet/Py-ForzaHorizon5-Tools/blob/main/images/en/cannot_afford_perk.jpg)](https://github.com/kevingrillet/Py-ForzaHorizon5-Tools/blob/main/images/en/cannot_afford_perk.jpg) | `cannot_afford_perk.jpg` | Car mastery page | Check if enough mastery points | `AutoCarMastery` | 47 | | [![`car_already_owned.jpg`](https://github.com/kevingrillet/Py-ForzaHorizon5-Tools/blob/main/images/en/car_already_owned.jpg)](https://github.com/kevingrillet/Py-ForzaHorizon5-Tools/blob/main/images/en/car_already_owned.jpg) | `car_already_owned.jpg` | After wheelspin | Check if unlocked car is already owned | `GameCommon` | 48 | | [![`collect_prize_and_spin_again.jpg`](https://github.com/kevingrillet/Py-ForzaHorizon5-Tools/blob/main/images/en/collect_prize_and_spin_again.jpg)](https://github.com/kevingrillet/Py-ForzaHorizon5-Tools/blob/main/images/en/collect_prize_and_spin_again.jpg) | `collect_prize_and_spin_again.jpg` | Wheelspins page | Re spin | `AutoWheelspins` | 49 | | [![`colors.jpg`](https://github.com/kevingrillet/Py-ForzaHorizon5-Tools/blob/main/images/en/colors.jpg)](https://github.com/kevingrillet/Py-ForzaHorizon5-Tools/blob/main/images/en/colors.jpg) | `colors.jpg` | During bought car | Wait until game load bought car colors | `AutoCarBuyLeastExpensive` | 50 | | [![`insufficient_cr.jpg`](https://github.com/kevingrillet/Py-ForzaHorizon5-Tools/blob/main/images/en/insufficient_cr.jpg)](https://github.com/kevingrillet/Py-ForzaHorizon5-Tools/blob/main/images/en/insufficient_cr.jpg) | `insufficient_cr.jpg` | After bought car | Check if enough CR | `AutoCarBuy`, `AutoCarBuyLeastExpensive` | 51 | | [![`loading_please_wait.jpg`](https://github.com/kevingrillet/Py-ForzaHorizon5-Tools/blob/main/images/en/loading_please_wait.jpg)](https://github.com/kevingrillet/Py-ForzaHorizon5-Tools/blob/main/images/en/loading_please_wait.jpg) | `loading_please_wait.jpg` | Switch to photo mode | Check if loading end | `AutoPhotoAllMyCars` | 52 | | [![`new_common.jpg`](https://github.com/kevingrillet/Py-ForzaHorizon5-Tools/blob/main/images/en/new_common.jpg)](https://github.com/kevingrillet/Py-ForzaHorizon5-Tools/blob/main/images/en/new_common.jpg) | `new_common.jpg` | My cars | Check if car is new | `AutoCarMastery` | 53 | | [![`new_rare.jpg`](https://github.com/kevingrillet/Py-ForzaHorizon5-Tools/blob/main/images/en/new_rare.jpg)](https://github.com/kevingrillet/Py-ForzaHorizon5-Tools/blob/main/images/en/new_rare.jpg) | `new_rare.jpg` | My cars | Check if car is new | `AutoCarMastery` | 54 | | [![`not_owned.jpg`](https://github.com/kevingrillet/Py-ForzaHorizon5-Tools/blob/main/images/en/not_owned.jpg)](https://github.com/kevingrillet/Py-ForzaHorizon5-Tools/blob/main/images/en/not_owned.jpg) | `not_owned.jpg` | Filter menu | Set filter | `AutoCarBuyLeastExpensive` | 55 | | [![`processing_photo.jpg`](https://github.com/kevingrillet/Py-ForzaHorizon5-Tools/blob/main/images/en/processing_photo.jpg)](https://github.com/kevingrillet/Py-ForzaHorizon5-Tools/blob/main/images/en/processing_photo.jpg) | `processing_photo.jpg` | After photo | Wait esc to appear | `AutoPhotoAllMyCars` | 56 | | [![`race_continue.jpg`](https://github.com/kevingrillet/Py-ForzaHorizon5-Tools/blob/main/images/en/race_continue.jpg)](https://github.com/kevingrillet/Py-ForzaHorizon5-Tools/blob/main/images/en/race_continue.jpg) | `race_continue.jpg` | Race end | Detect end & get rewards | `AutoLabReplay`, `AutoRaceRestart` | 57 | | [![`race_reward.jpg`](https://github.com/kevingrillet/Py-ForzaHorizon5-Tools/blob/main/images/en/race_reward.jpg)](https://github.com/kevingrillet/Py-ForzaHorizon5-Tools/blob/main/images/en/race_reward.jpg) | `race_reward.jpg` | Race end | Detect end & get rewards | `AutoLabReplay` | 58 | | [![`race_skip.jpg`](https://github.com/kevingrillet/Py-ForzaHorizon5-Tools/blob/main/images/en/race_skip.jpg)](https://github.com/kevingrillet/Py-ForzaHorizon5-Tools/blob/main/images/en/race_skip.jpg) | `race_skip.jpg` | Race end | Detect end & get rewards | `AutoLabReplay` | 59 | | [![`race_type.jpg`](https://github.com/kevingrillet/Py-ForzaHorizon5-Tools/blob/main/images/en/race_type.jpg)](https://github.com/kevingrillet/Py-ForzaHorizon5-Tools/blob/main/images/en/race_type.jpg) | `race_type.jpg` | Race type menu (lab) | Check after selecting lab race | `GameCommon` | 60 | | [![`search.jpg`](https://github.com/kevingrillet/Py-ForzaHorizon5-Tools/blob/main/images/en/search.jpg)](https://github.com/kevingrillet/Py-ForzaHorizon5-Tools/blob/main/images/common/search.jpg) | `search.jpg` | Auction house | Search page | `AutoCarBuyAuction` | 61 | | [![`skip.jpg`](https://github.com/kevingrillet/Py-ForzaHorizon5-Tools/blob/main/images/en/skip.jpg)](https://github.com/kevingrillet/Py-ForzaHorizon5-Tools/blob/main/images/en/skip.jpg) | `skip.jpg` | Wheelspins page | Skip spin | `AutoWheelspins` | 62 | | [![`value.jpg`](https://github.com/kevingrillet/Py-ForzaHorizon5-Tools/blob/main/images/en/value.jpg)](https://github.com/kevingrillet/Py-ForzaHorizon5-Tools/blob/main/images/en/value.jpg) | `value.jpg` | Sort menu | Change sort type | `AutoCarBuyLeastExpensive` | 63 | | [![`value_menu.jpg`](https://github.com/kevingrillet/Py-ForzaHorizon5-Tools/blob/main/images/en/value_menu.jpg)](https://github.com/kevingrillet/Py-ForzaHorizon5-Tools/blob/main/images/en/value_menu.jpg) | `value_menu.jpg` | Jump to value menu | Check if jump to good type | `AutoCarBuyLeastExpensive` | 64 | | [![`value_selected.jpg`](https://github.com/kevingrillet/Py-ForzaHorizon5-Tools/blob/main/images/en/value_selected.jpg)](https://github.com/kevingrillet/Py-ForzaHorizon5-Tools/blob/main/images/en/value_selected.jpg) | `value_selected.jpg` | Sort menu | Check if sort menu click works | `AutoCarBuyLeastExpensive` | 65 | | | | | | | 66 | 67 | ## Default 68 | 69 | | Image | Name | From | Description | Used in | 70 | |-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---------------------------------------|------------------------|------------------------------------------|--------------------------------------------------| 71 | | [![`default.jpg`](https://github.com/kevingrillet/Py-ForzaHorizon5-Tools/blob/main/images/default.jpg)](https://github.com/kevingrillet/Py-ForzaHorizon5-Tools/blob/main/images/default.jpg) | `default.jpg` | Minecraft | | `HandlerCv2` | 72 | | | | | | | 73 | 74 |
75 | 76 |
77 | Previous page 78 | | 79 | Next page 80 |
81 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | GNU GENERAL PUBLIC LICENSE 2 | Version 3, 29 June 2007 3 | 4 | Copyright (C) 2007 Free Software Foundation, Inc. 5 | Everyone is permitted to copy and distribute verbatim copies 6 | of this license document, but changing it is not allowed. 7 | 8 | Preamble 9 | 10 | The GNU General Public License is a free, copyleft license for 11 | software and other kinds of works. 12 | 13 | The licenses for most software and other practical works are designed 14 | to take away your freedom to share and change the works. By contrast, 15 | the GNU General Public License is intended to guarantee your freedom to 16 | share and change all versions of a program--to make sure it remains free 17 | software for all its users. We, the Free Software Foundation, use the 18 | GNU General Public License for most of our software; it applies also to 19 | any other work released this way by its authors. You can apply it to 20 | your programs, too. 21 | 22 | When we speak of free software, we are referring to freedom, not 23 | price. Our General Public Licenses are designed to make sure that you 24 | have the freedom to distribute copies of free software (and charge for 25 | them if you wish), that you receive source code or can get it if you 26 | want it, that you can change the software or use pieces of it in new 27 | free programs, and that you know you can do these things. 28 | 29 | To protect your rights, we need to prevent others from denying you 30 | these rights or asking you to surrender the rights. Therefore, you have 31 | certain responsibilities if you distribute copies of the software, or if 32 | you modify it: responsibilities to respect the freedom of others. 33 | 34 | For example, if you distribute copies of such a program, whether 35 | gratis or for a fee, you must pass on to the recipients the same 36 | freedoms that you received. You must make sure that they, too, receive 37 | or can get the source code. And you must show them these terms so they 38 | know their rights. 39 | 40 | Developers that use the GNU GPL protect your rights with two steps: 41 | (1) assert copyright on the software, and (2) offer you this License 42 | giving you legal permission to copy, distribute and/or modify it. 43 | 44 | For the developers' and authors' protection, the GPL clearly explains 45 | that there is no warranty for this free software. For both users' and 46 | authors' sake, the GPL requires that modified versions be marked as 47 | changed, so that their problems will not be attributed erroneously to 48 | authors of previous versions. 49 | 50 | Some devices are designed to deny users access to install or run 51 | modified versions of the software inside them, although the manufacturer 52 | can do so. This is fundamentally incompatible with the aim of 53 | protecting users' freedom to change the software. The systematic 54 | pattern of such abuse occurs in the area of products for individuals to 55 | use, which is precisely where it is most unacceptable. Therefore, we 56 | have designed this version of the GPL to prohibit the practice for those 57 | products. If such problems arise substantially in other domains, we 58 | stand ready to extend this provision to those domains in future versions 59 | of the GPL, as needed to protect the freedom of users. 60 | 61 | Finally, every program is threatened constantly by software patents. 62 | States should not allow patents to restrict development and use of 63 | software on general-purpose computers, but in those that do, we wish to 64 | avoid the special danger that patents applied to a free program could 65 | make it effectively proprietary. To prevent this, the GPL assures that 66 | patents cannot be used to render the program non-free. 67 | 68 | The precise terms and conditions for copying, distribution and 69 | modification follow. 70 | 71 | TERMS AND CONDITIONS 72 | 73 | 0. Definitions. 74 | 75 | "This License" refers to version 3 of the GNU General Public License. 76 | 77 | "Copyright" also means copyright-like laws that apply to other kinds of 78 | works, such as semiconductor masks. 79 | 80 | "The Program" refers to any copyrightable work licensed under this 81 | License. Each licensee is addressed as "you". "Licensees" and 82 | "recipients" may be individuals or organizations. 83 | 84 | To "modify" a work means to copy from or adapt all or part of the work 85 | in a fashion requiring copyright permission, other than the making of an 86 | exact copy. The resulting work is called a "modified version" of the 87 | earlier work or a work "based on" the earlier work. 88 | 89 | A "covered work" means either the unmodified Program or a work based 90 | on the Program. 91 | 92 | To "propagate" a work means to do anything with it that, without 93 | permission, would make you directly or secondarily liable for 94 | infringement under applicable copyright law, except executing it on a 95 | computer or modifying a private copy. Propagation includes copying, 96 | distribution (with or without modification), making available to the 97 | public, and in some countries other activities as well. 98 | 99 | To "convey" a work means any kind of propagation that enables other 100 | parties to make or receive copies. Mere interaction with a user through 101 | a computer network, with no transfer of a copy, is not conveying. 102 | 103 | An interactive user interface displays "Appropriate Legal Notices" 104 | to the extent that it includes a convenient and prominently visible 105 | feature that (1) displays an appropriate copyright notice, and (2) 106 | tells the user that there is no warranty for the work (except to the 107 | extent that warranties are provided), that licensees may convey the 108 | work under this License, and how to view a copy of this License. If 109 | the interface presents a list of user commands or options, such as a 110 | menu, a prominent item in the list meets this criterion. 111 | 112 | 1. Source Code. 113 | 114 | The "source code" for a work means the preferred form of the work 115 | for making modifications to it. "Object code" means any non-source 116 | form of a work. 117 | 118 | A "Standard Interface" means an interface that either is an official 119 | standard defined by a recognized standards body, or, in the case of 120 | interfaces specified for a particular programming language, one that 121 | is widely used among developers working in that language. 122 | 123 | The "System Libraries" of an executable work include anything, other 124 | than the work as a whole, that (a) is included in the normal form of 125 | packaging a Major Component, but which is not part of that Major 126 | Component, and (b) serves only to enable use of the work with that 127 | Major Component, or to implement a Standard Interface for which an 128 | implementation is available to the public in source code form. A 129 | "Major Component", in this context, means a major essential component 130 | (kernel, window system, and so on) of the specific operating system 131 | (if any) on which the executable work runs, or a compiler used to 132 | produce the work, or an object code interpreter used to run it. 133 | 134 | The "Corresponding Source" for a work in object code form means all 135 | the source code needed to generate, install, and (for an executable 136 | work) run the object code and to modify the work, including scripts to 137 | control those activities. However, it does not include the work's 138 | System Libraries, or general-purpose tools or generally available free 139 | programs which are used unmodified in performing those activities but 140 | which are not part of the work. For example, Corresponding Source 141 | includes interface definition files associated with source files for 142 | the work, and the source code for shared libraries and dynamically 143 | linked subprograms that the work is specifically designed to require, 144 | such as by intimate data communication or control flow between those 145 | subprograms and other parts of the work. 146 | 147 | The Corresponding Source need not include anything that users 148 | can regenerate automatically from other parts of the Corresponding 149 | Source. 150 | 151 | The Corresponding Source for a work in source code form is that 152 | same work. 153 | 154 | 2. Basic Permissions. 155 | 156 | All rights granted under this License are granted for the term of 157 | copyright on the Program, and are irrevocable provided the stated 158 | conditions are met. This License explicitly affirms your unlimited 159 | permission to run the unmodified Program. The output from running a 160 | covered work is covered by this License only if the output, given its 161 | content, constitutes a covered work. This License acknowledges your 162 | rights of fair use or other equivalent, as provided by copyright law. 163 | 164 | You may make, run and propagate covered works that you do not 165 | convey, without conditions so long as your license otherwise remains 166 | in force. You may convey covered works to others for the sole purpose 167 | of having them make modifications exclusively for you, or provide you 168 | with facilities for running those works, provided that you comply with 169 | the terms of this License in conveying all material for which you do 170 | not control copyright. Those thus making or running the covered works 171 | for you must do so exclusively on your behalf, under your direction 172 | and control, on terms that prohibit them from making any copies of 173 | your copyrighted material outside their relationship with you. 174 | 175 | Conveying under any other circumstances is permitted solely under 176 | the conditions stated below. Sublicensing is not allowed; section 10 177 | makes it unnecessary. 178 | 179 | 3. Protecting Users' Legal Rights From Anti-Circumvention Law. 180 | 181 | No covered work shall be deemed part of an effective technological 182 | measure under any applicable law fulfilling obligations under article 183 | 11 of the WIPO copyright treaty adopted on 20 December 1996, or 184 | similar laws prohibiting or restricting circumvention of such 185 | measures. 186 | 187 | When you convey a covered work, you waive any legal power to forbid 188 | circumvention of technological measures to the extent such circumvention 189 | is effected by exercising rights under this License with respect to 190 | the covered work, and you disclaim any intention to limit operation or 191 | modification of the work as a means of enforcing, against the work's 192 | users, your or third parties' legal rights to forbid circumvention of 193 | technological measures. 194 | 195 | 4. Conveying Verbatim Copies. 196 | 197 | You may convey verbatim copies of the Program's source code as you 198 | receive it, in any medium, provided that you conspicuously and 199 | appropriately publish on each copy an appropriate copyright notice; 200 | keep intact all notices stating that this License and any 201 | non-permissive terms added in accord with section 7 apply to the code; 202 | keep intact all notices of the absence of any warranty; and give all 203 | recipients a copy of this License along with the Program. 204 | 205 | You may charge any price or no price for each copy that you convey, 206 | and you may offer support or warranty protection for a fee. 207 | 208 | 5. Conveying Modified Source Versions. 209 | 210 | You may convey a work based on the Program, or the modifications to 211 | produce it from the Program, in the form of source code under the 212 | terms of section 4, provided that you also meet all of these conditions: 213 | 214 | a) The work must carry prominent notices stating that you modified 215 | it, and giving a relevant date. 216 | 217 | b) The work must carry prominent notices stating that it is 218 | released under this License and any conditions added under section 219 | 7. This requirement modifies the requirement in section 4 to 220 | "keep intact all notices". 221 | 222 | c) You must license the entire work, as a whole, under this 223 | License to anyone who comes into possession of a copy. This 224 | License will therefore apply, along with any applicable section 7 225 | additional terms, to the whole of the work, and all its parts, 226 | regardless of how they are packaged. This License gives no 227 | permission to license the work in any other way, but it does not 228 | invalidate such permission if you have separately received it. 229 | 230 | d) If the work has interactive user interfaces, each must display 231 | Appropriate Legal Notices; however, if the Program has interactive 232 | interfaces that do not display Appropriate Legal Notices, your 233 | work need not make them do so. 234 | 235 | A compilation of a covered work with other separate and independent 236 | works, which are not by their nature extensions of the covered work, 237 | and which are not combined with it such as to form a larger program, 238 | in or on a volume of a storage or distribution medium, is called an 239 | "aggregate" if the compilation and its resulting copyright are not 240 | used to limit the access or legal rights of the compilation's users 241 | beyond what the individual works permit. Inclusion of a covered work 242 | in an aggregate does not cause this License to apply to the other 243 | parts of the aggregate. 244 | 245 | 6. Conveying Non-Source Forms. 246 | 247 | You may convey a covered work in object code form under the terms 248 | of sections 4 and 5, provided that you also convey the 249 | machine-readable Corresponding Source under the terms of this License, 250 | in one of these ways: 251 | 252 | a) Convey the object code in, or embodied in, a physical product 253 | (including a physical distribution medium), accompanied by the 254 | Corresponding Source fixed on a durable physical medium 255 | customarily used for software interchange. 256 | 257 | b) Convey the object code in, or embodied in, a physical product 258 | (including a physical distribution medium), accompanied by a 259 | written offer, valid for at least three years and valid for as 260 | long as you offer spare parts or customer support for that product 261 | model, to give anyone who possesses the object code either (1) a 262 | copy of the Corresponding Source for all the software in the 263 | product that is covered by this License, on a durable physical 264 | medium customarily used for software interchange, for a price no 265 | more than your reasonable cost of physically performing this 266 | conveying of source, or (2) access to copy the 267 | Corresponding Source from a network server at no charge. 268 | 269 | c) Convey individual copies of the object code with a copy of the 270 | written offer to provide the Corresponding Source. This 271 | alternative is allowed only occasionally and noncommercially, and 272 | only if you received the object code with such an offer, in accord 273 | with subsection 6b. 274 | 275 | d) Convey the object code by offering access from a designated 276 | place (gratis or for a charge), and offer equivalent access to the 277 | Corresponding Source in the same way through the same place at no 278 | further charge. You need not require recipients to copy the 279 | Corresponding Source along with the object code. If the place to 280 | copy the object code is a network server, the Corresponding Source 281 | may be on a different server (operated by you or a third party) 282 | that supports equivalent copying facilities, provided you maintain 283 | clear directions next to the object code saying where to find the 284 | Corresponding Source. Regardless of what server hosts the 285 | Corresponding Source, you remain obligated to ensure that it is 286 | available for as long as needed to satisfy these requirements. 287 | 288 | e) Convey the object code using peer-to-peer transmission, provided 289 | you inform other peers where the object code and Corresponding 290 | Source of the work are being offered to the general public at no 291 | charge under subsection 6d. 292 | 293 | A separable portion of the object code, whose source code is excluded 294 | from the Corresponding Source as a System Library, need not be 295 | included in conveying the object code work. 296 | 297 | A "User Product" is either (1) a "consumer product", which means any 298 | tangible personal property which is normally used for personal, family, 299 | or household purposes, or (2) anything designed or sold for incorporation 300 | into a dwelling. In determining whether a product is a consumer product, 301 | doubtful cases shall be resolved in favor of coverage. For a particular 302 | product received by a particular user, "normally used" refers to a 303 | typical or common use of that class of product, regardless of the status 304 | of the particular user or of the way in which the particular user 305 | actually uses, or expects or is expected to use, the product. A product 306 | is a consumer product regardless of whether the product has substantial 307 | commercial, industrial or non-consumer uses, unless such uses represent 308 | the only significant mode of use of the product. 309 | 310 | "Installation Information" for a User Product means any methods, 311 | procedures, authorization keys, or other information required to install 312 | and execute modified versions of a covered work in that User Product from 313 | a modified version of its Corresponding Source. The information must 314 | suffice to ensure that the continued functioning of the modified object 315 | code is in no case prevented or interfered with solely because 316 | modification has been made. 317 | 318 | If you convey an object code work under this section in, or with, or 319 | specifically for use in, a User Product, and the conveying occurs as 320 | part of a transaction in which the right of possession and use of the 321 | User Product is transferred to the recipient in perpetuity or for a 322 | fixed term (regardless of how the transaction is characterized), the 323 | Corresponding Source conveyed under this section must be accompanied 324 | by the Installation Information. But this requirement does not apply 325 | if neither you nor any third party retains the ability to install 326 | modified object code on the User Product (for example, the work has 327 | been installed in ROM). 328 | 329 | The requirement to provide Installation Information does not include a 330 | requirement to continue to provide support service, warranty, or updates 331 | for a work that has been modified or installed by the recipient, or for 332 | the User Product in which it has been modified or installed. Access to a 333 | network may be denied when the modification itself materially and 334 | adversely affects the operation of the network or violates the rules and 335 | protocols for communication across the network. 336 | 337 | Corresponding Source conveyed, and Installation Information provided, 338 | in accord with this section must be in a format that is publicly 339 | documented (and with an implementation available to the public in 340 | source code form), and must require no special password or key for 341 | unpacking, reading or copying. 342 | 343 | 7. Additional Terms. 344 | 345 | "Additional permissions" are terms that supplement the terms of this 346 | License by making exceptions from one or more of its conditions. 347 | Additional permissions that are applicable to the entire Program shall 348 | be treated as though they were included in this License, to the extent 349 | that they are valid under applicable law. If additional permissions 350 | apply only to part of the Program, that part may be used separately 351 | under those permissions, but the entire Program remains governed by 352 | this License without regard to the additional permissions. 353 | 354 | When you convey a copy of a covered work, you may at your option 355 | remove any additional permissions from that copy, or from any part of 356 | it. (Additional permissions may be written to require their own 357 | removal in certain cases when you modify the work.) You may place 358 | additional permissions on material, added by you to a covered work, 359 | for which you have or can give appropriate copyright permission. 360 | 361 | Notwithstanding any other provision of this License, for material you 362 | add to a covered work, you may (if authorized by the copyright holders of 363 | that material) supplement the terms of this License with terms: 364 | 365 | a) Disclaiming warranty or limiting liability differently from the 366 | terms of sections 15 and 16 of this License; or 367 | 368 | b) Requiring preservation of specified reasonable legal notices or 369 | author attributions in that material or in the Appropriate Legal 370 | Notices displayed by works containing it; or 371 | 372 | c) Prohibiting misrepresentation of the origin of that material, or 373 | requiring that modified versions of such material be marked in 374 | reasonable ways as different from the original version; or 375 | 376 | d) Limiting the use for publicity purposes of names of licensors or 377 | authors of the material; or 378 | 379 | e) Declining to grant rights under trademark law for use of some 380 | trade names, trademarks, or service marks; or 381 | 382 | f) Requiring indemnification of licensors and authors of that 383 | material by anyone who conveys the material (or modified versions of 384 | it) with contractual assumptions of liability to the recipient, for 385 | any liability that these contractual assumptions directly impose on 386 | those licensors and authors. 387 | 388 | All other non-permissive additional terms are considered "further 389 | restrictions" within the meaning of section 10. If the Program as you 390 | received it, or any part of it, contains a notice stating that it is 391 | governed by this License along with a term that is a further 392 | restriction, you may remove that term. If a license document contains 393 | a further restriction but permits relicensing or conveying under this 394 | License, you may add to a covered work material governed by the terms 395 | of that license document, provided that the further restriction does 396 | not survive such relicensing or conveying. 397 | 398 | If you add terms to a covered work in accord with this section, you 399 | must place, in the relevant source files, a statement of the 400 | additional terms that apply to those files, or a notice indicating 401 | where to find the applicable terms. 402 | 403 | Additional terms, permissive or non-permissive, may be stated in the 404 | form of a separately written license, or stated as exceptions; 405 | the above requirements apply either way. 406 | 407 | 8. Termination. 408 | 409 | You may not propagate or modify a covered work except as expressly 410 | provided under this License. Any attempt otherwise to propagate or 411 | modify it is void, and will automatically terminate your rights under 412 | this License (including any patent licenses granted under the third 413 | paragraph of section 11). 414 | 415 | However, if you cease all violation of this License, then your 416 | license from a particular copyright holder is reinstated (a) 417 | provisionally, unless and until the copyright holder explicitly and 418 | finally terminates your license, and (b) permanently, if the copyright 419 | holder fails to notify you of the violation by some reasonable means 420 | prior to 60 days after the cessation. 421 | 422 | Moreover, your license from a particular copyright holder is 423 | reinstated permanently if the copyright holder notifies you of the 424 | violation by some reasonable means, this is the first time you have 425 | received notice of violation of this License (for any work) from that 426 | copyright holder, and you cure the violation prior to 30 days after 427 | your receipt of the notice. 428 | 429 | Termination of your rights under this section does not terminate the 430 | licenses of parties who have received copies or rights from you under 431 | this License. If your rights have been terminated and not permanently 432 | reinstated, you do not qualify to receive new licenses for the same 433 | material under section 10. 434 | 435 | 9. Acceptance Not Required for Having Copies. 436 | 437 | You are not required to accept this License in order to receive or 438 | run a copy of the Program. Ancillary propagation of a covered work 439 | occurring solely as a consequence of using peer-to-peer transmission 440 | to receive a copy likewise does not require acceptance. However, 441 | nothing other than this License grants you permission to propagate or 442 | modify any covered work. These actions infringe copyright if you do 443 | not accept this License. Therefore, by modifying or propagating a 444 | covered work, you indicate your acceptance of this License to do so. 445 | 446 | 10. Automatic Licensing of Downstream Recipients. 447 | 448 | Each time you convey a covered work, the recipient automatically 449 | receives a license from the original licensors, to run, modify and 450 | propagate that work, subject to this License. You are not responsible 451 | for enforcing compliance by third parties with this License. 452 | 453 | An "entity transaction" is a transaction transferring control of an 454 | organization, or substantially all assets of one, or subdividing an 455 | organization, or merging organizations. If propagation of a covered 456 | work results from an entity transaction, each party to that 457 | transaction who receives a copy of the work also receives whatever 458 | licenses to the work the party's predecessor in interest had or could 459 | give under the previous paragraph, plus a right to possession of the 460 | Corresponding Source of the work from the predecessor in interest, if 461 | the predecessor has it or can get it with reasonable efforts. 462 | 463 | You may not impose any further restrictions on the exercise of the 464 | rights granted or affirmed under this License. For example, you may 465 | not impose a license fee, royalty, or other charge for exercise of 466 | rights granted under this License, and you may not initiate litigation 467 | (including a cross-claim or counterclaim in a lawsuit) alleging that 468 | any patent claim is infringed by making, using, selling, offering for 469 | sale, or importing the Program or any portion of it. 470 | 471 | 11. Patents. 472 | 473 | A "contributor" is a copyright holder who authorizes use under this 474 | License of the Program or a work on which the Program is based. The 475 | work thus licensed is called the contributor's "contributor version". 476 | 477 | A contributor's "essential patent claims" are all patent claims 478 | owned or controlled by the contributor, whether already acquired or 479 | hereafter acquired, that would be infringed by some manner, permitted 480 | by this License, of making, using, or selling its contributor version, 481 | but do not include claims that would be infringed only as a 482 | consequence of further modification of the contributor version. For 483 | purposes of this definition, "control" includes the right to grant 484 | patent sublicenses in a manner consistent with the requirements of 485 | this License. 486 | 487 | Each contributor grants you a non-exclusive, worldwide, royalty-free 488 | patent license under the contributor's essential patent claims, to 489 | make, use, sell, offer for sale, import and otherwise run, modify and 490 | propagate the contents of its contributor version. 491 | 492 | In the following three paragraphs, a "patent license" is any express 493 | agreement or commitment, however denominated, not to enforce a patent 494 | (such as an express permission to practice a patent or covenant not to 495 | sue for patent infringement). To "grant" such a patent license to a 496 | party means to make such an agreement or commitment not to enforce a 497 | patent against the party. 498 | 499 | If you convey a covered work, knowingly relying on a patent license, 500 | and the Corresponding Source of the work is not available for anyone 501 | to copy, free of charge and under the terms of this License, through a 502 | publicly available network server or other readily accessible means, 503 | then you must either (1) cause the Corresponding Source to be so 504 | available, or (2) arrange to deprive yourself of the benefit of the 505 | patent license for this particular work, or (3) arrange, in a manner 506 | consistent with the requirements of this License, to extend the patent 507 | license to downstream recipients. "Knowingly relying" means you have 508 | actual knowledge that, but for the patent license, your conveying the 509 | covered work in a country, or your recipient's use of the covered work 510 | in a country, would infringe one or more identifiable patents in that 511 | country that you have reason to believe are valid. 512 | 513 | If, pursuant to or in connection with a single transaction or 514 | arrangement, you convey, or propagate by procuring conveyance of, a 515 | covered work, and grant a patent license to some of the parties 516 | receiving the covered work authorizing them to use, propagate, modify 517 | or convey a specific copy of the covered work, then the patent license 518 | you grant is automatically extended to all recipients of the covered 519 | work and works based on it. 520 | 521 | A patent license is "discriminatory" if it does not include within 522 | the scope of its coverage, prohibits the exercise of, or is 523 | conditioned on the non-exercise of one or more of the rights that are 524 | specifically granted under this License. You may not convey a covered 525 | work if you are a party to an arrangement with a third party that is 526 | in the business of distributing software, under which you make payment 527 | to the third party based on the extent of your activity of conveying 528 | the work, and under which the third party grants, to any of the 529 | parties who would receive the covered work from you, a discriminatory 530 | patent license (a) in connection with copies of the covered work 531 | conveyed by you (or copies made from those copies), or (b) primarily 532 | for and in connection with specific products or compilations that 533 | contain the covered work, unless you entered into that arrangement, 534 | or that patent license was granted, prior to 28 March 2007. 535 | 536 | Nothing in this License shall be construed as excluding or limiting 537 | any implied license or other defenses to infringement that may 538 | otherwise be available to you under applicable patent law. 539 | 540 | 12. No Surrender of Others' Freedom. 541 | 542 | If conditions are imposed on you (whether by court order, agreement or 543 | otherwise) that contradict the conditions of this License, they do not 544 | excuse you from the conditions of this License. If you cannot convey a 545 | covered work so as to satisfy simultaneously your obligations under this 546 | License and any other pertinent obligations, then as a consequence you may 547 | not convey it at all. For example, if you agree to terms that obligate you 548 | to collect a royalty for further conveying from those to whom you convey 549 | the Program, the only way you could satisfy both those terms and this 550 | License would be to refrain entirely from conveying the Program. 551 | 552 | 13. Use with the GNU Affero General Public License. 553 | 554 | Notwithstanding any other provision of this License, you have 555 | permission to link or combine any covered work with a work licensed 556 | under version 3 of the GNU Affero General Public License into a single 557 | combined work, and to convey the resulting work. The terms of this 558 | License will continue to apply to the part which is the covered work, 559 | but the special requirements of the GNU Affero General Public License, 560 | section 13, concerning interaction through a network will apply to the 561 | combination as such. 562 | 563 | 14. Revised Versions of this License. 564 | 565 | The Free Software Foundation may publish revised and/or new versions of 566 | the GNU General Public License from time to time. Such new versions will 567 | be similar in spirit to the present version, but may differ in detail to 568 | address new problems or concerns. 569 | 570 | Each version is given a distinguishing version number. If the 571 | Program specifies that a certain numbered version of the GNU General 572 | Public License "or any later version" applies to it, you have the 573 | option of following the terms and conditions either of that numbered 574 | version or of any later version published by the Free Software 575 | Foundation. If the Program does not specify a version number of the 576 | GNU General Public License, you may choose any version ever published 577 | by the Free Software Foundation. 578 | 579 | If the Program specifies that a proxy can decide which future 580 | versions of the GNU General Public License can be used, that proxy's 581 | public statement of acceptance of a version permanently authorizes you 582 | to choose that version for the Program. 583 | 584 | Later license versions may give you additional or different 585 | permissions. However, no additional obligations are imposed on any 586 | author or copyright holder as a result of your choosing to follow a 587 | later version. 588 | 589 | 15. Disclaimer of Warranty. 590 | 591 | THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY 592 | APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT 593 | HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY 594 | OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, 595 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 596 | PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM 597 | IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF 598 | ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 599 | 600 | 16. Limitation of Liability. 601 | 602 | IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING 603 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS 604 | THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY 605 | GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE 606 | USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF 607 | DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD 608 | PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), 609 | EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF 610 | SUCH DAMAGES. 611 | 612 | 17. Interpretation of Sections 15 and 16. 613 | 614 | If the disclaimer of warranty and limitation of liability provided 615 | above cannot be given local legal effect according to their terms, 616 | reviewing courts shall apply local law that most closely approximates 617 | an absolute waiver of all civil liability in connection with the 618 | Program, unless a warranty or assumption of liability accompanies a 619 | copy of the Program in return for a fee. 620 | 621 | END OF TERMS AND CONDITIONS 622 | 623 | How to Apply These Terms to Your New Programs 624 | 625 | If you develop a new program, and you want it to be of the greatest 626 | possible use to the public, the best way to achieve this is to make it 627 | free software which everyone can redistribute and change under these terms. 628 | 629 | To do so, attach the following notices to the program. It is safest 630 | to attach them to the start of each source file to most effectively 631 | state the exclusion of warranty; and each file should have at least 632 | the "copyright" line and a pointer to where the full notice is found. 633 | 634 | 635 | Copyright (C) 636 | 637 | This program is free software: you can redistribute it and/or modify 638 | it under the terms of the GNU General Public License as published by 639 | the Free Software Foundation, either version 3 of the License, or 640 | (at your option) any later version. 641 | 642 | This program is distributed in the hope that it will be useful, 643 | but WITHOUT ANY WARRANTY; without even the implied warranty of 644 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 645 | GNU General Public License for more details. 646 | 647 | You should have received a copy of the GNU General Public License 648 | along with this program. If not, see . 649 | 650 | Also add information on how to contact you by electronic and paper mail. 651 | 652 | If the program does terminal interaction, make it output a short 653 | notice like this when it starts in an interactive mode: 654 | 655 | Copyright (C) 656 | This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. 657 | This is free software, and you are welcome to redistribute it 658 | under certain conditions; type `show c' for details. 659 | 660 | The hypothetical commands `show w' and `show c' should show the appropriate 661 | parts of the General Public License. Of course, your program's commands 662 | might be different; for a GUI interface, you would use an "about box". 663 | 664 | You should also get your employer (if you work as a programmer) or school, 665 | if any, to sign a "copyright disclaimer" for the program, if necessary. 666 | For more information on this, and how to apply and follow the GNU GPL, see 667 | . 668 | 669 | The GNU General Public License does not permit incorporating your program 670 | into proprietary programs. If your program is a subroutine library, you 671 | may consider it more useful to permit linking proprietary applications with 672 | the library. If this is what you want to do, use the GNU Lesser General 673 | Public License instead of this License. But first, please read 674 | . 675 | --------------------------------------------------------------------------------