Advertisement
RulerOf

Untitled

Jun 2nd, 2012
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 2.34 KB | None | 0 0
  1.        
  2.     var units = Unit.Get();
  3.  
  4.         var unit = default(Unit);
  5.  
  6.         if(units != null)
  7.             unit = units.Where(u => u != default(Unit) && u.Name != null && u.Name.Contains("Shadow")).FirstOrDefault();
  8.  
  9.         while(unit != default(Unit))
  10.         {
  11.             Attack.AttackArea(TimeSpan.FromSeconds(5));
  12.              
  13.             units = Unit.Get();
  14.             if (units != null)
  15.                 unit = units.Where(u => u != null && u.Name != null && u.Name.Contains("Shadow")).FirstOrDefault();
  16.             else
  17.                 unit = default(Unit);
  18.         }
  19.  
  20.  
  21. //That code calls this function, but never prints "AttackArea Timeout!"
  22.  
  23.  
  24.  
  25.  public static void AttackArea(TimeSpan timeout)
  26.         {
  27.             TimeSpan startTime = TimeSpan.FromTicks(System.Environment.TickCount);
  28.  
  29.             while (TimeSpan.FromTicks(System.Environment.TickCount).Subtract(startTime) < timeout)
  30.             {
  31.                 if (Me.IsSkillReady(SNOPowerId.Witchdoctor_BigBadVoodoo))
  32.                 {
  33.                     Me.UsePower(SNOPowerId.Witchdoctor_BigBadVoodoo);
  34.                     Thread.Sleep(200);
  35.                 }
  36.                 if (Me.IsSkillReady(SNOPowerId.Witchdoctor_SpiritWalk))
  37.                 {
  38.                     Me.UsePower(SNOPowerId.Witchdoctor_SpiritWalk);
  39.                     Thread.Sleep(200);
  40.                 }
  41.                 if (Me.IsSkillReady(SNOPowerId.Witchdoctor_MassConfusion))
  42.                 {
  43.                     Me.UsePower(SNOPowerId.Witchdoctor_MassConfusion);
  44.                     Thread.Sleep(200);
  45.                 }
  46.                 if (Me.IsSkillReady(SNOPowerId.Witchdoctor_SummonZombieDog))
  47.                 {
  48.                     Me.UsePower(SNOPowerId.Witchdoctor_SummonZombieDog);
  49.                     Thread.Sleep(200);
  50.                 }
  51.                 if (Me.IsSkillReady(SNOPowerId.Witchdoctor_Sacrifice))
  52.                 {
  53.                     Me.UsePower(SNOPowerId.Witchdoctor_Sacrifice);
  54.                     Thread.Sleep(200);
  55.                 }
  56.                 //Draw.DrawText(10.0f, 10.0f, 0x16A, 0x16, 0xFFFFFFFF, String.Format("Attack Time: {0}", TimeSpan.FromTicks(System.Environment.TickCount).Subtract(startTime).Seconds));
  57.  
  58.                 Thread.Sleep(100);
  59.             }
  60.             Game.Print("AttackArea Timeout!");
  61.            
  62.             return;
  63.         }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement