/// <summary> /// populates a dictionary with current entities /// </summary> void PopulateEntityDictionary() { var activeTargets = TargetManager["targetsByID"].GetDictionary<long>().Keys; var beingTargeted = TargetManager["targeting"].GetDictionary<long>(); // Dictionary is <long, datetime> where datetime states when targeting started var targetedBy = TargetManager["targetedBy"].GetList<long>(); var jammers = Frame.Client.Tactical["jammers"].GetDictionary<long>(); _entityDictionary = new Dictionary<long, EveEntity>(); var ballpark = GetService("michelle").CallMethod("GetBallpark", new object[] { }); var balls = ballpark["balls"]; if (!balls.IsValid) { return; } var ballKeyList = balls.CallMethod("keys", new object[0]).GetList<long>(); foreach (var num in ballKeyList) { if (num > 0L) { EveObject parent = ballpark.CallMethod("GetInvItem", new object[] { num }); if (!parent.IsValid) break; EveItem item = new EveItem(parent); EveObject ball = ballpark.CallMethod("GetBall", new object[] { num }); EveEntity ent = new EveEntity(ball, item, num); _entityDictionary.Add(num, ent); ent.IsTarget = activeTargets.Contains(num); ent.IsBeingTargeted = beingTargeted.Keys.Contains<long>(num); ent.IsTargetingMe = targetedBy.Contains(num); ent.IsActiveTarget = num == GetActiveTargetId; ent.IsAbandoned = ballpark.CallMethod("IsAbandoned", new object[] { num }).GetValueAs<bool>(); ent.HaveLootRights = ballpark.CallMethod("HaveLootRight", new object[] { num }).GetValueAs<bool>(); ent.IsWreckEmpty = StateService.CallMethod("CheckWreckEmpty", new object[] { item }).GetValueAs<bool>(); ent.IsWreckAlreadyViewed = StateService.CallMethod("CheckWreckViewed", new object[] { item }).GetValueAs<bool>(); if (jammers.ContainsKey(num)) { foreach (var effect in jammers[num].GetDictionary<string>()) { switch (effect.Key) { case "webify": ent.IsWebbingMe = true; break; case "ewTargetPaint": ent.IsTargetPaintingMe = true; break; case "warpScrambler": ent.IsWarpScramblingMe = true; break; case "ewEnergyNeut": ent.IsEnergyNeutingMe = true; break; case "ewEnergyVampire": ent.IsEnergyNOSingMe = true; break; case "electronic": ent.IsJammingMe = true; break; case "ewRemoteSensorDamp": ent.IsSensorDampeningMe = true; break; case "ewTrackingDisrupt": ent.IsTrackingDisruptingMe = true; break; default: break; } } } } } }
public override void DoWork() { if (IsWorkDone || _localPulse > DateTime.Now || Frame.Client.Session.NextSessionChange > DateTime.Now) { return; } switch (_States.DroneState) { case DroneState.Initialise: double money = Frame.Client.wealth(); if (money < 500000) { Frame.Log("Dronenstate == Nicht genug geld // " + money); _States.DroneState = DroneState.donebuy; break; } List<EveSkill> neueskill = Frame.Client.GetMySkills(); List<EveQskill> neueQskill = Frame.Client.GetMyQueue(); EveSkill droneskill = neueskill.Where(x => x.typeID == skilldronen).Where(x => x.Skilllvl > 0).FirstOrDefault(); if (droneskill == null) { Frame.Log("Dronenskill == null"); _States.DroneState = DroneState.donebuy; break; } EveSkill droneskillop = neueskill.Where(x => x.typeID == skilldronenop).Where(x => x.Skilllvl > 0).FirstOrDefault(); if (droneskillop == null) { Frame.Log("Dronenskillop == null"); _States.DroneState = DroneState.donebuy; break; } if (droneskillop == null && droneskill != null) { Frame.Log("Dronenskillop == null aber schon einen mining skill"); _States.DroneState = DroneState.donebuy; break; } if (droneskill != null && droneskillop != null) { Frame.Log("Droneskill ist Aktiv"); int dronenlevel = droneskill.Skilllvl; Frame.Log("Droneskilllevel =" + dronenlevel); dronenmoeglich = dronenlevel; } if (Frame.Client.getdronbay() == false) { Frame.Client.ExecuteCommand(EveModel.EveCommand.OpenDroneBayOfActiveShip); break; } string shipname = Frame.Client.GetActiveShip.TypeName; if (shipname == "Venture") { skilldronenmoeglich = 2; } if (shipname == "Startschiff") { skilldronenmoeglich = 0; } if (Frame.Client.Session.InSpace == true) { _localPulse = DateTime.Now.AddMilliseconds(GetRandom(8000, 9000)); break; } if (Frame.Client.Session.InStation == true) { if (Frame.Client.getdronbay() == false) { Frame.Client.ExecuteCommand(EveModel.EveCommand.OpenDroneBayOfActiveShip); break; } if (Frame.Client.GetPrimaryInventoryWindow.DroneBay.Items.Count < skilldronenmoeglich) { Frame.Log("DroneninBay = null"); _States.DroneState = DroneState.vorhandenkaufen; Frame.Log("starte vorhandenkaufen im dronestate"); break; } _localPulse = DateTime.Now.AddMilliseconds(GetRandom(3000, 3500)); } if (Frame.Client.GetPrimaryInventoryWindow.DroneBay.Items.Count == skilldronenmoeglich) { Frame.Log("Change Dronestate to Idle.."); _States.DroneState = DroneState.donebuy; break; } Frame.Log("hier darf ich nie ankommen !!!"); break; case DroneState.Idle: if (aktiv == false) { _States.DroneState = DroneState.wait; break; } if (Frame.Client.Session.InStation == true) { _localPulse = DateTime.Now.AddMilliseconds(GetRandom(3000, 3500)); break; } _localPulse = DateTime.Now.AddMilliseconds(GetRandom(3000, 3500)); Frame.Log("Drones ...Ídle"); if (astro != null) { _States.DroneState = DroneState.Startdrones; astrodronen = DroneController.astro; break; } if (Frame.Client.getinvopen() == false) { Frame.Client.Getandopenwindow("leer"); break; } if (Frame.Client.getdronbay() == false) { Frame.Client.ExecuteCommand(EveModel.EveCommand.OpenDroneBayOfActiveShip); break; } List<EveEntity> dronis = Frame.Client.GetActiveShip.ActiveDrones; int droni = dronis.Count; Frame.Log("Drones count = " + droni); int dronesbay = Frame.Client.GetPrimaryInventoryWindow.DroneBay.Items.Count; Frame.Log("Drones count in bay = " + dronesbay); break; case DroneState.Startdrones: _localPulse = DateTime.Now.AddMilliseconds(GetRandom(3000, 3500)); if (Frame.Client.getdronbay() == false) { Frame.Client.ExecuteCommand(EveModel.EveCommand.OpenDroneBayOfActiveShip); break; } List<EveEntity> test3 = Frame.Client.Entities; // Und sortier sie nach namen distanz etc EveEntity dista2 = test3.Where(i => (i.Id == astro.Id)).FirstOrDefault(); double dista = dista2.Distance; if (dista > 7000) { Frame.Log("Debug distanz " + dista); break; } dronesinbay = Frame.Client.GetActiveShip.DronesInBay; if (dronesinbay > 0) { Frame.Log("Drones Startet"); Frame.Client.GetActiveShip.ReleaseDrones(); break; } else if (Frame.Client.GetActiveShip.ActiveDrones.Count > 0) { Frame.Log("Drones start mining"); Frame.Client.DroneMineRepeatedly(); dronenaktiviern = true; // Dronen aktiv _States.DroneState = DroneState.dronesatwork; break; } break; case DroneState.dronesatwork: if (astrodronen == null || DroneController.astro == null) { dronenaktiviern = false; // Dronen aktiv _States.DroneState = DroneState.dronesback; break; } if (astrodronen.Id == DroneController.astro.Id) { _localPulse = DateTime.Now.AddMilliseconds(GetRandom(1000, 2000)); break; } dronenaktiviern = false; // Dronen aktiv _States.DroneState = DroneState.dronesback; break; case DroneState.dronesback: if (Frame.Client.GetActiveShip.ActiveDrones.Count > 0) { _localPulse = DateTime.Now.AddMilliseconds(GetRandom(1000, 2500)); Frame.Log("Hole dronen zurück"); Frame.Client.recallalldrones(); break; } Frame.Log("Setzte state auf Idle"); _States.DroneState = states.DroneState.Idle; break; case DroneState.wait: _localPulse = DateTime.Now.AddMilliseconds(GetRandom(1000, 2500)); if (SkillController.dronenmoeglich == null) { _localPulse = DateTime.Now.AddMilliseconds(GetRandom(1000, 2500)); break; } break; case DroneState.vorhandenkaufen: Frame.Log("Dronestate .Vorhandenkaufen"); _localPulse = DateTime.Now.AddMilliseconds(GetRandom(1000, 2500)); if (Frame.Client.getdronbay() == false) { Frame.Client.ExecuteCommand(EveModel.EveCommand.OpenDroneBayOfActiveShip); break; } int dronenhanga = Frame.Client.GetPrimaryInventoryWindow.DroneBay.Items.Count; Frame.Log("count drones in bay = " + dronenhanga); if (dronenhanga == skilldronenmoeglich) { Frame.Log("dronenhanga == skilldronenmoeglich "); _States.DroneState = DroneState.donebuy; break; } if (dronenhanga < SkillController.dronenmoeglich || dronenhanga < skilldronenmoeglich) { if (Frame.Client.getinvopen() == false) { Frame.Client.Getandopenwindow("leer"); break; } List<EveItem> itemlischt = Frame.Client.GetPrimaryInventoryWindow.ItemHangar.Items; EveItem itemsZZ = itemlischt.Where(x => x.TypeId == dronen1idd).FirstOrDefault(); if (itemsZZ == null) { Frame.Log("Keine Dronen in der menge vorrätig"); Frame.Log("Auf die Einkaufsliste setzen"); Tuple<int, int> tmp = new Tuple<int, int>(dronen1idd, 2); BuyController.buylist.Add(tmp); _States.BuyControllerState = BuyControllerStates.buy; _States.DroneState = DroneState.waitbuy; break; } if (itemsZZ != null) { Frame.Log("Dronen im Hanga vorrätig"); Frame.Client.GetPrimaryInventoryWindow.DroneBay.Add(itemsZZ, 1); Frame.Log("Dronen von Hanga in Dronenbay +1"); _States.DroneState = DroneState.Initialise; break; } } _States.DroneState = DroneState.donebuy; break; case DroneState.waitbuy: _localPulse = DateTime.Now.AddMilliseconds(GetRandom(1000, 2500)); if (_States.BuyControllerState == BuyControllerStates.done) { Frame.Log("Buycontroller == done, setze Dronestate auf Initialise"); _States.DroneState = DroneState.Initialise; break; } break; case DroneState.donebuy: _localPulse = DateTime.Now.AddMilliseconds(GetRandom(1000, 2500)); // _States.DroneState = states.DroneState.Initialise; break; case DroneState.sleeper: _localPulse = DateTime.Now.AddMilliseconds(GetRandom(1000, 2500)); break; } }
private static int CompareAsteroidBelts(EveEntity e1, EveEntity e2) { int e1num = 0, e2num = 0; string planetE1 = e1.Name.Split(' ')[1], planetE2 = e2.Name.Split(' ')[1]; string[] romans = { "N", "I", "II", "III", "IV", "V", "VI", "VII", "VIII", "IX", "X", "XI", "XII", "XIII", "XIV", "XV", "XVI", "XVII", "XVIII", "XIX", "XX" }; for (int i = 0; i < romans.Length; i++) { if (romans[i] == planetE1) { e1num = i; } if (romans[i] == planetE2) { e2num = i; } if (e1num > 0 && e2num > 0) { break; } } int i1 = int.Parse(e1.Name.Substring(e1.Name.LastIndexOf(' ') + 1)); int i2 = int.Parse(e2.Name.Substring(e2.Name.LastIndexOf(' ') + 1)); if (e1num > e2num) { return 1; } else if (e1num < e2num) { return -1; } else { if (i1 > i2) { return 1; } else if (i1 < i2) { return -1; } else { return 0; } } }
/// Bot Code start //// /// //// public override void DoWork() { if (IsWorkDone || _localPulse > DateTime.Now || Frame.Client.Session.NextSessionChange > DateTime.Now) { return; } switch (_States.MiningState) { ///////////////////////////////////////////////////////////////////////////////////////// case MiningState.Initialise: // Frame.Client.ExecuteCommand(EveModel.EveCommand.OpenDroneBayOfActiveShip); List<EveWindow> mywindow; mywindow = Frame.Client.GetWindows; foreach (EveWindow tmp in mywindow) { Frame.Log("window name = " + tmp.Name); } if (Frame.Client.getinvopen() == false) { Frame.Client.Getandopenwindow("leer"); break; } if (Frame.Client.getoreopen() == false) { Frame.Client.Getandopenwindow("Orehold"); break; } EveInventoryContainer cargoho = Frame.Client.GetPrimaryInventoryWindow.OreHoldOfActiveShip; // Container wird erstellt "cargoho" und wird mit aktivem Cargohold verknüpft usdcapcargo = cargoho.UsedCapacity; //bugged manchmal nullcheck fehlt // Variablen werden gesetzt Verbrauchtes Cargo <-- fullcapcargo = cargoho.Capacity; // Variablen werden gesetzen Cargo insgesammt <--- Frame.Log(usdcapcargo); Frame.Log(fullcapcargo); if (Frame.Client.Session.InSpace) // Wenn wir im WEltraum sind gehe zur mining State { _States.MiningState = MiningState.letzgo; Frame.Log("State zu letzgo"); break; } if (Frame.Client.Session.InStation) // Wenn wir im WEltraum sind gehe zur mining State { if (usdcapcargo != 0) // Wenn das cargo voll gehe heim { _States.MiningState = MiningState.unload; // Abladen Frame.Log("State zu unload"); break; } _States.MiningState = MiningState.letzgo; // Losfliegen minen gehen :D Frame.Log("State zu letzgo"); break; } break; ///////////////////////////////////////////////////////////////////////////////////////// case MiningState.Mining: if (Frame.Client.GetActiveShip.Miners.Count == 0) { _States.MiningState = MiningState.warphome; break; } List<EveQskill> qskillmining = Frame.Client.GetMyQueue(); if (miningcount == 10) { Frame.Log("Starte SQLtimecheck"); // sqltimecheck(); miningcount = 0; } miningcount = (miningcount + 1); Frame.Log("Travelstate.Mining"); Frame.Log("Miningcount " + miningcount.ToString()); if (Frame.Client.getinvopen() == false) { Frame.Client.Getandopenwindow("leer"); break; } if (Frame.Client.getoreopen() == false) { Frame.Client.Getandopenwindow("Orehold"); break; } EveInventoryContainer cargoho2 = Frame.Client.GetPrimaryInventoryWindow.OreHoldOfActiveShip; // Container wird erstellt "cargoho" und wird mit aktivem Cargohold verknüpft usdcapcargo = cargoho2.UsedCapacity; // Variablen werden gesetzt Verbrauchtes Cargo <-- fullcapcargo = cargoho2.Capacity; // Variablen werden gesetzen Cargo insgesammt <--- Frame.Log(usdcapcargo); Frame.Log(fullcapcargo); double carggoo = (fullcapcargo * 0.95); Frame.Log("Maximal ladung(95% vom cargo" + carggoo); Frame.Log(" usd cargo " + usdcapcargo); Frame.Log(" qskillminingcount = " + qskillmining.Count); double money = Frame.Client.wealth(); if (money > 500000) { Frame.Log("Genug geld vorhanden checke skillliste"); if (usdcapcargo != 0 && qskillmining.Count == 0) { if (Frame.Client.GetActiveShip.ActiveDrones.Count > 0) { _States.DroneState = states.DroneState.dronesback; break; } DroneController.astro = null; Frame.Log(""); minersactiv = "Aus"; // EmptyBelts.Add(currentbelt); // State um zurück zur Stations Bookmark zu warpen _States.MiningState = MiningState.warphome; break; } } if (usdcapcargo > carggoo) // Wenn das cargo voll gehe heim { if (Frame.Client.GetActiveShip.ActiveDrones.Count > 0) { _States.DroneState = states.DroneState.dronesback; break; } DroneController.astro = null; Frame.Log("TravelState.Warphome"); _States.MiningState = MiningState.warphome; // State um zurück zur Stations Bookmark zu warpen break; } // Wenn nicht suche iene liste mit Asterioden raus List<EveEntity> test3 = Frame.Client.Entities; // Und sortier sie nach namen distanz etc if (targetast != null) { DroneController.astro = targetast; // Target übergeben an dronen targetda = test3.Where(i => (i.Id == targetast.Id)).Any(); } if (targetda == false) { targetast = null; } if (targetast == null) { Frame.Log("suche asteroiden"); targetast = test3.Where(i => i.Distance < 65000 && ( i.Name.ToLower().Contains("pyroxeres") // Magic dont touch ) ).OrderBy(i => i.Distance).FirstOrDefault(); } if (targetast == null) { targetast = test3.Where(i => i.Distance < 65000 && ( i.Name.ToLower().Contains("massive scordite") // Magic dont touch ) ).OrderBy(i => i.Distance).FirstOrDefault(); } if (targetast == null) { targetast = test3.Where(i => i.Distance < 65000 && ( i.Name.ToLower().Contains("condensed scordite") // Magic dont touch ) ).OrderBy(i => i.Distance).FirstOrDefault(); } if (targetast == null) { targetast = test3.Where(i => i.Distance < 65000 && ( i.Name.ToLower().Contains("scordite") // Magic dont touch ) ).OrderBy(i => i.Distance).FirstOrDefault(); } if (targetast == null) { targetast = test3.Where(i => i.Distance < 65000 && ( i.Name.ToLower().Contains("concentrated veldspar") // Magic dont touch ) ).OrderBy(i => i.Distance).FirstOrDefault(); } if (targetast == null) { targetast = test3.Where(i => i.Distance < 65000 && ( i.Name.ToLower().Contains("dense veldspar") // Magic dont touch ) ).OrderBy(i => i.Distance).FirstOrDefault(); } if (targetast == null) { targetast = test3.Where(i => i.Distance < 65000 && ( i.Name.ToLower().Contains("veldspar") // Magic dont touch ) ).OrderBy(i => i.Distance).FirstOrDefault(); } if (targetast == null) { targetast = test3.Where(i => i.Distance < 65000 && ( i.Name.ToLower().Contains("plagioclase") // Magic dont touch ) ).OrderBy(i => i.Distance).FirstOrDefault(); } if (targetast == null) { EmptyBelts.Add(currentbelt); if (Frame.Client.getinvopen() == false) { Frame.Client.Getandopenwindow("leer"); break; } if (Frame.Client.getoreopen() == false) { Frame.Client.Getandopenwindow("Orehold"); break; } EveInventoryContainer cargoho3 = Frame.Client.GetPrimaryInventoryWindow.OreHoldOfActiveShip; // Container wird erstellt "cargoho" und wird mit aktivem Cargohold verknüpft usdcapcargo = cargoho3.UsedCapacity; // Variablen werden gesetzt Verbrauchtes Cargo <-- fullcapcargo = cargoho3.Capacity; // Variablen werden gesetzen Cargo insgesammt <--- Frame.Log(" Used Cargo " + usdcapcargo); // Logausgabe Verbrauchtes Cargo Frame.Log(" Used Cargo " + fullcapcargo); // Logausgabe Cargo insgesammt restofcargo = (fullcapcargo * 0.95); // Berechne 80% Des gesamten Cargos Frame.Log(" 95% Cargo entspricht " + restofcargo); // Logausgabe Cargo insgesammt if (usdcapcargo > restofcargo) // Wenn das benutze cargo 80% übersteigt { if (Frame.Client.GetActiveShip.ActiveDrones.Count > 0) { _States.DroneState = states.DroneState.dronesback; break; } DroneController.astro = null; Frame.Log(""); minersactiv = "Aus"; EmptyBelts.Add(currentbelt); // State um zurück zur Stations Bookmark zu warpen _States.MiningState = MiningState.warphome; break; } else { if (Frame.Client.GetActiveShip.ActiveDrones.Count > 0) { _States.DroneState = states.DroneState.dronesback; break; } DroneController.astro = null; minersactiv = "Aus"; _States.MiningState = MiningState.warptobelt; // Warpe zum nächsten Mining Belt Bookmark break; } } else { if (targetast.Distance > 10000) // weiter weg als 10km { double dist = Frame.Client.Entities.Where(i => i.Id == targetast.Id).FirstOrDefault().Distance; Frame.Log(dist); targetast.Approach(); if (dist > 10000) { _localPulse = DateTime.Now.AddMilliseconds(GetRandom(2000, 3500)); // Warte zwischen 2 und 3.5 Secunden break; } } if (Frame.Client.GetActiveTargetId == -1) { if (!targetast.IsBeingTargeted) { targetast.LockTarget(); // DroneController.astro = targetast; // Target übergeben an dronen Frame.Log("Locke Target"); break; } } ////// Miner List<EveModule> minerlist = Frame.Client.GetActiveShip.Miners; int cnt = minerlist.Where(i => (i.IsActive == true)).Count(); if (minerlist.Count > cnt) { // _States.DroneState = states.DroneState.Startdrones; if (minersactiv == "Aus") { minersactiv = "An"; } minerlist.Where(i => (i.IsActive == false)).FirstOrDefault().Activate(targetast.Id); Frame.Log("Miner Aktiviern"); // Logausgabe Miner aktviviern break; } double dist33 = Frame.Client.Entities.Where(i => i.Id == targetast.Id).FirstOrDefault().Distance; Frame.Log("test " + dist33); if (targetast.Distance < 7000) { if (Frame.Client.GetActiveShip.ToEntity.MovementMode != EveEntity.EntityMovementState.Stopped) { Frame.Log("Schiff gestoppt"); Frame.Client.ExecuteCommand(EveModel.EveCommand.CmdStopShip); _localPulse = DateTime.Now.AddMilliseconds(GetRandom(2000, 2500)); } break; } } _States.MiningState = MiningState.Mining; // Wieder zu Mining gehen break; ///////////////////////////////////////////////////////////////////////////////////////// case MiningState.warphome: _localPulse = DateTime.Now.AddMilliseconds(GetRandom(4500, 6500)); // Heimwarpen minersactiv = "Aus"; if (Frame.Client.getinvopen() == false) { Frame.Client.Getandopenwindow("leer"); break; } if (Frame.Client.getoreopen() == false) { Frame.Client.Getandopenwindow("Orehold"); break; } if (Frame.Client.Session.InStation) // Bin ich in der station? { // Wenn ja Frame.Log("In Station angekommen"); // Log _States.MiningState = MiningState.unload; // setze state zu unload _localPulse = DateTime.Now.AddMilliseconds(GetRandom(4500, 6500)); // Warte zwischen 4,5 und 6,5 secunden break; // Breake } // Wenn nicht in Station if (Frame.Client.GetActiveShip.ToEntity.MovementMode != EveEntity.EntityMovementState.InWarp) // UND nicht im Warp { // Dann if (Frame.Client.Entities.Where(i => i.Group == Group.Station).Any()) // und irgendwo ne Station ist { // Dann EveEntity station = Frame.Client.Entities.Where(i => i.Group == Group.Station).FirstOrDefault(); // Setze variablen der Station Frame.Log("Docking"); // Logbuch station.Dock(); // Docke an dieser station/Warp dahin _localPulse = DateTime.Now.AddMilliseconds(GetRandom(3000, 5000)); // Warte zwischen 3 und 5 Sekunden _States.MiningState = MiningState.warphome; // Setze state auf warphome break; // break } else { List<EveBookmark> mybook = Frame.Client.GetMyBookmarks(); // Erstelle liste mit aktuellen Bookmarks statbm = mybook.Where(i => (i.Title.Contains("station"))).FirstOrDefault(); Frame.Log("Warp to Station"); statbm.WarpTo(); _localPulse = DateTime.Now.AddMilliseconds(GetRandom(4500, 6500)); // Warte zwischen 4.5 und 6.5 Secunden _States.MiningState = MiningState.warphome; break; } } _States.MiningState = MiningState.warphome; break; ///////////////////////////////////////////////////////////////////////////////////////// case MiningState.warping: if (Frame.Client.GetActiveShip.ToEntity.MovementMode == EveEntity.EntityMovementState.InWarp) { break; } Frame.Log("wechsel state zu mining state"); _States.MiningState = MiningState.Mining; Frame.Log("Starte SQLtimecheck"); // sqltimecheck(); break; ///////////////////////////////////////////////////////////////////////////////////////// case MiningState.letzgo: _localPulse = DateTime.Now.AddMilliseconds(GetRandom(18000, 50000)); // // MysqlController.akship = Frame.Client.GetActiveShip.TypeName; // Setze für MySQL den Schiffcontroller // targetast = null; // Setze Astroiden Target == Null /* List<EveWindow> mywindow2; mywindow2 = Frame.Client.GetWindows; string con = "incursion"; EveWindow ne = mywindow2.Where(x => x.Name.Contains(con)).FirstOrDefault(); */ if (Frame.Client.incursionaktiv()) { Frame.Log("NPC in Belt WARP HOME and blacklist"); _States.MiningState = MiningState.changebook; break; } if (Frame.Client.Session.InStation) { Frame.Client.ExecuteCommand(EveModel.EveCommand.CmdExitStation); Frame.Log("Undocking from station"); _localPulse = DateTime.Now.AddMilliseconds(GetRandom(18000, 25000)); } { if (Frame.Client.Session.InSpace) _States.MiningState = MiningState.warptobelt; } Frame.Log("Starte SQLtimecheck"); // sqltimecheck(); break; case MiningState.warptobelt: if (Frame.Client.getinvopen() == false) { Frame.Client.Getandopenwindow("leer"); break; } if (Frame.Client.getoreopen() == false) { Frame.Client.Getandopenwindow("Orehold"); break; } var belts = Frame.Client.Entities.Where(i => i.Group == Group.AsteroidBelt && !i.Name.ToLower().Contains("ice") && !EmptyBelts.Contains(i.Id)); var belt = belts.OrderBy(x => x.Distance).FirstOrDefault(); if (belt == null) { Frame.Log("Alle belts auf Blacklist oder Keine Belts im System"); _States.MiningState = MiningState.backandaway; // _States.MiningState = MiningState.changebook; // Dann EveEntity station = Frame.Client.Entities.Where(i => i.Group == Group.Station).FirstOrDefault(); // Setze variablen der Station Frame.Log("Docking"); // Logbuch station.Dock(); // Docke an dieser station/Warp dahin _localPulse = DateTime.Now.AddMilliseconds(GetRandom(10000, 15000)); // Warte zwischen 3 und 5 Sekunden // Setze state auf warphome break; } currentbelt = belt.Id; long countbelt = EmptyBelts.Count(); countbelt = countbelt - 1; long countbeltZ = belts.Count(); countbeltZ = countbeltZ - 1; Frame.Log("Belts auf Blacklist " + countbelt + " von " + countbeltZ); if (Frame.Client.GetActiveShip.ToEntity.MovementMode == EveEntity.EntityMovementState.InWarp) { Frame.Log("Fertig gewarpt weiter zur Warping State"); _States.MiningState = MiningState.warping; break; } if (Frame.Client.GetActiveShip.ToEntity.MovementMode != EveEntity.EntityMovementState.InWarp) // UND nicht im Warp { Frame.Log("Warping to Belt..."); long test = EmptyBelts.FirstOrDefault(); Frame.Log(test); Frame.Log(belt.Id); if (belt.Distance > 65000) { belt.WarpTo(); _localPulse = DateTime.Now.AddMilliseconds(GetRandom(10000, 15000)); _States.MiningState = MiningState.warptobelt; break; } else { _States.MiningState = MiningState.Mining; } } break; case MiningState.backandaway: _localPulse = DateTime.Now.AddMilliseconds(GetRandom(4500, 6500)); if (Frame.Client.Session.InStation) // Bin ich in der station? { // Wenn ja Frame.Log("In Station angekommen setzte neue desti"); // Log _States.MiningState = MiningState.changebook; break; // Warte zwischen 4,5 und 6,5 secunden } break; case MiningState.unload: MysqlController.lastaction = DateTime.Now; if (Frame.Client.GetService("marketQuote") == null) { break; } if (Frame.Client.GetService("wallet") == null) { break; } if (Frame.Client.getinvopen() == false) { Frame.Client.Getandopenwindow("leer"); break; } if (Frame.Client.getoreopen() == false) { Frame.Client.Getandopenwindow("Orehold"); break; } Frame.Log("bin bei Unload"); items = Frame.Client.GetPrimaryInventoryWindow.OreHoldOfActiveShip.Items; // Get itemslist check fehlt Frame.Log(items.Count); // Logbuch Items zahl if (items.Count == 0) { items = Frame.Client.GetPrimaryInventoryWindow.CargoHoldOfActiveShip.Items; } if (items.Count != 0) // Wenn items zahl ungleich 0 ist dann { Frame.Log("item gefunden"); // Logbuch items gefunden EveItem itemZ = items.OrderBy(x => x.ItemId).FirstOrDefault(); // Nimm das erste items in der liste string namee = itemZ.TypeName; Frame.Log("givenname = " + namee); Frame.Client.GetItemHangar(); Frame.Client.GetPrimaryInventoryWindow.ItemHangar.Add(itemZ); // und füge es dem itemshangar hinzu items.Remove(itemZ); Frame.Client.GetPrimaryInventoryWindow.ItemHangar.StackAll(); Frame.Log("Stackall"); _States.MiningState = MiningState.unload; // wiederhole unload break; } // Wenn kein items mehr da ist / oder da war if (sellcount > 10) { sellcount = 0; MysqlController.stationtrip = (MysqlController.stationtrip + 1); Frame.Log("sellerror, quickfix for the moment"); // Log buchausgabe // Abdocken und losfliegen _States.MiningState = MiningState.wait; Frame.Log("_States.MiningState = MiningState.wait;"); _States.maincontrollerState = maincontrollerStates.endminingcycle; Frame.Log("_States.maincontrollerState = maincontrollerStates.endminingcycle;"); break; } Frame.Client.GetItemHangar(); List<EveItem> itemlischt = Frame.Client.GetPrimaryInventoryWindow.ItemHangar.Items; EveItem itemsZZ = itemlischt.Where(x => x.Stacksize > 1000).FirstOrDefault(); if (itemsZZ == null) { sellcount = sellcount + 1; Frame.Log("Keine items in der menge vorrätig"); } if (itemsZZ != null) { if (Frame.Client.getmarketopen() == false) { sellcount = sellcount + 1; Frame.Client.Getandopenwindow("market"); return; } verkaufsintemszahl = (itemsZZ.Quantity); if (!Frame.Client.GetService("marketQuote").IsValid) { sellcount = sellcount + 1; break; } // sellitemsZ(verkaufsintemszahl, itemsZZ); Frame.Log("Verkaufe itemZZ typ id = " + itemsZZ.TypeId); Frame.Log("Verkaufe items" + verkaufsintemszahl + " " + itemsZZ.Quantity); Frame.Client.refreshorders(itemsZZ); List<EveMarketOrder> markyord = Frame.Client.GetCachedOrders(); if (markyord.Count == 0) { sellcount = sellcount + 1; break; } // double t = 1228; List<EveMarketOrder> marketitemZ = markyord.Where(x => x.typeID == itemsZZ.TypeId).Where(x => x.inrange == true).Where(x => x.bid == true).ToList(); if (marketitemZ != null) { sellcount = sellcount + 1; if (marketitemZ.OrderByDescending(x => x.price).Where(x => x.price > 13).Any()) { marketitem = marketitemZ.OrderByDescending(x => x.price).Where(x => x.price > 13).First(); // first or default } } if (marketitem == null) { sellcount = sellcount + 1; Frame.Log("kein eintrag mit -1"); return; } sellcount = sellcount + 1; Frame.Log("Marketitem Name = " + marketitem.Name); // Funktion für verkaufen infos Frame.Log("Marketitem Price = " + marketitem.price); Frame.Log("Marketitem Volentered = " + marketitem.volEntered); Frame.Log("Marketitem Remain = " + marketitem.volRemaining); Frame.Log("Marketitem OrderId = " + marketitem.orderID); Frame.Log("Marketitem Jumpes = " + marketitem.jumps); Frame.Log("Marketitem Range = " + marketitem.range); Frame.Log("Marketitem inrange = " + marketitem.inrange); marketitem.sell(verkaufsintemszahl, itemsZZ); verkaufswertinsg = (marketitem.price * verkaufsintemszahl); itemwert = (itemwert + verkaufswertinsg); Frame.Log("Verkaufswert = " + verkaufswertinsg); Frame.Log("setze marketitem wieder auf null"); marketitem = null; itemlischt.Remove(itemsZZ); Frame.Log("Loesche Item aus Liste"); break; } MysqlController.stationtrip = (MysqlController.stationtrip + 1); Frame.Log("keine items mehr wieder losfliegen"); // Log buchausgabe sellcount = 0; // Abdocken und losfliegen _States.MiningState = MiningState.wait; Frame.Log("_States.MiningState = MiningState.wait;"); _States.maincontrollerState = maincontrollerStates.endminingcycle; Frame.Log("_States.maincontrollerState = maincontrollerStates.endminingcycle;"); break; case MiningState.changebook: MysqlController.lastaction = DateTime.Now; EmptyBelts.Clear(); int remove = Math.Min(syssis.Count, 1); if (syssis.Count <= 0) { _States.MiningState = MiningState.wait; } long desti = syssis.FirstOrDefault(); if (desti == Frame.Client.Session.LocationId) { Frame.Log("wir befinden uns in diese system"); remove = Math.Min(syssis.Count, 1); syssis.RemoveRange(0, remove); Frame.Log("ersten listeneintrag gelöscht"); break; } Settings.Settings.Instance.homesys = desti; Frame.Log("setze Destination"); syssis.RemoveRange(0, remove); Frame.Client.SetDestination(desti); /* List<EveBookmark> test2 = new List<EveBookmark>(); test2 = Frame.Client.GetMyBookmarks(); if (test2.Count <= 0) { _States.MiningState = MiningState.wait; //keine bookmarks mehr } EveBookmark booky1 = test2.Where(x => !Emptysys.Contains(x.LocationId)).FirstOrDefault(); bookmaid = booky1.LocationId; Frame.Log(bookmaid); Frame.Log(booky1.LocationId + " = " + Frame.Client.Session.LocationId); if (booky1.LocationId == Frame.Client.Session.LocationId) { Frame.Log("booky == momentane Loc"); Emptysys.Add(bookmaid); _States.MiningState = MiningState.changebook; // Abdocken und losfliegen break; } booky1.SetDestination(); * */ _States.MiningState = MiningState.travStart; break; /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// ////////////// Travling to another Bookmark System ///////////////// /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// /* case MiningState.schelling: Frame.Client.refreshorders(itemsZZ); if (Frame.Client.GetCachedOrders() == null) { break; } List<EveMarketOrder> markyord = Frame.Client.GetCachedOrders(); List<EveMarketOrder> marketitemZ = markyord.Where(x => x.typeID == itemsZZ.TypeId).Where(x => x.inrange == true).Where(x => x.bid == true).ToList(); if (marketitemZ != null) { marketitem = marketitemZ.OrderByDescending(x => x.price).FirstOrDefault(); } if (marketitem == null) { Frame.Log("kein eintrag mit -1"); return; } Frame.Log("Marketitem Name = " + marketitem.Name); // Funktion für verkaufen infos Frame.Log("Marketitem Price = " + marketitem.price); Frame.Log("Marketitem Volentered = " + marketitem.volEntered); Frame.Log("Marketitem Remain = " + marketitem.volRemaining); Frame.Log("Marketitem OrderId = " + marketitem.orderID); Frame.Log("Marketitem Jumpes = " + marketitem.jumps); Frame.Log("Marketitem Range = " + marketitem.range); Frame.Log("Marketitem inrange = " + marketitem.inrange); marketitem.sell(verkaufsintemszahl, itemsZZ); verkaufswertinsg = (marketitem.price * verkaufsintemszahl); Frame.Log("Verkaufswert = " + verkaufswertinsg ); break; */ case MiningState.travStart: if (Frame.Client.Session.LocationId != syssis.FirstOrDefault()) { TravelController.desti = syssis.FirstOrDefault(); _States.TravelerState = TravelerState.Initialise; _States.maincontrollerState = maincontrollerStates.homesysarriv; _States.MiningState = MiningState.wait; } else { _States.maincontrollerState = maincontrollerStates.Idle; _States.MiningState = MiningState.Initialise; } /* _currentLocation = 0; if (Frame.Client.Session.InStation) { Frame.Client.ExecuteCommand(EveModel.EveCommand.CmdExitStation); Frame.Log("Undocking from station"); _localPulse = DateTime.Now.AddMilliseconds(GetRandom(18000, 25000)); break; } _destinationId = _destinationId > 0 ? _destinationId : Frame.Client.GetLastWaypointLocationId(); if (_destinationId == -1 || Frame.Client.Session.LocationId == _destinationId) { Frame.Log("No destination found, shutting down"); _States.MiningState = MiningState.ArrivedAtDestination; return; } if (Frame.Client.GetLastWaypointLocationId() == -1) { Frame.Log("Setting destination"); Frame.Client.SetDestination(_destinationId); } _States.MiningState = MiningState.Start; * */ break; case MiningState.Start: if (Frame.Client.Session.InStation) { Frame.Client.ExecuteCommand(EveModel.EveCommand.CmdExitStation); Frame.Log("Undocking from station"); _localPulse = DateTime.Now.AddMilliseconds(GetRandom(18000, 25000)); } _States.MiningState = MiningState.Travel; break; case MiningState.Travel: if (_destinationId == -1 || Frame.Client.Session.LocationId == _destinationId) { _States.MiningState = MiningState.ArrivedAtDestination; EveEntity destEntity = Frame.Client.Entities.Where(ent => ent.Id == _currentDestGateId).FirstOrDefault(); if (Frame.Client.Session.LocationId != _currentLocation && Frame.Client.Session.IsItSafe) { if (_waitforsessionChange) { Frame.Log("Session changed"); _localPulse = DateTime.Now.AddMilliseconds(GetRandom(4000, 6000)); _waitforsessionChange = false; return; } _waitforsessionChange = true; destEntity = Frame.Client.GetNextWaypointStargate(); _currentDestGateId = destEntity.Id; if (destEntity.Group == Group.Stargate) { destEntity.JumpStargate(); Frame.Log("Warping to and jumping through stargate - " + destEntity.Name); } else if (destEntity.Group == Group.Station) { destEntity.Dock(); Frame.Log("Warping to and docking at station - " + destEntity.Name); } _currentLocation = Frame.Client.Session.LocationId; } } break; case MiningState.ArrivedAtDestination: Frame.Log("Destination reached"); _States.MiningState = MiningState.letzgo; break; case MiningState.wait: // Frame.Log("Miningstate.wait erreicht"); _localPulse = DateTime.Now.AddMilliseconds(GetRandom(1000, 2500)); break; } }