public Manager(IManagerEventHandler managerEventHandler, IProgress <string> progressHandle) { m_managerEventHandler = managerEventHandler; m_eyes = new Eyes(); m_hands = new Hands(); m_ears = new Ears(); m_mouth = new Mouth(progressHandle); m_legs = new Legs(); m_fishingState = FishingState.Stopped; m_neededActions = NeededAction.None; m_fishingStats = new FishingStats(); m_fishingStats.Reset(); _cancellationTokenSource = null; InitializeTimer(ref m_LureTimer, LureTimerTick); InitializeTimer(ref m_CharmTimer, CharmTimerTick); InitializeTimer(ref m_RaftTimer, RaftTimerTick); InitializeTimer(ref m_BaitTimer, BaitTimerTick); InitializeTimer(ref m_HearthStoneTimer, HearthStoneTimerTick); InitializeTimer(ref m_AntiAfkTimer, AntiAfkTimerTick); ResetTimers(); }
public Manager(frmMain mainForm) { m_mainForm = mainForm; m_eyes = new Eyes(this); m_hands = new Hands(); m_ears = new Ears(this); m_mouth = new Mouth(m_mainForm); m_legs = new Legs(); m_actualState = FishingState.Stopped; m_neededActions = NeededAction.None; m_fishingStats.Reset(); //InitializeTimer(Timer, Handler); InitializeTimer(ref m_nextActionTimer, TakeNextAction); InitializeTimer(ref m_LureTimer, LureTimerTick); InitializeTimer(ref m_CharmTimer, CharmTimerTick); InitializeTimer(ref m_RaftTimer, RaftTimerTick); InitializeTimer(ref m_BaitTimer, BaitTimerTick); InitializeTimer(ref m_HearthStoneTimer, HearthStoneTimerTick); InitializeTimer(ref m_AntiAfkTimer, AntiAfkTimerTick); ResetTimers(); }
private void HandleNeededAction(NeededAction action) { switch (action) { case NeededAction.HearthStone: m_mainForm.StopFishing(); goto case NeededAction.Lure; // We continue, Hearthstone need m_hands.DoAction case NeededAction.Lure: case NeededAction.Charm: case NeededAction.Raft: case NeededAction.Bait: m_hands.DoAction(action, m_mouth); break; case NeededAction.AntiAfkMove: m_legs.DoMovement(t2s); break; default: break; } RemoveNeededAction(action); }
public Manager(IManagerEventHandler managerEventHandler, IProgress <string> progressHandle) { _mManagerEventHandler = managerEventHandler; var wowWindowPointer = Win32.FindWowWindow(); while (wowWindowPointer == new IntPtr()) { var result = MessageBox.Show( @"Could not find the the WoW process. Please make sure the game is running.", @"Error - WoW not open", MessageBoxButtons.RetryCancel, MessageBoxIcon.Error); if (result == DialogResult.Cancel) { Environment.Exit(1); } wowWindowPointer = Win32.FindWowWindow(); } _eyes = new Eyes(wowWindowPointer); _hands = new Hands(wowWindowPointer); _ears = new Ears(); _mouth = new Mouth(progressHandle); _legs = new Legs(); _fishingState = FishingState.Stopped; _neededActions = NeededAction.None; _fishingStats = new FishingStats(); _fishingStats.Reset(); _cancellationTokenSource = null; _lureTimer = InitializeTimer(LureTimerTick); _charmTimer = InitializeTimer(CharmTimerTick); _raftTimer = InitializeTimer(RaftTimerTick); _baitTimer = InitializeTimer(BaitTimerTick); _hearthStoneTimer = InitializeTimer(HearthStoneTimerTick); _antiAfkTimer = InitializeTimer(AntiAfkTimerTick); ResetTimers(); }
public Manager(IManagerEventHandler managerEventHandler, IProgress <string> progressHandle) { m_managerEventHandler = managerEventHandler; IntPtr WowWindowPointer = Helpers.Win32.FindWowWindow(); DialogResult result = DialogResult.Cancel; while (WowWindowPointer == new IntPtr()) { result = MessageBox.Show("Could not find the the WoW process. Please make sure the game is running.", "Error - WoW not open", MessageBoxButtons.RetryCancel, MessageBoxIcon.Error); if (result == DialogResult.Cancel) { Environment.Exit(1); } WowWindowPointer = Helpers.Win32.FindWowWindow(); } m_eyes = new Eyes(WowWindowPointer); m_hands = new Hands(WowWindowPointer); m_ears = new Ears(); m_mouth = new Mouth(progressHandle); m_legs = new Legs(); m_fishingState = FishingState.Stopped; m_neededActions = NeededAction.None; m_fishingStats = new FishingStats(); m_fishingStats.Reset(); _cancellationTokenSource = null; InitializeTimer(ref m_LureTimer, LureTimerTick); InitializeTimer(ref m_CharmTimer, CharmTimerTick); InitializeTimer(ref m_RaftTimer, RaftTimerTick); InitializeTimer(ref m_BaitTimer, BaitTimerTick); InitializeTimer(ref m_HearthStoneTimer, HearthStoneTimerTick); InitializeTimer(ref m_AntiAfkTimer, AntiAfkTimerTick); ResetTimers(); }
private async Task HandleNeededAction(NeededAction action, CancellationToken cancellationToken) { switch (action) { case NeededAction.HearthStone: Stop(); goto case NeededAction.Lure; // We continue, Hearthstone need m_hands.DoAction case NeededAction.Lure: case NeededAction.Charm: case NeededAction.Raft: case NeededAction.Bait: await m_hands.DoAction(action, m_mouth, cancellationToken); break; case NeededAction.AntiAfkMove: await m_legs.DoMovement(t2s, cancellationToken); break; } RemoveNeededAction(action); }
private bool HasNeededAction(NeededAction action) { return((m_neededActions & action) != NeededAction.None); }
private void RemoveNeededAction(NeededAction action) { m_neededActions &= ~action; }
private void AddNeededAction(NeededAction action) { m_neededActions |= action; }
public async Task DoAction(NeededAction action, Mouth mouth, CancellationToken cancellationToken) { string actionKey = ""; int sleepTime = 0; switch (action) { case NeededAction.HearthStone: { actionKey = Properties.Settings.Default.HearthKey; mouth.Say(Translate.GetTranslate("manager", "LABEL_HEARTHSTONE")); sleepTime = 0; break; } case NeededAction.Lure: { actionKey = Properties.Settings.Default.LureKey; mouth.Say(Translate.GetTranslate("manager", "LABEL_APPLY_LURE")); sleepTime = 3; break; } case NeededAction.Charm: { actionKey = Properties.Settings.Default.CharmKey; mouth.Say(Translate.GetTranslate("manager", "LABEL_APPLY_CHARM")); sleepTime = 3; break; } case NeededAction.Raft: { actionKey = Properties.Settings.Default.RaftKey; mouth.Say(Translate.GetTranslate("manager", "LABEL_APPLY_RAFT")); sleepTime = 2; break; } case NeededAction.Bait: { int baitIndex = 0; if (Properties.Settings.Default.CycleThroughBaitList) { if (_mBaitIndex >= 6) { _mBaitIndex = 0; } baitIndex = _mBaitIndex++; } actionKey = _mBaitKeys[baitIndex]; mouth.Say(Translate.GetTranslate("manager", "LABEL_APPLY_BAIT", baitIndex)); sleepTime = 3; break; } default: return; } Log.Information("Send key start: " + actionKey); Win32.ActivateWow(_wow); await Task.Delay(1000, cancellationToken); Win32.SendKey(actionKey); Log.Information("Sent key: " + actionKey); await Task.Delay(sleepTime * 1000, cancellationToken); }