diff --git a/README.md b/README.md index 9180b12..da64b9e 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,23 @@ -# Basic-New-World-Bot -Basic New World Bot +# Basic New World Bot +Watch the video! - https://www.youtube.com/watch?v=ixOkG0h6SjI + +Join teh Discord - https://discord.com/invite/YwMqW5P8ZN + +### Prereqs +Make sure you have a pet Python - https://www.python.org/ + +Make sure you pip install the following packages +``` +pip install PyAutoGUI +pip install PyDirectInput +``` + +New World must be installed and running..... But you know this already right? + +### Run +If you have python and the 2 packages you are good to go. Load up New World on your MAIN monitor (Only applicable for people with multiple monitors), enter the game and walk to a nice farming spot, then run the program. +``` +python main.py +``` +**We are always looking for new Volunteers to join our Champions! +If you have any ideas for videos or programs, let us know!** diff --git a/imgs/e0.png b/imgs/e0.png new file mode 100644 index 0000000..b309c8e Binary files /dev/null and b/imgs/e0.png differ diff --git a/main.py b/main.py new file mode 100644 index 0000000..a094976 --- /dev/null +++ b/main.py @@ -0,0 +1,92 @@ +import pyautogui +import pydirectinput +import time +import random + +def main(): + """ + Main function for the program + """ + + # Finds all Windows with the title "New World" + newWorldWindows = pyautogui.getWindowsWithTitle("New World") + + # Find the Window titled exactly "New World" (typically the actual game) + for window in newWorldWindows: + if window.title == "New World": + newWorldWindow = window + break + + # Select that Window + newWorldWindow.activate() + + # Move your mouse to the center of the game window + centerW = newWorldWindow.left + (newWorldWindow.width/2) + centerH = newWorldWindow.top + (newWorldWindow.height/2) + pyautogui.moveTo(centerW, centerH) + + # Clicky Clicky + time.sleep(.1) + pyautogui.click() + time.sleep(.1) + + # Seconds to move foward + fowardMoveTotal = 20 + + # Current seconds foward moved + currentFoward = 0 + + # Go right or left + flip = 1 + + # Turn 90 degrees, value will be different for you, im on a 4k monitor + flipMouseMove = 2000 + + # Making tuple with data from the window for later use + region = (newWorldWindow.left, newWorldWindow.top, newWorldWindow.width, newWorldWindow.height) + + # Main bot loop, runs forever use CTRL+C to turn it off + while True: + # Find that image on screen, in that region, with a confidence of 65% + if pyautogui.locateOnScreen("imgs/e0.png", grayscale=True, confidence=.65, region=region) is not None: + pyautogui.press('e') + time.sleep(1) + continue + + # Do I got to explain? + pyautogui.press('=') + + # Randomly move foward 0 - 1.5 seconds + temp = 1.5 * random.random() + currentFoward += temp + time.sleep(temp) + + # Brah, you know + pyautogui.press('=') + + # Flippy flip if you hitty hit the max move time (fowardMoveTotal) + if currentFoward >= fowardMoveTotal: + # Reset the move foward + currentFoward = 0 + + # Move the mouse 90 degrees + pydirectinput.move(flipMouseMove * flip, 1, relative=True) + + # Move Foward 1.5 secs + pyautogui.press('=') + time.sleep(1.5) + pyautogui.press('=') + + # Move the mouse 90 degrees + pydirectinput.move(flipMouseMove * flip, 1, relative=True) + + # Flippy flippy the value. Evil math. + flip *= -1 + + # Sleeping for the animation + time.sleep(.1) + + +# Runs the main function +if __name__ == '__main__': + main()