예제 #1
0
 public TibiaClient(Process process)
 {
     this.Process = process;
     GameClient gameClient = new GameClient(this);
     gameClient.AssignProcess();
     this.Title = string.Format("#{0} {1}",Process.Id,TibiaClients.GetCharacterNameFromProcess(Process));
 }
예제 #2
0
        public void InitializeBot()
        {
            Assembly assembly = Assembly.GetExecutingAssembly();
            FileVersionInfo fvi = FileVersionInfo.GetVersionInfo(assembly.Location);

            if (TibiaClients.GetProcessesFromClassName("TibiaClient").Count() > 0)
            {
                if (TibiaClients.GetProcessesFromClassName("TibiaClient").Count() == 1)
                {
                    GameClient client = new GameClient(new TibiaClient(TibiaClients.GetProcessesFromClassName("TibiaClient")[0]));
                    client.AssignProcess();
                    Title = String.Format("{0} {2} - {1}", fvi.ProductName, "xd", fvi.ProductVersion.Substring(0, 5));
                }
                else
                {
                    GameClientWindow.ShowDialog();
                    //Title = String.Format("{0} {2} - {1}", fvi.ProductName, "xd", fvi.ProductVersion.Substring(0, 5));
                }
            }
            else
            {
                Title = String.Format("{0} {2} - {1}", fvi.ProductName, "Tibia not found.", fvi.ProductVersion.Substring(0, 5));
            }

#if DEBUG
            HelpMethods.AllocateConsole();
#endif
            Worker.Instance.Init();
            CaveBot.Instance.Init();
            Targeting.Instance.Init();
            Healer.Instance.Init();


            Hud.Instance.Init();
            //PipeServer.Instance.Init();
            //Injector.Instance.Inject();
            //PipeClient.Instance.Connect();
            //PipeClient.Instance.Send(new NetworkMessage(new byte[] { 0x02 }));

            /*
            int loadedItems = Items.LoadItems();           

            if (loadedItems != -1)
                Helpers.Debug.WriteLine(String.Format("Items has been loaded successfully. Loaded items: {0}.", loadedItems), ConsoleColor.White);
            else
                Helpers.Debug.WriteLine(String.Format("Could not load items. Please download again and reinstall the bot."), ConsoleColor.Red);

            int loadedSpells = Spells.Instance.LoadSpells();

            if (loadedSpells != -1)
                Helpers.Debug.WriteLine(String.Format("Spells has been loaded successfully. Loaded spells: {0}.", loadedSpells), ConsoleColor.White);
            else
                Helpers.Debug.WriteLine(String.Format("Could not load items. Please download again and reinstall the bot."), ConsoleColor.Red);

            GuiEquipment.Instance.UpdateGUI();
            var z = GuiEquipment.Instance;
            */
        }