private void dataGridView1_CellContentClick(object sender, DataGridViewCellEventArgs e) { var senderGrid = (DataGridView)sender; if (senderGrid.Columns[e.ColumnIndex] is DataGridViewButtonColumn && e.RowIndex >= 0) { try { WoWConnection tempWoW = new WoWConnection(senderGrid["col_WinTitle", e.RowIndex].Value.ToString()); tempWoW.TryToConnect(); WoWPlayer.SetWindowTitleForPlayer(ref Game1.allPlayers, tempWoW.GetPlayerGUID(), (senderGrid["col_WinTitle", e.RowIndex].Value.ToString())); } catch (NullReferenceException) { } } }
private void Refresh(TimeSpan totalgameTime) { if ((totalgameTime - previousRefreshTime) > TimeSpan.FromMilliseconds(50)) { previousRefreshTime = totalgameTime; mainwow.TryToRefreshObjectManager(); WoWObject.GetAllObjects(ref allUnits, ref allSpells, ref allPlayers, mainwow); mainPlayer.RefreshFromList(allPlayers, mainPlayer.WindowTitle); WoWPlayer.SetWindowTitleForPlayer(ref allPlayers, mainPlayer.Guid, mainwow.WindowTitle); foreach (WoWPlayer wp in allPlayers) { if (wp.WindowTitle != null && Vector2.Distance(wp.MovementTarget, new Vector2(wp.Position.X, wp.Position.Y)) < 80) { if (MoveController.RotateTowards(wp, wp.MovementTarget, (double)0.06 * Math.PI, true)) { MoveController.WalkingTowards(wp, wp.MovementTarget, 5); } } } } }