def trudysSurprise(session): global times key = "trudy" timeExpiry = times.get(key) if timeExpiry == None or time.time() > timeExpiry: response = web.get(session, Constants.NEO_TRUDYS) postFields = {"action": "beginroll"} web.post(session, Constants.NEO_TRUDYS_SPIN, postFields, Constants.NEO_TRUDYS) time.sleep( 11 ) # Sleeps because when you spin the wheel you must wait for it to stop before collecting prize postFields = {"action": "prizeclaimed"} web.post(session, Constants.NEO_TRUDYS_SPIN, postFields, Constants.NEO_TRUDYS) print("Spun Trudy's Surprise Wheel") times[key] = timestamp.endOfDay() file = open('times.pkl', 'wb') pickle.dump(times, file) file.close()
def buy_stock(session, times): key = "stocks" timeExpiry = times.get(key) if timeExpiry == None or time.time() > timeExpiry: shares = 1000 ticker, price = __get_cheapest_stock(session) if ticker is not None: funds = True source = web.get(session, Constants.NEO_STOCK_BUY + ticker) balance = bank.getOnHandBalance(source) # Not enough nps get money from bank if balance < shares * price: funds = bank.withdraw(session, shares * price - balance) # If we have enough then buy the stocks if funds: soup = BeautifulSoup(source, "html.parser") ref = soup.find("input", {"name": "_ref_ck"})["value"] postFields = { "_ref_ck": ref, "type": "buy", "ticker_symbol": ticker, "amount_shares": shares } web.post(session, Constants.NEO_STOCK_BUY_PROCESS, postFields, Constants.NEO_STOCK_BUY + ticker) print("Bought " + str(shares) + " of " + ticker + "!") times[key] = timestamp.endOfDay() file = open('times.pkl', 'wb') pickle.dump(times, file) file.close() else: print("No stocks currently trading below 20np") times[key] = timestamp.end_of_hour()
def omelette(session): global times key = "omelette" timeExpiry = times.get(key) if timeExpiry == None or time.time() > timeExpiry: response = web.get(session, Constants.NEO_OMELETTE) postFields = {"type": "get_omelette"} source = web.post(session, Constants.NEO_OMELETTE, postFields, Constants.NEO_OMELETTE) print("Collected an omelette") times[key] = timestamp.endOfDay() file = open(r'times.pkl', 'wb') pickle.dump(times, file) file.close()
def jelly(session): global times key = "jelly" timeExpiry = times.get(key) if timeExpiry == None or time.time() > timeExpiry: response = web.get(session, Constants.NEO_JELLY) postFields = {"type": "get_jelly"} source = web.post(session, Constants.NEO_JELLY, postFields, Constants.NEO_JELLY) print("Collected Jelly") times[key] = timestamp.endOfDay() file = open(r'times.pkl', 'wb') pickle.dump(times, file) file.close()
def tdmbgpop(session): global times key = "tdmbgpop" timeExpiry = times.get(key) if timeExpiry == None or time.time() > timeExpiry: response = web.get(session, Constants.NEO_TDMBGPOP) postFields = {"talkto": "1"} source = web.post(session, Constants.NEO_TDMBGPOP, postFields, Constants.NEO_TDMBGPOP) print("Visited TDMBGPOP") times[key] = timestamp.endOfDay() file = open(r'times.pkl', 'wb') pickle.dump(times, file) file.close()
def collectInterest(session, times): key = "interest" timeExpiry = times.get(key) if timeExpiry == None or time.time() > timeExpiry: #Future edit check if interest has been collected #Return interest collected web.get(session, Constants.NEO_BANK, Constants.NEO_HOMEPAGE) #send POST to collect interest postFields = {"type": "interest"} web.post(session, Constants.NEO_BANK_INTEREST, postFields, Constants.NEO_BANK) print("Bank interest collected :)") times[key] = timestamp.endOfDay() file = open('times.pkl', 'wb') pickle.dump(times, file) file.close()
def adventCalendar(session): global times december = 12 # Only execute if we're in the month of december if int(time.strftime("%m")) == december: key = "advent" timeExpiry = times.get(key) if timeExpiry == None or time.time() > timeExpiry: response = web.get(session, Constants.NEO_ADVENT_CALENDAR) web.post(session, Constants.NEO_PROCESS_ADVENT, {}, Constants.NEO_ADVENT_CALENDAR) print("Collected Advent Calendar") times[key] = timestamp.endOfDay() file = open('times.pkl', 'wb') pickle.dump(times, file) file.close()
def tombola(session): key = "tombola" file = open(r'times.pkl', 'rb') times = pickle.load(file) file.close() timeExpiry = times.get(key) if timeExpiry == None or time.time() > timeExpiry: response = web.get(session, Constants.NEO_TOMBOLA) postFields = {} source = web.post(session, Constants.NEO_TOMBOLA_PLAY, postFields, Constants.NEO_TOMBOLA) print("Played Tombola") times[key] = timestamp.endOfDay() file = open(r'times.pkl', 'wb') pickle.dump(times, file) file.close()