Beispiel #1
0
        public Qualities Create(Qualities Qualities, Users users)
        {
            // validation
            if (_context.Qualities.Any(x => x.Name == Qualities.Name))
            {
                throw new AppException("Qualities Name \"" + Qualities.Name + "\" is already taken");
            }

            if (!_context.Items.Any(x => x.Id == Qualities.ItemId))
            {
                throw new AppException("Item Id \"" + Qualities.ItemId + "\" not found");
            }


            Qualities.ApplicationId = users.ApplicationId;
            Qualities.CreatedBy     = users.Id;
            Qualities.CreatedDate   = DateTime.Now;
            Qualities.UpdatedBy     = users.Id;
            Qualities.UpdatedDate   = DateTime.Now;

            _context.Qualities.Add(Qualities);
            _context.SaveChanges();

            return(Qualities);
        }
 public DownloadDetailsDto(string mimeType, string language, Qualities quality, string url)
 {
     MimeType = mimeType;
     Language = language;
     Quality  = quality;
     Url      = url;
 }
        public bool CanMoveQualityDown(string streamQuality)
        {
            var index = Qualities.IndexOf(streamQuality);

            return(Qualities.Count > 1 &&
                   index < Qualities.Count - 1);
        }
Beispiel #4
0
    void Start()
    {
        instance = this;

        var fileParts = LoadPartsFromFile();

        if (fileParts == null)
        {
            Debug.Log("Using default parts");
            weaponParts = new List <WeaponPart>();

            for (int i = 0; i < defaultWeaponParts.Count; i++)
            {
                weaponParts.Add(WeaponParts.GetPart(defaultWeaponParts[i].partShortCode));
                weaponParts[i].level   = defaultWeaponParts[i].level;
                weaponParts[i].quality = Qualities.GetQuality(defaultWeaponParts[i].quality);
            }
        }
        else
        {
            weaponParts = fileParts.ToList();
        }

        var fileWeapons = LoadWeaponsFromFile();

        if (fileWeapons == null)
        {
            Debug.Log("Using default weapons");
            weapons = defaultWeapons;
        }
        else
        {
            weapons = fileWeapons.ToList();
        }
    }
Beispiel #5
0
        /// <summary>
        /// Add a quality (can be negative)
        /// </summary>
        /// <param name="value">The value you're adding</param>
        /// <param name="additive">Is this additive or replace-ive</param>
        /// <returns>The new value</returns>
        public int SetQuality(int value, string quality, bool additive)
        {
            IQuality currentQuality = Qualities.FirstOrDefault(qual => qual.Name.Equals(quality, StringComparison.InvariantCultureIgnoreCase));

            if (currentQuality == null)
            {
                Qualities.Add(new Quality()
                {
                    Name    = quality,
                    Type    = QualityType.Aspect,
                    Visible = true,
                    Value   = value
                });

                return(value);
            }

            if (additive)
            {
                currentQuality.Value += value;
            }
            else
            {
                currentQuality.Value = value;
            }

            return(value);
        }
        public bool CanMoveQualityUp(string streamQuality)
        {
            var index = Qualities.IndexOf(streamQuality);

            return(Qualities.Count > 1 &&
                   index != 0);
        }
        private string GetColorCodeForQuality(Qualities quality)
        {
            switch (quality)
            {
            case Qualities.VeryLow:
                return("<color=#FF2D00>");

            case Qualities.Low:
                return("<color=#FF7800>");

            case Qualities.Medium:
                return("<color=#FFD800>");

            case Qualities.High:
                return("<color=#D1FF00>");

            case Qualities.VeryHigh:
                return("<color=#8FFF00>");

            case Qualities.Ultra:
                return("<color=#00FF08>");

            default:
                return("<color=#FF2D00>");
            }
        }
Beispiel #8
0
    //This function is using a random number generator to decide the quality of the item.
    public void RollItemQuality()
    {
        int quality;

        //initializing a temporary variable and settiing it's value to be random between the ranges of 1 and 100.
        int temp = UnityEngine.Random.Range(1, 101);

        //setting the quality of the item based on the temp variable's value.
        if (temp <= 55)
        {
            quality = 0;                        //55% chance for the item to be of common quality.
        }
        else if (temp <= 85)
        {
            quality = 1;                        //30% chance for the item to be of uncommon quality.
        }
        else if (temp <= 95)
        {
            quality = 2;                        //10% chance for the item to be of rare quality.
        }
        else
        {
            quality = 3;                        //5% chance for the item to be of epic quality.
        }
        itemQuality = (Qualities)quality;
    }
        public override void OnInspectorGUI()
        {
            base.OnInspectorGUI();
            GUI.enabled = _fakeDeviceQualityTester.QualitySettingsToBeTested != null && _fakeDeviceQualityTester.FakeDeviceInfos.Count > 0;
            if (!GUI.enabled)
            {
                EditorGUILayout.HelpBox("Attach a quality setting and some fake device infos to run the test", MessageType.Warning);
            }

            if (GUILayout.Button("Test Fake Devices"))
            {
                _results = new System.Text.StringBuilder();
                _results.Append("Testing for " + _fakeDeviceQualityTester.FakeDeviceInfos.Count + " devices...\n");
                for (int i = 0; i < _fakeDeviceQualityTester.FakeDeviceInfos.Count; i++)
                {
                    Qualities selectedQuality = _fakeDeviceQualityTester.QualitySettingsToBeTested.CalculateQualitySettings(_fakeDeviceQualityTester.FakeDeviceInfos[i].DeviceInfo);

                    _results.Append(string.Format("• {0}({1}) <b>{2}{3}</color></b>\n", _fakeDeviceQualityTester.FakeDeviceInfos[i].name, _fakeDeviceQualityTester.FakeDeviceInfos[i].DeviceInfo.model, GetColorCodeForQuality(selectedQuality), selectedQuality.ToString()));
                }
                _results.Append("\nYou can also see the logs for details. You can add \"AutoQualityLogger\" scripting define symbol to see the logs(in case you don't see them). You can remove it if you don't like to add logs to your build");
            }

            if (_results != null && _results.Length > 0)
            {
                GUIStyle style = new GUIStyle(GUI.skin.label);
                style.richText = true;
                style.wordWrap = true;
                EditorGUILayout.BeginVertical(GUI.skin.box);
                {
                    EditorGUILayout.LabelField(_results.ToString(), style);
                }
                EditorGUILayout.EndVertical();
            }
        }
Beispiel #10
0
 public override void Pack(BinaryWriter writer)
 {
     Qualities.Pack(writer);
     PlayerModule.Pack(writer);
     ContentProfile.Pack(writer);
     InventoryPlacement.Pack(writer);
 }
Beispiel #11
0
        /// <summary>
        /// Renders HTML for the info card popups
        /// </summary>
        /// <param name="viewer">entity initiating the command</param>
        /// <returns>the output HTML</returns>
        public virtual string RenderToInfo(IEntity viewer)
        {
            if (viewer == null)
            {
                return(string.Empty);
            }

            ITemplate     dt   = Template <ITemplate>();
            StringBuilder sb   = new StringBuilder();
            StaffRank     rank = viewer.ImplementsType <IPlayer>() ? viewer.Template <IPlayerTemplate>().GamePermissionsRank : StaffRank.Player;

            sb.Append("<div class='helpItem'>");

            sb.AppendFormat("<h3>{0}</h3>", GetDescribableName(viewer));
            sb.Append("<hr />");
            if (Qualities != null && Qualities.Count > 0)
            {
                sb.Append("<h4>Qualities</h4>");
                sb.AppendFormat("<div>{0}</div>", string.Join(",", Qualities.Select(q => string.Format("({0}:{1})", q.Name, q.Value))));
            }

            sb.Append("</div>");

            return(sb.ToString());
        }
Beispiel #12
0
 public void Clone(ISObject item)
 {
     _name        = item.Name;
     _value       = item.Value;
     _icon        = item.Icon;
     _quality     = item.Quality;
     _isEssential = item.IsEssential;
 }
        public override bool Equals(object obj)
        {
            var qualities = obj as FavoriteQualities;

            return(qualities != null &&
                   Qualities.SequenceEqual(qualities.Qualities) &&
                   FallbackQuality == qualities.FallbackQuality);
        }
Beispiel #14
0
 public override void Unpack(BinaryReader reader)
 {
     base.Unpack(reader);
     Qualities.Unpack(reader);
     PlayerModule.Unpack(reader);
     ContentProfile.Unpack(reader);
     InventoryPlacement.Unpack(reader);
 }
Beispiel #15
0
 private AstroSign(int index, string name, string abbrev, Elements elem, Qualities quality)
 {
     this.index   = index;
     this.name    = name;
     this.abbrev  = abbrev;
     this.element = elem;
     this.quality = quality;
 }
Beispiel #16
0
 private AstroSign(int index, string name, string abbrev, Elements elem, Qualities quality,
                   PlanetId ruler, PlanetId exalted, PlanetId detriment, PlanetId fall)
     : this(index, name, abbrev, elem, quality)
 {
     this.rulerId     = ruler;
     this.exaltedId   = exalted;
     this.detrimentId = detriment;
     this.fallId      = fall;
 }
Beispiel #17
0
    public static WeaponPart GetRandomPart(int level)
    {
        var part = Instantiate(instance.parts[Random.Range(0, instance.parts.Length)]);

        part.level   = Mathf.Max(1, level + Mathf.RoundToInt(instance.relativeLootLevel.Evaluate(Random.value)));
        part.quality = Qualities.GetRandomQuality();

        return(part);
    }
Beispiel #18
0
 private Sign(int order, string name, string abbrev, Double cusp, Elements elem, Qualities quality, Genders gender)
 {
     Order        = order;
     Name         = name;
     Abbreviation = abbrev;
     Degrees      = cusp;
     Element      = elem;
     Quality      = quality;
     Gender       = gender;
 }
Beispiel #19
0
 public override string ToString()
 {
     return(string.Join('\n', new string[] {
         "Name: " + Name,
         "Origin Path: " + OriginPath,
         "Storage Path: " + StorageBackend,
         "Whitelist: " + string.Join(" ", ValidExtensions),
         $"Qualities: \n{{{string.Join('\n', Qualities.Select(x => x.ToString()))}\n}}"
     }));
 }
Beispiel #20
0
        static bool LoadQualities(Element element, XElement infoBox)
        {
            Qualities q  = new Qualities(element);
            int       nQ = 0;

            foreach (XNode xn in infoBox.Nodes())
            {
                XElement xe = xn as XElement;
                if (xe != null)
                {
                    List <XNode>    nodes = new List <XNode>(xe.Nodes());
                    List <XElement> elems = new List <XElement>();
                    foreach (XNode xn2 in nodes)
                    {
                        if (xn2 is XElement)
                        {
                            elems.Add((XElement)xn2);
                        }
                    }
                    if (elems.Count == 2)
                    {
                        XElement e0 = elems[0], e1 = elems[1];
                        string   valName = e0.Value.Replace((char)160, (char)32);
                        if (valName.StartsWith("Ionisation"))
                        {
                            valName = valName.Replace("Ionisation", "Ionization");
                        }
                        if (valName.IndexOf("vaporisation") > 0)
                        {
                            valName = valName.Replace("isa", "iza");
                        }
                        foreach (Term term in _terms)
                        {
                            try
                            {
                                if (valName.IndexOf(term.Name) >= 0)
                                {
                                    if (term.ParseTerm(e1.Value, q))
                                    {
                                        nQ++;
                                    }
                                    break;
                                }
                            }
                            catch (Exception)
                            {
                                WriteError("Term {0} failed", term.Name);
                                throw;
                            }
                        }
                    }
                }
            }
            return(nQ >= 8);
        }
        public void AddQuality()
        {
            if (!CanAddQuality)
            {
                return;
            }

            Qualities.Insert(0, NewQuality.Trim());
            Qualities.Refresh(); // causes the CanMove guards to be checked
            NotifyOfPropertyChange(() => CanAddQuality);
        }
 internal bool IsValidQuality(Object Item)
 {
     if (!HasQualities)
     {
         return(Item.Quality == DefaultQuality);
     }
     else
     {
         return(Qualities.Any(x => (int)x == Item.Quality));
     }
 }
Beispiel #23
0
        /// <summary>
        /// Check for a quality
        /// </summary>
        /// <param name="name">Gets the value of the request quality</param>
        /// <returns>The value</returns>
        public virtual int GetQuality(string name)
        {
            IQuality currentQuality = Qualities.FirstOrDefault(qual => qual.Name.Equals(name, StringComparison.InvariantCultureIgnoreCase));

            if (currentQuality == null)
            {
                return(0);
            }

            return(currentQuality.Value);
        }
        public void MoveQualityUp(string streamQuality)
        {
            if (!CanMoveQualityUp(streamQuality))
            {
                return;
            }

            var index = Qualities.IndexOf(streamQuality);

            Qualities.Move(index, index - 1);
            Qualities.Refresh(); // causes the CanMove guards to be checked
        }
 public ApiClientQualitiesViewModel()
 {
     if (Execute.InDesignMode)
     {
         Qualities.AddRange(new []
         {
             "720p60",
             "720"
         });
         FallbackQuality = "Worst";
     }
 }
Beispiel #26
0
 public Soldier(string _name, int _age, Genders _gender, int _damage, int _armour, int _speed, Qualities _quality, Kingdoms _banner) : base(_name, _age, _gender)
 {
     Number++;
     Seqnumber = Number;
     Damage    = _damage;
     Armor     = _armour;
     Speed     = _speed;
     Tier      = (Damage + Armor) / 40;
     Quality   = _quality;
     Banner    = _banner;
     IsAlive   = true;
 }
        private protected override void FillControl(ControlBase control, Context context)
        {
            ComboBox qualitySelection = new(control);

            foreach (Quality quality in Qualities.All())
            {
                items[(int)quality] = qualitySelection.AddItem(quality.Name(), "", quality);
            }

            qualitySelection.SelectedItem = items[(int)get()];

            qualitySelection.ItemSelected += (_, args) => { set((Quality)((MenuItem)args.SelectedItem).UserData); };
        }
Beispiel #28
0
        public DownloadDetailsDto(/*string mimeType, string language, */ Qualities quality, string url)
        {
            //MimeType = mimeType;
            //Language = language;
            Quality = quality;
            var uriBuilder = new UriBuilder(new Uri(url, true))
            {
                Scheme = Uri.UriSchemeHttps,
                Port   = -1, //default port of scheme
            };

            Url = uriBuilder.ToString();
        }
Beispiel #29
0
        public object Clone()
        {
            Armor newArmor = new Armor();

            newArmor.Name        = Name;
            newArmor.Price       = Price;
            newArmor.Encumbrance = Encumbrance;
            newArmor.Description = Description;
            newArmor.AR          = AR;
            newArmor.Qualities   = (string[])Qualities.Clone();
            newArmor.Location    = Location;

            return(newArmor);
        }
        public FilterStateService(IPlexService plexService)
        {
            _plexService     = plexService;
            Languages        = new[] { new Language("DE", "German"), new Language("EN", "English") };
            SelectedLanguage = new BehaviorSubject <Language>(Languages.First());
            Qualities        = new[] { "1080p", "720p", "480p" };
            SelectedQuality  = new BehaviorSubject <string>(Qualities.First());

            Hoster = new[]
            {
                new Hoster("ddownload", "DD"), new Hoster("1ficher", "1F"), new Hoster("rapidgator", "RG"),
                new Hoster("uploaded", "UL"), new Hoster("nitroflare", "NI")
            };
        }