Code Monkey home page Code Monkey logo

tbot's Introduction

TBot - OGame bot

TBot

OGame Bot

GitHub all releases GitHub release (latest SemVer) Discord

TBot is a .NET 6 OGame bot based on ogamed deamon by alaingilbert

Feel free to publish issues or pull requests

TBot supports Ogame v11.2!

How to Update from 0.3.1

Be sure to remove .ogame folder from /home/username/ (linux) or C:/Users/username (win) before logging in

Stories in Ready

Disclaimer

Scripting and botting are forbidden by the OGame rules. I adopt a series of measures to prevent detection and thus ban, but I cannot, and never will, guarantee anything. Use this bot at your own risk!!

Testing and PR are very much appreciated!

Support TBot

Do you like the project? Buy me a beer!

Donate with PayPal

Configuration

TBot configuration consists in two files:

  • settings.json handles the configuration of Telegram Bot, WebUI and of the bot instances. settings.json can be passed as a command line argument as follows:

    TBot --settings=<settings.json path>

  • instance_settings.json handles the configuration of a bot instance

The settings.json should be compiled as follows:

{
        "TelegramMessenger": {
                "Active": true,
                "API": "<API TOKEN ID>",
                "ChatId": "<your chat id>",
                "TelegramAutoPing": {
                        "Active": true,
                        "EveryHours": 0
                }
        },
        "Instances": [
                {
                        "Alias": "Account alias",
                        "Settings": "<instance_settings>.json"
                },
                {
                        "Alias": "Another account",
                        "Settings": "<another_instance_settings>.json"
                }
        ],
	"WebUI": {
		"Enable": true,
		"Urls": "http://localhost:9090",
		"MaxLogsToShow": 2000
	}
}

NB: The settings should be pointing to a path relative to settings.json directory.

Important Notices

You must use different ports for each instance and for webUI. They all must be open and free.

Instances from the same lobby account can share the same cookies file;

If you run instances from different lobby accounts you must use different cookies files.

Be warned that Ogame's servers have a limit on the number of requests per second. If you run too many instances, you may get IP banned, or end up with banned accounts. Use proxies to avoid this.

Features

TBot has a wide variety of useful features. They all can be configured and customized editing the instance's settings file. Here follows a short explanation of each of them, read the Wiki for a more indepth explanation.

  • Defender: TBot checks periodically for incoming attacks
    • Autofleet: TBot dispatches your endangered fleet and resources on the safest mission possible. A favourite type of mission can be set in the settings
    • MessageAttacker: TBot sends a message to the attacker(s). The message is picked randomly from the array given in the settings
    • SpyAttacker: TBot automatically spies attacker with set number of probes
    • Alarm: TBot plays a nasty sound if under attack
    • TelegramMessenger: TBot sends you a notice if under attack (requires additional configuration, see below)
  • Expeditions: TBot will handle them for you
    • TBot can automatically optimize expeditions for your account, sending them from one or multiple origins. Military expos are supported too, by adding a ship type to the automatically calculated optimal fleet or by manually setting the desired fleet.
  • Brain: TBot has a series of extra functionalities
    • AutoCargo: TBot checks wether your celestials have enough capacity to displace the resources. If not, TBot builds ships for you (preferred type taken from settings)
    • AutoRepatriate: TBot periodically repatriates all your resources to a single drop celestial. You can also specify to leave a set amount of deuterium (only on moons or both moons and planets)
    • AutoMine: Tbot will develop your planets and moons up to the levels given in settings. A cool ROI based algorithm is present: TBot will develop your planets calculating to the most profitable building for each planet! A maximum amount of days of investment return can be set. An origin can be set in settings.json to send the necessary resources from.
    • AutoResearch: Tbot will develop your researches from the planet set in settings up to the given levels. An origin can be set in settings to send the necessary resources from.
    • AutoMineLF: TBot will develop you LifeForms buildings up to the given levels. TBot will detect the active lifeform based on lifeform buildings present, so you must build at least a lv 1 building in order to TBot to account for that planet.
    • AutoResearchLF: TBot will research the LifeForms techs you selected up to the given level. Only researches with lv 1 or more will be researched. You must manually select the desired researches and upgrade them to lv 1 or more in order to TBot to account for them.
    • BuyOfferOfTheDay: TBot can buy the daily item from the Trader (check intervals are implemented so you can configure shorter check times when there is the specific event)
  • AutoFarm: TBot will scan one or more ranges of systems spying inactive players and attacking them with the specified type of ship if they are profitable above a given amount.
  • AutoHarvest: TBot will harvest expedition debris in your celestials' systems as well as your own DFs
  • AutoColonize: TBot will make new colonies. Input the list of coordinates of your desired colonies and TBot will do the rest.
  • SleepMode: TBot will not interact with your account between the hours specified in settings
    • AutoFleetSave: TBot will keep your fleets safe by dispatching them on the safest mission possible until wake up time (deploy with recall is supported!)
  • Local Proxy: Tbot allows you to play in your browser
    • Insert the hostname of the machine you'll run TBot onto in the settings (i.e.: localhost, or the local ip of a computer on your local network such as 192.168.X.X)
    • Navigate with your browser to http://hostname:port/game/index.php (remember to change hostname and port with the ones you specified in settings)
    • Pay attention: TBot is not aware of what you do in the browser, it will do his job regardless of you playing manually, so keep an eye on the console
  • Proxy: TBot supports routing your traffic through a HTTP o SOCKS5 proxy
    • Fill the settings in settings. The settings are quite self-explainatory. WARNING: Ogame is positively blocking IPs from datacenters. You will probably need a residential proxy in ordet to be able to login.
  • WebUI: TBot has a webUI for changing settings, reading logs and interacting manually with the game. You can configure the host and port in the general settings file.

WebUI

Since 0.3.0 TBot includes a webUI where you can check and change the settings, read the logs in a filterable table and play manually with your account(s), all in the same place, even remotely.

Telegram

You can control and get info for TBot through a Telegram Bot. In order to enable it, you need to follow theese steps:

  • Create a new Telegram bot
    • Write "/new_bot" to @botfather
    • Follow the instructions given by BotFather, assigning a name and an username for the bot (theese are not important, set them to whatever you like)
    • BotFather will send you a message containing the API Key you need and a link to your new bot
    • Insert the newly obtained API Key in settings.json under TelegramMessenger.API
    • Click on the bot link and start the conversation
  • Get your ChatID
    • Write "/start" to @getmyid_bot
    • It will answer you a message containing your user ID and chat ID
    • Insert the newly obtained ID in settings.json under TelegramMessenger.ChatId
  • Send "/help" to the bot to get a list of the available commands. Here is a list:
    • Core Commands
      • /setmain - Set the TBot main instance to pilot. Format /setmain 0
      • /getmain - Get the current TBot instance that Telegram is managing
      • /getmainstats - Get current TBot instance statistics
      • /listinstances - List TBot main instances
      • /loglevel - Get current log level on telegram logging
      • /setloglevel - Set log level on telegram logging and enables it. Format /setloglevel Debug|Information|Warning|Error
      • /ping - Ping bot
      • /stopautoping - stop telegram autoping
      • /startautoping - start telegram autoping [Receive message every X hours]
      • /help - Display this help
    • TBot Main instance commands
      • /getfleets - Get OnGoing fleets ids (which are not already coming back)
      • /getcurrentauction - Get current Auction
      • /bidauction - Bid to current auction if there is one in progress. Format /bidauction 213131 M:1000 C:1000 D:1000
      • /subscribeauction - Get a notification when next auction will start
      • /ghostsleep - Wait fleets return, ghost harvest for current celestial only, and sleep for 5hours /ghostsleep 4h3m or 3m50s Harvest
      • /ghostsleepall - Wait fleets return, ghost harvest for all celestial and sleep for 5hours /ghostsleepall 4h3m or 3m50s Harvest
      • /ghost - Ghost for the specified amount of hours on the specified mission. Format: /ghost 4h3m or 3m50s Harvest
      • /ghostmoons - Ghost moons fleet for the specified amount of hours on the specified mission. Format: /ghostto 4h30m Harvest
      • /switch - Switch current celestial resources and fleets to its planet or moon at the specified speed. Format: /switch 5
      • /deploy - Deploy to celestial with full ships and resources. Format: /deploy 3:41:9 moon/planet 10
      • /jumpgate - jumpgate to moon with full ships [full], or keeps needed cargo amount for resources [auto]. Format: /jumpgate 2:41:9 auto/full
      • /phalanx - use phalanx from moon to destination. Format /phalanx 2:241:9 4:100:1
      • /cancelghostsleep - Cancel planned /ghostsleep(expe) if not already sent
      • /spycrash - Create a debris field by crashing a probe on target or automatically selected planet. Format: /spycrash 2:41:9/auto
      • /recall - Enable/disable fleet auto recall. Format: /recall true/false
      • /collect - Collect planets resources to JSON setting celestial
      • /build - Try to build buildable on each planet. Build max possible if no number value sent /build LightFighter [100]
      • /collectdeut - Collect planets only deut resources -> to JSON repatriate setting celestial
      • /msg - Send a message to current attacker. Format: /msg hello dude
      • /sleep - Stop bot for the specified amount of hours. Format: /sleep 4h3m or 3m50s
      • /wakeup - Wakeup bot\n" +
      • /cancel - Cancel fleet with specified ID. Format: /cancel 65656
      • /getcelestials - Return the list of your celestials
      • /attacked - check if you're (still) under attack
      • /celestial - Update program current celestial target. Format: /celestial 2:45:8 Moon/Planet
      • /getinfo - Get current celestial resources and ships. Additional arg format has to be /getinfo 2:45:8 Moon/Planet
      • /editsettings - Edit JSON file to change Expeditions, Colonize, Autominer's and Autoresearch Transport Origin, Repatriate and AutoReseach Target celestial. Format: /editsettings 2:425:9 Moon
      • /minexpecargo - Modify MinPrimaryToSend value inside JSON settings
      • /stopexpe - Stop sending expedition
      • /startexpe - Start sending expedition
      • /startdefender - start defender
      • /stopdefender - stop defender
      • /stopautoresearch - stop brain autoresearch
      • /startautoresearch - start brain autoresearch
      • /stopautomine - stop brain automine
      • /startautomine - start brain automine
      • /stoplifeformautomine - stop brain Lifeform automine
      • /startlifeformautomine - start brain Lifeform automine
      • /stoplifeformautoresearch - stop brain Lifeform autoresearch
      • /startlifeformautoresearch - start brain Lifeform autoresearch
      • /stopautofarm - stop autofarm
      • /startautofarm - start autofarm

Settings Hot Reload

TBot supports the editing of instance settings even while it is running. It will take care of turning on and off features as well as the specific feature config settings. You can change settings from WebUI or editing the files directly.

Hot reloading of instances is only partially supported at the moment. You can add and remove instances while the bot is running, but the feature is still in beta so there may be bugs.

Running on Windows

  • Download and unzip latest release.
  • Insert you credentials in instance settings file
    • Under "Universe" type your universe name with leading capital letter, i.e.: Andromeda, Bellatrix etc...
    • Under "Language" type your universe community code. You can find it by logging to your account and analyzing the url, such as s161-us.ogame.gameforge.com => us
  • Configure the bot by editing all settings fields
  • Make sure you have installed the .NET 6 runtime for your platform
  • Run TBot.exe

Running on Linux/MacOS

  • Open a terminal (if you are in a desktop environment)
  • Download latest release for your platform.
    • wget https://github.com/ogame-tbot/TBot/releases/download/VERSION/TBot-VERSION-PLATFORM.zip (change the filename to your real one!)
  • Unzip the downloaded file
    • unzip TBot-VERSION-PLATFORM.zip -d TBot (change the filename to your real one!)
  • Make ogamed executable (this is only required on first run or update)
    • chmod +x ogamed
  • Make TBot executable (this is only required on first run or update)
    • chmod +x TBot
  • Configure the general settings, listing all instance settings files
  • Insert you credentials in instance settings file
    • Under "Universe" type your universe name with leading capital letter, i.e.: Andromeda, Bellatrix etc...
    • Under "Language" type your universe community code. You can find it by logging to your account and analyzing the url, such as s161-us.ogame.gameforge.com => us
  • Configure the bot by editing all instance settings.json fields
    • All config options are sorted by feature, check which features you want and configure them before activating
  • Make sure you have installed the .NET 6 runtime for your platform
  • Run TBot
    • ./TBot

Running on Amazon Web Services

WARNING: Ogame is positively blocking IPs from datacenters. You probably need a residential proxy to run on AWS, or any other VPS.

Some successful tests have been done to run TBot on the smallest instance of LightSail (1 vCPU, 20 GB SSD, 500 MB RAM and 1 TB outbound traffic) on Amazon Linux 2, which is free for a three month trial. In order to run it, steps should be as follow:

  • Create your account on Amazon Web Services (Credit Card required), and create a LightSail Instance running Amazon Linux 2. The smallest one fits into the "Free Tier" Program, which allows a 3 month free trial.
  • Select the ports where you want to connect, and open them in the Networking Settings on the instance's AWS Console (ex. ports 8000 - 8020 open for TCP and from any ip address if you don't know where you will be connecting from). This should make it accessible to the public internet.
  • Connecto to AWS instance using SSH and the .pem key you get during the instance setup:
$ ssh -i ~/pem/<my>.pem ec2-user@<instance's public ip-address>
  • Update the system with
sudo yum update
$ sudo rpm -Uvh https://packages.microsoft.com/config/centos/7/packages-microsoft-prod.rpm
$ sudo yum install aspnetcore-runtime-6.0
$ sudo yum install dotnet-sdk-6.0
  • Upload your TBot files, which were previously downloaded and setup correctly. You can do this by using something like FileZilla using sftp and the same credentials as the ssh connection and then copy your TBot folder into the user's home directory in the server. Make sure your settings file has the public ip of the aws instance and the port where you want to connect.
  • Follow the instructions as written above for Linux by changing permissions.

Very important: if you run TBot by using the command ./TBot and then disconnect from the ssh connection, it'll kill TBot. In order to prevent this, you have to use a service called screen, and run the TBot instance like this:

$ screen ./TBot

then press <Ctrl + a + d> in order to detach the console.

Once it is detached you may close the ssh instance and TBot will run fine. You can repeat the process in order to run another instance of TBot on the server, as long as you detach it every time after you run the command.

The testing was done on the smallest LightSail instance has been running up to 4 instances of TBot (different accounts each), with no problems so far, however if you run a 5th instance, it can cause the server to run out of RAM and it'll crash.

Captcha solving

TBot implements an automatic captcha solving mechanism.

However, being based on ogamed, it supports manual captcha solving as well as Ninja Captcha Autoresolve service.

To manually solve captcha navigate to host:port/bot/captcha

To configure Ninja Capthca Service follow this guide and insert the obtained APIKey in settings.json

Development

Feel free to fork and make pull requests or give suggestions posting an Issue or joining the Discord chat.

Also, a proper documentation about how to deal with settings would no doubt be helpful, especially for new users.

Building

We write and build TBot with Visual Studio 2022 Community Edition, thus .NET 6 SDK is enough for command line compilation.

Releases are automated by GitHub Actions, take a look at the workflows if you are interested in the build process.

Portability

TBot is currently developed and mantained for Windows 64bit, Windows 32bit, Linux x86_64, MacOS 64bit, MacOS ARM, Linux ARMv7 and Linux ARM64.

tbot's People

Contributors

0xe232fe avatar anonymes-user avatar cheeeh avatar crucio32000 avatar ddprince17 avatar dependabot[bot] avatar emilianosalatino avatar feonor21 avatar hero-42 avatar kokiddp avatar milkypioneer avatar mipanox avatar mrburrburr avatar mstmp0 avatar ogame-tbot avatar polygamma avatar stewie-crypto avatar x4v1t0 avatar yolop0wn avatar

Stargazers

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

Watchers

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

tbot's Issues

Repatriate error when no dex left on servers with probe cargo

Hello,

Inside the function:
public static void AutoRepatriate(object state)

in this piece of code:

								} else {
									ships.Add(preferredShip, tempCelestial.Ships.GetAmount(preferredShip));
								}
								payload = Helpers.CalcMaxTransportableResources(ships, payload, researches.HyperspaceTechnology, userInfo.Class, probeCargo: serverData.ProbeCargo);

								if (payload.TotalResources > 0) {

"probeCargo:" is missing in original code.

This causes serverData.ProbeCargo to be entered into incorrect parameter (deutToLeave instead of probeCargo). If dex left on the planet is less than deutToLeave, than this leads to create a request to send "0 - serverData.ProbeCargo" dex. And this is a negative number!

Automatic Anti-ballistic Missile

Hi guys,

This morning i faced incomming missiles on my moon, because the wave of 150 rips could not get through my 1500 plasma turrets. I had to build abr while the ipr where flying in. can this be automated as a defence?

Unhandled exception. Telegram.Bot.Exceptions.ApiRequestException

In the middle of the night my bot crashed with the following exception:

Unhandled exception. Telegram.Bot.Exceptions.ApiRequestException: Bad Gateway
   at Telegram.Bot.TelegramBotClient.MakeRequestAsync[TResponse](IRequest`1 request, CancellationToken cancellationToken)
   at Telegram.Bot.TelegramBotClientExtensions.SendTextMessageAsync(ITelegramBotClient botClient, ChatId chatId, String text, Nullable`1 parseMode, IEnumerable`1 entities, Nullable`1 disableWebPagePreview, Nullable`1 disableNotification, Nullable`1 protectContent, Nullable`1 replyToMessageId, Nullable`1 allowSendingWithoutReply, IReplyMarkup replyMarkup, CancellationToken cancellationToken)
   at Tbot.Includes.TelegramMessenger.HandleErrorAsync(ITelegramBotClient botClient, Exception exception, CancellationToken cancellationToken)
   at Telegram.Bot.Polling.DefaultUpdateHandler.HandlePollingErrorAsync(ITelegramBotClient botClient, Exception exception, CancellationToken cancellationToken)
   at Telegram.Bot.Polling.DefaultUpdateReceiver.ReceiveAsync(IUpdateHandler updateHandler, CancellationToken cancellationToken)
   at Telegram.Bot.TelegramBotClientExtensions.ReceiveAsync(ITelegramBotClient botClient, IUpdateHandler updateHandler, ReceiverOptions receiverOptions, CancellationToken cancellationToken)
   at Telegram.Bot.TelegramBotClientExtensions.ReceiveAsync(ITelegramBotClient botClient, Func`4 updateHandler, Func`4 pollingErrorHandler, ReceiverOptions receiverOptions, CancellationToken cancellationToken)
   at Tbot.Includes.TelegramMessenger.TelegramBot()
   at System.Threading.Tasks.Task.<>c.<ThrowAsync>b__140_1(Object state)
   at System.Threading.QueueUserWorkItemCallbackDefaultContext.Execute()
   at System.Threading.ThreadPoolWorkQueue.Dispatch()
Aborted (core dumped)

relationship beetween metal, crystal and deuterium

I think it would be nice to be able to set the relationship of values beetween metal, crystal and deuterium used by the bot.

It could affter both ROI calculations if mines and such AND it could affter how autofarm values potential loot of scanned targets.

On speed unis crystal seems more valuable. For players who don't want to build very high mines metal seems less valuable.

Of course players who decide to pay for an exchange this is probably not an issue.

Any plans to add auto farmer feature?

Are there any plans to include an auto farmer function in the bot?

I think such a feature would greatly benefit the project. The implementation would probably not be that difficult, something like:

When farmer active and fleet slots (minus some reserved slots) available: Spy on inactives and / or a custom list of planets.
When espionage report comes in: Check if no defense / ships and if available resources above some threshold, calculate number of needed cargo ships and send them.

I just found this project, so I'm not familiar with the code and didn't even try the bot yet.
I might be able to help out, but have very little time available and would need to get familiar with the code, but let me know what you think about the suggestion!

AutoHarvest - Add `MinimumResources` for each target

I would like to set a different MinimumResources-value for DF and DeepSpace.

I propose the following changes to settings.json:

"AutoHarvest": {
  "Active": true,
  "HarvestOwnDF": true,
  "HarvestDeepSpace": true,
  "MinimumResourcesOwnDF": 300,
  "MinimumResourcesDeepSpace": 50000,
  "CheckIntervalMin": 30,
  "CheckIntervalMax": 60
},

Acces game in browser

It seems like I am facing an issue where TBOt application is correctly pointing to my VPS server on the home page of ogame website, but when I navigate to other pages, the links are still pointing to localhost rather than my VPS IP address.

InvalidOperationException crashing TBot

Not sure if the stacktrace is enough for you to fix the issue. Let me know if I can help in any way.

[Info] [Brain] [10/09/2021 02:58:39] - Sending LargeCargo: 119;  with M:0 C:3,270,348 D:1,631,989 E:0 DM:0 from XXX [M:0:0:0] to XXX [P:0:0:0]
[Info] [FleetScheduler] [10/09/2021 02:58:39] - Sending fleet from [M:0:0:0] to [P:0:0:0]. Mission: Transport. Speed: 100% . Ships: LargeCargo: 119;
ERRO [ogame.go:2422] Get "https://s178-en.ogame.gameforge.com/game/index.php?component=movement&page=ingame": context deadline exceeded (Client.Timeout exceeded while awaiting headers)
ERRO [ogame.go:2422] Get "https://s178-en.ogame.gameforge.com/game/index.php?component=movement&page=ingame": context deadline exceeded (Client.Timeout exceeded while awaiting headers)
Unhandled exception. System.InvalidOperationException: Sequence contains no matching element
   at System.Linq.ThrowHelper.ThrowNoMatchException()
   at System.Linq.Enumerable.Single[TSource](IEnumerable`1 source, Func`2 predicate)
   at Tbot.Program.AutoResearch(Object state)
   at System.Threading.TimerQueueTimer.<>c.<.cctor>b__23_0(Object state)
   at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)
--- End of stack trace from previous location ---
   at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)
   at System.Threading.TimerQueueTimer.CallCallback(Boolean isThreadPool)
   at System.Threading.TimerQueueTimer.Fire(Boolean isThreadPool)
   at System.Threading.TimerQueue.FireNextTimers()
   at System.Threading.TimerQueue.AppDomainTimerCallback(Int32 id)
Aborted

problem with lifeform automine

Hello,

Not sure how to debug, but this started to happen after I started using lifeforms in few next planets:

[Error] [Brain] [29.10.2022 06:01:30] - Lifeform AutoMine Exception: An error has occurred: Status: error - Message: invalid ogameID
[Warning] [Brain] [29.10.2022 06:01:30] - Stacktrace:    at Tbot.Services.OgamedService.GetPrice(LFBuildables buildable, Int64 levelOrQuantity) in *****\source\repos\TBot2\TBot\Services\OgamedService.cs:line 923
   at Tbot.Includes.Helpers.GetNextLFBuildingToBuild(Celestial planet, Int32 maxPopuFactory, Int32 maxFoodFactory, Int32 maxTechFactory) in *****\source\repos\TBot2\TBot\Includes\Helpers.cs:line 2018
   at Tbot.Program.LifeformAutoMine(Object state) in *****\source\repos\TBot2\TBot\Program.cs:line 4182

[FEAT] More intelligent defender

It would be pretty cool to be able to fine tune the defender setting a little bit more.

Specifically I would like to be able to fleet save to the nearest moon from a planet under attack.
Then from there if the moon gets attacked it would get sent to a harvest mission.

Perhaps it's also possible to Increase the check interval while under attack in order for the bot to make more intelligent decisions with updated data.

AutoColonize issue when Compute Techno not reserched

Hello,

I just realized that the autocolonize bug if we haven't researched computer technology at least level 1.

Here is the error I get:

[09:51:08|Info|FleetScheduler] Sending fleet from [P:4:487:10] to [P:4:487:6]. Mission: Colonize. Speed: 100% Ships: ColonyShip: 1; [09:51:08|Debug|FleetScheduler] Calculated flight time (one-way): 00:31:06 [09:51:08|Debug|FleetScheduler] Calculated flight time (full trip): 01:02:12 [09:51:08|Debug|FleetScheduler] Calculated flight fuel: 118 [09:51:08|Warning|FleetScheduler] Unable to send fleet, no slots available [09:51:08|Info|Colonize] Delaying... [09:51:08|Info|Brain] Repatriating resources... Unhandled exception. System.InvalidOperationException: Sequence contains no elements at System.Linq.ThrowHelper.ThrowNoElementsException() at System.Linq.Enumerable.First[TSource](IEnumerable1 source) at Tbot.Program.HandleColonize(Object state) at System.Threading.TimerQueueTimer.<>c.<.cctor>b__23_0(Object state) at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state) --- End of stack trace from previous location --- at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state) at System.Threading.TimerQueueTimer.CallCallback(Boolean isThreadPool) at System.Threading.TimerQueueTimer.Fire(Boolean isThreadPool) at System.Threading.TimerQueue.FireNextTimers() at System.Threading.TimerQueue.AppDomainTimerCallback(Int32 id) PS D:\Downloads\TBot>

After this error, Tbot exit.

TBot version: 0.2.57.0
OS: Windows 11
Runtime : .Net 5 latest

Thank you
Daeloran
settings_copy.txt

Checking next mine to build

If you have catched a moment when on initialising automine one mine is shown as 'next mine' but few moments later another mine is started - here is the reason:

Inside function GetNextMineToBuild there is following code:

Dictionary<Buildables, float> dic = new();
............. get a dictionary of possible mines to be built into 'dic'
dic = dic.OrderBy(m => m.Value)
    ToDictionary(m => m.Key, m => m.Value);
var bestMine = dic.FirstOrDefault().Key;

What it does?

  1. checkes what mines can be build and puts them into 'dic'.
  2. orders possible mines by their ROI and put them into ordereddictionary (to keep the order)
  3. converts ordereddictionary back into dictionary, loosing the order and puts them back into 'dic'
  4. gets first of mines from 'dic' (not ordered dictionary) and says it should be built.

Obviously correct code would skip step 3, so it should look something like this:

Dictionary<Buildables, float> dic = new();
............. get a dictionary of possible mines to be built into 'dic'
var orderedDic = dic.OrderBy(m => m.Value);
var bestMine = orderedDic.FirstOrDefault().Key;

In fact current internal implementation of dictionary usually keeps the order or entered elements, so it usually works. But only usually.

Btw similar code appears in two copies of GetNextMineToBuild and in GetNextResearchToBuild too.

Wrong Fleet Return Time when Recalling Fleet

Hi,
i found out that if a user is getting attacked and the bot saves the fleet and recalls it because the attack was aborted it outputs the time of the arrival without recalling.

eg.

the bot saves from planet a to moon a
lets say the flight will take 1h and he starts to save at 8:00am arrival would be 9:00am at Moon A

Now lets add the fact that the attack gets aborted and the bot recalls the fleet at 08:10am the arrival time at Planet A must be 08:20am but bot reports that it's 9:00am

do you get what i mean ?
it seems to be just an error in the output because the routines are running normally so he would check a new attack and saves the fleet... but still confusing maybe fix console output

in Program.cs on Line: 948 this is Original

Helpers.WriteLog(LogType.Info, LogSender.Tbot, "Fleet recalled: return time: " + fleet.ArrivalTime.ToString());


and it has to use --> the time of the recall flight instead of -> fleet.ArrivalTime.ToString()

i'll take a look at it later maybe there allready is a value for that time if i find it i will fix it

question: how to use whitelist on defender mode

to my understanding to insert a player into my whitelist (for example someone who helps me creating a moon and therefor attacking me.) I need to get his player ID, but I can't find anything that looks like a player ID on Ogame.
where do I get that player ID to insert it to the whitelist?

Thanks

cuncurrency for resources on the planet

There are few different functions working on building different things on one planet:

  1. automine
  2. autoresearch (if used on that planet)
  3. lifeformsautomine
  4. lifeformsautoresearch

Each of those functions can use resources available on the planet and it's fine.
But if there are not enough resources, than function has to ask for a transport of resources. That it schedules itself to continue once transport arrives. Its' fine too.
But if another build finishes, than in can kick in and steal some of the resources.

Let's say that automine usually has builds that take way more time than lifeformsautomine.

Now something like this frequently happens:

  1. Automine wants to build something, let's say DeuteriumSynthesizer level 27. It requires metal: 8 522 270 and crystal 2 840 757.
    Let's say half of that is available, so it asks for a transport with the other half. Transport starts.
  2. Lifeformsautomine completes something and starts another small thing. Using some of the resources that are available on the planet.
  3. Automine gets it's transport and finds out that is short of resources again, as some were took by lifeformsautomine. So it schedules another transport.
  4. Lifeformsautomine completes something and starts another small thing. Using some of the resources that are available on the planet.

It's not sure how to work around that problem. It would be best to make a plan for the planet that includes all of the buildables, but doing that would be hard. A much easier to implement workaround would be to temp block other build operations on the planet if one waits for a transport.

But I would prefer to NOT implement it as "don't build anything if any transport is arriving" as that would interfere with user transporting resources between planets.

Any ideas?

transfering resources for few buildables

First of all: it's a great feature that was just recently added. Thanks!

But it doesn't always work good. At least when first buildable to be built is SolarPlant than something like this happens:

[Info] [Brain] [06.10.2022 10:52:16] - Running automine...
[Info] [Brain] [06.10.2022 10:52:16] - Running AutoMine on *****
[Info] [Brain] [06.10.2022 10:52:19] - Best building for *****: SolarPlant
[Info] [Brain] [06.10.2022 10:52:19] - Not enough resources to build: SolarPlant level 13 on *****. Needed: M: 9 731 C: 3 893 D: 0 - Available: M: 2 231 C: 3 024 D: 501 999
[Info] [Brain] [06.10.2022 10:52:20] - Sending resources for SolarPlant level 14 too
[Info] [Brain] [06.10.2022 10:52:20] - Sending resources for SolarPlant level 15 too
[Info] [Brain] [06.10.2022 10:52:20] - Sending resources for SolarPlant level 16 too
[Info] [Brain] [06.10.2022 10:52:21] - Sending LargeCargo: 3;  with M: 77 000 C: 29 000 D: 0 from ***** to *****

Obviously later it doesn't insist on building few levels of SolarPlanet before building anything other.

btw Another thing is that it could cooperate with LF automine and autoresearch too. But it's less important for me as usually when LF starts I already have a moon and I'm letting my transfers go through the moon. Transfer from local moon is very very fast so this doesn't matter for me. But for players who don't transfer resources through local moon it might be important too.

Attacker tools

I think few simple attacked tools woud be quite useful when wathing targets. They are generally speaking an ad hoc configuration so setting them up temporary by telegram messages would be better than by settings file.

  1. Open galaxy for given system or range of systems and note any debris appearing / disappearing. Automatically repeat every "x" seconds/minutes. And write differences in a file somewhere (or send message by telegram if changes are detected).

  2. Open galaxy for given system or range of systems and note any activity markers appearing / disappearing. Automatically repeat every "x" seconds/minutes. And write differences in a file somewhere (or send message by telegram if changes are detected).

  3. Use sensor phalanx or given target and note any changes (new or cancelled fleets). Automatically repeat every "x" seconds/minutes. And write differences in a file somewhere (or send message by telegram if changes are detected).

Each of the tools should have a completion time when it would automatically stop or maybe even an ability to stop if given change is detected (like stop scanning if given debris field disappears or if given fleet is cancelled).

Autofarm: Cache galaxyinfo, persist database

Hello,

It's a long one ;)

It would be nice to implement caching of galaxyInfo received from the server. It would allow more aggressive sending of farming attacks without spamming galaxy refreshes.

Cache (or it's entry at least) should be cleared on any error with sending ships to the destination. In case an error is caused by planet (or moon) got removed.

It would also be nice to persist galaxy cache and farm targets.

And it would be nice to implement deadline for scanning targets.

For me it looks like this:

declare:
static volatile Dictionary<int, GalaxyInfo> galaxyCache = new();

At start of AutoFarm - prepare:

			string farmTargetsFileName = new($"{Helpers.logPath}/farmTargets.json");
			string galaxyCacheFileName = new($"{Helpers.logPath}/galaxyCache.json");
			var rng = new Random();
			DateTime? ScanningDeadTime = null;

After checking if there are enough slots - read persisted data and change pruning old data

					if (freeSlots > slotsToLeaveFree) {
						try {
							if (farmTargets.Count == 0) {
								try {
									string farmTargetsStr = File.ReadAllText(farmTargetsFileName);
									farmTargets = Newtonsoft.Json.JsonConvert.DeserializeObject<List<FarmTarget>>(farmTargetsStr);
								} catch (Exception) {
								}
							}
							if (galaxyCache.Count == 0) {
								try {
									string galaxyCacheStr = File.ReadAllText(galaxyCacheFileName);
									galaxyCache = Newtonsoft.Json.JsonConvert.DeserializeObject<Dictionary<int, GalaxyInfo>>(galaxyCacheStr);
								} catch (Exception) {
								}
							}
							// Prune all reports older than KeepReportFor and all reports of state AttackSent: information no longer actual.
							var newTime = GetDateTime();
							var removeReports = farmTargets.Where(t => t.State == FarmState.AttackSent || t.State == FarmState.ProbesSent || (t.Report != null && DateTime.Compare(t.Report.Date.AddMinutes((double) settings.AutoFarm.KeepReportFor), GetDateTime()) < 0)).ToList();
							foreach (var remove in removeReports) {
								var updateReport = remove;
								updateReport.State = FarmState.ProbesPending;
								updateReport.Report = null;
								farmTargets.Remove(remove);
//								farmTargets.Add(updateReport);
							}

At scanning loop - check deadline:

							foreach (var range in settings.AutoFarm.ScanRange) {
								if (Helpers.IsSettingSet(settings.AutoFarm.TargetsProbedBeforeAttack) && settings.AutoFarm.TargetsProbedBeforeAttack != 0 && numProbed >= (int) settings.AutoFarm.TargetsProbedBeforeAttack) break;
								if ((ScanningDeadTime != null) && (DateTime.Now > ScanningDeadTime)) break;

								int galaxy		= (int) range.Galaxy;
								int startSystem = (int) range.StartSystem;
								int endSystem	= (int) range.EndSystem;

A little lower - check deadline again:

								// Loop from start to end system.
								for (var system = startSystem; system <= endSystem; system++) {
									if (Helpers.IsSettingSet(settings.AutoFarm.TargetsProbedBeforeAttack) && settings.AutoFarm.TargetsProbedBeforeAttack != 0 && numProbed >= (int) settings.AutoFarm.TargetsProbedBeforeAttack) break;
									if ((ScanningDeadTime != null) && (DateTime.Now > ScanningDeadTime)) break;

									// Check excluded system.

A little bit lower - cache galaxyInfo. I have decided to randomly refresh it sometimes. You can do that or not

									GalaxyInfo galaxyInfo;
									int galaxyIndex = galaxy * 1000 + system;
									{
										if (rng.NextDouble() < 0.02) {
											galaxyCache.Remove(galaxyIndex);
										}
										if (galaxyCache.TryGetValue(galaxyIndex, out galaxyInfo)) {
										} else {
											galaxyInfo = ogamedService.GetGalaxyInfo(galaxy, system);
											galaxyCache.Add(galaxyIndex, galaxyInfo);
										}
									}
									var planets = galaxyInfo.Planets.Where(p => p != null && p.Inactive && !p.Administrator && !p.Banned && !p.Vacation && p.Coordinate.Type == Celestials.Planet);
									List<Celestial> scannedTargets = planets.Cast<Celestial>().ToList();

Later inside loop of sending probes we need to update free slots in case of an error. Else we risk of ugly loop of failed attempts if another task used our last fleet slot:

											if (celestialProbes[closest.ID] >= neededProbes) {
												Ships ships = new();
												ships.Add(Buildables.EspionageProbe, neededProbes);

												Helpers.WriteLog(LogType.Info, LogSender.AutoFarm, $"Spying {target.ToString()} from {closest.ToString()} with {neededProbes} probes.");

												slots = UpdateSlots();
												// in case another task used our fleet slot we need to break a loop of failed spy attempts
												freeSlots = slots.Free;
												var fleetId = SendFleet(closest, ships, target.Celestial.Coordinate, Missions.Spy, Speeds.HundredPercent);
												if (fleetId > 0) {

Just a little bit lower - chose a deadline after first successful spy. Could be taken from settings probably:

												if (fleetId > 0) {
													freeSlots--;
													numProbed++;
													celestialProbes[closest.ID] -= neededProbes;

													if (ScanningDeadTime == null) {
														ScanningDeadTime = DateTime.Now.AddMinutes(10); // could be settings parameter
													}

													if (target.State == FarmState.ProbesRequired || target.State == FarmState.FailedProbesRequired)
														break;

Remove an entry from galaxyCache in case of trouble:

												} else if (fleetId == -1) {
													stop = true;
													return;
												}
												else {
													// remove from galaxy cache, error might mean the planet has dissappeared
													galaxyCache.Remove(galaxyIndex);
													break;
												}

Oh, fix calculation of time required to wait for spy reports. We need to wait for all the spy reports, not for returning of first spy probe. There might be more probes still heading to their destinations. I have choced a fixed timeout to avoid waiting for any slow espionage fleet saves:

						// Wait for all espionage fleets to return.
						fleets = UpdateFleets();
						var celestialEspionages = Helpers.GetMissionsInProgress(Missions.Spy, fleets).Where(e => (e.ArriveIn >= 0) && (e.ArriveIn < 4 * 60));
						Fleet lastSpied = (celestialEspionages.Any())
							? celestialEspionages.OrderByDescending(e => e.ArriveIn).First()
							: null;
						//Fleet firstReturning = Helpers.GetFirstReturningEspionage(fleets);
						if (lastSpied != null) {
							int interval = (int) ((1000 * lastSpied.ArriveIn) + Helpers.CalcRandomInterval(IntervalType.AFewSeconds));
							Helpers.WriteLog(LogType.Info, LogSender.AutoFarm, $"Waiting for probes to spy...");
							Thread.Sleep(interval);
						}

And finally store galaxyinfo and galaxycache to files:

			} finally {
				Helpers.WriteLog(LogType.Info, LogSender.AutoFarm, $"Attacked targets: {farmTargets.Where(t => t.State == FarmState.AttackSent).Count()}");
				{
					if (farmTargets.Count > 0) {
						try {
							string farmTargetsStr = Newtonsoft.Json.JsonConvert.SerializeObject(farmTargets, Newtonsoft.Json.Formatting.Indented);
							File.WriteAllText(farmTargetsFileName, farmTargetsStr);
						} catch (Exception) {
						}
					}
					if (galaxyCache.Count > 0) {
						try {
							string galaxyCacheStr = Newtonsoft.Json.JsonConvert.SerializeObject(galaxyCache, Newtonsoft.Json.Formatting.Indented);
							File.WriteAllText(galaxyCacheFileName, galaxyCacheStr);
						} catch (Exception) {
						}
					}
				}
				if (!isSleeping) {

Sorry for not generating a patch, but I have too many changes made to the files and it's not easy to split them to different patches now :(

If data are persistent, than it's possible to add a lot more logic. But more about that another time.

Wrong usage for Delay with IntervalType.AFewSeconds?

https://github.com/ogame-tbot/TBot/blob/714a865c0f01a2f4c6f7ce02d98fae9336a1cb75/TBot/Workers/FleetScheduler.cs#LL500C24-L500C24

won't
await Task.Delay((int) IntervalType.AFewSeconds);
always result in 0 and should therefore look like:
await Task.Delay((int) RandomizeHelper.CalcRandomInterval(IntervalType.AFewSeconds));
?

also applies for this:

https://github.com/ogame-tbot/TBot/blob/714a865c0f01a2f4c6f7ce02d98fae9336a1cb75/TBot/Workers/ExpeditionsWorker.cs#LL276C1-L276C1

Expeditions: Limit types of military ships

Some military ships are painfully slow. It might be a good idea to select what types of military ships should be allowed in expeditions and what types should be avoided. Some players might decide to not use any military ships at all (only pathfinders).

Support Lifeforms

Hello,

It would be nice if TBot had actually supported lifeforms. Not just build and research them, but support.

At the moment for example:

  1. Speed of the ships is not correctly caltulated if lifeforms researches boost it.
  2. Capacity of the ships is not correctly calculated if lifeforms researches boost it.
  3. Deuterium usage is not correctly calculated if lifeforms researches decrease it.

First limitation is the worst as it has serious security implications. It can be really bad if it caused "deploy" fleet save to arrive it's destination before it got recalled. It can also lead to emergency (defender) fleet save to come back inside the window of possible delayed attack (130% of current time).

Autocargo does not provide a correct exit

Hello,

I notice Autocargo does not provide a correct output.

Indeed, I have not yet unlocked the LargeCargo and the autocargo notices that I do not have any (because they are the ships defined by default in the settings.json).
He therefore tries to launch the construction of the missing ships and tells me that the production has been launched.

But this is not true since I have not unlocked these ships.

There may be a test to add or review for a more accurate output :)

Here, the output I get:

[09:56:19|Info|Brain] Running autocargo... [09:56:20|Info|Brain] 265 230 more capacity is needed, 9 more LargeCargo are needed. [09:56:20|Info|Brain] Archeas [P:4:487:10]: Not enough resources to build 9xLargeCargo. 6 will be built instead. [09:56:21|Info|Brain] Production succesfully started. [09:56:22|Info|Brain] Next capacity check at 05/08/2022 11:48:29

TBot version: 0.2.57.0
OS: Windows 11
Runtime : .Net 5 latest

Thanks
Daeloran
settings_copy.txt

Turtle mode - Build defence

It would be nice to have a feature that would auto-build defence on each planet.

Settings part could look something like this:

"Turtle": {
	"Active": true,
	"CheckIntervalMin": 1,
	"CheckIntervalMax": 16,
	"Exclude": [],
	"DefenceToBuild": {
		"RocketLauncher": 20000,
		"LightLaser": 10000,
		and so on
	},
}

failed to find all resource settings

Hi,

i am always getting the following error when running Tbot:

[16:56:16|Info|Brain] Running AutoMine on Helgoland [P:1:484:1]
[16:56:16|Debug|Tbot] Exception: An error has occurred: Status: error - Message: failed to find all resource settings
[16:56:16|Warning|Tbot] Stacktrace:    at Tbot.Services.OgamedService.GetResourceSettings(Planet planet)
   at Tbot.Program.UpdatePlanet(Celestial planet, UpdateTypes UpdateTypes)
[16:56:16|Warning|Tbot] An error has occurred. Skipping update

Any suggestions how to fix?

Here is my settings.json

{
	"Credentials": {
		"Universe": "XXX",
		"Email": "XXX",
		"Password": "XXX",
		"Language": "de",
		"LobbyPioneers": false,
		"BasicAuth": {
			"Username": "",
			"Password": ""
		}
	},
	"General": {
		"UserAgent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/105.0.0.0 Safari/537.36",
		"Host": "192.168.3.3",
		"Port": "8282",
		"Proxy": {
			"Enabled": false,
			"Address": "",
			"Type": "socks5",
			"Username": "",
			"Password": "",
			"LoginOnly": true
		},
		"CaptchaAPIKey": "",
		"CookiesPath": "cookies.txt",
		"CustomTitle": "",
		"SlotsToLeaveFree": 1
	},
	"SleepMode": {
		"Active": true,
		"GoToSleep": "23:15",
		"WakeUp": "07:05",
		"PreventIfThereAreFleets": true,
		"TelegramMessenger": {
			"Active": false
		},
		"AutoFleetSave": {
			"Active": true,
			"OnlyMoons": true,
			"ForceUnsafe": true,
			"DeutToLeave": 200000,
			"Recall": true,
			"DefaultMission": "Deploy"
		}
	},
	"Defender": {
		"Active": true,
		"CheckIntervalMin": 1,
		"CheckIntervalMax": 22,
		"IgnoreProbes": true,
		"IgnoreMissiles": true,
		"IgnoreWeakAttack": false,
		"WeakAttackRatio": 3,
		"Autofleet": {
			"Active": true,
			"TelegramMessenger": {
				"Active": true
			}
		},
		"WhiteList": [
			100000,
			100003,
			100004
		],
		"SpyAttacker": {
			"Active": true,
			"Probes": 20
		},
		"MessageAttacker": {
			"Active": false,
			"Messages": [
				"hey",
				"hello",
				"i'm online'"
			]
		},
		"TelegramMessenger": {
			"Active": false
		},
		"Alarm": {
			"Active": true
		}
	},
	"Brain": {
		"Active": true,
		"AutoMine": {
			"Active": true,
			"MaxMetalMine": 40,
			"MaxCrystalMine": 35,
			"MaxDeuteriumSynthetizer": 37,
			"MaxSolarPlant": 20,
			"MaxFusionReactor": 20,
			"MaxMetalStorage": 13,
			"MaxCrystalStorage": 12,
			"MaxDeuteriumTank": 11,
			"MaxRoboticsFactory": 10,
			"MaxShipyard": 12,
			"MaxResearchLab": 12,
			"MaxMissileSilo": 0,
			"MaxNaniteFactory": 7,
			"MaxTerraformer": 8,
			"MaxSpaceDock": 7,
			"MaxLunarBase": 8,
			"MaxLunarShipyard": 0,
			"MaxLunarRoboticsFactory": 8,
			"MaxSensorPhalanx": 6,
			"MaxJumpGate": 1,
			"Transports": {
				"Active": false,
				"CargoType": "SmallCargo",
				"DeutToLeave": 1000000,
				"RoundResources": true,
				"Origin": {
					"Galaxy": 3,
					"System": 333,
					"Position": 8,
					"Type": "Moon"
				}
			},
			"RandomOrder": true,
			"Exclude": [
				{
					"Galaxy": 3,
					"System": 333,
					"Position": 15,
					"Type": "Planet"
				}
			],
			"OptimizeForStart": true,
			"PrioritizeRobotsAndNanites": false,
			"BuildDepositIfFull": false,
			"DepositHours": 6,
			"MaxDaysOfInvestmentReturn": 7,
			"DeutToLeaveOnMoons": 1000000,
			"CheckIntervalMin": 10,
			"CheckIntervalMax": 20
		},
		"AutoResearch": {
			"Active": true,
			"MaxEnergyTechnology": 20,
			"MaxLaserTechnology": 12,
			"MaxIonTechnology": 5,
			"MaxHyperspaceTechnology": 20,
			"MaxPlasmaTechnology": 20,
			"MaxCombustionDrive": 19,
			"MaxImpulseDrive": 17,
			"MaxHyperspaceDrive": 15,
			"MaxEspionageTechnology": 8,
			"MaxComputerTechnology": 20,
			"MaxAstrophysics": 23,
			"MaxIntergalacticResearchNetwork": 12,
			"MaxWeaponsTechnology": 25,
			"MaxShieldingTechnology": 25,
			"MaxArmourTechnology": 25,
			"Target": {
				"Galaxy": 3,
				"System": 333,
				"Position": 8,
				"Type": "Planet"
			},
			"Transports": {
				"Active": false,
				"CargoType": "SmallCargo",
				"DeutToLeave": 1000000,
				"RoundResources": true,
				"Origin": {
					"Galaxy": 3,
					"System": 333,
					"Position": 8,
					"Type": "Moon"
				}
			},
			"OptimizeForStart": true,
			"EnsureExpoSlots": true,
			"PrioritizeAstrophysics": true,
			"PrioritizePlasmaTechnology": true,
			"PrioritizeEnergyTechnology": true,
			"PrioritizeIntergalacticResearchNetwork": true,
			"CheckIntervalMin": 10,
			"CheckIntervalMax": 20
		},
		"AutoCargo": {
			"Active": false,
			"ExcludeMoons": true,
			"CargoType": "LargeCargo",
			"RandomOrder": true,
			"MaxCargosToBuild": 50,
			"MaxCargosToKeep": 50,
			"LimitToCapacity": true,
			"SkipIfIncomingTransport": true,
			"Exclude": [
				{
					"Galaxy": 3,
					"System": 333,
					"Position": 15,
					"Type": "Moon"
				}
			],
			"CheckIntervalMin": 60,
			"CheckIntervalMax": 240
		},
		"AutoRepatriate": {
			"Active": false,
			"ExcludeMoons": false,
			"MinimumResources": 1000000,
			"LeaveDeut": {
				"OnlyOnMoons": true,
				"DeutToLeave": 1000000
			},
			"Target": {
				"Galaxy": 5,
				"System": 63,
				"Position": 8,
				"Type": "Moon"
			},
			"CargoType": "LargeCargo",
			"RandomOrder": true,
			"SkipIfIncomingTransport": true,
			"Exclude": [
				{
					"Galaxy": 3,
					"System": 333,
					"Position": 15,
					"Type": "Planet"
				}
			],
			"CheckIntervalMin": 30,
			"CheckIntervalMax": 60
		},
		"BuyOfferOfTheDay": {
			"Active": false,
			"CheckIntervalMin": 240,
			"CheckIntervalMax": 360
		}
	},
	"Expeditions": {
		"Active": true,
		"PrimaryShip": "LargeCargo",
		"MinPrimaryToSend": 1,
		"PrimaryToKeep": 20,
		"SecondaryShip": "Null",
		"MinSecondaryToSend": 0,
		"SecondaryToPrimaryRatio": 2,
		"ManualShips": {
			"Active": false,
			"Ships": {
				"LargeCargo": 1300,
				"LightFighter": 26000,
				"Reaper": 1,
				"Pathfinder": 1,
				"EspionageProbe": 1
			}
		},
		"WaitForAllExpeditions": false,
		"WaitForMajorityOfExpeditions": false,
		"SplitExpeditionsBetweenSystems": {
			"Active": true,
			"Range": 1
		},
		"RandomizeOrder": true,
		"FuelToCarry": 20000,
		"Origin": [
			{
				"Galaxy": 1,
				"System": 484,
				"Position": 8,
				"Type": "Planet"
			}
		]
	},
	"AutoFarm": {
		"Active": false,
		"ExcludeMoons": true,
		"ScanRange": [
			{
				"Galaxy": 2,
				"StartSystem": 360,
				"EndSystem": 420
			}
		],
		"Exclude": [
			{
				"Galaxy": 3,
				"System": 3,
				"Planet": 3
			}
		],
		"KeepReportFor": 180,
		"NumProbes": 10,
		"Origin": [
			{
				"Galaxy": 2,
				"System": 396,
				"Position": 4,
				"Type": "Planet"
			}
		],
		"TargetsProbedBeforeAttack": 30,
		"CargoType": "LargeCargo",
		"FleetSpeed": 100,
		"MinCargosToKeep": 0,
		"MinCargosToSend": 25,
		"CargoSurplusPercentage": 10,
		"BuildCargos": false,
		"BuildProbes": false,
		"MinimumResources": 1000000,
		"MinimumPlayerRank": 500,
		"MaxFlightTime": 7200,
		"MaxWaitTime": 7200,
		"MinLootFuelRatio": 0.5,
		"PreferedResource": "",
		"SlotsToLeaveFree": 1,
		"CheckIntervalMin": 30,
		"CheckIntervalMax": 60
	},
	"AutoHarvest": {
		"Active": true,
		"HarvestOwnDF": true,
		"HarvestDeepSpace": true,
		"MinimumResourcesOwnDF": 300,
		"MinimumResourcesDeepSpace": 50000,
		"CheckIntervalMin": 30,
		"CheckIntervalMax": 60
	},
	"AutoColonize": {
		"Active": false,
		"Origin": {
			"Galaxy": 5,
			"System": 64,
			"Position": 8,
			"Type": "Planet"
		},
		"SlotsToLeaveFree": 0,
		"Targets": [
			{
				"Galaxy": 6,
				"System": 1,
				"Position": 8
			},
			{
				"Galaxy": 6,
				"System": 1,
				"Position": 9
			}
		],
		"CheckIntervalMin": 30,
		"CheckIntervalMax": 60
	},
	"TelegramMessenger": {
		"Active": true,
		"API": "XXX",
		"ChatId": "XXX",
		"TelegramAutoPing": {
			"Active": true,
			"EveryHours":  1
		}
	}
}

`DeutToLeaveOnMoons` for AutoMine

I upgraded some facilities on my moons using the AutoMine feature. The problem is that those moons are also the origin of my expeditions. So when AutoMine calculates how many resources it should send to build a facility it will use all the fuel for future expeditions. This is a problem because today I checked and saw that most of my moons ran out of fuel for expeditions and AFAIK there is currenlty no "re-fuel-moons" feature. So I think we should add the property DeutToLeaveOnMoons.

yet another problem with lifeform automine

Hello,

Here is fragment of log:
[Info] [Brain] [04.11.2022 14:23:49] - Running Lifeform autoresearch... [Info] [Brain] [04.11.2022 14:23:49] - Running Lifeform AutoResearch on **** [Info] [Brain] [04.11.2022 14:23:51] - Skipping ****: there is already a Lifeform research in production. [Info] [Brain] [04.11.2022 14:23:51] - Delaying... [Error] [Brain] [04.11.2022 14:23:52] - Lifeform AutoMine Exception: Number must be either non-negative and less than or equal to Int32.MaxValue or -1. (Parameter 'dueTime') [Warning] [Brain] [04.11.2022 14:23:52] - Stacktrace: at System.Threading.Timer..ctor(TimerCallback callback, Object state, Int64 dueTime, Int64 period) at Tbot.Program.LifeformAutoResearchCelestial(Celestial celestial) in ****\TBot\Program.cs:line 4099 at Tbot.Program.LifeformAutoResearch(Object state) in ****\TBot\Program.cs:line 3949

And it stopped doing lifeform autoresearch at least for this planet.

I believe it was caused by lag in the game. The message that research (or build) was completed, but refreshing still says it was completed. And you can't start next one (queued researches are still queued and not started, if you have queues bought).

Restarting TBot helped (at least for now). I haven't tried if /sleep and /wakeup from telegram would have helped.

Extend AutoRepatriate to deliver Deuterium to Expo origins

Lets say you have two or more moon-origins for Expeditions set. If you have no luck finding Deuterium on expeditions, at some point you won't have any fuel for further expeditions.

It would be nice to have a feature where you could "refill" the moon with Deuterium.

I know there is an option to leave a pre-defined amount of Deuterium on a moon, but this won't help since at some point it will run out.

Run multiple Instances of the script for different universes?

Hi,

is the any possibility to run multiple instances of this script?
I want to run in for different universes in ogame.

When I put the script in different folder with separate settings.jar the secondly started script seems not to take "its" settings.jar

Any ideas?

ERROR failed to parse planet infos

Hi!
First, thanks for your work!
I'm trying your bot for the first time. Seems like he is conneting well to the acc and everything (can see my ranking, my planet names etc).
However, the bot doesnt seem to do anything (i'm trying it on a brand new acc).
And i get this error :
[31mERRO←[0m [extracts_v6.go:38] failed to parse planet infos: Couillizator [1:450:12]Forme de vie: Les Humains12.800km (0/163)-12 °C à 28°CVue d`ensembleRessourcesForme de vieRechercheInstallationsChantier spatialDéfenseFlotteGalaxie

Is it because like you've not done the parsing for V9 in french or something like that? Or did i do something wrong?
Thanks in advance!

Failed to find all resource settings since update to 9.0.5-pl1

Since today's update on DE server to 9.0.5, the bot can no longer read some resources as shown below.

[21:53:51|Debug|Tbot] Exception: An error has occurred: Status: error - Message: failed to find all resource settings

[21:53:51|Warning|Tbot] Stacktrace: at Tbot.Services.OgamedService.GetResourceSettings(Planet planet) at Tbot.Program.UpdatePlanet(Celestial planet, UpdateTypes UpdateTypes)

[21:53:51|Warning|Tbot] An error has occurred. Skipping update

All other functions that I have active work so far without abnormalities.

AutoMine, LifeformsAutoMine, LifeformsAutoResearch and AutoRepatriate - route through local moon

It would be nice to implement a feature to route resource transports through local moons if possible. To avoid getting scanned or intercepted on long routes.

So for AutoMine, LifeformsAutoMine and LifeformsAutoResearch:

  1. if feature enabled and celestial is a planet and it has a moon than:
    a) try to get resources from the moon
    b) if there are not enough resources on the moon, than start a transport to the moon

  2. if feature is not enabled or if celestial is a moon than do what you do now.

And for AutoRepatriate (it's easier here):

  1. if feature enabled and celestial is a planet and it has a moon than:
    a) send resources to the moon

  2. if feature is not enabled or if celestial is a moon than do what you do now.

Autofarm do not function

Hello, since today I can no longer send autofarm it is indicated insufficient deuterium when this is not the case. The problem this product on MAC, Windows works.

Fleet Building

Hello,

Do you think it would be possible to add a "Fleet construction" and "Defense construction" part allowing to define a list of ships/defenses as well as their number to automate their creation?

Why not even add an option in the AutoFarm to automatically build the missing ships necessary to farm a planet with defenses etc.?

(I apologize in advance if this is the wrong place for suggestions, I'm not familiar with this use of git)

Thanks in advance,
Daeloran

EDIT: I just saw someone already suggest an AutoBuilder for defenses. Sorry :(

Ability to set preferred research

Hello,

It would be nice to be able to set a preferred research to do. Type and level. That would be researched before anything else (unless something is required).

Of course it would be best if setting that would be possible by telegram and if setting would be persisted.

Examples of useful researches to be executed quickly if player wants it:

  • hyperspace (cargo space)
  • hyperdrive lvl 15 (super speed for recyclers)
  • computer (more fleet slots)
  • astro (more planets / exp slots)

crash in telegram task

I have been getting rendom crashes in TBot and was trying to chase it.

Finally found it in telegram. Looks like a random connectivity problem causes it to throw an exception. Like this:

[Error] [Telegram] [13.10.2022 00:16:34] - Unexpected exception: Bad Gateway
[Warning] [Telegram] [13.10.2022 00:16:34] - Stacktrace:    at Telegram.Bot.TelegramBotClient.MakeRequestAsync[TResponse](IRequest`1 request, CancellationToken cancellationToken)
   at Telegram.Bot.TelegramBotClientExtensions.SendTextMessageAsync(ITelegramBotClient botClient, ChatId chatId, String text, Nullable`1 parseMode, IEnumerable`1 entities, Nullable`1 disableWebPagePreview, Nullable`1 disableNotification, Nullable`1 protectContent, Nullable`1 replyToMessageId, Nullable`1 allowSendingWithoutReply, IReplyMarkup replyMarkup, CancellationToken cancellationToken)
   at Tbot.Includes.TelegramMessenger.HandleErrorAsync(ITelegramBotClient botClient, Exception exception, CancellationToken cancellationToken) in C:\Users\Sławomir\source\repos\TBot2\TBot\Includes\TelegramMessenger.cs:line 907
   at Telegram.Bot.Polling.DefaultUpdateHandler.HandlePollingErrorAsync(ITelegramBotClient botClient, Exception exception, CancellationToken cancellationToken)
   at Telegram.Bot.Polling.DefaultUpdateReceiver.ReceiveAsync(IUpdateHandler updateHandler, CancellationToken cancellationToken)
   at Telegram.Bot.TelegramBotClientExtensions.ReceiveAsync(ITelegramBotClient botClient, IUpdateHandler updateHandler, ReceiverOptions receiverOptions, CancellationToken cancellationToken)
   at Telegram.Bot.TelegramBotClientExtensions.ReceiveAsync(ITelegramBotClient botClient, Func`4 updateHandler, Func`4 pollingErrorHandler, ReceiverOptions receiverOptions, CancellationToken cancellationToken)
   at Tbot.Includes.TelegramMessenger.TelegramBot() in ******\TBot\Includes\TelegramMessenger.cs:line 922

In original TBot code it used to be an unhandled exception. Guess it would be nice to catch it, log and restart telegram. I am not restarting telegram and I'm not sure how to do that correctly. So my code just catchs exceptions and logs them:

		public async void TelegramBot() {

			var cts = new CancellationTokenSource();
			var cancellationToken = cts.Token;

			var receiverOptions = new ReceiverOptions {
				AllowedUpdates = Array.Empty<UpdateType>(),
				ThrowPendingUpdates = true
			};

			try {
				await Client.ReceiveAsync(HandleUpdateAsync, HandleErrorAsync, receiverOptions, cts.Token);
			} catch (Exception e) {
				Helpers.WriteLog(LogType.Error, LogSender.Telegram, $"Unexpected exception: {e.Message}");
				Helpers.WriteLog(LogType.Warning, LogSender.Telegram, $"Stacktrace: {e.StackTrace}");
			}
		}

captcha

[Instance] Unable to login ("An error has occurred: Status Code: InternalServerError Status: error - Message: 403 Forbidden : {"error":{"message":"Forbidden"}}"). Checking captcha...

Do not check OOTD on the same day again

I was wondering if this could be improved:

[Info] [Brain] [10/08/2021 01:49:28] - Buying offer of the day...
[Info] [Brain] [10/08/2021 01:49:59] - Offer of the day succesfully bought.
[Info] [Brain] [10/08/2021 01:50:00] - Next BuyOfferOfTheDay check at 10/08/2021 05:54:22

Why would it check again on the same day?

[IDEA] Incomming messages to telegram

An option to see incoming messages from players or the alliance in telegram would be great.
This could better prevent you from being online but not answering.

Expeditions: Ability to limit to 1 expedition per origin

Later in the game you usually have more planets than expedition slots. If you allow sending expeditions without waiting for all expeditions to return, than bot randomly choses from which origins to try to send expeditions.

You can try to limit minimum amount of transporters to send, but if 1 or 2 expeditions bring you a lot of your primary ships, than it can happen that you have double the required amount available on the planet (or moon). So bot sometimes starts second expedition from such a planet without waiting for previous one to arrive (if he has enough ships available).

It can easily lead to causing an expedition slot to be overhelmed and decrease success chances.

Would be nice to set a flag somewhere that would make bot check if any expedition is still being executed from given origin and skip the origin if it is.

Problem with manual captcha solving

I usually get error - +02:00 12 WRN Tbot] [Test] Unable to login ("403 Forbidden : {"error":{"message":"Forbidden"}}"). Checking captcha... [22:28:13.237 +02:00 12 INF Tbot] [Test] Trying to solve captcha... [22:28:13.491 +02:00 4 INF OGameD] [email] "ERRO [handlers.go:1398] failed to solve captcha (404 Not Found)"

Seems like ogame ninja is also down

Wrong crystal transport when automine on other planet

it seems that wrongly reiterate satellites calculation and when optimal buildiing is sats it produces sats in any ways more and more.

[20:39:28|Info|Brain] Best building for xxxxxxxx [P:x:xxx:xx]: SolarSatellite [20:39:28|Info|Brain] Not enough resources to build: 4x SolarSatellite on xxxxxxx[P:x:xxx:10xxNeeded: M: 0 C: 8.000 D: 2.000 - Available: M: 144.532 C: 3.606 D: 26.305 [20:39:29|Info|Brain] Sending resources for SolarSatellite level 4 too [20:39:29|Info|Brain] Sending resources for SolarSatellite level 4 too [20:39:29|Info|Brain] Sending resources for SolarSatellite level 4 too [20:39:29|Info|Brain] Sending resources for SolarSatellite level 4 too [20:39:29|Info|Brain] Sending resources for SolarSatellite level 4 too [20:39:29|Info|Brain] Sending resources for SolarSatellite level 4 too [20:39:29|Info|Brain] Sending resources for SolarSatellite level 4 too [20:39:29|Info|Brain] Sending resources for SolarSatellite level 4 too [20:39:29|Info|Brain] Sending resources for SolarSatellite level 4 too [20:39:29|Info|Brain] Sending resources for SolarSatellite level 4 too [20:39:29|Info|Brain] Sending resources for SolarSatellite level 4 too [20:39:29|Info|Brain] Sending resources for SolarSatellite level 4 too [20:39:29|Info|Brain] Sending resources for SolarSatellite level 4 too [20:39:29|Info|Brain] Sending resources for SolarSatellite level 4 too [20:39:29|Info|Brain] Sending resources for SolarSatellite level 4 too [20:39:29|Info|Brain] Sending resources for SolarSatellite level 4 too [20:39:29|Info|Brain] Sending resources for SolarSatellite level 4 too [20:39:29|Info|Brain] Sending resources for SolarSatellite level 4 too [20:39:29|Info|Brain] Sending resources for SolarSatellite level 4 too [20:39:29|Info|Brain] Sending resources for SolarSatellite level 4 too [20:39:29|Info|Brain] Sending resources for SolarSatellite level 4 too [20:39:29|Info|Brain] Sending resources for SolarSatellite level 4 too [20:39:29|Info|Brain] Sending resources for SolarSatellite level 4 too [20:39:29|Info|Brain] Sending resources for SolarSatellite level 4 too [20:39:29|Info|Brain] Sending resources for SolarSatellite level 4 too [20:39:29|Info|Brain] Sending resources for SolarSatellite level 4 too [20:39:29|Info|Brain] Sending resources for SolarSatellite level 4 too [20:39:29|Info|Brain] Sending resources for SolarSatellite level 4 too [20:39:29|Info|Brain] Sending resources for SolarSatellite level 4 too [20:39:29|Info|Brain] Sending resources for SolarSatellite level 4 too [20:39:29|Info|Brain] Sending resources for SolarSatellite level 4 too [20:39:29|Info|Brain] Sending resources for SolarSatellite level 4 too [20:39:29|Info|Brain] Sending resources for SolarSatellite level 4 too [20:39:29|Info|Brain] Sending resources for SolarSatellite level 4 too [20:39:29|Info|Brain] Sending resources for SolarSatellite level 4 too [20:39:29|Info|Brain] Sending resources for SolarSatellite level 4 too [20:39:29|Info|Brain] Sending resources for SolarSatellite level 4 too [20:39:29|Info|Brain] Sending resources for SolarSatellite level 4 too [20:39:29|Info|Brain] Sending resources for SolarSatellite level 4 too [20:39:29|Info|Brain] Sending resources for SolarSatellite level 4 too [20:39:29|Info|Brain] Sending resources for SolarSatellite level 4 too [20:39:29|Info|Brain] Sending resources for SolarSatellite level 4 too [20:39:29|Info|Brain] Sending resources for SolarSatellite level 4 too [20:39:29|Info|Brain] Sending resources for SolarSatellite level 4 too [20:39:29|Info|Brain] Sending resources for SolarSatellite level 4 too [20:39:29|Info|Brain] Sending resources for SolarSatellite level 4 too [20:39:29|Info|Brain] Sending resources for SolarSatellite level 4 too [20:39:29|Info|Brain] Sending resources for SolarSatellite level 4 too [20:39:29|Info|Brain] Sending resources for SolarSatellite level 4 too [20:39:29|Info|Brain] Sending resources for SolarSatellite level 4 too [20:39:29|Info|Brain] Sending resources for SolarSatellite level 4 too [20:39:29|Info|Brain] Sending resources for SolarSatellite level 4 too [20:39:29|Info|Brain] Sending resources for SolarSatellite level 4 too [20:39:29|Info|Brain] Sending resources for SolarSatellite level 4 too [20:39:29|Info|Brain] Sending resources for SolarSatellite level 4 too [20:39:29|Info|Brain] Sending resources for SolarSatellite level 4 too [20:39:29|Info|Brain] Sending resources for SolarSatellite level 4 too [20:39:29|Info|Brain] Sending resources for SolarSatellite level 4 too [20:39:29|Info|Brain] Sending resources for SolarSatellite level 4 too [20:39:29|Info|Brain] Sending resources for SolarSatellite level 4 too [20:39:29|Info|Brain] Sending resources for SolarSatellite level 4 too [20:39:29|Info|Brain] Sending resources for SolarSatellite level 4 too [20:39:29|Info|Brain] Sending resources for SolarSatellite level 4 too [20:39:29|Info|Brain] Sending resources for SolarSatellite level 4 too [20:39:29|Info|Brain] Sending resources for SolarSatellite level 4 too [20:39:29|Info|Brain] Sending resources for SolarSatellite level 4 too [20:39:29|Info|Brain] Sending resources for SolarSatellite level 4 too [20:39:29|Info|Brain] Sending resources for SolarSatellite level 4 too [20:39:29|Info|Brain] Sending resources for SolarSatellite level 4 too [20:39:29|Info|Brain] Sending resources for SolarSatellite level 4 too [20:39:29|Info|Brain] Sending resources for SolarSatellite level 4 too [20:39:29|Info|Brain] Sending resources for SolarSatellite level 4 too [20:39:29|Info|Brain] Sending resources for SolarSatellite level 4 too [20:39:29|Info|Brain] Sending resources for SolarSatellite level 4 too [20:39:29|Info|Brain] Sending resources for SolarSatellite level 4 too [20:39:29|Info|Brain] Sending resources for SolarSatellite level 4 too [20:39:29|Info|Brain] Sending resources for SolarSatellite level 4 too [20:39:29|Info|Brain] Sending resources for SolarSatellite level 4 too [20:39:29|Info|Brain] Sending resources for SolarSatellite level 4 too [20:39:29|Info|Brain] Sending resources for SolarSatellite level 4 too [20:39:29|Info|Brain] Sending resources for SolarSatellite level 4 too [20:39:29|Info|Brain] Sending resources for SolarSatellite level 4 too [20:39:29|Info|Brain] Sending resources for SolarSatellite level 4 too [20:39:29|Info|Brain] Sending resources for SolarSatellite level 4 too [20:39:29|Info|Brain] Sending resources for SolarSatellite level 4 too [20:39:29|Info|Brain] Sending resources for SolarSatellite level 4 too [20:39:29|Info|Brain] Sending resources for SolarSatellite level 4 too [20:39:29|Info|Brain] Sending resources for SolarSatellite level 4 too [20:39:29|Info|Brain] Sending resources for SolarSatellite level 4 too [20:39:29|Info|Brain] Sending resources for SolarSatellite level 4 too [20:39:29|Info|Brain] Sending resources for SolarSatellite level 4 too [20:39:29|Info|Brain] Sending resources for SolarSatellite level 4 too [20:39:29|Info|Brain] Sending resources for SolarSatellite level 4 too [20:39:29|Info|Brain] Sending resources for SolarSatellite level 4 too [20:39:29|Info|Brain] Sending resources for SolarSatellite level 4 too [20:39:29|Info|Brain] Sending resources for SolarSatellite level 4 too [20:39:29|Info|Brain] Sending resources for SolarSatellite level 4 too [20:39:29|Info|Brain] Sending resources for SolarSatellite level 4 too [20:39:29|Info|Brain] Sending resources for SolarSatellite level 4 too [20:39:29|Info|Brain] Sending resources for SolarSatellite level 4 too [20:39:29|Info|Brain] Sending resources for SolarSatellite level 4 too [20:39:29|Info|Brain] Sending resources for SolarSatellite level 4 too [20:39:29|Info|Brain] Sending resources for SolarSatellite level 4 too [20:39:29|Info|Brain] Sending resources for SolarSatellite level 4 too [20:39:29|Info|Brain] Sending resources for SolarSatellite level 4 too [20:39:29|Info|Brain] Sending resources for SolarSatellite level 4 too [20:39:29|Info|Brain] Sending resources for SolarSatellite level 4 too [20:39:29|Info|Brain] Sending resources for SolarSatellite level 4 too [20:39:29|Info|Brain] Sending resources for SolarSatellite level 4 too [20:39:29|Info|Brain] Sending resources for SolarSatellite level 4 too [20:39:29|Info|Brain] Sending resources for SolarSatellite level 4 too [20:39:29|Info|Brain] Sending resources for SolarSatellite level 4 too [20:39:29|Info|Brain] Sending resources for SolarSatellite level 4 too [20:39:29|Info|Brain] Sending resources for SolarSatellite level 4 too [20:39:29|Info|Brain] Sending resources for SolarSatellite level 4 too [20:39:29|Info|Brain] Sending resources for SolarSatellite level 4 too [20:39:29|Info|Brain] Sending resources for SolarSatellite level 4 too [20:39:29|Info|Brain] Sending resources for SolarSatellite level 4 too [20:39:29|Info|Brain] Sending resources for SolarSatellite level 4 too [20:39:29|Info|Brain] Sending resources for SolarSatellite level 4 too [20:39:29|Info|Brain] Sending resources for SolarSatellite level 4 too [20:39:29|Info|Brain] Sending resources for SolarSatellite level 4 too [20:39:29|Info|Brain] Sending resources for SolarSatellite level 4 too [20:39:29|Info|Brain] Sending resources for SolarSatellite level 4 too [20:39:29|Info|Brain] Sending resources for SolarSatellite level 4 too [20:39:29|Info|Brain] Sending resources for SolarSatellite level 4 too [20:39:29|Info|Brain] Sending resources for SolarSatellite level 4 too [20:39:29|Info|Brain] Sending resources for SolarSatellite level 4 too [20:39:29|Info|Brain] Sending resources for SolarSatellite level 4 too [20:39:29|Info|Brain] Sending resources for SolarSatellite level 4 too [20:39:29|Info|Brain] Sending resources for SolarSatellite level 4 too **> [20:39:29|Info|Brain] Sending LargeCargo: 37; with M: 0 C: 1.053.000 D: 262.000 from xxxxx [xx:xx:xx:xx] to xxxxxxx[P:xx:xx:xx]** [20:39:29|Info|FleetScheduler] Sending fleet from [M:x:xxxx:xx] to [P:x:xx]. Mission: Transport. Speed: 100% Ships: LargeCargo: 37; [20:39:29|Debug|FleetScheduler] Calculated flight time (one-way): 00:34:40 [20:39:29|Debug|FleetScheduler] Calculated flight time (full trip): 01:09:20 [20:39:29|Debug|FleetScheduler] Calculated flight fuel: 4230 [20:39:30|Info|FleetScheduler] Fleet succesfully sent

Expedition : wrong calculation of fleet

Research :

  • Computer : 4
  • Astrophysics : 1

Available fleet :

  • Small Cargo : 31
  • Some light fighters and probes

Settings :

:
"Expeditions": {
"Active": true,
"PrimaryShip": "SmallCargo",
"MinPrimaryToSend": 10,
"PrimaryToKeep": 10,
"SecondaryShip": "Null",
"MinSecondaryToSend": 0,
"SecondaryToPrimaryRatio": 2,
"ManualShips": {
"Active": false,
"Ships": {
"LargeCargo": 1300,
"LightFighter": 26000,
"Reaper": 1,
"Pathfinder": 1,
"EspionageProbe": 1
}
},
"WaitForAllExpeditions": true,
"WaitForMajorityOfExpeditions": false,
"SplitExpeditionsBetweenSystems": {
"Active": true,
"Range": 1
},
"RandomizeOrder": true,
"FuelToCarry": 200,
"Origin": [
{
"Galaxy": G,
"System": S,
"Position": P,
"Type": "Planet"
}
]
},

TBot output

:
[07:26:57|Debug|Expeditions] Expedition slot free: 4
[07:26:58|Warning|Expeditions] Available SmallCargo in origin xxx [P:xxx]: 21
[07:26:58|Info|Expeditions] 4 expeditions with LightFighter: 1; SmallCargo: 10; EspionageProbe: 1; will be sent from xxx [P:xxx]
[07:26:58|Info|FleetScheduler] Sending fleet from [P:xxx] to [DS:xxx]. Mission: Expedition. Speed: 100% Ships: LightFighter: 1; SmallCargo: 10; EspionageProbe: 1;
[07:26:58|Debug|FleetScheduler] Calculated flight time (one-way): 00:10:14
[07:26:58|Debug|FleetScheduler] Calculated flight time (full trip): 01:20:28
[07:26:58|Debug|FleetScheduler] Calculated flight fuel: 14
[07:27:00|Info|FleetScheduler] Fleet succesfully sent
[07:27:01|Info|FleetScheduler] Sending fleet from [P:xxx] to [DS:xxx]. Mission: Expedition. Speed: 100% Ships: LightFighter: 1; SmallCargo: 10; EspionageProbe: 1;
[07:27:01|Debug|FleetScheduler] Calculated flight time (one-way): 00:16:57
[07:27:01|Debug|FleetScheduler] Calculated flight time (full trip): 01:33:54
[07:27:01|Debug|FleetScheduler] Calculated flight fuel: 36
[07:27:02|Info|FleetScheduler] Fleet succesfully sent
[07:27:03|Info|FleetScheduler] Sending fleet from [P:xxx] to [DS:xxx]. Mission: Expedition. Speed: 100% Ships: LightFighter: 1; SmallCargo: 10; EspionageProbe: 1;
[07:27:03|Debug|FleetScheduler] Calculated flight time (one-way): 00:16:41
[07:27:03|Debug|FleetScheduler] Calculated flight time (full trip): 01:33:22
[07:27:03|Debug|FleetScheduler] Calculated flight fuel: 35
[07:27:05|Info|FleetScheduler] Fleet succesfully sent
[07:27:06|Info|FleetScheduler] Sending fleet from [P:xxx] to [DS:xxx]. Mission: Expedition. Speed: 100% Ships: LightFighter: 1; SmallCargo: 10; EspionageProbe: 1;
[07:27:06|Debug|FleetScheduler] Calculated flight time (one-way): 00:16:41
[07:27:06|Debug|FleetScheduler] Calculated flight time (full trip): 01:33:22
[07:27:06|Debug|FleetScheduler] Calculated flight fuel: 35
[07:27:08|Info|FleetScheduler] Fleet succesfully sent
[07:27:09|Info|Expeditions] Next check at 4/10/2022 09:03:14

Result :

TBot has sent 4 expedition, 3 with 10 Smal Cargos, 1 with only 1 Smal Cargo
No primary kept on the planet

It correctly calculate that i have only 21 Small Cargos to be sent (31 - 10 to be kept), but calculate all fleet without taking the previous one into consideration

It should have only sent 2 expeditions with 10 SC

It also generate error message :

:
[06:02:40|Debug|Expeditions] Expedition slot free: 3
[06:02:40|Warning|Expeditions] Available SmallCargo in origin xxx [P:xxx]: 8
[06:02:40|Info|Expeditions] 3 expeditions with SmallCargo: 10; will be sent from xxx [P:xxx]
[06:02:41|Info|FleetScheduler] Sending fleet from [P:xxx] to [DS:xxx]. Mission: Expedition. Speed: 100% Ships: SmallCargo: 10;
[06:02:41|Debug|FleetScheduler] Calculated flight time (one-way): 00:10:14
[06:02:41|Debug|FleetScheduler] Calculated flight time (full trip): 01:20:28
[06:02:41|Debug|FleetScheduler] Calculated flight fuel: 13
[06:02:42|Info|FleetScheduler] Fleet succesfully sent
[06:02:43|Info|FleetScheduler] Sending fleet from [P:xxx] to [DS:xxx]. Mission: Expedition. Speed: 100% Ships: SmallCargo: 10;
[06:02:43|Debug|FleetScheduler] Calculated flight time (one-way): 00:10:14
[06:02:43|Debug|FleetScheduler] Calculated flight time (full trip): 01:20:28
[06:02:43|Debug|FleetScheduler] Calculated flight fuel: 13
[06:02:44|Error|FleetScheduler] Unable to send fleet: an exception has occurred: An error has occurred: Status: error - Message: no ships to send
[06:02:44|Warning|FleetScheduler] Stacktrace: at Tbot.Services.OgamedService.SendFleet(Celestial origin, Ships ships, Coordinate destination, Missions mission, Decimal speed, Resources payload)
at Tbot.Program.SendFleet(Celestial origin, Ships ships, Coordinate destination, Missions mission, Decimal speed, Resources payload, CharacterClass playerClass, Boolean force)

Here it has sent a fleet with 10 SC and a second with 8, then failed on the 3rd one

Fleet should be calculated one by one and vessels already sent should be substracted from the total available

AutoFarm issue

I have this error pop up repeatedly when trying to use autofarm feature, I am rather new to this and not sure if I am missing something very obvious.

[20:35:17|Error|AutoFarm] AutoFarmProcessReports Exception: An error has occurred: Status: error - Message: deactivate 'Hide pictures in reports'
[20:35:17|Warning|AutoFarm] Stacktrace: at Tbot.Services.OgamedService.GetEspionageReport(Int32 msgId)
at Tbot.Program.AutoFarmProcessReports()

I tried playing around with in-game settings but the "hide pictures in reports" option isn't even deactivated.
Would appreciate help.

[Docker] TBot crashes when running with -d option

Hello,

I'm trying to package this into a reusable docker image that I can run in the background, but the software keeps crashing when using the docker option "-d"

It works fine interactively with"-it" though.

image

Thanks

Problem with Telegram

[23:46:19|Info|Tbot] Activating Telegram Messenger
[23:46:19|Info|Tbot] Sending Telegram message...
[23:46:19|Info|Tbot] Initializing data...
[23:46:19|Error|Tbot] Could not send Telegram message: an exception has occurred: Bad Request: chat not found

as indicated in the guide I generated the bot with https://t.me/botfather and recovered the user id with https://t.me/getmyid_bot but I receive the indicated error

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.