All pastes #418824 Raw Edit

Stuff

public text v1 · immutable
#418824 ·published 2007-03-31 21:12 UTC
rendered paste body
        public void PlotBox()
        {
                string RegionName;
                int Degrees = 0;
                double Distance = (MaximumBoxSize * 2); // To compensate for the corners of the square
                double X1, X2, Y1, Y2, Z1, Z2;
                Coords Location = new Coords(Game.Instance.WoW.Me.Location);
                Coords CollisionPoint;
                double X, Y;

                Z1 = Location.Z;
                Z2 = Location.Z;
                do
                {
                    X = Location.X + (MaximumBoxSize / 2) * Math.Cos(Degrees);
                    Y = Location.Y - (MaximumBoxSize / 2) * Math.Sin(Degrees);

                    CollisionPoint = new Coords(Game.Instance.WoW.IsPathObstructed(Location.X, Location.Y, Location.Z, X, Y, Location.Z));
                    if (CollisionPoint != null)
                    {
                        if (Utility.Distance(Location, CollisionPoint) < Distance)
                        {
                            Distance = Utility.Distance(Location.X, Location.Y, Location.Z, CollisionPoint.X, CollisionPoint.Y, Location.Z);
                        }
                    }

                    Degrees = Degrees + 30;
                }
                while (Degrees <= 360);

                if (Distance > (MaximumBoxSize / 2))
                {
                    Distance = (MaximumBoxSize / 2);
                }

                X1 = Location.X - Distance;
                Y1 = Location.Y - Distance;
                X2 = Location.X + Distance;
                Y2 = Location.Y + Distance;
                Z1 = Location.Z;
                Z2 = Location.Z + 1;

                

                RegionName = string.Format("R{0}", SubZone.ChildCount);
                SubZone.AddBox(RegionName, X1, X2, Y1, Y2, Z1, Z2, 0);

                Output.Instance.Echo(string.Format("Added: {0} Size: {1}", RegionName, (Distance * 2)));
        }