private void button1_Click(object sender, RoutedEventArgs e)
        {
            var tibiaInjectedm_client = tibia_process.GetChangingIndexOfProcess(listBox.SelectedIndex);

            Tibia_Debug.Log("Injected into :: " + tibiaInjectedm_client.cHandle.ToString());
            var task = RefresItems(TimeSpan.FromSeconds(0.5), tibiaInjectedm_client);

            button1.IsEnabled = false;
            button2.IsEnabled = true;
            button.Content    = "Stop the bot";
        }
        private void onBotRefresh(IntPtr cHandle, IntPtr baseAddr)
        {
            int hp     = memory_reader.GetHealth(cHandle, (Int32)baseAddr);
            int mp     = memory_reader.GetMana(cHandle, (Int32)baseAddr);
            int hp_max = memory_reader.GetMaxHealth(cHandle, (Int32)baseAddr);
            int mp_max = memory_reader.GetMaxMana(cHandle, (Int32)baseAddr);



            Tibia_Debug.Log(hp.ToString());
            Tibia_Debug.Log(mp.ToString());
            Tibia_Debug.Log(hp_max.ToString());
            Tibia_Debug.Log(mp_max.ToString());
        }
        // for long items
        #region
        private byte[] ReadBytesLong(IntPtr pHandle, IntPtr address, int bytesToRead)
        {
            int bytesRead = 0;

            byte[] buffer = new byte[bytesToRead];
            ReadProcessMemory(pHandle, address, buffer, bytesToRead, ref bytesRead);

            // error handling
            if (buffer[0] == 0)
            {
                var procesID  = Process.GetCurrentProcess().Id;
                var errorCode = GetLastError();
                Tibia_Debug.Log("Error code");
                Tibia_Debug.Log("\n" + errorCode);
                return(buffer);
            }
            return(buffer);
        }