예제 #1
0
 public void OnTarget(object o)
 {
     if (o is IPoint3D)
     {
         Point3D start = this.m_Start;
         Point3D bottom = new Point3D((IPoint3D) o);
         FixPoints(ref start, ref bottom);
         using (StreamWriter writer = new StreamWriter("exported.log", true))
         {
             writer.WriteLine("Exported on {0}", DateTime.Now);
             writer.WriteLine();
             foreach (Item item in World.Items.Values)
             {
                 if (((item.X >= start.X) && (item.X <= bottom.X)) && ((item.Y >= start.Y) && (item.Y <= bottom.Y)))
                 {
                     writer.WriteLine("0x{0:X4}\t0x{1:X4}\t({2}, {3}, {4})\t\t// {5}", new object[] { item.ID & 0x3fff, item.Hue, item.X, item.Y, item.Z, Localization.GetString(0xf9060 + (item.ID & 0x3fff)) });
                 }
             }
             writer.WriteLine("#########################");
         }
     }
     else
     {
         Engine.TargetHandler = this;
     }
 }
        private static void StartInteractionWithTheServer()
        {
            try
            {
                Thread.Sleep(1000);
                Console.WriteLine("===================================");
                Console.Write("Enter the IP adress of the server: ");
                string adress = Console.ReadLine();

                Console.WriteLine("Please enter the (int) variables as X-Y-Z coordinates of some 3d point: ");

                Console.Write("X: ");
                int X =  Convert.ToInt32(Console.In.ReadLine());

                Console.Write("Y: ");
                int Y = Convert.ToInt32(Console.In.ReadLine());

                Console.Write("Z: ");
                int Z = Convert.ToInt32(Console.In.ReadLine());

                var point = new Point3D(X,Y,Z);

                var bytes = Serialization.Serialize(point);

                var SocketSend = new SocketSending();
                SocketSend.Send(adress,13000,bytes);

                Thread.Sleep(1000);
                bool loop = false;
                do
                {
                    Console.WriteLine("Continue? Press Y or N: ");
                    ConsoleKeyInfo key = Console.ReadKey();
                    switch (key.KeyChar)
                    {
                        case 'y':
                            StartInteractionWithTheServer();
                            loop = true;
                            break;
                        case 'n':
                            Environment.Exit(0);
                            break;
                        default:
                            Console.WriteLine("Error!");
                            break;
                    }
                }
                while (loop  == false);

            }
            catch (Exception ex)
            {
               Console.WriteLine(ex.Message);
               StartInteractionWithTheServer();
            }
        }
예제 #3
0
 public void Add(Point3D p)
 {
     if ((this.m_Count + 1) > this.m_List.Length)
     {
         Point3D[] list = this.m_List;
         this.m_List = new Point3D[list.Length * 2];
         for (int i = 0; i < list.Length; i++)
         {
             this.m_List[i] = list[i];
         }
     }
     this.m_List[this.m_Count].X = p.X;
     this.m_List[this.m_Count].Y = p.Y;
     this.m_List[this.m_Count].Z = p.Z;
     this.m_Count++;
 }
예제 #4
0
 public static void FixPoints(ref Point3D top, ref Point3D bottom)
 {
     if (bottom.X < top.X)
     {
         int x = top.X;
         top.X = bottom.X;
         bottom.X = x;
     }
     if (bottom.Y < top.Y)
     {
         int y = top.Y;
         top.Y = bottom.Y;
         bottom.Y = y;
     }
     if (bottom.Z < top.Z)
     {
         int z = top.Z;
         top.Z = bottom.Z;
         bottom.Z = z;
     }
 }
예제 #5
0
 public InternalTargetHandler(Point3D p)
 {
     this.m_Start = p;
 }
예제 #6
0
 public Point3D[] ToArray()
 {
     if (this.m_Count == 0)
     {
         return m_EmptyList;
     }
     Point3D[] pointdArray = new Point3D[this.m_Count];
     for (int i = 0; i < this.m_Count; i++)
     {
         pointdArray[i] = this.m_List[i];
     }
     this.m_Count = 0;
     return pointdArray;
 }
예제 #7
0
파일: World.cs 프로젝트: Skinny1001/PlayUO
 public static bool InRange(Point3D p1, Point3D p2, int range)
 {
     return ((((p1.X >= (p2.X - range)) && (p1.X <= (p2.X + range))) && (p1.Y >= (p2.Y - range))) && (p1.Y <= (p2.Y + range)));
 }
예제 #8
0
파일: Map.cs 프로젝트: Skinny1001/PlayUO
 public static bool LineOfSight(Point3D org, Point3D dest)
 {
     if (!World.InRange(org, dest, m_MaxLOSDistance))
     {
         return false;
     }
     Point3D pointd = org;
     Point3D pointd2 = dest;
     if (((org.X > dest.X) || ((org.X == dest.X) && (org.Y > dest.Y))) || (((org.X == dest.X) && (org.Y == dest.Y)) && (org.Z > dest.Z)))
     {
         Point3D pointd3 = org;
         org = dest;
         dest = pointd3;
     }
     Point3DList pathList = m_PathList;
     if (org != dest)
     {
         double num4;
         if (pathList.Count > 0)
         {
             pathList.Clear();
         }
         int num8 = dest.X - org.X;
         int num9 = dest.Y - org.Y;
         int num10 = dest.Z - org.Z;
         double num3 = Math.Sqrt((double) ((num8 * num8) + (num9 * num9)));
         if (num10 != 0)
         {
             num4 = Math.Sqrt((num3 * num3) + (num10 * num10));
         }
         else
         {
             num4 = num3;
         }
         double num = ((double) num9) / num4;
         double num2 = ((double) num8) / num4;
         num3 = ((double) num10) / num4;
         double y = org.Y;
         double z = org.Z;
         double x = org.X;
         while ((NumberBetween(x, dest.X, org.X, 0.5) && NumberBetween(y, dest.Y, org.Y, 0.5)) && NumberBetween(z, dest.Z, org.Z, 0.5))
         {
             int num11 = (int) Math.Round(x);
             int num12 = (int) Math.Round(y);
             int num13 = (int) Math.Round(z);
             if (pathList.Count > 0)
             {
                 Point3D last = pathList.Last;
                 if (((last.X != num11) || (last.Y != num12)) || (last.Z != num13))
                 {
                     pathList.Add(num11, num12, num13);
                 }
             }
             else
             {
                 pathList.Add(num11, num12, num13);
             }
             x += num2;
             y += num;
             z += num3;
         }
         if (pathList.Count == 0)
         {
             return true;
         }
         if (pathList.Last != dest)
         {
             pathList.Add(dest);
         }
         Point3D top = org;
         Point3D bottom = dest;
         FixPoints(ref top, ref bottom);
         int count = pathList.Count;
         MapPackage cache = GetCache();
         for (int i = 0; i < count; i++)
         {
             Point3D pointd7 = pathList[i];
             int num17 = pointd7.X - cache.CellX;
             int num18 = pointd7.Y - cache.CellY;
             if (((num17 < 0) || (num18 < 0)) || ((num17 >= Renderer.cellWidth) || (num18 >= Renderer.cellHeight)))
             {
                 return false;
             }
             ArrayList list2 = cache.cells[num17, num18];
             bool flag = false;
             bool flag2 = false;
             for (int j = 0; j < list2.Count; j++)
             {
                 int height;
                 TileFlags flags;
                 ICell cell = (ICell) list2[j];
                 if (cell is LandTile)
                 {
                     LandTile tile = (LandTile) cell;
                     for (int k = 0; k < m_InvalidLandTiles.Length; k++)
                     {
                         if (tile.ID == m_InvalidLandTiles[k])
                         {
                             flag = true;
                             break;
                         }
                     }
                     int num21 = 0;
                     int avg = 0;
                     int num23 = 0;
                     GetAverageZ(pointd7.X, pointd7.Y, ref num21, ref avg, ref num23);
                     if ((((num21 > pointd7.Z) || (num23 < pointd7.Z)) || (((pointd7.X == pointd2.X) && (pointd7.Y == pointd2.Y)) && ((num21 <= pointd2.Z) && (num23 >= pointd2.Z)))) || tile.Ignored)
                     {
                         continue;
                     }
                     return false;
                 }
                 if (cell is StaticItem)
                 {
                     flag2 = true;
                     StaticItem item = (StaticItem) cell;
                     flags = m_ItemFlags[item.m_RealID & 0x3fff];
                     height = m_Item[item.m_RealID & 0x3fff].m_Height;
                     if (flags[TileFlag.Bridge])
                     {
                         height /= 2;
                     }
                     if ((((item.m_Z <= pointd7.Z) && ((item.m_Z + height) >= pointd7.Z)) && (flags[TileFlag.Window] || flags[TileFlag.NoShoot])) && (((pointd7.X != pointd2.X) || (pointd7.Y != pointd2.Y)) || ((item.m_Z > pointd2.Z) || ((item.m_Z + height) < pointd2.Z))))
                     {
                         return false;
                     }
                 }
                 else if (cell is DynamicItem)
                 {
                     flag2 = true;
                     DynamicItem item2 = (DynamicItem) cell;
                     flags = m_ItemFlags[item2.m_ID & 0x3fff];
                     height = m_Item[item2.m_ID & 0x3fff].m_Height;
                     if (flags[TileFlag.Bridge])
                     {
                         height /= 2;
                     }
                     if ((((item2.m_Z <= pointd7.Z) && ((item2.m_Z + height) >= pointd7.Z)) && (flags[TileFlag.Window] || flags[TileFlag.NoShoot])) && (((pointd7.X != pointd2.X) || (pointd7.Y != pointd2.Y)) || ((item2.m_Z > pointd2.Z) || ((item2.m_Z + height) < pointd2.Z))))
                     {
                         return false;
                     }
                 }
             }
             if (flag && !flag2)
             {
                 return false;
             }
         }
     }
     return true;
 }
예제 #9
0
파일: Map.cs 프로젝트: Skinny1001/PlayUO
 public static bool LineOfSight(Mobile from, Point3D target)
 {
     Point3D pointd;
     pointd = new Point3D(from.X, from.Y, from.Z) {
         Z = pointd.Z + 14
     };
     return LineOfSight(pointd, target);
 }
예제 #10
0
파일: Map.cs 프로젝트: Skinny1001/PlayUO
 public static bool LineOfSight(Mobile from, Mobile to)
 {
     if (from == to)
     {
         return true;
     }
     Point3D org = new Point3D(from.X, from.Y, from.Z);
     Point3D dest = new Point3D(to.X, to.Y, to.Z);
     org.Z += 14;
     dest.Z += 14;
     return LineOfSight(org, dest);
 }