Beispiel #1
0
        public static void MapKillsExample()
        {
            MapKills mapKills = EveApi.GetMapKills();

            foreach (MapKills.MapKillsItem item in mapKills.MapSystemKills)
            {
                if (item.ShipKills > 5)
                {
                    Console.WriteLine("{0} is a bad place to be right now", item.SolarSystemId);
                }
            }
        }
Beispiel #2
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;
        }
Beispiel #3
0
        public void JumpsPersist()
        {
            ResponseCache.Clear();

            MapKills mapKills = EveApi.GetMapKills();

            ResponseCache.Save("ResponseCache.xml");
            ResponseCache.Clear();
            ResponseCache.Load("ResponseCache.xml");
            MapKills cachedmapKills = EveApi.GetMapKills();

            Assert.AreEqual(mapKills.CachedUntilLocal, cachedmapKills.CachedUntilLocal);

            for (int i = 0; i < mapKills.MapSystemKills.Length; i++)
            {
                Assert.AreEqual(mapKills.MapSystemKills[i].PodKills, cachedmapKills.MapSystemKills[i].PodKills);
                Assert.AreEqual(mapKills.MapSystemKills[i].ShipKills, cachedmapKills.MapSystemKills[i].ShipKills);
            }
        }