Example #1
0
        private void getSystem(Input input)
        {
            string systemName = null;

            try
            {
                systemName = input.message.Split(new char[] { ' ' }, 2)[1];
                //If no arguments provided, this is actually out of bounds.
            }
            catch (IndexOutOfRangeException)
            {
                addResponse("I think you forgot something...");
                return;
            }

            //(List<InvType>)IrcBot.mySession.CreateCriteria<InvType>().Add(Restrictions.InsensitiveLike("typeName", itemName+"%")).List<InvType>();
            SolarSystem system = (SolarSystem)IrcBot.mySession.CreateCriteria <SolarSystem>().Add(Restrictions.Eq("solarSystemName", systemName)).UniqueResult();

            if (system == null)
            {
                addResponse("Cannot find system: " + systemName);
                return;
            }
            MapKills eveMapKills = EveApi.GetMapKills();

            MapKills.MapKillsItem kills = null;
            foreach (MapKills.MapKillsItem map in eveMapKills.MapSystemKills)
            {
                if (map.SolarSystemId == system.solarSystemID)
                {
                    kills = map;
                }
            }
            addResponse(string.Format("System: {0}. Constellation: {1}. Region: {2}. Security Status: {3}", system.solarSystemName, system.constellation.constellationName, system.region.regionName, system.security));
            if (kills != null)
            {
                addResponse(string.Format("Kills in the last hour: {0} ships, {1} pods", kills.ShipKills, kills.PodKills));
            }
            else
            {
                addResponse("No known kills in the last hour");
            }

            return;
        }
Example #2
0
        public MapKills Parse(XmlDocument xmlDocument)
        {
            this.CheckVersion(xmlDocument);
            MapKills mapKills = new MapKills();

            mapKills.ParseCommonElements(xmlDocument);

            List <MapKills.MapKillsItem> systemList = new List <MapKills.MapKillsItem>();

            foreach (XmlNode systemRow in xmlDocument.SelectNodes("//rowset[@name='solarSystems']/row"))
            {
                MapKills.MapKillsItem systemData = new MapKills.MapKillsItem();
                systemData.SolarSystemId = Convert.ToInt32(systemRow.Attributes["solarSystemID"].InnerText, CultureInfo.InvariantCulture);
                systemData.ShipKills     = Convert.ToInt32(systemRow.Attributes["shipKills"].InnerText, CultureInfo.InvariantCulture);
                systemData.FactionKills  = Convert.ToInt32(systemRow.Attributes["factionKills"].InnerText, CultureInfo.InvariantCulture);
                systemData.PodKills      = Convert.ToInt32(systemRow.Attributes["podKills"].InnerText, CultureInfo.InvariantCulture);
                systemList.Add(systemData);
            }
            mapKills.MapSystemKills = systemList.ToArray();

            return(mapKills);
        }