Esempio n. 1
0
        public void GetWeapon()
        {
            var dir = "d:/avatar/new";

            foreach (var prof in pairs.Keys)
            {
                foreach (var typed in Directory.GetDirectories($"{dir}/{prof.Replace("_at", "")}/weapon"))
                {
                    var type = typed.GetSuffix();
                    var file = $"{GAME_PATH}/sprite_character_{prof}{(prof.EndsWith("_at") ? "" : "_")}equipment_weapon_{GetType(prof, type)}.npk";
                    var list = Npks.Load(file);
                    var ps   = $"{dir}/{prof}/weapon/{type}";
                    if (!Directory.Exists(ps))
                    {
                        continue;
                    }
                    var images = Directory.GetFiles(ps);

                    var path = $"d:/avatar/new_image/{prof}/weapon/{type}";
                    if (!Directory.Exists(path))
                    {
                        Directory.CreateDirectory(path);
                    }
                    for (var i = 0; i < images.Length; i++)
                    {
                        var regex = new Regex("\\d+");
                        var match = regex.Match(images[i]);
                        if (match.Success)
                        {
                            var code = match.Value;
                            var arr  = list.Where(item => Npks.MatchCode(item.Name, code)).ToList();
                            var rs   = FindImg(arr, int.Parse(code), type);
                            if (rs.Count() > 0)
                            {
                                var img     = rs.ElementAt(0);
                                var builder = new LSBuilder();
                                var image   = img[pairs[prof]];
                                ImageToJson(path, prof, type, img.Name, match.Value, image);
                            }
                        }
                    }
                }
            }
        }
Esempio n. 2
0
        public void GetImage(string source, string target, string prof)
        {
            foreach (var part in part_array)
            {
                var file = $"{GAME_PATH}/sprite_character_{prof}{(prof.EndsWith("_at") ? "" : "_")}equipment_avatar_{part}.NPK";
                var list = Npks.Load(file);
                var ps   = $"{source}/icon/{prof}/{part}";
                if (!Directory.Exists(ps))
                {
                    continue;
                }
                var images = Directory.GetFiles(ps);

                var path = $"{target}/image/{prof}/{part}";
                if (!Directory.Exists(path))
                {
                    Directory.CreateDirectory(path);
                }
                for (var i = 0; i < images.Length; i++)
                {
                    var regex = new Regex("\\d+");
                    var match = regex.Match(images[i].GetSuffix());
                    if (match.Success)
                    {
                        var code = match.Value;
                        var arr  = list.Where(item => Npks.MatchCode(item.Name, code)).ToList();
                        var rs   = FindImg(arr, int.Parse(code), part.Equals("skin") ? "body" : part);
                        foreach (var img in rs)
                        {
                            var builder = new LSBuilder();
                            var image   = img[pairs[prof]];
                            ImageToJson(path, prof, part, img.Name, match.Value, image);
                        }
                    }
                }
            }
        }