Skip to content

Instantly share code, notes, and snippets.

@JeremyLoy
Last active March 4, 2020 01:29
Show Gist options
  • Save JeremyLoy/84126c7e2577ac984192eb89b440e969 to your computer and use it in GitHub Desktop.
Save JeremyLoy/84126c7e2577ac984192eb89b440e969 to your computer and use it in GitHub Desktop.
Auto-Fractaline

A simple script I wrote to automate Fractaline donation in Destiny 2.

Video in action

Stonks

The Empyrean Restoration Effort was a limited time event (5 weeks) that provided unprecedented amounts of XP and loot as donating 400 Fractaline instantly completed all weapon bounties. Those bounties granted thousands of XP each, as well as random rolls of medium to high quality gear.

Automating this task saved literally dozens of hours as donating 400 Fractaline takes roughly 20 seconds. Adding in the time to acquire, redeem, and delete weapon bounties a single loop would take around 1.5 minutes. With the amount of Fractaline I myself acquired (~60,000), it would have taken me ~4 hours do donate. Not the most interesting thing to do on a Saturday night. Instead, I spent around 20 minutes learning pyautogui, which I had never used before, and let it run while I watched Twitch.

Although the event is over and this script is now without purpose, I decided to publicly archive it for others edification. Perhaps this script could be used in part for a future event.

Tested with python 3.7.6 and pyautogui 0.9.48

If you want to use this script for yourself, you may have to adjust the constants defined at the beginning of the file to accomadate different aspect ratios and resolutions.

This script assumes standard keybindings, plus an additional keybind of p for the quest menu.

Bailing from the script is simple, just move your mouse to one of the 4 corners for a second and the script will exit.

pip install pyautogui
python auto-fractaline.py
import pyautogui
import time
# these constants are configured for a 21:9 3440x1440 monitor
# use python -m pyautogui to find the correct (x, y) for your aspect ratio and resolution
FRACTALINE = pyautogui.Point(2000, 330)
PARADOX = pyautogui.Point(2000, 330)
PRIMARY_EQUIPPED = pyautogui.Point(1140, 530)
PRIMARY_SLOT_3 = pyautogui.Point(720, 520)
QUEST_1 = pyautogui.Point(2290, 350)
VENDOR_TAB_1 = pyautogui.Point(2320, 150)
VENDOR_TAB_2 = pyautogui.Point(2420, 150)
# 1) wait for tab into game
time.sleep(5)
while True:
# 2) select vendor tab 2
pyautogui.moveTo(VENDOR_TAB_2, pause=0.5)
pyautogui.click(VENDOR_TAB_2, pause=0.5)
# 3) position to paradox and purchase 7 paradoxes
pyautogui.moveTo(PARADOX, pause=1)
for _ in range(7):
pyautogui.mouseDown(PARADOX, pause=3)
pyautogui.mouseUp()
# 4) select vendor tab 1
pyautogui.moveTo(VENDOR_TAB_1, pause=0.5)
pyautogui.click(VENDOR_TAB_1, pause=0.5)
# 5) position to fractaline and donate 4 times
pyautogui.moveTo(FRACTALINE, pause=1)
for _ in range(4):
pyautogui.mouseDown(FRACTALINE, pause=5)
pyautogui.mouseUp()
# 6) go to quests
pyautogui.keyDown('p', pause=1)
pyautogui.keyUp('p', pause=1)
# 7) redeem 7 quests
pyautogui.moveTo(QUEST_1, pause=0.5)
pyautogui.click(QUEST_1, clicks=7, interval=1, pause=1)
# 8) go to inventory
pyautogui.keyDown('i', pause=1)
pyautogui.keyUp('i', pause=1)
# 9) positon to weapon one, (which opens submenu), then poistion to the first paradox
pyautogui.moveTo(PRIMARY_EQUIPPED, pause=1)
pyautogui.moveTo(PRIMARY_SLOT_3, pause=1)
# 10) delete all 7 paradoxes
for _ in range(7):
pyautogui.keyDown('f', pause=2)
pyautogui.keyUp('f')
# 11) (esc) to return to vendor menu
pyautogui.keyDown('esc', pause=2)
pyautogui.keyUp('esc', pause=2)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment