Git Product home page Git Product logo

bot_spacecrypto's Introduction

SpaceCrypto Bot

  • [en-us] In order to change to english Readme version click here.
  • [pt-br] Para alterar para a versão Readme em português, clique aqui.

This is an automation (bot) to play the game SpaceCrypto, it automatically login into the game, send ships to fight, refresh the game, new map, etc.

If you find this bot helpful to you, please donate so we can continue to improve the hard work and hours spent on this 🤯.

Donation

Donations options:

Observations

  • Check Requirements topic to make sure in what environment, tools and versions we know that it works.
  • I suggest you to turn off the feature News and interests from Windows, because the mouse might pass through it and click in some card without us know. You can turn off this feature from Turn news and interests feature on and off guide.
  • Change the sort option in the game to "Max Ammo", that will keep the bot faster by looking into new ships even with pagination.

Does your bot is in endless loop and it's doing nothing? So read the note below!

The problem now, is that it's not matching the same images I shared from the one you have on your screen. So you'll need to change those in order to make it work. So you'll need to replace the same images with the exactly same names in the path /static/img/game.

All images taken from the game was from a Full HD screen and scale at 100%. So if your bot is not working, make sure that your scale is at least 100%. After that, get all pictures again and save them as .png format.

Main Steps

In a breafy way you'll need to:

  1. Download Python
  2. Install python packages from requirements.txt
  3. Adjust screen scale to 100% if needed
  4. Download Brave browser (best option)
  5. Change options on config.yaml file if needed
  6. Create Telegram bot if needed

Project structure

.
└── Bot_SpaceCrypto
    ├── main.py                     # setup our app
    ├── bot.py                      # all bot movements
    ├── controllers.py              # all controllers to help the bot to run
    ├── config.yaml                 # all configurations and options to run
    └── logs                        # all log files are saved daily here
    └── static
        ├── img
            ├── game                # all images related to game to run the bot
            ├── readme              # all images related to repository
            ├── screenshot          # all images taken from screenshot (folder will create automatically)

Tutorial

The tutorial on how to install and use this bot can be found on GitHub Wiki page.

The tutorial on how to use Brave browser for this bot can be found on GitHub Wiki page.

Some settings can be changed in the config.yaml file. If you change it, don't forget to restar the bot so that the new settings are activated.

Changelog

  • 03/03/2022:
    • Removed the schedule to send ships to work because we are using the image zero-ships.png for that.
    • Minor fixes in some functions
  • 22/02/2022:
    • Added create_bat_file, telegram_pic_integration, drag_amount, surrender_on_boss parameters
    • Added function to surrender on boss, when boss image is the same as boss available
    • Improved function to send pictures to Telegram
  • 19/02/2022:
    • Added verification of work_ships_options parameter
    • Improved the function to call ships to fight
    • Changed image from error in the game
    • Changed the way it scrolls the ships when the game is in "full" mode in the work_ships_options parameter
  • 17/02/2022:
    • Improved the function to send pictures to Telegram
    • Improved the way it was looking for errors on game
    • Improved function to find the button confirm
  • 16/02/2022: Released bot first version

Requirements

Browser: Brave: Version 1.34.81 Chromium: 97.0.4692.99

⚠️ I really advise you to use the Brave browser instead of others, for so many reasons, especially if you want to use multiaccount feature.

For Brave tutorial, check here.


Windows version:

  • Windows 10
  • Windows 11

Python version (Python 3.10+ versions DOES NOT work!):

Python 3.9.9

The requirements can be found in requirements.txt file also. This project utilizes the following requirements:

APScheduler==3.6.3
asyncio==3.4.3    
numpy==1.21.4
opencv-python==4.5.4.60
pandas==1.1.5
pathlib==1.0.1
Pillow==8.4.0
PyAutoGUI==0.9.53
python-telegram-bot==13.9
pywin32==303
pywinauto==0.6.8
PyYAML==6.0
requests==2.26.0
tzlocal==4.1

Monitor scale: 100%

Features

  • Schedule the refresh of the game in a period of time
  • Schedule sending ships to fight in a period of time
  • Delete old files and folders if you want automatically
  • Connect into wallet
  • Connect, signin, unlock Metamask
  • Check if is there new map available
  • Take screenshot of errors, new maps, sending to fight, etc
  • Send Telegram message
  • Works with as many accounts as you need

YAML file configurations and options explained

1. bot_options

  • create_logfiles: You can enable the creation of log in files availabe in the folder logs
  • delete_old_logfiles: You can enable the deletion of old log files and keep today's date file.
  • delete_old_folders: You can enable the deletion of older folders and keep today's date folders.
  • enable_multiaccount: You can enable the multiaccount feature.
  • multiaccount_names: You can set the account/profile names from Brave browser in each line.
  • refresh_browser_time: You can set the time where the browser will be refreshed by the keys: CTRL + SHIFT + R 1.1 metamask_options
    • enable_login_metamask: You can enable the login in Metamask when it's locked and needs password to unlock
    • metamask_password: If enable_login_metamask option is set to True, you can pass the password to unlock Metamask.

2. telegram_options

  • telegram_integration: You can enable the integration from log messages to Telegram messages as well
  • telegram_token: If telegram_integration is set to True, you can pass the token from your Telegram bot.
  • telegram_chatid: If telegram_integration is set to True, you can pass the chat_id number from your Telegram bot. Once the number is wrote, it doesn't change anymore.

3. game_options

  • work_ships_options: You can set the fight mode for your ships.
    • The option all send all ships to fight, whenever the fight button is available.
    • The option full send all ships to fight regardless of the rarity and only when the ammo is 100%.
  • work_ships_time: You can set the time when bot will send ships to fight automatically.
  • refresh_ships_time: You can set the time when bot will just refresh the game, so the game don't disconnect.
  • chest_screenshot_time: You can set the time when bot will take a screenshot from your coins from the game.
  • clicks_count: You can set how many ships you have, so the bot will not keep clicking more than you need.
  • drag_count: You can set for how many times you want the bot to drag the list searching for ships that has ammo.

Improvements

  • More options in sending ships to fight
  • Sort ships automatically set from user

Conclusion

  1. Want my code? Grab it here 📎
  2. Want the tutorial of how to use it? Go to Wiki ✔️
  3. New ideas for this app? Help me to improve it ❤️
  4. Want something else added to this tutorial? Add an issue to the repo ⚠️

bot_spacecrypto's People

Contributors

guimatheus92 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

bot_spacecrypto's Issues

Bot sempre faz o mesmo movimento do mouse!

No cmd não aparece nenhuma mensagem de erro, porém o bot só faz uma movimentação no centro da tela e da um click, depois passa repetir isso.
Qual seria a resolução ideal para ele?
spgb

Sugestão de redimensionamento e múltiplas janelas.

Seria interessante poder trabalhar com o bot em janelas pequenas, 50% a 67% por exemplo, e redimensionamento automático para o tamanho que você programou, evitando assim falhas para reconhecer os pixels, isso ajudaria ter várias janelas trabalhando ao mesmo tempo e sobre nossa visão.

Tela preta/Contas desativadas

AnyDesk_zzrmsXFfyA
Alguma ideia do q possa ser? Todas as ABAS ficaram com a tela preta, e o jogo cai.. veja no grafico abaixo do usa da CPU como cai geral o processamento.. acusando q as 4 contas estão desativadas.

Multiaccounts not working?

Hi, Single account is working great, after i changed the images.

However, i wanted to use Multi account.

After enabling Multi account, and doing all the instructions regarding Flags on brave.

The bot reads the profile names. But says ot has 0 profiles.

RETIRADA DE NAVES EM CASO DE FALHA

Em momentos q o jogo apresenta instabilidade e da erro, o BOT corretamente atualiza a pagina.
Porém ao iniciar o jogo novamente, ele retira todas as naves selecionadas e seleciona novas naves (Mesmo se ele acabou de selecionar as naves e tao com a estamina cheia). Isso leva um tempo consideravel quando se trabalha com multiplas contas e acaba prejudicando o FARM quando acontecem muitas oscilações, igual percebi essa madrugada.

Opções que poderia ser adicionadas:

  • Colocar a opção de apenas completar as 15 naves em caso de reinicio
  • Retirada apenas das que estão com menos de 50% de estamina

Ao executar main.py

C:\Bot_SpaceCrypto-main>main.py
Traceback (most recent call last):
  File "C:\Bot_SpaceCrypto-main\main.py", line 4, in <module>
    from bot import reload_page, start_game, login_metamask, new_map, SetTrigger, skip_error_on_game, how_many_coins, first_start, send_ships_to_fight, refresh_game, continue_fighting
  File "C:\Bot_SpaceCrypto-main\bot.py", line 8, in <module>
    from controllers import setup_logger, take_screenshot, read_configurations, send_telegram_pic
  File "C:\Bot_SpaceCrypto-main\controllers.py", line 2, in <module>
    import requests
ModuleNotFoundError: No module named 'requests'

Selecionar até BOSS XX (SURRENDER)

É possivel selecionar até qual BOSS ele vai aplicar o SURRENDER?
Isso seria bem interessante pra ajudar algumas contas mais fracas e outras fortes com estrategia de FARM.

Sugestão: disponibilizar quais logs mostrar e duvida sobre niveis de boss

Boa tarde,

Antes de mais nada, seu bot está incrível, parabéns pelo ótimo trabalho que fez nele.

Eu gostaria de sugerir uma coisa:
Eu configurei para enviar os logs para o telegram, porém ele envia TODOS os logs, isso gera muito spam, não teria como colocar para setar quais logs receber no yaml?
Exemplo:

  • Eu só quero receber logs das screenshots, quando enviar as naves pra lutar e quando clicar em continuar.

Também tenho uma dúvida, você criou alguma configuração referente a alterar as naves após o nivel 9, 15, etc? Se sim, como faz para configurar isso? Seria legal deixar disponibilizado para que pudéssemos configurar isso e também configuração para escolher quais naves enviar com base na raridade.

Muito obrigado pela atenção e por disponibilizar o BOT.

Abraço.

Mudança na hora de escolher as naves

Fala Gui
Boa tarde!
Como você está?
Amigo eles colocaram uma aba nova para mudar a pagina de naves.
image
Você consegue atualizar para esse novo formato?
E agora ficou mto mais rápido ao selecionar as naves também rsrs

Vlw

endless loop help

INFO | Function: main | 02/18/2022 00:58:10: ------------------- New Execution ----------------

INFO | Function: main | 02/18/2022 00:58:10: Donate on BUSD/BCOIN/ETH/BNB (BEP20): 0xf1e43519fca44d9308f889baf99531ed0de903fc
INFO | Function: main | 02/18/2022 00:58:10: Donate on PayPal: https://www.paypal.com/donate/?hosted_button_id=82CABN6CYVG6U
INFO | Function: main | 02/18/2022 00:58:10: Donate on Nubank: https://nubank.com.br/pagar/1jxcl/z5fyuL6S28
INFO | Function: main | 02/18/2022 00:58:10: Donate on Pix: 42a762ed-e6ec-4059-a88e-f168b9fbc63f
INFO | Function: main | 02/18/2022 00:58:10: Starting Bot..... Bot started!
INFO | Function: main | 02/18/2022 00:58:10: Scheduling to the refresh game every 14 minute(s)!
INFO | Function: main | 02/18/2022 00:58:11: Scheduling the time for ships to fight every 30 minute(s)!
INFO | Function: main | 02/18/2022 00:58:11: Scheduling the time for refreshing the browser every 60 minute(s)!
INFO | Function: main | 02/18/2022 00:58:11: Scheduling to take screenshot from coins every 60 minute(s)!
INFO | Function: main | 02/18/2022 00:58:11: Number of accounts that the bot will run: 1
INFO | Function: first_start | 02/18/2022 00:58:16: Bot (SPG):  First start function..
INFO | Function: skip_error_on_game | 02/18/2022 00:58:16: Checking if game has any erros or crash..
INFO | Function: continue_fighting | 02/18/2022 00:58:17: Bot (SPG):  Checking if needs to send ships to fight again..
INFO | Function: send_ships_to_fight | 02/18/2022 00:58:18: Bot (SPG):  [Work] Calling send ships to fight function..
INFO | Function: first_start | 02/18/2022 00:58:19: Bot (SPG):  Exiting start function..
INFO | Function: connect_wallet | 02/18/2022 00:58:23: Checking if needs to connect wallet..
INFO | Function: play_game | 02/18/2022 00:58:23: Checking if needs to play game..

Como organizar as janelas para multiacount?

Oi amigo primeiramente obrigado pelo programa!

Como devo organizar as janelas para rodar mais de 1 conta? (Ainda nao testei)

1- As contas tem que ficar tudo visiveis na tela? (em qualquer lugar da tela?)
2 - Ou Em modo cascata?

Agradeço

Error when enabling multi-account

image
If the value is False, everything works without errors, as soon as I turn on True and start the bot, it throws an error.
image
Deleted everything and made a new one, the same error, help me figure it out!

ERROR exeption

Ta dando esse erro ai tava no fight derrepente deu isso...
image

Panda and Pathlib Issue

having this error, it wont install directly, been trying to get around it for about 5 hours now. stil not working

### Pandas Error:

 note: This error originates from a subprocess, and is likely not a problem with pip.
  ERROR: Failed building wheel for pandas
Failed to build pandas
ERROR: Could not build wheels for pandas, which is required to install pyproject.toml-based projects

Pathlib Error:

Collecting pathlib==1.0.1
  Using cached pathlib-1.0.1.tar.gz (49 kB)
  Preparing metadata (setup.py) ... error
  error: subprocess-exited-with-error

  × python setup.py egg_info did not run successfully.
  │ exit code: 1
  ╰─> [1 lines of output]
      ERROR: Can not execute `setup.py` since setuptools is not available in the build environment.
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
error: metadata-generation-failed

× Encountered error while generating package metadata.
╰─> See above for output.

note: This is an issue with the package mentioned above, not pip.

OSError: screen grab failed

INFO | Function: go_to_ships | 02/17/2022 12:22:13: Bot (SPG): Going to ships menu..

Task exception was never retrieved
future: <Task finished name='Task-1' coro=<main() done, defined at C:\Users\dicroh\Downloads\Bot_SpaceCrypto-main\Bot_SpaceCrypto-main\main.py:21> exception=OSError('screen grab failed')>
Traceback (most recent call last):
  File "C:\Users\dicroh\Downloads\Bot_SpaceCrypto-main\Bot_SpaceCrypto-main\main.py", line 115, in main
    await asyncio.create_task(first_start(app_name=app[1]))
  File "C:\Users\dicroh\Downloads\Bot_SpaceCrypto-main\Bot_SpaceCrypto-main\bot.py", line 178, in first_start
    await asyncio.create_task(send_ships_to_fight(app_name=app_name))
  File "C:\Users\dicroh\Downloads\Bot_SpaceCrypto-main\Bot_SpaceCrypto-main\bot.py", line 349, in send_ships_to_fight
    buttons = list(pyautogui.locateAllOnScreen(FightImgBtn, confidence=0.99))
  File "C:\Users\dicroh\AppData\Local\Programs\Python\Python39\lib\site-packages\pyautogui\__init__.py", line 175, in wrapper
    return wrappedFunction(*args, **kwargs)
  File "C:\Users\dicroh\AppData\Local\Programs\Python\Python39\lib\site-packages\pyautogui\__init__.py", line 201, in locateAllOnScreen
    return pyscreeze.locateAllOnScreen(*args, **kwargs)
  File "C:\Users\dicroh\AppData\Local\Programs\Python\Python39\lib\site-packages\pyscreeze\__init__.py", line 397, in locateAllOnScreen
    screenshotIm = screenshot(region=None) # the locateAll() function must handle cropping to return accurate coordinates, so don't pass a region here.
  File "C:\Users\dicroh\AppData\Local\Programs\Python\Python39\lib\site-packages\pyscreeze\__init__.py", line 145, in wrapper
    return wrappedFunction(*args, **kwargs)
  File "C:\Users\dicroh\AppData\Local\Programs\Python\Python39\lib\site-packages\pyscreeze\__init__.py", line 457, in _screenshot_win32
    im = ImageGrab.grab()
  File "C:\Users\dicroh\AppData\Local\Programs\Python\Python39\lib\site-packages\PIL\ImageGrab.py", line 43, in grab
    offset, size, data = Image.core.grabscreen_win32(
OSError: screen grab failed

Cant switch on other account

Have some problems with multiaccount. When the battle ends on first account bot cant switch up on next account and he staying at the first account start menu trying to put planes in battle when they recharging. Hope you understand me.
P.S. Second account wasn't logged in.
P.S.S. But when all of accounts logged in and battling in 1 time i dont see this problems.

setup.py

Preparing metadata (setup.py) ... error
  error: subprocess-exited-with-error

  × python setup.py egg_info did not run successfully.
  │ exit code: 1
  ╰─> [1 lines of output]
      ERROR: Can not execute `setup.py` since setuptools is not available in the build environment.
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
error: metadata-generation-failed

× Encountered error while generating package metadata.
╰─> See above for output.

note: This is an issue with the package mentioned above, not pip.
hint: See above for details.

Opção de Pausar as operações

Algo q sinto falta em todos os bots de todos os jogos, seria uma opção de PAUSAR as operações, para q possa fazer algo na VM e apos isso voltar de onde parou. No seu bot daria certinho pra fazer pq ele opera as ABAS com identificação de nome, então é possivel ele voltar exatamente de onde parou.

troca de naves

  • Não sei se está com essa função ou o meu que não faz, mas existe a possibilidade de o bot durante a fight trocar as naves por outras ou ele espera zerar e coloca novas só quando todas estiverem cansadas? Se eu tiver 20 naves por exemplo, ele coloca as outras 5 quando as 15 primeiras cansarem?

Estão de parabéns pelo bot, excelente trabalho.

Sugestões de configuração para time pequeno

Antes de qualquer coisa gostaria de agradecer por sua enorme contribuição para a comunidade. Seu script realmente funciona e é muito bem organizado, programado e útil!

Gostaria de solicitar uma sugestão aqui, afinal, eu tenho poucas naves (15) e acho que o bot não funciona tão bem para quem tem poucas naves, né? Não sei qual seria o melhor método nesse caso, afinal se forem só minhas comuns não devo chegar em um boss significantemente bom.

Como é o funcionamento nesse caso? é enviado as minhas naves comuns sozinhas? as vezes com alguns Raros juntos e bem raramente com meu Super Raro (por culpa countdown)?

Obrigado novamente e aceito sugestões.

error: subprocess-exited-with-error

Bom Dia.
Tentei varias vezes mas fica dando este erro ao exeutar o comando.

pip install -r requirements.txt

tenho o Python 3.10.2
Erro neste pacote pip install pandas==1.1.5

instalei o Visual Studio e agora este erro

  pandas/_libs/src/klib\khash.h(563): warning C4090: 'fun‡Æo': qualificadores 'const' diferentes
  pandas/_libs/src/parser/io.c(139): error C2065: 'ssize_t': identificador nÆo declarado
  pandas/_libs/src/parser/io.c(139): error C2146: erro de sintaxe: ';' ausente antes do identificador 'rv'
  pandas/_libs/src/parser/io.c(139): error C2065: 'rv': identificador nÆo declarado
  pandas/_libs/src/parser/io.c(145): error C2065: 'rv': identificador nÆo declarado
  pandas/_libs/src/parser/io.c(145): warning C4267: 'fun‡Æo': conversÆo de 'size_t' para 'unsigned int', poss¡vel perda de dados
  pandas/_libs/src/parser/io.c(146): error C2065: 'rv': identificador nÆo declarado
  pandas/_libs/src/parser/io.c(157): error C2065: 'rv': identificador nÆo declarado
  pandas/_libs/src/parser/io.c(158): error C2065: 'rv': identificador nÆo declarado
  error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\BuildTools\\VC\\Tools\\MSVC\\14.29.30133\\bin\\HostX86\\x64\\cl.exe' failed with exit code 2
  [end of output]

note: This error originates from a subprocess, and is likely not a problem with pip.
ERROR: Failed building wheel for pandas
Failed to build pandas
ERROR: Could not build wheels for pandas, which is required to install pyproject.toml-based projects


Preparing metadata (setup.py) ... error
error: subprocess-exited-with-error

× python setup.py egg_info did not run successfully.
│ exit code: 1
╰─> [1 lines of output]
ERROR: Can not execute setup.py since setuptools is not available in the build environment.
[end of output]

note: This error originates from a subprocess, and is likely not a problem with pip.
error: metadata-generation-failed

× Encountered error while generating package metadata.
╰─> See above for output.

note: This is an issue with the package mentioned above, not pip.
hint: See above for details.

SURRENDER

Primeiramente, parabens pelo trabalho, seu bot esta se saindo melhor q todos q estou testando para multiplas contas, alem do seu suporte. Breve farei minha contribuição.

Vi que esta para implantar o SURRENDER e gostaria de dar uma dica:

Devido a multiplas contas, vai acontecer das contas chegarem ao BOSS X configurado para SURRENDER e passarem, devido ao bot estar config outras contas. Uma solução simples seria, quando ele identificar q passou, o bot poderia aguardar o BOSS finalizar, e apos a tela de VITORIA, dar o SURRENDER, não gastando assim energia/munição sem finalizar o BOSS.

Outra adição interessante, quando o BOT verificar q esta em 1 BOSS anterior ao config para SURRENDER, ele aguardar finalizar o BOSS e apos a tela de VITORIA apertar SURRENDER.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.