Advertisement
uhmm

HexingPants.cs

Feb 3rd, 2022
182
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 2.19 KB | None | 0 0
  1. namespace Turbo.plugins.patrick.autoactions.actions.rift {
  2.     using System;
  3.     using System.Collections.Generic;
  4.     using System.ComponentModel;
  5.     using System.Linq;
  6.     using System.Windows.Forms;
  7.     using Newtonsoft.Json;
  8.     using parameters.types;
  9.     using parameters;
  10.     using Plugins;
  11.     using util.thud;
  12.     using util.input;
  13.  
  14.     public class HexingPants : AbstractAutoAction {
  15.         public static bool ToggledOn { get; set; } = true;
  16.         public int MinimumIntervalMS { get; set; } = 500;
  17.         public int WiggleDistance { get; set; } = 25;
  18.         private bool GoLeftNow = true;
  19.         private long lastTimeMoved = 0;
  20.        
  21.         public override string tooltip => "Wiggle";
  22.  
  23.         public override string GetAttributes() {
  24.             return $"[ {nameof(MinimumIntervalMS)}: {MinimumIntervalMS}, {nameof(WiggleDistance)} : {WiggleDistance} ]";
  25.         }
  26.  
  27.         public override long minimumExecutionDelta => 64;
  28.  
  29.         public override List<AbstractParameter> GetParameters()
  30.         {
  31.             return new List<AbstractParameter>
  32.             {
  33.                 SimpleParameter<int>.of(nameof(MinimumIntervalMS), x => MinimumIntervalMS = x),
  34.                 SimpleParameter<int>.of(nameof(WiggleDistance), x => WiggleDistance = x),
  35.             };
  36.         }
  37.  
  38.         public override bool Applicable(IController hud)
  39.         {
  40.             return ToggledOn &&
  41.                 hud.Game.Me.IsInGame &&
  42.                 !hud.Game.Me.IsDead &&
  43.                 hud.Game.SpecialArea == SpecialArea.GreaterRift &&
  44.                 hud.Game.Me.Powers.BuffIsActive(hud.Sno.SnoPowers.HexingPantsOfMrYan.Sno) &&
  45.                 (DateTimeOffset.Now.ToUnixTimeMilliseconds() - lastTimeMoved > MinimumIntervalMS);
  46.         }
  47.  
  48.         public override void Invoke(IController hud)
  49.         {
  50.             int toAdd = GoLeftNow ? -WiggleDistance : +WiggleDistance;
  51.             GoLeftNow = !GoLeftNow;
  52.             lastTimeMoved = DateTimeOffset.Now.ToUnixTimeMilliseconds();
  53.             InputSimulator.PostMessageKeyPress(Keys.MButton, (int)hud.Game.Me.FloorCoordinate.ToScreenCoordinate().X + toAdd, (int)hud.Game.Me.FloorCoordinate.ToScreenCoordinate().Y);
  54.         }
  55.     }
  56. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement