Пример #1
0
        private void KeyHook_KeyUp(object sender, KeyHookEventArgs e)
        {
            if (OverlayWindow.GenshinHandle == IntPtr.Zero)
            {
                return;
            }
            if (Config.CooldownTextLocation == Point.Empty || Config.PartyNumLocations["4 #1"] == Point.Empty)
            {
                return;
            }
            if (e.Key == Keys.E)
            {
                if (Party.SelectedCharacter == -1 || Party.Characters[Party.SelectedCharacter].Cooldown > Config.CooldownMinimumReapply || Party.Characters[Party.SelectedCharacter].Processing)
                {
                    return;
                }
                int c = Party.SelectedCharacter;
                Party.Characters[c].Processing = true;

                new Thread(() => {
                    Thread.Sleep(100);
                    Point captureLocation = new Point(Config.CooldownTextLocation.X, Config.CooldownTextLocation.Y);
                    Size captureSize      = new Size(Config.CooldownTextSize.Width, Config.CooldownTextSize.Height);

                    decimal currentCooldown = IMG.Capture(OverlayWindow.CurrentHandle, captureLocation, captureSize);
                    while (c == Party.SelectedCharacter && currentCooldown == 0)
                    {
                        Thread.Sleep(100);
                        currentCooldown = IMG.Capture(OverlayWindow.CurrentHandle, captureLocation, captureSize);
                    }
                    if (c != Party.SelectedCharacter)
                    {
                        Party.Characters[c].Cooldown = 0;
                        Party.Characters[c].Max      = 0;
                    }
                    else
                    {
                        if (Config.CooldownOverride[c] > 0)
                        {
                            if (currentCooldown < Config.CooldownMinimumOverride)
                            {
                                Party.Characters[c].Cooldown = Config.CooldownOverride[c];
                                Party.Characters[c].Max      = Config.CooldownOverride[c];
                            }
                            else
                            {
                                Party.Characters[c].Cooldown = currentCooldown;
                                Party.Characters[c].Max      = currentCooldown;
                            }
                        }
                        else
                        {
                            Party.Characters[c].Cooldown = currentCooldown + Config.CooldownOffset;
                            Party.Characters[c].Max      = Party.Characters[c].Cooldown;
                        }
                    }
                    Party.Characters[c].Processing = false;
                }).Start();
            }
        }
Пример #2
0
 private void KeyHook_KeyUp(object sender, KeyHookEventArgs e)
 {
     if (OverlayWindow.GenshinHandle == IntPtr.Zero)
     {
         return;
     }
     if (Config.CooldownTextLocation == Point.Empty || Config.PartyNumLocations["4 #1"] == Point.Empty)
     {
         return;
     }
     if (e.Key == Keys.E)
     {
         SkillKeyPressed();
     }
 }