private static void TestGetLocalGridEntities(Character me, EVE.ISXEVE.EVE eve, ILogger logger) { //var entities = EntityRepository.GetLocalGridEntities(me, eve); eve.RefreshStandings(); var entities = eve.QueryEntities().Where(x => x.IsPC); //var anObj = LavishScript.Objects.GetObject("Local", "Romvex"); //logger.Log(anObj.ToString()); var pilot = new Pilot("Romvex "); logger.Log(pilot.ToString()); foreach (var entity in entities) { logger.Log(entity.Name); logger.Log(LavishScriptObject.IsNullOrInvalid(entity.Owner.ToFleetMember).ToString()); logger.Log(entity.Owner.CharID.ToString()); logger.Log(entity.Owner.Corp.ID.ToString()); logger.Log(entity.AllianceID.ToString()); var standing = me.StandingTo(entity.CharID, entity.Corp.ID, entity.AllianceID); logger.Log(standing.AllianceToAlliance.ToString()); logger.Log(standing.AllianceToCorp.ToString()); logger.Log(standing.AllianceToPilot.ToString()); logger.Log(standing.CorpToAlliance.ToString()); logger.Log(standing.CorpToCorp.ToString()); logger.Log(standing.CorpToPilot.ToString()); logger.Log(standing.MeToAlliance.ToString()); logger.Log(standing.MeToCorp.ToString()); logger.Log(standing.MeToPilot.ToString()); } }
private static void TestGetLocalGridEntities(Character me, EVE.ISXEVE.EVE eve, ILogger logger) { //var entities = EntityRepository.GetLocalGridEntities(me, eve); eve.RefreshStandings(); var entities = eve.QueryEntities().Where(x => x.IsPC); //var anObj = LavishScript.Objects.GetObject("Local", "Romvex"); //logger.Log(anObj.ToString()); var pilot = new Pilot("Romvex "); logger.Log(pilot.ToString()); foreach (var entity in entities) { logger.Log(entity.Name); logger.Log(LavishScriptObject.IsNullOrInvalid(entity.Owner.ToFleetMember).ToString()); logger.Log(entity.Owner.CharID.ToString()); logger.Log(entity.Owner.Corp.ID.ToString()); logger.Log(entity.AllianceID.ToString()); var standing = me.StandingTo(entity.CharID, entity.Corp.ID, entity.AllianceID); logger.Log(standing.AllianceToAlliance.ToString()); logger.Log(standing.AllianceToCorp.ToString()); logger.Log(standing.AllianceToPilot.ToString()); logger.Log(standing.CorpToAlliance.ToString()); logger.Log(standing.CorpToCorp.ToString()); logger.Log(standing.CorpToPilot.ToString()); logger.Log(standing.MeToAlliance.ToString()); logger.Log(standing.MeToCorp.ToString()); logger.Log(standing.MeToPilot.ToString()); } }
protected override void PopulateItems(ref Dictionary <long, Entity> cache) { using (new FrameLock(true)) { EVE.ISXEVE.EVE eve = new EVE.ISXEVE.EVE(); foreach (Entity e in eve.QueryEntities()) { cache[e.ID] = e; } } }
/// <summary> /// Gets the local grid entities. /// </summary> /// <param name="myMe"></param> /// <param name="myEVE">My eve.</param> /// <returns></returns> public static IEnumerable <EntityViewModel> GetLocalGridEntities(Character myMe, EVE.ISXEVE.EVE myEVE) { try { var entities = myEVE.QueryEntities().Where(entity => entity.IsPC && myMe.CharID != entity.CharID).ToArray(); var oEntities = new List <EntityViewModel>(); foreach (var entity in entities) { var standings = EntityHelper.ComputeStandings(myMe, entity); var newEntity = new EntityViewModel { Entity = entity, EntityStandings = standings }; var cachedEntity = EntityCache.Get(newEntity); if (cachedEntity == null) { EntityCache.Add(newEntity); } else { if (cachedEntity.EntityStandings != newEntity.EntityStandings) { if (newEntity.EntityStandings > cachedEntity.EntityStandings) { EntityCache.Remove(newEntity); EntityCache.Add(newEntity); } if (newEntity.EntityStandings == 0 && cachedEntity.EntityStandings != 0) { newEntity.EntityStandings = cachedEntity.EntityStandings; } } } oEntities.Add(newEntity); } return(oEntities); } catch (Exception e) { InnerSpace.Echo("GET LOCAL GRID ENTITIES ERROR :" + e.Message); return(new List <EntityViewModel>()); } }
/// <summary> /// Gets the local grid entities. /// </summary> /// <param name="myMe"></param> /// <param name="myEVE">My eve.</param> /// <returns></returns> public static IEnumerable<EntityViewModel> GetLocalGridEntities(Character myMe, EVE.ISXEVE.EVE myEVE) { try { var entities = myEVE.QueryEntities().Where(entity => entity.IsPC && myMe.CharID != entity.CharID).ToArray(); var oEntities = new List<EntityViewModel>(); foreach (var entity in entities) { var standings = EntityHelper.ComputeStandings(myMe, entity); var newEntity = new EntityViewModel {Entity = entity, EntityStandings = standings}; var cachedEntity = EntityCache.Get(newEntity); if (cachedEntity == null) { EntityCache.Add(newEntity); } else { if (cachedEntity.EntityStandings != newEntity.EntityStandings) { if (newEntity.EntityStandings > cachedEntity.EntityStandings) { EntityCache.Remove(newEntity); EntityCache.Add(newEntity); } if (newEntity.EntityStandings == 0 && cachedEntity.EntityStandings != 0) { newEntity.EntityStandings = cachedEntity.EntityStandings; } } } oEntities.Add(newEntity); } return oEntities; } catch (Exception e) { InnerSpace.Echo("GET LOCAL GRID ENTITIES ERROR :" + e.Message); return new List<EntityViewModel>(); } }
public void CheckCache(bool forceRepopulate = false) { if (RepopulateCache || forceRepopulate) { EntityCache.Clear(); EVE.ISXEVE.EVE eve = new EVE.ISXEVE.EVE(); List <Entity> entities = eve.QueryEntities(); foreach (Entity e in entities) { EntityCache.Add(e.ID, e); } } RepopulateCache = false; }