Example #1
0
        public void Load(int mapId, WzManager wzMan)
        {
            var wz        = wzMan["Map.wz"];
            var path      = $"Map/Map{mapId / 100000000}/{mapId}.img/foothold";
            var footholds = wz.ResolvePath(path);

            foreach (WZObject wz1 in footholds)
            {
                foreach (WZObject wz2 in wz1)
                {
                    foreach (WZObject fh in wz2)
                    {
                        var f = new Foothold
                        {
                            Id   = Convert.ToInt32(fh.Name),
                            Next = fh["next"].ValueOrDie <int>(),
                            Prev = fh["prev"].ValueOrDie <int>(),
                            X1   = (short)fh["x1"].ValueOrDie <int>(),
                            Y1   = (short)fh["y1"].ValueOrDie <int>(),
                            X2   = (short)fh["x2"].ValueOrDie <int>(),
                            Y2   = (short)fh["y2"].ValueOrDie <int>(),
                        };

                        Footholds.Add(f);
                    }
                }
            }
        }
Example #2
0
        public void Load(WZObject mapNode)
        {
            var footholds = mapNode["foothold"];

            foreach (WZObject wz1 in footholds)
            {
                foreach (WZObject wz2 in wz1)
                {
                    foreach (WZObject fh in wz2)
                    {
                        var f = new Foothold
                        {
                            Id   = Convert.ToInt32(fh.Name),
                            Next = fh["next"].ValueOrDie <int>(),
                            Prev = fh["prev"].ValueOrDie <int>(),
                            X1   = (short)fh["x1"].ValueOrDie <int>(),
                            Y1   = (short)fh["y1"].ValueOrDie <int>(),
                            X2   = (short)fh["x2"].ValueOrDie <int>(),
                            Y2   = (short)fh["y2"].ValueOrDie <int>(),
                        };

                        Footholds.Add(f);
                    }
                }
            }
        }
Example #3
0
        public int CompareTo(object obj)
        {
            Foothold foothold = (Foothold)obj;

            if (Y2 < foothold.Y1)
            {
                return(-1);
            }
            if (Y1 > foothold.Y2)
            {
                return(1);
            }

            return(0);
        }
Example #4
0
        /*
         * public void Load(int mapId, WzManager wzMan)
         * {
         *  var wz = wzMan["Map.wz"];
         *  var path = $"Map/Map{mapId / 100000000}/{mapId}.img/foothold";
         *  var footholds = wz.ResolvePath(path);
         *
         *  foreach (WZObject wz1 in footholds)
         *  {
         *      foreach (WZObject wz2 in wz1)
         *      {
         *          foreach (WZObject fh in wz2)
         *          {
         *              var f = new Foothold
         *              {
         *                  Id = Convert.ToInt32(fh.Name),
         *                  Next = fh["next"].ValueOrDie<int>(),
         *                  Prev = fh["prev"].ValueOrDie<int>(),
         *                  X1 = (short)fh["x1"].ValueOrDie<int>(),
         *                  Y1 = (short)fh["y1"].ValueOrDie<int>(),
         *                  X2 = (short)fh["x2"].ValueOrDie<int>(),
         *                  Y2 = (short)fh["y2"].ValueOrDie<int>(),
         *              };
         *
         *              Footholds.Add(f);
         *          }
         *      }
         *
         *  }
         * }*/

        public void Load(WZProperty mapNode)
        {
            var footholds = mapNode.Resolve("foothold").Children;

            foreach (WZProperty x in footholds)
            {
                var f = new Foothold();
                f.Id = Convert.ToInt32(x.Name);
                foreach (var portalChildNode in x.Children)
                {
                    if (portalChildNode.Name == "next")
                    {
                        f.Next = portalChildNode.ResolveFor <int>() ?? 0;
                    }
                    else if (portalChildNode.Name == "prev")
                    {
                        f.Prev = portalChildNode.ResolveFor <int>() ?? 0;
                    }
                    else if (portalChildNode.Name == "x1")
                    {
                        f.X1 = (short)(portalChildNode.ResolveFor <short>() ?? 0);
                    }
                    else if (portalChildNode.Name == "y1")
                    {
                        f.Y1 = (short)(portalChildNode.ResolveFor <int>() ?? 0);
                    }
                    else if (portalChildNode.Name == "x2")
                    {
                        f.X2 = (short)(portalChildNode.ResolveFor <short>() ?? 0);
                    }
                    else if (portalChildNode.Name == "y2")
                    {
                        f.Y2 = (short)(portalChildNode.ResolveFor <short>() ?? 0);
                    }
                }

                Footholds.Add(f);
            }
        }