Esempio n. 1
0
        public SerializableKillLogListItem ToXMLItem()
        {
            var ret = new SerializableKillLogListItem()
            {
                KillID        = KillID,
                KillTime      = KillTime,
                MoonID        = MoonID,
                SolarSystemID = SolarSystemID,
                Victim        = Victim?.ToXMLItem()
            };

            // Attackers
            if (Attackers != null)
            {
                foreach (var attacker in Attackers)
                {
                    ret.Attackers.Add(attacker.ToXMLItem());
                }
            }

            // Items
            if (Victim != null)
            {
                var items = Victim.Items;
                if (items != null)
                {
                    foreach (var item in items)
                    {
                        ret.Items.Add(item.ToXMLItem());
                    }
                }
            }

            return(ret);
        }
Esempio n. 2
0
        /// <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;
        }
Esempio n. 3
0
        /// <summary>
        /// Exports this object to a serializable form.
        /// </summary>
        /// <returns>The SerializableKillLogListItem representing this object.</returns>
        public SerializableKillLogListItem Export()
        {
            var exported = new SerializableKillLogListItem()
            {
                KillTime      = KillTime,
                MoonID        = MoonID,
                SolarSystemID = SolarSystem?.ID ?? 0,
                Victim        = Victim
            };

            // Export items
            foreach (var item in m_items)
            {
                exported.Items.Add(item.Export());
            }
            // Export attackers
            foreach (var attacker in Attackers)
            {
                exported.Attackers.Add(attacker);
            }
            return(exported);
        }