public static OGameFleetSender Espionage(OGameHttpClient client, Planet source, Planet destination) { return(new OGameFleetSender(client, source, destination, FleetSpeed.Speed100, new List <ShipBase> { new EspionageProbe(source, 1, true, true) }, MissionType.Espionage)); }
public static OGameFleetSender Stationize(OGameHttpClient client, Planet source, Planet destination, FleetSpeed speed, List <ShipBase> ships, Metal metal, Crystal crystal, Deuterium deuterium) { return(new OGameFleetSender(client, source, destination, speed, ships, MissionType.Stationize, metal, crystal, deuterium)); }
private OGameFleetSender(OGameHttpClient client, Planet source, Planet destination, FleetSpeed speed, List <ShipBase> ships, MissionType missionType, Metal metal = null, Crystal crystal = null, Deuterium deuterium = null) { _client = client; _source = source; _destination = destination; _metal = metal; _crystal = crystal; _deuterium = deuterium; _speed = speed; _ships = ships; _missionType = missionType; }
public static async Task <MissionBase> SaveFleet(OGameHttpClient client, int savePlanetId) { var planetToSave = ObjectContainer.Instance.PlayerPlanets.First(p => p.Id == savePlanetId); var saveLocation = ObjectContainer.Instance.PlayerPlanets.FirstOrDefault(p => p.Id != savePlanetId); if (saveLocation == null) { return(null); } await client.RefreshPlanet(planetToSave); var planetShips = planetToSave.Ships; var shipsCapacity = planetShips.Sum(x => x.Capacity * x.Quantity) * 0.95; Metal metalToSave; Crystal crystalToSave; Deuterium deuteriumToSave; planetToSave.Deuterium.Amount = (int)(planetToSave.Deuterium.Amount * 0.95); if (shipsCapacity > planetToSave.TotalResources) { metalToSave = planetToSave.Metal; crystalToSave = planetToSave.Crystal; deuteriumToSave = planetToSave.Deuterium; } else { metalToSave = new Metal((int)shipsCapacity * 1 / 6); crystalToSave = new Crystal((int)shipsCapacity * 2 / 6); deuteriumToSave = new Deuterium((int)shipsCapacity * 3 / 6); if (metalToSave.Amount > planetToSave.Metal.Amount) { metalToSave = planetToSave.Metal; } if (crystalToSave.Amount > planetToSave.Crystal.Amount) { crystalToSave = planetToSave.Crystal; } if (deuteriumToSave.Amount > planetToSave.Deuterium.Amount) { deuteriumToSave = planetToSave.Deuterium; } } return(await Stationize(client, planetToSave, saveLocation, FleetSpeed.Speed10, planetShips, metalToSave, crystalToSave, deuteriumToSave).SendFleet()); }
public MainWindowViewModel(OGameHttpClient client) : base(client) { ResourcesViewModel = new ResourcesViewModel(client); TopBarViewModel = new TopBarViewModel(ResourcesViewModel); GalaxyViewModel = new GalaxyViewModel(client); Observable.Interval(TimeSpan.FromMinutes(5)) .SubscribeOnDispatcher() .DelayTask(() => TimeSpan.FromMinutes(Random.Next(10, 20))) .Select(i => SafeHttpTask(() => RefreshObjectContainerTask(false))) .Subscribe(); Observable.Interval(TimeSpan.FromMinutes(1)) .SubscribeOnDispatcher() .Where(i => WorkerQueueActionRunner.ExecutionQueue.Any()) .Subscribe(token => { WorkerQueueActionRunner.CheckQueue(); }); Init(); }
protected OGameWorkerBaseViewModel(OGameHttpClient client) { Client = client; }
public static OGameFleetSender Attack(OGameHttpClient client, Planet source, Planet destination, FleetSpeed speed, List <ShipBase> ships) { return(new OGameFleetSender(client, source, destination, speed, ships, MissionType.Attack)); }
public OGameWorkerRequestBuilder(OGameHttpClient client) { _client = client; }
public FleetViewModel(OGameHttpClient client) { _client = client; }
public MainWindow(OGameHttpClient client) { ViewModel = new MainWindowViewModel(client); InitializeComponent(); DataContext = ViewModel; }