Exemplo n.º 1
0
 /// <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);
     }
 }
Exemplo n.º 2
0
        /// <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);
        }
Exemplo n.º 3
0
 /// <summary>
 /// Updates the location.
 /// </summary>
 /// <returns></returns>
 public void UpdateLocation(CCPCharacter character)
 {
     // If location not already determined
     if (m_installedItemLocationID != 0L && (SolarSystem == null || SolarSystem.ID == 0))
     {
         var station = EveIDToStation.GetIDToStation(m_installedItemLocationID,
                                                     character);
         SolarSystem = station?.SolarSystem ?? SolarSystem.UNKNOWN;
     }
 }
Exemplo n.º 4
0
 /// <summary>
 /// Updates the location.
 /// </summary>
 /// <returns></returns>
 public void UpdateLocation()
 {
     // If location not already determined
     if (m_installedItemLocationID != 0L && SolarSystem == null)
     {
         Station station = EveIDToStation.GetIDToStation(m_installedItemLocationID);
         if (station != null)
         {
             SolarSystem = station.SolarSystem;
         }
     }
 }
Exemplo n.º 5
0
        /// <summary>
        /// Gets the station.
        /// </summary>
        /// <param name="id">The ID of the installation.</param>
        /// <returns>Name of the installation.</returns>
        private string GetInstallation(long id)
        {
            return(EveIDToStation.GetIDToStation(id)?.Name ?? EveMonConstants.UnknownText);

            // Starbase assembly structures can no longer be used

            /*return station == null
             *  ? Activity == BlueprintActivity.Manufacturing
             *      ? "POS - Assembly Array"
             *      : "POS - Laboratory"
             *  : outpost != null
             *      ? outpost.FullName
             *      : station.Name;*/
        }
Exemplo n.º 6
0
 /// <summary>
 /// Updates the location.
 /// </summary>
 /// <returns></returns>
 public void UpdateLocation(CCPCharacter character)
 {
     // If location not already determined
     if (m_installedItemLocationID != 0L && (SolarSystem == null || SolarSystem.ID == 0))
     {
         var station = EveIDToStation.GetIDToStation(m_installedItemLocationID,
                                                     character);
         if (station != null)
         {
             SolarSystem = station.SolarSystem;
         }
         else
         {
             SolarSystem = new SolarSystem();
         }
     }
 }
Exemplo n.º 7
0
        /// <summary>
        /// Imports data from an ESI deserialization object.
        /// </summary>
        public void Import(EsiAPIClones serial)
        {
            if (serial == null)
            {
                return;
            }

            m_cloneSets.Clear();
            // Jump clones
            foreach (var clone in serial.JumpClones)
            {
                int    cloneID = clone.JumpCloneID;
                string name    = clone.Name;
                // Try to pick a sane name if it is null
                if (string.IsNullOrEmpty(name))
                {
                    var location = EveIDToStation.GetIDToStation(clone.LocationID);
                    if (location == null)
                    {
                        name = "Clone at location #" + clone.LocationID.ToString(CultureInfo.
                                                                                 InvariantCulture);
                    }
                    else
                    {
                        name = "Clone in " + location.Name;
                    }
                }
                ImplantSet set = new ImplantSet(m_character, name);
                // Jump clone implants
                var jcImplants = new LinkedList <SerializableNewImplant>();
                foreach (int implant in clone.Implants)
                {
                    jcImplants.AddLast(new SerializableNewImplant()
                    {
                        ID   = implant,
                        Name = StaticItems.GetItemName(implant)
                    });
                }
                set.Import(jcImplants);
                m_cloneSets.Add(set);
            }

            EveMonClient.OnCharacterImplantSetCollectionChanged(m_character);
        }
Exemplo n.º 8
0
 /// <summary>
 /// Creates a clone name if it is blank.
 /// </summary>
 /// <param name="name">The current clone name</param>
 /// <param name="locationID">The clone location</param>
 /// <returns>A name for this clone, using a default if none is given</returns>
 private string GetCloneName(string name, long locationID)
 {
     // Try to pick a sane name if it is null
     if (string.IsNullOrEmpty(name))
     {
         var location = EveIDToStation.GetIDToStation(locationID, m_character as
                                                      CCPCharacter);
         if (location == null)
         {
             name = "Clone at location #" + locationID.ToString(CultureInfo.
                                                                InvariantCulture);
         }
         else
         {
             name = "Clone in " + location.Name;
         }
     }
     return(name);
 }
Exemplo n.º 9
0
        /// <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;
            }
        }
Exemplo n.º 10
0
 /// <summary>
 /// Updates the station.
 /// </summary>
 public void UpdateStation()
 {
     Station = EveIDToStation.GetIDToStation(m_stationID);
 }
Exemplo n.º 11
0
 /// <summary>
 /// Gets the station.
 /// </summary>
 /// <param name="id">The ID of the installation.</param>
 /// <returns>Name of the installation.</returns>
 private string GetInstallation(long id, CCPCharacter character)
 {
     return(EveIDToStation.GetIDToStation(id, character)?.Name ?? EveMonConstants.
            UnknownText);
 }
Exemplo n.º 12
0
 /// <summary>
 /// Updates the station.
 /// </summary>
 public void UpdateStation()
 {
     StartStation = EveIDToStation.GetIDToStation(m_startStationID, Character);
     EndStation   = EveIDToStation.GetIDToStation(m_endStationID, Character);
 }
Exemplo n.º 13
0
 /// <summary>
 /// Updates the station.
 /// </summary>
 public void UpdateStation()
 {
     Station = EveIDToStation.GetIDToStation(m_stationID, m_character);
 }
Exemplo n.º 14
0
        /// <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;
            }
        }
Exemplo n.º 15
0
        /// <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":
            {
                parsedDict[key] = EveIDToName.GetIDToName(long.Parse(value));
                break;
            }

            case "CLONESTATIONID":
            case "CORPSTATIONID":
            case "LOCATIONID":
            {
                parsedDict[key] = EveIDToStation.GetIDToStation(long.Parse(value)).Name;
                break;
            }

            case "SHIPTYPEID":
            case "TYPEID":
            {
                parsedDict[key] = StaticItems.GetItemByID(int.Parse(value)).Name;
                break;
            }

            case "MEDALID":
            {
                var medal = notification.CCPCharacter.CharacterMedals
                            .FirstOrDefault(x => x.ID.ToString() == value);

                parsedDict[key] = medal == null
                        ? EveMonConstants.UnknownText
                        : medal.Title ?? EveMonConstants.UnknownText;
                parsedDict.Add("medalDescription", medal == null
                        ? EveMonConstants.UnknownText
                        : medal.Description ?? EveMonConstants.UnknownText);
                break;
            }

            case "ENDDATE":
            case "STARTDATE":
            {
                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 "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)
                        {
                            sb
                            .AppendLine()
                            .AppendLine($"Type: {StaticItems.GetItemByID(int.Parse(typeID.ToString())).Name}");
                        }
                        parsedDict[key] = sb.ToString();
                    }
                }
                break;
                }
                break;
            }

            case "ISHOUSEWARMINGGIFT":
            {
                if (!Convert.ToBoolean(pair.Value))
                {
                    break;
                }

                switch (notification.TypeID)
                {
                case 34:
                    // Tritanium
                    parsedDict[key] = StaticItems.GetItemByID(34).Name;
                    break;
                }
                break;
            }

            case "LEVEL":
            {
                parsedDict[key] = $"{Standing.Status(double.Parse(value))} Standing";
                break;
            }
            }
        }