예제 #1
0
        //=========================================================================================================


        public static float ComputeAdditional(ModuleSettingsRes res, AddParam param, int level, int point, ColorInfo color)
        {
            float val = color.factor * point * (2.0f * (float)level / (float)(level + res.maxLevel)) * (param.max / res.addPointMax) * Rand.Float(param.randMin, param.randMax);

            if (val > param.max)
            {
                val = param.max;
            }
            return(val);
        }
예제 #2
0
public static void Main()
{
Console.WriteLine("Current thread id " + Thread.CurrentThread.GetHashCode());
AddParam add = new AddParam(10, 20);
exe e = new exe();
Thread th = new Thread(new ParameterizedThreadStart(e.Run));
th.Start(add);
Thread.Sleep(1000);

Console.WriteLine("Task Completed");
}
예제 #3
0
        private void butAddParameter_Click(object sender, EventArgs e)
        {
            frmAddParameter AddParam;

            if (tabParams.SelectedIndex == 0)
            {
                AddParam = new frmAddParameter(AddParameter);
            }
            else
            {
                AddParam = new frmAddParameter(AddCookie);
            }

            AddParam.ShowDialog();
        }
예제 #4
0
        /*
         * public static float ComputeRESISTANCE(int points, int pointsMax,  int level, int levelMax,  float resistMax, float colorMult) {
         *  //return points * pointsValue * Mathf.Pow(pointsFactor, level - 1);
         *  //return points * pointsValue * pointsFactor * ((float)level / 12.0f + 1);
         *  float resistance = colorMult * points * ( 2.0f * (float)level / (float)(level + levelMax) )* (resistMax / pointsMax) * Rand.Float(0.4f, 1.0f);
         *  if(resistance > resistMax ) {
         *      resistance = resistMax;
         *  }
         *  return resistance;
         * }*/

        public static float Resistance(ModuleSettingsRes res, AddParam param, int level, int point, ColorInfo color)
        {
            return(ComputeAdditional(res, param, level, point, color));
        }
예제 #5
0
 public static float WeaponCriticalChance(WeaponDropSettings res, AddParam param, int level, int point, ColorInfo color)
 {
     return(ComputeAdditionalWeapon(res, param, level, point, color));
 }
예제 #6
0
            public Shop GetShops()
            {
                var listVendor   = new Vendor().GetListVendor();
                var baseUrl      = Settings.PriceSettings.BaseURL;
                var list         = new List <Shop>();
                var listCategory = new CategoryB().GetListCategory().Select(x => x.Id).ToList <int>();
                var shop         = new Shop()
                {
                    Name       = Settings.PriceSettings.Name,
                    Company    = Settings.PriceSettings.CopanyName,
                    Url        = Settings.PriceSettings.URL,
                    Currencies = new Currencies()
                    {
                        Currency = new Currency()
                        {
                            Id = "UAH", Rate = "1"
                        }
                    },
                };

                var listAddParams  = new AddParam().GetListAddParam();
                var listAdd        = new Product().GetNameReplace();
                var listPictureAdd = new Picture().GetListPicture();

                foreach (var categoryId in listCategory)
                {
                    var ListCat    = new CategoryB().GetListcategoryToPrice(categoryId);
                    var categories = new List <Category>();
                    foreach (var cat in ListCat)
                    {
                        if (!listPictureAdd.Select(x => x.category).Contains(cat.Id))
                        {
                            continue;
                        }
                        if (cat.Parent_Id == 0)
                        {
                            categories.Add(new Category()
                            {
                                Id   = cat.Id.ToString(),
                                Text = cat.Name.ToString()
                            });
                        }
                        else
                        {
                            categories.Add(new Category()
                            {
                                Id       = cat.Id.ToString(),
                                Text     = cat.Name.ToString(),
                                ParentId = cat.Parent_Id.ToString()
                            });
                            var parent = new CategoryB().GetListcategoryToPrice(cat.Parent_Id);
                            categories.Add(new Category()
                            {
                                Id   = parent.FirstOrDefault().Id.ToString(),
                                Text = parent.FirstOrDefault().Name.ToString()
                            });
                        }
                    }

                    var listOffes = new List <Offer>();

                    var products = new Product().GetListProduct(categoryId);
                    if (products.Count() == 0)
                    {
                        continue;
                    }
                    foreach (var product in products)
                    {
                        if (!listPictureAdd.Where(x => x.link.Contains(product.Url)).Any())
                        {
                            continue;
                        }

                        var skuses = new Skus().GetListSkus(product.Id);

                        if (product.Images.Count() == 0)
                        {
                            continue;
                        }
                        foreach (var skus in skuses)
                        {
                            var parames     = new List <Param>();
                            var listParames = new Paramses().GetListParams(product.Id, skus.Id);
                            foreach (var item in listParames.Where(x => x.Status == true))
                            {
                                parames.Add(
                                    new Param()
                                {
                                    Name = item.Name.ToString(),
                                    Text = item.Text.ToString()
                                });
                            }

                            foreach (var item in listAddParams.Where(z => z.GroupId == categoryId))
                            {
                                parames.Add(
                                    new Param()
                                {
                                    Name = item.ParamName.ToString(),
                                    Text = item.ParamValue.ToString()
                                });
                            }

                            var additname = string.Empty;

                            if (product.addparam > 0)
                            {
                                var addName = listAdd[product.addparam];
                                var add     = parames.Where(x => x.Name == addName).FirstOrDefault();

                                if (add != null)
                                {
                                    additname = " " + add.Text.ToString();
                                }
                            }

                            if (skus.Price == 0)
                            {
                                skus.Price = product.Price;
                            }
                            if (skus.Price == 0)
                            {
                                continue;
                            }

                            var    markup      = listParames.Where(x => x.Status == false).FirstOrDefault()?.Text;
                            double markupValue = 0;
                            var    resM        = double.TryParse(markup, out markupValue);
                            if (resM && markupValue > 0)
                            {
                                markupValue = markupValue / 100;
                                skus.Price  = Math.Round(skus.Price + skus.Price * markupValue, 0);
                            }


                            listOffes.Add(new Offer()
                            {
                                Id             = skus.Id.ToString(),
                                Available      = "true",
                                Url            = baseUrl + product.Url.ToString(),
                                Price          = skus.Price.ToString(),
                                Price_old      = (skus.OldPrice == 0) ? null : skus.OldPrice.ToString(),
                                CurrencyId     = "UAH",
                                CategoryId     = categoryId.ToString(),
                                Picture        = product.Images,
                                Vendor         = listVendor.Where(x => x.Product_id == skus.Product_id)?.FirstOrDefault()?.Name ?? string.Empty,
                                Stock_quantity = product.Count.ToString(),
                                Name           = product.Name.ToString() + additname.ToString(),
                                Description    = product.Description.ToString(),
                                Param          = parames
                            });
                        }
                    }
                    if (listOffes.Count() == 0)
                    {
                        continue;
                    }

                    if (shop.Categories == null)
                    {
                        shop.Categories = new Categories()
                        {
                            Category = categories
                        }
                    }
                    ;
                    else
                    {
                        shop.Categories.Category.AddRange(categories);
                    }

                    if (shop.Offers == null)
                    {
                        shop.Offers = new Offers()
                        {
                            Offer = listOffes
                        }
                    }
                    ;
                    else
                    {
                        shop.Offers.Offer.AddRange(listOffes);
                    }
                    shop.Offers.Offer = shop.Offers.Offer.GroupBy(x => x.Id).Select(x => new Offer
                    {
                        Id             = x.Key,
                        Available      = x.Select(z => z.Available).FirstOrDefault().ToString(),
                        CategoryId     = x.Select(z => z.CategoryId).FirstOrDefault().ToString(),
                        CurrencyId     = x.Select(z => z.CurrencyId).FirstOrDefault().ToString(),
                        Description    = x.Select(z => z.Description).FirstOrDefault().ToString(),
                        Name           = x.Select(z => z.Name).FirstOrDefault().ToString(),
                        Param          = x.Select(z => z.Param).FirstOrDefault(),
                        Picture        = x.Select(z => z.Picture).FirstOrDefault(),
                        Price          = x.Select(z => z.Price).FirstOrDefault(),
                        Price_old      = x.Select(z => z.Price_old).FirstOrDefault(),
                        Stock_quantity = x.Select(z => z.Stock_quantity).FirstOrDefault(),
                        Url            = x.Select(z => z.Url).FirstOrDefault(),
                        Vendor         = x.Select(z => z.Vendor).FirstOrDefault().ToString()
                    }).ToList();

                    var listName = shop.Offers.Offer.GroupBy(x => x.Name);
                    foreach (var item in listName)
                    {
                        if (item.Count() > 1)
                        {
                            Settings.Dublicates.Add(string.Concat(item.Select(x => x.CategoryId).FirstOrDefault(), item.Select(x => x.Url).FirstOrDefault()));
                        }
                    }

                    foreach (var item in shop.Offers.Offer)
                    {
                        if (item.Description.Contains(" href"))
                        {
                            Settings.Urls.Add(item.Url);
                        }
                        if (item.Vendor == string.Empty)
                        {
                            Settings.Errores.Add(string.Format("Не указана торговая марка {0}, {1}", item.Id, string.Empty));
                        }
                    }
                }
                if (shop.Categories == null)
                {
                    return(shop);
                }
                shop.Categories.Category = shop.Categories.Category.GroupBy(x => x.Id).Select(x => new Category {
                    Id = x.Key, ParentId = x.Select(z => z.ParentId).FirstOrDefault(), Text = x.Select(z => z.Text).FirstOrDefault()
                }).ToList();
                return(shop);
            }