public static void SendShipsDestination(ShipDestType type) { var bestships = new Queue <Ship>(Core.GlobalData.Ships.Where(n => n.TargetId == 0 && n.Activated != 0 && n.Sent == 0) .OrderByDescending(SendingHelper.GetCapacity)); Thread.Sleep(2000); switch (type) { case ShipDestType.Upgradable: foreach (var ship in bestships) { Destinations.SendToUpgradable(ship, Core.Config.autoshiptype); } break; case ShipDestType.Outpost: foreach (var ship in bestships) { Destinations.SendToOutpost(ship); } break; case ShipDestType.Marketplace: foreach (var ship in bestships) { Destinations.SendToMarketplace(ship); } break; case ShipDestType.Contractor: foreach (var ship in bestships) { Destinations.SendToContractor(ship); } break; case ShipDestType.Auto: SendShips.SendShipsAutoDestination(); break; case ShipDestType.Wreck: foreach (var ship in bestships) { Destinations.SendToWreck(ship); } break; } }
public static double GetPercentage(ShipDestType dest) { int count = 0; switch (dest) { case ShipDestType.Upgradable: count = Core.GlobalData.Ships.Where(n => n.Sent != 0 && n.Activated != 0).Count(n => n.Type == "upgradeable"); break; case ShipDestType.Outpost: count = Core.GlobalData.Ships.Where(n => n.Sent != 0 && n.Activated != 0).Count(n => n.Type == "outpost"); break; case ShipDestType.Marketplace: count = Core.GlobalData.Ships.Where(n => n.Sent != 0 && n.Activated != 0).Count(n => n.Type == "marketplace"); break; case ShipDestType.Contractor: count = Core.GlobalData.Ships.Where(n => n.Sent != 0 && n.Activated != 0).Count(n => n.Type == "contractor"); break; case ShipDestType.Wreck: count = Core.GlobalData.Ships.Where(n => n.Sent != 0 && n.Activated != 0).Count(n => n.Type == "wreck"); break; } if (count == 0) { return(0); } var perc = 100D / (Core.GlobalData.Ships.Count(n => n.Sent != 0 && n.Activated != 0) / (double)count); return(perc); }