Advertisement
miceiken

Untitled

Mar 8th, 2011
107
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.91 KB | None | 0 0
  1.     public class FishingScript : Script
  2.     {
  3.         public FishingScript()
  4.             : base("Fishing", "Bot")
  5.         { }
  6.  
  7.         private int Fishes = 0;
  8.         private WoWSpell Fishing = WoWSpell.Invalid;
  9.  
  10.         public override void OnStart()
  11.         {
  12.             Fishing = WoWSpell.GetSpell("Fishing");
  13.             if (!Fishing.IsValid)
  14.             {
  15.                 Print("You don't know fishing!");
  16.                 Stop();
  17.             }
  18.         }
  19.  
  20.         public override void OnTick()
  21.         {
  22.             if (!IsFishing)
  23.             {
  24.                 Print("Casting Fishing Pole");
  25.                 Fishing.Cast();
  26.                 Sleep(1200);
  27.             }
  28.  
  29.             if (Bobber.IsValid && IsFishing)
  30.             {
  31.                 if (IsBobbing)
  32.                 {
  33.                     Print("Looks like we have a bait!");                    
  34.                     Bobber.Interact();
  35.                     Fishes++;
  36.                     Sleep(1000);
  37.                 }
  38.                 else
  39.                     Sleep(200);
  40.             }
  41.         }
  42.  
  43.         public override void OnTerminate()
  44.         {
  45.             Print("Fishing season is over! You did however catch {0} fishes.", Fishes);
  46.         }
  47.  
  48.         private WoWGameObject Bobber
  49.         {
  50.             get
  51.             {
  52.                 return Manager.Objects.Where(b => b.IsValid && b.IsGameObject)
  53.                     .Select(b => b as WoWGameObject)
  54.                     .Where(b => b.CreatedByMe && b.Name == "Fishing Bobber")
  55.                     .FirstOrDefault() ?? WoWGameObject.Invalid;
  56.             }
  57.         }
  58.  
  59.         private bool IsBobbing
  60.         {
  61.             get { return (Bobber.IsValid ? (Helper.Magic.Read<int>(Bobber.Pointer + 0xD4) & 1) != 0: false); }
  62.         }
  63.  
  64.         private bool IsFishing
  65.         {
  66.             get { return Manager.LocalPlayer.ChanneledCastingId == Fishing.Id; }
  67.         }
  68.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement