private void Run() { while (true) { if (playing) { if (wardsCD == 0 && warnWards && mainForm.WardWards()) { warnWards = false; string chatStr = "▶ Wards are off cooldown!"; KBMHelper.PressKey(VirtualKeyCode.RETURN); Thread.Sleep(50); KBMHelper.TypeChat(chatStr); Thread.Sleep(50); KBMHelper.PressKey(VirtualKeyCode.RETURN); Thread.Sleep(200); } if (canTimeTrigger) { if (mainForm.WarnRunes() && mainForm.WarnTome() && clockTime % 600 == 0 && clockTime > 599) { string chatStr = "▶ All Runes are up and Tome of Knowledge can be purchased!"; canTimeTrigger = false; KBMHelper.PressKey(VirtualKeyCode.RETURN); Thread.Sleep(50); KBMHelper.TypeChat(chatStr); Thread.Sleep(50); KBMHelper.PressKey(VirtualKeyCode.RETURN); Thread.Sleep(200); } else if (!mainForm.WarnRunes() && mainForm.WarnTome() && clockTime % 600 == 0 && clockTime > 599) { string chatStr = "▶ Tome of Knowledge can be purchased!"; canTimeTrigger = false; KBMHelper.PressKey(VirtualKeyCode.RETURN); Thread.Sleep(50); KBMHelper.TypeChat(chatStr); Thread.Sleep(50); KBMHelper.PressKey(VirtualKeyCode.RETURN); Thread.Sleep(200); } else if (mainForm.WarnRunes() && !mainForm.WarnTome() && clockTime % 600 == 0 && clockTime > 599) { string chatStr = "▶ All Runes are up!"; canTimeTrigger = false; KBMHelper.PressKey(VirtualKeyCode.RETURN); Thread.Sleep(50); KBMHelper.TypeChat(chatStr); Thread.Sleep(50); KBMHelper.PressKey(VirtualKeyCode.RETURN); Thread.Sleep(200); } else if (mainForm.WarnRunes() && clockTime % 120 == 0 && clockTime % 600 != 0 && clockTime > 119) { string chatStr = "▶ Power-Up Runes are up!"; canTimeTrigger = false; KBMHelper.PressKey(VirtualKeyCode.RETURN); Thread.Sleep(50); KBMHelper.TypeChat(chatStr); Thread.Sleep(50); KBMHelper.PressKey(VirtualKeyCode.RETURN); Thread.Sleep(200); } else if (mainForm.WarnRunes() && clockTime % 300 == 0 && clockTime % 600 != 0 && clockTime > 299) { string chatStr = "▶ Bounty Runes are up!"; canTimeTrigger = false; KBMHelper.PressKey(VirtualKeyCode.RETURN); Thread.Sleep(50); KBMHelper.TypeChat(chatStr); Thread.Sleep(50); KBMHelper.PressKey(VirtualKeyCode.RETURN); Thread.Sleep(200); } } if (mainForm.WarnRoshan() && clockTime >= roshTime && roshToggle) { int limit = roshTime + 180; string chatStr = "▶ Roshan might be up! Limit is: " + TimeHelper.toHHMMSS(limit); roshToggle = false; KBMHelper.PressKey(VirtualKeyCode.RETURN); Thread.Sleep(50); KBMHelper.TypeChat(chatStr); Thread.Sleep(50); KBMHelper.PressKey(VirtualKeyCode.RETURN); Thread.Sleep(200); } if (mainForm.WarnAegis() && clockTime <= aegisTime && aegisToggle > 0) { string chatStr = ""; int left = aegisTime - clockTime; if (left <= 0 && aegisToggle == 1) { chatStr = "▶ Aegis expired!"; aegisToggle = 0; KBMHelper.PressKey(VirtualKeyCode.RETURN); Thread.Sleep(50); KBMHelper.TypeChat(chatStr); Thread.Sleep(50); KBMHelper.PressKey(VirtualKeyCode.RETURN); } else if (left == 60 && aegisToggle == 2) { chatStr = "▶ Aegis will expire in " + left + " seconds! (" + TimeHelper.toHHMMSS(aegisTime) + ")"; KBMHelper.PressKey(VirtualKeyCode.RETURN); aegisToggle = 1; Thread.Sleep(50); KBMHelper.TypeChat(chatStr); Thread.Sleep(50); KBMHelper.PressKey(VirtualKeyCode.RETURN); } else if (left == 180 && aegisToggle == 3) { chatStr = "▶ Aegis will expire in " + left + " seconds! (" + TimeHelper.toHHMMSS(aegisTime) + ")"; KBMHelper.PressKey(VirtualKeyCode.RETURN); aegisToggle = 2; Thread.Sleep(50); KBMHelper.TypeChat(chatStr); Thread.Sleep(50); KBMHelper.PressKey(VirtualKeyCode.RETURN); } Thread.Sleep(200); } if (KBMHelper.GetAsyncKeyState(0x2D) < 0) //INSERT { string chatStr = "▶ Roshan Timer: "; int minTime = clockTime + 480; //8 MINS int maxTime = clockTime + 660; //11 MINS roshTime = minTime; roshToggle = true; chatStr = chatStr + TimeHelper.toHHMMSS(minTime) + " - " + TimeHelper.toHHMMSS(maxTime); KBMHelper.PressKey(VirtualKeyCode.RETURN); Thread.Sleep(50); KBMHelper.TypeChat(chatStr); Thread.Sleep(50); KBMHelper.PressKey(VirtualKeyCode.RETURN); Thread.Sleep(200); continue; } if (KBMHelper.GetAsyncKeyState(0x2E) < 0) //DELETE { string chatStr = "▶ Aegis expires on: "; int minTime = clockTime + 300; //5 MINS aegisTime = minTime; aegisToggle = 3; chatStr = chatStr + TimeHelper.toHHMMSS(minTime); KBMHelper.PressKey(VirtualKeyCode.RETURN); Thread.Sleep(50); KBMHelper.TypeChat(chatStr); Thread.Sleep(50); KBMHelper.PressKey(VirtualKeyCode.RETURN); Thread.Sleep(200); continue; } if (KBMHelper.GetAsyncKeyState(0x5) < 0 && alive && !comboLock) //MOUSE4 and ALIVE { KBMHelper.keybd_event(0x5, 0, 0x2, 0); ListBox.ObjectCollection macro; macro = mainForm.Macro(); int time = 0; string command = ""; string args = ""; bool success = false; bool waited = false; bool shiftState = false; comboLock = true; foreach (string macroCMD in macro) { if (macroCMD == null || macroCMD.Length == 0) { continue; } command = ""; args = ""; waited = false; if (macroCMD.Split(' ').Length == 1) { command = macroCMD.Split(' ')[0]; } else if (macroCMD.Split(' ').Length >= 2) { command = macroCMD.Split(' ')[0]; args = macroCMD.Split(' ')[1]; } if (command == "ATTACK") { ActionExecuter.ExecuteAbility(command.Substring(0, 1), args, mainForm.QuickCast(), this, false); success = true; } else if (command == "TAB") { KBMHelper.PressKey(VirtualKeyCode.TAB); waited = true; success = true; continue; } else if (command == "STOP") { KBMHelper.PressKey(VirtualKeyCode.VK_S); shiftState = !shiftState; waited = true; success = true; continue; } else if (command == "SHIFT") { if (!shiftState) { KBMHelper.PressKey(VirtualKeyCode.VK_S); KBMHelper.ShiftDown(); } else { KBMHelper.ShiftUp(); KBMHelper.PressKey(VirtualKeyCode.VK_S); } shiftState = !shiftState; waited = true; success = true; continue; } else if (command == "WAIT" && success) { time = Int32.Parse(args); waited = true; Thread.Sleep(time); KBMHelper.PressKey(VirtualKeyCode.VK_S); continue; } success = true; if (command.Length == 1) { success = ActionExecuter.ExecuteAbility(command.Substring(0, 1), args, mainForm.QuickCast(), this, false); } if (command.Length > 4) { if (command.Substring(0, 5) == "item_") { success = ActionExecuter.ExecuteItem(command, args, mainForm.QuickCast(), this, false); } } if (!success && mainForm.Cancel()) { break; } //if (KBMHelper.GetAsyncKeyState(0x48) < 0) break; //H - HALT if (!waited && success) { Random rnd = new Random(); time = mainForm.ActionWait(); if (mainForm.WaitRandom()) { time += rnd.Next(1, mainForm.WaitRandomTime()); } if (shiftState && !mainForm.Shift()) { time = 0; } Thread.Sleep(time); } } if (shiftState) { KBMHelper.ShiftUp(); } comboLock = false; Thread.Sleep(200); } if (KBMHelper.GetAsyncKeyState(0x20) < 0) { KBMHelper.keybd_event(0x20, 0, 0x2, 0); autoShadowAmulet = !autoShadowAmulet; Thread.Sleep(200); } if (autoShadowAmulet && KBMHelper.GetAsyncKeyState(0x2) < 0) { Random rnd = new Random(); int time = 200; if (mainForm.WaitRandom()) { time += rnd.Next(1, mainForm.WaitRandomTime()); } ActionExecuter.ExecuteItem("item_shadow_amulet", "SELF", mainForm.QuickCast(), this, false); Thread.Sleep(time); } if (mainForm.Phase() && (KBMHelper.GetAsyncKeyState(0x2) < 0 || KBMHelper.GetAsyncKeyState(0x41) < 0 || KBMHelper.GetAsyncKeyState(0x4D) < 0)) { Random rnd = new Random(); int time = 200; if (mainForm.WaitRandom()) { time += rnd.Next(1, mainForm.WaitRandomTime()); } ActionExecuter.ExecuteItem("item_phase_boots", null, mainForm.QuickCast(), this, true); Thread.Sleep(time); } } Thread.Sleep(1); } }