public static void OnMouseUp(GameInput.MouseButtons btn) { var key = Keys.LButton; switch (btn) { case GameInput.MouseButtons.Right: key = Keys.RButton; break; case GameInput.MouseButtons.Middle: key = Keys.MButton; break; } MouseUp?.Invoke(key); if (Interface.Interface.HasInputFocus()) { return; } if (Globals.Me == null) { return; } if (Controls.Controls.ControlHasKey(Control.Block, key)) { Globals.Me.StopBlocking(); } if (btn != GameInput.MouseButtons.Right) { return; } if (Globals.InputManager.KeyDown(Keys.Shift) != true) { return; } var x = (int)Math.Floor(Globals.InputManager.GetMousePosition().X + Graphics.CurrentView.Left); var y = (int)Math.Floor(Globals.InputManager.GetMousePosition().Y + Graphics.CurrentView.Top); foreach (MapInstance map in MapInstance.Lookup.Values) { if (!(x >= map.GetX()) || !(x <= map.GetX() + Options.MapWidth * Options.TileWidth)) { continue; } if (!(y >= map.GetY()) || !(y <= map.GetY() + Options.MapHeight * Options.TileHeight)) { continue; } //Remove the offsets to just be dealing with pixels within the map selected x -= (int)map.GetX(); y -= (int)map.GetY(); //transform pixel format to tile format x /= Options.TileWidth; y /= Options.TileHeight; var mapNum = map.Id; if (Globals.Me.GetRealLocation(ref x, ref y, ref mapNum)) { PacketSender.SendAdminAction(new WarpToLocationAction(map.Id, (byte)x, (byte)y)); } return; } }
public static void OnMouseDown(GameInput.MouseButtons btn) { var key = Keys.None; switch (btn) { case GameInput.MouseButtons.Left: key = Keys.LButton; break; case GameInput.MouseButtons.Right: key = Keys.RButton; break; case GameInput.MouseButtons.Middle: key = Keys.MButton; break; } MouseDown?.Invoke(key); if (Interface.Interface.HasInputFocus()) { return; } if (Globals.GameState != GameStates.InGame || Globals.Me == null) { return; } if (Interface.Interface.MouseHitGui()) { return; } if (Globals.Me == null) { return; } if (Globals.Me.TryTarget()) { return; } if (Controls.Controls.ControlHasKey(Control.PickUp, key)) { if (Globals.Me.TryPickupItem(Globals.Me.MapInstance.Id, Globals.Me.Y * Options.MapWidth + Globals.Me.X, Guid.Empty, true)) { return; } if (Globals.Me.AttackTimer < Timing.Global.Ticks / TimeSpan.TicksPerMillisecond) { Globals.Me.AttackTimer = Timing.Global.Ticks / TimeSpan.TicksPerMillisecond + Globals.Me.CalculateAttackTime(); } } if (Controls.Controls.ControlHasKey(Control.Block, key)) { if (Globals.Me.TryBlock()) { return; } } if (key != Keys.None) { OnKeyPressed(key); } }
public static void OnMouseDown(GameInput.MouseButtons btn) { var key = Keys.None; switch (btn) { case GameInput.MouseButtons.Left: key = Keys.LButton; break; case GameInput.MouseButtons.Right: key = Keys.RButton; break; case GameInput.MouseButtons.Middle: key = Keys.MButton; break; } MouseDown?.Invoke(key); if (Interface.Interface.HasInputFocus()) { return; } if (Globals.GameState != GameStates.InGame || Globals.Me == null) { return; } if (Interface.Interface.MouseHitGui()) { return; } if (Globals.Me == null) { return; } if (Globals.Me.TryTarget()) { return; } if (Controls.Controls.ControlHasKey(Control.PickUp, key)) { if (Globals.Me.TryPickupItem()) { return; } if (Globals.Me.AttackTimer < Globals.System.GetTimeMs()) { Globals.Me.AttackTimer = Globals.System.GetTimeMs() + Globals.Me.CalculateAttackTime(); } } if (!Controls.Controls.ControlHasKey(Control.Block, key)) { return; } if (Globals.Me.TryBlock()) { return; } if (key != Keys.None) { OnKeyPressed(key); } }
public static void OnMouseDown(GameInput.MouseButtons btn) { var key = Keys.None; switch (btn) { case GameInput.MouseButtons.Left: key = Keys.LButton; break; case GameInput.MouseButtons.Right: key = Keys.RButton; break; case GameInput.MouseButtons.Middle: key = Keys.MButton; break; } MouseDown?.Invoke(key); if (Interface.Interface.HasInputFocus()) { return; } if (Globals.GameState != GameStates.InGame || Globals.Me == null) { return; } if (Interface.Interface.MouseHitGui()) { return; } if (Globals.Me == null) { return; } var mouseX = (int)(Math.Floor(((Globals.InputManager.GetMousePosition().X + Graphics.CurrentView.Left) / Options.MapWidth))); var mouseY = (int)(Math.Floor((Globals.InputManager.GetMousePosition().Y + Graphics.CurrentView.Top)) / Options.MapWidth); if (Globals.Me.TryInteractOrPickUpItem(Globals.Me.MapInstance.Id, Globals.Me.Y * Options.MapWidth + Globals.Me.X, mouseY * Options.MapWidth + mouseX)) { return; } if (Globals.Me.TryTarget()) { return; } if (Controls.Controls.ControlHasKey(Control.PickUp, key)) { if (Globals.Me.TryPickupItem(Globals.Me.MapInstance.Id, Globals.Me.Y * Options.MapWidth + Globals.Me.X, Guid.Empty, true)) { return; } if (Globals.Me.AttackTimer < Timing.Global.Ticks / TimeSpan.TicksPerMillisecond) { Globals.Me.AttackTimer = Timing.Global.Ticks / TimeSpan.TicksPerMillisecond + Globals.Me.CalculateAttackTime(); } } if (Controls.Controls.ControlHasKey(Control.Block, key)) { if (Globals.Me.TryBlock()) { return; } } if (key != Keys.None) { OnKeyPressed(key); } }