/// <summary> /// Instantiates a FFXIVLIB instance. /// PID is optional but required if multiple FFXIV process are running. /// </summary> /// <param name="pid">FFXIV PID (optionnal)</param> public FFXIVLIB(int pid = 0) { if (pid != 0) { ffxiv_process = Process.GetProcessById(pid); } else { Process[] p = Process.GetProcessesByName(Constants.PROCESS_NAME); if (p.Length <= 0) { throw new InvalidOperationException("No FFXIV process."); } if (p.Length > 1) { throw new InvalidOperationException("Call the constructor with PID if multiple process."); } ffxiv_process = p[0]; } Pid = ffxiv_process.Id; _mr = MemoryReader.SetInstance(ffxiv_process); _ss = new SigScanner(Pid, true); Ski = SendKeyInput.SetInstance(ffxiv_process.MainWindowHandle); }
/// <summary> /// Instantiates a FFXIVLIB instance. /// PID is optionnal but required if multiple FFXIV process are running. /// </summary> /// <param name="pid">FFXIV PID (optionnal)</param> public FFXIVLIB(int pid = 0) { if (pid != 0) ffxiv_process = Process.GetProcessById(pid); else { Process[] p = Process.GetProcessesByName(Constants.PROCESS_NAME); if (p.Length <= 0) throw new InvalidOperationException("No FFXIV process."); if (p.Length > 1) throw new NotImplementedException("Call the constructor with PID if multiple process."); ffxiv_process = p[0]; } #region Sanity checks if (!ffxiv_process.MainWindowTitle.Equals(Constants.WINDOW_TITLE)) throw new InvalidOperationException("We might not be attaching to FFXIV, is something wrong?"); if (ffxiv_process.MainModule.ModuleMemorySize < Constants.PROCESS_MMS) throw new InvalidOperationException("Wrong MMS."); #endregion ffxiv_pid = ffxiv_process.Id; _mr = MemoryReader.SetInstance(ffxiv_process); _ss = new SigScanner(ffxiv_pid, true); Ski = SendKeyInput.SetInstance(ffxiv_process.MainWindowHandle); }
internal MovementHelper(Entity player, SendKeyInput.VKKeys leftKey = SendKeyInput.VKKeys.KEY_A, SendKeyInput.VKKeys rightKey = SendKeyInput.VKKeys.KEY_D, SendKeyInput.VKKeys forwardKey = SendKeyInput.VKKeys.KEY_W) { _player = player; _leftKey = leftKey; _rightKey = rightKey; _forwardKey = forwardKey; _pause = false; }
public static void sendAction(KeyBind bind) { SendKeyInput instance = SendKeyInput.GetInstance(); SendKeyInput.VKKeys key = 0; switch (bind.keyBindString [0]) { case '=': key = SendKeyInput.VKKeys.OEM_PLUS; break; case ',': key = SendKeyInput.VKKeys.OEM_COMMA; break; case '-': key = SendKeyInput.VKKeys.OEM_MINUS; break; case '.': key = SendKeyInput.VKKeys.OEM_PERIOD; break; default: key = (SendKeyInput.VKKeys)bind.keyBindString [0]; break; } if (bind.keyBindModifier == "Shift") { instance.ToggleKeyState(SendKeyInput.VKKeys.SHIFT, true); } if (bind.keyBindModifier == "CTRL") { instance.ToggleKeyState(SendKeyInput.VKKeys.CONTROL, true); } instance.SendKeyPress(key); if (bind.keyBindModifier == "Shift") { instance.ToggleKeyState(SendKeyInput.VKKeys.SHIFT, false); } if (bind.keyBindModifier == "CTRL") { instance.ToggleKeyState(SendKeyInput.VKKeys.CONTROL, false); } }
/// <summary> /// Instantiates a FFXIVLIB instance. /// PID is optional but required if multiple FFXIV process are running. /// </summary> /// <param name="pid">FFXIV PID (optionnal)</param> public FFXIVLIB(int pid = 0) { if (pid != 0) ffxiv_process = Process.GetProcessById(pid); else { Process[] p = Process.GetProcessesByName(Constants.PROCESS_NAME); if (p.Length <= 0) throw new InvalidOperationException("No FFXIV process."); if (p.Length > 1) throw new InvalidOperationException("Call the constructor with PID if multiple process."); ffxiv_process = p[0]; } Pid = ffxiv_process.Id; _mr = MemoryReader.SetInstance(ffxiv_process); _ss = new SigScanner(Pid, true); Ski = SendKeyInput.SetInstance(ffxiv_process.MainWindowHandle); }
/// <summary> /// Returns a MovementHelper instance ready for work. /// </summary> /// <param name="leftKey">Left key (default: A)</param> /// <param name="rightKey">Right key (default: D)</param> /// <param name="forwardKey">Forward key (default: W)</param> /// <returns>MovementHelper instance</returns> public MovementHelper GetMovementHelper(SendKeyInput.VKKeys leftKey = SendKeyInput.VKKeys.KEY_A, SendKeyInput.VKKeys rightKey = SendKeyInput.VKKeys.KEY_D, SendKeyInput.VKKeys forwardKey = SendKeyInput.VKKeys.KEY_W) { return new MovementHelper(GetEntityInfo(0), leftKey, rightKey, forwardKey); }
public static SendKeyInput SetInstance(IntPtr ffxivWindow) { return _instance ?? (_instance = new SendKeyInput(ffxivWindow)); }
public static SendKeyInput SetInstance(IntPtr ffxivWindow) { return(_instance ?? (_instance = new SendKeyInput(ffxivWindow))); }