private void CreateDynamicColumns()
        {
            foreach (Stat stat in StatEnums)
            {
                if (stat == Stat.Unknown)
                {
                    continue;
                }

                var key    = stat.ToString();
                var strKey = RegexFunctions.SeperateCamelCase(key.Replace("Rate", "").Replace("Multiplier", "").Replace("Percent", ""));

                var sign = "";

                if (key.Contains("Percent"))
                {
                    sign = "%";
                }
                else if (key.Contains("Multiplier"))
                {
                    sign = "x";
                }

                var col = new DataGridViewTextBoxColumn
                {
                    HeaderText       = $"{strKey} {sign}",
                    Name             = "Stat" + stat.ToString(),
                    ValueType        = typeof(int),
                    DataPropertyName = "Stat" + stat.ToString()
                };

                monsterInfoGridView.Columns.Add(col);
            }
        }
        public CodeMemberMethod CreateApiFunction(Settings settings, string relativePath, OperationType httpMethod,
                                                  OpenApiOperation apiOperation, ComponentsToCsTypes coms2CsTypes, bool forAsync, bool useEnsureSuccessStatusCodeEx)
        {
            if (!(new OperationType[] { OperationType.Get, OperationType.Post, OperationType.Put, OperationType.Delete, OperationType.Patch }).Any(d => d == httpMethod))
            {
                Trace.TraceWarning("This HTTP method {0} is not yet supported", httpMethod);
                return(null);
            }

            this.settings     = settings;
            this.nameComposer = new NameComposer(settings);
            this.apiOperation = apiOperation;
            statementOfEnsureSuccessStatusCode = useEnsureSuccessStatusCodeEx ? "EnsureSuccessStatusCodeEx" : "EnsureSuccessStatusCode";

            this.actionName   = nameComposer.GetActionName(apiOperation, httpMethod.ToString(), relativePath);
            this.coms2CsTypes = coms2CsTypes;
            this.forAsync     = forAsync;


            this.RelativePath = RemovePrefixSlash(relativePath);
            this.RelativePath = RegexFunctions.RefineUrlWithHyphenInParameters(RelativePath);

            if (actionName.EndsWith("Async"))
            {
                actionName = actionName[0..^ 5];
Exemple #3
0
        private string CombinedBuffText()
        {
            string text  = "Active Buffs\n";
            var    stats = new Stats();

            for (var i = 0; i < _buffList.Count; i++)
            {
                var buff = GameScene.Scene.Buffs[i];

                stats.Add(buff.Stats);
            }

            foreach (var val in stats.Values)
            {
                var c   = val.Value < 0 ? "Decreased" : "Increased";
                var key = val.Key.ToString();

                var strKey = RegexFunctions.SeperateCamelCase(key.Replace("Rate", "").Replace("Multiplier", "").Replace("Percent", ""));

                var sign = "";

                if (key.Contains("Percent"))
                {
                    sign = "%";
                }
                else if (key.Contains("Multiplier"))
                {
                    sign = "x";
                }

                var txt = $"{c} {strKey} by: {val.Value}{sign}.\n";

                text += txt;
            }

            return(text);
        }
Exemple #4
0
        private void CreateDynamicColumns()
        {
            foreach (Stat stat in StatEnums)
            {
                if (stat == Stat.Unknown)
                {
                    continue;
                }

                var key    = stat.ToString();
                var strKey = RegexFunctions.SeperateCamelCase(key.Replace("Rate", "").Replace("Multiplier", "").Replace("Percent", ""));

                var sign = "";

                if (key.Contains("Percent"))
                {
                    sign = "%";
                }
                else if (key.Contains("Multiplier"))
                {
                    sign = "x";
                }

                var col = new DataGridViewTextBoxColumn
                {
                    HeaderText       = $"{strKey} {sign}",
                    Name             = "Stat" + stat.ToString(),
                    ValueType        = typeof(int),
                    DataPropertyName = "Stat" + stat.ToString()
                };

                itemInfoGridView.Columns.Add(col);
            }

            foreach (BindMode bind in BindEnums)
            {
                if (bind == BindMode.None)
                {
                    continue;
                }

                var col = new DataGridViewCheckBoxColumn
                {
                    HeaderText       = bind.ToString(),
                    Name             = "Bind" + bind.ToString(),
                    ValueType        = typeof(bool),
                    DataPropertyName = "Bind" + bind.ToString()
                };

                itemInfoGridView.Columns.Add(col);
            }

            foreach (SpecialItemMode special in SpecialEnums)
            {
                if (special == SpecialItemMode.None)
                {
                    continue;
                }

                var col = new DataGridViewCheckBoxColumn
                {
                    HeaderText       = special.ToString(),
                    Name             = "Special" + special.ToString(),
                    ValueType        = typeof(bool),
                    DataPropertyName = "Special" + special.ToString()
                };

                itemInfoGridView.Columns.Add(col);
            }
        }
Exemple #5
0
        public string BuffString(ClientBuff buff)
        {
            string text          = RegexFunctions.SeperateCamelCase(buff.Type.ToString()) + "\n";
            bool   overridestats = false;

            switch (buff.Type)
            {
            case BuffType.GameMaster:
                GMOptions options = (GMOptions)buff.Values[0];

                if (options.HasFlag(GMOptions.GameMaster))
                {
                    text += "-Invisible\n";
                }
                if (options.HasFlag(GMOptions.Superman))
                {
                    text += "-Superman\n";
                }
                if (options.HasFlag(GMOptions.Observer))
                {
                    text += "-Observer\n";
                }
                break;

            case BuffType.MentalState:
                switch (buff.Values[0])
                {
                case 0:
                    text += "Agressive (Full damage)\nCan't shoot over walls.\n";
                    break;

                case 1:
                    text += "Trick shot (Minimal damage)\nCan shoot over walls.\n";
                    break;

                case 2:
                    text += "Group Mode (Medium damage)\nDon't steal agro.\n";
                    break;
                }
                break;

            case BuffType.Hiding:
            case BuffType.ClearRing:
                text += "Invisible to many monsters.\n";
                break;

            case BuffType.MoonLight:
                text += "Invisible to players and many\nmonsters when at a distance.\n";
                break;

            case BuffType.EnergyShield:
                overridestats = true;
                text         += string.Format("{0}% chance to gain {1} HP when attacked.\n", buff.Stats[Stat.EnergyShieldPercent], buff.Stats[Stat.EnergyShieldHPGain]);
                break;

            case BuffType.DarkBody:
                text += "Invisible to many monsters and able to move.\n";
                break;

            case BuffType.VampireShot:
                text += "Gives you a vampiric ability\nthat can be released with\ncertain skills.\n";
                break;

            case BuffType.PoisonShot:
                text += "Gives you a poison ability\nthat can be released with\ncertain skills.\n";
                break;

            case BuffType.Concentration:
                text += "Increases chance on element extraction.\n";
                break;

            case BuffType.MagicBooster:
                overridestats = true;
                text          = string.Format("Increases MC by: {0}-{1}.\nIncreases consumption by {2}%.\n", buff.Stats[Stat.MinMC], buff.Stats[Stat.MaxMC], buff.Stats[Stat.ManaPenaltyPercent]);
                break;

            case BuffType.Transform:
                text = "Disguises your appearance.\n";
                break;

            case BuffType.Mentee:
                text = "Learn skill points twice as quick.\n";
                break;

            case BuffType.Guild:
                text += GameScene.Scene.GuildDialog.ActiveStats;
                break;
            }

            if (!overridestats)
            {
                foreach (var val in buff.Stats.Values)
                {
                    var c   = val.Value < 0 ? "Decreases" : "Increases";
                    var key = val.Key.ToString();

                    var strKey = RegexFunctions.SeperateCamelCase(key.Replace("Rate", "").Replace("Multiplier", "").Replace("Percent", ""));

                    var sign = "";

                    if (key.Contains("Percent"))
                    {
                        sign = "%";
                    }
                    else if (key.Contains("Multiplier"))
                    {
                        sign = "x";
                    }

                    var txt = $"{c} {strKey} by: {val.Value}{sign}.\n";

                    text += txt;
                }
            }

            text += buff.Infinite ? GameLanguage.ExpireNever : string.Format(GameLanguage.Expire, Functions.PrintTimeSpanFromSeconds(Math.Round((buff.ExpireTime - CMain.Time) / 1000D)));

            if (!string.IsNullOrEmpty(buff.Caster))
            {
                text += string.Format("\nCaster: {0}", buff.Caster);
            }

            return(text);
        }
Exemple #6
0
        public string BuffString(ClientPoisonBuff buff)
        {
            string text          = RegexFunctions.SeperateCamelCase(buff.Type.ToString()) + "\n";
            bool   overridestats = false;

            switch (buff.Type)
            {
            case PoisonType.Green:
            {
                var tick     = buff.TickSpeed / 1000;
                var tickName = tick > 1 ? "seconds" : "second";

                text += $"Recieve {buff.Value} damage every {tick} {tickName}.\n";
            }
            break;

            case PoisonType.Red:
            {
                var tick     = buff.TickSpeed / 1000;
                var tickName = tick > 1 ? "seconds" : "second";

                text += $"Reduces armour rate by 10% every {tick} {tickName}.\n";
            }
            break;

            case PoisonType.Slow:
                text += "Reduces movement speed.\n";
                break;

            case PoisonType.Frozen:
                text += "Prevents casting, movin\nand attacking.\n";
                break;

            case PoisonType.Stun:
            {
                var tick     = buff.TickSpeed / 1000;
                var tickName = tick > 1 ? "seconds" : "second";

                text += $"Increases damage received by 20% every {tick} {tickName}.\n";
            }
            break;

            case PoisonType.Paralysis:
                text += "Prevents moving and attacking.\n";
                break;

            case PoisonType.DelayedExplosion:
                text += "Ticking time bomb.\n";
                break;

            case PoisonType.Bleeding:
            {
                var tick     = buff.TickSpeed / 1000;
                var tickName = tick > 1 ? "seconds" : "second";

                text += $"Recieve {buff.Value} damage every {tick} {tickName}.\n";
            }
            break;

            case PoisonType.LRParalysis:
                text += "Prevents moving and attacking.\nCancels when attacked\n";
                break;

            case PoisonType.Blindness:
                text += "Causes temporary blindness.\n";
                break;

            case PoisonType.Dazed:
                text += "Prevents attacking.\n";
                break;
            }

            text += string.Format(GameLanguage.Expire, Functions.PrintTimeSpanFromSeconds(Math.Round((buff.ExpireTime - CMain.Time) / 1000D)));

            if (!string.IsNullOrEmpty(buff.Caster))
            {
                text += string.Format("\nCaster: {0}", buff.Caster);
            }

            return(text);
        }
 public UsersBLL(IGreatRepository <User> context) : base(context)
 {
     _validationFunctions = new ValidationFunctions();
     _regexFunctions      = new RegexFunctions();
 }
        public CodeMemberMethod CreateApiFunction(Settings settings, string relativePath, OperationType httpMethod, OpenApiOperation apiOperation, ComponentsToTsTypes com2TsTypes)
        {
            if (!(new OperationType[] { OperationType.Get, OperationType.Post, OperationType.Put, OperationType.Delete, OperationType.Patch }).Any(d => d == httpMethod))
            {
                Trace.TraceWarning("This HTTP method {0} is not yet supported", httpMethod);
                return(null);
            }

            this.nameComposer          = new NameComposer(settings);
            this.apiOperation          = apiOperation;
            this.HttpMethod            = httpMethod;
            this.ActionName            = nameComposer.GetActionName(apiOperation, httpMethod.ToString(), relativePath);
            this.bodyContentRefBuilder = new BodyContentRefBuilder(com2TsTypes, ActionName);
            this.parametersRefBuilder  = new ParametersRefBuilder(com2TsTypes, ActionName);
            this.ParameterDescriptions = parametersRefBuilder.OpenApiParametersToParameterDescriptions(apiOperation.Parameters);
            if (httpMethod == OperationType.Post || httpMethod == OperationType.Put || httpMethod == OperationType.Patch)
            {
                Tuple <CodeTypeReference, string, bool> kc = bodyContentRefBuilder.GetBodyContent(apiOperation, httpMethod.ToString(), relativePath);
                if (kc != null)
                {
                    this.RequestBodyCodeTypeReference = kc.Item1;
                    this.requestBodyComment           = kc.Item2;
                    if (!kc.Item3)
                    {
                        return(null);                        // not to generate for unsupported POST content type.
                    }
                }
            }

            this.RelativePath = RemovePrefixSlash(relativePath);
            this.RelativePath = RegexFunctions.RefineUrlWithHyphenInParameters(RelativePath);

            Tuple <CodeTypeReference, bool> r;

            try
            {
                var returnRefBuilder = new ReturnRefBuilder(com2TsTypes, ActionName);
                r = returnRefBuilder.GetOperationReturnTypeReference(apiOperation);
            }
            catch (CodeGenException ex)
            {
                if (ex.Pending)
                {
                    throw new CodeGenException($"When generating TS scripts, definition {relativePath}=>{httpMethod} triggers error {ex.Message}");
                }

                throw;
            }

            ReturnTypeReference = r.Item1;

            //create method
            Method = CreateMethodName();

            CreateDocComments();

            switch (HttpMethod)
            {
            case OperationType.Get:
            case OperationType.Delete:
            case OperationType.Post:
            case OperationType.Put:
            case OperationType.Patch:
                RenderImplementation();
                break;

            default:
                Trace.TraceWarning("This HTTP method {0} is not yet supported in TS gen", HttpMethod);
                break;
            }

            return(Method);
        }
 private void tbPrice_KeyPress(object sender, KeyPressEventArgs e)
 {
     RegexFunctions.AcceptNumbersOnly(sender, e);
 }
Exemple #10
0
 public string RegexUnescape(string text) => RegexFunctions.Unescape(text);
Exemple #11
0
 public ScriptArray RegexSplit(string text, string pattern, string options = null) => RegexFunctions.Split(Engine, text, pattern, options);
Exemple #12
0
 public string RegexReplace(string text, string pattern, string replace, string options = null) => RegexFunctions.Replace(Engine, text, pattern, replace, options);
Exemple #13
0
 public ScriptArray RegexMatches(string text, string pattern, string options = null) => RegexFunctions.Matches(Engine, text, pattern, options);
Exemple #14
0
 public string RegexEscape(string text) => RegexFunctions.Escape(text);