private void loadClientToolStripMenuItem_Click(object sender, EventArgs e) { try { var chooserOptions = new ClientChooserOptions(); chooserOptions.Smart = true; chooserOptions.ShowOTOption = false; chooserOptions.OfflineOnly = true; var c = ClientChooser.ShowBox(chooserOptions); if (c != null) { if (c.Version.OtbMajorVersion != otItems.MajorVersion || c.Version.OtbMinorVersion != otItems.MinorVersion) { Trace.WriteLine("[Warning] This client requires the version " + c.Version.OtbMajorVersion + "." + c.Version.OtbMinorVersion + " of items.otb."); } c.LoginServers = new LoginServer[] { new LoginServer("127.0.0.1", 7171) }; c.EnableProxy(); Client = c; Trace.WriteLine("Client successfully loaded."); } } catch (Exception ex) { Trace.WriteLine("[Error] Unable to load tibia client. Details: " + ex.StackTrace.ToString()); } }
public Core(string clientChooserTitle, string mutexName, bool proxy, bool useWPF) { KeyboardHook.Enable(); do { ClientChooserOptions clientChooserOptions = new ClientChooserOptions(); clientChooserOptions.Title = clientChooserTitle; clientChooserOptions.ShowOTOption = true; clientChooserOptions.OfflineOnly = proxy; if (useWPF) { Client = ClientChooserWPF.ShowBox(clientChooserOptions); } else { Client = ClientChooser.ShowBox(clientChooserOptions); } if (Client != null) { kedrahMutex = new Mutex(true, "Kedrah_" + mutexName + Client.Process.Id.ToString()); if (!kedrahMutex.WaitOne(0, false)) { Client = null; continue; } System.Diagnostics.Process.GetCurrentProcess().PriorityClass = System.Diagnostics.ProcessPriorityClass.AboveNormal; Client.Process.Exited += new EventHandler(ClientClosed); if (proxy) { Client.IO.StartProxy(); Proxy = Client.IO.Proxy; Proxy.PlayerLogin += new EventHandler(OnLogin); Proxy.PlayerLogout += new EventHandler(OnLogout); } else { loginChecker.Execute += new Tibia.Util.Timer.TimerExecution(loginChecker_Execute); loginChecker.Start(); } Modules = new HModules(this); Kedrah.Extensions.Core = this; } } while (Client == null); }