Esempio n. 1
0
        /// <inheritdoc />
        public void ShowAvailableQuests()
        {
            if (this.player.OpenedNpc == null)
            {
                return;
            }

            var totalQuests = this.player.OpenedNpc.Definition.Quests.Where(q => q.MinimumCharacterLevel <= this.player.Level && q.MaximumCharacterLevel >= this.player.Level).ToList();
            var questCount  = totalQuests.Count;

            using var writer = this.player.Connection.StartSafeWrite(AvailableQuests.HeaderType, AvailableQuests.GetRequiredSize(questCount));
            var message = new AvailableQuests(writer.Span)
            {
                QuestCount     = (ushort)questCount,
                QuestNpcNumber = (ushort)this.player.OpenedNpc?.Definition.Number,
            };

            for (int i = 0; i < questCount; i++)
            {
                var block = message[i];
                var quest = totalQuests[i];
                block.Number = (ushort)quest.Number;
                block.Group  = (ushort)quest.Group;
            }

            writer.Commit();
        }
Esempio n. 2
0
        /// <inheritdoc />
        public void ShowAvailableQuests()
        {
            if (this.player.OpenedNpc is null)
            {
                return;
            }

            var totalQuests = this.player.GetAvailableQuestsOfOpenedNpc().ToList();
            var questCount  = totalQuests.Count;

            using var writer = this.player.Connection.StartSafeWrite(AvailableQuests.HeaderType, AvailableQuests.GetRequiredSize(questCount));
            var message = new AvailableQuests(writer.Span)
            {
                QuestCount     = (ushort)questCount,
                QuestNpcNumber = (ushort)this.player.OpenedNpc.Definition.Number,
            };

            for (int i = 0; i < questCount; i++)
            {
                var block = message[i];
                var quest = totalQuests[i];
                block.Number = (ushort)quest.StartingNumber;
                block.Group  = (ushort)quest.Group;
            }

            writer.Commit();
        }
        /// <summary>
        /// Updates the <see cref="Control"/>. This is called for every <see cref="Control"/>, even if it is disabled or
        /// not visible.
        /// </summary>
        /// <param name="currentTime">The current time in milliseconds.</param>
        protected override void UpdateControl(TickCount currentTime)
        {
            base.UpdateControl(currentTime);

            // If there are no quests listed, close the form
            if (AvailableQuests.IsEmpty())
                IsVisible = false;
        }
 public void Update(DestinyMilestone?other)
 {
     if (other is null)
     {
         return;
     }
     if (MilestoneHash != other.MilestoneHash)
     {
         MilestoneHash = other.MilestoneHash;
         OnPropertyChanged(nameof(MilestoneHash));
     }
     if (!AvailableQuests.DeepEqualsList(other.AvailableQuests))
     {
         AvailableQuests = other.AvailableQuests;
         OnPropertyChanged(nameof(AvailableQuests));
     }
     if (!Activities.DeepEqualsList(other.Activities))
     {
         Activities = other.Activities;
         OnPropertyChanged(nameof(Activities));
     }
     if (!Values.DeepEqualsDictionaryNaive(other.Values))
     {
         Values = other.Values;
         OnPropertyChanged(nameof(Values));
     }
     if (!VendorHashes.DeepEqualsListNaive(other.VendorHashes))
     {
         VendorHashes = other.VendorHashes;
         OnPropertyChanged(nameof(VendorHashes));
     }
     if (!Vendors.DeepEqualsList(other.Vendors))
     {
         Vendors = other.Vendors;
         OnPropertyChanged(nameof(Vendors));
     }
     if (!Rewards.DeepEqualsList(other.Rewards))
     {
         Rewards = other.Rewards;
         OnPropertyChanged(nameof(Rewards));
     }
     if (StartDate != other.StartDate)
     {
         StartDate = other.StartDate;
         OnPropertyChanged(nameof(StartDate));
     }
     if (EndDate != other.EndDate)
     {
         EndDate = other.EndDate;
         OnPropertyChanged(nameof(EndDate));
     }
     if (Order != other.Order)
     {
         Order = other.Order;
         OnPropertyChanged(nameof(Order));
     }
 }
Esempio n. 5
0
        //TODO: Should use just quest Id
        public Location AddQuest(Quest quest)
        {
            var existing = AvailableQuests.FirstOrDefault(x => x.Id == quest.Id);

            if (existing == null)
            {
                AvailableQuests.Add(quest);
            }

            return(this);
        }
Esempio n. 6
0
 public bool DeepEquals(DestinyPublicMilestone?other)
 {
     return(other is not null &&
            MilestoneHash == other.MilestoneHash &&
            AvailableQuests.DeepEqualsList(other.AvailableQuests) &&
            Activities.DeepEqualsList(other.Activities) &&
            VendorHashes.DeepEqualsListNaive(other.VendorHashes) &&
            Vendors.DeepEqualsList(other.Vendors) &&
            StartDate == other.StartDate &&
            EndDate == other.EndDate &&
            Order == other.Order);
 }
Esempio n. 7
0
        public bool Equals(DestinyMilestone input)
        {
            if (input == null)
            {
                return(false);
            }

            return
                ((
                     MilestoneHash == input.MilestoneHash ||
                     (MilestoneHash.Equals(input.MilestoneHash))
                     ) &&
                 (
                     AvailableQuests == input.AvailableQuests ||
                     (AvailableQuests != null && AvailableQuests.SequenceEqual(input.AvailableQuests))
                 ) &&
                 (
                     Activities == input.Activities ||
                     (Activities != null && Activities.SequenceEqual(input.Activities))
                 ) &&
                 (
                     Values == input.Values ||
                     (Values != null && Values.SequenceEqual(input.Values))
                 ) &&
                 (
                     VendorHashes == input.VendorHashes ||
                     (VendorHashes != null && VendorHashes.SequenceEqual(input.VendorHashes))
                 ) &&
                 (
                     Vendors == input.Vendors ||
                     (Vendors != null && Vendors.SequenceEqual(input.Vendors))
                 ) &&
                 (
                     Rewards == input.Rewards ||
                     (Rewards != null && Rewards.SequenceEqual(input.Rewards))
                 ) &&
                 (
                     StartDate == input.StartDate ||
                     (StartDate != null && StartDate.Equals(input.StartDate))
                 ) &&
                 (
                     EndDate == input.EndDate ||
                     (EndDate != null && EndDate.Equals(input.EndDate))
                 ) &&
                 (
                     Order == input.Order ||
                     (Order.Equals(input.Order))
                 ));
        }