private static MessagePayload HyperFormatKillMessage(ZkbResponse.ZkbKill kill, string corpName, long corpId) { MessagePayload message = new MessagePayload(); message.Attachments = new List<MessagePayloadAttachment>(); string type; List<string> messageLines = new List<string>(); if (kill.Victim.CorporationId == corpId) { type = "LOSS"; } else { type = "KILL"; } EveAI.Map.SolarSystem system = GetSolarSystem(kill.SolarSystemId); ZkbResponse.ZkbStats stats = kill.Stats; string killTitle = string.Format(Properties.Settings.Default.MessageFormatLine1, corpName, type, kill.KillTime.ToString()); //messageLines.Add(killTitle); string killLine1 = string.Format(Properties.Settings.Default.MessageFormatLine2, kill.Victim.CharacterName, GetProductType(kill.Victim.ShipTypeId).Name, system.Name, system.Region.Name); messageLines.Add(killLine1); foreach (ZkbResponse.ZkbAttacker Attacker in kill.Attackers) { if (Attacker.FinalBlow == true) { messageLines.Add(string.Format(Properties.Settings.Default.MessageFormatLine3, Attacker.CharacterName, GetProductType(Attacker.ShipTypeId).Name)); } } foreach (ZkbResponse.ZkbAttacker Attacker in kill.Attackers) { if (Attacker.CorporationId == corpId) { messageLines.Add(string.Format(Properties.Settings.Default.MessageFormatLine4, Attacker.CharacterName, GetProductType(Attacker.ShipTypeId).Name)); } } if (stats != null) { messageLines.Add(string.Format(Properties.Settings.Default.MessageFormatLine5, stats.TotalValue.ToString("N2"))); } string killUrl = string.Format(Properties.Settings.Default.KillURL, kill.KillId.ToString()); messageLines.Add(string.Empty); message.Attachments.Add(new MessagePayloadAttachment() { Text = String.Join("\n", messageLines.ToArray()), TitleLink = killUrl, Title = killTitle, ThumbUrl = string.Format(Properties.Settings.Default.ShipImageUrl, kill.Victim.ShipTypeId.ToString()) }); if(type == "KILL") { message.Attachments.First().Colour = "#00FF00"; } else if (type == "LOSS") { message.Attachments.First().Colour = "#FF0000"; } return message; }
private static string FormatKillMessage(ZkbResponse.ZkbKill kill, string corpName, long corpId) { string type; List<string> messageLines = new List<string>(); string message = string.Empty; if (kill.Victim.CorporationId == corpId) { type = "LOSS"; } else { type = "KILL"; } EveAI.Map.SolarSystem system = GetSolarSystem(kill.SolarSystemId); ZkbResponse.ZkbStats stats = kill.Stats; messageLines.Add(string.Format(Properties.Settings.Default.MessageFormatLine1, corpName, type, kill.KillTime.ToString())); messageLines.Add(string.Format(Properties.Settings.Default.MessageFormatLine2, kill.Victim.CharacterName, GetProductType(kill.Victim.ShipTypeId).Name, system.Name, system.Region.Name)); foreach (ZkbResponse.ZkbAttacker Attacker in kill.Attackers) { if (Attacker.FinalBlow == true) { messageLines.Add(string.Format(Properties.Settings.Default.MessageFormatLine3, Attacker.CharacterName, GetProductType(Attacker.ShipTypeId).Name)); } } foreach (ZkbResponse.ZkbAttacker Attacker in kill.Attackers) { if (Attacker.CorporationId == corpId) { messageLines.Add(string.Format(Properties.Settings.Default.MessageFormatLine4, Attacker.CharacterName, GetProductType(Attacker.ShipTypeId).Name)); } } if (stats != null) { messageLines.Add(string.Format(Properties.Settings.Default.MessageFormatLine5, stats.TotalValue.ToString("N2"))); } string killUrl = string.Format(Properties.Settings.Default.KillURL, kill.KillId.ToString()); messageLines.Add(string.Format(Properties.Settings.Default.MessageFormatLine6, killUrl)); message = String.Join("\n", messageLines.ToArray()); return message; }
public void GetAll_ValidRequest_NoErrors() { ZkbResponse result = Api.GetLosses(Options); Assert.IsNotNull(result); }