init-commit2
7
.gitignore
vendored
Normal file
@ -0,0 +1,7 @@
|
||||
.idea/
|
||||
.git/
|
||||
__pycache__/
|
||||
log/
|
||||
temp/
|
||||
template_folder/
|
||||
checkpoint
|
@ -1,2 +1,2 @@
|
||||
# fishyboteso
|
||||
Fishing bot for Elder Scrolls Online
|
||||
Fishing bot for Elder Scrolls Online made using tensorflow and python
|
9
android/Fishy/.gitignore
vendored
Normal file
@ -0,0 +1,9 @@
|
||||
*.iml
|
||||
.gradle
|
||||
/local.properties
|
||||
/.idea/workspace.xml
|
||||
/.idea/libraries
|
||||
.DS_Store
|
||||
/build
|
||||
/captures
|
||||
.externalNativeBuild
|
1
android/Fishy/app/.gitignore
vendored
Normal file
@ -0,0 +1 @@
|
||||
/build
|
29
android/Fishy/app/build.gradle
Normal file
@ -0,0 +1,29 @@
|
||||
apply plugin: 'com.android.application'
|
||||
|
||||
android {
|
||||
compileSdkVersion 25
|
||||
buildToolsVersion "25.0.1"
|
||||
defaultConfig {
|
||||
applicationId "in.definex.fishy"
|
||||
minSdkVersion 16
|
||||
targetSdkVersion 25
|
||||
versionCode 1
|
||||
versionName "1.0"
|
||||
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
|
||||
}
|
||||
buildTypes {
|
||||
release {
|
||||
minifyEnabled false
|
||||
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
dependencies {
|
||||
compile fileTree(dir: 'libs', include: ['*.jar'])
|
||||
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
|
||||
exclude group: 'com.android.support', module: 'support-annotations'
|
||||
})
|
||||
compile 'com.android.support:appcompat-v7:25.0.1'
|
||||
testCompile 'junit:junit:4.12'
|
||||
}
|
17
android/Fishy/app/proguard-rules.pro
vendored
Normal file
@ -0,0 +1,17 @@
|
||||
# Add project specific ProGuard rules here.
|
||||
# By default, the flags in this file are appended to flags specified
|
||||
# in C:\Users\adam_\AppData\Local\Android\Sdk/tools/proguard/proguard-android.txt
|
||||
# You can edit the include path and order by changing the proguardFiles
|
||||
# directive in build.gradle.
|
||||
#
|
||||
# For more details, see
|
||||
# http://developer.android.com/guide/developing/tools/proguard.html
|
||||
|
||||
# Add any project specific keep options here:
|
||||
|
||||
# If your project uses WebView with JS, uncomment the following
|
||||
# and specify the fully qualified class name to the JavaScript interface
|
||||
# class:
|
||||
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
|
||||
# public *;
|
||||
#}
|
@ -0,0 +1,26 @@
|
||||
package in.definex.fishy;
|
||||
|
||||
import android.content.Context;
|
||||
import android.support.test.InstrumentationRegistry;
|
||||
import android.support.test.runner.AndroidJUnit4;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
/**
|
||||
* Instrumentation test, which will execute on an Android device.
|
||||
*
|
||||
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
|
||||
*/
|
||||
@RunWith(AndroidJUnit4.class)
|
||||
public class ExampleInstrumentedTest {
|
||||
@Test
|
||||
public void useAppContext() throws Exception {
|
||||
// Context of the app under test.
|
||||
Context appContext = InstrumentationRegistry.getTargetContext();
|
||||
|
||||
assertEquals("in.definex.fishy", appContext.getPackageName());
|
||||
}
|
||||
}
|
26
android/Fishy/app/src/main/AndroidManifest.xml
Normal file
@ -0,0 +1,26 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
package="in.definex.fishy">
|
||||
|
||||
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
|
||||
<uses-permission android:name="android.permission.INTERNET"> </uses-permission>
|
||||
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"> </uses-permission>
|
||||
<uses-permission android:name="android.permission.VIBRATE" />
|
||||
|
||||
<application
|
||||
android:allowBackup="true"
|
||||
android:icon="@mipmap/ic_launcher"
|
||||
android:label="@string/app_name"
|
||||
android:supportsRtl="true"
|
||||
android:theme="@style/AppTheme">
|
||||
<activity android:name=".MainActivity">
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN" />
|
||||
|
||||
<category android:name="android.intent.category.LAUNCHER" />
|
||||
</intent-filter>
|
||||
</activity>
|
||||
<service android:name=".NetworkService" />
|
||||
</application>
|
||||
|
||||
</manifest>
|
@ -0,0 +1,86 @@
|
||||
package in.definex.fishy;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.SharedPreferences;
|
||||
import android.net.wifi.WifiManager;
|
||||
import android.support.v7.app.AppCompatActivity;
|
||||
import android.os.Bundle;
|
||||
import android.text.format.Formatter;
|
||||
import android.view.View;
|
||||
import android.widget.Button;
|
||||
import android.widget.EditText;
|
||||
import android.widget.TextView;
|
||||
|
||||
import org.w3c.dom.Text;
|
||||
|
||||
public class MainActivity extends AppCompatActivity {
|
||||
|
||||
SharedPreferences sharedPreferences = null;
|
||||
int notifMode;
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_main);
|
||||
|
||||
final Context context = this;
|
||||
|
||||
sharedPreferences = getSharedPreferences("config",Context.MODE_PRIVATE);
|
||||
|
||||
notifMode = sharedPreferences.getInt("notifMode",0);
|
||||
|
||||
final Button notifButton = (Button)findViewById(R.id.notifMode);
|
||||
|
||||
changeButtonText(notifMode, notifButton);
|
||||
notifButton.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
notifMode = notifMode == 0?1:0;
|
||||
sharedPreferences.edit().putInt("notifMode",notifMode).apply();
|
||||
changeButtonText(notifMode, notifButton);
|
||||
}
|
||||
});
|
||||
|
||||
final Button button = (Button)findViewById(R.id.button);
|
||||
//final EditText editText = (EditText)findViewById(R.id.ipAddress);
|
||||
|
||||
WifiManager wm = (WifiManager) getSystemService(WIFI_SERVICE);
|
||||
final String ip = Formatter.formatIpAddress(wm.getConnectionInfo().getIpAddress());
|
||||
((TextView)findViewById(R.id.ipAddress)).setText("IP: "+ip);
|
||||
|
||||
//startService(new Intent(context, NetworkService.class));
|
||||
button.setOnClickListener(new View.OnClickListener() {
|
||||
boolean serviceOn = false;
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
|
||||
if(!serviceOn){
|
||||
button.setText("Stop Service");
|
||||
startService(new Intent(context, NetworkService.class));
|
||||
serviceOn = true;
|
||||
}else{
|
||||
button.setText("Start Service");
|
||||
stopService(new Intent(context, NetworkService.class));
|
||||
serviceOn = false;
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
|
||||
private void changeButtonText(int notifMode, Button button){
|
||||
switch (notifMode){
|
||||
case 0:
|
||||
button.setText("Notification Mode");
|
||||
break;
|
||||
|
||||
case 1:
|
||||
button.setText("Toast Mode");
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,179 @@
|
||||
package in.definex.fishy;
|
||||
|
||||
import android.app.Application;
|
||||
import android.app.IntentService;
|
||||
import android.app.Notification;
|
||||
import android.app.NotificationManager;
|
||||
import android.app.PendingIntent;
|
||||
import android.app.TaskStackBuilder;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.os.Build;
|
||||
import android.os.Handler;
|
||||
import android.os.Looper;
|
||||
import android.support.annotation.RequiresApi;
|
||||
import android.support.v7.app.NotificationCompat;
|
||||
import android.widget.Toast;
|
||||
|
||||
import org.json.JSONException;
|
||||
import org.json.JSONObject;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.DataInput;
|
||||
import java.io.DataInputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.InputStreamReader;
|
||||
import java.net.DatagramPacket;
|
||||
import java.net.DatagramSocket;
|
||||
import java.net.InetAddress;
|
||||
import java.net.ServerSocket;
|
||||
import java.net.Socket;
|
||||
import java.net.SocketException;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
|
||||
/**
|
||||
* Created by adam_ on 13-07-2017.
|
||||
*/
|
||||
|
||||
public class NetworkService extends IntentService {
|
||||
|
||||
private int port = 8023;
|
||||
String ip;
|
||||
|
||||
/**
|
||||
* A constructor is required, and must call the super IntentService(String)
|
||||
* constructor with a name for the worker thread.
|
||||
*/
|
||||
public NetworkService() {
|
||||
super("NetworkService");
|
||||
|
||||
}
|
||||
|
||||
Handler handler;
|
||||
|
||||
String jsonString;
|
||||
Context context;
|
||||
JSONObject jsonObject;
|
||||
ServerSocket serverSocket = null;
|
||||
Socket server = null;
|
||||
|
||||
boolean serviceIsOn;
|
||||
|
||||
@RequiresApi(api = Build.VERSION_CODES.KITKAT)
|
||||
@Override
|
||||
protected void onHandleIntent(Intent intent) {
|
||||
|
||||
context = this;
|
||||
ip = intent.getStringExtra("ip");
|
||||
handler = new Handler(Looper.getMainLooper());
|
||||
BufferedReader in = null;
|
||||
try {
|
||||
serverSocket = new ServerSocket(port);
|
||||
serverSocket.setSoTimeout(10000);
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
serviceIsOn = true;
|
||||
|
||||
while(serviceIsOn){
|
||||
try{
|
||||
server = serverSocket.accept();
|
||||
in = new BufferedReader(new InputStreamReader(server.getInputStream(), "UTF-8"));
|
||||
|
||||
jsonString = "";
|
||||
String line;
|
||||
while ((line = in.readLine()) != null) {
|
||||
jsonString+=line;
|
||||
}
|
||||
|
||||
System.out.println("RECEIVED: " + jsonString);
|
||||
|
||||
jsonObject = new JSONObject(jsonString);
|
||||
|
||||
String action = jsonObject.getString("action");
|
||||
|
||||
switch (action){
|
||||
case "holeDeplete":
|
||||
String message = "Hole has been depleted!";
|
||||
String subMessage = jsonObject.getInt("fishCount") + " Fishes Caught";
|
||||
toast(message, subMessage);
|
||||
break;
|
||||
}
|
||||
|
||||
System.out.println("yoooooo");
|
||||
|
||||
|
||||
server.close();
|
||||
} catch (SocketException e){
|
||||
System.out.println(e);
|
||||
} catch (IOException | JSONException e) {
|
||||
System.out.println(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDestroy() {
|
||||
|
||||
try {
|
||||
serviceIsOn = false;
|
||||
serverSocket.close();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
toast("Service turned off","");
|
||||
|
||||
super.onDestroy();
|
||||
}
|
||||
|
||||
private void toast(final String message, final String subMessage){
|
||||
int notifMode = getSharedPreferences("config", Context.MODE_PRIVATE).getInt("notifMode",0);
|
||||
|
||||
switch (notifMode){
|
||||
case 0:
|
||||
int mNotificationId = 8023;
|
||||
NotificationCompat.Builder mBuilder =
|
||||
(NotificationCompat.Builder) new NotificationCompat.Builder(this)
|
||||
.setSmallIcon(R.mipmap.ic_launcher)
|
||||
.setContentTitle(message)
|
||||
.setContentText(subMessage)
|
||||
.setDefaults(Notification.DEFAULT_ALL)
|
||||
.setPriority(Notification.PRIORITY_MAX);
|
||||
|
||||
Intent resultIntent = new Intent(this, MainActivity.class);
|
||||
|
||||
TaskStackBuilder stackBuilder = TaskStackBuilder.create(this);
|
||||
stackBuilder.addParentStack(MainActivity.class);
|
||||
stackBuilder.addNextIntent(resultIntent);
|
||||
PendingIntent resultPendingIntent =
|
||||
stackBuilder.getPendingIntent(
|
||||
0,
|
||||
PendingIntent.FLAG_UPDATE_CURRENT
|
||||
);
|
||||
|
||||
mBuilder.setContentIntent(resultPendingIntent);
|
||||
|
||||
NotificationManager mNotificationManager = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
|
||||
mNotificationManager.notify(mNotificationId, mBuilder.build());
|
||||
break;
|
||||
|
||||
case 1:
|
||||
handler.post(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
|
||||
String m = subMessage.isEmpty()?message:message+" ("+subMessage+")";
|
||||
|
||||
Toast.makeText(getApplicationContext(),
|
||||
m,
|
||||
Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
});
|
||||
break;
|
||||
|
||||
}
|
||||
}
|
||||
}
|
41
android/Fishy/app/src/main/res/layout/activity_main.xml
Normal file
@ -0,0 +1,41 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:id="@+id/activity_main"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:paddingBottom="@dimen/activity_vertical_margin"
|
||||
android:paddingLeft="@dimen/activity_horizontal_margin"
|
||||
android:paddingRight="@dimen/activity_horizontal_margin"
|
||||
android:paddingTop="@dimen/activity_vertical_margin"
|
||||
tools:context="in.definex.fishy.MainActivity">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_centerInParent="true"
|
||||
android:orientation="vertical">
|
||||
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="ip"
|
||||
android:textAlignment="center"
|
||||
android:id="@+id/ipAddress"/>
|
||||
|
||||
<Button
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="Start Service"
|
||||
android:id="@+id/button"
|
||||
android:layout_gravity="center"/>
|
||||
|
||||
<Button
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="Notification Mode"
|
||||
android:id="@+id/notifMode"
|
||||
android:layout_gravity="center"/>
|
||||
|
||||
</LinearLayout>
|
||||
</RelativeLayout>
|
BIN
android/Fishy/app/src/main/res/mipmap-hdpi/ic_launcher.png
Normal file
After Width: | Height: | Size: 3.3 KiB |
BIN
android/Fishy/app/src/main/res/mipmap-mdpi/ic_launcher.png
Normal file
After Width: | Height: | Size: 2.2 KiB |
BIN
android/Fishy/app/src/main/res/mipmap-xhdpi/ic_launcher.png
Normal file
After Width: | Height: | Size: 4.7 KiB |
BIN
android/Fishy/app/src/main/res/mipmap-xxhdpi/ic_launcher.png
Normal file
After Width: | Height: | Size: 7.5 KiB |
BIN
android/Fishy/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
Normal file
After Width: | Height: | Size: 10 KiB |
6
android/Fishy/app/src/main/res/values-w820dp/dimens.xml
Normal file
@ -0,0 +1,6 @@
|
||||
<resources>
|
||||
<!-- Example customization of dimensions originally defined in res/values/dimens.xml
|
||||
(such as screen margins) for screens with more than 820dp of available width. This
|
||||
would include 7" and 10" devices in landscape (~960dp and ~1280dp respectively). -->
|
||||
<dimen name="activity_horizontal_margin">64dp</dimen>
|
||||
</resources>
|
6
android/Fishy/app/src/main/res/values/colors.xml
Normal file
@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<color name="colorPrimary">#3F51B5</color>
|
||||
<color name="colorPrimaryDark">#303F9F</color>
|
||||
<color name="colorAccent">#FF4081</color>
|
||||
</resources>
|
5
android/Fishy/app/src/main/res/values/dimens.xml
Normal file
@ -0,0 +1,5 @@
|
||||
<resources>
|
||||
<!-- Default screen margins, per the Android Design guidelines. -->
|
||||
<dimen name="activity_horizontal_margin">16dp</dimen>
|
||||
<dimen name="activity_vertical_margin">16dp</dimen>
|
||||
</resources>
|
3
android/Fishy/app/src/main/res/values/strings.xml
Normal file
@ -0,0 +1,3 @@
|
||||
<resources>
|
||||
<string name="app_name">Fishy</string>
|
||||
</resources>
|
11
android/Fishy/app/src/main/res/values/styles.xml
Normal file
@ -0,0 +1,11 @@
|
||||
<resources>
|
||||
|
||||
<!-- Base application theme. -->
|
||||
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
|
||||
<!-- Customize your theme here. -->
|
||||
<item name="colorPrimary">@color/colorPrimary</item>
|
||||
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
|
||||
<item name="colorAccent">@color/colorAccent</item>
|
||||
</style>
|
||||
|
||||
</resources>
|
@ -0,0 +1,17 @@
|
||||
package in.definex.fishy;
|
||||
|
||||
import org.junit.Test;
|
||||
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
/**
|
||||
* Example local unit test, which will execute on the development machine (host).
|
||||
*
|
||||
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
|
||||
*/
|
||||
public class ExampleUnitTest {
|
||||
@Test
|
||||
public void addition_isCorrect() throws Exception {
|
||||
assertEquals(4, 2 + 2);
|
||||
}
|
||||
}
|
23
android/Fishy/build.gradle
Normal file
@ -0,0 +1,23 @@
|
||||
// Top-level build file where you can add configuration options common to all sub-projects/modules.
|
||||
|
||||
buildscript {
|
||||
repositories {
|
||||
jcenter()
|
||||
}
|
||||
dependencies {
|
||||
classpath 'com.android.tools.build:gradle:2.2.2'
|
||||
|
||||
// NOTE: Do not place your application dependencies here; they belong
|
||||
// in the individual module build.gradle files
|
||||
}
|
||||
}
|
||||
|
||||
allprojects {
|
||||
repositories {
|
||||
jcenter()
|
||||
}
|
||||
}
|
||||
|
||||
task clean(type: Delete) {
|
||||
delete rootProject.buildDir
|
||||
}
|
17
android/Fishy/gradle.properties
Normal file
@ -0,0 +1,17 @@
|
||||
# Project-wide Gradle settings.
|
||||
|
||||
# IDE (e.g. Android Studio) users:
|
||||
# Gradle settings configured through the IDE *will override*
|
||||
# any settings specified in this file.
|
||||
|
||||
# For more details on how to configure your build environment visit
|
||||
# http://www.gradle.org/docs/current/userguide/build_environment.html
|
||||
|
||||
# Specifies the JVM arguments used for the daemon process.
|
||||
# The setting is particularly useful for tweaking memory settings.
|
||||
org.gradle.jvmargs=-Xmx1536m
|
||||
|
||||
# When configured, Gradle will run in incubating parallel mode.
|
||||
# This option should only be used with decoupled projects. More details, visit
|
||||
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
|
||||
# org.gradle.parallel=true
|
BIN
android/Fishy/gradle/wrapper/gradle-wrapper.jar
vendored
Normal file
6
android/Fishy/gradle/wrapper/gradle-wrapper.properties
vendored
Normal file
@ -0,0 +1,6 @@
|
||||
#Mon Dec 28 10:00:20 PST 2015
|
||||
distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
zipStorePath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-2.14.1-all.zip
|
160
android/Fishy/gradlew
vendored
Normal file
@ -0,0 +1,160 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
##############################################################################
|
||||
##
|
||||
## Gradle start up script for UN*X
|
||||
##
|
||||
##############################################################################
|
||||
|
||||
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||
DEFAULT_JVM_OPTS=""
|
||||
|
||||
APP_NAME="Gradle"
|
||||
APP_BASE_NAME=`basename "$0"`
|
||||
|
||||
# Use the maximum available, or set MAX_FD != -1 to use that value.
|
||||
MAX_FD="maximum"
|
||||
|
||||
warn ( ) {
|
||||
echo "$*"
|
||||
}
|
||||
|
||||
die ( ) {
|
||||
echo
|
||||
echo "$*"
|
||||
echo
|
||||
exit 1
|
||||
}
|
||||
|
||||
# OS specific support (must be 'true' or 'false').
|
||||
cygwin=false
|
||||
msys=false
|
||||
darwin=false
|
||||
case "`uname`" in
|
||||
CYGWIN* )
|
||||
cygwin=true
|
||||
;;
|
||||
Darwin* )
|
||||
darwin=true
|
||||
;;
|
||||
MINGW* )
|
||||
msys=true
|
||||
;;
|
||||
esac
|
||||
|
||||
# Attempt to set APP_HOME
|
||||
# Resolve links: $0 may be a link
|
||||
PRG="$0"
|
||||
# Need this for relative symlinks.
|
||||
while [ -h "$PRG" ] ; do
|
||||
ls=`ls -ld "$PRG"`
|
||||
link=`expr "$ls" : '.*-> \(.*\)$'`
|
||||
if expr "$link" : '/.*' > /dev/null; then
|
||||
PRG="$link"
|
||||
else
|
||||
PRG=`dirname "$PRG"`"/$link"
|
||||
fi
|
||||
done
|
||||
SAVED="`pwd`"
|
||||
cd "`dirname \"$PRG\"`/" >/dev/null
|
||||
APP_HOME="`pwd -P`"
|
||||
cd "$SAVED" >/dev/null
|
||||
|
||||
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
|
||||
|
||||
# Determine the Java command to use to start the JVM.
|
||||
if [ -n "$JAVA_HOME" ] ; then
|
||||
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
|
||||
# IBM's JDK on AIX uses strange locations for the executables
|
||||
JAVACMD="$JAVA_HOME/jre/sh/java"
|
||||
else
|
||||
JAVACMD="$JAVA_HOME/bin/java"
|
||||
fi
|
||||
if [ ! -x "$JAVACMD" ] ; then
|
||||
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
|
||||
|
||||
Please set the JAVA_HOME variable in your environment to match the
|
||||
location of your Java installation."
|
||||
fi
|
||||
else
|
||||
JAVACMD="java"
|
||||
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
||||
|
||||
Please set the JAVA_HOME variable in your environment to match the
|
||||
location of your Java installation."
|
||||
fi
|
||||
|
||||
# Increase the maximum file descriptors if we can.
|
||||
if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then
|
||||
MAX_FD_LIMIT=`ulimit -H -n`
|
||||
if [ $? -eq 0 ] ; then
|
||||
if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
|
||||
MAX_FD="$MAX_FD_LIMIT"
|
||||
fi
|
||||
ulimit -n $MAX_FD
|
||||
if [ $? -ne 0 ] ; then
|
||||
warn "Could not set maximum file descriptor limit: $MAX_FD"
|
||||
fi
|
||||
else
|
||||
warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
|
||||
fi
|
||||
fi
|
||||
|
||||
# For Darwin, add options to specify how the application appears in the dock
|
||||
if $darwin; then
|
||||
GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
|
||||
fi
|
||||
|
||||
# For Cygwin, switch paths to Windows format before running java
|
||||
if $cygwin ; then
|
||||
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
|
||||
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
|
||||
JAVACMD=`cygpath --unix "$JAVACMD"`
|
||||
|
||||
# We build the pattern for arguments to be converted via cygpath
|
||||
ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
|
||||
SEP=""
|
||||
for dir in $ROOTDIRSRAW ; do
|
||||
ROOTDIRS="$ROOTDIRS$SEP$dir"
|
||||
SEP="|"
|
||||
done
|
||||
OURCYGPATTERN="(^($ROOTDIRS))"
|
||||
# Add a user-defined pattern to the cygpath arguments
|
||||
if [ "$GRADLE_CYGPATTERN" != "" ] ; then
|
||||
OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
|
||||
fi
|
||||
# Now convert the arguments - kludge to limit ourselves to /bin/sh
|
||||
i=0
|
||||
for arg in "$@" ; do
|
||||
CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
|
||||
CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
|
||||
|
||||
if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
|
||||
eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
|
||||
else
|
||||
eval `echo args$i`="\"$arg\""
|
||||
fi
|
||||
i=$((i+1))
|
||||
done
|
||||
case $i in
|
||||
(0) set -- ;;
|
||||
(1) set -- "$args0" ;;
|
||||
(2) set -- "$args0" "$args1" ;;
|
||||
(3) set -- "$args0" "$args1" "$args2" ;;
|
||||
(4) set -- "$args0" "$args1" "$args2" "$args3" ;;
|
||||
(5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
|
||||
(6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
|
||||
(7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
|
||||
(8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
|
||||
(9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
|
||||
esac
|
||||
fi
|
||||
|
||||
# Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules
|
||||
function splitJvmOpts() {
|
||||
JVM_OPTS=("$@")
|
||||
}
|
||||
eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS
|
||||
JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME"
|
||||
|
||||
exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@"
|
90
android/Fishy/gradlew.bat
vendored
Normal file
@ -0,0 +1,90 @@
|
||||
@if "%DEBUG%" == "" @echo off
|
||||
@rem ##########################################################################
|
||||
@rem
|
||||
@rem Gradle startup script for Windows
|
||||
@rem
|
||||
@rem ##########################################################################
|
||||
|
||||
@rem Set local scope for the variables with windows NT shell
|
||||
if "%OS%"=="Windows_NT" setlocal
|
||||
|
||||
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||
set DEFAULT_JVM_OPTS=
|
||||
|
||||
set DIRNAME=%~dp0
|
||||
if "%DIRNAME%" == "" set DIRNAME=.
|
||||
set APP_BASE_NAME=%~n0
|
||||
set APP_HOME=%DIRNAME%
|
||||
|
||||
@rem Find java.exe
|
||||
if defined JAVA_HOME goto findJavaFromJavaHome
|
||||
|
||||
set JAVA_EXE=java.exe
|
||||
%JAVA_EXE% -version >NUL 2>&1
|
||||
if "%ERRORLEVEL%" == "0" goto init
|
||||
|
||||
echo.
|
||||
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
||||
echo.
|
||||
echo Please set the JAVA_HOME variable in your environment to match the
|
||||
echo location of your Java installation.
|
||||
|
||||
goto fail
|
||||
|
||||
:findJavaFromJavaHome
|
||||
set JAVA_HOME=%JAVA_HOME:"=%
|
||||
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
|
||||
|
||||
if exist "%JAVA_EXE%" goto init
|
||||
|
||||
echo.
|
||||
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
|
||||
echo.
|
||||
echo Please set the JAVA_HOME variable in your environment to match the
|
||||
echo location of your Java installation.
|
||||
|
||||
goto fail
|
||||
|
||||
:init
|
||||
@rem Get command-line arguments, handling Windowz variants
|
||||
|
||||
if not "%OS%" == "Windows_NT" goto win9xME_args
|
||||
if "%@eval[2+2]" == "4" goto 4NT_args
|
||||
|
||||
:win9xME_args
|
||||
@rem Slurp the command line arguments.
|
||||
set CMD_LINE_ARGS=
|
||||
set _SKIP=2
|
||||
|
||||
:win9xME_args_slurp
|
||||
if "x%~1" == "x" goto execute
|
||||
|
||||
set CMD_LINE_ARGS=%*
|
||||
goto execute
|
||||
|
||||
:4NT_args
|
||||
@rem Get arguments from the 4NT Shell from JP Software
|
||||
set CMD_LINE_ARGS=%$
|
||||
|
||||
:execute
|
||||
@rem Setup the command line
|
||||
|
||||
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
|
||||
|
||||
@rem Execute Gradle
|
||||
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
|
||||
|
||||
:end
|
||||
@rem End local scope for the variables with windows NT shell
|
||||
if "%ERRORLEVEL%"=="0" goto mainEnd
|
||||
|
||||
:fail
|
||||
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
|
||||
rem the _cmd.exe /c_ return code!
|
||||
if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
|
||||
exit /b 1
|
||||
|
||||
:mainEnd
|
||||
if "%OS%"=="Windows_NT" endlocal
|
||||
|
||||
:omega
|
1
android/Fishy/settings.gradle
Normal file
@ -0,0 +1 @@
|
||||
include ':app'
|
465
fishy.py
Normal file
@ -0,0 +1,465 @@
|
||||
"""Fishy
|
||||
|
||||
Usage:
|
||||
fishy.py -h | --help
|
||||
fishy.py -v | --version
|
||||
fishy.py -c | --configwin
|
||||
fishy.py -f | --fish [--ip=IPADDRESS] [HOOKTHRESHOLD] [MINIMUMCONFIDENCE]
|
||||
fishy.py (-s | --screencapture) FOLDERNAME
|
||||
fishy.py (-l | --learn) [--load] VALAMOUNT TESTAMOUNT
|
||||
|
||||
Options:
|
||||
-h, --help Show this screen.
|
||||
-v, --version Show version and exit.
|
||||
-c, --configwin Configure the game window.
|
||||
-f, --fish Start fishing.
|
||||
-s, --screencapture Capture screen for learning.
|
||||
-l, --learn Learn and create model.
|
||||
--load Load existing model to learn new data.
|
||||
|
||||
|
||||
"""
|
||||
|
||||
VERSION = "0.0.2a 005"
|
||||
|
||||
print("Fishy "+VERSION+" for Elder Scrolls Online")
|
||||
print("Loading, Please Wait...")
|
||||
|
||||
from docopt import docopt
|
||||
arguments = docopt(__doc__)
|
||||
|
||||
import numpy as np
|
||||
from PIL import ImageGrab
|
||||
import cv2
|
||||
import pyautogui
|
||||
import time
|
||||
from PIL import Image
|
||||
import os
|
||||
from random import shuffle
|
||||
from tqdm import tqdm
|
||||
import matplotlib.pyplot as plt
|
||||
import sys
|
||||
import math
|
||||
|
||||
import tflearn
|
||||
from tflearn.layers.conv import conv_2d, max_pool_2d
|
||||
from tflearn.layers.core import input_data, dropout, fully_connected
|
||||
from tflearn.layers.estimator import regression
|
||||
import tensorflow as tf
|
||||
|
||||
import fishy_network as net
|
||||
from threading import Timer
|
||||
|
||||
|
||||
from pynput.keyboard import Key, Listener
|
||||
|
||||
controls = {"stop":[Key.f11,"f11"], "debug":[Key.f10,"f10"], "pause":[Key.f9,"f9"]}
|
||||
|
||||
stop = False
|
||||
pause = False
|
||||
debug = False
|
||||
|
||||
IMG_SIZE = 100
|
||||
##IMG_SIZE_X = 350
|
||||
##IMG_SIZE_Y = 284
|
||||
LR = 1e-3
|
||||
|
||||
|
||||
MODEL_NAME = 'learnstick-{}-{}.model'.format(LR, '6conv-basic-video')
|
||||
|
||||
ROOT_DIR = os.path.dirname(os.path.abspath(__file__))
|
||||
TRAIN_DIR_HOOK = ROOT_DIR+r'\hook'
|
||||
TRAIN_DIR_STICK = ROOT_DIR+r'\stick'
|
||||
TRAIN_DIR_NONE = ROOT_DIR+r'\none'
|
||||
TEST_DIR = ROOT_DIR+r'\test'
|
||||
|
||||
IMAGE_DIR = ROOT_DIR+"\\imgs\\"
|
||||
|
||||
STICK_TIMEOUT = 30.0 #secs
|
||||
NONE_TIMEOUT = 5.0 #secs
|
||||
|
||||
if arguments['HOOKTHRESHOLD'] is not None:
|
||||
HOOK_THRESHOLD = int(arguments['HOOKTHRESHOLD'])
|
||||
else:
|
||||
HOOK_THRESHOLD = 3
|
||||
|
||||
if arguments["MINIMUMCONFIDENCE"] is not None:
|
||||
MINIMUM_CONFIDENCE = float(arguments["MINIMUMCONFIDENCE"])
|
||||
else:
|
||||
MINIMUM_CONFIDENCE = -1
|
||||
|
||||
IP_ADDRESS = arguments["--ip"]
|
||||
|
||||
|
||||
def create_model():
|
||||
convnet = input_data(shape=[None, IMG_SIZE, IMG_SIZE, 1], name='input')
|
||||
|
||||
convnet = conv_2d(convnet, 32, 2, activation='relu')
|
||||
convnet = max_pool_2d(convnet, 2)
|
||||
|
||||
convnet = conv_2d(convnet, 64, 2, activation='relu')
|
||||
convnet = max_pool_2d(convnet, 2)
|
||||
|
||||
convnet = conv_2d(convnet, 32, 2, activation='relu')
|
||||
convnet = max_pool_2d(convnet, 2)
|
||||
|
||||
convnet = conv_2d(convnet, 64, 2, activation='relu')
|
||||
convnet = max_pool_2d(convnet, 2)
|
||||
|
||||
convnet = conv_2d(convnet, 32, 2, activation='relu')
|
||||
convnet = max_pool_2d(convnet, 2)
|
||||
|
||||
convnet = conv_2d(convnet, 64, 2, activation='relu')
|
||||
convnet = max_pool_2d(convnet, 2)
|
||||
|
||||
convnet = fully_connected(convnet, 1024, activation='relu')
|
||||
convnet = dropout(convnet, 0.8)
|
||||
|
||||
convnet = fully_connected(convnet, 3, activation='softmax')
|
||||
convnet = regression(convnet, optimizer='adam', learning_rate=LR, loss='categorical_crossentropy', name='targets')
|
||||
|
||||
model = tflearn.DNN(convnet, tensorboard_dir='log')
|
||||
return model
|
||||
|
||||
def get_data_from(DIR, label):
|
||||
data = []
|
||||
for img in tqdm(os.listdir(DIR)):
|
||||
path = os.path.join(DIR,img)
|
||||
img = cv2.resize(cv2.imread(path, cv2.IMREAD_GRAYSCALE), (IMG_SIZE,IMG_SIZE))
|
||||
data.append([np.array(img), np.array(label)])
|
||||
return data
|
||||
|
||||
def create_train_data():
|
||||
training_data = []
|
||||
|
||||
training_data.extend(get_data_from(TRAIN_DIR_HOOK,[1,0,0]))
|
||||
training_data.extend(get_data_from(TRAIN_DIR_STICK,[0,1,0]))
|
||||
training_data.extend(get_data_from(TRAIN_DIR_NONE,[0,0,1]))
|
||||
|
||||
shuffle(training_data)
|
||||
#np.save('train_data.npy',training_data)
|
||||
return training_data
|
||||
|
||||
def create_test_data():
|
||||
testing_data = []
|
||||
i=0
|
||||
for img in tqdm(os.listdir(TEST_DIR)):
|
||||
path = os.path.join(TEST_DIR,img)
|
||||
img = cv2.resize(cv2.imread(path,cv2.IMREAD_GRAYSCALE), (IMG_SIZE,IMG_SIZE))
|
||||
testing_data.append([np.array(img),i])
|
||||
i+=1
|
||||
#np.save('test_data.npy',testing_data)
|
||||
return testing_data
|
||||
|
||||
def roi(img, vertices):
|
||||
mask = np.zeros_like(img)
|
||||
cv2.fillPoly(mask, vertices, 255)
|
||||
masked = cv2.bitwise_and(img, mask)
|
||||
return masked
|
||||
|
||||
def process_img(original_img):
|
||||
#processed_img = original_img
|
||||
processed_img = cv2.cvtColor(original_img, cv2.COLOR_BGR2GRAY)
|
||||
vertices = np.array([[290,216],[640,216],[640,500],[290,500]])
|
||||
processed_img = roi(processed_img,[vertices])
|
||||
croped_img = processed_img[216:500, 290:640]
|
||||
return croped_img
|
||||
|
||||
def save_img(data,foldername,no):
|
||||
rescaled = (255.0 / data.max() * (data - data.min())).astype(np.uint8)
|
||||
im = Image.fromarray(rescaled)
|
||||
im.save(IMAGE_DIR+foldername+"\\"+foldername+str(no)+".png")
|
||||
|
||||
def create_test_data():
|
||||
testing_data = []
|
||||
i=0
|
||||
for img in tqdm(os.listdir(TEST_DIR)):
|
||||
path = os.path.join(TEST_DIR,img)
|
||||
img = cv2.resize(cv2.imread(path,cv2.IMREAD_GRAYSCALE), (IMG_SIZE,IMG_SIZE))
|
||||
testing_data.append([np.array(img),i])
|
||||
i+=1
|
||||
#np.save('test_data.npy',testing_data)
|
||||
return testing_data
|
||||
|
||||
def configureWindow():
|
||||
print("Depricated!!!, use fishy_config.py\npress q to quit")
|
||||
while(True):
|
||||
screen = np.array(ImageGrab.grab(bbox=(0,40,800,600)))
|
||||
new_screen = cv2.cvtColor(screen, cv2.COLOR_BGR2RGB)
|
||||
cv2.imshow('window', new_screen)
|
||||
|
||||
k = cv2.waitKey(25) & 0xFF
|
||||
|
||||
if k == ord('q') or k == ord('Q'):
|
||||
cv2.destroyAllWindows()
|
||||
break
|
||||
|
||||
|
||||
|
||||
def pressE():
|
||||
pyautogui.press('e')
|
||||
|
||||
def pullStick(fishCaught, timeToHook):
|
||||
print("HOOOOOOOOOOOOOOOOOOOOOOOK....... "+str(fishCaught)+" caught "+" in "+str(timeToHook)+" secs")
|
||||
pressE()
|
||||
#Timer(0.5, pressE).start()
|
||||
time.sleep(0.5)
|
||||
pressE()
|
||||
|
||||
|
||||
def on_release(key):
|
||||
global stop, pause, debug
|
||||
|
||||
if controls["pause"][0] == key:
|
||||
pause = not pause
|
||||
if pause:
|
||||
print("PAUSED")
|
||||
else:
|
||||
print("STARTED")
|
||||
|
||||
elif controls["debug"][0] == key:
|
||||
debug = not debug
|
||||
|
||||
elif controls["stop"][0] == key:
|
||||
stop = True
|
||||
|
||||
def startFishing():
|
||||
global stop, pause, debug
|
||||
|
||||
pause = True
|
||||
showedControls = True
|
||||
debug = False
|
||||
stop = False
|
||||
hookCount = 0
|
||||
fishCaught = 0
|
||||
model = create_model()
|
||||
model.load(MODEL_NAME)
|
||||
|
||||
ctrl_help = controls["pause"][1]+": start or pause\n"+controls["debug"][1]+": start debug\n"+controls["stop"][1]+": quit\nHOOK_THRESHOLD is set to "+str(HOOK_THRESHOLD)+"\nMINIMUM_CONFIDENCE is set to "+str(MINIMUM_CONFIDENCE)
|
||||
|
||||
print(ctrl_help)
|
||||
|
||||
|
||||
stickInitTime = time.time()
|
||||
noneInitTime = time.time()
|
||||
|
||||
|
||||
hookTime = time.time()
|
||||
|
||||
use_net = False
|
||||
if IP_ADDRESS is not None:
|
||||
use_net = True
|
||||
net.initialize(IP_ADDRESS)
|
||||
|
||||
holeDepleteSent = True
|
||||
noneTimeStarted = True
|
||||
|
||||
timerStarted = False
|
||||
|
||||
with Listener(on_release=on_release) as listener:
|
||||
while(True):
|
||||
screen = np.array(ImageGrab.grab(bbox=(0,40,800,600)))
|
||||
new_screen = process_img(screen)
|
||||
cv2.imshow('window', new_screen)
|
||||
|
||||
processed_img = cv2.resize(new_screen, (IMG_SIZE,IMG_SIZE)).tolist()
|
||||
|
||||
X = np.array(processed_img).reshape(-1, IMG_SIZE, IMG_SIZE, 1)
|
||||
|
||||
model_out = model.predict(X)[0]
|
||||
labelNum = np.argmax(model_out)
|
||||
|
||||
|
||||
|
||||
if not pause:
|
||||
if labelNum == 0 and (MINIMUM_CONFIDENCE == -1 or model_out[0]>MINIMUM_CONFIDENCE):
|
||||
#when 0 comes
|
||||
hookCount+=1
|
||||
|
||||
if hookCount >= HOOK_THRESHOLD:
|
||||
#hooooked
|
||||
hookCount=0
|
||||
|
||||
fishCaught+=1
|
||||
timeToHook = time.time() - stickInitTime
|
||||
pullStick(fishCaught, timeToHook)
|
||||
|
||||
|
||||
|
||||
else:
|
||||
hookCount = 0
|
||||
|
||||
if labelNum == 1:
|
||||
if not timerStarted:
|
||||
stickInitTime = time.time()
|
||||
timerStarted = True
|
||||
if (time.time() - stickInitTime) >= STICK_TIMEOUT:
|
||||
print("STICK TIMED OUT, THROWING AGAIN")
|
||||
pressE()
|
||||
timerStarted = False
|
||||
else:
|
||||
timerStarted = False
|
||||
|
||||
if labelNum == 2:
|
||||
if not noneTimeStarted:
|
||||
noneInitTime = time.time()
|
||||
noneTimeStarted = True
|
||||
holeDepleteSent = False
|
||||
|
||||
if not holeDepleteSent and time.time() - noneInitTime >= NONE_TIMEOUT:
|
||||
if fishCaught>0:
|
||||
print("HOLE DEPLETED")
|
||||
if use_net:
|
||||
net.sendHoleDeplete(fishCaught)
|
||||
|
||||
fishCaught = 0
|
||||
holeDepleteSent = True
|
||||
else:
|
||||
noneTimeStarted = False
|
||||
|
||||
|
||||
if debug:
|
||||
print(str(labelNum)+' '+str(model_out))
|
||||
showedControls = False
|
||||
else:
|
||||
if not showedControls:
|
||||
showedControls = True
|
||||
#os.system('cls')
|
||||
print(ctrl_help)
|
||||
|
||||
cv2.waitKey(25)
|
||||
|
||||
## if k == ord('q') or k == ord('Q'):
|
||||
## cv2.destroyAllWindows()
|
||||
## break
|
||||
## if k == ord('p') or k == ord('P'):
|
||||
## pause = not pause
|
||||
## if pause:
|
||||
## print("PAUSED")
|
||||
## fishCaught = 0
|
||||
## else:
|
||||
## print("STARTED")
|
||||
## if k == ord('d') or k == ord('D'):
|
||||
## debug = not debug
|
||||
|
||||
if stop:
|
||||
cv2.destroyAllWindows()
|
||||
break
|
||||
|
||||
|
||||
def screenCapture(foldername):
|
||||
global stop, pause, debug
|
||||
|
||||
print("Press \n"+controls["pause"][1]+" to pause\n"+controls["stop"][1]+" to quit")
|
||||
imgNo = 0
|
||||
|
||||
imgPath = IMAGE_DIR+foldername
|
||||
|
||||
stop = False
|
||||
|
||||
if not os.path.exists(imgPath):
|
||||
os.makedirs(imgPath)
|
||||
else:
|
||||
print("Folder already exists, move/delete it and try again")
|
||||
return
|
||||
|
||||
with Listener(on_release=on_release) as listener:
|
||||
while(True):
|
||||
screen = np.array(ImageGrab.grab(bbox=(0,40,800,600)))
|
||||
new_screen = process_img(screen)
|
||||
cv2.imshow('window', new_screen)
|
||||
|
||||
if not pause:
|
||||
save_img(new_screen,foldername,imgNo)
|
||||
|
||||
imgNo+=1
|
||||
cv2.waitKey(25)
|
||||
if stop:
|
||||
cv2.destroyAllWindows()
|
||||
break
|
||||
|
||||
def closestMul(x):
|
||||
n = math.ceil(math.sqrt(x))
|
||||
m = math.ceil(x/n)
|
||||
return n,m
|
||||
|
||||
def learn(load,valamount,trainamount):
|
||||
if not load and os.path.exists('{}.meta'.format(MODEL_NAME)):
|
||||
print("Please move/delete your old model, and retry (--load to use existing model)")
|
||||
return
|
||||
|
||||
train_data = create_train_data()
|
||||
tf.reset_default_graph()
|
||||
|
||||
model = create_model()
|
||||
|
||||
if load:
|
||||
if os.path.exists('{}.meta'.format(MODEL_NAME)):
|
||||
model.load(MODEL_NAME)
|
||||
print("Model Loaded")
|
||||
else:
|
||||
print("Could'nt find an existing model to load")
|
||||
|
||||
train = train_data[:-valamount-trainamount]
|
||||
val = train_data[-valamount-trainamount:-trainamount]
|
||||
test_data = train_data[-trainamount:]
|
||||
|
||||
X = np.array([i[0] for i in train]).reshape(-1, IMG_SIZE, IMG_SIZE, 1)
|
||||
Y = [i[1] for i in train]
|
||||
|
||||
test_x = np.array([i[0] for i in val]).reshape(-1, IMG_SIZE, IMG_SIZE, 1)
|
||||
test_y = [i[1] for i in val]
|
||||
|
||||
model.fit({'input': X}, {'targets': Y}, n_epoch=10, validation_set=({'input': test_x}, {'targets': test_y}),snapshot_step=500, show_metric=True, run_id=MODEL_NAME)
|
||||
model.save(MODEL_NAME)
|
||||
|
||||
#test_data = create_test_data()
|
||||
|
||||
fig = plt.figure()
|
||||
|
||||
n,m = closestMul(trainamount)
|
||||
|
||||
for num, data in enumerate(test_data):
|
||||
img_data = data[0]
|
||||
|
||||
y=fig.add_subplot(n,m,num+1)
|
||||
orig = img_data
|
||||
data = img_data.reshape(IMG_SIZE, IMG_SIZE, 1)
|
||||
|
||||
model_out = model.predict([data])[0]
|
||||
print(model_out)
|
||||
|
||||
str_lable = str(np.argmax(model_out))
|
||||
|
||||
y.imshow(orig, cmap='gray')
|
||||
plt.title(str_lable)
|
||||
y.axes.get_xaxis().set_visible(False)
|
||||
y.axes.get_yaxis().set_visible(False)
|
||||
plt.show()
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
if arguments["--configwin"]:
|
||||
configureWindow()
|
||||
|
||||
elif arguments["--fish"] :
|
||||
startFishing()
|
||||
|
||||
elif arguments["--screencapture"]:
|
||||
screenCapture(arguments["FOLDERNAME"])
|
||||
|
||||
elif arguments["--learn"]:
|
||||
learn(arguments["--load"],int(arguments["VALAMOUNT"]), int(arguments["TESTAMOUNT"]))
|
||||
|
||||
elif arguments["--version"]:
|
||||
print("Fishy "+VERSION+" For Elder Scrolls Online")
|
||||
|
||||
input("Press Enter to continue...")
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
5
fishy_config.py
Normal file
@ -0,0 +1,5 @@
|
||||
import win32gui
|
||||
X,Y,W,H = -8,0,815,608
|
||||
|
||||
hwnd = win32gui.FindWindow(None, "Elder Scrolls Online")
|
||||
win32gui.MoveWindow(hwnd, X, Y, W, H, True)
|
37
fishy_network.py
Normal file
@ -0,0 +1,37 @@
|
||||
import socket
|
||||
import json
|
||||
from socket import timeout
|
||||
import time
|
||||
|
||||
PORT = 8023
|
||||
MESSAGE = "yo"
|
||||
RETRY_LIMIT = 5
|
||||
IP = 0
|
||||
|
||||
def initialize(ip):
|
||||
global s, IP
|
||||
IP = ip
|
||||
|
||||
def send_message(message, count=1):
|
||||
try:
|
||||
s = socket.socket()
|
||||
s.connect((IP,PORT))
|
||||
s.send(bytes(message, "utf-8"))
|
||||
s.close()
|
||||
except ConnectionRefusedError:
|
||||
print("Connection Refused, please turn on service on mobile")
|
||||
except TimeoutError:
|
||||
print("Timeout Error")
|
||||
|
||||
if count < RETRY_LIMIT:
|
||||
send_message(message, count+1)
|
||||
|
||||
|
||||
def sendHoleDeplete(count):
|
||||
message = {"action":"holeDeplete", "fishCount": count}
|
||||
jsonString = json.dumps(message)
|
||||
send_message(jsonString)
|
||||
|
||||
|
||||
##initialize("192.168.0.192")
|
||||
##sendHoleDeplete(2)
|
BIN
imgs/2_sunlight_reflect/2_sunlight_reflect0.png
Normal file
After Width: | Height: | Size: 30 KiB |
BIN
imgs/2_sunlight_reflect/2_sunlight_reflect1.png
Normal file
After Width: | Height: | Size: 30 KiB |
BIN
imgs/2_sunlight_reflect/2_sunlight_reflect10.png
Normal file
After Width: | Height: | Size: 30 KiB |
BIN
imgs/2_sunlight_reflect/2_sunlight_reflect100.png
Normal file
After Width: | Height: | Size: 32 KiB |
BIN
imgs/2_sunlight_reflect/2_sunlight_reflect1000.png
Normal file
After Width: | Height: | Size: 22 KiB |
BIN
imgs/2_sunlight_reflect/2_sunlight_reflect1001.png
Normal file
After Width: | Height: | Size: 22 KiB |
BIN
imgs/2_sunlight_reflect/2_sunlight_reflect1002.png
Normal file
After Width: | Height: | Size: 25 KiB |
BIN
imgs/2_sunlight_reflect/2_sunlight_reflect1003.png
Normal file
After Width: | Height: | Size: 23 KiB |
BIN
imgs/2_sunlight_reflect/2_sunlight_reflect1004.png
Normal file
After Width: | Height: | Size: 20 KiB |
BIN
imgs/2_sunlight_reflect/2_sunlight_reflect1005.png
Normal file
After Width: | Height: | Size: 25 KiB |
BIN
imgs/2_sunlight_reflect/2_sunlight_reflect1006.png
Normal file
After Width: | Height: | Size: 23 KiB |
BIN
imgs/2_sunlight_reflect/2_sunlight_reflect1007.png
Normal file
After Width: | Height: | Size: 24 KiB |
BIN
imgs/2_sunlight_reflect/2_sunlight_reflect1008.png
Normal file
After Width: | Height: | Size: 24 KiB |
BIN
imgs/2_sunlight_reflect/2_sunlight_reflect1009.png
Normal file
After Width: | Height: | Size: 26 KiB |
BIN
imgs/2_sunlight_reflect/2_sunlight_reflect101.png
Normal file
After Width: | Height: | Size: 31 KiB |
BIN
imgs/2_sunlight_reflect/2_sunlight_reflect1010.png
Normal file
After Width: | Height: | Size: 25 KiB |
BIN
imgs/2_sunlight_reflect/2_sunlight_reflect1011.png
Normal file
After Width: | Height: | Size: 26 KiB |
BIN
imgs/2_sunlight_reflect/2_sunlight_reflect1012.png
Normal file
After Width: | Height: | Size: 26 KiB |
BIN
imgs/2_sunlight_reflect/2_sunlight_reflect1013.png
Normal file
After Width: | Height: | Size: 25 KiB |
BIN
imgs/2_sunlight_reflect/2_sunlight_reflect1014.png
Normal file
After Width: | Height: | Size: 25 KiB |
BIN
imgs/2_sunlight_reflect/2_sunlight_reflect1015.png
Normal file
After Width: | Height: | Size: 25 KiB |
BIN
imgs/2_sunlight_reflect/2_sunlight_reflect1016.png
Normal file
After Width: | Height: | Size: 26 KiB |
BIN
imgs/2_sunlight_reflect/2_sunlight_reflect1017.png
Normal file
After Width: | Height: | Size: 25 KiB |
BIN
imgs/2_sunlight_reflect/2_sunlight_reflect1018.png
Normal file
After Width: | Height: | Size: 25 KiB |
BIN
imgs/2_sunlight_reflect/2_sunlight_reflect1019.png
Normal file
After Width: | Height: | Size: 28 KiB |
BIN
imgs/2_sunlight_reflect/2_sunlight_reflect102.png
Normal file
After Width: | Height: | Size: 31 KiB |
BIN
imgs/2_sunlight_reflect/2_sunlight_reflect1020.png
Normal file
After Width: | Height: | Size: 31 KiB |
BIN
imgs/2_sunlight_reflect/2_sunlight_reflect1021.png
Normal file
After Width: | Height: | Size: 30 KiB |
BIN
imgs/2_sunlight_reflect/2_sunlight_reflect1022.png
Normal file
After Width: | Height: | Size: 26 KiB |
BIN
imgs/2_sunlight_reflect/2_sunlight_reflect1023.png
Normal file
After Width: | Height: | Size: 26 KiB |
BIN
imgs/2_sunlight_reflect/2_sunlight_reflect1024.png
Normal file
After Width: | Height: | Size: 27 KiB |
BIN
imgs/2_sunlight_reflect/2_sunlight_reflect1025.png
Normal file
After Width: | Height: | Size: 28 KiB |
BIN
imgs/2_sunlight_reflect/2_sunlight_reflect1026.png
Normal file
After Width: | Height: | Size: 28 KiB |
BIN
imgs/2_sunlight_reflect/2_sunlight_reflect1027.png
Normal file
After Width: | Height: | Size: 30 KiB |
BIN
imgs/2_sunlight_reflect/2_sunlight_reflect1028.png
Normal file
After Width: | Height: | Size: 31 KiB |
BIN
imgs/2_sunlight_reflect/2_sunlight_reflect1029.png
Normal file
After Width: | Height: | Size: 32 KiB |
BIN
imgs/2_sunlight_reflect/2_sunlight_reflect103.png
Normal file
After Width: | Height: | Size: 32 KiB |
BIN
imgs/2_sunlight_reflect/2_sunlight_reflect1030.png
Normal file
After Width: | Height: | Size: 32 KiB |
BIN
imgs/2_sunlight_reflect/2_sunlight_reflect1031.png
Normal file
After Width: | Height: | Size: 32 KiB |
BIN
imgs/2_sunlight_reflect/2_sunlight_reflect1032.png
Normal file
After Width: | Height: | Size: 31 KiB |
BIN
imgs/2_sunlight_reflect/2_sunlight_reflect1033.png
Normal file
After Width: | Height: | Size: 32 KiB |
BIN
imgs/2_sunlight_reflect/2_sunlight_reflect1034.png
Normal file
After Width: | Height: | Size: 33 KiB |
BIN
imgs/2_sunlight_reflect/2_sunlight_reflect1035.png
Normal file
After Width: | Height: | Size: 32 KiB |
BIN
imgs/2_sunlight_reflect/2_sunlight_reflect1036.png
Normal file
After Width: | Height: | Size: 32 KiB |
BIN
imgs/2_sunlight_reflect/2_sunlight_reflect1037.png
Normal file
After Width: | Height: | Size: 32 KiB |
BIN
imgs/2_sunlight_reflect/2_sunlight_reflect1038.png
Normal file
After Width: | Height: | Size: 32 KiB |
BIN
imgs/2_sunlight_reflect/2_sunlight_reflect1039.png
Normal file
After Width: | Height: | Size: 32 KiB |
BIN
imgs/2_sunlight_reflect/2_sunlight_reflect104.png
Normal file
After Width: | Height: | Size: 32 KiB |
BIN
imgs/2_sunlight_reflect/2_sunlight_reflect1040.png
Normal file
After Width: | Height: | Size: 32 KiB |
BIN
imgs/2_sunlight_reflect/2_sunlight_reflect1041.png
Normal file
After Width: | Height: | Size: 32 KiB |
BIN
imgs/2_sunlight_reflect/2_sunlight_reflect1042.png
Normal file
After Width: | Height: | Size: 32 KiB |
BIN
imgs/2_sunlight_reflect/2_sunlight_reflect1043.png
Normal file
After Width: | Height: | Size: 32 KiB |
BIN
imgs/2_sunlight_reflect/2_sunlight_reflect1044.png
Normal file
After Width: | Height: | Size: 31 KiB |
BIN
imgs/2_sunlight_reflect/2_sunlight_reflect1045.png
Normal file
After Width: | Height: | Size: 31 KiB |
BIN
imgs/2_sunlight_reflect/2_sunlight_reflect1046.png
Normal file
After Width: | Height: | Size: 32 KiB |
BIN
imgs/2_sunlight_reflect/2_sunlight_reflect1047.png
Normal file
After Width: | Height: | Size: 32 KiB |
BIN
imgs/2_sunlight_reflect/2_sunlight_reflect1048.png
Normal file
After Width: | Height: | Size: 30 KiB |
BIN
imgs/2_sunlight_reflect/2_sunlight_reflect1049.png
Normal file
After Width: | Height: | Size: 30 KiB |
BIN
imgs/2_sunlight_reflect/2_sunlight_reflect105.png
Normal file
After Width: | Height: | Size: 32 KiB |
BIN
imgs/2_sunlight_reflect/2_sunlight_reflect1050.png
Normal file
After Width: | Height: | Size: 30 KiB |
BIN
imgs/2_sunlight_reflect/2_sunlight_reflect1051.png
Normal file
After Width: | Height: | Size: 30 KiB |
BIN
imgs/2_sunlight_reflect/2_sunlight_reflect1052.png
Normal file
After Width: | Height: | Size: 30 KiB |
BIN
imgs/2_sunlight_reflect/2_sunlight_reflect1053.png
Normal file
After Width: | Height: | Size: 30 KiB |
BIN
imgs/2_sunlight_reflect/2_sunlight_reflect1054.png
Normal file
After Width: | Height: | Size: 30 KiB |
BIN
imgs/2_sunlight_reflect/2_sunlight_reflect1055.png
Normal file
After Width: | Height: | Size: 30 KiB |
BIN
imgs/2_sunlight_reflect/2_sunlight_reflect1056.png
Normal file
After Width: | Height: | Size: 29 KiB |
BIN
imgs/2_sunlight_reflect/2_sunlight_reflect1057.png
Normal file
After Width: | Height: | Size: 30 KiB |
BIN
imgs/2_sunlight_reflect/2_sunlight_reflect1058.png
Normal file
After Width: | Height: | Size: 30 KiB |