Example #1
0
        private void GetCharName()
        {
            try
            {
                Int32 size = Win32.SendMessage((int)CharInfo, Win32.WM_GETTEXTLENGTH, 0, 0).ToInt32();
                StringBuilder data = new StringBuilder(size + 1);
                Win32.SendMessage(CharInfo, Win32.WM_GETTEXT, data.Capacity, data);

                string[] Parts1 = data.ToString().Split(' ');
                if (Parts1.Length <= 1)
                {
                    Manager.NotifyManager.ShowAlert(data.ToString(), "Unknown Login Information", Manager.NotifyManager.MSG_Type.UnknownBotLogin);
                    Dispose();
                }
                string sro_Type = Parts1[0].Replace("[", "").Replace("]", "").Trim();
                if (sro_Type == SroType.ISRO.ToString())
                    _sroType = SroType.ISRO;
                else if (sro_Type == SroType.SROR.ToString())
                    _sroType = SroType.SROR;
                else if (sro_Type == SroType.PrivSRO.ToString())
                    _sroType = SroType.PrivSRO;
                else
                    _sroType = SroType.ISRO;
                string[] Parts2 = Parts1[1].ToString().Split('@');
                _charName = Parts2[0];
                OnPropertyChanged("CharName");
            }
            catch (Exception ex)
            { Program.dbOperations.SaveToEx(this.GetType().ToString(), ex.Message, ex.StackTrace); }
        }
Example #2
0
        public bool PrepareHandlers()
        {
            try
            {
                MainWindowHandle = FindMainWindowInProcess(SBot.BotTitle);
                IntPtr MainPanalHandle = Win32.GetWindow(MainWindowHandle, Win32.GetWindow_Cmd.GW_CHILD);
                TopPanalHandle = Win32.GetWindow(MainPanalHandle, Win32.GetWindow_Cmd.GW_CHILD);
                BtnStartGameHandle = Win32.GetWindow(TopPanalHandle, Win32.GetWindow_Cmd.GW_HWNDNEXT);
                BtnGoClientlessHandle = Win32.GetWindow(BtnStartGameHandle, Win32.GetWindow_Cmd.GW_HWNDNEXT);
                BtnDisconnectHandle = Win32.GetWindow(BtnGoClientlessHandle, Win32.GetWindow_Cmd.GW_HWNDNEXT);
                IntPtr ListView = Win32.GetWindow(BtnDisconnectHandle, Win32.GetWindow_Cmd.GW_HWNDNEXT);// Not Used
                RightPanalHandle = Win32.GetWindow(ListView, Win32.GetWindow_Cmd.GW_HWNDNEXT);
                ButtomPanalHandle = Win32.GetWindow(RightPanalHandle, Win32.GetWindow_Cmd.GW_HWNDNEXT);
                //TopPanel Ctr
                IntPtr Tmp_VersionText = Win32.GetWindow(TopPanalHandle, Win32.GetWindow_Cmd.GW_CHILD);// Not Used
                BotVersionHandle = Win32.GetWindow(Tmp_VersionText, Win32.GetWindow_Cmd.GW_HWNDNEXT);
                IntPtr Tmp_HPText = Win32.GetWindow(BotVersionHandle, Win32.GetWindow_Cmd.GW_HWNDNEXT);// Not Used
                CharHPProgressBarHandle = Win32.GetWindow(Tmp_HPText, Win32.GetWindow_Cmd.GW_HWNDNEXT);
                IntPtr Tmp_MPText = Win32.GetWindow(CharHPProgressBarHandle, Win32.GetWindow_Cmd.GW_HWNDNEXT);// Not Used
                CharMPProgressBarHandle = Win32.GetWindow(Tmp_MPText, Win32.GetWindow_Cmd.GW_HWNDNEXT);
                IntPtr Tmp_XpText = Win32.GetWindow(CharMPProgressBarHandle, Win32.GetWindow_Cmd.GW_HWNDNEXT);// Not Used
                IntPtr Tmp_XpBar = Win32.GetWindow(Tmp_XpText, Win32.GetWindow_Cmd.GW_HWNDNEXT);// Not Used
                IntPtr Tmp_BotServerStatusText = Win32.GetWindow(Tmp_XpBar, Win32.GetWindow_Cmd.GW_HWNDNEXT);// Not Used
                BotServerStatusHandle = Win32.GetWindow(Tmp_BotServerStatusText, Win32.GetWindow_Cmd.GW_HWNDNEXT);
                IntPtr Tmp_SilkroadServerStatusText = Win32.GetWindow(BotServerStatusHandle, Win32.GetWindow_Cmd.GW_HWNDNEXT);// Not Used
                SilkroadServerStatusHandle = Win32.GetWindow(Tmp_SilkroadServerStatusText, Win32.GetWindow_Cmd.GW_HWNDNEXT);
                IntPtr Tmp_BotStatusText = Win32.GetWindow(SilkroadServerStatusHandle, Win32.GetWindow_Cmd.GW_HWNDNEXT);// Not Used
                BotStatusHandle = Win32.GetWindow(Tmp_BotStatusText, Win32.GetWindow_Cmd.GW_HWNDNEXT);
                IntPtr Tmp_ConnectionQua = Win32.GetWindow(BotStatusHandle, Win32.GetWindow_Cmd.GW_HWNDNEXT);// Not Used
                IntPtr Tmp_AvgText = Win32.GetWindow(Tmp_ConnectionQua, Win32.GetWindow_Cmd.GW_HWNDNEXT);// Not Used
                ConnectionQualityAvgHandle = Win32.GetWindow(Tmp_AvgText, Win32.GetWindow_Cmd.GW_HWNDNEXT);
                IntPtr Tmp_CurText = Win32.GetWindow(ConnectionQualityAvgHandle, Win32.GetWindow_Cmd.GW_HWNDNEXT);// Not Used
                ConnectionQualityCurHandle = Win32.GetWindow(Tmp_CurText, Win32.GetWindow_Cmd.GW_HWNDNEXT);
                //RightPanel Ctr
                IntPtr Tmp_XText = Win32.GetWindow(RightPanalHandle, Win32.GetWindow_Cmd.GW_CHILD);// Not Used
                PosXHandle = Win32.GetWindow(Tmp_XText, Win32.GetWindow_Cmd.GW_HWNDNEXT);
                IntPtr Tmp_YText = Win32.GetWindow(PosXHandle, Win32.GetWindow_Cmd.GW_HWNDNEXT);// Not Used
                PosYHandle = Win32.GetWindow(Tmp_YText, Win32.GetWindow_Cmd.GW_HWNDNEXT);
                IntPtr Tmp_CharLine = Win32.GetWindow(PosYHandle, Win32.GetWindow_Cmd.GW_HWNDNEXT);// Not Used
                IntPtr Tmp_CharText = Win32.GetWindow(Tmp_CharLine, Win32.GetWindow_Cmd.GW_HWNDNEXT);// Not Used
                CharNameHandle = Win32.GetWindow(Tmp_CharText, Win32.GetWindow_Cmd.GW_HWNDNEXT);
                if (CharNameHandle == IntPtr.Zero)
                    return false;
                IntPtr Tmp_LevelText = Win32.GetWindow(CharNameHandle, Win32.GetWindow_Cmd.GW_HWNDNEXT);// Not Used
                LevelHandle = Win32.GetWindow(Tmp_LevelText, Win32.GetWindow_Cmd.GW_HWNDNEXT);
                IntPtr Tmp_GoldText = Win32.GetWindow(LevelHandle, Win32.GetWindow_Cmd.GW_HWNDNEXT);// Not Used
                GoldHandle = Win32.GetWindow(Tmp_GoldText, Win32.GetWindow_Cmd.GW_HWNDNEXT);
                IntPtr Tmp_SPText = Win32.GetWindow(GoldHandle, Win32.GetWindow_Cmd.GW_HWNDNEXT);// Not Used
                SkillPointHandle = Win32.GetWindow(Tmp_SPText, Win32.GetWindow_Cmd.GW_HWNDNEXT);
                IntPtr Tmp_LocationText = Win32.GetWindow(SkillPointHandle, Win32.GetWindow_Cmd.GW_HWNDNEXT);// Not Used
                LocationNameHandle = Win32.GetWindow(Tmp_LocationText, Win32.GetWindow_Cmd.GW_HWNDNEXT);
                IntPtr Tmp_TotalTimeLine = Win32.GetWindow(LocationNameHandle, Win32.GetWindow_Cmd.GW_HWNDNEXT);// Not Used
                IntPtr Tmp_TotalTimeText = Win32.GetWindow(Tmp_TotalTimeLine, Win32.GetWindow_Cmd.GW_HWNDNEXT);// Not Used
                TotaltimeHandle = Win32.GetWindow(Tmp_TotalTimeText, Win32.GetWindow_Cmd.GW_HWNDNEXT);
                IntPtr Tmp_KillsText = Win32.GetWindow(TotaltimeHandle, Win32.GetWindow_Cmd.GW_HWNDNEXT);// Not Used
                KillsHandle = Win32.GetWindow(Tmp_KillsText, Win32.GetWindow_Cmd.GW_HWNDNEXT);
                IntPtr Tmp_XPGainedText = Win32.GetWindow(KillsHandle, Win32.GetWindow_Cmd.GW_HWNDNEXT);// Not Used
                XPGainedHandle = Win32.GetWindow(Tmp_XPGainedText, Win32.GetWindow_Cmd.GW_HWNDNEXT);
                IntPtr Tmp_XPMinText = Win32.GetWindow(XPGainedHandle, Win32.GetWindow_Cmd.GW_HWNDNEXT);// Not Used
                XPMinHandle = Win32.GetWindow(Tmp_XPMinText, Win32.GetWindow_Cmd.GW_HWNDNEXT);
                IntPtr Tmp_XPHText = Win32.GetWindow(XPMinHandle, Win32.GetWindow_Cmd.GW_HWNDNEXT);// Not Used
                XPHHandle = Win32.GetWindow(Tmp_XPHText, Win32.GetWindow_Cmd.GW_HWNDNEXT);
                IntPtr Tmp_SPGainedText = Win32.GetWindow(XPHHandle, Win32.GetWindow_Cmd.GW_HWNDNEXT);// Not Used
                SPGainedHandle = Win32.GetWindow(Tmp_SPGainedText, Win32.GetWindow_Cmd.GW_HWNDNEXT);
                IntPtr Tmp_SPMinText = Win32.GetWindow(SPGainedHandle, Win32.GetWindow_Cmd.GW_HWNDNEXT);// Not Used
                SPMinHandle = Win32.GetWindow(Tmp_SPMinText, Win32.GetWindow_Cmd.GW_HWNDNEXT);
                IntPtr Tmp_SPHText = Win32.GetWindow(SPMinHandle, Win32.GetWindow_Cmd.GW_HWNDNEXT);// Not Used
                SPHHandle = Win32.GetWindow(Tmp_SPHText, Win32.GetWindow_Cmd.GW_HWNDNEXT);
                IntPtr Tmp_DiedText = Win32.GetWindow(SPHHandle, Win32.GetWindow_Cmd.GW_HWNDNEXT);// Not Used
                DiedHandle = Win32.GetWindow(Tmp_DiedText, Win32.GetWindow_Cmd.GW_HWNDNEXT);
                IntPtr Tmp_DiedsessText = Win32.GetWindow(DiedHandle, Win32.GetWindow_Cmd.GW_HWNDNEXT);// Not Used
                DiedsessHandle = Win32.GetWindow(Tmp_DiedsessText, Win32.GetWindow_Cmd.GW_HWNDNEXT);
                IntPtr Tmp_ItemDropsText = Win32.GetWindow(DiedsessHandle, Win32.GetWindow_Cmd.GW_HWNDNEXT);// Not Used
                ItemDropsHandle = Win32.GetWindow(Tmp_ItemDropsText, Win32.GetWindow_Cmd.GW_HWNDNEXT);
                IntPtr Tmp_GoldLoopText = Win32.GetWindow(ItemDropsHandle, Win32.GetWindow_Cmd.GW_HWNDNEXT);// Not Used
                GoldLoopHandle = Win32.GetWindow(Tmp_GoldLoopText, Win32.GetWindow_Cmd.GW_HWNDNEXT);
                BtnResetStatusHandle = Win32.GetWindow(GoldLoopHandle, Win32.GetWindow_Cmd.GW_HWNDNEXT);
                IntPtr Tmp_SaveSettingLine = Win32.GetWindow(BtnResetStatusHandle, Win32.GetWindow_Cmd.GW_HWNDNEXT);// Not Used
                BtnSaveSettingsHandle = Win32.GetWindow(Tmp_SaveSettingLine, Win32.GetWindow_Cmd.GW_HWNDNEXT);
                BtnHieClientHandle = Win32.GetWindow(BtnSaveSettingsHandle, Win32.GetWindow_Cmd.GW_HWNDNEXT);
                BtnStartTrainingHandle = Win32.GetWindow(BtnHieClientHandle, Win32.GetWindow_Cmd.GW_HWNDNEXT);
                BtnStopTrainingHandle = Win32.GetWindow(BtnStartTrainingHandle, Win32.GetWindow_Cmd.GW_HWNDNEXT);
                //LeftPanel Ctr
                IntPtr Tmp_ListView1stChild = Win32.GetWindow(ListView, Win32.GetWindow_Cmd.GW_CHILD);// Not Used
                IntPtr Tmp_ListViewLoginUserControl = Win32.GetWindow(Tmp_ListView1stChild, Win32.GetWindow_Cmd.GW_HWNDNEXT);// Not Used

                UpdateProperty(BotVersionHandle, ref _botVersion, "BotVersion");
                if (_botVersion.ToLower().Contains("sbotp"))
                {
                    _sroType = SroType.PrivSRO;
                    IntPtr Tmp_LoginUC_Ctr1 = Win32.GetWindow(Tmp_ListViewLoginUserControl, Win32.GetWindow_Cmd.GW_CHILD);// Not Used
                    IntPtr Tmp_LoginUC_Ctr2 = Win32.GetWindow(Tmp_LoginUC_Ctr1, Win32.GetWindow_Cmd.GW_HWNDNEXT);// Not Used
                    IntPtr Tmp_LoginUC_Ctr3 = Win32.GetWindow(Tmp_LoginUC_Ctr2, Win32.GetWindow_Cmd.GW_HWNDNEXT);// Not Used
                    IntPtr Tmp_LoginUC_Ctr4 = Win32.GetWindow(Tmp_LoginUC_Ctr3, Win32.GetWindow_Cmd.GW_HWNDNEXT);// Not Used
                    IntPtr Tmp_LoginUC_Ctr5 = Win32.GetWindow(Tmp_LoginUC_Ctr4, Win32.GetWindow_Cmd.GW_HWNDNEXT);// Not Used
                    IntPtr Tmp_LoginUC_Ctr6 = Win32.GetWindow(Tmp_LoginUC_Ctr5, Win32.GetWindow_Cmd.GW_HWNDNEXT);// Not Used
                    IntPtr Tmp_LoginUC_Ctr7 = Win32.GetWindow(Tmp_LoginUC_Ctr6, Win32.GetWindow_Cmd.GW_HWNDNEXT);// Not Used
                    IntPtr Tmp_LoginUC_Ctr8 = Win32.GetWindow(Tmp_LoginUC_Ctr7, Win32.GetWindow_Cmd.GW_HWNDNEXT);// Not Used
                    IntPtr Tmp_LoginUC_Ctr9 = Win32.GetWindow(Tmp_LoginUC_Ctr8, Win32.GetWindow_Cmd.GW_HWNDNEXT);// Not Used
                    IntPtr Tmp_LoginUC_Ctr10 = Win32.GetWindow(Tmp_LoginUC_Ctr9, Win32.GetWindow_Cmd.GW_HWNDNEXT);// Not Used
                    IntPtr Tmp_LoginUC_Ctr11 = Win32.GetWindow(Tmp_LoginUC_Ctr10, Win32.GetWindow_Cmd.GW_HWNDNEXT);// Not Used
                    IntPtr Tmp_LoginUC_Ctr12 = Win32.GetWindow(Tmp_LoginUC_Ctr11, Win32.GetWindow_Cmd.GW_HWNDNEXT);// Not Used
                    IntPtr Tmp_LoginUC_Ctr13 = Win32.GetWindow(Tmp_LoginUC_Ctr12, Win32.GetWindow_Cmd.GW_HWNDNEXT);// Not Used
                    IntPtr Tmp_LoginUC_Ctr14 = Win32.GetWindow(Tmp_LoginUC_Ctr13, Win32.GetWindow_Cmd.GW_HWNDNEXT);// Not Used
                    IntPtr Tmp_LoginUC_Ctr15 = Win32.GetWindow(Tmp_LoginUC_Ctr14, Win32.GetWindow_Cmd.GW_HWNDNEXT);// Not Used
                    IntPtr Tmp_LoginUC_Ctr16 = Win32.GetWindow(Tmp_LoginUC_Ctr15, Win32.GetWindow_Cmd.GW_HWNDNEXT);// Not Used

                    //IntPtr Tmp_LoginUC_Ctr17 = Win32.GetWindow(Tmp_LoginUC_Ctr16, Win32.GetWindow_Cmd.GW_HWNDNEXT);// Not Used
                    //IntPtr Tmp_LoginUC_Ctr18 = Win32.GetWindow(Tmp_LoginUC_Ctr17, Win32.GetWindow_Cmd.GW_HWNDNEXT);// Not Used
                    //IntPtr Tmp_LoginUC_Ctr19 = Win32.GetWindow(Tmp_LoginUC_Ctr18, Win32.GetWindow_Cmd.GW_HWNDNEXT);// Not Used
                    //IntPtr Tmp_LoginUC_Ctr20 = Win32.GetWindow(Tmp_LoginUC_Ctr19, Win32.GetWindow_Cmd.GW_HWNDNEXT);// Not Used

                    CharInfo = Win32.GetWindow(Tmp_LoginUC_Ctr16, Win32.GetWindow_Cmd.GW_HWNDNEXT);
                }
                else
                {
                    _sroType = SroType.ISRO;
                    IntPtr Tmp_LoginUC_Ctr1 = Win32.GetWindow(Tmp_ListViewLoginUserControl, Win32.GetWindow_Cmd.GW_CHILD);// Not Used
                    IntPtr Tmp_LoginUC_Ctr2 = Win32.GetWindow(Tmp_LoginUC_Ctr1, Win32.GetWindow_Cmd.GW_HWNDNEXT);// Not Used
                    IntPtr Tmp_LoginUC_Ctr3 = Win32.GetWindow(Tmp_LoginUC_Ctr2, Win32.GetWindow_Cmd.GW_HWNDNEXT);// Not Used
                    IntPtr Tmp_LoginUC_Ctr4 = Win32.GetWindow(Tmp_LoginUC_Ctr3, Win32.GetWindow_Cmd.GW_HWNDNEXT);// Not Used
                    IntPtr Tmp_LoginUC_Ctr5 = Win32.GetWindow(Tmp_LoginUC_Ctr4, Win32.GetWindow_Cmd.GW_HWNDNEXT);// Not Used
                    IntPtr Tmp_LoginUC_Ctr6 = Win32.GetWindow(Tmp_LoginUC_Ctr5, Win32.GetWindow_Cmd.GW_HWNDNEXT);// Not Used
                    IntPtr Tmp_LoginUC_Ctr7 = Win32.GetWindow(Tmp_LoginUC_Ctr6, Win32.GetWindow_Cmd.GW_HWNDNEXT);// Not Used
                    IntPtr Tmp_LoginUC_Ctr8 = Win32.GetWindow(Tmp_LoginUC_Ctr7, Win32.GetWindow_Cmd.GW_HWNDNEXT);// Not Used
                    IntPtr Tmp_LoginUC_Ctr9 = Win32.GetWindow(Tmp_LoginUC_Ctr8, Win32.GetWindow_Cmd.GW_HWNDNEXT);// Not Used
                    IntPtr Tmp_LoginUC_Ctr10 = Win32.GetWindow(Tmp_LoginUC_Ctr9, Win32.GetWindow_Cmd.GW_HWNDNEXT);// Not Used
                    IntPtr Tmp_LoginUC_Ctr11 = Win32.GetWindow(Tmp_LoginUC_Ctr10, Win32.GetWindow_Cmd.GW_HWNDNEXT);// Not Used
                    IntPtr Tmp_LoginUC_Ctr12 = Win32.GetWindow(Tmp_LoginUC_Ctr11, Win32.GetWindow_Cmd.GW_HWNDNEXT);// Not Used
                    IntPtr Tmp_LoginUC_Ctr13 = Win32.GetWindow(Tmp_LoginUC_Ctr12, Win32.GetWindow_Cmd.GW_HWNDNEXT);// Not Used
                    IntPtr Tmp_LoginUC_Ctr14 = Win32.GetWindow(Tmp_LoginUC_Ctr13, Win32.GetWindow_Cmd.GW_HWNDNEXT);// Not Used
                    IntPtr Tmp_LoginUC_Ctr15 = Win32.GetWindow(Tmp_LoginUC_Ctr14, Win32.GetWindow_Cmd.GW_HWNDNEXT);// Not Used
                    IntPtr Tmp_LoginUC_Ctr16 = Win32.GetWindow(Tmp_LoginUC_Ctr15, Win32.GetWindow_Cmd.GW_HWNDNEXT);// Not Used
                    IntPtr Tmp_LoginUC_Ctr17 = Win32.GetWindow(Tmp_LoginUC_Ctr16, Win32.GetWindow_Cmd.GW_HWNDNEXT);// Not Used
                    IntPtr Tmp_LoginUC_Ctr18 = Win32.GetWindow(Tmp_LoginUC_Ctr17, Win32.GetWindow_Cmd.GW_HWNDNEXT);// Not Used
                    IntPtr Tmp_LoginUC_Ctr19 = Win32.GetWindow(Tmp_LoginUC_Ctr18, Win32.GetWindow_Cmd.GW_HWNDNEXT);// Not Used
                    IntPtr Tmp_LoginUC_Ctr20 = Win32.GetWindow(Tmp_LoginUC_Ctr19, Win32.GetWindow_Cmd.GW_HWNDNEXT);// Not Used
                    IntPtr Tmp_LoginUC_Ctr21 = Win32.GetWindow(Tmp_LoginUC_Ctr20, Win32.GetWindow_Cmd.GW_HWNDNEXT);// Not Used
                    IntPtr Tmp_LoginUC_Ctr22 = Win32.GetWindow(Tmp_LoginUC_Ctr21, Win32.GetWindow_Cmd.GW_HWNDNEXT);// Not Used
                    IntPtr Tmp_LoginUC_Ctr23 = Win32.GetWindow(Tmp_LoginUC_Ctr22, Win32.GetWindow_Cmd.GW_HWNDNEXT);// Not Used
                    IntPtr Tmp_LoginUC_Ctr24 = Win32.GetWindow(Tmp_LoginUC_Ctr23, Win32.GetWindow_Cmd.GW_HWNDNEXT);// Not Used

                    IntPtr Tmp_LoginUC_Ctr25 = Win32.GetWindow(Tmp_LoginUC_Ctr24, Win32.GetWindow_Cmd.GW_HWNDNEXT);// Not Used
                    IntPtr Tmp_LoginUC_Ctr26 = Win32.GetWindow(Tmp_LoginUC_Ctr25, Win32.GetWindow_Cmd.GW_HWNDNEXT);// Not Used
                    IntPtr Tmp_LoginUC_Ctr27 = Win32.GetWindow(Tmp_LoginUC_Ctr26, Win32.GetWindow_Cmd.GW_HWNDNEXT);// Not Used
                    IntPtr Tmp_LoginUC_Ctr28 = Win32.GetWindow(Tmp_LoginUC_Ctr27, Win32.GetWindow_Cmd.GW_HWNDNEXT);// Not Used

                    CharInfo = Win32.GetWindow(Tmp_LoginUC_Ctr28, Win32.GetWindow_Cmd.GW_HWNDNEXT);
                }

                //ButtomPanel Ctr
                BotLogsHandle = Win32.GetWindow(ButtomPanalHandle, Win32.GetWindow_Cmd.GW_CHILD);

                //Inventory Handlers
                //InventoryMainWindowHandle = FindMainWindowInProcess(SBot.InventoryTitle);
                //InventoryMainTabHandle = Win32.GetDlgItem(InventoryMainWindowHandle, (int)CtrID.InventoryMainTab);
                //InventoryGridHandle = Win32.GetDlgItem(InventoryMainTabHandle, (int)CtrID.InventoryGrid);
                //InventoryGridRowsHandle = Win32.GetWindow(Win32.GetWindow(InventoryGridHandle, Win32.GetWindow_Cmd.GW_CHILD), Win32.GetWindow_Cmd.GW_HWNDLAST);
            }
            catch (Exception ex)
            { Program.dbOperations.SaveToEx(this.GetType().ToString(), ex.Message, ex.StackTrace); return false; }
            return true;
        }