public ClientForm(BLL.PWClient client) { InitializeComponent(); // EVENTS this.Paint += (sender, e) => DoDraw(e.Graphics); this.Load += (sender, e) => { if (this.WinMovePosition != Point.Empty) { this.Location = this.WinMovePosition; } }; this.MouseWheel += ClientForm_MouseWheel; this.Click += ClientForm_Click; this.Activated += (sender, e) => { this.Location = new Point(this.Client.dbConfig.ScreenX, this.Client.dbConfig.ScreenY); }; this.Deactivate += (sender, e) => { HideAll(); }; this.tmrSave.Tick += (sender, e) => { this.Client.dbConfig.Save(this.Client.Manager.GetWindowRect()); }; this.DoubleClick += (sender, e) => { this.Client.Action.Global.Test(); }; // Windows Move this.MouseDown += (sender, e) => { WinMovePosition = new Point(Cursor.Position.X - Location.X, Cursor.Position.Y - Location.Y); WinMoveMover = true; }; this.MouseMove += (sender, e) => { if (WinMoveMover) { var x = Convert.ToInt32(Math.Round((Cursor.Position.X - WinMovePosition.X) / 20.0) * 20); var y = Convert.ToInt32(Math.Round((Cursor.Position.Y - WinMovePosition.Y) / 20.0) * 20); this.Location = new Point(x, y); OnCustomMove?.Invoke(this, this.Location); } }; this.MouseUp += (sender, e) => { WinMoveMover = false; this.Client.dbConfig.ScreenX = this.Location.X; this.Client.dbConfig.ScreenY = this.Location.Y; this.Client.dbConfig.PendingChanges = true; }; // Menu bLogin.Click += (sender, e) => { this.Client.Action.Global.DoLogin(); }; bClose.Click += (sender, e) => { this.Client.dbConfig.Save(this.Client.Manager.GetWindowRect()); this.Client.Dispose(); this.Close(); }; bCloseClient.Click += (sender, e) => { this.Client.dbConfig.Save(this.Client.Manager.GetWindowRect()); var mgr = this.Client.Manager; WinManager.RemoveClient(this.Client); this.Client.Dispose(); mgr.CloseApp(); this.Close(); }; bAntiFreeze.Click += (sender, e) => { this.Client.Config.AntiFreeze = !(this.Client.Config.AntiFreeze ?? true); }; bAutoKey.Click += (sender, e) => { this.Client.Auto.SetAutoKeyAll(!this.Client.Auto.IsAnyAutoKeyRunning); }; bAutoFollow.Click += (sender, e) => { this.Client.Auto.SetAutoFollow(!this.Client.Auto.IsAutoFollowRunning); }; bAutoSpot.Click += (sender, e) => { this.Client.Auto.SetAutoSpot(!this.Client.Auto.IsAutoSpotRunning); }; bAutoAssist.Click += (sender, e) => { this.Client.Auto.SetAutoAssist(!this.Client.Auto.IsAutoAssistRunning); }; bAutoVilla.Click += (sender, e) => { this.Client.Auto.SetVilla(!this.Client.Auto.IsVillaRunning); }; bStopAll.Click += (sender, e) => { this.Client.Auto.StopAll(); }; bPartyMenu.DropDownOpening += (sender, e) => RefreshPartyMenu(); bPartyCreateNew.Click += (sender, e) => BLL.ClientManager.CreateParty(this.Client); bShowWinChat.Click += (sender, e) => this.Client.dbConfig.HideWinChat = !this.Client.dbConfig.HideWinChat; bShowWins.DropDownOpening += (sender, e) => { bShowWinChat.Checked = !this.Client.dbConfig.HideWinChat; }; this.Client = client; // Menu - Key Events this.Client.Manager.OnKeyboard(Keys.F12, (sender, e) => { this.Client.Auto.StopAll(); }); this.Client.Manager.OnKeyboard(Keys.F9, (sender, e) => { this.Client.Auto.SetAutoFollow(!this.Client.Auto.IsAutoFollowRunning); }); this.Client.Manager.OnKeyboard(Keys.Control | Keys.S, (sender, e) => { this.Client.Auto.SetAutoSpot(!this.Client.Auto.IsAutoSpotRunning); }); this.Client.Manager.OnKeyboard(Keys.Control | Keys.A, (sender, e) => { this.Client.Auto.SetAutoAssist(!this.Client.Auto.IsAutoAssistRunning); }); this.Client.Manager.OnKeyboard(Keys.Control | Keys.K, (sender, e) => { this.Client.Auto.SetAutoKeyAll(!this.Client.Auto.IsAnyAutoKeyRunning); }); // Client events this.Client.Auto.OnAutoKeyStatusChange += (sender, e) => { bAutoKey.Checked = this.Client.Auto.IsAnyAutoKeyRunning; }; this.Client.Auto.OnAutoFollowStatusChange += (sender, e) => { bAutoFollow.Checked = e; }; this.Client.Auto.OnAutoSpotStatusChange += (sender, e) => { bAutoSpot.Checked = e; }; this.Client.Auto.OnAutoAssistStatusChange += (sender, e) => { bAutoAssist.Checked = e; }; this.Client.Auto.OnVillaStatusChange += (sender, e) => { this.Tools.MultiThreadSafe(this.Menu, () => { bAutoVilla.Checked = this.Client.Auto.IsVillaRunning; }); }; this.Tools = new Helper.FormTools(this, this.Client); this.AutoKeyForm = new AutoKeyForm(this, this.Client); this.AutoSpotForm = new AutoSpotForm(this, this.Client); this.AutoAssistForm = new AutoAssistForm(this, this.Client); this.ShowInfoForm = new ShowInfoForm(this, this.Client); LoadInitialValues(); }