コード例 #1
0
 private static void Move01(PwClient client)
 {
     // go to the first room
     client.ActionStructs.GoToGame(363.5f, 502.5f);
     client.Additional.WaitForTeleportation(446.2f, 569.9f);
     client.ActionStructs.GoToGame(446.2f, 574.6f);
 }
コード例 #2
0
 private static void Move56(PwClient client)
 {
     client.ActionStructs.GoToGame(438.2f, 597.8f);
     client.ActionStructs.GoToGame(436.3f, 598.6f);
     client.ActionStructs.GoToGame(433.6f, 598.6f);
     client.Additional.WaitForBomb();
     client.ActionStructs.GoToGame(425.5f, 598.6f);
     client.Additional.WaitForBomb();
     client.ActionStructs.GoToGame(417.3f, 598.6f);
     client.Additional.WaitForBomb();
     client.ActionStructs.GoToGame(414.5f, 598.6f);
     client.ActionStructs.GoToGame(414.5f, 593.2f);
     client.ActionStructs.GoToGame(418.3f, 589.9f);
     client.ActionStructs.GoToGame(418.3f, 587.1f);
     client.ActionStructs.GoToGame(423.5f, 587.1f);
     client.ActionStructs.GoToGame(423.5f, 585.3f);
     client.ActionStructs.GoToGame(425.6f, 585.3f);
     client.ActionStructs.GoToGame(425.6f, 586.3f);
     client.ActionStructs.GoToGame(422.8f, 586.3f);
     client.ActionStructs.GoToGame(422.8f, 585.1f);
     client.ActionStructs.GoToGame(421.2f, 585.1f);
     client.ActionStructs.GoToGame(421.2f, 570f);
     client.ActionStructs.GoToGame(422.8f, 570f);
     client.ActionStructs.GoToGame(422.8f, 568.1f);
     client.ActionStructs.GoToGame(425.8f, 567.5f);
 }
コード例 #3
0
        public static bool CheckCharacters()
        {
            var clients = PwClient.GetClients();

            return(clients.Any(cl => cl.PlayerInfo.Name == "chersanya") &&
                   clients.Any(cl => cl.PlayerInfo.Name == "chersаnyа"));
        }
コード例 #4
0
        public override void Do(object param)
        {
            if (!this.IsStart)
            {
                bot = PwUtils.Pw_CLient_Search(param.ToString(), bot);
                if (bot == null)
                {
                    return;
                }
                PwUtils.GetCords(this.bot, out this.x, out this.y, out this.z);

                this.IsStart = !this.IsStart;
            }

            while (true)
            {
                Thread.Sleep(1000);
                tempCount++;

                bot = PwUtils.Pw_CLient_Search(param.ToString(), bot);
                if (bot == null)
                {
                    continue;
                }
                //поиск адреса контрола
                btn_address = CalcMethods.CalcControlAddress(bot.Handle, "Win_QuickbarPetH", "Btn_Attack");
                //раз в 10 секунд проверяем бота на "стояние"
                if (tempCount % 10 == 0)
                {
                    double x_new, y_new, z_new;
                    //чекам координаты
                    PwUtils.GetCords(this.bot, out x_new, out y_new, out z_new);
                    if (x_new == this.x && y_new == this.y && z_new == this.z)
                    {
                        for (int i = 0; i < 4; i++)
                        {
                            //Посылаем F12 4 раза
                            WinApi.PostMessage(bot.Descrypt, WinApi.WM_KEYDOWN, (int)Keys.F12, 0);
                            Thread.Sleep(400);
                        }
                    }
                    this.x = x_new; this.y = y_new; this.z = z_new;
                }

                //раз в две минуты проверка
                if (tempCount % 120 == 0)
                {
                    //если не изменилось количество денег, то отправляем уведомление в телеграм
                    PwUtils.CheckMoney(bot);
                    oldMoneyValue = bot.Money;
                }
                //жмем атаку
                var visible = CalcMethods.CalcByteValue(bot.Handle, btn_address[0] + OfsPresenter.getInstance("WND_VIS")[0]);
                if (visible == 1)
                {
                    Injects.GUI_Inject(btn_address[0], btn_address[1], bot.Handle);
                }
            }
        }
コード例 #5
0
        private static void Main(string[] args)
        {
            _client = PwClient.GetClients().First(cl => cl.PlayerInfo.Name == "chersanya");
            var ps = _client.Environment.GetPlayers();

            _client.UnfreezePermanent();
            OpenAllChips();
        }
コード例 #6
0
        public static void Init()
        {
            var clients = PwClient.GetClients();

            Assasin = clients.First(cl => cl.PlayerInfo.Name == "chersanya");
            Cleric  = clients.First(cl => cl.PlayerInfo.Name == "chersаnyа");
            Assasin.UnfreezePermanent();
            Cleric.UnfreezePermanent();
        }
コード例 #7
0
        public MainWindow()
        {
            InitializeComponent();
            MouseDown += delegate { DragMove(); };

            _client = PwClient.GetClients().FirstOrDefault();

            var timer = new DispatcherTimer();

            timer.Tick += (s, e) =>
            {
                if (_client == null || _client.Process.HasExited)
                {
                    _client = null;
                    ClearInfo();
                    Hide();
                    return;
                }

                uint target = _client.PlayerInfo.TargetId;
                var  player = _client.Environment.GetPlayers().FirstOrDefault(p => p.Id == target);
                if (player != null)
                {
                    bool eye = _client.PlayerInfo.Class == Class.Assasin &&
                               player.Class == Class.Assasin &&
                               player.Level >= _client.PlayerInfo.Level;
                    SetInfo(player.Name, player.Level, player.Class, player.Hp, player.MaxHp, player.Mp, player.MaxMp, eye);
                    Show();
                }
                else
                {
                    SetInfo(_client.PlayerInfo.Name, _client.PlayerInfo.Level, _client.PlayerInfo.Class, _client.PlayerInfo.Hp, _client.PlayerInfo.MaxHp, _client.PlayerInfo.Mp, _client.PlayerInfo.MaxMp, false);
                    Show();
                }
            };
            timer.Interval = TimeSpan.FromSeconds(0.5);
            timer.Start();



            var timerWinUpd = new DispatcherTimer();

            timerWinUpd.Tick += (s, ee) =>
            {
                IntPtr foreground = GetForegroundWindow();
                if (IsActive)
                {
                    return;
                }
                _client = PwClient.GetClients().FirstOrDefault(cl => cl.Process.MainWindowHandle == foreground);
            };
            timerWinUpd.Interval = TimeSpan.FromSeconds(2);
            timerWinUpd.Start();
        }
コード例 #8
0
 private Int32 SearchIndexInCollection(PwClient pw, List <PwClient> coll)
 {
     //пробегаемся по коллекции и ищем индекс нужного элемента
     for (Int32 i = 0; i < coll.Count; i++)
     {
         if (pw == coll[i])
         {
             return(i);
         }
     }
     return(-1);
 }
コード例 #9
0
 private static void Move12(PwClient client)
 {
     // go to the next room
     client.ActionStructs.GoToGame(436.9f, 577.6f);
     client.ActionStructs.GoToGame(435.4f, 579);
     client.ActionStructs.GoToGame(435.4f, 579);
     client.ActionStructs.GoToGame(434.3f, 580.6f);
     client.ActionStructs.GoToGame(433.1f, 580.6f);
     client.ActionStructs.GoToGame(433.1f, 582.1f);
     client.ActionStructs.GoToGame(430.4f, 585);
     client.ActionStructs.GoToGame(429.1f, 585);
     client.ActionStructs.GoToGame(429.1f, 586.3f);
     client.ActionStructs.GoToGame(425.9f, 587.9f);
 }
コード例 #10
0
        public void Start(PwClient client, Action <string, MsgType> log)
        {
            var runtime = Python.CreateRuntime();
            var scope   = runtime.CreateScope();
            var engine  = runtime.GetEngine("Python");

            runtime.IO.SetOutput(new EventRaisingStream(s => log(s, MsgType.Out)), Encoding.ASCII);
            runtime.IO.SetErrorOutput(new EventRaisingStream(s => log(s, MsgType.Error)), Encoding.ASCII);

            scope.SetVariable("pw", client);

            engine.Execute(PreScript, scope);

            scope.SetVariable("Log", new Action <dynamic>(msg => log(msg, MsgType.Out)));
            scope.SetVariable("Success", new Action <dynamic>(msg => log(msg, MsgType.Success)));
            scope.SetVariable("Error", new Action <dynamic>(msg => log(msg, MsgType.Error)));

            WorkingThread = new Thread(() =>
            {
                OnPropertyChanged("IsRunning");
                log("Script started", MsgType.System);
                try
                {
                    engine.Execute(Source, scope);

                    if (scope.ContainsVariable("Loop"))
                    {
                        while (true)
                        {
                            scope.GetVariable <Action>("Loop")();
                            Thread.Sleep(200);
                        }
                    }
                }
                catch (ThreadAbortException)
                {
                    Thread.ResetAbort();
                }
                catch (Exception ex)
                {
                    log(ex.Message, MsgType.Error);
                }
                log("Script completed\n", MsgType.System);
                OnPropertyChanged("IsRunning");
            });
            WorkingThread.Start();
        }
コード例 #11
0
 private void UpdateCharacters()
 {
     charactersGrid.ItemsSource = PwClient.GetClients();
 }
コード例 #12
0
 public static void SelectCharacter(int pid)
 {
     ActiveClient = PwClient.GetClients().First(cl => cl.Pid == pid);
 }
コード例 #13
0
 private void SelectedClientChanged(object sender, SelectedCellsChangedEventArgs e)
 {
     _client = (PwClient)clientsGrid.SelectedItem;
 }
コード例 #14
0
        private void Pw_CLient_Search(ObservableCollection <PwClient> coll)
        {
            //Задаем начало отсчета
            IntPtr hwnd = IntPtr.Zero;
            //Задаем временное хранилище запущенных клиентов
            List <PwClient> temp_coll = new List <PwClient>();

            //В бесконечном цикле перебираем все запущенные окна с классом ElementClient Window
            while (true)
            {
                //очищаем коллекцию клиентов и начинаем заполнять заново
                //получаем следующее окно с классом ElementClient Window.
                hwnd = WinApi.FindWindowEx(IntPtr.Zero, hwnd, "ElementClient Window", null);
                //Если наткнулись на ноль - значит выходим
                if (hwnd == IntPtr.Zero)
                {
                    break;
                }
                //задаем временную ссылку на объект нашего клиента
                PwClient temp_client = new PwClient(hwnd);
                //если персонаж запущен (удалось прочесть имя), то добавляем наш объект во временное хранилище
                if (temp_client.Name.Length > 0)
                {
                    temp_coll.Add(temp_client);
                }
            }
            //цикл для удаления из комбобокса и хэштаблицы неактуальных объектов
            for (int i = coll.Count - 1; i > -1; i--)
            {
                if (!temp_coll.Contains(coll[i]))
                {
                    {
                        oldMoneyValue.Remove(((PwClient)coll[i]).Name);
                        ht.Remove(((PwClient)coll[i]).Name);
                        coll.Remove((PwClient)coll[i]);
                    }
                }
            }

            //цикл для удаления из временного хранилища уже запущенных клиентов
            for (int i = coll.Count - 1; i > -1; i--)
            {
                //если временное хранилище имеет элемент, которое уже есть в комбобоксе
                //то ищем индекс этого объекта во временном хранилище и удаляем по индексу
                PwClient temp = (PwClient)coll[i];
                if (temp_coll.Contains(temp))
                {
                    Int32 iter = SearchIndexInCollection((PwClient)coll[i], temp_coll);
                    if (iter > -1)
                    {
                        temp_coll.RemoveAt(iter);
                    }
                }
            }


            //добавляем оставшиеся во временном хранилище объекты (новые)
            //в комбобокс и хэш-таблицу
            foreach (PwClient pw in temp_coll)
            {
                coll.Add(pw);
                ht.Add(pw.Name, pw);
                oldMoneyValue.Add(pw.Name, pw.Money);
            }
        }
コード例 #15
0
 private void UpdateCharacters()
 {
     charactersGrid.ItemsSource = PwClient.GetClients();
     configsCb.ItemsSource      = MainLogic.GetConfigs();
 }
コード例 #16
0
 private static void Move23(PwClient client)
 {
     client.ActionStructs.GoToGame(424.8f, 592.9f);
     client.ActionStructs.GoToGame(422.8f, 594.8f);
     client.ActionStructs.GoToGame(422.8f, 596.8f);
 }
コード例 #17
0
 private static void Move45(PwClient client)
 {
     client.ActionStructs.GoToGame(439.8f, 591.8f);
     client.ActionStructs.GoToGame(439.8f, 594.7f);
 }
コード例 #18
0
 private void UpdateClientsButtonClick(object sender, RoutedEventArgs e)
 {
     clientsGrid.ItemsSource = PwClient.GetClients();
 }
コード例 #19
0
 private static void Move34(PwClient client)
 {
     client.ActionStructs.GoToGame(432.4f, 592.7f);
     client.ActionStructs.GoToGame(434.3f, 591.8f);
     client.ActionStructs.GoToGame(434.8f, 591.8f);
 }
コード例 #20
0
ファイル: CommonPwBot.cs プロジェクト: K1aidy/PW_BOT_MVVM_GUI
        public override void Do(object param)
        {
            if (!this.IsStart)
            {
                botId = ConfigurationManager.AppSettings[param.ToString()];
                if (String.IsNullOrEmpty(botId))
                {
                    throw new Exception($"Не найден телеграм-бот {param.ToString()}");
                }
                //запускаем бота
                telebot = new TelegramBotClient(botId);
                telebot.SetWebhookAsync("");
                //ищем id чата
                Int64.TryParse(ConfigurationManager.AppSettings["ChatId"], out chatid);
                bot = PwUtils.Pw_CLient_Search(param.ToString(), bot);
                if (bot == null)
                {
                    return;
                }



                this.IsStart = !this.IsStart;
            }

            while (true)
            {
                Thread.Sleep(1000);
                tempCount++;

                bot = PwUtils.Pw_CLient_Search(param.ToString(), bot);
                if (bot == null)
                {
                    continue;
                }

                btn_address = CalcMethods.CalcControlAddress(bot.Handle, "Win_QuickbarPetH", "Btn_Attack");
                //раз в две минуты проверка
                if (tempCount % 120 == 0)
                {
                    //если не изменилось количество денег, то отправляем уведомление в телеграм
                    PwUtils.CheckMoney(bot);
                    if (oldMoneyValue == bot.Money)
                    {
                        telebot.SendTextMessageAsync(chatid, $"У меня не меняется количество денег").Wait();
                    }
                    oldMoneyValue = bot.Money;

                    //обработка последних сообщений в телеграме
                    var updates = telebot.GetUpdatesAsync(msgCount).Result;
                    foreach (var update in updates) // Перебираем все обновления
                    {
                        if (update.Message.Type == Telegram.Bot.Types.Enums.MessageType.TextMessage)
                        {
                            if (update.Message.Text == "/addme")
                            {
                                //обработка текста
                            }
                        }
                        msgCount = update.Id + 1;
                    }
                }
            }
        }