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); }
/// <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> /// 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> /// 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); }
/// <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> /// 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; }