public bool InitializeSelf(object[] Params) { if ((!Session.InSpace && !Session.InStation) || !Session.Safe) { return(false); } if (Me.Name != null) { Self.CharacterName = Me.Name; LoadConfig(); LoadedSettings = true; } if (CurrentGroup != null) { foreach (string skill in GenericLSkills) { Skill s = Skill.All.FirstOrDefault(a => a.Type == skill); if (s != null) { Self.LeadershipValue += s.SkillLevel; } } if (Self.Role == Role.Combat && CurrentGroup.GroupSettings.GroupType == GroupType.AnomalyCombat) { foreach (string skill in CombatLSkills) { Skill s = Skill.All.FirstOrDefault(a => a.Type == skill); if (s != null) { Self.LeadershipValue += s.SkillLevel; } } } if (Self.Role == Role.Miner && CurrentGroup.GroupSettings.GroupType == GroupType.Mining) { foreach (string skill in MiningLSkills) { Skill s = Skill.All.FirstOrDefault(a => a.Type == skill); if (s != null) { Self.LeadershipValue += s.SkillLevel; } } } if (Self.Role == Role.Booster) { Self.LeadershipValue = -1; } EVEFrame.Log("My computed leadership value is " + Self.LeadershipValue); RelayAll("forceupdate", ""); RelayAll("active", Self.CharacterName, Self.LeadershipValue.ToString(), Self.Role.ToString()); return(true); } return(false); }
public bool Upload(string uploadFile) { WebClient client = new WebClient(); client.Headers.Add("Content-Type", "binary/octet-stream"); Byte[] result = client.UploadFile("http://api.eve-com.com/log.php", "POST", uploadFile); EVEFrame.Log(Encoding.UTF8.GetString(result, 0, result.Length)); if (Encoding.UTF8.GetString(result, 0, result.Length) == "uploaded") { return(true); } return(false); }
bool Control(object[] Params) { if (!Session.Safe || (!Session.InSpace && !Session.InStation)) { return(false); } if (Session.SolarSystemID != SolarSystem) { PilotCache = Local.Pilots; SolarSystem = Session.SolarSystemID; } if (Config.LocalTraffic) { List <Pilot> newPilots = Local.Pilots.Where(a => !PilotCache.Contains(a)).ToList(); foreach (Pilot pilot in newPilots) { ChatQueue.Enqueue("<Local> New Pilot: " + pilot.Name); } } PilotCache = Local.Pilots; try { if (Config.Local) { if (Config.AllChat) { foreach (ChatChannel channel in ChatChannel.All) { try { if (channel.Messages.Count > 0) { if (!chatMessages.ContainsKey(channel.ID)) { chatMessages.Add(channel.ID, string.Empty); } if (chatMessages.FirstOrDefault(a => a.Key == channel.ID).Value != channel.Messages.Last().Text) { chatMessages.AddOrUpdate(channel.ID, channel.Messages.Last().Text); if (channel.Messages.Last().SenderID > 1 || Config.NPC) { ChatQueue.Enqueue("[Chat] <" + channel.Name + "> " + channel.Messages.Last().SenderName + ": " + channel.Messages.Last().Text); } } } } catch (Exception e) { EVEFrame.Log(e); } } } else { if (LocalChat.Messages.Any()) { if (LocalChat.Messages.Last().Text != LastLocal) { LastLocal = LocalChat.Messages.Last().Text; if (LocalChat.Messages.Last().SenderID > 1 || Config.NPC) { ChatQueue.Enqueue("[Chat] <Local> " + LocalChat.Messages.Last().SenderName + ": " + LastLocal); } } } } } } catch (Exception e) { EVEFrame.Log(e); } if (Config.ChatInvite) { Window ChatInvite = Window.All.FirstOrDefault(a => a.Name.Contains("ChatInvitation")); if (!ChatInviteSeen && ChatInvite != null) { ChatQueue.Enqueue("<Comms> !!!!!!!!!!!!!!!!!!!!New Chat Invitation received!!!!!!!!!!!!!!!!!!!!"); ChatInviteSeen = true; } if (ChatInviteSeen && ChatInvite == null) { ChatInviteSeen = false; } } if (Config.Wallet && LastWallet != Wallet.ISK) { double difference = Wallet.ISK - LastWallet; LastWallet = Wallet.ISK; ChatQueue.Enqueue("<Wallet> " + toISK(LastWallet) + " Delta: " + toISK(difference)); } if (Session.InSpace && Config.Grid) { Entity AddNonFleet = NonFleetPlayers.TargetList.FirstOrDefault(a => !NonFleetMemberOnGrid.Contains(a)); if (AddNonFleet != null) { ChatQueue.Enqueue("<Security> Non fleet member on grid: " + AddNonFleet.Name + " - http://evewho.com/pilot/" + AddNonFleet.Name.Replace(" ", "%20") + " (" + AddNonFleet.Type + ")"); NonFleetMemberOnGrid.Add(AddNonFleet); } NonFleetMemberOnGrid = NonFleetPlayers.TargetList.Where(a => NonFleetMemberOnGrid.Contains(a)).ToList(); } if (Config.UseIRC) { if (ChatQueue.Any()) { IRC.LocalUser.SendMessage(Config.SendTo, ChatQueue.Dequeue()); } } if (LocalQueue.Count > 0) { LocalChat.Send(LocalQueue.Dequeue()); } return(false); }
void Error(object sender, IrcErrorEventArgs e) { EVEFrame.Log("Error: " + e.Error.Message); }
private bool DatabaseFeeder(object[] Params) { if (Session.Safe && Session.InSpace) { Entity POS = Entity.All.FirstOrDefault(a => a.GroupID == Group.ControlTower && !ReportedPOS.Contains(a.ID)); if (POS != null) { Entity ClosestMoon = Entity.All.Where(a => a.GroupID == Group.Moon).OrderBy(a => a.Distance).First(); String data = String.Format(@"GUID={0}&moonID={1}&corpID={2}&typeID={3}", Config.guid, ClosestMoon.ID, POS.OwnerID, POS.TypeID); Log.Log("Submit StarbasePresence data: " + data, LogType.DEBUG); (new Thread(() => { try { EVEFrame.Log(StatsHost + "starbasepresence.php?" + data); WebRequest.Create(StatsHost + "starbasepresence.php?" + data).GetResponse(); EVEFrame.Log("Request completed."); } catch (Exception ex) { MessageBox.Show(ex.ToString()); EVEFrame.Log(ex.ToString()); } })).Start(); ReportedPOS.Add(POS.ID); return(false); } List <Entity> ReportCustomsOffices = Entity.All.Where(a => (a.TypeID == 2233 || a.TypeID == 4318) && !CustomsOffices.Contains(a.ID)).ToList(); if (ReportCustomsOffices.Any()) { String data = String.Format(@"GUID={0}&solarSystemID={1}", Config.guid, Session.SolarSystemID); foreach (Entity POCO in ReportCustomsOffices) { data += String.Format(@"&ownerID[]={0}&itemID[]={1}&typeID[]={2}&x[]={3}&y[]={4}&z[]={5}", POCO.OwnerID, POCO.ID, POCO.TypeID, POCO.Position.X.ToString(CultureInfo.InvariantCulture), POCO.Position.Y.ToString(CultureInfo.InvariantCulture), POCO.Position.Z.ToString(CultureInfo.InvariantCulture)); CustomsOffices.Add(POCO.ID); } Log.Log("Submit POCO data: " + data, LogType.DEBUG); (new Thread(() => { try { EVEFrame.Log(StatsHost + "poco.php?" + data); WebRequest.Create(StatsHost + "poco.php?" + data).GetResponse(); EVEFrame.Log("Request completed."); } catch (Exception ex) { MessageBox.Show(ex.ToString()); EVEFrame.Log(ex.ToString()); } })).Start(); } } return(false); }
bool LoginScreen(object[] Params) { UpdateCurrentProfile(); if (Session.InSpace || Session.InStation || CharSel.AtCharSel) { return(true); } if (Login.AtLogin) { if (Login.Loading) { return(false); } if (Login.ServerStatus != "Status: OK") { return(false); } PopupWindow Message = Window.All.OfType <PopupWindow>().FirstOrDefault(a => a.Message.Contains("A client update is available") || a.Message.Contains("The daily downtime will begin in") || a.Message.Contains("The connection to the server was closed") || a.Message.Contains("Unable to connect to the selected server.") || a.Message.Contains("Connection Failed")); if (Message != null) { EVEFrame.Log("Click"); Message.ClickButton(Window.Button.OK); return(false); } if (Window.All.OfType <PopupWindow>().Any(a => a.Message.Contains("Account subscription expired") || a.Message.Contains("has been disabled"))) { Log.Log("|rLogin failed, stopping script"); Clear(); return(true); } if (Login.Connecting) { return(false); } if (_curProfile != null) { if (Config.Mode == "Duration" && DateTime.Now <= Instanced.AddMinutes(LoginDelta)) { return(false); } if (Config.Mode == "Period" && DateTime.Now.TimeOfDay < Config.PeriodStart.TimeOfDay) { return(false); } if (Config.Mode == "Period" && DateTime.Now.TimeOfDay > Config.PeriodEnd.TimeOfDay) { Log.Log("|oRun period already complete, closing"); Clear(); QueueState(Logout); } Log.Log("|oLogging into account"); Log.Log(" |g{0}", _curProfile.Username); Login.Connect(_curProfile.Username, _curProfile.Password); InsertState(LoginScreen); WaitFor(5, () => Login.Connecting); return(true); } } return(false); }
public bool LoadModule(Module mod, Entity roid) { if (mod.Capacity > 0) { // Module is offline if (!mod.IsOnline) { EVEFrame.Log("LoadModule: Module offline"); return(false); } // Module is busy - wait if (mod.IsReloading || mod.IsActive || mod.IsActivating || mod.IsDeactivating) { EVEFrame.Log("LoadModule: Module is busy - wait"); return(true); } if (mod.Charge != null) { // Do we already have the correct crystal loaded if (MatchingMiningCrystal(roid).Contains(mod.Charge.TypeID)) { return(false); } } Item matchingCrystal = MyShip.CargoBay.Items.FirstOrDefault(a => MatchingMiningCrystal(roid) != null && MatchingMiningCrystal(roid).Contains(a.TypeID)); // We're on cooldown from swapping or unloading crystals right now if (CrystalSwapCooldown.ContainsKey(mod) && DateTime.Now < CrystalSwapCooldown[mod]) { EVEFrame.Log("LoadModule: Cooldown"); return(true); } if (!MyShip.CargoBay.IsPrimed) { MyShip.CargoBay.Prime(); return(true); } // Cargo is full, can't unload mining crystal if (mod.Charge != null && (MyShip.CargoBay.MaxCapacity - MyShip.CargoBay.UsedCapacity) < mod.Charge.Volume) { return(false); } // We have the correct crystal in cargo, load it if (matchingCrystal != null) { mod.LoadAmmo(matchingCrystal); CrystalSwapCooldown.AddOrUpdate(mod, DateTime.Now.AddSeconds(5)); return(true); } // We don't have the correct crystal in cargo and there's a charge loaded, unload it if (mod.Charge != null) { mod.UnloadAmmo(); CrystalSwapCooldown.AddOrUpdate(mod, DateTime.Now.AddSeconds(5)); return(true); } } return(false); }