Coder Social home page Coder Social logo

pokemon-go-controller's Introduction

Pokemon-Go-Controller

Alt text Alt text

iOS device as game controller

Alt text
Clone this xcode project and run on your iphone / ipad, this app actually perform a web server that tells your chosen location, your location will be wherever the poke ball is, so you may drag the map of press the buttons.

{"lng":"114.132530212402","lat":"22.3636264801025"}

This is what the app response via port 80 by http, so be sure to connect the iphone / ipad to your wifi network in order to gain access.

Get controller message

import xml.etree.cElementTree as ET
import urllib2
import json

lastLat = ""
lastLng = ""

def getPokemonLocation():
	try:
		response = urllib2.urlopen("http://your controller's ip/", timeout = 1)
		return json.load(response)
	except urllib2.URLError as e:
		print e.reason

def generateXML():
	global lastLat, lastLng
	geo = getPokemonLocation()
	if geo != None:
		if geo["lat"] != lastLat or geo["lng"] != lastLng:
			lastLat = geo["lat"]
			lastLng = geo["lng"]
			gpx = ET.Element("gpx", version="1.1", creator="Xcode")
			wpt = ET.SubElement(gpx, "wpt", lat=geo["lat"], lon=geo["lng"])
			ET.SubElement(wpt, "name").text = "PokemonLocation"
			ET.ElementTree(gpx).write("somewhere.gpx")
			print "Location Updated!", "latitude:", geo["lat"], "longitude:" ,geo["lng"]

def start():
	while True:
		generateXML()

start()

Edit readAndChangeXML.py ,change the urlopen address to your controller's ip and write to somewhere your gpx file you want to put. Be sure you remember where the gpx you put :)

Alt text
If running normal, at console you should see something like this when your drag the map or press the buttons on your game controller.

Simulate location to target device

Alt text
Create a blank single page app with your Xcode. Remember where you put the gpx file? Import the gpx file to your project without copying it, just referencing.

Alt text
Run this project on your iOS device that will actually run the Pokemon Go game, when running, at Xcode you will see a button to simulate location, so you see the option of your gpx file. Our next step is to constantly press this two buttons to simulate your location constantly and automatically.

http://stackoverflow.com/questions/4230867/how-do-i-simulate-a-mouse-click-through-the-mac-terminal/26687223
By this, we can simulate a / some / lot of click(s) programmatically

gcc -o autoClicker autoClicker.m -framework ApplicationServices -framework Foundation

compile the autoClicker.m with gcc at terminal.

import os
import urllib2
import json
import time

def checkConnected():
	try:
		response = urllib2.urlopen("http://your controller's ip/", timeout = 1)
		return json.load(response)
	except urllib2.URLError as e:
		print e.reason

def clickAction():
	os.system("./autoClicker -x 750 -y 400")
	os.system("./autoClicker -x 750 -y 450")
	time.sleep(1)
	print "clicking!!"

def start():
	while True:
		if checkConnected() != None:
			clickAction()

start()

So change the x,y location of your xcode's simulate button. LOL don't ask me your x,y, find it and test it by yourself, to have it easy when adjusting your x,y, you may set the sleep time longer among loops :) more tip: the loop will stop if you close the game controller as it looks for the active state on game controller, so please change the urlopen address here too with your game controller's ip.

Overall flow

  1. you provide location data on game controller
  2. receive it and generate gpx file constantly when you move
  3. blank project referencing the gpx and simulate on your playing device
  4. auto click the xcode buttons constantly

Have Fun!

Alt text

pokemon-go-controller's People

Contributors

ashton-w avatar kahopoon avatar onedevelopertwo avatar pawin avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

pokemon-go-controller's Issues

The blank app dies without any error

Hi,

The blank app dies without any obivous reason on Xcode saying "Finished running Pokemon-Go-Handler on iPhone 6~" The app doesn't seem to crash if I don't run Pokemon Go game application on the iPhone. Do you have any idea to solve this issue?

FYI, I'm using Xcode 7.3.1 with iPhone 6s (iOS 9.3.2)

No Such module 'GCDWebServer'

Just fwi sorry, I'm not a developer by any means.

I'm trying to run the PokemonController and came across an error (No Such modile 'GCDWebServer')
Really confused as to what this is, help?

time out

Another issue I noticed while playing was the timed out errors that interfere with the auto-click process when I stop manipulating location to catch a Pokémon or for gym fights..

'CGPostMouseEvent' is deprecated

running on macOS Sierra got this warning: 'CGPostMouseEvent' is deprecated: first deprecated
in OS X 10.6 [-Wdeprecated-declarations]

.

.

How not to exit the blank app in the background mode?

I will transform it to use Google Maps and Javascript, click on the map in a browser, and then output to a coordinate in json, readAndChangeXML.py get lat and lng, and then write gpx file and simulate a click.
The question now is: for the newly created position of analog blank app in debug mode, you will be logged out after a period of operation, and thus invalid. Is there any good way to keep it not to quit?

.

.

error

process launch failed: No such file or directory (/private/var/containers/Bundle/Application/E862A65E-D6FD-4D83-A5E9-7970C594C344/PokemonController.app)

also how do you direct this app to wright to my GPX file i have created?

Springing back to real location

Hi all,

First, I really have to say that I love the work that kahopoon did with this. It's fantastic and really does work well. I'm not a programmer or developer and it took me most of the night to figure this out but after reading the instructions and using some logic, I was able to get it all to work. I do have one little problem though: after a little while, I'll rubber band back to my real world location.

After getting it set up last night I decided to do a couple of test runs. I went down my neighborhood and towards the main street where I live. Crossed it and went over to the local high school, always tapping slowly to simulate walking (just in case). I had a good 15-20 minutes over by my old high school collecting from the multiple pokestops there and had no issues capturing Pokemons. After the 15-20 minutes, I suddenly get snapped back to my real location. I would shut it down at that point and wait a while before trying again.

Second attempt was similar but this time I went north towards a nearby park and after about 10 or 15 minutes, it happened again - I snapped back to my real location. No error messages and console was still reporting the lat/long from the park as I moved through it on the controller but on my phone, it wasn't receiving it.

Any idea what could be happening? Does the blank app on the gaming device time out or is there a setting I'm not turning on/off so that my gps doesn't re-assert itself?

Multiplatform?

Is there any way to make it run on Linux or Win OS? Since you have used Python, is there any way to run it without Xcode or outside iOS?

I am willing to help with that maybe.

timeout when running .py script

When I run the script after running the controller, my terminal keeps looping through "timeout" and no gpx file is generated. I'm using the ip address generated in the console of xcode when I run controller. I also tried running it without xcode and I still get a timeout. What does this mean?

Building error

I'm a noob. when i try to build this app i get this error... can you please help?

Check dependencies

Code Sign error: No matching provisioning profile found: Your build settings specify a provisioning profile with the UUID “net.kahopoon.PokemonController”, however, no such provisioning profile was found.

readAndChangeXML.py and Python error?

Hello. I'm new to using a mac and Python. My first issue was wtf is python, I google'd and quickly solved that. Opened terminal, changed directories to where my pokemon file was, and then i entered 'python readAndChangeXML.py' in the terminal and there's an issue that I'm not too sure how to solve..? If anyone could help, that'd be great, otherwise i'll just theorycraft some more x.x

Traceback (most recent call last):
File "readAndChangeXML.py", line 32, in
start()
File "readAndChangeXML.py", line 30, in start
generateXML()
File "readAndChangeXML.py", line 17, in generateXML
geo = getPokemonLocation()
File "readAndChangeXML.py", line 11, in getPokemonLocation
return json.load(response)
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/json/init.py", line 291, in load
**kw)
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/json/init.py", line 339, in loads
return _default_decoder.decode(s)
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/json/decoder.py", line 364, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/json/decoder.py", line 382, in raw_decode
raise ValueError("No JSON object could be decoded")
ValueError: No JSON object could be decoded

Make a video

Would someone like to make a YouTube video on how to do this step by step as most people trying to do this are noobs.... Thanks

Build succeeded but nothing in my device.

img

I am not a IOS developer,I have built this APP succeeded in Xcode, but there is nothing be found in my device.

Is that I did something wrong ? Can somebody point it out ? Thanks

autoclicking prevents users from using the simulator

You could instead add an applescript, which calls the menu item:

tell application "System Events" to tell process "Xcode"
    click menu item "pokemonLocation" of menu 1 of menu item "Simulate Location" of menu 1 of menu bar item "Debug" of menu bar 1
end tell

Currently I am running this thingy when the gpx file changes via nodemon:
nodemon -e gpx --exec osascript setlocation.applescript

This works better than the current solution.

Every Pokemon keep escaping from captures

I've been using this project to change my location from China to Sydney and New York catching pokemons. But after 2 days hard work and 100+ pokemons collection, it seems that I can't catch any more pokemons. Everytime I throw a pokeball to a pokemon, even those easiest ones, they escape at once.
I found a similar situation from http://gaming.stackexchange.com/questions/274044/why-do-pok%C3%A9mon-keep-escaping-from-captures .
Dose anyone else have same situation here? Or dose anyone know why this happens and what can I do?

Unable to parse GPX file

I was able to get everything working as expected but got this error after about a minute of location manipulation. Maybe it's because of changing the location too fast...

[Errno 61] Connection refused

Hey, thanks for this repo!

I'm trying to get the data from controller app, everything runs well, but whenever I run the py script to write the gpx file, I got this error [Errno 61] Connection refused. However, when I type the ip address into safari, I can see the response. Not sure what's going on in there. Let me know if you have any ideas about how to fix that, thanks.

Does autoclick script work when running the controller on simulator?

I successfully run the controller on the simulator cuz I have only one ios device, but have to manually refresh the simulated location in Xcode by several clicks.
I just wonder whether the autoclick script still works when running the controller on simulator cuz I have to click direction arrows to make movements.
(Haven't tried that yet cuz it takes time to adjust x,y)

[Errno 61] Connection refused

@kahopoon When you talk about your controller's ip. Is it the ipad controller in the gif ip? Or would it be the ip of computer which the xcode is running on? I tried both laptop and ipad ip and I keep getting refused connection. Thanks
Is there a specific environment setting that you did to enable to connection?

When I run the python script. It keeps giving me the following error:

[Errno 61] Connection refused

But when I try to use your ip 172.16.255.195. It shows it as timeout.

Catching Pokemon becomes impossible after using the controller for some time

It seems to me, that after some time jetting around the world to "see other places", I cannot catch Pokemon anymore.

Each and every Pokemon you try to catch escapes you ball and runs away. Every single time.

Until this is further investigated, I would refrain from using the controller.

I hope that by tomorrow I will be able to play again.

generateXML can't update the gpx file

First of all thank you for sharing the code!
I found that I can't update the pokemonLocation.gpx file while running the generateXML function. Any idea what's happening there?
Thank you!

Support for Xcode 8

I believe that majority of the users who would use this git are running iOS 10 either the Developer Preview or Public Beta. Support for Xcode 8 - Beta is essential to support the disk image of these devices.

GPX File

I'm not quite sure what needs to be in the GPX file, are we supposed to put

"{"lng":"114.132530212402","lat":"22.3636264801025"}" This inside, or make a new .gpx somehow?

User-friendly installation

It is very cool! Is it possible to make a user-friendly installation method for non-programmer users? I think, it can broaden the user audience.

Reverting back to true location

This is not the same issue as "Springing back to true location".

I wand my phone to use my actual location so I can still play the game as intended. However, I deleted the "PokemonHandler" from my phone and my phone still thinks I am in the middle of nowhere (the same initial location on the controller).

Any suggestions on how to fix my Location issues?

Use applescript instead of autoclicker

The following will tell xCode to update the location without hijacking the mouse:

repeat while true

    tell application "System Events" to tell process "Xcode"
        click menu item "pokemonLocation" of menu 1 of menu item "Simulate Location" of menu 1 of menu bar item "Debug" of menu bar 1

    end tell

end repeat

Just open with script editor and run :)

GCDWebServer

Working through the process:

Currently getting a Swift Complier Error - No such module "GCDWebServer" ViewController.swift

Launched from PokemonController.xcodeporj

Set IP for readAndChangeXML.py

GCDWebServer.framework has been added to Linked Frameworks and Libraries.

Not sure what else I am missing or what else I need to do. Just trying to get this going :D Thanks for the help

Android Version?

Hey there good work, it looks great! However there is just one problem; is there any way to set this up on android?

autoClicker.m error

I'm trying to compile the autoclicker.m file in terminal and when I type "gcc -o autoClicker autoClicker.m -framework ApplicationServices -framework Foundation" everything runs smoothly until I get an error,

clang: error: no such file or directory: 'autoClicker.m'

Help?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.