Esempio n. 1
0
        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);
        }
Esempio n. 2
0
        private static EveAI.Map.SolarSystem GetSolarSystem(int systemId)
        {
            EveApi     API;
            APIKeyInfo KeyInfo;

            EveAI.Map.SolarSystem system;

            try
            {
                API     = new EveApi("Clyde en Marland's API Checker", Properties.Settings.Default.CorpAPI, Properties.Settings.Default.VCode);
                KeyInfo = API.GetApiKeyInfo();

                system = EveApi.EveApiCore.FindSolarSystem(systemId);
            }
            catch (Exception Ex)
            {
                system      = new EveAI.Map.SolarSystem();
                system.Name = string.Concat("Error querying API server; ", Ex.Message);
            }

            return(system);
        }
        private static EveAI.Map.SolarSystem GetSolarSystem(int systemId)
        {
            EveApi API;
            APIKeyInfo KeyInfo;
            EveAI.Map.SolarSystem system;

            try
            {
                API = new EveApi("Clyde en Marland's API Checker", Properties.Settings.Default.CorpAPI, Properties.Settings.Default.VCode);
                KeyInfo = API.GetApiKeyInfo();

                system = EveApi.EveApiCore.FindSolarSystem(systemId);
            }
            catch (Exception Ex)
            {
                system = new EveAI.Map.SolarSystem();
                system.Name = string.Concat("Error querying API server; ", Ex.Message);
            }

            return system;
        }
Esempio n. 4
0
        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);
        }