Пример #1
0
        private void ActivateChatFeature()
        {
            //RefreshChatCustomization();
            CallFunc(chat.Refresh);
            Dictionary <Microsoft.Xna.Framework.Input.Buttons, string> dict = new Dictionary <Microsoft.Xna.Framework.Input.Buttons, string>();

            BaseAddress = GetModule("RocketLeague.exe");
            int[] ChatEnabledOffsets = { 0xF8, 0x1C0, 0x10, 0x78, 0x414 };
            int[] InMenuOffsets      = { 0x10, 0xC, 0x0, 0x614, 0x718 };
            if (BaseAddress != 0)
            {
                while (true)
                {
                    //checks whether or not the player is in a menu
                    uint InMenuBase    = Mem.ReadUInteger((IntPtr)BaseAddress + 0x019FA7E8);
                    int  InMenuAddress = FindMultiLevelPointer(InMenuBase, InMenuOffsets);
                    int  InMenu        = Mem.ReadInt32((IntPtr)InMenuAddress);

                    //checks whether or not the quick chat is enabled
                    uint ChatEnabledBase    = Mem.ReadUInteger((IntPtr)BaseAddress + 0x01962610);
                    int  ChatEnabledAddress = FindMultiLevelPointer(ChatEnabledBase, ChatEnabledOffsets);
                    int  ChatEnabled        = Mem.ReadInt32((IntPtr)ChatEnabledAddress);

                    if (CheckForOverlayUpdate)
                    {
                        if (chat.RefreshOverlayCue)
                        {
                            CallTextUpdate();
                            for (int i = 0; i < dict.Count; i++)
                            {
                                KeyValuePair <Microsoft.Xna.Framework.Input.Buttons, string> pair = dict.ElementAt(i);
                                overlay.StrToDraw[i] = pair.Value;
                            }
                            CallFunc(overlay.Refresh);
                            chat.RefreshOverlayCue = false;
                        }
                    }
                    if (RunThread && (InMenu == 0 && (ChatEnabled == 1 || ChatEnabled == 25 || ChatEnabled == 27)))
                    {
                        GamePadState currentState = GamePad.GetState(PlayerIndex.One);
                        foreach (var i in messageSets)
                        {
                            if (currentState.IsConnected && currentState.IsButtonDown(i.Key))
                            {
                                if (!overlay.Draw)
                                {
                                    currentMessageSet = i.Key;
                                }
                                else
                                {
                                    overlay.Timer.Stop();
                                    overlay.Timer.Start();
                                    continue;
                                }
                            }
                            else
                            {
                                continue;
                            }



                            dict = messageSets[currentMessageSet];

                            overlay.StrToDraw = new string[4];

                            for (int j = 0; j < dict.Count; j++)
                            {
                                KeyValuePair <Microsoft.Xna.Framework.Input.Buttons, string> pair = dict.ElementAt(j);
                                overlay.StrToDraw[j] = pair.Value;
                            }
                            overlay.Draw = true;
                            CallFunc(overlay.Refresh);
                            Thread.Sleep(300);
                        }
                        currentState = GamePad.GetState(PlayerIndex.One);
                        foreach (var i in dict)
                        {
                            if (overlay.Draw)
                            {
                                Microsoft.Xna.Framework.Input.Buttons iterKey = i.Key;
                                if (currentState.IsConnected && currentState.IsButtonDown(iterKey))
                                {
                                    AlterTextBox("" + i.Key);
                                    key = i.Key;
                                    break;
                                }
                                key = 0;
                            }
                        }
                        if (key != 0)
                        {
                            SendDelay++;
                            if (SendDelay == 1)
                            {
                                //checks for existence of [y] preceding message - if this yields true, it will send a 'y' to open team chat
                                bool TeamChatPrefixExists = (dict[key].Substring(0, 3).Equals("[y]"));

                                SendKeys.SendWait((TeamChatPrefixExists) ? "y" : "t");
                                Thread.Sleep(SLEEP_TIME);
                                SendKeys.SendWait(((TeamChatPrefixExists) ? dict[key].Substring(3) : dict[key]) + "{ENTER}"); //if [y] prefix exists, it is excluded from the main message being sent
                            }
                        }
                        else
                        {
                            SendDelay = 0;
                        }
                    }
                    Thread.Sleep(1);
                }
            }
        }