RESET.py 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. # ---------------------------------------------------------------------
  2. # neobots 1.0.5 -------------------------------------------------------
  3. # Made by txtsd -------------------------------------------------------
  4. # Based on raredaredevil's/DarkByte's HabiBot/NeoAuto -----------------
  5. # Open Source Neopets Automation --------------------------------------
  6. # ---------------------------------------------------------------------
  7. # Imports -------------------------------------------------------------
  8. import urllib2
  9. import sys
  10. import pyamf
  11. import time
  12. from pyamf.remoting.client import RemotingService
  13. from classes.NeoAccount import NeoAccount
  14. # End Imports ---------------------------------------------------------
  15. debugmode = 1
  16. # Settings ------------------------------------------------------------
  17. neouser = "" # Neopets Username
  18. neopass = "" # Neopets Password
  19. proxyaddress = "" # Optional proxy eg. "127.0.0.1:8888", leave at "" for none
  20. # ---------------------------------------------------------------------
  21. if debugmode == 0:
  22. if len(sys.argv) == 4:
  23. neouser = sys.argv[1] # Get args from commandline
  24. neopass = sys.argv[2] # Get args from commandline
  25. proxyaddress = sys.argv[3] # Get args from commandline
  26. elif len(sys.argv) == 3:
  27. neouser = sys.argv[1] # Get args from commandline
  28. neopass = sys.argv[2] # Get args from commandline
  29. else:
  30. print "Debug mode was turned off, but incorrect args sent, so fell back to debug mode."
  31. acc = NeoAccount(neouser, neopass, proxyaddress)
  32. acc.login()
  33. habiopener = urllib2.build_opener(urllib2.HTTPCookieProcessor(acc.session.cookies))
  34. if proxyaddress != "":
  35. habiopener.setproxy = proxyaddress
  36. lastlogintime = time.time()
  37. pyamfhandler = RemotingService(
  38. 'http://habitarium.neopets.com/amfphp/gateway.php',
  39. amf_version=pyamf.AMF3,
  40. user_agent="Mozilla/5.0 (Windows NT 6.0; WOW64; rv:24.0) Gecko/20100101 Firefox/24.0",
  41. opener=habiopener.open)
  42. try:
  43. player_service = pyamfhandler.getService('PlayerService')
  44. inventory_service = pyamfhandler.getService('InventoryService')
  45. itembag = inventory_service.itemBag()
  46. for x in itembag:
  47. inventory_service.deleteItem(str(x[1]['m_id']))
  48. print "Deleted item"
  49. print "Resetting player"
  50. player_service.reset()
  51. print "Player has been reset"
  52. print "You may now run client.py as usual"
  53. except:
  54. print "Something went wrong. Run this program again."
  55. print "If it doesn't work at all, contact txtsd"