Advertisement
Guest User

Untitled

a guest
Apr 18th, 2014
59
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 3.11 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using MuPie_X;
  6. using System.Collections;
  7. using System.Threading;
  8.  
  9. namespace DrMike_Trainer.Classes
  10. {
  11.     class Actions
  12.     {
  13.         private ArrayList GameConnections = new ArrayList();
  14.         bool isRunning = false;
  15.         List<byte[]> Array = new List<byte[]>();
  16.         int delay = 0;
  17.         byte[] MovingBytes = new byte[3] { 181, 73, 75 };
  18.         byte[] MovingByte = new byte[3] { 181, 122, 75 };
  19.         public static bool ContainsSequence(byte[] toSearch, byte[] toFind)
  20.         {
  21.             for (var i = 0; i + toFind.Length < toSearch.Length; i++)
  22.             {
  23.                 var allSame = true;
  24.                 for (var j = 0; j < toFind.Length; j++)
  25.                 {
  26.                     if (toSearch[i + j] != toFind[j])
  27.                     {
  28.                         allSame = false;
  29.                         break;
  30.                     }
  31.                 }
  32.  
  33.                 if (allSame)
  34.                 {
  35.                     return true;
  36.                 }
  37.             }
  38.  
  39.             return false;
  40.         }
  41.         public void AddBytes(string[] copyself)
  42.         {
  43.             string[] nigga = copyself;
  44.             foreach (string item in nigga)
  45.             {
  46.                 try
  47.                 {
  48.                     string[] obj = item.Trim().Split(' ');
  49.                     byte[] Data = new byte[obj.Length];
  50.                     int s = 0;
  51.                     for (s = 0; s < Data.Length; s++)
  52.                     {
  53.                         string inter = obj[s].ToString();
  54.                         byte tmp = byte.Parse(inter, System.Globalization.NumberStyles.AllowHexSpecifier);
  55.                         Data[s] = tmp;
  56.                     }
  57.                     Array.Add(Data);
  58.                 }
  59.                 catch { }
  60.             }
  61.         }
  62.         public void SendOne(byte[] packet)
  63.         {
  64.             try
  65.             {
  66.                 for (int i = 0; i < GameConnections.Count; i++)
  67.                     ((MuGameConnection)GameConnections[i]).SendServer(packet);
  68.             }
  69.             catch
  70.             {
  71.                
  72.             }
  73.         }
  74.         public void Run()
  75.         {
  76.             isRunning = true;
  77.             while (isRunning)
  78.             {
  79.                 foreach(byte[] s in Array){
  80.                     if (ContainsSequence(s, MovingByte) || ContainsSequence(s, MovingBytes))
  81.                     {
  82.                         Thread.Sleep(50);
  83.                         SendOne(s);
  84.                     }
  85.                     else
  86.                     {
  87.                         for (int i = 0; i < 3; i++)
  88.                         {
  89.                             SendOne(s);
  90.                             Thread.Sleep(delay);
  91.                         }
  92.                     }
  93.                 }
  94.             }
  95.         }
  96.         public void Stop()
  97.         {
  98.             isRunning = false;
  99.         }
  100.         public Actions(int delays, ArrayList gameCon)
  101.         {
  102.             this.delay = delays;
  103.             this.GameConnections = gameCon;
  104.         }
  105.     }
  106. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement