gatherbond_client.py 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. #!/usr/bin/env python3
  2. # ---------------------------------------------------------------------
  3. # ------------------------- Plight Rising -----------------------------
  4. # -----------------------------txtsd-----------------------------------
  5. # ---------------------------------------------------------------------
  6. """Runs the bot"""
  7. # Imports -------------------------------------------------------------
  8. import os
  9. import sys
  10. import time
  11. import random
  12. import datetime
  13. from pytz import timezone
  14. from configobj import ConfigObj
  15. from classes.FRAccount import FRAccount
  16. from classes.Familiar import Familiar
  17. from classes.Gather import Gather
  18. from classes.Coliseum import Coliseum
  19. # End Imports ---------------------------------------------------------
  20. config = ConfigObj('config.ini')
  21. if config['account']['username'] or (not config['account']['username'] == 'herp' and config['account']['password'] == 'derp'):
  22. fruser = config['account']['username']
  23. frpass = config['account']['password']
  24. proxyaddress = config['account']['proxy']
  25. gather = True
  26. bond = True
  27. coli = False
  28. start = datetime.time(23, 58)
  29. end = datetime.time(0, 32)
  30. pst = timezone('US/Pacific')
  31. acc = FRAccount(fruser, frpass, proxyaddress)
  32. if not (start < datetime.datetime.now(tz=pst).time() or datetime.datetime.now(tz=pst).time() < end):
  33. if acc.login():
  34. gHandler = Gather(acc)
  35. fHandler = Familiar(acc)
  36. if gather:
  37. gHandler.gather()
  38. if bond:
  39. fHandler.bond()
  40. if coli:
  41. try:
  42. cHandler = None
  43. cHandler = Coliseum()
  44. cHandler.play(acc)
  45. except Exception as e:
  46. # pass
  47. # e = sys.exc_info()[0]
  48. print("clientderp")
  49. print(type(e))
  50. print(e.args)
  51. print(e)
  52. except KeyboardInterrupt:
  53. sys.exit()
  54. # finally:
  55. # # del cHandler
  56. # time.sleep(random.randint(1, 2))
  57. # # acc.login()
  58. else:
  59. if os.path.isfile(fruser + '.bin'):
  60. os.remove(fruser + '.bin')
  61. time.sleep(10)
  62. else:
  63. print('Please set up your username and password, among other things, in config.ini')
  64. sys.exit()