示例#1
0
        public static string GetValueString(this Wz_Node node)
        {
            var    type = node.GetNodeType();
            string value;

            switch (type)
            {
            case Shared.NodeType.Wz_Uol:
                var target = node.GetValue <Wz_Uol>().HandleUol(node);
                value = $"link:{target.FullPathToFile}";
                break;

            case Shared.NodeType.Wz_Vector:
                var point = node.GetValue <Wz_Vector>();
                value = $"({point.X},{point.Y})";
                break;

            case Shared.NodeType.Wz_Normal:
                value = node.Value.ToString();
                break;

            case Shared.NodeType.Wz_Null:
            case Shared.NodeType.Wz_File:
            case Shared.NodeType.Wz_Image:
            case Shared.NodeType.Wz_Sound:
            case Shared.NodeType.Wz_Png:
            default:
                value = $"link:{node.FullPathToFile}";
                break;
            }
            return(value);
        }
 private object InnerLoad(Wz_Node node, Type assetType)
 {
     if (assetType == typeof(TextureAtlas)) //回头再说
     {
         var png = node.GetValue <Wz_Png>();
         if (png != null)
         {
             return(new TextureAtlas(png.ToTexture(this.GraphicsDevice)));
         }
     }
     else if (assetType == typeof(Texture2D))
     {
         var png = node.GetValue <Wz_Png>();
         if (png != null)
         {
             return(png.ToTexture(this.GraphicsDevice));
         }
     }
     else if (assetType == typeof(Music))
     {
         var sound = node.GetValue <Wz_Sound>();
         if (sound != null)
         {
             return(new Music(sound));
         }
     }
     return(null);
 }
        public static int GetActionDelay(string actionName)
        {
            if (string.IsNullOrEmpty(actionName))
            {
                return(0);
            }
            Wz_Node actionNode = PluginManager.FindWz("Character/00002000.img/" + actionName);

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

            int delay = 0;

            foreach (Wz_Node frameNode in actionNode.Nodes)
            {
                Wz_Node delayNode = frameNode.Nodes["delay"];
                if (delayNode != null)
                {
                    delay += Math.Abs(delayNode.GetValue <int>());
                }
            }

            return(delay);
        }
示例#4
0
        public static PngInfo GetPngInfo(this Wz_Node wz_Node, Wz_Node baseNode)
        {
            var     nodes       = wz_Node.Nodes;
            var     inLinkNode  = nodes["_inlink"];
            var     outLinkNode = nodes["_outlink"];
            PngInfo pngInfo;

            if (inLinkNode != null)
            {
                var link = inLinkNode.Value.ToString().Replace('/', '\\');
                var node = wz_Node.GetNodeWzImage().Node.SearchNode(link);
                pngInfo = node.GetValue <Wz_Png>()?.ToPngInfo();
            }
            else if (outLinkNode != null)
            {
                var link = outLinkNode.Value.ToString().Replace('/', '\\');
                var node = baseNode.SearchNode(link);
                pngInfo = node.GetValue <Wz_Png>()?.ToPngInfo();
            }
            else
            {
                pngInfo = wz_Node.GetValue <Wz_Png>()?.ToPngInfo();
            }
            return(pngInfo);
        }
示例#5
0
        private static Wz_Node SearchNode(this Wz_Node wz_Node, List <string> pathes)
        {
            Wz_Node node;

            pathes.RemoveAt(0);
            if (pathes.Count == 0)
            {
                return(wz_Node);
            }
            node = wz_Node.FindNodeByPath(pathes[0]);
            if (node == null)
            {
                var value = wz_Node.GetValue <Wz_Image>();
                if (value != null)
                {
                    value.TryExtract();
                    wz_Node = value.Node;
                    node    = wz_Node.FindNodeByPath(pathes[0]);
                }
            }
            else
            {
                var value = node.GetValue <Wz_Image>();
                if (value != null)
                {
                    value.TryExtract();
                    node = value.Node;
                }
            }
            return(SearchNode(node, pathes));
        }
示例#6
0
        public static Wz_Node GetImageNode(this Wz_Node wz_Node)
        {
            var image = wz_Node.GetValue <Wz_Image>();

            if (image.TryExtract())
            {
                return(image.Node);
            }
            return(null);
        }
示例#7
0
        private ActionFrame LoadStandardFrame(Wz_Node frameNode)
        {
            ActionFrame frame = new ActionFrame();

            while (frameNode.Value is Wz_Uol)
            {
                frameNode = frameNode.GetValue <Wz_Uol>().HandleUol(frameNode);
            }
            LoadActionFrameDesc(frameNode, frame);
            return(frame);
        }
示例#8
0
        private Wz_Node FindNodeByGearID(Wz_Node characWz, int id)
        {
            string  imgName = id.ToString("D8") + ".img";
            Wz_Node imgNode = null;

            foreach (var node1 in characWz.Nodes)
            {
                if (node1.Text == imgName)
                {
                    imgNode = node1;
                    break;
                }
                else if (node1.Nodes.Count > 0)
                {
                    foreach (var node2 in node1.Nodes)
                    {
                        if (node2.Text == imgName)
                        {
                            imgNode = node2;
                            break;
                        }
                    }
                    if (imgNode != null)
                    {
                        break;
                    }
                }
            }

            if (imgNode != null)
            {
                Wz_Image img = imgNode.GetValue <Wz_Image>();
                if (img != null && img.TryExtract())
                {
                    return(img.Node);
                }
            }

            return(null);
        }
示例#9
0
        public static BitmapOrigin CreateFromNode(Wz_Node node, GlobalFindNodeFunction findNode)
        {
            BitmapOrigin bp = new BitmapOrigin();
            Wz_Uol       uol;

            while ((uol = node.GetValue <Wz_Uol>(null)) != null)
            {
                node = uol.HandleUol(node);
            }

            //获取linkNode
            var    linkNode = node.GetLinkedSourceNode(findNode);
            Wz_Png png      = linkNode?.GetValue <Wz_Png>() ?? (Wz_Png)node.Value;

            bp.Bitmap = png?.ExtractPng();
            Wz_Node   originNode = node.FindNodeByPath("origin");
            Wz_Vector vec        = (originNode == null) ? null : originNode.GetValue <Wz_Vector>();

            bp.Origin = (vec == null) ? new Point() : new Point(vec.X, vec.Y);

            return(bp);
        }
示例#10
0
        public static CharacterConfig GetCharacterConfig(this Wz_Node wz_Node, Wz_Node baseNode)
        {
            if (wz_Node.Value != null && wz_Node.Value is Wz_Uol)
            {
                wz_Node = wz_Node.GetValue <Wz_Uol>().HandleUol(wz_Node);
            }
            var nodes  = wz_Node.Nodes;
            var config = new CharacterConfig
            {
                Name    = wz_Node.Text,
                Origin  = nodes["origin"]?.GetValue <Wz_Vector>(),
                PngInfo = wz_Node.GetPngInfo(baseNode),
                Group   = nodes["group"]?.Value?.ToString(),
                Hash    = nodes["_hash"]?.Value?.ToString(),
                Map     = wz_Node.GetMap(),
                Z       = nodes["z"]?.Value?.ToString(),
                Action  = nodes["action"]?.Value?.ToString(),
                Delay   = nodes["delay"]?.Value?.ToString(),
                Frame   = nodes["frame"]?.Value?.ToString(),
                Move    = nodes["move"]?.GetValue <Wz_Vector>(),
                Rotate  = nodes["rotate"]?.Value?.ToString(),
                Vector  = nodes["vector"]?.GetValue <Wz_Vector>(),
                Flip    = nodes["flip"]?.Value?.ToString()
            };

            if (config.Action != null)
            {
                var link       = $"{config.Action}\\{config.Frame}";
                var node       = wz_Node.GetNodeWzImage().Node.SearchNode(link);
                var baseConfig = node.GetCharacterConfig(baseNode);
                config.Origin  = baseConfig.Origin;
                config.Map     = baseConfig.Map;
                config.Z       = baseConfig.Z;
                config.Group   = baseConfig.Group;
                config.Hash    = baseConfig.Hash;
                config.PngInfo = baseConfig.PngInfo;
            }
            return(config);
        }
示例#11
0
        public static Gear CreateFromNode(Wz_Node node, GlobalFindNodeFunction findNode)
        {
            int   gearID;
            Match m = Regex.Match(node.Text, @"^(\d{8})\.img$");

            if (!(m.Success && Int32.TryParse(m.Result("$1"), out gearID)))
            {
                return(null);
            }
            Gear gear = new Gear();

            gear.ItemID = gearID;
            gear.type   = Gear.GetGearType(gear.ItemID);
            Wz_Node infoNode = node.FindNodeByPath("info");

            if (infoNode != null)
            {
                foreach (Wz_Node subNode in infoNode.Nodes)
                {
                    switch (subNode.Text)
                    {
                    case "icon":
                        if (subNode.Value is Wz_Png)
                        {
                            gear.Icon = BitmapOrigin.CreateFromNode(subNode, findNode);
                        }
                        break;

                    case "iconRaw":
                        if (subNode.Value is Wz_Png)
                        {
                            gear.IconRaw = BitmapOrigin.CreateFromNode(subNode, findNode);
                        }
                        break;

                    case "sample":
                        if (subNode.Value is Wz_Png)
                        {
                            gear.Sample = BitmapOrigin.CreateFromNode(subNode, findNode);
                        }
                        break;

                    case "addition":     //附加属性信息
                        foreach (Wz_Node addiNode in subNode.Nodes)
                        {
                            Addition addi = Addition.CreateFromNode(addiNode);
                            if (addi != null)
                            {
                                gear.Additions.Add(addi);
                            }
                        }
                        gear.Additions.Sort((add1, add2) => (int)add1.Type - (int)add2.Type);
                        break;

                    case "option":     //附加潜能信息
                        Wz_Node itemWz = findNode != null?findNode("Item\\ItemOption.img") : null;

                        if (itemWz == null)
                        {
                            break;
                        }
                        int optIdx = 0;
                        foreach (Wz_Node optNode in subNode.Nodes)
                        {
                            int optId = 0, optLevel = 0;
                            foreach (Wz_Node optArgNode in optNode.Nodes)
                            {
                                switch (optArgNode.Text)
                                {
                                case "option": optId = Convert.ToInt32(optArgNode.Value); break;

                                case "level": optLevel = Convert.ToInt32(optArgNode.Value); break;
                                }
                            }

                            Potential opt = Potential.CreateFromNode(itemWz.FindNodeByPath(optId.ToString("d6")), optLevel);
                            if (opt != null)
                            {
                                gear.Options[optIdx++] = opt;
                            }
                        }
                        break;

                    case "level":     //可升级信息
                        if (subNode.Nodes["fixLevel"].GetValueEx <int>(0) != 0)
                        {
                            gear.FixLevel = true;
                        }

                        Wz_Node levelInfo = subNode.Nodes["info"];
                        gear.Levels = new List <GearLevelInfo>();
                        if (levelInfo != null)
                        {
                            for (int i = 1; ; i++)
                            {
                                Wz_Node levelInfoNode = levelInfo.Nodes[i.ToString()];
                                if (levelInfoNode != null)
                                {
                                    GearLevelInfo info = GearLevelInfo.CreateFromNode(levelInfoNode);
                                    int           lv;
                                    Int32.TryParse(levelInfoNode.Text, out lv);
                                    info.Level = lv;
                                    gear.Levels.Add(info);
                                }
                                else
                                {
                                    break;
                                }
                            }
                        }

                        Wz_Node levelCase = subNode.Nodes["case"];
                        if (levelCase != null)
                        {
                            int probTotal = 0;
                            foreach (Wz_Node caseNode in levelCase.Nodes)
                            {
                                int prob = caseNode.Nodes["prob"].GetValueEx(0);
                                probTotal += prob;
                                for (int i = 0; i < gear.Levels.Count; i++)
                                {
                                    GearLevelInfo info      = gear.Levels[i];
                                    Wz_Node       caseLevel = caseNode.Nodes[info.Level.ToString()];
                                    if (caseLevel != null)
                                    {
                                        //desc
                                        Wz_Node caseHS = caseLevel.Nodes["hs"];
                                        if (caseHS != null)
                                        {
                                            info.HS = caseHS.GetValue <string>();
                                        }

                                        //随机技能
                                        Wz_Node caseSkill = caseLevel.Nodes["Skill"];
                                        if (caseSkill != null)
                                        {
                                            foreach (Wz_Node skillNode in caseSkill.Nodes)
                                            {
                                                int id    = skillNode.Nodes["id"].GetValueEx(-1);
                                                int level = skillNode.Nodes["level"].GetValueEx(-1);
                                                if (id >= 0 && level >= 0)
                                                {
                                                    info.Skills[id] = level;
                                                }
                                            }
                                        }

                                        //装备技能
                                        Wz_Node equipSkill = caseLevel.Nodes["EquipmentSkill"];
                                        if (equipSkill != null)
                                        {
                                            foreach (Wz_Node skillNode in equipSkill.Nodes)
                                            {
                                                int id    = skillNode.Nodes["id"].GetValueEx(-1);
                                                int level = skillNode.Nodes["level"].GetValueEx(-1);
                                                if (id >= 0 && level >= 0)
                                                {
                                                    info.EquipmentSkills[id] = level;
                                                }
                                            }
                                        }
                                        info.Prob = prob;
                                    }
                                }
                            }

                            foreach (var info in gear.Levels)
                            {
                                info.ProbTotal = probTotal;
                            }
                        }
                        gear.Props.Add(GearPropType.level, 1);
                        break;

                    case "sealed":     //封印解除信息
                        Wz_Node sealedInfo = subNode.Nodes["info"];
                        gear.Seals = new List <GearSealedInfo>();
                        if (sealedInfo != null)
                        {
                            foreach (Wz_Node levelInfoNode in sealedInfo.Nodes)
                            {
                                GearSealedInfo info = GearSealedInfo.CreateFromNode(levelInfoNode, findNode);
                                int            lv;
                                Int32.TryParse(levelInfoNode.Text, out lv);
                                info.Level = lv;
                                gear.Seals.Add(info);
                            }
                        }
                        gear.Props.Add(GearPropType.@sealed, 1);
                        break;

                    case "variableStat":     //升级奖励属性
                        foreach (Wz_Node statNode in subNode.Nodes)
                        {
                            GearPropType type;
                            if (Enum.TryParse(statNode.Text, out type))
                            {
                                try
                                {
                                    gear.VariableStat.Add(type, Convert.ToSingle(statNode.Value));
                                }
                                finally
                                {
                                }
                            }
                        }
                        break;

                    case "abilityTimeLimited":     //限时属性
                        foreach (Wz_Node statNode in subNode.Nodes)
                        {
                            GearPropType type;
                            if (Enum.TryParse(statNode.Text, out type))
                            {
                                try
                                {
                                    gear.AbilityTimeLimited.Add(type, Convert.ToInt32(statNode.Value));
                                }
                                finally
                                {
                                }
                            }
                        }
                        break;

                    default:
                    {
                        GearPropType type;
                        if (!int.TryParse(subNode.Text, out _) && Enum.TryParse(subNode.Text, out type))
                        {
                            try
                            {
                                gear.Props.Add(type, Convert.ToInt32(subNode.Value));
                            }
                            finally
                            {
                            }
                        }
                    }
                    break;
                    }
                }
            }
            int value;

            //读取默认可升级状态
            if (gear.Props.TryGetValue(GearPropType.tuc, out value) && value > 0)
            {
                gear.HasTuc       = true;
                gear.CanPotential = true;
            }
            else if (Gear.SpecialCanPotential(gear.type))
            {
                gear.CanPotential = true;
            }

            //读取默认gearGrade
            if (gear.Props.TryGetValue(GearPropType.fixedGrade, out value))
            {
                gear.Grade = (GearGrade)(value - 1);
            }

            //自动填充Grade
            if (gear.Options.Any(opt => opt != null) && gear.Grade == GearGrade.C)
            {
                gear.Grade = GearGrade.B;
            }

            //添加默认装备要求
            GearPropType[] types = new GearPropType[] {
                GearPropType.reqJob, GearPropType.reqLevel, GearPropType.reqSTR, GearPropType.reqDEX,
                GearPropType.reqINT, GearPropType.reqLUK
            };
            foreach (GearPropType type in types)
            {
                if (!gear.Props.ContainsKey(type))
                {
                    gear.Props.Add(type, 0);
                }
            }

            //修复恶魔盾牌特殊属性
            if (gear.type == GearType.demonShield)
            {
                if (gear.Props.TryGetValue(GearPropType.incMMP, out value))
                {
                    gear.Props.Remove(GearPropType.incMMP);
                    gear.Props.Add(GearPropType.incMDF, value);
                }
            }

            //备份标准属性
            gear.StandardProps = new Dictionary <GearPropType, int>(gear.Props);

            //追加限时属性
            gear.MakeTimeLimitedPropAvailable();

            return(gear);
        }
示例#12
0
        private Wz_Node[] LinkPlayerParts(ActionFrame bodyAction, ActionFrame faceAction)
        {
            //寻找所有部件
            List <Wz_Node> partNode = new List <Wz_Node>();

            //链接人
            if (this.Body != null && this.Head != null && bodyAction != null &&
                this.Body.Visible && this.Head.Visible)
            {
                //身体
                Wz_Node bodyNode = FindBodyActionNode(bodyAction);
                partNode.Add(bodyNode);

                //头部
                bool?face = bodyAction.Face;          //扩展动作规定头部
                if (face == null && bodyNode != null) //链接的body内规定
                {
                    Wz_Node propNode = bodyNode.FindNodeByPath("face");
                    if (propNode != null)
                    {
                        face = propNode.GetValue <int>(0) != 0;
                    }
                }

                if (face ?? false)
                {
                    ActionFrame headAction = new ActionFrame()
                    {
                        Action = "front"
                    };
                    partNode.Add(FindActionFrameNode(this.Head.Node, headAction));
                }
                else
                {
                    partNode.Add(FindActionFrameNode(this.Head.Node, bodyAction));
                }

                //脸
                if (this.Face != null && this.Face.Visible && faceAction != null)
                {
                    partNode.Add(FindActionFrameNode(this.Face.Node, faceAction));
                }
                //毛
                if (this.Hair != null && this.Hair.Visible)
                {
                    if (face ?? false)
                    {
                        ActionFrame headAction = new ActionFrame()
                        {
                            Action = "default"
                        };
                        partNode.Add(FindActionFrameNode(this.Hair.Node, headAction));
                    }
                    else
                    {
                        partNode.Add(FindActionFrameNode(this.Hair.Node, bodyAction));
                    }
                }
                //其他部件
                for (int i = 4; i < 16; i++)
                {
                    var part = this.Parts[i];
                    if (part != null && part.Visible)
                    {
                        if (i == 12 && Gear.GetGearType(part.ID.Value) == GearType.cashWeapon) //点装武器
                        {
                            var wpNode = part.Node.FindNodeByPath(this.WeaponType.ToString());
                            partNode.Add(FindActionFrameNode(wpNode, bodyAction));
                        }
                        else if (i == 14) //脸
                        {
                            partNode.Add(FindActionFrameNode(part.Node, faceAction));
                        }
                        else //其他部件
                        {
                            partNode.Add(FindActionFrameNode(part.Node, bodyAction));
                        }
                    }
                }
            }

            partNode.RemoveAll(node => node == null);

            return(partNode.ToArray());
        }
示例#13
0
        private void CreateBone(Bone root, Wz_Node[] frameNodes, bool?bodyFace = null)
        {
            bool face = true;

            foreach (Wz_Node partNode in frameNodes)
            {
                Wz_Node linkPartNode = partNode;
                if (linkPartNode.Value is Wz_Uol)
                {
                    linkPartNode = linkPartNode.GetValue <Wz_Uol>().HandleUol(linkPartNode);
                }

                foreach (Wz_Node childNode in linkPartNode.Nodes) //分析部件
                {
                    Wz_Node linkNode = childNode;
                    if (childNode.Value is Wz_Uol)
                    {
                        linkNode = ((Wz_Uol)childNode.Value).HandleUol(linkNode);
                        if (linkNode == null)
                        {
                            continue;
                        }
                    }
                    if (childNode.Text == "hairShade")
                    {
                        linkNode = childNode.FindNodeByPath("0");
                        if (linkNode == null)
                        {
                            continue;
                        }
                    }
                    if (linkNode.Value is Wz_Png)
                    {
                        //过滤纹理
                        switch (childNode.Text)
                        {
                        case "face": if (!(bodyFace ?? face))
                            {
                                continue;
                            }
                            break;

                        case "ear": if (!ShowEar)
                            {
                                continue;
                            }
                            break;

                        case "hairOverHead":
                        case "backHairOverCape":
                        case "backHair": if (HairCover)
                            {
                                continue;
                            }
                            break;

                        case "hair":
                        case "backHairBelowCap": if (!HairCover)
                            {
                                continue;
                            }
                            break;

                        case "hairShade": if (!ShowHairShade)
                            {
                                continue;
                            }
                            break;

                        default:
                            if (childNode.Text.StartsWith("weapon"))
                            {
                                //检查是否多武器颜色
                                if (linkNode.ParentNode.FindNodeByPath("weapon1") != null)
                                {
                                    //只追加限定武器
                                    string weaponName = "weapon" + (this.WeaponIndex == 0 ? "" : this.WeaponIndex.ToString());
                                    if (childNode.Text != weaponName)
                                    {
                                        continue;
                                    }
                                }
                            }
                            break;
                        }

                        //读取纹理
                        Skin skin = new Skin();
                        skin.Name  = childNode.Text;
                        skin.Image = BitmapOrigin.CreateFromNode(linkNode, PluginBase.PluginManager.FindWz);
                        skin.Z     = linkNode.FindNodeByPath("z").GetValueEx <string>(null);

                        //读取骨骼
                        Wz_Node mapNode = linkNode.FindNodeByPath("map");
                        if (mapNode != null)
                        {
                            Bone parentBone = null;
                            foreach (var map in mapNode.Nodes)
                            {
                                string mapName   = map.Text;
                                Point  mapOrigin = map.GetValue <Wz_Vector>();

                                if (mapName == "muzzle") //特殊处理 忽略
                                {
                                    continue;
                                }

                                if (parentBone == null) //主骨骼
                                {
                                    parentBone = AppendBone(root, null, skin, mapName, mapOrigin);
                                }
                                else //级联骨骼
                                {
                                    AppendBone(root, parentBone, skin, mapName, mapOrigin);
                                }
                            }
                        }
                        else
                        {
                            root.Skins.Add(skin);
                        }
                    }
                    else
                    {
                        switch (childNode.Text)
                        {
                        case "face":
                            face = Convert.ToInt32(childNode.Value) != 0;
                            break;
                        }
                    }
                }
            }
        }
示例#14
0
        public static Skill CreateFromNode(Wz_Node node, GlobalFindNodeFunction findNode)
        {
            Skill skill = new Skill();
            int   skillID;

            if (!Int32.TryParse(node.Text, out skillID))
            {
                return(null);
            }
            skill.SkillID = skillID;

            foreach (Wz_Node childNode in node.Nodes)
            {
                switch (childNode.Text)
                {
                case "icon":
                    skill.Icon = BitmapOrigin.CreateFromNode(childNode, findNode);
                    break;

                case "iconMouseOver":
                    skill.IconMouseOver = BitmapOrigin.CreateFromNode(childNode, findNode);
                    break;

                case "iconDisabled":
                    skill.IconDisabled = BitmapOrigin.CreateFromNode(childNode, findNode);
                    break;

                case "common":
                    foreach (Wz_Node commonNode in childNode.Nodes)
                    {
                        if (commonNode.Value != null && !(commonNode.Value is Wz_Vector))
                        {
                            skill.common[commonNode.Text] = commonNode.Value.ToString();
                        }
                    }
                    break;

                case "PVPcommon":
                    foreach (Wz_Node commonNode in childNode.Nodes)
                    {
                        if (commonNode.Value != null && !(commonNode.Value is Wz_Vector))
                        {
                            skill.PVPcommon[commonNode.Text] = commonNode.Value.ToString();
                        }
                    }
                    break;

                case "level":
                    for (int i = 1; ; i++)
                    {
                        Wz_Node levelNode = childNode.FindNodeByPath(i.ToString());
                        if (levelNode == null)
                        {
                            break;
                        }
                        Dictionary <string, string> levelInfo = new Dictionary <string, string>();

                        foreach (Wz_Node commonNode in levelNode.Nodes)
                        {
                            if (commonNode.Value != null && !(commonNode.Value is Wz_Vector))
                            {
                                levelInfo[commonNode.Text] = commonNode.Value.ToString();
                            }
                        }

                        skill.levelCommon.Add(levelInfo);
                    }
                    break;

                case "hyper":
                    skill.Hyper = (HyperSkillType)childNode.GetValue <int>();
                    break;

                case "invisible":
                    skill.Invisible = childNode.GetValue <int>() != 0;
                    break;

                case "combatOrders":
                    skill.CombatOrders = childNode.GetValue <int>() != 0;
                    break;

                case "notRemoved":
                    skill.NotRemoved = childNode.GetValue <int>() != 0;
                    break;

                case "masterLevel":
                    skill.MasterLevel = childNode.GetValue <int>();
                    break;

                case "reqLev":
                    skill.ReqLevel = childNode.GetValue <int>();
                    break;

                case "req":
                    foreach (Wz_Node reqNode in childNode.Nodes)
                    {
                        if (reqNode.Text == "level")
                        {
                            skill.ReqLevel = reqNode.GetValue <int>();
                        }
                        else if (reqNode.Text == "reqAmount")
                        {
                            skill.ReqAmount = reqNode.GetValue <int>();
                        }
                        else
                        {
                            int reqSkill;
                            if (Int32.TryParse(reqNode.Text, out reqSkill))
                            {
                                skill.ReqSkill[reqSkill] = reqNode.GetValue <int>();
                            }
                        }
                    }
                    break;

                case "action":
                    for (int i = 0; ; i++)
                    {
                        Wz_Node idxNode = childNode.FindNodeByPath(i.ToString());
                        if (idxNode == null)
                        {
                            break;
                        }
                        skill.Action.Add(idxNode.GetValue <string>());
                    }
                    break;
                }
            }

            //判定技能声明版本
            skill.PreBBSkill = false;
            if (skill.levelCommon.Count > 0)
            {
                if (skill.common.Count <= 0 ||
                    (skill.common.Count == 1 && skill.common.ContainsKey("maxLevel")))
                {
                    skill.PreBBSkill = true;
                }
            }

            return(skill);
        }
示例#15
0
        private void LoadBack()
        {
            Wz_Node mapWz = PluginManager.FindWz(Wz_Type.Map);
            Dictionary <string, RenderFrame>   loadedBackRes = new Dictionary <string, RenderFrame>();
            Dictionary <string, RenderFrame[]> loadedFrames  = new Dictionary <string, RenderFrame[]>();

            if (mapWz == null)
            {
                return;
            }
            Wz_Node backLstNode = mapImg.Node.FindNodeByPath("back");

            if (backLstNode != null)
            {
                string[] path = new string[4];

                foreach (Wz_Node node in backLstNode.Nodes)
                {
                    Wz_Node x               = node.FindNodeByPath("x"),
                                 y          = node.FindNodeByPath("y"),
                                 bs         = node.FindNodeByPath("bS"),
                                 ani        = node.FindNodeByPath("ani"),
                                 no         = node.FindNodeByPath("no"),
                                 f          = node.FindNodeByPath("f"),
                                 front      = node.FindNodeByPath("front"),
                                 type       = node.FindNodeByPath("type"),
                                 cx         = node.FindNodeByPath("cx"),
                                 cy         = node.FindNodeByPath("cy"),
                                 rx         = node.FindNodeByPath("rx"),
                                 ry         = node.FindNodeByPath("ry"),
                                 a          = node.FindNodeByPath("a"),
                                 screenMode = node.FindNodeByPath("screenMode");

                    if (bs != null && no != null)
                    {
                        bool _ani  = ani.GetValueEx <int>(0) != 0;
                        int  _type = type.GetValueEx <int>(0);

                        path[0] = "Back";
                        path[1] = bs.GetValue <string>() + ".img";
                        path[2] = _ani ? "ani" : "back";
                        path[3] = no.GetValue <string>();

                        string key = string.Join("\\", path);

                        RenderFrame[] frames;
                        if (!loadedFrames.TryGetValue(key, out frames))
                        {
                            Wz_Node objResNode = mapWz.FindNodeByPath(true, path);
                            if (objResNode == null)
                            {
                                continue;
                            }
                            frames            = LoadFrames(objResNode, loadedBackRes);
                            loadedFrames[key] = frames;
                        }

                        BackPatch patch = new BackPatch();
                        patch.ObjectType = front.GetValueEx <int>(0) != 0 ? RenderObjectType.Front : RenderObjectType.Back;
                        patch.Position   = new Vector2(x.GetValueEx <int>(0), y.GetValueEx <int>(0));
                        patch.Cx         = cx.GetValueEx <int>(0);
                        patch.Cy         = cy.GetValueEx <int>(0);
                        patch.Rx         = rx.GetValueEx <int>(0);
                        patch.Ry         = ry.GetValueEx <int>(0);
                        patch.Frames     = new RenderAnimate(frames);
                        patch.Flip       = f.GetValueEx <int>(0) != 0;
                        patch.TileMode   = GetBackTileMode(_type);
                        patch.Alpha      = a.GetValueEx <int>(255);
                        patch.ScreenMode = screenMode.GetValueEx <int>(0);

                        patch.ZIndex[0] = (int)patch.ObjectType;
                        Int32.TryParse(node.Text, out patch.ZIndex[1]);

                        patch.Name = string.Format("back_{0}", node.Text);

                        if (patch.ObjectType == RenderObjectType.Back)
                        {
                            this.Back.Nodes.Add(patch);
                        }
                        else if (patch.ObjectType == RenderObjectType.Front)
                        {
                            this.Front.Nodes.Add(patch);
                        }
                    }
                } // end foreach

                this.Back.Nodes.Sort();
                this.Front.Nodes.Sort();
            }
        }