Exemple #1
0
 /// <summary>
 /// Find StaticTile with matching ID.
 /// </summary>
 /// <returns>True on success</returns>
 public bool FindTile(int ID, out StaticTile staticTile)
 {
     if (staticTiles != null)
     {
         foreach (StaticTile s in staticTiles)
         {
             if (s.ID == ID)
             {
                 staticTile = s;
                 return true;
             }
         }
     }
     staticTile = null;
     return false;
 }
Exemple #2
0
 /// <summary>
 /// Find StaticTile which matches any of the given IDs.
 /// </summary>
 /// <param name="ID">List of IDs to search for.</param>
 /// <param name="staticTile">StaticTile (out).</param>
 /// <returns>True on success.</returns>
 public bool FindTile(int[] ID, out StaticTile staticTile)
 {
     if (staticTiles != null && ID != null)
     {
         foreach (StaticTile s in staticTiles)
         {
             foreach (int i in ID)
             {
                 if (i == s.ID)
                 {
                     staticTile = s;
                     return true;
                 }
             }
         }
     }
     staticTile = null;
     return false;
 }
Exemple #3
0
 public static void Target( int client, StaticTile staticTile )
 {
     ClientInfo ci;
     if (staticTile != null && ClientInfoCollection.GetClient( client, out ci ))
     {
         int x = staticTile.X;
         int y = staticTile.Y;
         int z = staticTile.Z;
         int ID = staticTile.ID;
         byte[] packet = new byte[19];
         packet[0] = 0x6C;
         packet[1] = 0x01;
         packet[2] = (byte) ( ci.TargetID >> 24 );
         packet[3] = (byte) ( ci.TargetID >> 16 );
         packet[4] = (byte) ( ci.TargetID >> 8 );
         packet[5] = (byte) ( ci.TargetID );
         packet[11] = (byte) ( staticTile.X >> 8 );
         packet[12] = (byte) staticTile.X;
         packet[13] = (byte) ( staticTile.Y >> 8 );
         packet[14] = (byte) staticTile.Y;
         //packet[15] = (byte)(staticTile.Z >> 8);
         packet[16] = (byte) staticTile.Z;
         packet[17] = (byte) ( staticTile.ID >> 8 );
         packet[18] = (byte) staticTile.ID;
         SendPacketToServer( client, packet );
         Macro.SetTargetCursor( client, false );
     }
 }
Exemple #4
0
 private static StaticTile[] GetMatchingTiles(StaticRecord[] staticRecords, int x, int y)
 {
     if (staticRecords == null) return null;
     int cellX = x % 8;
     int cellY = y % 8;
     List<StaticTile> tileList = new List<StaticTile>(32);
     foreach (StaticRecord s in staticRecords)
     {
         if (s.x == cellX && s.y == cellY)
         {
             StaticTile staticTile = new StaticTile(TileData.GetStaticTile(s.id));
             staticTile.X = x;
             staticTile.Y = y;
             staticTile.Z = s.z;
             tileList.Add(staticTile);
         }
     }
     if (tileList.Count > 0) return tileList.ToArray();
     return null;
 }