/// <summary> /// Gets the location. /// </summary> /// <returns></returns> private string GetLocation() { if (m_locationID == 0) { return(String.Empty); } string location = m_locationID.ToString(CultureConstants.InvariantCulture); if (m_locationID > Int32.MaxValue) { return(location); } int locationID = Convert.ToInt32(LocationID); Station station = EveIDToStation.GetIDToStation(locationID); SolarSystem = station == null ? StaticGeography.GetSolarSystemByID(locationID) : station.SolarSystem; FullLocation = station == null ? SolarSystem == null ? location : SolarSystem.FullLocation : station.FullLocation; return(station == null ? SolarSystem == null ? location : SolarSystem.Name : station.Name); }
/// <summary> /// Gets the station information from its ID. Works on NPC, conquerable, and citadel stations. /// </summary> /// <param name="id">The id.</param> /// <returns>The station information</returns> internal static Station GetIDToStation(long id) { var station = StaticGeography.GetStationByID(id); if (station == null && id != 0L) { SerializableOutpost serStation; // Citadels have ID over maximum int value if (id < int.MaxValue) { serStation = s_conq.LookupID(id); } else { serStation = s_cita.LookupID(id); } if (serStation != null) { station = new Station(serStation); } } return(station); }
/// <summary> /// Updates the location. /// </summary> /// <returns></returns> public void UpdateLocation() { // If location not already determined if (m_locationID != 0L && (m_solarSystem == null || m_solarSystem.ID == 0 || m_fullLocation.IsEmptyOrUnknown())) { var station = EveIDToStation.GetIDToStation(m_locationID, m_character); if (station == null) { SolarSystem sys; if (m_locationID < int.MaxValue && (sys = StaticGeography. GetSolarSystemByID((int)m_locationID)) != null) { // In space m_solarSystem = sys; m_fullLocation = sys.FullLocation; } else { // In an inaccessible citadel, or one that is not yet loaded m_solarSystem = new SolarSystem(); m_fullLocation = EveMonConstants.UnknownText; } } else { // Station known m_solarSystem = station.SolarSystem; m_fullLocation = station.FullLocation; } string locationStr = m_locationID.ToString(CultureConstants.InvariantCulture); Location = (station == null ? (m_solarSystem == null ? locationStr : m_solarSystem.Name) : station.Name); } }
/// <summary> /// Populates the serialization object job with the info from the API. /// </summary> /// <param name="src">The source.</param> private void PopulateJobInfo(SerializableJobListItem src) { ID = src.JobID; InstallerID = src.InstallerID; InstalledItem = StaticBlueprints.GetBlueprintByID(src.BlueprintTypeID); Runs = src.Runs; SolarSystem = StaticGeography.GetSolarSystemByID(src.SolarSystemID); Cost = src.Cost; Probability = src.Probability; SuccessfulRuns = src.SuccessfulRuns; //InstalledTime = src.InstallTime; //InstalledME = src.InstalledItemMaterialLevel; //InstalledPE = src.InstalledItemProductivityLevel; StartDate = src.StartDate; EndDate = src.EndDate; PauseDate = src.PauseDate; IssuedFor = src.IssuedFor; m_installedItemLocationID = src.StationID; UpdateInstallation(); if (Enum.IsDefined(typeof(BlueprintActivity), src.ActivityID)) { Activity = (BlueprintActivity)Enum.ToObject(typeof(BlueprintActivity), src.ActivityID); } OutputItem = GetOutputItem(src.ProductTypeID); //if (Enum.IsDefined(typeof(BlueprintType), src.InstalledItemCopy)) // BlueprintType = (BlueprintType)Enum.ToObject(typeof(BlueprintType), src.InstalledItemCopy); }
public SerializablePlanetaryColony ToXMLItem() { // Determine planet type from type name // Planet type is a type ID CCPAPIPlanetTypes type = CCPAPIPlanetTypes.Unknown; if (!string.IsNullOrEmpty(PlanetType)) { Enum.TryParse(PlanetType, true, out type); } int planetType = (int)type; var ret = new SerializablePlanetaryColony() { LastUpdate = LastUpdate, NumberOfPins = NumberOfPins, OwnerID = OwnerID, PlanetID = PlanetID, SolarSystemID = SolarSystemID, SolarSystemName = StaticGeography.GetSolarSystemName(SolarSystemID), PlanetTypeID = planetType, PlanetTypeName = StaticItems.GetItemName(planetType), UpgradeLevel = UpgradeLevel }; return(ret); }
protected override string Prefetch(long id) { string name = null; if (id < int.MaxValue && id > int.MinValue && id != 0) { int intId = (int)id; // Check NPC corporations var npcCorp = StaticGeography.GetCorporationByID(intId); if (npcCorp != null) { name = npcCorp.Name; } else { // Check NPC factions var npcFaction = StaticGeography.GetFactionByID(intId); if (npcFaction != null) { name = npcFaction.Name; } } } return(name); }
protected override string Prefetch(long id) { string name = null; if (id == 0L) { // Empty IDs are always "unknown" name = EveMonConstants.UnknownText; } else if (id < int.MaxValue && id > int.MinValue) { int intId = (int)id; // Check NPC corporations var npcCorp = StaticGeography.GetCorporationByID(intId); if (npcCorp != null) { name = npcCorp.Name; } else { // Check NPC factions var npcFaction = StaticGeography.GetFactionByID(intId); if (npcFaction != null) { name = npcFaction.Name; } } } // Try filling with a current character identity or corporation/alliance if (string.IsNullOrEmpty(name)) { foreach (var character in EveMonClient.Characters) { string corpName = character.CorporationName, allianceName = character. AllianceName; if (character.CharacterID == id) { name = character.Name; break; } if (character.CorporationID == id && !corpName.IsEmptyOrUnknown()) { name = corpName; break; } if (character.AllianceID == id && !allianceName.IsEmptyOrUnknown()) { name = allianceName; break; } } } return(name); }
/// <summary> /// Updates the skill queue training time. /// </summary> /// <returns></returns> private void UpdateSkillQueueTrainingTime() { CCPCharacter ccpCharacter = Character as CCPCharacter; lblSkillQueueTrainingTime.ForeColor = m_settingsForeColor; // Determine the character's system location int locID = Character?.LastKnownLocation?.SolarSystemID ?? 0; string text = string.Empty, locText; if (locID == 0) { locText = EveMonConstants.UnknownText + " Location"; } else { locText = StaticGeography.GetSolarSystemName(locID); } lblLocation.Text = locText; // Current character isn't a CCP character, so can't have a Queue if (ccpCharacter != null && !ccpCharacter.SkillQueue.IsPaused) { TimeSpan skillQueueEndTime = ccpCharacter.SkillQueue.EndTime.Subtract( DateTime.UtcNow); TimeSpan timeLeft = SkillQueue.WarningThresholdTimeSpan.Subtract( skillQueueEndTime); // Negative time: Skill queue is populated with more than a day if (timeLeft < TimeSpan.Zero) { // More than one entry in queue ? Display total queue remaining time if (ccpCharacter.SkillQueue.Count > 1) { text = "Queue ends in " + ccpCharacter.SkillQueue.EndTime. ToRemainingTimeShortDescription(DateTimeKind.Utc); } } // Skill queue is empty ? else if (timeLeft > SkillQueue.WarningThresholdTimeSpan) { lblSkillQueueTrainingTime.ForeColor = Color.Red; text = "Skill queue is empty"; } else if (timeLeft != TimeSpan.Zero) { // Less than one minute? Display seconds else display time without seconds string endTimeText = skillQueueEndTime.ToDescriptiveText( DescriptiveTextOptions.IncludeCommas, skillQueueEndTime < TimeSpan. FromMinutes(1)); lblSkillQueueTrainingTime.ForeColor = Color.Red; text = $"Queue ends in {endTimeText}"; } } lblSkillQueueTrainingTime.Text = text; }
/// <summary> /// Constructor from the API. /// </summary> /// <param name="src"></param> protected MarketOrder(SerializableAPIOrder src) { m_state = GetState(src); m_orderID = src.OrderID; m_item = StaticItems.GetItem(src.ItemID); m_station = StaticGeography.GetStation(src.StationID); m_unitaryPrice = src.UnitaryPrice; m_initialVolume = src.InitialVolume; m_remainingVolume = src.RemainingVolume; m_lastStateChange = DateTime.UtcNow; m_minVolume = src.MinVolume; m_duration = src.Duration; m_issued = src.Issued; }
/// <summary> /// Initializes a new instance of the <see cref="PlanetaryColony"/> class. /// </summary> /// <param name="ccpCharacter">The CCP character.</param> /// <param name="src">The source.</param> internal PlanetaryColony(CCPCharacter ccpCharacter, SerializablePlanetaryColony src) { Character = ccpCharacter; SolarSystem = StaticGeography.GetSolarSystemByID(src.SolarSystemID); PlanetID = src.PlanetID; PlanetName = src.PlanetName; PlanetTypeID = src.PlanetTypeID; PlanetTypeName = src.PlanetTypeName; LastUpdate = src.LastUpdate; UpgradeLevel = src.UpgradeLevel; NumberOfPins = src.NumberOfPins; GetColonyLayout(); }
/// <summary> /// Gets the corporation name from the provided ID. /// </summary> /// <param name="id">The id.</param> /// <returns></returns> private static string GetIDToName(long id) { string corporationName = String.Empty; // Check if it's an NPC Corporation if (id <= Int32.MaxValue) { NPCCorporation corporation = StaticGeography.GetCorporationByID((int)id); corporationName = corporation?.Name ?? String.Empty; } // If it's a player's corporation, query the API return(string.IsNullOrEmpty(corporationName) ? EveIDToName.GetIDToName(id) : corporationName); }
/// <summary> /// Constructor from the API. /// </summary> /// <param name="character">The character.</param> /// <param name="src">The source.</param> internal KillLog(Character character, SerializableKillLogListItem src) { Character = character; KillTime = src.KillTime; TimeSinceKill = DateTime.UtcNow.Subtract(src.KillTime); MoonID = src.MoonID; Victim = src.Victim; Attackers = src.Attackers; SolarSystem = StaticGeography.GetSolarSystemByID(src.SolarSystemID); m_items.AddRange(src.Items.Select(item => new KillLogItem(item))); Group = src.Victim.ID == character.CharacterID ? KillGroup.Losses : KillGroup.Kills; }
/// <summary> /// Constructor from an object deserialized from the settings file. /// </summary> /// <param name="src"></param> protected MarketOrder(SerializableOrderBase src) { m_ignored = src.Ignored; m_orderID = src.OrderID; m_state = src.State; m_item = StaticItems.FindItem(src.Item); m_station = StaticGeography.GetStation(src.StationID); m_unitaryPrice = src.UnitaryPrice; m_initialVolume = src.InitialVolume; m_remainingVolume = src.RemainingVolume; m_lastStateChange = src.LastStateChange; m_minVolume = src.MinVolume; m_duration = src.Duration; m_issued = src.Issued; }
/// <summary> /// Initializes a new instance of the <see cref="PlanetaryColony"/> class. /// </summary> /// <param name="ccpCharacter">The CCP character.</param> /// <param name="src">The source.</param> internal PlanetaryColony(CCPCharacter ccpCharacter, SerializablePlanetaryColony src) { Character = ccpCharacter; SolarSystem = StaticGeography.GetSolarSystemByID(src.SolarSystemID); PlanetID = src.PlanetID; PlanetTypeID = src.PlanetTypeID; PlanetTypeName = src.PlanetTypeName; PlanetName = EveMonConstants.UnknownText; LastUpdate = src.LastUpdate; UpgradeLevel = src.UpgradeLevel; NumberOfPins = src.NumberOfPins; m_layoutResponse = m_planetResponse = null; GetColonyLayout(); GetPlanetName(); }
/// <summary> /// Initializes a new instance of the <see cref="PlanetaryColony"/> class. /// </summary> /// <param name="ccpCharacter">The CCP character.</param> /// <param name="src">The source.</param> internal PlanetaryColony(CCPCharacter ccpCharacter, EsiPlanetaryColonyListItem src) { Character = ccpCharacter; SolarSystem = StaticGeography.GetSolarSystemByID(src.SolarSystemID); PlanetID = src.PlanetID; PlanetTypeID = src.PlanetType; PlanetTypeName = StaticItems.GetItemName(PlanetTypeID); PlanetName = SolarSystem.FindPlanetByID(PlanetID)?.Name ?? EveMonConstants. UnknownText; LastUpdate = src.LastUpdate; UpgradeLevel = src.UpgradeLevel; NumberOfPins = src.NumberOfPins; m_layoutResponse = null; GetColonyLayout(); }
/// <summary> /// Gets the corporation name from the provided ID. /// </summary> /// <param name="id">The id.</param> /// <returns></returns> private static string GetIDToName(long id) { string corporationName = String.Empty; // Check if it's an NPC Corporation if (id > Int32.MaxValue) { return(String.IsNullOrEmpty(corporationName) ? EveIDToName.GetIDToName(id) : corporationName); } int npcCorpID = Convert.ToInt32(id); NPCCorporation corporation = StaticGeography.GetCorporationByID(npcCorpID); corporationName = corporation?.Name ?? String.Empty; // If it's a player's corporation, query the API return(String.IsNullOrEmpty(corporationName) ? EveIDToName.GetIDToName(id) : corporationName); }
/// <summary> /// Gets the station information from its ID. Works on NPC stations and citadels. /// Since conquerable stations were converted, no attempt is made to check the ESI /// station endpoint online as all stations should (TM) be in the SDE... /// </summary> /// <param name="id">The id.</param> /// <returns>The station information</returns> internal static Station GetIDToStation(long id, CCPCharacter character = null) { var station = StaticGeography.GetStationByID(id); if (station == null && id > int.MaxValue) { // Citadels have ID over maximum int value var serStation = s_cita.LookupIDESI(id, character)?.Station; if (serStation != null) { station = new Station(serStation); } else { station = Station.CreateInaccessible(id); } } return(station); }
/// <summary> /// Loads the static data. /// </summary> public static async Task LoadAsync() { // Quit if the client has been shut down if (EveMonClient.Closed) { return; } // This is the time optimal loading order // (min order to follow : // skills before anything else, // properties before items, // items before blueprints, reprocessing and certificates, // certs before masteries) EveMonClient.Trace("Datafiles.Load - begin", printMethod: false); // Must always run first // It will have finished loading until static skills finish Task properties = TaskHelper.RunIOBoundTaskAsync(() => StaticProperties.Load()); // Must always run before items Task skills = TaskHelper.RunIOBoundTaskAsync(() => StaticSkills.Load()); await Task.WhenAll(skills, properties); // Must always run synchronously as blueprints, reprocessing and certificates depend on it await TaskHelper.RunIOBoundTaskAsync(() => StaticItems.Load()); // Must always run synchronously as masteries depend on it await TaskHelper.RunIOBoundTaskAsync(() => StaticCertificates.Load()); // Must always run synchronously as ID to name depends on it await TaskHelper.RunIOBoundTaskAsync(() => StaticGeography.Load()); // Non critical loadings as all dependencies have been loaded Task blueprints = TaskHelper.RunIOBoundTaskAsync(() => StaticBlueprints.Load()); Task reprocessing = TaskHelper.RunIOBoundTaskAsync(() => StaticReprocessing.Load()); await TaskHelper.RunIOBoundTaskAsync(() => StaticMasteries.Load()); EveMonClient.Trace("Datafiles.Load - done", printMethod: false); }
/// <summary> /// Gets the station. /// </summary> /// <param name="id">The ID of the installation.</param> /// <returns>Name of the installation.</returns> internal string GetInstallation(long id) { // Look for the station in datafile Station station = StaticGeography.GetStation(id); // Is it a conquerable outpost station ? if (station == null) { station = ConquerableStation.GetStation(id); } // Still nothing ? Then it's a starbase structure // and will be assigned manually based on activity if (station == null) { return(m_activity == BlueprintActivity.Manufacturing ? "POS - Assembly Array" : "POS - Laboratory"); } return(station.Name); }
/// <summary> /// Gets the query string. /// </summary> /// <param name="idsToQuery">The ids to query.</param> /// <returns></returns> private static string GetQueryString(IReadOnlyCollection <int> idsToQuery) { var sb = new StringBuilder(); foreach (int i in idsToQuery) { sb.Append($"typeid={i}"); if (idsToQuery.Last() != i) { sb.Append("&"); } } var jitaSolarSystem = StaticGeography.GetSolarSystemByName("Jita"); if (jitaSolarSystem != null) { sb.Append($"&usesystem={jitaSolarSystem.ID}"); } return(sb.ToString()); }
/// <summary> /// Gets the station of an order. /// </summary> /// <param name="src"></param> /// <returns></returns> private static Station GetStationByID(long id) { // Look for the station in datafile Station station = StaticGeography.GetStation(id); // We failed ? Then it's a conquerable outpost station if (station == null) { station = ConquerableStation.GetStation(id); } // We failed again ? It's not in any data we can access // We set it to a fixed one and notify about it in the trace file if (station == null) { station = StaticGeography.GetStation(60013747); EveClient.Trace("Could not find station id {0}", id); EveClient.Trace("Setting to {0}", station.Name); } return(station); }
/// <summary> /// Constructor from the API. /// </summary> /// <param name="src"></param> internal IndustryJob(SerializableJobListItem src) { m_state = GetState(src); m_jobID = src.JobID; m_installedItemID = src.InstalledItemTypeID; m_installedItem = StaticBlueprints.GetBlueprintByID(src.InstalledItemTypeID); m_outputItemID = src.OutputTypeID; m_outputItem = GetOutputItem(src.OutputTypeID); m_runs = src.Runs; m_activity = (BlueprintActivity)Enum.ToObject(typeof(BlueprintActivity), src.ActivityID); m_blueprintType = (BlueprintType)Enum.ToObject(typeof(BlueprintType), src.InstalledItemCopy); m_installation = GetInstallation(src.OutputLocationID); m_solarSystem = StaticGeography.GetSystem(src.SolarSystemID); m_installedTime = src.InstallTime; m_installedItemME = src.InstalledItemMaterialLevel; m_installedItemPE = src.InstalledItemProductivityLevel; m_beginProductionTime = src.BeginProductionTime; m_endProductionTime = src.EndProductionTime; m_pauseProductionTime = src.PauseProductionTime; m_lastStateChange = DateTime.UtcNow; m_issuedFor = src.IssuedFor; m_activeJobState = GetActiveJobState(); }
/// <summary> /// Constructor from an object deserialized from the settings file. /// </summary> /// <param name="src"></param> internal IndustryJob(SerializableJob src) { m_ignored = src.Ignored; m_jobID = src.JobID; m_state = src.State; m_installedItemID = src.InstalledItemID; m_installedItem = StaticBlueprints.GetBlueprintByID(src.InstalledItemID); m_outputItemID = src.OutputItemID; m_outputItem = GetOutputItem(src.OutputItemID); m_runs = src.Runs; m_activity = src.Activity; m_blueprintType = src.BlueprintType; m_installation = src.ItemLocation; m_solarSystem = StaticGeography.GetSystem(src.SolarSystemID); m_installedTime = src.InstalledTime; m_installedItemME = src.InstalledItemME; m_installedItemPE = src.InstalledItemPE; m_beginProductionTime = src.BeginProductionTime; m_endProductionTime = src.EndProductionTime; m_pauseProductionTime = src.PauseProductionTime; m_lastStateChange = src.LastStateChange; m_issuedFor = src.IssuedFor; m_activeJobState = GetActiveJobState(); }
/// <summary> /// Parses the notification text. /// </summary> /// <param name="notification">The notification.</param> /// <param name="pair">The pair.</param> /// <param name="parsedDict">The parsed dictionary.</param> public override void Parse(EveNotification notification, KeyValuePair <YamlNode, YamlNode> pair, IDictionary <string, string> parsedDict) { string key = pair.Key.ToString(), value = pair.Value.ToString(); long valueAsLong; decimal amount; double valueAsDouble; int typeID = notification.TypeID; DateTime timestamp = notification.SentDate; YamlSequenceNode typeIDs; // The value is often used as an int64 in the list below, simplify calculation if (!value.TryParseInv(out valueAsLong)) { valueAsLong = 0L; } switch (key.ToUpperInvariant()) { case "CHARID": case "SENDERCHARID": case "RECEIVERCHARID": case "OWNERID": case "LOCATIONOWNERID": case "DESTROYERID": case "INVOKINGCHARID": case "PODKILLERID": case "NEWCEOID": case "OLDCEOID": case "CORPID": case "VICTIMID": case "DECLAREDBYID": case "AGAINSTID": case "CREDITORID": case "FACTIONID": case "DEFENDERID": case "ENEMYID": case "AGGRESSORID": case "ALLYID": case "MERCID": case "AGGRESSORCORPID": case "AGGRESSORALLIANCEID": parsedDict[key] = EveIDToName.GetIDToName(valueAsLong); break; case "CLONESTATIONID": case "CORPSTATIONID": case "LOCATIONID": case "STRUCTUREID": case "EXTERNALID2": parsedDict[key] = EveIDToStation.GetIDToStation(valueAsLong)?.Name ?? EveMonConstants.UnknownText; break; case "SOLARSYSTEMID": // If it overflows the result will be invalid anyways parsedDict[key] = StaticGeography.GetSolarSystemName((int)valueAsLong); break; case "SHIPTYPEID": case "TYPEID": case "STRUCTURETYPEID": case "VICTIMSHIPTYPEID": // If it overflows the result will be invalid anyways parsedDict[key] = StaticItems.GetItemName((int)valueAsLong); break; case "MEDALID": var medal = notification.CCPCharacter.CharacterMedals.FirstOrDefault(x => (x.ID.ToString() == value)); parsedDict[key] = medal?.Title ?? EveMonConstants.UnknownText; parsedDict.Add("medalDescription", medal?.Description ?? EveMonConstants.UnknownText); break; case "AMOUNT": case "ISKVALUE": // Format as ISK amount if (value.TryParseInv(out amount)) { parsedDict[key] = amount.ToString("N2"); } break; case "ENDDATE": case "STARTDATE": case "DECLOAKTIME": case "DESTRUCTTIME": case "TIMEFINISHED": parsedDict[key] = string.Format(CultureConstants.InvariantCulture, "{0:dddd, MMMM d, yyyy HH:mm} (EVE Time)", valueAsLong. WinTimeStampToDateTime()); break; case "NOTIFICATION_CREATED": parsedDict[key] = string.Format(CultureConstants.InvariantCulture, "{0:dddd, MMMM d, yyyy HH:mm} (EVE Time)", timestamp); break; case "DUEDATE": case "ISSUEDATE": parsedDict[key] = string.Format(CultureConstants.InvariantCulture, "{0:dddd, MMMM d, yyyy} (EVE Time)", valueAsLong.WinTimeStampToDateTime()); break; case "CAMPAIGNEVENTTYPE": switch (value) { case "1": parsedDict[key] = "Territorial Claim Unit"; break; case "2": parsedDict[key] = "Infrastructure Hub"; break; case "3": parsedDict[key] = "Station"; break; default: parsedDict[key] = EveMonConstants.UnknownText; break; } break; case "TYPEIDS": typeIDs = pair.Value as YamlSequenceNode; if (typeIDs != null && (typeID == 56 || typeID == 57)) { parsedDict[key] = BuildImplantList(typeIDs); } break; case "LISTOFTYPESANDQTY": typeIDs = pair.Value as YamlSequenceNode; if (typeIDs != null) { parsedDict[key] = BuildItemList(typeIDs); } break; case "ISHOUSEWARMINGGIFT": // Tritanium parsedDict[key] = StaticItems.GetItemName(typeID); break; case "LEVEL": if (value.TryParseInv(out valueAsDouble)) { parsedDict[key] = Standing.Status(valueAsDouble) + " Standing"; } break; case "SHIELDVALUE": case "ARMORVALUE": case "HULLVALUE": if (value.TryParseInv(out valueAsDouble)) { parsedDict[key] = (valueAsDouble * 100.0).ToString("N0"); } break; } }
/// <summary> /// Updates the extra data shown on screen. /// </summary> private void UpdateExtraData() { string extraText = string.Empty; var ccpCharacter = Character as CCPCharacter; if (m_showLocation) { // Determine the character's system location int locID = Character?.LastKnownLocation?.SolarSystemID ?? 0; if (locID == 0) { extraText = EveMonConstants.UnknownText + " Location"; } else { extraText = StaticGeography.GetSolarSystemName(locID); } } else if (m_showJobs && ccpCharacter != null) { int jobs, max, indJobs = 0, resJobs = 0, reaJobs = 0; string desc; // Sum up by type foreach (var job in ccpCharacter.CharacterIndustryJobs) { switch (job.Activity) { case BlueprintActivity.Reactions: case BlueprintActivity.SimpleReactions: reaJobs++; break; case BlueprintActivity.Manufacturing: indJobs++; break; case BlueprintActivity.Copying: case BlueprintActivity.Duplicating: case BlueprintActivity.Invention: case BlueprintActivity.ResearchingMaterialEfficiency: case BlueprintActivity.ResearchingTechnology: case BlueprintActivity.ResearchingTimeEfficiency: case BlueprintActivity.ReverseEngineering: resJobs++; break; default: break; } } // Determine the character's jobs remaining (character only) switch ((DateTime.UtcNow.Second / INTERVAL) % 3) { case 0: default: // Industry max = IndustryJob.MaxManufacturingJobsFor(ccpCharacter); jobs = indJobs; desc = "Indus"; break; case 1: // Research max = IndustryJob.MaxResearchJobsFor(ccpCharacter); jobs = resJobs; desc = "Resea"; break; case 2: // Reaction max = IndustryJob.MaxReactionJobsFor(ccpCharacter); jobs = reaJobs; desc = "React"; break; } extraText = string.Format("{0:D} / {1:D} {2}", jobs, max, desc); } lblExtraInfo.Text = extraText; }
/// <summary> /// Parses the notification text. /// </summary> /// <param name="notification">The notification.</param> /// <param name="pair">The pair.</param> /// <param name="parsedDict">The parsed dictionary.</param> public override void Parse(EveNotification notification, KeyValuePair <YamlNode, YamlNode> pair, IDictionary <string, string> parsedDict) { string key = pair.Key.ToString(), value = pair.Value.ToString(); switch (key.ToUpperInvariant()) { case "CHARID": case "SENDERCHARID": case "RECEIVERCHARID": case "OWNERID": case "LOCATIONOWNERID": case "DESTROYERID": case "INVOKINGCHARID": case "PODKILLERID": case "NEWCEOID": case "OLDCEOID": case "CORPID": case "VICTIMID": parsedDict[key] = EveIDToName.GetIDToName(long.Parse(value)); break; case "CLONESTATIONID": case "CORPSTATIONID": case "LOCATIONID": parsedDict[key] = EveIDToStation.GetIDToStation(long.Parse(value))?.Name ?? EveMonConstants.UnknownText; break; case "SOLARSYSTEMID": parsedDict[key] = StaticGeography.GetSolarSystemName(int.Parse(value)); break; case "SHIPTYPEID": case "TYPEID": case "STRUCTURETYPEID": case "VICTIMSHIPTYPEID": parsedDict[key] = StaticItems.GetItemName(int.Parse(value)); break; case "MEDALID": var medal = notification.CCPCharacter.CharacterMedals.FirstOrDefault(x => (x.ID.ToString() == value)); parsedDict[key] = medal?.Title ?? EveMonConstants.UnknownText; parsedDict.Add("medalDescription", medal?.Description ?? EveMonConstants.UnknownText); break; case "ENDDATE": case "STARTDATE": case "DECLOAKTIME": parsedDict[key] = string.Format(CultureConstants.InvariantCulture, "{0:dddd, MMMM d, yyyy HH:mm} (EVE Time)", long.Parse(value). WinTimeStampToDateTime()); break; case "NOTIFICATION_CREATED": parsedDict[key] = string.Format(CultureConstants.InvariantCulture, "{0:dddd, MMMM d, yyyy} (EVE Time)", long.Parse(value). WinTimeStampToDateTime()); break; case "CAMPAIGNEVENTTYPE": switch (value) { case "1": parsedDict[key] = "Territorial Claim Unit"; break; case "2": parsedDict[key] = "Infrastructure Hub"; break; case "3": parsedDict[key] = "Station"; break; default: parsedDict[key] = EveMonConstants.UnknownText; break; } break; case "TYPEIDS": YamlSequenceNode typeIDs = pair.Value as YamlSequenceNode; if (typeIDs == null) { break; } switch (notification.TypeID) { case 56: case 57: { if (!typeIDs.Any()) { parsedDict[key] = "None were in the clone"; } else { StringBuilder sb = new StringBuilder(); foreach (var typeID in typeIDs) { int type = 0; int.TryParse(typeID.ToString(), out type); sb.AppendLine().AppendLine($"Type: {StaticItems.GetItemName(type)}"); } parsedDict[key] = sb.ToString(); } } break; } break; case "ISHOUSEWARMINGGIFT": if (Convert.ToBoolean(pair.Value) && notification.TypeID == 34) { // Tritanium parsedDict[key] = StaticItems.GetItemName(notification.TypeID); } break; case "LEVEL": parsedDict[key] = $"{Standing.Status(double.Parse(value))} Standing"; break; } }
/// <summary> /// Draws the list item for the given standing /// </summary> /// <param name="contact"></param> /// <param name="e"></param> private void DrawItem(Contact contact, DrawItemEventArgs e) { Graphics g = e.Graphics; // Draw background g.FillRectangle(e.Index % 2 == 0 ? Brushes.White : Brushes.LightGray, e.Bounds); // Measure and draw contact name Size contactTextSize = TextRenderer.MeasureText(g, contact.Name, m_contactsBoldFont, Size.Empty, Format); TextRenderer.DrawText(g, contact.Name, m_contactsBoldFont, new Rectangle( e.Bounds.Left + contact.EntityImage.Width + 4, e.Bounds.Top + (contact.Group == ContactGroup.Agent ? PadTop : (e.Bounds.Height - contactTextSize.Height) / 2), contactTextSize.Width + PadLeft, contactTextSize.Height), Color.Black); // Draw text for agents if (contact.Group == ContactGroup.Agent) { Agent agent = StaticGeography.GetAgentByName(contact.Name); if (agent != null) { Station agentStation = agent.Station; string agentLocationText = agentStation != null ? agentStation.Name : agent.Station.Name; // Determine the agent level and division string agentLevelText = (agent.AgentType != AgentType.BasicAgent && agent.AgentType != AgentType.ResearchAgent) ? agent.AgentType. GetDescription() : $"Level {Skill.GetRomanFromInt(agent.Level)}"; string agentLevelDivisionText = $"( {agentLevelText} - {agent.Division} )"; // Calculate text size Size agentLocationTextSize = TextRenderer.MeasureText(g, agentLocationText, m_contactsFont, Size.Empty, Format); Size agentLevelDivisionTextSize = TextRenderer.MeasureText(g, agentLevelDivisionText, m_contactsFont, Size.Empty, Format); // Draw agent level and division text TextRenderer.DrawText(g, agentLevelDivisionText, m_contactsFont, new Rectangle(e.Bounds.Left + contact.EntityImage.Width + 4 + contactTextSize.Width + PadRight, e.Bounds.Top + PadTop, agentLevelDivisionTextSize.Width + PadLeft, agentLevelDivisionTextSize.Height), Color.Black, Format); // Draw agent location TextRenderer.DrawText(g, agentLocationText, m_contactsFont, new Rectangle( e.Bounds.Left + contact.EntityImage.Width + 4, e.Bounds.Top + PadTop + agentLevelDivisionTextSize.Height, agentLocationTextSize.Width + PadLeft, agentLocationTextSize.Height), Color.Black); } } else if (Settings.UI.SafeForWork) { string contactStandingStatusText = $"({Standing.Status(contact.Standing)})"; // Measure and draw standing text Size contactStandingStatusTextSize = TextRenderer.MeasureText(g, contactStandingStatusText, m_contactsFont, Size.Empty, Format); TextRenderer.DrawText(g, contactStandingStatusText, m_contactsFont, new Rectangle(e.Bounds.Left + contact.EntityImage.Width + 4 + contactTextSize.Width + PadRight, e.Bounds.Top + (e.Bounds.Height - contactStandingStatusTextSize.Height) / 2, contactStandingStatusTextSize. Width + PadLeft, contactStandingStatusTextSize.Height), Color.Black); // Draw watchlist text if (contact.IsInWatchlist) { const string ContactInWatchListText = " - Watching"; Size contactInWatchListTextSize = TextRenderer.MeasureText(g, ContactInWatchListText, m_contactsFont, Size.Empty, Format); TextRenderer.DrawText(g, ContactInWatchListText, m_contactsFont, new Rectangle(e.Bounds.Left + contact.EntityImage.Width + 4 + contactTextSize.Width + contactStandingStatusTextSize.Width + PadRight, e.Bounds.Top + (e.Bounds.Height - contactStandingStatusTextSize.Height) / 2, contactInWatchListTextSize.Width + PadLeft, contactInWatchListTextSize.Height), Color.Black); } } else { // Draw standing image Image standingImage = Standing.GetStandingImage((int)contact.Standing); g.DrawImage(standingImage, new Rectangle(e.Bounds.Left + contact.EntityImage. Width + 4 + contactTextSize.Width + PadRight * 2, e.Bounds.Top + (e.Bounds. Height - standingImage.Size.Height) / 2, standingImage.Width, standingImage.Height)); // Draw watchlist image if (contact.IsInWatchlist) { g.DrawImage(Resources.Watch, new Rectangle(e.Bounds.Left + contact. EntityImage.Width + 4 + contactTextSize.Width + standingImage.Width + PadRight * 3, e.Bounds.Top + (e.Bounds.Height - Resources.Watch. Height) / 2, Resources.Watch.Width, Resources.Watch.Height)); } } // Draw images if (!Settings.UI.SafeForWork) { g.DrawImage(contact.EntityImage, new Rectangle(e.Bounds.Left + PadLeft / 2, ContactDetailHeight / 2 - contact.EntityImage.Height / 2 + e.Bounds.Top, contact.EntityImage.Width, contact.EntityImage.Height)); } }
/// <summary> /// Update the controls. /// </summary> private void UpdateContent() { if (!Visible) { return; } // Update character's 'Adorned Name' and 'Portrait' in case they have changed lblCharName.Text = Character.LabelPrefix + Character.AdornedName; pbCharacterPortrait.Character = Character; lblTotalSkillPoints.Text = string.Format("{0:N0} SP", Character.SkillPoints); FormatBalance(); CCPCharacter ccpCharacter = Character as CCPCharacter; QueuedSkill trainingSkill = Character.CurrentlyTrainingSkill; // Character in training ? We have labels to fill if (Character.IsTraining || (ccpCharacter != null && trainingSkill != null && ccpCharacter.SkillQueue.IsPaused)) { // Update the skill in training label lblSkillInTraining.Text = trainingSkill.ToString(); DateTime endTime = trainingSkill.EndTime.ToLocalTime(); // Updates the time remaining label lblRemainingTime.Text = (ccpCharacter != null && ccpCharacter.SkillQueue. IsPaused) ? "Paused" : trainingSkill.RemainingTime.ToDescriptiveText( DescriptiveTextOptions.IncludeCommas); // Update the completion time lblCompletionTime.Text = (ccpCharacter != null && ccpCharacter.SkillQueue. IsPaused) ? string.Empty : $"{endTime:ddd} {endTime:G}"; // Changes the completion time color on scheduling block string blockingEntry; bool isAutoBlocking; bool isBlocking = Scheduler.SkillIsBlockedAt(endTime, out blockingEntry, out isAutoBlocking); lblCompletionTime.ForeColor = (m_showConflicts && isBlocking && (ccpCharacter == null || ccpCharacter.SkillQueue.Count == 1 || !isAutoBlocking)) ? Color.Red : m_settingsForeColor; // Update the skill queue training time label UpdateSkillQueueTrainingTime(); // Show the training labels m_hasSkillInTraining = true; m_hasCompletionTime = true; m_hasRemainingTime = true; m_hasSkillQueueTrainingTime = true; } else { // Hide the training labels m_hasSkillInTraining = false; m_hasCompletionTime = false; m_hasRemainingTime = false; m_hasSkillQueueTrainingTime = false; } // Determine the character's system location int locID = Character?.LastKnownLocation?.SolarSystemID ?? 0; string locText; if (locID == 0) { locText = EveMonConstants.UnknownText + " Location"; } else { locText = StaticGeography.GetSolarSystemName(locID); } lblLocation.Text = locText; // Adjusts all the controls layout PerformCustomLayout(m_isTooltip); }
public SerializableWalletJournalListItem ToXMLItem() { // This is never actually used in EveMon! string argName1 = string.Empty; long argId1 = 0L; // Populate arguments from the extra data based on the ref type // See http://eveonline-third-party-documentation.readthedocs.io/en/latest/xmlapi/constants.html#reference-type switch (refType) { case EsiRefTypeString.player_trading: argId1 = ContextID; break; case EsiRefTypeString.market_transaction: argName1 = ContextID.ToString(CultureInfo.InvariantCulture); break; case EsiRefTypeString.office_rental_fee: case EsiRefTypeString.brokers_fee: case EsiRefTypeString.jump_clone_installation_fee: case EsiRefTypeString.jump_clone_activation_fee: case EsiRefTypeString.reprocessing_tax: argName1 = "EVE System"; argId1 = 1L; break; case EsiRefTypeString.bounty_prize: argId1 = ContextID; break; case EsiRefTypeString.insurance: argName1 = ContextID.ToString(CultureInfo.InvariantCulture); break; case EsiRefTypeString.agent_mission_reward: case EsiRefTypeString.agent_mission_time_bonus_reward: case EsiRefTypeString.cspa: case EsiRefTypeString.corporation_account_withdrawal: case EsiRefTypeString.medal_creation: case EsiRefTypeString.medal_issued: argId1 = ContextID; break; case EsiRefTypeString.corporation_logo_change_cost: argId1 = ContextID; break; case EsiRefTypeString.alliance_maintainance_fee: argId1 = ContextID; break; case EsiRefTypeString.manufacturing: argName1 = ContextID.ToString(CultureInfo.InvariantCulture); break; case EsiRefTypeString.contract_auction_bid: case EsiRefTypeString.contract_auction_bid_refund: case EsiRefTypeString.contract_price: case EsiRefTypeString.contract_brokers_fee: case EsiRefTypeString.contract_sales_tax: case EsiRefTypeString.contract_deposit: case EsiRefTypeString.contract_price_payment_corp: case EsiRefTypeString.contract_brokers_fee_corp: case EsiRefTypeString.contract_deposit_corp: case EsiRefTypeString.contract_deposit_refund: argName1 = ContextID.ToString(CultureInfo.InvariantCulture); break; case EsiRefTypeString.bounty_prizes: argId1 = ContextID; break; case EsiRefTypeString.planetary_import_tax: case EsiRefTypeString.planetary_export_tax: argId1 = ContextID; // Planet name available from geography argName1 = StaticGeography.GetPlanetByID((int)ContextID)?.Name ?? EveMonConstants.UnknownText; break; case EsiRefTypeString.industry_job_tax: argId1 = ContextID; break; default: // Empty break; } return(new SerializableWalletJournalListItem() { Amount = Amount, ArgID1 = argId1, ArgName1 = argName1, Balance = Balance, Date = Date, ID = ID, Reason = Reason, OwnerID1 = OwnerID1, OwnerID2 = OwnerID2, RefTypeID = RefTypeID, TaxAmount = TaxAmount, TaxReceiverID = TaxReceiverID }); }