Exemple #1
0
        public List <T> GenerateRandomThings(T[] thingsEnumerable, Tiers tier, int itemsCount, Dictionary <Tiers, int> chancesDictionary)
        {
            var items           = new List <T>();
            var itemsTiersCount = GetThingsCountInTiers(itemsCount, chancesDictionary);

            foreach (var currentTier in itemsTiersCount)
            {
                var currentTierList = new List <T>(thingsEnumerable.Where(x => x.Tier == currentTier.Key)).ToArray();
                var minIndex        = 0;
                var maxIndex        = 0;
                if (currentTierList.Length > 0)
                {
                    minIndex = Array.IndexOf(currentTierList, currentTierList.First());
                    maxIndex = Array.IndexOf(currentTierList, currentTierList.Last());
                }
                var indexes = new List <int>();
                for (int i = 0; i < currentTier.Value; i++)
                {
                    var randomIndex = GetRandomNumber(minIndex, maxIndex);
                    while (indexes.Contains(randomIndex))
                    {
                        randomIndex = GetRandomNumber(minIndex, maxIndex);
                    }
                    items.Add(currentTierList.ElementAt(randomIndex));
                    indexes.Add(randomIndex);
                }
            }
            return(items);
        }
Exemple #2
0
        private void ChangeTier(Tiers load)
        {
            if (currentTier == load)
            {
                return;
            }
            currentTier = load;

            foreach (KeyValuePair <Tiers, List <pSprite> > s in tierSprites)
            {
                if (currentTier == s.Key)
                {
                    foreach (pSprite p in s.Value)
                    {
                        p.Transformations.Clear();
                        p.CurrentPosition = p.StartPosition;
                        p.IsClickable     = true;
                        if (p.TagNumeric == (int)currentTier)
                        {
                            p.FadeIn(300);
                        }
                    }
                }
                else
                {
                    foreach (pSprite p in s.Value)
                    {
                        p.MoveToRelative(new Vector2(-50, 0), 400, EasingTypes.In);
                        p.FadeOut(400);
                        p.IsClickable = false;
                    }
                }
            }
        }
Exemple #3
0
        public override void IncreaseTier()
        {
            base.IncreaseTier();

            List <object> list = new List <object>();
            Item          c;

            switch (Tier)
            {
            case 1:
                // dishing stump
                c = new Static(0x1865);
                c.MoveToWorld(new Point3D(1417, 1590, 30), Map);
                list.Add(c);

                // pickaxe
                c = new Pickaxe();
                c.MoveToWorld(new Point3D(1414, 1588, 47), Map);
                c.Movable = false;
                list.Add(c);

                // sewing kit
                c = new SewingKit();
                c.MoveToWorld(new Point3D(1414, 1592, 42), Map);
                c.Movable = false;
                list.Add(c);

                // empty tool box
                c = new Static(0x1EB7);
                c.MoveToWorld(new Point3D(1415, 1588, 47), Map);
                list.Add(c);

                // silver wire
                c = new Static(0x1EB7)
                {
                    Weight = 5.0
                };
                c.MoveToWorld(new Point3D(1417, 1592, 46), Map);
                list.Add(c);

                // gold wire
                c = new Static(0x1EB7)
                {
                    Weight = 5.0
                };
                c.MoveToWorld(new Point3D(1417, 1592, 47), Map);
                list.Add(c);

                // silver ingots
                c = new Static(0x1BF6);
                c.MoveToWorld(new Point3D(1416, 1592, 44), Map);
                list.Add(c);
                break;
            }

            if (list.Count > 0)
            {
                Tiers.Add(list);
            }
        }
    private void ChangeTiers()
    {
        switch (WhichUnicycle)
        {
        case Player.Bike1:

            if (ScoreScript.Player1Score >= 150)
            {
                P1Tier = Tiers.Tier3;
            }
            else if (ScoreScript.Player1Score >= 50)
            {
                P1Tier = Tiers.Tier2;
            }

            break;

        case Player.Bike2:

            if (ScoreScript.Player2Score >= 150)
            {
                P2Tier = Tiers.Tier3;
            }
            else if (ScoreScript.Player2Score >= 50)
            {
                P2Tier = Tiers.Tier2;
            }

            break;

        default:
            break;
        }
    }
Exemple #5
0
        void OnPlayerPermission(PlayerPermissionEventArgs e)
        {
            // If the player isn't logged it, he's certainly not a contributor
            if (e.Player == null || !e.Player.IsLoggedIn || !e.Player.ContainsData(Contributor.DataKey))
            {
                return;
            }

            Contributor con = e.Player.GetData <Contributor>(Contributor.DataKey);

            #region DEBUG
#if DEBUG
            //TShock.Log.ConsoleInfo("[" + e.Player.Index + "] Checking permission for: " + e.Permission);
#endif
            #endregion

            Tier tier = Tiers.Get(con.Tier);
            e.Handled = tier.Permissions.HasPermission(e.Permission);
            #region DEBUG
#if DEBUG
            if (e.Handled)
            {
                TShock.Log.ConsoleInfo("OnPlayerPermission: Contributor had the permission");
            }
#endif
            #endregion
        }
Exemple #6
0
 public Shop(Tiers tier, string name, List <Item> stock, IMessageService messageService = null)
 {
     Tier            = tier;
     Name            = name;
     Stock           = stock;
     mMessageService = messageService;
 }
        void Save_tier(bool btn)
        {
            try
            {
                ITiers tiers = new Tiers();
                if (id == 0 || textBox1.Text.Equals("") || textBox2.Text.Equals("") || textBox3.Text.Equals("") ||
                    textBox4.Text.Equals("") || textBox5.Text.Equals("") || textBox6.Text.Equals(""))
                {
                    MessageBox.Show("Complete all textbox please", "Error...", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
                else
                {
                    tiers.Id       = Convert.ToInt32(id);
                    tiers.Nom      = textBox1.Text.Trim();
                    tiers.Postnom  = textBox2.Text.Trim();
                    tiers.Prenom   = textBox3.Text.Trim();
                    tiers.Contact  = textBox4.Text.Trim();
                    tiers.Mail     = textBox5.Text.Trim();
                    tiers.Addresse = textBox6.Text.Trim();

                    if (btn)
                    {
                        tiers.Save(tiers); InitializeComponents();
                    }
                    else
                    {
                        tiers.Delete(id); InitializeComponents();
                    }
                }
            }catch (Exception ex) { MessageBox.Show("Error " + ex.Message); }
        }
        public bool Equals(DestinyArtifactDefinition input)
        {
            if (input == null)
            {
                return(false);
            }

            return
                ((
                     DisplayProperties == input.DisplayProperties ||
                     (DisplayProperties != null && DisplayProperties.Equals(input.DisplayProperties))
                     ) &&
                 (
                     TranslationBlock == input.TranslationBlock ||
                     (TranslationBlock != null && TranslationBlock.Equals(input.TranslationBlock))
                 ) &&
                 (
                     Tiers == input.Tiers ||
                     (Tiers != null && Tiers.SequenceEqual(input.Tiers))
                 ) &&
                 (
                     Hash == input.Hash ||
                     (Hash.Equals(input.Hash))
                 ) &&
                 (
                     Index == input.Index ||
                     (Index.Equals(input.Index))
                 ) &&
                 (
                     Redacted == input.Redacted ||
                     (Redacted != null && Redacted.Equals(input.Redacted))
                 ));
        }
Exemple #9
0
        public void AddTracker(string tracker)
        {
            var trackers = new[] { tracker };

            Tiers.Add(new TrackerTier(trackers));
            CurrentTracker = Tiers[0].Trackers[0];
        }
Exemple #10
0
        public Tiers Add(Tiers Tiers)
        {
            Tiers      result     = new Tiers();
            Parametres parametres = _parametresService.GetAll();



            if (!parametres.INCCLI)
            {
                if (!(CheckUnicCodification(Tiers.Numero)))
                {
                    Tiers.Type = 0;
                    _clientRepository.Add(Tiers);
                    result = Tiers;
                }
                else
                {
                    result = null;
                }
            }
            else
            {
                Tiers.Numero = parametres.NUMCLI;
                while (CheckUnicCodification(Tiers.Numero))
                {
                    Tiers.Numero = Tiers.Numero.IncrementCode();
                }
                Tiers.Type        = 0;
                result            = _clientRepository.Add(Tiers);
                parametres.NUMCLI = Tiers.Numero;
                _parametresService.Update(parametres);
            }
            return(result);
        }
Exemple #11
0
        public Member Copy()
        {
            Member clonedMember = (Member)MemberwiseClone();

            clonedMember.Tiers = Tiers.Copy();
            return(clonedMember);
        }
Exemple #12
0
        public override void IncreaseTier()
        {
            base.IncreaseTier();

            List <object> list = new List <object>();
            Item          c;

            switch (Tier)
            {
            case 1:
                // decorative armor
                c = new Static(0x1508);
                c.MoveToWorld(new Point3D(1409, 1610, 30), Map);
                list.Add(c);

                // cannon
                c = new Static(0xE94);
                c.MoveToWorld(new Point3D(1409, 1610, 30), Map);
                list.Add(c);

                c = new Static(0xE95);
                c.MoveToWorld(new Point3D(1410, 1610, 30), Map);
                list.Add(c);

                c = new Static(0xE96);
                c.MoveToWorld(new Point3D(1411, 1610, 30), Map);
                list.Add(c);
                break;
            }

            if (list.Count > 0)
            {
                Tiers.Add(list);
            }
        }
 public void EnregistreNouveauTiers(IUnitOfWork unitOfWork, Tiers tiersAEnregistrer)
 {
     if (TiersEstValide(unitOfWork, tiersAEnregistrer))
     {
         unitOfWork.Repository <Tiers>().Enregistre(tiersAEnregistrer);
     }
 }
 /// ------------------------------------------------------------------------------------
 public void AddIgnoredSegment(TimeSpan newBoundary)
 {
     Tiers.AddIgnoredSegment((float)newBoundary.TotalSeconds);
     _undoStack.Push(new SegmentChange(TimeTier.Segments.First(s => s.TimeRange.End == newBoundary).TimeRange.Copy(),
                                       c => { Tiers.GetTranscriptionTier().Segments.Last().Text = string.Empty; RevertNewSegment(c); }));
     OnSegmentBoundaryChanged();
 }
        /// ------------------------------------------------------------------------------------
        public SegmenterDlgBaseViewModel(ComponentFile file)
        {
            ComponentFile  = file;
            OrigWaveStream = new WaveFileReader(ComponentFile.PathToAnnotatedFile);

            Tiers = file.GetAnnotationFile() != null?
                    file.GetAnnotationFile().Tiers.Copy() : new TierCollection(ComponentFile.PathToAnnotatedFile);

            TimeTier = Tiers.GetTimeTier();

            if (TimeTier == null)
            {
                TimeTier = new TimeTier(ComponentFile.PathToAnnotatedFile);
                Tiers.Insert(0, TimeTier);
            }

            OralAnnotationsFolder = ComponentFile.PathToAnnotatedFile +
                                    Settings.Default.OralAnnotationsFolderSuffix;

            TempOralAnnotationsFolder = Path.Combine(Path.GetTempPath(), "SayMoreOralAnnotations");
            if (Directory.Exists(TempOralAnnotationsFolder))
            {
                foreach (var tempFile in Directory.EnumerateFiles(TempOralAnnotationsFolder))
                {
                    File.Delete(tempFile);
                }
            }
            _oralAnnotationFilesBeforeChanges = GetListOfOralAnnotationSegmentFilesBeforeChanges().ToList();
            TimeTier.BackupOralAnnotationSegmentFileAction = BackupOralAnnotationSegmentFile;
        }
        /// ------------------------------------------------------------------------------------
        public void SetIgnoredFlagForSegment(AnnotationSegment segment, bool ignore)
        {
            if (segment != null)
            {
                var segmentIndex = TimeTier.GetIndexOfSegment(segment);
                var timeRange    = segment.TimeRange.Copy();
                if (ignore)
                {
                    Action restoreState = GetActionToRestoreStateWhenUndoingAnIgnore(segment);

                    Tiers.MarkSegmentAsIgnored(segmentIndex);
                    _undoStack.Push(new SegmentChange(SegmentChangeType.Ignored, timeRange, timeRange, sc =>
                    {
                        Tiers.MarkSegmentAsUnignored(segmentIndex);
                        restoreState();
                    }));
                }
                else
                {
                    Tiers.MarkSegmentAsUnignored(segmentIndex);
                    _undoStack.Push(new SegmentChange(SegmentChangeType.Unignored, timeRange, timeRange,
                                                      sc => Tiers.MarkSegmentAsIgnored(segmentIndex)));
                }
            }
            else
            {
                if (!ignore)
                {
                    throw new InvalidOperationException("New segment can never be unignored.");
                }
                AddIgnoredSegment(VirtualBoundaryBeyondLastSegment);
            }
        }
        /// ------------------------------------------------------------------------------------
        /// <summary>
        /// Return the transcription and/or translation roles if all the segments are not
        /// empty.
        /// </summary>
        /// ------------------------------------------------------------------------------------
        public override IEnumerable <ComponentRole> GetAssignedRoles()
        {
            var transcriptionTier = Tiers.GetTranscriptionTier();

            if (transcriptionTier != null && transcriptionTier.GetIsComplete())
            {
                yield return(_componentRoles.Single(r => r.Id == ComponentRole.kTranscriptionComponentRoleId));
            }

            // Stage status (complete-incomplete) is not displaying the status for Written Translations correctly, if one or more segments are ignored.
            var translationTier = Tiers.GetFreeTranslationTier();

            if (translationTier != null && translationTier.GetIsComplete(transcriptionTier))
            {
                yield return(_componentRoles.Single(r => r.Id == ComponentRole.kFreeTranslationComponentRoleId));
            }

            if (Tiers.GetIsAdequatelyAnnotated(OralAnnotationType.CarefulSpeech))
            {
                yield return(_componentRoles.Single(r => r.Id == ComponentRole.kCarefulSpeechComponentRoleId));
            }

            if (Tiers.GetIsAdequatelyAnnotated(OralAnnotationType.Translation))
            {
                yield return(_componentRoles.Single(r => r.Id == ComponentRole.kOralTranslationComponentRoleId));
            }
        }
        /// ------------------------------------------------------------------------------------
        public override void Save(string path)
        {
            // path is ignored.

            base.OnBeforeSave(this);
            Tiers.Save(AssociatedComponentFile.PathToAnnotatedFile);
            base.OnAfterSave(this);
        }
Exemple #19
0
 public Tiers Put([FromBody] Tiers Tiers)
 {
     if (ModelState.IsValid)
     {
         _fournisseurService.Update(Tiers);
     }
     return(Tiers);
 }
 /// ------------------------------------------------------------------------------------
 public bool GetIsSegmentIgnored(int segmentIndex)
 {
     if (Tiers.GetTranscriptionTier() == null || segmentIndex < 0 || segmentIndex >= Tiers.GetTranscriptionTier().Segments.Count)
     {
         return(false);
     }
     return(Tiers.GetIsSegmentIgnored(segmentIndex));
 }
        public static Adresse CreerAdresse(string adresse, Tiers tiers)
        {
            Adresse nouvelleAdresse = CreerAdresse(adresse);

            nouvelleAdresse.ListeTiers.Add(tiers);

            return(nouvelleAdresse);
        }
Exemple #22
0
 public Enemy(Tiers tier, Race race, List <Ability> abilities, Inventory inventory, int gold, string name,
              int maxHp, int damage, int armor, int lifestealPercent, int criticalStrikeChance, int blockChance = 0,
              int evadeChance = 0, string asciiArt = "") : base(race, abilities, inventory, gold, name, maxHp, damage,
                                                                armor, lifestealPercent, criticalStrikeChance, blockChance, evadeChance)
 {
     Inventory = inventory;
     Tier      = tier;
     AsciiArt  = asciiArt;
 }
Exemple #23
0
 private void RemplisTiers()
 {
     if (TestPasDeCompte())
     {
         txtFiltreTiers.DataSource    = null;
         txtOperationTiers.DataSource = null;
         txtFiltreTiers.DataSource    = Tiers.ChargeTout();
         txtOperationTiers.DataSource = Tiers.ChargeTout();
     }
 }
Exemple #24
0
 public Item(Dictionary <string, int> stats, ItemType type, int cost, Tiers rarity, string name,
             Ability itemAbility = null) : base(stats)
 {
     Type        = type;
     Stats       = stats;
     Cost        = cost;
     Tier        = rarity;
     Name        = name;
     ItemAbility = itemAbility;
 }
Exemple #25
0
 public bool DeepEquals(DestinyArtifactDefinition?other)
 {
     return(other is not null &&
            (DisplayProperties is not null ? DisplayProperties.DeepEquals(other.DisplayProperties) : other.DisplayProperties is null) &&
            (TranslationBlock is not null ? TranslationBlock.DeepEquals(other.TranslationBlock) : other.TranslationBlock is null) &&
            Tiers.DeepEqualsList(other.Tiers) &&
            Hash == other.Hash &&
            Index == other.Index &&
            Redacted == other.Redacted);
 }
 public bool DeepEquals(DestinyArtifactDefinition other)
 {
     return(other != null &&
            DisplayProperties.DeepEquals(other.DisplayProperties) &&
            Tiers.DeepEqualsReadOnlyCollections(other.Tiers) &&
            TranslationBlock.DeepEquals(other.TranslationBlock) &&
            Blacklisted == other.Blacklisted &&
            Hash == other.Hash &&
            Index == other.Index &&
            Redacted == other.Redacted);
 }
 /// ------------------------------------------------------------------------------------
 /// <summary>
 /// If the time tier contains more segments than all the other text tiers, this method
 /// will add a number of segments to each text tier so each tier contains the same
 /// number of segments. Added text segments are filled with an empty string.
 /// </summary>
 /// ------------------------------------------------------------------------------------
 public void CreateMissingTextSegmentsToMatchTimeSegmentCount()
 {
     foreach (var textTier in Tiers.OfType <TextTier>()
              .Where(t => t.Segments.Count < TimeTier.Segments.Count))
     {
         while (textTier.Segments.Count < TimeTier.Segments.Count)
         {
             textTier.AddSegment(string.Empty);
         }
     }
 }
Exemple #28
0
 public Tiers Update(Tiers Tiers)
 {
     try
     {
         _context.Update(Tiers);
         _context.SaveChanges();
         return(Tiers);
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Exemple #29
0
 void UpdateTiers(object sender, ElapsedEventArgs e)
 {
     try
     {
         Tiers.Refresh();
         TShock.Log.ConsoleInfo("CTRS: Refreshed tiers.");
     }
     catch (Exception ex)
     {
         TShock.Log.ConsoleError("CTRS: Exception thrown during tier refresh. Check logs for details.");
         TShock.Log.Error(ex.ToString());
     }
 }
        /// ------------------------------------------------------------------------------------
        public bool DeleteBoundary(TimeSpan boundary)
        {
            var seg = TimeTier.GetSegmentHavingEndBoundary((float)boundary.TotalSeconds);

            if (!Tiers.RemoveTierSegments(TimeTier.GetIndexOfSegment(seg)))
            {
                return(false);
            }

            OnSegmentDeleted(seg);
            OnSegmentBoundaryChanged();
            return(true);
        }