private void ShowNewAppointmentEditPage(IntervalInfo info)
        {
            AppointmentEditPage appEditPage = new AppointmentEditPage(info.Start, info.End,
                                                                      info.AllDay, this.storage);

            Navigation.PushAsync(appEditPage);
        }
Пример #2
0
 public bool DeepEquals(DestinyRecordDefinition other)
 {
     return(other != null &&
            DisplayProperties.DeepEquals(other.DisplayProperties) &&
            CompletionInfo.DeepEquals(other.CompletionInfo) &&
            ExpirationInfo.DeepEquals(other.ExpirationInfo) &&
            IntervalInfo.DeepEquals(other.IntervalInfo) &&
            StateInfo.DeepEquals(other.StateInfo) &&
            TitleInfo.DeepEquals(other.TitleInfo) &&
            Objectives.DeepEqualsReadOnlyCollections(other.Objectives) &&
            ParentNodes.DeepEqualsReadOnlyCollections(other.ParentNodes) &&
            PresentationNodeType == other.PresentationNodeType &&
            RecordValueStyle == other.RecordValueStyle &&
            Requirements.DeepEquals(other.Requirements) &&
            RewardItems.DeepEqualsReadOnlyCollections(other.RewardItems) &&
            Scope == other.Scope &&
            Traits.DeepEqualsReadOnlyCollections(other.Traits) &&
            TraitIds.DeepEqualsReadOnlySimpleCollection(other.TraitIds) &&
            Lore.DeepEquals(other.Lore) &&
            PresentationInfo.DeepEquals(other.PresentationInfo) &&
            ForTitleGilding == other.ForTitleGilding &&
            Blacklisted == other.Blacklisted &&
            Hash == other.Hash &&
            Index == other.Index &&
            Redacted == other.Redacted);
 }
Пример #3
0
        public bool AddDamage(int rounds, int time, int value)
        {
            time = Math.Max(time, Constants.JobCheckCreatureCompletionInterval);

            if (rounds == -1)
            {
                //periodic damage
                PeriodDamage = value;
                SetParam(ConditionParameters.TickInterval, time);
                SetParam(ConditionParameters.Ticks, -1);
                return(true);
            }

            if (PeriodDamage > 0)
            {
                return(false);
            }

            //rounds, time, damage
            for (int i = 0; i < rounds; ++i)
            {
                var damageInfo = new IntervalInfo {
                    Interval = time, TimeLeft = time, Value = value
                };
                DamageList.Add(damageInfo);

                if (Ticks != -1)
                {
                    SetTicks(Ticks + damageInfo.Interval);
                }
            }

            return(true);
        }
 public bool DeepEquals(DestinyRecordDefinition?other)
 {
     return(other is not null &&
            (DisplayProperties is not null ? DisplayProperties.DeepEquals(other.DisplayProperties) : other.DisplayProperties is null) &&
            Scope == other.Scope &&
            (PresentationInfo is not null ? PresentationInfo.DeepEquals(other.PresentationInfo) : other.PresentationInfo is null) &&
            LoreHash == other.LoreHash &&
            ObjectiveHashes.DeepEqualsListNaive(other.ObjectiveHashes) &&
            RecordValueStyle == other.RecordValueStyle &&
            ForTitleGilding == other.ForTitleGilding &&
            (TitleInfo is not null ? TitleInfo.DeepEquals(other.TitleInfo) : other.TitleInfo is null) &&
            (CompletionInfo is not null ? CompletionInfo.DeepEquals(other.CompletionInfo) : other.CompletionInfo is null) &&
            (StateInfo is not null ? StateInfo.DeepEquals(other.StateInfo) : other.StateInfo is null) &&
            (Requirements is not null ? Requirements.DeepEquals(other.Requirements) : other.Requirements is null) &&
            (ExpirationInfo is not null ? ExpirationInfo.DeepEquals(other.ExpirationInfo) : other.ExpirationInfo is null) &&
            (IntervalInfo is not null ? IntervalInfo.DeepEquals(other.IntervalInfo) : other.IntervalInfo is null) &&
            RewardItems.DeepEqualsList(other.RewardItems) &&
            PresentationNodeType == other.PresentationNodeType &&
            TraitIds.DeepEqualsListNaive(other.TraitIds) &&
            TraitHashes.DeepEqualsListNaive(other.TraitHashes) &&
            ParentNodeHashes.DeepEqualsListNaive(other.ParentNodeHashes) &&
            Hash == other.Hash &&
            Index == other.Index &&
            Redacted == other.Redacted);
 }
Пример #5
0
    public int GetFillId(bool isDeductStep = false)
    {
        FILL_COUNT++;

        if (id <= 10000 || isDeductStep)
        {
            lastFillId = GetRandomFillId();
            return(lastFillId);
        }

        for (int i = 0; i < copys.Count; i++)
        {
            CopyFillInfo copyFillInfo = copys[i];
            int          inRange      = copyFillInfo.InRange(FILL_COUNT);
            if (inRange > 0)
            {
                if (inRange == 2)
                {
                    //copys.RemoveAt (i);
                }
                return(lastFillId);
            }
        }

        if (specifics.ContainsKey(FILL_COUNT))
        {
            IFSInfo specific = specifics[FILL_COUNT];
            lastFillId = specific.GetFillId();
            return(lastFillId);
        }

        for (int i = 0; i < intervals.Count; i++)
        {
            IntervalInfo intervalInfo = intervals[i];
            int          inRange      = intervalInfo.InRange(FILL_COUNT);
            if (inRange > 0)
            {
                lastFillId = intervalInfo.GetFillId();
                if (inRange == 2)
                {
                    //intervals.RemoveAt (i);
                }
                return(lastFillId);
            }
        }

        if (defaultFill == null)
        {
            lastFillId = GetRandomFillId();
            return(lastFillId);
        }

        lastFillId = defaultFill.GetFillId();
        return(lastFillId);
    }
Пример #6
0
        public override sealed void AddCondition(Creature creature, Condition addCondition)
        {
            if (addCondition.ConditionType != ConditionType)
            {
                return;
            }

            if (!UpdateCondition(addCondition))
            {
                return;
            }

            var conditionDamage = (ConditionDamage)addCondition;

            SetTicks(addCondition.Ticks);
            Owner        = conditionDamage.Owner;
            MaxDamage    = conditionDamage.MaxDamage;
            MinDamage    = conditionDamage.MinDamage;
            StartDamage  = conditionDamage.StartDamage;
            TickInterval = conditionDamage.TickInterval;
            PeriodDamage = conditionDamage.PeriodDamage;
            int nextTimeLeft = TickInterval;

            if (DamageList.Count != 0)
            {
                //save previous timeLeft
                IntervalInfo damageInfo = DamageList[0];
                nextTimeLeft = damageInfo.TimeLeft;
                DamageList.Clear();
            }

            DamageList = conditionDamage.DamageList;

            if (Init())
            {
                if (DamageList.Count != 0)
                {
                    //restore last timeLeft
                    DamageList[0].TimeLeft = nextTimeLeft;
                }

                if (!Delayed)
                {
                    int damage;
                    if (GetNextDamage(out damage))
                    {
                        DoDamage(creature, damage);
                    }
                }
            }
        }
Пример #7
0
        public override sealed bool ExecuteCondition(Creature creature, int interval)
        {
            if (PeriodDamage != 0)
            {
                PeriodDamageTick += interval;

                if (PeriodDamageTick >= TickInterval)
                {
                    PeriodDamageTick = 0;
                    DoDamage(creature, PeriodDamage);
                }
            }
            else if (DamageList.Count != 0)
            {
                IntervalInfo damageInfo = DamageList[0];

                bool bRemove = (Ticks != -1);
                creature.OnTickCondition(ConditionType, ref bRemove);
                damageInfo.TimeLeft -= interval;

                if (damageInfo.TimeLeft <= 0)
                {
                    int damage = damageInfo.Value;

                    if (bRemove)
                    {
                        DamageList.RemoveAt(0);
                    }
                    else
                    {
                        damageInfo.TimeLeft = damageInfo.Interval;
                    }

                    DoDamage(creature, damage);
                }

                if (!bRemove)
                {
                    if (Ticks > 0)
                    {
                        EndTime += interval;
                    }

                    interval = 0;
                }
            }

            return(base.ExecuteCondition(creature, interval));
        }
Пример #8
0
    public void FillTxt(string content)
    {
        if (id <= 10000)
        {
            return;
        }
        if (content != null)
        {
            string[] txtArr = content.Split('\n');

            foreach (string txt in txtArr)
            {
                string[] txts = txt.Split('|');
                switch (txts[0].ToLower())
                {
                case "d":
                    defaultFill = new IFSInfo();
                    defaultFill.FillTxt(txts[2]);
                    break;

                case "g":
                    IntervalInfo intervalInfo = new IntervalInfo();
                    intervalInfo.FillTxt(txts[1], txts[2]);
                    intervals.Add(intervalInfo);
                    break;

                case "s":
                    IFSInfo iFSInfo = new IFSInfo();
                    int     step    = Convert.ToInt32(txts[1]);
                    iFSInfo.FillTxt(txts[2]);
                    specifics.Add(step, iFSInfo);
                    break;

                case "c":
                    CopyFillInfo copyInfo = new CopyFillInfo();
                    copyInfo.FillTxt(txts[1], txts[2]);
                    copys.Add(copyInfo);
                    break;
                }
            }
        }
    }
Пример #9
0
        public override sealed bool UnserializeProp(ConditionAttributions attr, MemoryStream propStream)
        {
            try
            {
                if (attr == ConditionAttributions.Delayed)
                {
                    Delayed = propStream.ReadBoolean();
                    return(true);
                }
                if (attr == ConditionAttributions.PeriodDamage)
                {
                    PeriodDamage = propStream.ReadInt32();
                    return(true);
                }
                if (attr == ConditionAttributions.Owner)
                {
                    propStream.ReadBytes(4);
                    return(true);
                }
                if (attr == ConditionAttributions.IntervalData)
                {
                    var damageInfo = new IntervalInfo
                    {
                        TimeLeft = propStream.ReadInt32(),
                        Value    = propStream.ReadInt32(),
                        Interval = propStream.ReadInt32(),
                    };
                    DamageList.Add(damageInfo);

                    if (Ticks != -1)
                    {
                        SetTicks(Ticks + damageInfo.Interval);
                    }
                    return(true);
                }
                return(base.UnserializeProp(attr, propStream));
            }
            catch (Exception)
            {
                return(false);
            }
        }
Пример #10
0
 protected bool GetNextDamage(out int damage)
 {
     damage = 0;
     if (PeriodDamage != 0)
     {
         damage = PeriodDamage;
         return(true);
     }
     if (DamageList.Count != 0)
     {
         IntervalInfo damageInfo = DamageList[0];
         damage = damageInfo.Value;
         if (Ticks != -1)
         {
             DamageList.RemoveAt(0);
         }
         return(true);
     }
     return(false);
 }
        public async Task <ActionResult <List <IntervalCountAggregations> > > GetAsync(
            string type,
            string team,
            string topic,
            bool?hasContinuousDelivery,
            DateTime?asOf,
            DateTime?intervalStartTime,
            DateTime?intervalEndTime,
            int?intervals)
        {
            if (intervals.HasValue && (!intervalStartTime.HasValue && !intervalEndTime.HasValue))
            {
                var modelStateDictionary = new ModelStateDictionary();
                modelStateDictionary.TryAddModelError(nameof(intervals), "Can not specify an interval without a start or end time");

                return(BadRequest(modelStateDictionary));
            }

            var repositorySearch = new RepositorySearch
            {
                TypeName = type,
                Team     = team,
                Topic    = topic,
                HasContinuousDelivery = hasContinuousDelivery,
                AsOf = asOf
            };

            var intervalInfo = new IntervalInfo
            {
                IntervalStartTime = intervalStartTime,
                IntervalEndTime   = intervalEndTime,
                Intervals         = intervals
            };

            var intervalCountAggregations = await repositoryImplementationsManager.SearchAsync(repositorySearch, intervalInfo);

            return(intervalCountAggregations);
        }
Пример #12
0
        public async Task <List <IntervalCountAggregations> > SearchAsync(RepositorySearch repositorySearch, IntervalInfo intervalInfo)
        {
            var intervalCountAggregations = new List <IntervalCountAggregations>();

            if (intervalInfo.Intervals.HasValue && intervalInfo.Intervals.Value > 1)
            {
                if (!intervalInfo.IntervalEndTime.HasValue)
                {
                    intervalInfo.IntervalEndTime = DateTime.Now;
                }

                var intervalTimeSpan = (intervalInfo.IntervalEndTime.Value - intervalInfo.IntervalStartTime.Value) / intervalInfo.Intervals.Value;

                var searchTasks = new List <Task <IntervalCountAggregations> >();

                for (int i = 0; i < intervalInfo.Intervals.Value; i++)
                {
                    DateTime?intervalCreatedOnOrAfter  = intervalInfo.IntervalStartTime.Value.Add(intervalTimeSpan * i);
                    DateTime?intervalCreatedOnOrBefore = intervalCreatedOnOrAfter.Value.Add(intervalTimeSpan);

                    var searchTask = repositoryImplementationsRepository.SearchAsync(repositorySearch, intervalCreatedOnOrAfter, intervalCreatedOnOrBefore);

                    searchTasks.Add(searchTask);
                }

                await Task.WhenAll(searchTasks).ConfigureAwait(false);

                foreach (var task in searchTasks)
                {
                    intervalCountAggregations.Add(task.Result);
                }
            }
            else
            {
                var intervalCountAggregation = await repositoryImplementationsRepository.SearchAsync(repositorySearch, intervalInfo.IntervalStartTime, intervalInfo.IntervalEndTime).ConfigureAwait(false);

                intervalCountAggregations.Add(intervalCountAggregation);
            }

            return(intervalCountAggregations);
        }
Пример #13
0
        public bool Equals(DestinyRecordDefinition input)
        {
            if (input == null)
            {
                return(false);
            }

            return
                ((
                     DisplayProperties == input.DisplayProperties ||
                     (DisplayProperties != null && DisplayProperties.Equals(input.DisplayProperties))
                     ) &&
                 (
                     Scope == input.Scope ||
                     (Scope != null && Scope.Equals(input.Scope))
                 ) &&
                 (
                     PresentationInfo == input.PresentationInfo ||
                     (PresentationInfo != null && PresentationInfo.Equals(input.PresentationInfo))
                 ) &&
                 (
                     LoreHash == input.LoreHash ||
                     (LoreHash.Equals(input.LoreHash))
                 ) &&
                 (
                     ObjectiveHashes == input.ObjectiveHashes ||
                     (ObjectiveHashes != null && ObjectiveHashes.SequenceEqual(input.ObjectiveHashes))
                 ) &&
                 (
                     RecordValueStyle == input.RecordValueStyle ||
                     (RecordValueStyle != null && RecordValueStyle.Equals(input.RecordValueStyle))
                 ) &&
                 (
                     ForTitleGilding == input.ForTitleGilding ||
                     (ForTitleGilding != null && ForTitleGilding.Equals(input.ForTitleGilding))
                 ) &&
                 (
                     TitleInfo == input.TitleInfo ||
                     (TitleInfo != null && TitleInfo.Equals(input.TitleInfo))
                 ) &&
                 (
                     CompletionInfo == input.CompletionInfo ||
                     (CompletionInfo != null && CompletionInfo.Equals(input.CompletionInfo))
                 ) &&
                 (
                     StateInfo == input.StateInfo ||
                     (StateInfo != null && StateInfo.Equals(input.StateInfo))
                 ) &&
                 (
                     Requirements == input.Requirements ||
                     (Requirements != null && Requirements.Equals(input.Requirements))
                 ) &&
                 (
                     ExpirationInfo == input.ExpirationInfo ||
                     (ExpirationInfo != null && ExpirationInfo.Equals(input.ExpirationInfo))
                 ) &&
                 (
                     IntervalInfo == input.IntervalInfo ||
                     (IntervalInfo != null && IntervalInfo.Equals(input.IntervalInfo))
                 ) &&
                 (
                     RewardItems == input.RewardItems ||
                     (RewardItems != null && RewardItems.SequenceEqual(input.RewardItems))
                 ) &&
                 (
                     PresentationNodeType == input.PresentationNodeType ||
                     (PresentationNodeType != null && PresentationNodeType.Equals(input.PresentationNodeType))
                 ) &&
                 (
                     TraitIds == input.TraitIds ||
                     (TraitIds != null && TraitIds.SequenceEqual(input.TraitIds))
                 ) &&
                 (
                     TraitHashes == input.TraitHashes ||
                     (TraitHashes != null && TraitHashes.SequenceEqual(input.TraitHashes))
                 ) &&
                 (
                     ParentNodeHashes == input.ParentNodeHashes ||
                     (ParentNodeHashes != null && ParentNodeHashes.SequenceEqual(input.ParentNodeHashes))
                 ) &&
                 (
                     Hash == input.Hash ||
                     (Hash.Equals(input.Hash))
                 ) &&
                 (
                     Index == input.Index ||
                     (Index.Equals(input.Index))
                 ) &&
                 (
                     Redacted == input.Redacted ||
                     (Redacted != null && Redacted.Equals(input.Redacted))
                 ));
        }
 public void Update(DestinyRecordDefinition?other)
 {
     if (other is null)
     {
         return;
     }
     if (!DisplayProperties.DeepEquals(other.DisplayProperties))
     {
         DisplayProperties.Update(other.DisplayProperties);
         OnPropertyChanged(nameof(DisplayProperties));
     }
     if (Scope != other.Scope)
     {
         Scope = other.Scope;
         OnPropertyChanged(nameof(Scope));
     }
     if (!PresentationInfo.DeepEquals(other.PresentationInfo))
     {
         PresentationInfo.Update(other.PresentationInfo);
         OnPropertyChanged(nameof(PresentationInfo));
     }
     if (LoreHash != other.LoreHash)
     {
         LoreHash = other.LoreHash;
         OnPropertyChanged(nameof(LoreHash));
     }
     if (!ObjectiveHashes.DeepEqualsListNaive(other.ObjectiveHashes))
     {
         ObjectiveHashes = other.ObjectiveHashes;
         OnPropertyChanged(nameof(ObjectiveHashes));
     }
     if (RecordValueStyle != other.RecordValueStyle)
     {
         RecordValueStyle = other.RecordValueStyle;
         OnPropertyChanged(nameof(RecordValueStyle));
     }
     if (ForTitleGilding != other.ForTitleGilding)
     {
         ForTitleGilding = other.ForTitleGilding;
         OnPropertyChanged(nameof(ForTitleGilding));
     }
     if (!TitleInfo.DeepEquals(other.TitleInfo))
     {
         TitleInfo.Update(other.TitleInfo);
         OnPropertyChanged(nameof(TitleInfo));
     }
     if (!CompletionInfo.DeepEquals(other.CompletionInfo))
     {
         CompletionInfo.Update(other.CompletionInfo);
         OnPropertyChanged(nameof(CompletionInfo));
     }
     if (!StateInfo.DeepEquals(other.StateInfo))
     {
         StateInfo.Update(other.StateInfo);
         OnPropertyChanged(nameof(StateInfo));
     }
     if (!Requirements.DeepEquals(other.Requirements))
     {
         Requirements.Update(other.Requirements);
         OnPropertyChanged(nameof(Requirements));
     }
     if (!ExpirationInfo.DeepEquals(other.ExpirationInfo))
     {
         ExpirationInfo.Update(other.ExpirationInfo);
         OnPropertyChanged(nameof(ExpirationInfo));
     }
     if (!IntervalInfo.DeepEquals(other.IntervalInfo))
     {
         IntervalInfo.Update(other.IntervalInfo);
         OnPropertyChanged(nameof(IntervalInfo));
     }
     if (!RewardItems.DeepEqualsList(other.RewardItems))
     {
         RewardItems = other.RewardItems;
         OnPropertyChanged(nameof(RewardItems));
     }
     if (PresentationNodeType != other.PresentationNodeType)
     {
         PresentationNodeType = other.PresentationNodeType;
         OnPropertyChanged(nameof(PresentationNodeType));
     }
     if (!TraitIds.DeepEqualsListNaive(other.TraitIds))
     {
         TraitIds = other.TraitIds;
         OnPropertyChanged(nameof(TraitIds));
     }
     if (!TraitHashes.DeepEqualsListNaive(other.TraitHashes))
     {
         TraitHashes = other.TraitHashes;
         OnPropertyChanged(nameof(TraitHashes));
     }
     if (!ParentNodeHashes.DeepEqualsListNaive(other.ParentNodeHashes))
     {
         ParentNodeHashes = other.ParentNodeHashes;
         OnPropertyChanged(nameof(ParentNodeHashes));
     }
     if (Hash != other.Hash)
     {
         Hash = other.Hash;
         OnPropertyChanged(nameof(Hash));
     }
     if (Index != other.Index)
     {
         Index = other.Index;
         OnPropertyChanged(nameof(Index));
     }
     if (Redacted != other.Redacted)
     {
         Redacted = other.Redacted;
         OnPropertyChanged(nameof(Redacted));
     }
 }