From 078849a01ab470593bde37debe657297fd6022b5 Mon Sep 17 00:00:00 2001 From: Steve Sharp Date: Sun, 25 Mar 2018 16:07:32 +0100 Subject: [PATCH] zkill feed, tidy up, colours fix --- EVEData/Anom.cs | 1 + EVEData/AnomData.cs | 1 + EVEData/AnomManager.cs | 1 + EVEData/Character.cs | 1 + EVEData/{ => ESI}/ZKBData.cs | 0 EVEData/EveManager.cs | 47 +++++++---- EVEData/Fleet.cs | 6 +- EVEData/IntelData.cs | 9 +-- EVEData/JumpBridge.cs | 28 +++++-- EVEData/MapRegion.cs | 73 ++++++++++++----- EVEData/MapSystem.cs | 37 ++++++--- EVEData/System.cs | 116 +++++++++++++++++++++------ EVEData/Thera.cs | 26 ------ EVEData/TheraConnection.cs | 53 ++++++++++++ EVEData/ZKillRedisQ.cs | 151 ++++++++++++++++++++++++++--------- MainWindow.xaml | 7 ++ MainWindow.xaml.cs | 57 ++++++++++++- MapColours.cs | 22 ++--- MapConfig.cs | 16 ++++ RegionControl.xaml.cs | 2 +- SMT.csproj | 8 +- 21 files changed, 494 insertions(+), 168 deletions(-) rename EVEData/{ => ESI}/ZKBData.cs (100%) delete mode 100644 EVEData/Thera.cs create mode 100644 EVEData/TheraConnection.cs diff --git a/EVEData/Anom.cs b/EVEData/Anom.cs index 9d36b41b..1de1582a 100644 --- a/EVEData/Anom.cs +++ b/EVEData/Anom.cs @@ -1,6 +1,7 @@ //----------------------------------------------------------------------- // EVE Anoms //----------------------------------------------------------------------- + using System; namespace SMT.EVEData diff --git a/EVEData/AnomData.cs b/EVEData/AnomData.cs index d239fdca..8ad0f8c2 100644 --- a/EVEData/AnomData.cs +++ b/EVEData/AnomData.cs @@ -1,6 +1,7 @@ //----------------------------------------------------------------------- // EVE Anom Data //----------------------------------------------------------------------- + using System.Collections.Generic; using System.Linq; diff --git a/EVEData/AnomManager.cs b/EVEData/AnomManager.cs index ff7d2945..e522d2a6 100644 --- a/EVEData/AnomManager.cs +++ b/EVEData/AnomManager.cs @@ -1,6 +1,7 @@ //----------------------------------------------------------------------- // EVE AnomManager //----------------------------------------------------------------------- + using System.ComponentModel; using System.Linq; diff --git a/EVEData/Character.cs b/EVEData/Character.cs index 5eab0773..d8676daf 100644 --- a/EVEData/Character.cs +++ b/EVEData/Character.cs @@ -1,6 +1,7 @@ //----------------------------------------------------------------------- // EVE AnomManager //----------------------------------------------------------------------- + using System; using System.Collections.Generic; using System.Collections.ObjectModel; diff --git a/EVEData/ZKBData.cs b/EVEData/ESI/ZKBData.cs similarity index 100% rename from EVEData/ZKBData.cs rename to EVEData/ESI/ZKBData.cs diff --git a/EVEData/EveManager.cs b/EVEData/EveManager.cs index fb3d4c67..a36d6bff 100644 --- a/EVEData/EveManager.cs +++ b/EVEData/EveManager.cs @@ -1,6 +1,7 @@ //----------------------------------------------------------------------- // EVE Manager //----------------------------------------------------------------------- + using System; using System.Collections.Generic; using System.Collections.ObjectModel; @@ -188,13 +189,29 @@ public static EveManager Instance /// /// Gets or sets the Name to System dictionary /// - private Dictionary NameToSystem { get; set; } + private Dictionary NameToSystem { get; } /// /// Gets or sets the current list of intel filters used to monitor the local log files /// private List IntelFilters { get; set; } + /// + /// Get the System name from the System ID + /// + /// System ID + /// System Name + public string GetSystemNameFromSystemID(string id) + { + string name = string.Empty; + if (SystemIDToName.Keys.Contains(id)) + { + name = SystemIDToName[id]; + } + + return name; + } + /// /// Get the alliance name from the alliance ID /// @@ -625,7 +642,7 @@ public void CreateFromScratch() s.ActualX = x; s.ActualY = y; s.ActualZ = z; - s.Security = security; + s.TrueSec = security; s.ConstellationID = constID; } } @@ -781,10 +798,7 @@ public void LoadFromDisk() /// Does the System Exist ? /// /// Name (not ID) of the system - public bool DoesSystemExist(string name) - { - return GetEveSystem(name) != null; - } + public bool DoesSystemExist(string name) => GetEveSystem(name) != null; /// /// Get a System object from the name, note : for regions which have other region systems in it wont return @@ -1112,17 +1126,12 @@ private void IntelFileWatcher_Changed(object sender, FileSystemEventArgs e) string l = file.ReadLine(); fileReadFrom++; - if (l.Contains("Channel ID")) + // explicitly skip just "local" + if(l.Contains("Channel Name: Local")) { - string temp = l.Split(',')[1].Split(')')[0].Trim(); - if (SystemIDToName.Keys.Contains(temp)) - { - system = SystemIDToName[temp]; - } - // now can read the next line - l = file.ReadLine(); // should be the "Channel Name : Local" - l = file.ReadLine(); + l = file.ReadLine(); // should be the "Listener : " + fileReadFrom++; characterName = l.Split(':')[1].Trim(); @@ -1143,6 +1152,8 @@ private void IntelFileWatcher_Changed(object sender, FileSystemEventArgs e) { LocalCharacters.Add(new EVEData.Character(characterName, changedFile, system)); }), DispatcherPriority.ApplicationIdle); + + } break; @@ -1173,6 +1184,12 @@ private void IntelFileWatcher_Changed(object sender, FileSystemEventArgs e) line = line.Substring(line.IndexOf("[")); } + if(line == "") + { + line = file.ReadLine(); + continue; + } + fileReadFrom++; if (localChat) diff --git a/EVEData/Fleet.cs b/EVEData/Fleet.cs index b887668d..ebd6a7f2 100644 --- a/EVEData/Fleet.cs +++ b/EVEData/Fleet.cs @@ -1,6 +1,7 @@ //----------------------------------------------------------------------- // Fleet //----------------------------------------------------------------------- + using System.Collections.ObjectModel; namespace SMT.EVEData @@ -49,14 +50,15 @@ public Fleet() public struct FleetMember { /// - /// Fleet Member Character name + /// Gets or sets Fleet Member Character name /// public string Name { get; set; } /// - /// Fleet member Location + /// Gets or sets Fleet member Location /// public string Location { get; set; } + public override string ToString() => Name; } } diff --git a/EVEData/IntelData.cs b/EVEData/IntelData.cs index 0b9ca705..c36d4570 100644 --- a/EVEData/IntelData.cs +++ b/EVEData/IntelData.cs @@ -1,6 +1,7 @@ //----------------------------------------------------------------------- // Intel Data //----------------------------------------------------------------------- + using System; using System.Collections.Generic; @@ -12,8 +13,9 @@ namespace SMT.EVEData public class IntelData { /// - /// Initializes a new instance of the class + /// Initializes a new instance of the class /// + /// the raw line of text from the log file public IntelData(string intelText) { RawIntelString = intelText; @@ -45,9 +47,6 @@ public IntelData(string intelText) /// public List Systems { get; set; } - public override string ToString() - { - return "[" + IntelTime.ToString("HH:mm") + "] " + IntelString; - } + public override string ToString() => "[" + IntelTime.ToString("HH:mm") + "] " + IntelString; } } \ No newline at end of file diff --git a/EVEData/JumpBridge.cs b/EVEData/JumpBridge.cs index 182620b9..c7bf03f6 100644 --- a/EVEData/JumpBridge.cs +++ b/EVEData/JumpBridge.cs @@ -1,14 +1,29 @@ -namespace SMT.EVEData +//----------------------------------------------------------------------- +// Jump Bridge +//----------------------------------------------------------------------- + +namespace SMT.EVEData { /// /// A Player owned link between systems /// public class JumpBridge { + /// + /// Initializes a new instance of the class. + /// public JumpBridge() { } + /// + /// Initializes a new instance of the class. + /// + /// From + /// From Info + /// To + /// ToInfo + /// Is Friendly? public JumpBridge(string f, string fi, string t, string ti, bool friend) { From = f; @@ -19,29 +34,28 @@ public JumpBridge(string f, string fi, string t, string ti, bool friend) } /// - /// Starting System + /// Gets or sets the starting System /// public string From { get; set; } /// - /// Starting System Location (Planet-Moon) + /// Gets or sets the starting system location info(Planet-Moon) /// public string FromInfo { get; set; } /// - /// Ending System + /// Gets or sets the ending System /// public string To { get; set; } /// - /// Ending System Location (Planet-Moon) + /// Gets or sets the ending system Location info usually (Planet-Moon) /// public string ToInfo { get; set; } /// - /// Is this a friendly or hostile Jumpbridge + /// Gets or sets if this is a friendly or hostile Jump bridge /// public bool Friendly { get; set; } - } } \ No newline at end of file diff --git a/EVEData/MapRegion.cs b/EVEData/MapRegion.cs index 4f427bf2..041bdfa3 100644 --- a/EVEData/MapRegion.cs +++ b/EVEData/MapRegion.cs @@ -1,36 +1,33 @@ -using System.Collections.Generic; +//----------------------------------------------------------------------- +// Map Region +//----------------------------------------------------------------------- + +using System.Collections.Generic; using System.Linq; namespace SMT.EVEData { + /// + /// Represents a Map of a Region (will have out of region systems on the map) + /// public class MapRegion { /// - /// English Name of this region - /// - public string Name { get; set; } - - public string Faction { get; set; } - - public double RegionX { get; set; } - - public double RegionY { get; set; } - - /// - /// "Name" on Dotlan, used in URL's etc + /// Initializes a new instance of the class. /// - public string DotLanRef { get; set; } - - public SerializableDictionary MapSystems { get; set; } - - public List RegionLinks { get; set; } - public MapRegion() { MapSystems = new SerializableDictionary(); RegionLinks = new List(); } + /// + /// Initializes a new instance of the class. + /// + /// Name of the Region + /// Faction (if any) of the region + /// X Location to render this on the universe map + /// Y Location to render this on the universe map public MapRegion(string name, string faction, double regionX, double regionY) { Name = name; @@ -40,16 +37,50 @@ public MapRegion(string name, string faction, double regionX, double regionY) RegionX = regionX; RegionY = regionY; - - MapSystems = new SerializableDictionary(); RegionLinks = new List(); } + /// + /// Gets or sets the English name of this region + /// + public string Name { get; set; } + + /// + /// Gets or sets the Regions Faction name + /// + public string Faction { get; set; } + + /// + /// Gets or sets the Regions X coord on the universe map + /// + public double RegionX { get; set; } + + /// + /// Gets or sets the Regions Y coord on the universe map + /// + public double RegionY { get; set; } + + /// + /// Gets or sets the "Name" on Dotlan, used in URL's etc + /// + public string DotLanRef { get; set; } + + /// + /// Gets or sets the dictionary of systems on this map + /// + public SerializableDictionary MapSystems { get; set; } + + /// + /// Gets or sets the list of links to other Regions + /// + public List RegionLinks { get; set; } /// /// Is the System on this region map : note as we're using the dotlan layout we have out of region systems on the map for navigability reasons /// + /// Name of the System to Check + /// public bool IsSystemOnMap(string name) { // to catch out of region systems on the current map, ie region boundaries or strange intra-region settings diff --git a/EVEData/MapSystem.cs b/EVEData/MapSystem.cs index b3068599..f146d9db 100644 --- a/EVEData/MapSystem.cs +++ b/EVEData/MapSystem.cs @@ -1,10 +1,13 @@ -using System.Collections.Generic; +//----------------------------------------------------------------------- +// Map System +//----------------------------------------------------------------------- + +using System.Collections.Generic; using System.Windows; using System.Xml.Serialization; namespace SMT.EVEData { - /// /// This is a representation of a System on a map.. usually these would be in the same region, however /// these will be duplicated in the case of the inter-region link systems and in regions where it makes @@ -12,30 +15,42 @@ namespace SMT.EVEData /// public class MapSystem { + /// + /// Gets or sets the Name of the system + /// public string Name { get; set; } + /// + /// Gets or sets the region this system belongs to + /// public string Region { get; set; } + /// + /// Gets or sets if this system is considered out of region for layout purposes + /// public bool OutOfRegion { get; set; } - + /// + /// Gets or sets the X Coordinate for the layout + /// public double LayoutX { get; set; } + /// + /// Gets or sets the Y Coordinate for the layout + /// public double LayoutY { get; set; } + /// + /// Gets or sets the list of points defining the cell around this system + /// public List CellPoints { get; set; } /// - /// the main data store for the actual eve system data + /// Gets or sets the actual actual eve system /// [XmlIgnoreAttribute] - public System ActualSystem; - - - public override string ToString() - { - return Name; - } + public System ActualSystem { get; set; } + public override string ToString() => Name; } } diff --git a/EVEData/System.cs b/EVEData/System.cs index 227715ce..a929e409 100644 --- a/EVEData/System.cs +++ b/EVEData/System.cs @@ -1,76 +1,140 @@ -using System.Collections.Generic; +//----------------------------------------------------------------------- +// System +//----------------------------------------------------------------------- + +using System.Collections.Generic; using System.Xml.Serialization; namespace SMT.EVEData { + /// + /// Represents the actual eve system, this may be referenced by multiple regions in the case of either border systems or systems that make sense to be drawn in another region + /// public class System { + /// + /// Initializes a new instance of the class. + /// + public System() + { + Jumps = new List(); + } + + /// + /// Initializes a new instance of the class. + /// + /// Name of the System + /// ID of the system + /// Region this system is in + /// Does this system contain an NPC station + public System(string name, string id, string region, bool station) + { + Name = name; + ID = id; + Region = region; + HasNPCStation = station; + + // default the ESI stats + NPCKillsLastHour = -1; + PodKillsLastHour = -1; + ShipKillsLastHour = -1; + JumpsLastHour = -1; + + Jumps = new List(); + } + + /// + /// Gets or sets the Name of the system + /// public string Name { get; set; } + /// + /// Gets or sets the Region this system belongs to + /// public string Region { get; set; } /// - /// Eve's internal ID for this System + /// Gets or sets Eve's internal ID for this System /// public string ID { get; set; } + /// + /// Gets or sets EVE's internal Constellation ID + /// public string ConstellationID { get; set; } + /// + /// Gets or sets the X coordinate in real space for this system + /// public double ActualX { get; set; } + /// + /// Gets or sets the Y coordinate in real space for this system + /// public double ActualY { get; set; } + /// + /// Gets or sets the Z coordinate in real space for this system + /// public double ActualZ { get; set; } - public double Security { get; set; } + /// + /// Gets or sets the Systems True Security Value + /// + public double TrueSec { get; set; } + /// + /// Gets or sets if this system has an NPC Station + /// public bool HasNPCStation { get; set; } + /// + /// Gets or sets the number of NPC Kills in the last hour + /// [XmlIgnoreAttribute] public int NPCKillsLastHour { get; set; } + /// + /// Gets or sets the number of pod kills in the last hour + /// [XmlIgnoreAttribute] public int PodKillsLastHour { get; set; } + /// + /// Gets or sets the number of player ships killed in the last hour + /// [XmlIgnoreAttribute] public int ShipKillsLastHour { get; set; } + /// + /// Gets or sets the number of pods killed in the last hour + /// [XmlIgnoreAttribute] public int JumpsLastHour { get; set; } + /// + /// Gets or sets the name of the alliance holding sov in this system + /// [XmlIgnoreAttribute] public string SOVAlliance { get; set; } + /// + /// Gets or sets the name of the corporation holding sov in this system + /// [XmlIgnoreAttribute] public string SOVCorp { get; set; } + /// + /// Gets or sets the Faction of the system if owned by an NPC Corp + /// [XmlIgnoreAttribute] - public string SOVFaction { get; set; } - + public string NPCSOVFaction { get; set; } + /// + /// Gets or sets the list of Jumps from this system + /// public List Jumps { get; set; } - public override string ToString() => Name; - - public System() - { - Jumps = new List(); - } - - public System(string name, string id, string region, bool station) - { - Name = name; - ID = id; - Region = region; - HasNPCStation = station; - - NPCKillsLastHour = -1; - PodKillsLastHour = -1; - ShipKillsLastHour = -1; - JumpsLastHour = -1; - - Jumps = new List(); - } } } \ No newline at end of file diff --git a/EVEData/Thera.cs b/EVEData/Thera.cs deleted file mode 100644 index 1cef504c..00000000 --- a/EVEData/Thera.cs +++ /dev/null @@ -1,26 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace SMT.EVEData -{ - public class TheraConnection - { - public string System { get; set; } - public string Region { get; set; } - public string InSignatureID { get; set; } - public string OutSignatureID { get; set; } - public string EstimatedEOL { get; set; } - - public TheraConnection(string sys, string region, string inID, string outID, string eol) - { - Region = region; - System = sys; - InSignatureID = inID; - OutSignatureID = outID; - EstimatedEOL = eol; - } - } -} diff --git a/EVEData/TheraConnection.cs b/EVEData/TheraConnection.cs new file mode 100644 index 00000000..b4533746 --- /dev/null +++ b/EVEData/TheraConnection.cs @@ -0,0 +1,53 @@ +//----------------------------------------------------------------------- +// Thera Connection +//----------------------------------------------------------------------- + +namespace SMT.EVEData +{ + /// + /// Represents a Connection into Thera (sourced from Eve-Scout) + /// + public class TheraConnection + { + /// + ///Initializes a new instance of the class. + /// + /// System + /// Region + /// In Signature ID + /// Out Signature ID + /// End of Life Status + public TheraConnection(string sys, string region, string inID, string outID, string eol) + { + Region = region; + System = sys; + InSignatureID = inID; + OutSignatureID = outID; + EstimatedEOL = eol; + } + /// + /// Gets or sets the system with the connection to Thera + /// + public string System { get; set; } + + /// + /// Gets or sets the region that this system is in + /// + public string Region { get; set; } + + /// + /// Gets or sets the signature ID from the specified system into Thera + /// + public string InSignatureID { get; set; } + + /// + /// Gets or sets the signature ID from Thera to the specified system + /// + public string OutSignatureID { get; set; } + + /// + /// Gets or sets the Estimated End of Life status + /// + public string EstimatedEOL { get; set; } + } +} diff --git a/EVEData/ZKillRedisQ.cs b/EVEData/ZKillRedisQ.cs index 18df9d77..80a6b2b0 100644 --- a/EVEData/ZKillRedisQ.cs +++ b/EVEData/ZKillRedisQ.cs @@ -1,7 +1,7 @@ -using Newtonsoft.Json; -using Newtonsoft.Json.Linq; +//----------------------------------------------------------------------- +// ZKillboard ReDisQ feed +//----------------------------------------------------------------------- using System; -using System.Collections.Generic; using System.Collections.ObjectModel; using System.IO; using System.Net; @@ -11,64 +11,96 @@ namespace SMT.EVEData { + /// + /// The ZKillboard RedisQ representation + /// public class ZKillRedisQ { - public class ZKBDataSimple - { - public string KillID { get; set; } - public string VictimCharacterID { get; set; } - public string VictimCorpID { get; set; } - public string VictimAllianceID { get; set; } - public string SystemID { get; set; } - public DateTimeOffset KillTime { get; set; } + private bool updateThreadRunning = true; + private Thread updateThread; - public override string ToString() - { - return "KillID:" + KillID + " SystemID:" + SystemID + " Victim:" + VictimCharacterID ; - } + ~ZKillRedisQ() + { + updateThreadRunning = false; + updateThread.Join(); } - public ObservableCollection KillStream { get; set;} + /// + /// + /// + public bool PauseUpdate { get; set; } + /// + /// Gets or sets the Stream of the last few kills from ZKillBoard + /// + public ObservableCollection KillStream { get; set; } + + /// + /// Initialise the ZKB feed system + /// public void Initialise() { KillStream = new ObservableCollection(); - new Thread(() => - { - UpdateThreadFunc(); - }).Start(); - } + ThreadStart ts = new ThreadStart(UpdateThreadFunc); + updateThread = new Thread(ts); + updateThread.Start(); + } - public void UpdateThreadFunc() + /// + /// The main update function + /// + private void UpdateThreadFunc() { - bool running = true; - string redistURL = @"https://redisq.zkillboard.com/listen.php"; int cleanupCounter = 0; - while (running) + while (updateThreadRunning) { + if(PauseUpdate) + { + if(KillStream.Count > 0) + { + Application.Current.Dispatcher.Invoke((Action)(() => + { + KillStream.Clear(); + }), DispatcherPriority.ApplicationIdle); + + } + + Thread.Sleep(5000); + continue; + } + HttpWebRequest request = (HttpWebRequest)WebRequest.Create(redistURL); request.Method = WebRequestMethods.Http.Get; - request.Timeout = 20000; + request.Timeout = 10000; request.Proxy = null; - WebResponse response = request.GetResponse(); + HttpWebResponse response; + + try + { + response = request.GetResponse() as HttpWebResponse; + } + catch + { + Thread.Sleep(1000); + continue; + } Stream responseStream = response.GetResponseStream(); + using (StreamReader sr = new StreamReader(responseStream)) { // Need to return this response string strContent = sr.ReadToEnd(); -// JsonTextReader jsr = new JsonTextReader(new StringReader(strContent)); - try { ZKBData.ZkbData z = ZKBData.ZkbData.FromJson(strContent); - if(z.Package != null) + if (z.Package != null) { ZKBDataSimple zs = new ZKBDataSimple(); zs.KillID = z.Package.KillId.ToString(); @@ -80,19 +112,19 @@ public void UpdateThreadFunc() Application.Current.Dispatcher.Invoke((Action)(() => { - KillStream.Add(zs); + KillStream.Insert(0,zs); }), DispatcherPriority.ApplicationIdle); } else { + // nothing was returned by the request; rather than spam the server just wait 5 seconds Thread.Sleep(5000); } cleanupCounter++; // now clean up the list - - if(cleanupCounter > 100) + if (cleanupCounter > 10) { Application.Current.Dispatcher.Invoke((Action)(() => { @@ -103,24 +135,65 @@ public void UpdateThreadFunc() KillStream.RemoveAt(i); } } - }), DispatcherPriority.ApplicationIdle); cleanupCounter = 0; } - - } catch { } - - } - // wait 1 seconds for the next request + // wait for the next request Thread.Sleep(100); } } + + /// + /// A simple class with the Kill Highlights + /// + public class ZKBDataSimple + { + /// + /// Gets or sets the ZKillboard Kill ID + /// + public string KillID { get; set; } + + /// + /// Gets or sets the character ID of the victim + /// + public string VictimCharacterID { get; set; } + + /// + /// Gets or sets the Victim's corp ID + /// + public string VictimCorpID { get; set; } + + /// + /// Gets or sets the Victims Alliance ID + /// + public string VictimAllianceID { get; set; } + + /// + /// Gets or sets the System ID the kill was in + /// + public string SystemID { get; set; } + + /// + /// Gets or sets the time of the kill + /// + public DateTimeOffset KillTime { get; set; } + + public override string ToString() + { + string systemName = EVEData.EveManager.Instance.GetSystemNameFromSystemID(SystemID); + if(systemName == string.Empty) + { + systemName = SystemID; + } + return "KillID:" + KillID + " System:" + systemName + " Victim:" + VictimCharacterID; + } + } } } \ No newline at end of file diff --git a/MainWindow.xaml b/MainWindow.xaml index 50475f7b..5ff26b0d 100644 --- a/MainWindow.xaml +++ b/MainWindow.xaml @@ -93,6 +93,13 @@ + + + + + + + diff --git a/MainWindow.xaml.cs b/MainWindow.xaml.cs index 0e73b471..b36a75e1 100644 --- a/MainWindow.xaml.cs +++ b/MainWindow.xaml.cs @@ -33,9 +33,9 @@ public partial class MainWindow : Window private static NLog.Logger OutputLog = NLog.LogManager.GetCurrentClassLogger(); - private MapConfig MapConf { get; set; } + private MapConfig MapConf { get; } - private Xceed.Wpf.AvalonDock.Layout.LayoutDocument RegionLayoutDoc { get;set; } + private Xceed.Wpf.AvalonDock.Layout.LayoutDocument RegionLayoutDoc { get; } // Timer to Re-draw the map @@ -243,6 +243,11 @@ private void MapConf_PropertyChanged(object sender, PropertyChangedEventArgs e) this.Topmost = false; } } + + if(e.PropertyName == "ShowZKillData") + { + EVEManager.ZKillFeed.PauseUpdate = !MapConf.ShowZKillData; + } } private void MainWindow_Closed(object sender, EventArgs e) @@ -665,8 +670,56 @@ private void RegionShape_MouseDown(object sender, MouseButtonEventArgs e) private void ZKBFeed_MouseDoubleClick(object sender, MouseButtonEventArgs e) { + if (ZKBFeed.SelectedIndex == -1) + { + return; + } + + EVEData.ZKillRedisQ.ZKBDataSimple zkbs = ZKBFeed.SelectedItem as EVEData.ZKillRedisQ.ZKBDataSimple; + if (zkbs != null) + { + string KillURL = "https://zkillboard.com/kill/" + zkbs.KillID + "/"; + System.Diagnostics.Process.Start(KillURL); + } } + + private void ZKBContexMenu_ShowSystem_Click(object sender, RoutedEventArgs e) + { + if (ZKBFeed.SelectedIndex == -1) + { + return; + } + + EVEData.ZKillRedisQ.ZKBDataSimple zkbs = ZKBFeed.SelectedItem as EVEData.ZKillRedisQ.ZKBDataSimple; + + if (zkbs != null) + { + string systemName = EVEManager.GetSystemNameFromSystemID(zkbs.SystemID); + if (systemName != "") + { + RegionRC.SelectSystem(systemName, true); + } + } + } + + private void ZKBContexMenu_ShowZKB_Click(object sender, RoutedEventArgs e) + { + if (ZKBFeed.SelectedIndex == -1) + { + return; + } + + EVEData.ZKillRedisQ.ZKBDataSimple zkbs = ZKBFeed.SelectedItem as EVEData.ZKillRedisQ.ZKBDataSimple; + + if(zkbs != null) + { + string KillURL = "https://zkillboard.com/kill/" + zkbs.KillID + "/"; + System.Diagnostics.Process.Start(KillURL); + } + } + + } } \ No newline at end of file diff --git a/MapColours.cs b/MapColours.cs index 177b31f2..25c11bd4 100644 --- a/MapColours.cs +++ b/MapColours.cs @@ -99,6 +99,8 @@ public class MapColours static public Color GetSecStatusColour(double secStatus) { /* + Note : these are rounded to the nearest 0.1.. + #FF2FEFEF 1.0 #FF48F0C0 0.9 #FF00EF47 0.8 @@ -114,52 +116,52 @@ static public Color GetSecStatusColour(double secStatus) Color secCol = (Color)ColorConverter.ConvertFromString("#FFF00000"); - if (secStatus > 0.1) + if (secStatus > 0.05) { secCol = (Color)ColorConverter.ConvertFromString("#FFD73000"); } - if (secStatus > 0.2) + if (secStatus > 0.15) { secCol = (Color)ColorConverter.ConvertFromString("#FFF04800"); } - if (secStatus > 0.3) + if (secStatus > 0.25) { secCol = (Color)ColorConverter.ConvertFromString("#FFF06000"); } - if (secStatus > 0.4) + if (secStatus > 0.35) { secCol = (Color)ColorConverter.ConvertFromString("#FFD77700"); } - if (secStatus > 0.5) + if (secStatus > 0.45) { secCol = (Color)ColorConverter.ConvertFromString("#FFEFEF00"); } - if (secStatus > 0.6) + if (secStatus > 0.55) { secCol = (Color)ColorConverter.ConvertFromString("#FF8FEF2F"); } - if (secStatus > 0.7) + if (secStatus > 0.65) { secCol = (Color)ColorConverter.ConvertFromString("#FF00F000"); } - if (secStatus > 0.8) + if (secStatus > 0.75) { secCol = (Color)ColorConverter.ConvertFromString("#FF00EF47"); } - if (secStatus > 0.9) + if (secStatus > 0.85) { secCol = (Color)ColorConverter.ConvertFromString("#FF48F0C0"); } - if (secStatus > 0.99) + if (secStatus > 0.95) { secCol = (Color)ColorConverter.ConvertFromString("#FF2FEFEF"); } diff --git a/MapConfig.cs b/MapConfig.cs index 76ea8452..a601fba5 100644 --- a/MapConfig.cs +++ b/MapConfig.cs @@ -56,6 +56,21 @@ public string DefaultRegion [Browsable(false)] public MapColours ActiveColourScheme; + private bool m_ShowZKillData; + [Category("General")] + [DisplayName("Show ZKillData")] + public bool ShowZKillData + { + get + { + return m_ShowZKillData; + } + set + { + m_ShowZKillData = value; + OnPropertyChanged("ShowZKillData"); + } + } [Category("General")] [DisplayName("System Popup")] @@ -138,6 +153,7 @@ public void SetDefaults() MaxIntelSeconds = 120; AlwaysOnTop = false; ShowToolBox = true; + ShowZKillData = true; MapColours = new List(); } diff --git a/RegionControl.xaml.cs b/RegionControl.xaml.cs index c2320a48..676984f5 100644 --- a/RegionControl.xaml.cs +++ b/RegionControl.xaml.cs @@ -502,7 +502,7 @@ private void AddSystemsToMap() // override with sec status colours if (ShowSystemSecurity) { - systemShape.Fill = new SolidColorBrush(MapColours.GetSecStatusColour(system.ActualSystem.Security)); + systemShape.Fill = new SolidColorBrush(MapColours.GetSecStatusColour(system.ActualSystem.TrueSec)); } // add the hover over and click handlers diff --git a/SMT.csproj b/SMT.csproj index 2e235bb6..d6262cc5 100644 --- a/SMT.csproj +++ b/SMT.csproj @@ -149,9 +149,11 @@ - - - + + False + + +