public DestinyUserActivity(DestinyActivity destinyActivity, DestinyActivityDefinition definition,
                                   DestinyActivityModeDefinition modeDefinition, string characterId)
        {
            /*
             * Download and unpack world database
             * /common/destiny2_content/sqlite/en/world_sql_content_7227d0c5fd50443c8dd9e2e35f353f69.content
             * mode maps to modeType in DestinyActivityModeDefinition (game type)
             * referenceId maps to hash in DestinyActivityDefinition (map)
             * directoryActivityHash maps to hash in DestinyActivityDefinition (playlist)
             *
             * activity definitions
             * https://bungie-net.github.io/multi/schema_Destiny-HistoricalStats-Definitions-DestinyActivityModeType.html#schema_Destiny-HistoricalStats-Definitions-DestinyActivityModeType
             */

            var activityId      = destinyActivity.ActivityDetails.InstanceId;
            var contentUrl      = $"https://www.bungie.net/en/PGCR/{activityId}?character={characterId}";
            var gameTypeIconUrl = $"https://www.bungie.net{modeDefinition.DisplayProperties.Icon}";
            var gameType        = modeDefinition.DisplayProperties.Name;
            var map             = definition.DisplayProperties.Name;
            var startTime       = destinyActivity.Period;
            var endTime         = destinyActivity.Period.AddSeconds(destinyActivity.Values["activityDurationSeconds"].Basic.Value);
            var mapImageUrl     = $"https://www.bungie.net{definition.PgcrImage}";
            var placement       = destinyActivity.Values["standing"].Basic.DisplayValue;
            var placementColour = placement == "Victory" || placement == "1" ? AdaptiveTextColor.Good : AdaptiveTextColor.Attention;
            var stat1Name       = "Efficiency";
            var stat1Value      = destinyActivity.Values["efficiency"].Basic.DisplayValue;
            var stat2Name       = "Opponents Defeated";
            var stat2Value      = destinyActivity.Values["opponentsDefeated"].Basic.DisplayValue;

            Activity = BuildActivity(activityId, contentUrl, gameTypeIconUrl, gameType, map, startTime,
                                     endTime, mapImageUrl, placementColour, placement, stat1Name, stat1Value, stat2Name,
                                     stat2Value);
        }
Пример #2
0
 public bool DeepEquals(TrendingDetail?other)
 {
     return(other is not null &&
            Identifier == other.Identifier &&
            EntityType == other.EntityType &&
            (News is not null ? News.DeepEquals(other.News) : other.News is null) &&
            (Support is not null ? Support.DeepEquals(other.Support) : other.Support is null) &&
            (DestinyItem is not null ? DestinyItem.DeepEquals(other.DestinyItem) : other.DestinyItem is null) &&
            (DestinyActivity is not null ? DestinyActivity.DeepEquals(other.DestinyActivity) : other.DestinyActivity is null) &&
            (DestinyRitual is not null ? DestinyRitual.DeepEquals(other.DestinyRitual) : other.DestinyRitual is null) &&
            (Creation is not null ? Creation.DeepEquals(other.Creation) : other.Creation is null));
 }
Пример #3
0
 public void Update(TrendingDetail?other)
 {
     if (other is null)
     {
         return;
     }
     if (Identifier != other.Identifier)
     {
         Identifier = other.Identifier;
         OnPropertyChanged(nameof(Identifier));
     }
     if (EntityType != other.EntityType)
     {
         EntityType = other.EntityType;
         OnPropertyChanged(nameof(EntityType));
     }
     if (!News.DeepEquals(other.News))
     {
         News.Update(other.News);
         OnPropertyChanged(nameof(News));
     }
     if (!Support.DeepEquals(other.Support))
     {
         Support.Update(other.Support);
         OnPropertyChanged(nameof(Support));
     }
     if (!DestinyItem.DeepEquals(other.DestinyItem))
     {
         DestinyItem.Update(other.DestinyItem);
         OnPropertyChanged(nameof(DestinyItem));
     }
     if (!DestinyActivity.DeepEquals(other.DestinyActivity))
     {
         DestinyActivity.Update(other.DestinyActivity);
         OnPropertyChanged(nameof(DestinyActivity));
     }
     if (!DestinyRitual.DeepEquals(other.DestinyRitual))
     {
         DestinyRitual.Update(other.DestinyRitual);
         OnPropertyChanged(nameof(DestinyRitual));
     }
     if (!Creation.DeepEquals(other.Creation))
     {
         Creation.Update(other.Creation);
         OnPropertyChanged(nameof(Creation));
     }
 }