Skip to content

Commit

Permalink
Merge branch 'dev' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
Qfc9 committed Nov 22, 2021
2 parents 35e3a13 + f78956d commit f66041e
Show file tree
Hide file tree
Showing 3 changed files with 115 additions and 2 deletions.
25 changes: 23 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -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!**
Binary file added imgs/e0.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
92 changes: 92 additions & 0 deletions main.py
Original file line number Diff line number Diff line change
@@ -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()

0 comments on commit f66041e

Please sign in to comment.