Skip to content

Commit

Permalink
revert some changes
Browse files Browse the repository at this point in the history
fix autominer
  • Loading branch information
kokiddp committed Apr 2, 2021
1 parent 5bef897 commit 5cfaf23
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 14 deletions.
24 changes: 14 additions & 10 deletions TBot/Model/Enums.cs
Original file line number Diff line number Diff line change
Expand Up @@ -108,25 +108,29 @@ public enum Missions

public enum Speeds
{
FivePercent = 5,
TenPercent = 1,
TwentyPercent = 2,
ThirtyPercent = 3,
FourtyPercent = 4,
FiftyPercent = 5,
SixtyPercent = 6,
SeventyPercent = 7,
EightyPercent = 8,
NinetyPercent = 9,
HundredPercent = 10
}

public enum Percents
{
TenPercent = 10,
FifteenPercent = 15,
TwentyPercent = 20,
TwentyfivePercent = 25,
ThirtyPercent = 30,
ThirtyfivePercent = 35,
FourtyPercent = 40,
FourtyfivePercent = 45,
FiftyPercent = 50,
FiftyfivePercent = 55,
SixtyPercent = 60,
SixtyfivePercent = 65,
SeventyPercent = 70,
SeventyfivePercent = 75,
EightyPercent = 80,
EightyfivePercent = 85,
NinetyPercent = 90,
NinetyfivePercent = 95,
HundredPercent = 100
}

Expand Down
8 changes: 8 additions & 0 deletions TBot/Model/Types.cs
Original file line number Diff line number Diff line change
Expand Up @@ -229,6 +229,14 @@ public class UserInfo

public class Resources
{
public Resources(long metal = 0, long crystal = 0, long deuterium = 0, long energy = 0, long darkmatter = 0)
{
Metal = metal;
Crystal = crystal;
Deuterium = deuterium;
Energy = energy;
Darkmatter = darkmatter;
}
public long Metal { get; set; }
public long Crystal { get; set; }
public long Deuterium { get; set; }
Expand Down
3 changes: 3 additions & 0 deletions TBot/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -471,6 +471,7 @@ private static void AutoMine(object state)
xaSem[(int)Feature.BrainAutoMine].WaitOne();
Helpers.WriteLog(LogType.Info, LogSender.Brain, "Checking mines and resources..");
celestials = UpdatePlanets(UpdateType.Techs);
celestials = UpdatePlanets(UpdateType.Resources);
celestials = UpdatePlanets(UpdateType.Constructions);

Buildables xBuildable = Buildables.Null;
Expand Down Expand Up @@ -877,6 +878,7 @@ private static int SendFleet(Celestial origin, Ships ships, Coordinate destinati
{
Helpers.WriteLog(LogType.Info, LogSender.Tbot, "Sending fleet from " + origin.Coordinate.ToString() + " to " + destination.ToString() + ". Mission: " + mission.ToString() + ". Speed: " + speed.ToString() + ". Ships: " + ships.ToString());

/*
if (
playerClass != Classes.General && (
speed == Speeds.FivePercent ||
Expand All @@ -895,6 +897,7 @@ private static int SendFleet(Celestial origin, Ships ships, Coordinate destinati
Helpers.WriteLog(LogType.Warning, LogSender.Tbot, "Unable to send fleet, speed not available for your class");
return 0;
}
*/

slots = UpdateSlots();
if (slots.Free > 1 || force)
Expand Down
6 changes: 3 additions & 3 deletions TBot/Services/OgamedService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ internal void CreateOgamedExecutable()
tempExeName = Path.Combine(Directory.GetCurrentDirectory(), "ogamed.exe");
else
tempExeName = Path.Combine(Directory.GetCurrentDirectory(), "ogamed");
using FileStream fsDst = new FileStream(tempExeName, FileMode.OpenOrCreate, FileAccess.Write);
using FileStream fsDst = new(tempExeName, FileMode.OpenOrCreate, FileAccess.Write);
byte[] bytes = GetOgamedExecutable();
fsDst.Write(bytes, 0, bytes.Length);
}
Expand Down Expand Up @@ -448,7 +448,7 @@ public List<Celestial> GetCelestials()
{
var planets = this.GetPlanets();
var moons = this.GetMoons();
List<Celestial> celestials = new List<Celestial>();
List<Celestial> celestials = new();
celestials.AddRange(planets);
celestials.AddRange(moons);
return celestials;
Expand Down Expand Up @@ -831,7 +831,7 @@ public GalaxyInfo GetGalaxyInfo(Coordinate coordinate)

public GalaxyInfo GetGalaxyInfo(int galaxy, int system)
{
Coordinate coordinate = new Coordinate { Galaxy = galaxy, System = system };
Coordinate coordinate = new() { Galaxy = galaxy, System = system };
return this.GetGalaxyInfo(coordinate);
}

Expand Down
2 changes: 1 addition & 1 deletion TBot/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"Language": ""
},
"General": {
"UserAgent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/89.0.4389.90 Safari/537.36",
"UserAgent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/89.0.4389.114 Safari/537.36",
"Host": "localhost",
"Port": "8080",
"CaptchaAPIKey": ""
Expand Down

0 comments on commit 5cfaf23

Please sign in to comment.