mirror of
https://github.com/AndorsTrailRelease/andors-trail.git
synced 2025-12-28 23:35:47 +01:00
Compare commits
3 Commits
master
...
compressed
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
19d9ecb721 | ||
|
|
66a0e34ef9 | ||
|
|
13c58fcdbc |
1
.gitignore
vendored
1
.gitignore
vendored
@@ -1 +0,0 @@
|
||||
/AndorsTrail/.idea/workspace.xml
|
||||
6
AndorsTrail/.gitignore
vendored
6
AndorsTrail/.gitignore
vendored
@@ -1,3 +1,6 @@
|
||||
# Android ignores
|
||||
app/src/main/res
|
||||
app/src/main/assets
|
||||
gen/
|
||||
bin/
|
||||
target/
|
||||
@@ -5,7 +8,6 @@ local.properties
|
||||
app/build/intermediates/
|
||||
build/
|
||||
debug/
|
||||
beta/
|
||||
release/
|
||||
.gradle/
|
||||
|
||||
@@ -50,6 +52,4 @@ gradle-app.setting
|
||||
/AndorsTrail/gradle/wrapper
|
||||
/AndorsTrail/app/build/
|
||||
/AndorsTrail/app/debug/
|
||||
/AndorsTrail/app/beta/
|
||||
/AndorsTrail/app/release/
|
||||
/AndorsTrail/app/beta/
|
||||
|
||||
Binary file not shown.
BIN
AndorsTrail/.gradle/7.3.3/fileChanges/last-build.bin
Normal file
BIN
AndorsTrail/.gradle/7.3.3/fileChanges/last-build.bin
Normal file
Binary file not shown.
0
AndorsTrail/.gradle/7.3.3/gc.properties
Normal file
0
AndorsTrail/.gradle/7.3.3/gc.properties
Normal file
0
AndorsTrail/.gradle/vcs-1/gc.properties
Normal file
0
AndorsTrail/.gradle/vcs-1/gc.properties
Normal file
6
AndorsTrail/.idea/compiler.xml
generated
Normal file
6
AndorsTrail/.idea/compiler.xml
generated
Normal file
@@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="CompilerConfiguration">
|
||||
<bytecodeTargetLevel target="11" />
|
||||
</component>
|
||||
</project>
|
||||
20
AndorsTrail/.idea/gradle.xml
generated
Normal file
20
AndorsTrail/.idea/gradle.xml
generated
Normal file
@@ -0,0 +1,20 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="GradleMigrationSettings" migrationVersion="1" />
|
||||
<component name="GradleSettings">
|
||||
<option name="linkedExternalProjectsSettings">
|
||||
<GradleProjectSettings>
|
||||
<option name="testRunner" value="GRADLE" />
|
||||
<option name="distributionType" value="DEFAULT_WRAPPED" />
|
||||
<option name="externalProjectPath" value="$PROJECT_DIR$" />
|
||||
<option name="gradleJvm" value="1.8" />
|
||||
<option name="modules">
|
||||
<set>
|
||||
<option value="$PROJECT_DIR$" />
|
||||
<option value="$PROJECT_DIR$/app" />
|
||||
</set>
|
||||
</option>
|
||||
</GradleProjectSettings>
|
||||
</option>
|
||||
</component>
|
||||
</project>
|
||||
25
AndorsTrail/.idea/jarRepositories.xml
generated
Normal file
25
AndorsTrail/.idea/jarRepositories.xml
generated
Normal file
@@ -0,0 +1,25 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="RemoteRepositoriesConfiguration">
|
||||
<remote-repository>
|
||||
<option name="id" value="central" />
|
||||
<option name="name" value="Maven Central repository" />
|
||||
<option name="url" value="https://repo1.maven.org/maven2" />
|
||||
</remote-repository>
|
||||
<remote-repository>
|
||||
<option name="id" value="jboss.community" />
|
||||
<option name="name" value="JBoss Community repository" />
|
||||
<option name="url" value="https://repository.jboss.org/nexus/content/repositories/public/" />
|
||||
</remote-repository>
|
||||
<remote-repository>
|
||||
<option name="id" value="BintrayJCenter" />
|
||||
<option name="name" value="BintrayJCenter" />
|
||||
<option name="url" value="https://jcenter.bintray.com/" />
|
||||
</remote-repository>
|
||||
<remote-repository>
|
||||
<option name="id" value="Google" />
|
||||
<option name="name" value="Google" />
|
||||
<option name="url" value="https://dl.google.com/dl/android/maven2/" />
|
||||
</remote-repository>
|
||||
</component>
|
||||
</project>
|
||||
10
AndorsTrail/.idea/misc.xml
generated
Normal file
10
AndorsTrail/.idea/misc.xml
generated
Normal file
@@ -0,0 +1,10 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ExternalStorageConfigurationManager" enabled="true" />
|
||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_11" project-jdk-name="11" project-jdk-type="JavaSDK">
|
||||
<output url="file://$PROJECT_DIR$/build/classes" />
|
||||
</component>
|
||||
<component name="ProjectType">
|
||||
<option name="id" value="Android" />
|
||||
</component>
|
||||
</project>
|
||||
6
AndorsTrail/.idea/vcs.xml
generated
Normal file
6
AndorsTrail/.idea/vcs.xml
generated
Normal file
@@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="VcsDirectoryMappings">
|
||||
<mapping directory="$PROJECT_DIR$/.." vcs="Git" />
|
||||
</component>
|
||||
</project>
|
||||
166
AndorsTrail/.idea/workspace.xml
generated
Normal file
166
AndorsTrail/.idea/workspace.xml
generated
Normal file
@@ -0,0 +1,166 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="AutoImportSettings">
|
||||
<option name="autoReloadType" value="NONE" />
|
||||
</component>
|
||||
<component name="ChangeListManager">
|
||||
<list default="true" id="fb7bf33b-30cf-40b9-a238-3e2f6f604a8f" name="Changes" comment="" />
|
||||
<option name="SHOW_DIALOG" value="false" />
|
||||
<option name="HIGHLIGHT_CONFLICTS" value="true" />
|
||||
<option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" />
|
||||
<option name="LAST_RESOLUTION" value="IGNORE" />
|
||||
</component>
|
||||
<component name="ExecutionTargetManager" SELECTED_TARGET="device_and_snapshot_combo_box_target[AQ8PSW4DBUZPMZOR]" />
|
||||
<component name="ExternalProjectsData">
|
||||
<projectState path="$PROJECT_DIR$">
|
||||
<ProjectState />
|
||||
</projectState>
|
||||
</component>
|
||||
<component name="ExternalProjectsManager">
|
||||
<system id="GRADLE">
|
||||
<state>
|
||||
<projects_view>
|
||||
<tree_state>
|
||||
<expand>
|
||||
<path>
|
||||
<item name="" type="6a2764b6:ExternalProjectsStructure$RootNode" />
|
||||
<item name="AndorsTrail" type="f1a62948:ProjectNode" />
|
||||
</path>
|
||||
</expand>
|
||||
<select />
|
||||
</tree_state>
|
||||
</projects_view>
|
||||
</state>
|
||||
</system>
|
||||
</component>
|
||||
<component name="GenerateSignedApkSettings">
|
||||
<option name="KEY_STORE_PATH" value="C:\AT\sec\AndorsTrail.keystore" />
|
||||
<option name="KEY_ALIAS" value="andorstrail" />
|
||||
<option name="REMEMBER_PASSWORDS" value="true" />
|
||||
<option name="BUILD_TARGET_KEY" value="apk" />
|
||||
</component>
|
||||
<component name="Git.Settings">
|
||||
<option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$/.." />
|
||||
</component>
|
||||
<component name="ProjectId" id="2FG0LqADbxm6Q1t3yQ9BlX5APzJ" />
|
||||
<component name="ProjectLevelVcsManager" settingsEditedManually="true" />
|
||||
<component name="ProjectViewState">
|
||||
<option name="hideEmptyMiddlePackages" value="true" />
|
||||
<option name="showLibraryContents" value="true" />
|
||||
</component>
|
||||
<component name="PropertiesComponent">
|
||||
<property name="ApkExportedModule" value="AndorsTrail.app" />
|
||||
<property name="ExportApk.ApkPath" value="C:\AT\AndorsTrailRelease\andors-trail\AndorsTrail\app" />
|
||||
<property name="ExportApk.BuildVariants" value="release" />
|
||||
<property name="RunOnceActivity.OpenProjectViewOnStart" value="true" />
|
||||
<property name="RunOnceActivity.ShowReadmeOnStart" value="true" />
|
||||
<property name="RunOnceActivity.cidr.known.project.marker" value="true" />
|
||||
<property name="android.sdk.path" value="$USER_HOME$/AppData/Local/Android/Sdk" />
|
||||
<property name="cidr.known.project.marker" value="true" />
|
||||
<property name="last_opened_file_path" value="$PROJECT_DIR$/../../../sec/AndorsTrail.keystore" />
|
||||
<property name="settings.editor.selected.configurable" value="device.file.explorer" />
|
||||
<property name="show.inlinked.gradle.project.popup" value="false" />
|
||||
</component>
|
||||
<component name="RunManager">
|
||||
<configuration name="<template>" type="Applet" default="true" selected="false">
|
||||
<option name="MAIN_CLASS_NAME" />
|
||||
<option name="HTML_FILE_NAME" />
|
||||
<option name="HTML_USED" value="false" />
|
||||
<option name="WIDTH" value="400" />
|
||||
<option name="HEIGHT" value="300" />
|
||||
<option name="POLICY_FILE" value="$APPLICATION_HOME_DIR$/bin/appletviewer.policy" />
|
||||
<option name="VM_PARAMETERS" />
|
||||
</configuration>
|
||||
<configuration name="<template>" type="#org.jetbrains.idea.devkit.run.PluginConfigurationType" default="true" selected="false">
|
||||
<option name="VM_PARAMETERS" value="-Xmx512m -Xms256m -XX:MaxPermSize=250m -ea" />
|
||||
</configuration>
|
||||
<configuration name="app" type="AndroidRunConfigurationType" factoryName="Android App">
|
||||
<module name="AndorsTrail.app" />
|
||||
<option name="DEPLOY" value="true" />
|
||||
<option name="DEPLOY_APK_FROM_BUNDLE" value="false" />
|
||||
<option name="DEPLOY_AS_INSTANT" value="false" />
|
||||
<option name="ARTIFACT_NAME" value="" />
|
||||
<option name="PM_INSTALL_OPTIONS" value="" />
|
||||
<option name="ALL_USERS" value="false" />
|
||||
<option name="ALWAYS_INSTALL_WITH_PM" value="false" />
|
||||
<option name="DYNAMIC_FEATURES_DISABLED_LIST" value="" />
|
||||
<option name="ACTIVITY_EXTRA_FLAGS" value="" />
|
||||
<option name="MODE" value="default_activity" />
|
||||
<option name="CLEAR_LOGCAT" value="false" />
|
||||
<option name="SHOW_LOGCAT_AUTOMATICALLY" value="false" />
|
||||
<option name="INSPECTION_WITHOUT_ACTIVITY_RESTART" value="false" />
|
||||
<option name="TARGET_SELECTION_MODE" value="DEVICE_AND_SNAPSHOT_COMBO_BOX" />
|
||||
<option name="SELECTED_CLOUD_MATRIX_CONFIGURATION_ID" value="-1" />
|
||||
<option name="SELECTED_CLOUD_MATRIX_PROJECT_ID" value="" />
|
||||
<option name="DEBUGGER_TYPE" value="Auto" />
|
||||
<Auto>
|
||||
<option name="USE_JAVA_AWARE_DEBUGGER" value="false" />
|
||||
<option name="SHOW_STATIC_VARS" value="true" />
|
||||
<option name="WORKING_DIR" value="" />
|
||||
<option name="TARGET_LOGGING_CHANNELS" value="lldb process:gdb-remote packets" />
|
||||
<option name="SHOW_OPTIMIZED_WARNING" value="true" />
|
||||
</Auto>
|
||||
<Hybrid>
|
||||
<option name="USE_JAVA_AWARE_DEBUGGER" value="false" />
|
||||
<option name="SHOW_STATIC_VARS" value="true" />
|
||||
<option name="WORKING_DIR" value="" />
|
||||
<option name="TARGET_LOGGING_CHANNELS" value="lldb process:gdb-remote packets" />
|
||||
<option name="SHOW_OPTIMIZED_WARNING" value="true" />
|
||||
</Hybrid>
|
||||
<Java />
|
||||
<Native>
|
||||
<option name="USE_JAVA_AWARE_DEBUGGER" value="false" />
|
||||
<option name="SHOW_STATIC_VARS" value="true" />
|
||||
<option name="WORKING_DIR" value="" />
|
||||
<option name="TARGET_LOGGING_CHANNELS" value="lldb process:gdb-remote packets" />
|
||||
<option name="SHOW_OPTIMIZED_WARNING" value="true" />
|
||||
</Native>
|
||||
<Profilers>
|
||||
<option name="ADVANCED_PROFILING_ENABLED" value="false" />
|
||||
<option name="STARTUP_PROFILING_ENABLED" value="false" />
|
||||
<option name="STARTUP_CPU_PROFILING_ENABLED" value="false" />
|
||||
<option name="STARTUP_CPU_PROFILING_CONFIGURATION_NAME" value="Java/Kotlin Method Sample (legacy)" />
|
||||
<option name="STARTUP_NATIVE_MEMORY_PROFILING_ENABLED" value="false" />
|
||||
<option name="NATIVE_MEMORY_SAMPLE_RATE_BYTES" value="2048" />
|
||||
</Profilers>
|
||||
<option name="DEEP_LINK" value="" />
|
||||
<option name="ACTIVITY_CLASS" value="" />
|
||||
<option name="SEARCH_ACTIVITY_IN_GLOBAL_SCOPE" value="false" />
|
||||
<option name="SKIP_ACTIVITY_VALIDATION" value="false" />
|
||||
<method v="2" />
|
||||
</configuration>
|
||||
<configuration default="true" type="Application" factoryName="Application">
|
||||
<option name="WORKING_DIRECTORY" value="$PROJECT_DIR$" />
|
||||
<method v="2">
|
||||
<option name="Make" enabled="true" />
|
||||
</method>
|
||||
</configuration>
|
||||
<configuration default="true" type="JUnit" factoryName="JUnit">
|
||||
<option name="TEST_OBJECT" value="class" />
|
||||
<option name="WORKING_DIRECTORY" value="$MODULE_DIR$" />
|
||||
<method v="2">
|
||||
<option name="Make" enabled="true" />
|
||||
</method>
|
||||
</configuration>
|
||||
<configuration default="true" type="TestNG">
|
||||
<option name="TEST_OBJECT" value="CLASS" />
|
||||
<option name="WORKING_DIRECTORY" value="$MODULE_DIR$" />
|
||||
<properties />
|
||||
<listeners />
|
||||
<method v="2">
|
||||
<option name="Make" enabled="true" />
|
||||
</method>
|
||||
</configuration>
|
||||
</component>
|
||||
<component name="SpellCheckerSettings" RuntimeDictionaries="0" Folders="0" CustomDictionaries="0" DefaultDictionary="application-level" UseSingleDictionary="true" transferred="true" />
|
||||
<component name="TaskManager">
|
||||
<task active="true" id="Default" summary="Default task">
|
||||
<changelist id="fb7bf33b-30cf-40b9-a238-3e2f6f604a8f" name="Changes" comment="" />
|
||||
<created>1664103080085</created>
|
||||
<option name="number" value="Default" />
|
||||
<option name="presentableId" value="Default" />
|
||||
<updated>1664103080085</updated>
|
||||
</task>
|
||||
<servers />
|
||||
</component>
|
||||
</project>
|
||||
@@ -1,91 +1,23 @@
|
||||
apply plugin: 'com.android.application'
|
||||
|
||||
android {
|
||||
|
||||
compileSdkVersion 35
|
||||
compileSdkVersion 30
|
||||
buildToolsVersion "30.0.3"
|
||||
|
||||
defaultConfig {
|
||||
applicationId "com.gpl.rpg.AndorsTrail"
|
||||
minSdkVersion 14
|
||||
targetSdkVersion 35
|
||||
targetSdkVersion 30
|
||||
}
|
||||
|
||||
buildTypes {
|
||||
release {
|
||||
manifestPlaceholders icon_name: 'icon', fileproviderPath: 'AndorsTrail'
|
||||
minifyEnabled false
|
||||
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
|
||||
}
|
||||
debug {
|
||||
manifestPlaceholders icon_name: 'icon_beta', fileproviderPath: 'AndorsTrail.beta2'
|
||||
applicationIdSuffix 'beta2'
|
||||
versionNameSuffix = "dev"
|
||||
signingConfig signingConfigs.debug
|
||||
}
|
||||
beta {
|
||||
manifestPlaceholders icon_name: 'icon_beta', fileproviderPath: 'AndorsTrail.beta2'
|
||||
applicationIdSuffix 'beta2'
|
||||
versionNameSuffix = "beta"
|
||||
signingConfig signingConfigs.debug
|
||||
}
|
||||
}
|
||||
namespace 'com.gpl.rpg.AndorsTrail'
|
||||
|
||||
sourceSets {
|
||||
main {
|
||||
res.srcDirs = ['build/gen-res', 'src/main/res']
|
||||
assets.srcDirs = ['build/gen-assets', 'src/main/assets']
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
dependencies {
|
||||
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
|
||||
}
|
||||
|
||||
task copyRes(type: Copy) {
|
||||
description "Copies the res folder to the modules res folder (& renames .tmx to .xml)"
|
||||
from "${rootDir}/res"
|
||||
into "${projectDir}/build/gen-res"
|
||||
rename "(.*)\\.tmx", "\$1.xml"
|
||||
}
|
||||
|
||||
task copyResValuesIn(type: Copy) {
|
||||
description "Exception Indonesian language code (Old IN was renamed to now ID)"
|
||||
from "${rootDir}/res/values-id/"
|
||||
into "${projectDir}/build/gen-res/values-in/"
|
||||
}
|
||||
|
||||
task copyTranslation(type: Copy) {
|
||||
description("Copies the translation files to the modules translations folder")
|
||||
from "${rootDir}/assets/translation"
|
||||
into "${projectDir}/build/gen-assets/translation"
|
||||
}
|
||||
|
||||
task cleanup(type: Delete) {
|
||||
description("Deletes the assets/translation and the res folder from the modules folder")
|
||||
delete "${projectDir}/build/gen-res", "${projectDir}/build/gen-assets/translation"
|
||||
}
|
||||
|
||||
afterEvaluate {
|
||||
project.tasks.copyRes.dependsOn project.tasks.copyResValuesIn
|
||||
|
||||
mapReleaseSourceSetPaths.dependsOn project.tasks.copyRes
|
||||
generateReleaseResources.dependsOn project.tasks.copyRes
|
||||
|
||||
generateDebugResources.dependsOn project.tasks.copyRes
|
||||
mapDebugSourceSetPaths.dependsOn project.tasks.copyRes
|
||||
mergeDebugResources.dependsOn project.tasks.copyRes
|
||||
extractDeepLinksDebug.dependsOn project.tasks.copyRes
|
||||
mergeReleaseResources.dependsOn project.tasks.copyRes
|
||||
extractDeepLinksRelease.dependsOn project.tasks.copyRes
|
||||
|
||||
generateDebugResources.dependsOn project.tasks.copyTranslation
|
||||
mapDebugSourceSetPaths.dependsOn project.tasks.copyTranslation
|
||||
mergeDebugAssets.dependsOn project.tasks.copyTranslation
|
||||
mergeReleaseAssets.dependsOn project.tasks.copyTranslation
|
||||
extractDeepLinksDebug.dependsOn project.tasks.copyTranslation
|
||||
extractDeepLinksRelease.dependsOn project.tasks.copyTranslation
|
||||
|
||||
clean.dependsOn project.tasks.cleanup
|
||||
implementation 'com.android.support:support-v4:28.0.0'
|
||||
}
|
||||
|
||||
@@ -3,11 +3,15 @@
|
||||
<manifest
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
package="com.gpl.rpg.AndorsTrail"
|
||||
android:versionCode="82"
|
||||
android:versionName="0.8.15"
|
||||
android:versionCode="65"
|
||||
android:versionName="0.8.1"
|
||||
android:installLocation="auto"
|
||||
>
|
||||
|
||||
<uses-sdk
|
||||
android:minSdkVersion="4"
|
||||
android:targetSdkVersion="30"
|
||||
/>
|
||||
|
||||
<supports-screens
|
||||
android:smallScreens="true"
|
||||
android:normalScreens="true"
|
||||
@@ -23,7 +27,7 @@
|
||||
<application
|
||||
android:name="com.gpl.rpg.AndorsTrail.AndorsTrailApplication"
|
||||
android:label="@string/app_name"
|
||||
android:icon="@drawable/${icon_name}"
|
||||
android:icon="@drawable/icon"
|
||||
android:description="@string/app_description"
|
||||
android:allowBackup="true"
|
||||
android:theme="@style/AndorsTrailTheme_Blue"
|
||||
@@ -31,8 +35,7 @@
|
||||
android:hasFragileUserData="true"
|
||||
android:preserveLegacyExternalStorage="true"
|
||||
>
|
||||
<activity
|
||||
android:exported="true"
|
||||
<activity
|
||||
android:name="com.gpl.rpg.AndorsTrail.activity.StartScreenActivity"
|
||||
android:clearTaskOnLaunch="true"
|
||||
>
|
||||
@@ -63,8 +66,8 @@
|
||||
<activity android:name="com.gpl.rpg.AndorsTrail.activity.DisplayWorldMapActivity" />
|
||||
|
||||
<provider
|
||||
android:name="androidx.core.content.FileProvider"
|
||||
android:authorities="${applicationId}.fileprovider"
|
||||
android:name="android.support.v4.content.FileProvider"
|
||||
android:authorities="com.gpl.rpg.AndorsTrail.fileprovider"
|
||||
android:grantUriPermissions="true"
|
||||
android:exported="false">
|
||||
<meta-data
|
||||
|
||||
@@ -8,41 +8,31 @@ import com.gpl.rpg.AndorsTrail.context.ControllerContext;
|
||||
import com.gpl.rpg.AndorsTrail.context.WorldContext;
|
||||
import com.gpl.rpg.AndorsTrail.controller.Constants;
|
||||
import com.gpl.rpg.AndorsTrail.util.AndroidStorage;
|
||||
import com.gpl.rpg.AndorsTrail.util.Pair;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.app.Application;
|
||||
import android.content.Context;
|
||||
import android.content.res.Configuration;
|
||||
import android.content.res.Resources;
|
||||
import android.graphics.Insets;
|
||||
import android.os.Build;
|
||||
import android.os.Environment;
|
||||
import android.util.Pair;
|
||||
import android.view.View;
|
||||
import android.view.Window;
|
||||
import android.view.WindowInsets;
|
||||
import android.view.WindowInsetsController;
|
||||
import android.view.WindowManager;
|
||||
|
||||
import androidx.annotation.RequiresApi;
|
||||
|
||||
|
||||
public final class AndorsTrailApplication extends Application {
|
||||
public static final String CURRENT_VERSION_DISPLAY = BuildConfig.VERSION_NAME;
|
||||
public static final boolean IS_DEV_VERSION = CURRENT_VERSION_DISPLAY.endsWith("dev");
|
||||
public static final boolean IS_BETA_VERSION = CURRENT_VERSION_DISPLAY.endsWith("beta");
|
||||
public static final boolean IS_RELEASE_VERSION = !CURRENT_VERSION_DISPLAY.matches(".*[a-zA-Z].*");
|
||||
|
||||
public static final boolean DEVELOPMENT_DEBUGRESOURCES = false;
|
||||
public static final boolean DEVELOPMENT_FORCE_STARTNEWGAME = false;
|
||||
public static final boolean DEVELOPMENT_FORCE_CONTINUEGAME = false;
|
||||
public static final boolean DEVELOPMENT_DEBUGBUTTONS = IS_DEV_VERSION;
|
||||
public static final boolean DEVELOPMENT_DEBUGBUTTONS = false;
|
||||
public static final boolean DEVELOPMENT_FASTSPEED = false;
|
||||
public static final boolean DEVELOPMENT_VALIDATEDATA = IS_BETA_VERSION;
|
||||
public static final boolean DEVELOPMENT_DEBUGMESSAGES = IS_DEV_VERSION;
|
||||
public static final boolean DEVELOPMENT_VALIDATEDATA = false;
|
||||
public static final boolean DEVELOPMENT_DEBUGMESSAGES = false;
|
||||
public static final String CURRENT_VERSION_DISPLAY = "0.8.1";
|
||||
public static final boolean IS_RELEASE_VERSION = !CURRENT_VERSION_DISPLAY.matches(".*[a-d].*");
|
||||
public static final boolean DEVELOPMENT_INCOMPATIBLE_SAVEGAMES = DEVELOPMENT_DEBUGRESOURCES || DEVELOPMENT_DEBUGBUTTONS || DEVELOPMENT_FASTSPEED || !IS_RELEASE_VERSION;
|
||||
public static final int DEVELOPMENT_INCOMPATIBLE_SAVEGAME_VERSION = 999;
|
||||
public static final int CURRENT_VERSION = DEVELOPMENT_INCOMPATIBLE_SAVEGAMES ? DEVELOPMENT_INCOMPATIBLE_SAVEGAME_VERSION : BuildConfig.VERSION_CODE;
|
||||
public static final int CURRENT_VERSION = DEVELOPMENT_INCOMPATIBLE_SAVEGAMES ? DEVELOPMENT_INCOMPATIBLE_SAVEGAME_VERSION : 65;
|
||||
|
||||
private final AndorsTrailPreferences preferences = new AndorsTrailPreferences();
|
||||
private WorldContext world = new WorldContext();
|
||||
@@ -67,45 +57,13 @@ public final class AndorsTrailApplication extends Application {
|
||||
|
||||
public void setWindowParameters(Activity activity) {
|
||||
activity.requestWindowFeature(Window.FEATURE_NO_TITLE);
|
||||
}
|
||||
|
||||
public void setFullscreenMode(Activity activity) {
|
||||
setFullscreenMode(preferences.fullscreen, activity.getWindow());
|
||||
}
|
||||
public static void setFullscreenMode(boolean fullscreen, Window window) {
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) {
|
||||
|
||||
final WindowInsetsController insetsController = window.getInsetsController();
|
||||
if (insetsController != null) {
|
||||
insetsController.setSystemBarsBehavior(WindowInsetsController.BEHAVIOR_SHOW_TRANSIENT_BARS_BY_SWIPE);
|
||||
int insetType = WindowInsets.Type.statusBars();
|
||||
if (fullscreen) {
|
||||
insetsController.hide(insetType);
|
||||
} else {
|
||||
insetsController.show(insetType);
|
||||
}
|
||||
}
|
||||
if (preferences.fullscreen) {
|
||||
activity.getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
|
||||
} else {
|
||||
if (fullscreen) {
|
||||
window.setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
|
||||
|
||||
} else {
|
||||
window.setFlags(0, WindowManager.LayoutParams.FLAG_FULLSCREEN);
|
||||
}
|
||||
activity.getWindow().setFlags(0, WindowManager.LayoutParams.FLAG_FULLSCREEN);
|
||||
}
|
||||
}
|
||||
|
||||
@RequiresApi(Build.VERSION_CODES.R)
|
||||
public int getUsableTouchAreaInsetMask(){
|
||||
int i = 0;
|
||||
i |= WindowInsets.Type.displayCutout();
|
||||
i |= WindowInsets.Type.navigationBars();
|
||||
if (!preferences.fullscreen) {
|
||||
i |= WindowInsets.Type.statusBars();
|
||||
}
|
||||
return i;
|
||||
}
|
||||
|
||||
//Get default locale at startup, as somehow it seems that changing the app's
|
||||
//configured locale impacts the value returned by Locale.getDefault() nowadays.
|
||||
private final Locale defaultLocale = Locale.getDefault();
|
||||
@@ -208,18 +166,4 @@ public final class AndorsTrailApplication extends Application {
|
||||
controllers = new ControllerContext(this, world);
|
||||
setup = new WorldSetup(world, controllers, getApplicationContext());
|
||||
}
|
||||
|
||||
public void setUsablePadding(View root) {
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) {
|
||||
root.setOnApplyWindowInsetsListener((v, insets) -> {
|
||||
Insets bars = insets.getInsets(getUsableTouchAreaInsetMask());
|
||||
int left = Math.max(bars.left, v.getPaddingLeft());
|
||||
int top = Math.max(bars.top, v.getPaddingTop());
|
||||
int right = Math.max(bars.right, v.getPaddingRight());
|
||||
int bottom = Math.max(bars.bottom, v.getPaddingBottom());
|
||||
v.setPadding(left, top, right, bottom);
|
||||
return WindowInsets.CONSUMED;
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -78,7 +78,7 @@ public final class AndorsTrailPreferences {
|
||||
dest.dpadTransparency = Integer.parseInt(prefs.getString("dpadtransparency", Integer.toString(DPAD_TRANSPARENCY_50_PERCENT)));
|
||||
dest.dpadMinimizeable = prefs.getBoolean("dpadMinimizeable", true);
|
||||
dest.optimizedDrawing = prefs.getBoolean("optimized_drawing", false);
|
||||
dest.highQualityFilters = prefs.getBoolean("high_quality_filters", false);
|
||||
dest.highQualityFilters = prefs.getBoolean("high_quality_filters", true);
|
||||
dest.enableUiAnimations = prefs.getBoolean("enableUiAnimations", true);
|
||||
dest.displayOverwriteSavegame = Integer.parseInt(prefs.getString("display_overwrite_savegame", Integer.toString(CONFIRM_OVERWRITE_SAVEGAME_ALWAYS)));
|
||||
dest.quickslotsPosition = Integer.parseInt(prefs.getString("quickslots_placement", Integer.toString(QUICKSLOTS_POSITION_HORIZONTAL_CENTER_BOTTOM)));
|
||||
|
||||
@@ -15,7 +15,7 @@ import android.content.pm.PackageManager;
|
||||
import android.net.Uri;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import androidx.fragment.app.Fragment;
|
||||
import android.support.v4.app.Fragment;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.AdapterView;
|
||||
@@ -46,15 +46,14 @@ import com.gpl.rpg.AndorsTrail.model.item.Loot;
|
||||
import com.gpl.rpg.AndorsTrail.model.map.MapObject;
|
||||
import com.gpl.rpg.AndorsTrail.util.ThemeHelper;
|
||||
import com.gpl.rpg.AndorsTrail.view.CustomDialogFactory;
|
||||
import com.gpl.rpg.AndorsTrail.view.CustomDialogFactory.CustomDialog;
|
||||
import com.gpl.rpg.AndorsTrail.view.ItemContainerAdapter;
|
||||
|
||||
public final class Dialogs {
|
||||
|
||||
private static void showDialogAndPause(CustomDialog d, final ControllerContext context) {
|
||||
private static void showDialogAndPause(Dialog d, final ControllerContext context) {
|
||||
showDialogAndPause(d, context, null);
|
||||
}
|
||||
private static void showDialogAndPause(CustomDialog d, final ControllerContext context, final OnDismissListener onDismiss) {
|
||||
private static void showDialogAndPause(Dialog d, final ControllerContext context, final OnDismissListener onDismiss) {
|
||||
context.gameRoundController.pause();
|
||||
CustomDialogFactory.setDismissListener(d, new OnDismissListener() {
|
||||
@Override
|
||||
@@ -66,6 +65,14 @@ public final class Dialogs {
|
||||
CustomDialogFactory.show(d);
|
||||
}
|
||||
|
||||
public static void showKeyArea(final MainActivity currentActivity, final ControllerContext context, String phraseID) {
|
||||
showConversation(currentActivity, context, phraseID, null);
|
||||
}
|
||||
|
||||
public static void showMapSign(final MainActivity currentActivity, final ControllerContext context, String phraseID) {
|
||||
showConversation(currentActivity, context, phraseID, null);
|
||||
}
|
||||
|
||||
public static void showMapScriptMessage(final MainActivity currentActivity, final ControllerContext context, String phraseID) {
|
||||
showConversation(currentActivity, context, phraseID, null, false);
|
||||
}
|
||||
@@ -188,7 +195,7 @@ public final class Dialogs {
|
||||
// itemList.setPadding(20, 0, 20, 20);
|
||||
itemList.setAdapter(new ItemContainerAdapter(mainActivity, world.tileManager, combinedLoot.items, world.model.player));
|
||||
|
||||
final CustomDialog d = CustomDialogFactory.createDialog(mainActivity,
|
||||
final Dialog d = CustomDialogFactory.createDialog(mainActivity,
|
||||
mainActivity.getResources().getString(title),
|
||||
mainActivity.getResources().getDrawable(R.drawable.ui_icon_equipment),
|
||||
msg,
|
||||
@@ -242,7 +249,7 @@ public final class Dialogs {
|
||||
}
|
||||
|
||||
public static void showHeroDied(final MainActivity mainActivity, final ControllerContext controllers) {
|
||||
final CustomDialog d = CustomDialogFactory.createDialog(mainActivity,
|
||||
final Dialog d = CustomDialogFactory.createDialog(mainActivity,
|
||||
mainActivity.getResources().getString(R.string.dialog_game_over_title),
|
||||
mainActivity.getResources().getDrawable(R.drawable.ui_icon_combat),
|
||||
mainActivity.getResources().getString(R.string.dialog_game_over_text),
|
||||
@@ -279,7 +286,7 @@ public final class Dialogs {
|
||||
}
|
||||
|
||||
public static void showConfirmRest(final Activity currentActivity, final ControllerContext controllerContext, final MapObject area) {
|
||||
final CustomDialog d = CustomDialogFactory.createDialog(currentActivity,
|
||||
final Dialog d = CustomDialogFactory.createDialog(currentActivity,
|
||||
currentActivity.getResources().getString(R.string.dialog_rest_title),
|
||||
null,
|
||||
currentActivity.getResources().getString(R.string.dialog_rest_confirm_message),
|
||||
@@ -303,7 +310,7 @@ public final class Dialogs {
|
||||
// .setMessage(R.string.dialog_rest_message)
|
||||
// .setNeutralButton(android.R.string.ok, null)
|
||||
// .create();
|
||||
final CustomDialog d = CustomDialogFactory.createDialog(currentActivity,
|
||||
final Dialog d = CustomDialogFactory.createDialog(currentActivity,
|
||||
currentActivity.getResources().getString(R.string.dialog_rest_title),
|
||||
null,
|
||||
currentActivity.getResources().getString(R.string.dialog_rest_message),
|
||||
@@ -329,7 +336,7 @@ public final class Dialogs {
|
||||
text += currentActivity.getResources().getString(R.string.dialog_newversion_permission_information);
|
||||
}
|
||||
|
||||
final CustomDialog d = CustomDialogFactory.createDialog(currentActivity,
|
||||
final Dialog d = CustomDialogFactory.createDialog(currentActivity,
|
||||
currentActivity.getResources().getString(R.string.dialog_newversion_title),
|
||||
null,
|
||||
text,
|
||||
@@ -346,6 +353,7 @@ public final class Dialogs {
|
||||
CustomDialogFactory.show(d);
|
||||
}
|
||||
|
||||
@TargetApi(23)
|
||||
private static boolean hasPermissions(final Activity activity) {
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
|
||||
if (activity.getApplicationContext().checkSelfPermission(android.Manifest.permission.READ_EXTERNAL_STORAGE) != PackageManager.PERMISSION_GRANTED
|
||||
@@ -363,7 +371,7 @@ public final class Dialogs {
|
||||
}
|
||||
|
||||
if (!world.model.statistics.hasUnlimitedSaves()) {
|
||||
final CustomDialog d = CustomDialogFactory.createDialog(mainActivity,
|
||||
final Dialog d = CustomDialogFactory.createDialog(mainActivity,
|
||||
mainActivity.getResources().getString(R.string.menu_save_switch_character_title),
|
||||
null,
|
||||
mainActivity.getResources().getString(R.string.menu_save_switch_character),
|
||||
@@ -452,7 +460,7 @@ public final class Dialogs {
|
||||
itemList.setAdapter(new ArrayAdapter<String>(context, R.layout.combatlog_row, android.R.id.text1, combatLogMessages));
|
||||
view = itemList;
|
||||
|
||||
final CustomDialog d = CustomDialogFactory.createDialog(context,
|
||||
final Dialog d = CustomDialogFactory.createDialog(context,
|
||||
context.getResources().getString(R.string.combat_log_title),
|
||||
context.getResources().getDrawable(R.drawable.ui_icon_combat),
|
||||
null,
|
||||
|
||||
@@ -24,7 +24,9 @@ public final class AboutActivity extends AndorsTrailBaseActivity implements Imag
|
||||
super.onCreate(savedInstanceState);
|
||||
|
||||
AndorsTrailApplication app = AndorsTrailApplication.getApplicationFromActivity(this);
|
||||
initializeView(this, R.layout.about, R.id.about_root);
|
||||
app.setWindowParameters(this);
|
||||
|
||||
setContentView(R.layout.about);
|
||||
final Resources res = getResources();
|
||||
|
||||
final TextView tv = (TextView) findViewById(R.id.about_contents);
|
||||
|
||||
@@ -30,16 +30,14 @@ public final class ActorConditionInfoActivity extends AndorsTrailBaseActivity {
|
||||
|
||||
String conditionTypeID = getIntent().getData().getLastPathSegment();
|
||||
ActorConditionType conditionType = world.actorConditionsTypes.getActorConditionType(conditionTypeID);
|
||||
initializeView(this, R.layout.actorconditioninfo, R.id.actorconditioninfo_root);
|
||||
|
||||
setContentView(R.layout.actorconditioninfo);
|
||||
|
||||
|
||||
TextView tv = (TextView) findViewById(R.id.actorconditioninfo_title);
|
||||
tv.setText(conditionType.name);
|
||||
world.tileManager.setImageViewTile(getResources(), tv, conditionType);
|
||||
|
||||
TextView descriptionTv = (TextView) findViewById(R.id.actorconditioninfo_description);
|
||||
if(conditionType.description != null && !conditionType.description.isEmpty()) descriptionTv.setText(conditionType.description);
|
||||
else descriptionTv.setVisibility(View.GONE);
|
||||
|
||||
Button b = (Button) findViewById(R.id.actorconditioninfo_close);
|
||||
b.setOnClickListener(new OnClickListener() {
|
||||
@Override
|
||||
|
||||
@@ -2,10 +2,6 @@ package com.gpl.rpg.AndorsTrail.activity;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.os.Bundle;
|
||||
import android.view.View;
|
||||
|
||||
import androidx.annotation.IdRes;
|
||||
import androidx.annotation.LayoutRes;
|
||||
|
||||
import com.gpl.rpg.AndorsTrail.AndorsTrailApplication;
|
||||
|
||||
@@ -23,13 +19,5 @@ public abstract class AndorsTrailBaseActivity extends Activity {
|
||||
AndorsTrailApplication app = AndorsTrailApplication.getApplicationFromActivity(this);
|
||||
app.setLocale(this);
|
||||
}
|
||||
protected void initializeView(Activity activity, @LayoutRes int layoutId, @IdRes int rootViewId) {
|
||||
AndorsTrailApplication app = AndorsTrailApplication.getApplicationFromActivity(activity);
|
||||
app.setWindowParameters(activity);
|
||||
activity.setContentView(layoutId);
|
||||
View root = activity.findViewById(rootViewId);
|
||||
app.setUsablePadding(root);
|
||||
app.setFullscreenMode(activity);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,12 +1,7 @@
|
||||
package com.gpl.rpg.AndorsTrail.activity;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.os.Bundle;
|
||||
import android.view.View;
|
||||
|
||||
import androidx.annotation.IdRes;
|
||||
import androidx.annotation.LayoutRes;
|
||||
import androidx.fragment.app.FragmentActivity;
|
||||
import android.support.v4.app.FragmentActivity;
|
||||
|
||||
import com.gpl.rpg.AndorsTrail.AndorsTrailApplication;
|
||||
|
||||
@@ -24,13 +19,4 @@ public abstract class AndorsTrailBaseFragmentActivity extends FragmentActivity {
|
||||
AndorsTrailApplication app = AndorsTrailApplication.getApplicationFromActivity(this);
|
||||
app.setLocale(this);
|
||||
}
|
||||
|
||||
protected void initializeView(Activity activity, @LayoutRes int layoutId, @IdRes int rootViewId) {
|
||||
AndorsTrailApplication app = AndorsTrailApplication.getApplicationFromActivity(activity);
|
||||
app.setWindowParameters(activity);
|
||||
activity.setContentView(layoutId);
|
||||
View root = activity.findViewById(rootViewId);
|
||||
app.setUsablePadding(root);
|
||||
app.setFullscreenMode(activity);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -23,7 +23,6 @@ import com.gpl.rpg.AndorsTrail.controller.ItemController;
|
||||
import com.gpl.rpg.AndorsTrail.model.item.ItemType;
|
||||
import com.gpl.rpg.AndorsTrail.util.ThemeHelper;
|
||||
import com.gpl.rpg.AndorsTrail.view.CustomDialogFactory;
|
||||
import com.gpl.rpg.AndorsTrail.view.CustomDialogFactory.CustomDialog;
|
||||
|
||||
/**
|
||||
* @author ejwessel
|
||||
@@ -89,7 +88,8 @@ public final class BulkSelectionInterface extends AndorsTrailBaseActivity implem
|
||||
interfaceType = BulkInterfaceType.valueOf(params.getString("interfaceType"));
|
||||
|
||||
int intialSelection = 1;
|
||||
initializeView(this, R.layout.bulkselection, R.id.bulkselection_root);
|
||||
|
||||
setContentView(R.layout.bulkselection);
|
||||
|
||||
// initialize UI variables
|
||||
TextView bulkselection_action_type = (TextView)findViewById(R.id.bulkselection_action_type);
|
||||
@@ -206,7 +206,7 @@ public final class BulkSelectionInterface extends AndorsTrailBaseActivity implem
|
||||
// })
|
||||
// .setNegativeButton(android.R.string.no, null)
|
||||
// .show();
|
||||
final CustomDialog d = CustomDialogFactory.createDialog(v.getContext(),
|
||||
final Dialog d = CustomDialogFactory.createDialog(v.getContext(),
|
||||
v.getContext().getResources().getString(R.string.bulkselection_sell_confirmation_title),
|
||||
v.getContext().getResources().getDrawable(android.R.drawable.ic_dialog_info),
|
||||
message,
|
||||
|
||||
@@ -75,11 +75,13 @@ public final class ConversationActivity
|
||||
|
||||
requestWindowFeature(Window.FEATURE_NO_TITLE);
|
||||
|
||||
initializeView(this, R.layout.conversation, R.id.conversation_root);
|
||||
setContentView(R.layout.conversation);
|
||||
|
||||
setFinishOnTouchOutside(false);
|
||||
if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
|
||||
setFinishOnTouchOutside(false);
|
||||
}
|
||||
|
||||
replyGroup = new RadioGroup(this);
|
||||
replyGroup = new RadioGroup(this);
|
||||
replyGroup.setLayoutParams(new ListView.LayoutParams(ListView.LayoutParams.MATCH_PARENT, ListView.LayoutParams.WRAP_CONTENT));
|
||||
statementList = (ListView) findViewById(R.id.conversation_statements);
|
||||
statementList.addFooterView(replyGroup);
|
||||
|
||||
@@ -31,7 +31,6 @@ public final class DebugInterface {
|
||||
private DebugButton[] buttons;
|
||||
private List<DebugButton> tpButtons = new ArrayList<DebugButton>();
|
||||
private List<DebugButton> tpButtons2 = new ArrayList<DebugButton>();
|
||||
private List<DebugButton> tpButtons3 = new ArrayList<DebugButton>();
|
||||
|
||||
public DebugInterface(ControllerContext controllers, WorldContext world, MainActivity mainActivity) {
|
||||
this.controllerContext = controllers;
|
||||
@@ -59,9 +58,6 @@ public final class DebugInterface {
|
||||
for (DebugButton b : tpButtons2) {
|
||||
b.b.setVisibility(View.GONE);
|
||||
}
|
||||
for (DebugButton b : tpButtons3) {
|
||||
b.b.setVisibility(View.GONE);
|
||||
}
|
||||
}
|
||||
})
|
||||
,new DebugButton("teleport", new OnClickListener() {
|
||||
@@ -152,12 +148,6 @@ public final class DebugInterface {
|
||||
public void onClick(View arg0) {
|
||||
showToast(mainActivity, "DEBUG: map=" + world.model.currentMaps.map.name , Toast.LENGTH_SHORT);
|
||||
}
|
||||
})
|
||||
,new DebugButton("tim", new OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View arg0) {
|
||||
world.model.worldData.tickWorldTime(10);
|
||||
}
|
||||
})
|
||||
}));
|
||||
|
||||
@@ -188,7 +178,7 @@ public final class DebugInterface {
|
||||
,new DebugButton("cr", new OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View arg0) {
|
||||
controllerContext.movementController.placePlayerAsyncAt(MapObject.MapObjectType.newmap, "crossroads", "middle", 0, 0);
|
||||
controllerContext.movementController.placePlayerAsyncAt(MapObject.MapObjectType.newmap, "houseatcrossroads4", "down", 0, 0);
|
||||
}
|
||||
})
|
||||
,new DebugButton("lf", new OnClickListener() {
|
||||
@@ -252,8 +242,11 @@ public final class DebugInterface {
|
||||
new DebugButton("teleport", new OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View arg0) {
|
||||
for (DebugButton tpButton : tpButtons3) {
|
||||
tpButton.b.setVisibility(View.VISIBLE);
|
||||
for (int i = 0; i < buttons.length; i++) {
|
||||
buttons[i].b.setVisibility(View.VISIBLE);
|
||||
}
|
||||
for (DebugButton tpButton : tpButtons) {
|
||||
tpButton.b.setVisibility(View.GONE);
|
||||
}
|
||||
for (DebugButton tpButton : tpButtons2) {
|
||||
tpButton.b.setVisibility(View.GONE);
|
||||
@@ -284,173 +277,9 @@ public final class DebugInterface {
|
||||
controllerContext.movementController.placePlayerAsyncAt(MapObject.MapObjectType.newmap, "sullengard2", "south", 0, 0);
|
||||
}
|
||||
})
|
||||
,new DebugButton("gal", new OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View arg0) {
|
||||
controllerContext.movementController.placePlayerAsyncAt(MapObject.MapObjectType.newmap, "galmore_19", "south", 0, 0);
|
||||
}
|
||||
})
|
||||
|
||||
,new DebugButton("apl", new OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View arg0) {
|
||||
controllerContext.movementController.placePlayerAsyncAt(MapObject.MapObjectType.newmap, "sullengard_apple_farm_east", "house", 0, 0);
|
||||
}
|
||||
})
|
||||
|
||||
,new DebugButton("wch", new OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View arg0) {
|
||||
controllerContext.movementController.placePlayerAsyncAt(MapObject.MapObjectType.newmap, "lake_shore_road_0", "west", 0, 0);
|
||||
}
|
||||
})
|
||||
|
||||
,new DebugButton("la1", new OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View arg0) {
|
||||
controllerContext.movementController.placePlayerAsyncAt(MapObject.MapObjectType.newmap, "laerothisland2", "south2", 0, 0);
|
||||
}
|
||||
})
|
||||
|
||||
,new DebugButton("la2", new OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View arg0) {
|
||||
controllerContext.movementController.placePlayerAsyncAt(MapObject.MapObjectType.newmap, "island3", "cave", 0, 0);
|
||||
}
|
||||
})
|
||||
|
||||
,new DebugButton("wx", new OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View arg0) {
|
||||
controllerContext.movementController.placePlayerAsyncAt(MapObject.MapObjectType.newmap, "wexlow_village", "north", 0, 0);
|
||||
}
|
||||
})
|
||||
|
||||
,new DebugButton("fey", new OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View arg0) {
|
||||
controllerContext.movementController.placePlayerAsyncAt(MapObject.MapObjectType.newmap, "guynmart_wood_17", "north", 0, 0);
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
}));
|
||||
buttonList.addAll(tpButtons2);
|
||||
|
||||
tpButtons3.addAll(Arrays.asList(new DebugButton[] {
|
||||
new DebugButton("teleport", new OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View arg0) {
|
||||
for (int i = 0; i < buttons.length; i++) {
|
||||
buttons[i].b.setVisibility(View.VISIBLE);
|
||||
}
|
||||
for (DebugButton tpButton : tpButtons) {
|
||||
tpButton.b.setVisibility(View.GONE);
|
||||
}
|
||||
for (DebugButton tpButton : tpButtons2) {
|
||||
tpButton.b.setVisibility(View.GONE);
|
||||
}
|
||||
for (DebugButton tpButton : tpButtons3) {
|
||||
tpButton.b.setVisibility(View.GONE);
|
||||
}
|
||||
}
|
||||
})
|
||||
,new DebugButton("#1", new OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View arg0) {
|
||||
controllerContext.movementController.placePlayerAsyncAt(MapObject.MapObjectType.newmap, "lake_shore_road_9", "north", 5, 0);
|
||||
}
|
||||
})
|
||||
|
||||
,new DebugButton("#2", new OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View arg0) {
|
||||
controllerContext.movementController.placePlayerAsyncAt(MapObject.MapObjectType.newmap, "undertell_3_lava_01", "west", 0, 0);
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
,new DebugButton("#3", new OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View arg0) {
|
||||
controllerContext.movementController.placePlayerAsyncAt(MapObject.MapObjectType.newmap, "galmore_cavea", "up", 0, 0);
|
||||
}
|
||||
})
|
||||
|
||||
,new DebugButton("#4", new OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View arg0) {
|
||||
controllerContext.movementController.placePlayerAsyncAt(MapObject.MapObjectType.newmap, "galmore_35", "south", 11, 0);
|
||||
}
|
||||
})
|
||||
|
||||
,new DebugButton("#5", new OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View arg0) {
|
||||
controllerContext.movementController.placePlayerAsyncAt(MapObject.MapObjectType.newmap, "way_to_sullengard_west_5", "east", 0, 5);
|
||||
}
|
||||
})
|
||||
|
||||
,new DebugButton("#6", new OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View arg0) {
|
||||
controllerContext.movementController.placePlayerAsyncAt(MapObject.MapObjectType.newmap, "galmore_32", "south", 19, 0);
|
||||
}
|
||||
})
|
||||
|
||||
,new DebugButton("#7", new OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View arg0) {
|
||||
controllerContext.movementController.placePlayerAsyncAt(MapObject.MapObjectType.newmap, "cabin_norcity_road1", "north", 5, 0);
|
||||
}
|
||||
})
|
||||
|
||||
,new DebugButton("#8", new OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View arg0) {
|
||||
controllerContext.movementController.placePlayerAsyncAt(MapObject.MapObjectType.newmap, "wayto_feygard_duleian_2", "south", 0, 5);
|
||||
}
|
||||
})
|
||||
|
||||
,new DebugButton("#9", new OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View arg0) {
|
||||
controllerContext.movementController.placePlayerAsyncAt(MapObject.MapObjectType.newmap, "galmore_58", "north", 0, 0);
|
||||
}
|
||||
})
|
||||
|
||||
,new DebugButton("#10", new OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View arg0) {
|
||||
controllerContext.movementController.placePlayerAsyncAt(MapObject.MapObjectType.newmap, "moesforest_03", "north1", 0, 0);
|
||||
}
|
||||
})
|
||||
|
||||
,new DebugButton("#11", new OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View arg0) {
|
||||
controllerContext.movementController.placePlayerAsyncAt(MapObject.MapObjectType.newmap, "galmore_17", "outside", 0, 0);
|
||||
}
|
||||
})
|
||||
|
||||
,new DebugButton("#12", new OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View arg0) {
|
||||
controllerContext.movementController.placePlayerAsyncAt(MapObject.MapObjectType.newmap, "galmore_48", "west", 0, 10);
|
||||
}
|
||||
})
|
||||
|
||||
,new DebugButton("#13", new OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View arg0) {
|
||||
controllerContext.movementController.placePlayerAsyncAt(MapObject.MapObjectType.newmap, "feygard_outside1", "south", 6, 0);
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
}));
|
||||
buttonList.addAll(tpButtons3);
|
||||
|
||||
buttons = buttonList.toArray(new DebugButton[buttonList.size()]);
|
||||
addDebugButtons(buttons);
|
||||
|
||||
@@ -460,9 +289,6 @@ public final class DebugInterface {
|
||||
for (DebugButton b : tpButtons2) {
|
||||
b.b.setVisibility(View.GONE);
|
||||
}
|
||||
for (DebugButton b : tpButtons3) {
|
||||
b.b.setVisibility(View.GONE);
|
||||
}
|
||||
}
|
||||
|
||||
private void showToast(Context context, String msg, int duration) {
|
||||
|
||||
@@ -38,7 +38,10 @@ public final class DisplayWorldMapActivity extends AndorsTrailBaseActivity {
|
||||
AndorsTrailApplication app = AndorsTrailApplication.getApplicationFromActivity(this);
|
||||
if (!app.isInitialized()) { finish(); return; }
|
||||
this.world = app.getWorld();
|
||||
initializeView(this, R.layout.displayworldmap, R.id.worldmap_root);
|
||||
|
||||
app.setWindowParameters(this);
|
||||
|
||||
setContentView(R.layout.displayworldmap);
|
||||
|
||||
displayworldmap_webview = (WebView) findViewById(R.id.displayworldmap_webview);
|
||||
displayworldmap_webview.setBackgroundColor(ThemeHelper.getThemeColor(this, R.attr.ui_theme_displayworldmap_bg_color));
|
||||
|
||||
@@ -2,7 +2,7 @@ package com.gpl.rpg.AndorsTrail.activity;
|
||||
|
||||
import android.content.res.Resources;
|
||||
import android.os.Bundle;
|
||||
import androidx.fragment.app.FragmentTabHost;
|
||||
import android.support.v4.app.FragmentTabHost;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.ImageView;
|
||||
@@ -29,7 +29,10 @@ public final class HeroinfoActivity extends AndorsTrailBaseFragmentActivity {
|
||||
AndorsTrailApplication app = AndorsTrailApplication.getApplicationFromActivity(this);
|
||||
if (!app.isInitialized()) { finish(); return; }
|
||||
this.world = app.getWorld();
|
||||
initializeView(this, R.layout.tabbedlayout, android.R.id.tabhost);
|
||||
|
||||
app.setWindowParameters(this);
|
||||
|
||||
setContentView(R.layout.tabbedlayout);
|
||||
|
||||
Resources res = getResources();
|
||||
|
||||
|
||||
@@ -14,7 +14,6 @@ import android.widget.TextView;
|
||||
import com.gpl.rpg.AndorsTrail.AndorsTrailApplication;
|
||||
import com.gpl.rpg.AndorsTrail.R;
|
||||
import com.gpl.rpg.AndorsTrail.context.WorldContext;
|
||||
import com.gpl.rpg.AndorsTrail.controller.Constants;
|
||||
import com.gpl.rpg.AndorsTrail.model.item.ItemType;
|
||||
import com.gpl.rpg.AndorsTrail.util.ThemeHelper;
|
||||
import com.gpl.rpg.AndorsTrail.view.ItemEffectsView;
|
||||
@@ -46,7 +45,7 @@ public final class ItemInfoActivity extends AndorsTrailBaseActivity {
|
||||
boolean buttonEnabled = params.getBoolean("buttonEnabled");
|
||||
boolean moreButtonEnabled = params.getBoolean("moreActions");
|
||||
|
||||
initializeView(this, R.layout.iteminfo, R.id.iteminfo_root);
|
||||
setContentView(R.layout.iteminfo);
|
||||
|
||||
TextView tv = (TextView) findViewById(R.id.iteminfo_title);
|
||||
tv.setText(itemType.getName(world.model.player));
|
||||
@@ -55,7 +54,7 @@ public final class ItemInfoActivity extends AndorsTrailBaseActivity {
|
||||
tv = (TextView) findViewById(R.id.iteminfo_description);
|
||||
String description = itemType.getDescription();
|
||||
if (description != null) {
|
||||
tv.setText(description.replace(Constants.PLACEHOLDER_PLAYERNAME, world.model.player.getName()));
|
||||
tv.setText(description);
|
||||
tv.setVisibility(View.VISIBLE);
|
||||
} else {
|
||||
tv.setVisibility(View.GONE);
|
||||
@@ -68,10 +67,8 @@ public final class ItemInfoActivity extends AndorsTrailBaseActivity {
|
||||
itemType.effects_equip,
|
||||
itemType.effects_use == null ? null : Collections.singletonList(itemType.effects_use),
|
||||
itemType.effects_hit == null ? null : Collections.singletonList(itemType.effects_hit),
|
||||
itemType.effects_miss == null ? null : Collections.singletonList(itemType.effects_miss),
|
||||
itemType.effects_kill == null ? null : Collections.singletonList(itemType.effects_kill),
|
||||
itemType.effects_hitReceived == null ? null : Collections.singletonList(itemType.effects_hitReceived),
|
||||
itemType.effects_missReceived == null ? null : Collections.singletonList(itemType.effects_missReceived),
|
||||
null,
|
||||
itemType.isWeapon()
|
||||
);
|
||||
|
||||
@@ -37,7 +37,7 @@ public final class LevelUpActivity extends AndorsTrailBaseActivity {
|
||||
|
||||
requestWindowFeature(Window.FEATURE_NO_TITLE);
|
||||
|
||||
initializeView(this, R.layout.levelup, R.id.levelup_root);
|
||||
setContentView(R.layout.levelup);
|
||||
|
||||
levelup_title = (TextView) findViewById(R.id.levelup_title);
|
||||
levelup_description = (TextView) findViewById(R.id.levelup_description);
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -20,12 +20,11 @@ import com.gpl.rpg.AndorsTrail.savegames.Savegames;
|
||||
import com.gpl.rpg.AndorsTrail.util.ThemeHelper;
|
||||
import com.gpl.rpg.AndorsTrail.view.CloudsAnimatorView;
|
||||
import com.gpl.rpg.AndorsTrail.view.CustomDialogFactory;
|
||||
import com.gpl.rpg.AndorsTrail.view.CustomDialogFactory.CustomDialog;
|
||||
|
||||
public final class LoadingActivity extends AndorsTrailBaseActivity implements OnResourcesLoadedListener, OnSceneLoadedListener {
|
||||
|
||||
private WorldSetup setup;
|
||||
private CustomDialog progressDialog;
|
||||
private Dialog progressDialog;
|
||||
private CloudsAnimatorView clouds_back, clouds_mid, clouds_front;
|
||||
boolean loaded = false;
|
||||
|
||||
@@ -36,7 +35,8 @@ public final class LoadingActivity extends AndorsTrailBaseActivity implements On
|
||||
setTheme(ThemeHelper.getBaseTheme());
|
||||
super.onCreate(savedInstanceState);
|
||||
AndorsTrailApplication app = AndorsTrailApplication.getApplicationFromActivity(this);
|
||||
initializeView(this, R.layout.startscreen, R.id.startscreen_fragment_container);
|
||||
app.setWindowParameters(this);
|
||||
setContentView(R.layout.startscreen);
|
||||
|
||||
TextView tv = (TextView) findViewById(R.id.startscreen_version);
|
||||
tv.setVisibility(View.GONE);
|
||||
@@ -165,7 +165,7 @@ public final class LoadingActivity extends AndorsTrailBaseActivity implements On
|
||||
}
|
||||
|
||||
private void showLoadingFailedDialog(int messageResourceID) {
|
||||
final CustomDialog d = CustomDialogFactory.createDialog(this, getResources().getString(R.string.dialog_loading_failed_title), null, getResources().getString(messageResourceID), null, true);
|
||||
final Dialog d = CustomDialogFactory.createDialog(this, getResources().getString(R.string.dialog_loading_failed_title), null, getResources().getString(messageResourceID), null, true);
|
||||
CustomDialogFactory.addDismissButton(d, android.R.string.ok);
|
||||
CustomDialogFactory.setDismissListener(d, new OnDismissListener() {
|
||||
@Override
|
||||
|
||||
@@ -43,7 +43,6 @@ import com.gpl.rpg.AndorsTrail.util.Coord;
|
||||
import com.gpl.rpg.AndorsTrail.util.ThemeHelper;
|
||||
import com.gpl.rpg.AndorsTrail.view.CombatView;
|
||||
import com.gpl.rpg.AndorsTrail.view.CustomDialogFactory;
|
||||
import com.gpl.rpg.AndorsTrail.view.CustomDialogFactory.CustomDialog;
|
||||
import com.gpl.rpg.AndorsTrail.view.DisplayActiveActorConditionIcons;
|
||||
import com.gpl.rpg.AndorsTrail.view.ItemContainerAdapter;
|
||||
import com.gpl.rpg.AndorsTrail.view.MainView;
|
||||
@@ -91,9 +90,9 @@ public final class MainActivity
|
||||
AndorsTrailPreferences preferences = app.getPreferences();
|
||||
this.world = app.getWorld();
|
||||
this.controllers = app.getControllerContext();
|
||||
app.setWindowParameters(this);
|
||||
|
||||
initializeView(this, R.layout.main, R.id.main_container);
|
||||
|
||||
setContentView(R.layout.main);
|
||||
mainview = (MainView) findViewById(R.id.main_mainview);
|
||||
statusview = (StatusView) findViewById(R.id.main_statusview);
|
||||
combatview = (CombatView) findViewById(R.id.main_combatview);
|
||||
@@ -248,7 +247,7 @@ public final class MainActivity
|
||||
final ItemContainerAdapter inventoryListAdapter = new QuickslotsItemContainerAdapter(lv.getContext(), world.tileManager, world.model.player.inventory.usableItems(), world.model.player, wornTiles);
|
||||
lv.setAdapter(inventoryListAdapter);
|
||||
|
||||
final CustomDialog d = CustomDialogFactory.createDialog(v.getContext(),
|
||||
final Dialog d = CustomDialogFactory.createDialog(v.getContext(),
|
||||
v.getResources().getString(R.string.inventory_assign),
|
||||
v.getResources().getDrawable(R.drawable.ui_icon_equipment),
|
||||
v.getResources().getString(R.string.inventory_selectitem), view, false);
|
||||
@@ -397,10 +396,12 @@ public final class MainActivity
|
||||
|
||||
@Override
|
||||
public void onPlayerSteppedOnMapSignArea(MapObject area) {
|
||||
Dialogs.showMapSign(this, controllers, area.id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPlayerSteppedOnKeyArea(MapObject area) {
|
||||
Dialogs.showKeyArea(this, controllers, area.id);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -34,7 +34,7 @@ public final class MonsterEncounterActivity extends AndorsTrailBaseActivity {
|
||||
return;
|
||||
}
|
||||
|
||||
initializeView(this, R.layout.monsterencounter, R.id.monsterencounter_root);
|
||||
setContentView(R.layout.monsterencounter);
|
||||
|
||||
CharSequence difficulty = getText(MonsterInfoActivity.getMonsterDifficultyResource(controllers, monster));
|
||||
|
||||
|
||||
@@ -43,7 +43,7 @@ public final class MonsterInfoActivity extends AndorsTrailBaseActivity {
|
||||
this.controllers = app.getControllerContext();
|
||||
requestWindowFeature(Window.FEATURE_NO_TITLE);
|
||||
|
||||
initializeView(this, R.layout.monsterinfo, R.id.monsterinfo_root);
|
||||
setContentView(R.layout.monsterinfo);
|
||||
|
||||
monsterinfo_title = (TextView) findViewById(R.id.monsterinfo_title);
|
||||
monsterinfo_difficulty = (TextView) findViewById(R.id.monsterinfo_difficulty);
|
||||
@@ -90,10 +90,8 @@ public final class MonsterInfoActivity extends AndorsTrailBaseActivity {
|
||||
null,
|
||||
null,
|
||||
monster.getOnHitEffectsAsList(),
|
||||
monster.getOnMissEffectsAsList(),
|
||||
null,
|
||||
monster.getOnHitReceivedEffectsAsList(),
|
||||
monster.getOnMissReceivedEffectsAsList(),
|
||||
monster.getOnDeathEffects(),
|
||||
false);
|
||||
hp.update(monster.getMaxHP(), monster.getCurrentHP());
|
||||
|
||||
@@ -13,16 +13,17 @@ public final class Preferences extends PreferenceActivity {
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
setTheme(ThemeHelper.getBaseTheme());
|
||||
AndorsTrailApplication app = AndorsTrailApplication.getApplicationFromActivity(this);
|
||||
app.setWindowParameters(this);
|
||||
requestWindowFeature(Window.FEATURE_NO_TITLE);
|
||||
super.onCreate(savedInstanceState);
|
||||
app.setFullscreenMode(this);
|
||||
|
||||
AndorsTrailApplication app = AndorsTrailApplication.getApplicationFromActivity(this);
|
||||
if (app.getPreferences().fullscreen) {
|
||||
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
|
||||
} else {
|
||||
getWindow().setFlags(0, WindowManager.LayoutParams.FLAG_FULLSCREEN);
|
||||
}
|
||||
|
||||
app.setLocale(this);
|
||||
addPreferencesFromResource(R.xml.preferences);
|
||||
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -2,7 +2,7 @@ package com.gpl.rpg.AndorsTrail.activity;
|
||||
|
||||
import android.content.res.Resources;
|
||||
import android.os.Bundle;
|
||||
import androidx.fragment.app.FragmentTabHost;
|
||||
import android.support.v4.app.FragmentTabHost;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.ImageView;
|
||||
@@ -23,8 +23,9 @@ public final class ShopActivity extends AndorsTrailBaseFragmentActivity {
|
||||
|
||||
AndorsTrailApplication app = AndorsTrailApplication.getApplicationFromActivity(this);
|
||||
if (!app.isInitialized()) { finish(); return; }
|
||||
app.setWindowParameters(this);
|
||||
|
||||
initializeView(this, R.layout.tabbedlayout, android.R.id.tabhost);
|
||||
setContentView(R.layout.tabbedlayout);
|
||||
|
||||
final Resources res = getResources();
|
||||
|
||||
|
||||
@@ -31,7 +31,9 @@ public final class SkillInfoActivity extends AndorsTrailBaseActivity {
|
||||
final WorldContext world = app.getWorld();
|
||||
final Player player = world.model.player;
|
||||
|
||||
initializeView(this, R.layout.skill_info_view, R.id.skillinfo_root);
|
||||
app.setWindowParameters(this);
|
||||
|
||||
setContentView(R.layout.skill_info_view);
|
||||
|
||||
final Resources res = getResources();
|
||||
final Intent intent = getIntent();
|
||||
@@ -194,7 +196,7 @@ public final class SkillInfoActivity extends AndorsTrailBaseActivity {
|
||||
case armorProficiencyShield: return res.getString(R.string.skill_longdescription_armor_prof_shield, SkillCollection.PER_SKILLPOINT_INCREASE_SHIELD_PROF_DR);
|
||||
case armorProficiencyUnarmored: return res.getString(R.string.skill_longdescription_armor_prof_unarmored, SkillCollection.PER_SKILLPOINT_INCREASE_UNARMORED_BC);
|
||||
case armorProficiencyLight: return res.getString(R.string.skill_longdescription_armor_prof_light, SkillCollection.PER_SKILLPOINT_INCREASE_LIGHT_ARMOR_BC_PERCENT);
|
||||
case armorProficiencyHeavy: return res.getString(R.string.skill_longdescription_armor_prof_heavy, SkillCollection.PER_SKILLPOINT_INCREASE_HEAVY_ARMOR_BC_PERCENT, SkillCollection.PER_SKILLPOINT_INCREASE_HEAVY_ARMOR_MOVECOST_PERCENT, SkillCollection.PER_SKILLPOINT_INCREASE_HEAVY_ARMOR_ATKCOST_PERCENT, SkillCollection.PER_SKILLPOINT_INCREASE_HEAVY_ARMOR_USECOST_PERCENT);
|
||||
case armorProficiencyHeavy: return res.getString(R.string.skill_longdescription_armor_prof_heavy, SkillCollection.PER_SKILLPOINT_INCREASE_HEAVY_ARMOR_BC_PERCENT, SkillCollection.PER_SKILLPOINT_INCREASE_HEAVY_ARMOR_MOVECOST_PERCENT, SkillCollection.PER_SKILLPOINT_INCREASE_HEAVY_ARMOR_ATKCOST_PERCENT);
|
||||
case fightstyleDualWield: return res.getString(R.string.skill_longdescription_fightstyle_dualwield, SkillCollection.DUALWIELD_EFFICIENCY_LEVEL0, SkillCollection.DUALWIELD_EFFICIENCY_LEVEL1, SkillCollection.DUALWIELD_LEVEL1_OFFHAND_AP_COST_PERCENT, SkillCollection.DUALWIELD_EFFICIENCY_LEVEL2);
|
||||
case fightstyle2hand: return res.getString(R.string.skill_longdescription_fightstyle_2hand, SkillCollection.PER_SKILLPOINT_INCREASE_FIGHTSTYLE_2HAND_DMG_PERCENT);
|
||||
case fightstyleWeaponShield: return res.getString(R.string.skill_longdescription_fightstyle_weapon_shield, SkillCollection.PER_SKILLPOINT_INCREASE_FIGHTSTYLE_WEAPON_AC_PERCENT, SkillCollection.PER_SKILLPOINT_INCREASE_FIGHTSTYLE_SHIELD_BC_PERCENT);
|
||||
|
||||
@@ -11,7 +11,6 @@ import com.gpl.rpg.AndorsTrail.resource.tiles.TileManager;
|
||||
import com.gpl.rpg.AndorsTrail.util.ThemeHelper;
|
||||
import com.gpl.rpg.AndorsTrail.view.CloudsAnimatorView;
|
||||
import com.gpl.rpg.AndorsTrail.view.CustomDialogFactory;
|
||||
import com.gpl.rpg.AndorsTrail.view.CustomDialogFactory.CustomDialog;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.app.Dialog;
|
||||
@@ -21,10 +20,8 @@ import android.content.pm.PackageManager;
|
||||
import android.content.res.Resources;
|
||||
import android.graphics.drawable.AnimationDrawable;
|
||||
import android.os.Bundle;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.fragment.app.Fragment;
|
||||
import androidx.fragment.app.FragmentManager.OnBackStackChangedListener;
|
||||
import android.support.v4.app.Fragment;
|
||||
import android.support.v4.app.FragmentManager.OnBackStackChangedListener;
|
||||
import android.view.KeyEvent;
|
||||
import android.view.View;
|
||||
import android.view.ViewTreeObserver;
|
||||
@@ -51,9 +48,9 @@ public final class StartScreenActivity extends AndorsTrailBaseFragmentActivity i
|
||||
final Resources res = getResources();
|
||||
TileManager tileManager = app.getWorld().tileManager;
|
||||
tileManager.setDensity(res);
|
||||
app.setWindowParameters(this);
|
||||
|
||||
initializeView(this, R.layout.startscreen, R.id.startscreen_fragment_container);
|
||||
app.setFullscreenMode(this);
|
||||
setContentView(R.layout.startscreen);
|
||||
|
||||
if (findViewById(R.id.startscreen_fragment_container) != null) {
|
||||
StartScreenActivity_MainMenu mainMenu = new StartScreenActivity_MainMenu();
|
||||
@@ -69,11 +66,9 @@ public final class StartScreenActivity extends AndorsTrailBaseFragmentActivity i
|
||||
|
||||
|
||||
tv = (TextView) findViewById(R.id.startscreen_version);
|
||||
app.setUsablePadding(tv);
|
||||
tv.setText('v' + AndorsTrailApplication.CURRENT_VERSION_DISPLAY);
|
||||
|
||||
development_version = (TextView) findViewById(R.id.startscreen_dev_version);
|
||||
app.setUsablePadding((View) development_version.getParent());
|
||||
if (AndorsTrailApplication.DEVELOPMENT_INCOMPATIBLE_SAVEGAMES) {
|
||||
development_version.setText(R.string.startscreen_incompatible_savegames);
|
||||
development_version.setVisibility(View.VISIBLE);
|
||||
@@ -100,10 +95,6 @@ public final class StartScreenActivity extends AndorsTrailBaseFragmentActivity i
|
||||
}
|
||||
});
|
||||
}
|
||||
View titleLogo = findViewById(R.id.title_logo);
|
||||
if (titleLogo != null) {
|
||||
app.setUsablePadding(titleLogo);
|
||||
}
|
||||
|
||||
if (development_version.getVisibility() == View.VISIBLE) {
|
||||
development_version.setText(development_version.getText()
|
||||
@@ -120,10 +111,10 @@ public final class StartScreenActivity extends AndorsTrailBaseFragmentActivity i
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, int[] grantResults) {
|
||||
public void onRequestPermissionsResult(int requestCode, String[] permissions, int[] grantResults) {
|
||||
if (grantResults.length > 0 && grantResults[0] != PackageManager.PERMISSION_GRANTED) {
|
||||
|
||||
final CustomDialog d = CustomDialogFactory.createDialog(this,
|
||||
final Dialog d = CustomDialogFactory.createDialog(this,
|
||||
getResources().getString(R.string.dialog_permission_information_title),
|
||||
getResources().getDrawable(android.R.drawable.ic_dialog_info),
|
||||
getResources().getString(R.string.dialog_permission_information),
|
||||
|
||||
@@ -5,7 +5,7 @@ import java.util.Arrays;
|
||||
import android.app.Activity;
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
import androidx.fragment.app.Fragment;
|
||||
import android.support.v4.app.Fragment;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.Menu;
|
||||
import android.view.MenuInflater;
|
||||
|
||||
@@ -8,7 +8,7 @@ import java.util.Map;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
import androidx.fragment.app.Fragment;
|
||||
import android.support.v4.app.Fragment;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
|
||||
@@ -5,7 +5,7 @@ import java.util.ArrayList;
|
||||
import android.app.Activity;
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
import androidx.fragment.app.Fragment;
|
||||
import android.support.v4.app.Fragment;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
|
||||
@@ -5,7 +5,7 @@ import java.util.ArrayList;
|
||||
import android.content.Intent;
|
||||
import android.content.res.Resources;
|
||||
import android.os.Bundle;
|
||||
import androidx.fragment.app.Fragment;
|
||||
import android.support.v4.app.Fragment;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.View.OnClickListener;
|
||||
@@ -183,25 +183,19 @@ public final class HeroinfoActivity_Stats extends Fragment {
|
||||
);
|
||||
|
||||
ArrayList<ItemTraits_OnUse> effects_hit = new ArrayList<ItemTraits_OnUse>();
|
||||
ArrayList<ItemTraits_OnUse> effects_miss = new ArrayList<ItemTraits_OnUse>();
|
||||
ArrayList<ItemTraits_OnUse> effects_kill = new ArrayList<ItemTraits_OnUse>();
|
||||
ArrayList<ItemTraits_OnHitReceived> effects_hitReceived = new ArrayList<ItemTraits_OnHitReceived>();
|
||||
ArrayList<ItemTraits_OnHitReceived> effects_missReceived = new ArrayList<ItemTraits_OnHitReceived>();
|
||||
for (Inventory.WearSlot slot : Inventory.WearSlot.values()) {
|
||||
ItemType type = player.inventory.getItemTypeInWearSlot(slot);
|
||||
if (type == null) continue;
|
||||
if (type.effects_hit != null) effects_hit.add(type.effects_hit);
|
||||
if (type.effects_miss != null) effects_miss.add(type.effects_miss);
|
||||
if (type.effects_kill != null) effects_kill.add(type.effects_kill);
|
||||
if (type.effects_hitReceived != null) effects_hitReceived.add(type.effects_hitReceived);
|
||||
if (type.effects_missReceived != null) effects_missReceived.add(type.effects_missReceived);
|
||||
}
|
||||
if (effects_hit.isEmpty()) effects_hit = null;
|
||||
if (effects_miss.isEmpty()) effects_miss = null;
|
||||
if (effects_kill.isEmpty()) effects_kill = null;
|
||||
if (effects_hitReceived.isEmpty()) effects_hitReceived = null;
|
||||
if (effects_missReceived.isEmpty()) effects_missReceived = null;
|
||||
actorinfo_onhiteffects.update(null, null, effects_hit, effects_miss, effects_kill, effects_hitReceived,effects_missReceived, null, false);
|
||||
actorinfo_onhiteffects.update(null, null, effects_hit, effects_kill, effects_hitReceived, null, false);
|
||||
|
||||
|
||||
updateStatsTableRow(world.model.statistics.getNumberOfCompletedQuests(world), R.id.heroinfo_gamestats_quests, R.id.heroinfo_gamestats_quests_row);
|
||||
|
||||
@@ -4,7 +4,7 @@ import java.util.HashSet;
|
||||
|
||||
import android.content.res.Resources;
|
||||
import android.os.Bundle;
|
||||
import androidx.fragment.app.Fragment;
|
||||
import android.support.v4.app.Fragment;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
|
||||
@@ -24,7 +24,7 @@ public final class ShopActivity_Buy extends ShopActivityFragment {
|
||||
@Override
|
||||
public void onItemInfoClicked(int position, ItemType itemType) {
|
||||
int price = ItemController.getBuyingPrice(player, itemType);
|
||||
boolean enableButton = (price > 0 && ItemController.canAfford(player, price));
|
||||
boolean enableButton = ItemController.canAfford(player, price);
|
||||
String text = getResources().getString(R.string.shop_buyitem, price);
|
||||
Intent intent = Dialogs.getIntentForItemInfo(getActivity(), itemType.id, ItemInfoActivity.ItemInfoAction.buy, text, enableButton, null);
|
||||
startActivityForResult(intent, INTENTREQUEST_ITEMINFO);
|
||||
|
||||
@@ -12,7 +12,7 @@ import android.content.SharedPreferences.Editor;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import androidx.fragment.app.Fragment;
|
||||
import android.support.v4.app.Fragment;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.View.OnClickListener;
|
||||
@@ -38,37 +38,37 @@ import com.gpl.rpg.AndorsTrail.util.AndroidStorage;
|
||||
import com.gpl.rpg.AndorsTrail.util.L;
|
||||
import com.gpl.rpg.AndorsTrail.util.ThemeHelper;
|
||||
import com.gpl.rpg.AndorsTrail.view.CustomDialogFactory;
|
||||
import com.gpl.rpg.AndorsTrail.view.CustomDialogFactory.CustomDialog;
|
||||
|
||||
public class StartScreenActivity_MainMenu extends Fragment {
|
||||
|
||||
private static final int INTENTREQUEST_PREFERENCES = 7;
|
||||
public static final int INTENTREQUEST_LOADGAME = 9;
|
||||
private static final int INTENTREQUEST_PREFERENCES = 7;
|
||||
public static final int INTENTREQUEST_LOADGAME = 9;
|
||||
|
||||
private boolean hasExistingGame = false;
|
||||
private Button startscreen_continue;
|
||||
private Button startscreen_newgame;
|
||||
private Button startscreen_load;
|
||||
private ViewGroup save_preview_holder;
|
||||
private ImageView save_preview_hero_icon;
|
||||
private TextView save_preview_hero_desc;
|
||||
private boolean hasExistingGame = false;
|
||||
private Button startscreen_continue;
|
||||
private Button startscreen_newgame;
|
||||
private Button startscreen_load;
|
||||
private ViewGroup save_preview_holder;
|
||||
private ImageView save_preview_hero_icon;
|
||||
private TextView save_preview_hero_desc;
|
||||
|
||||
|
||||
@Override
|
||||
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
|
||||
updatePreferences(false);
|
||||
super.onCreateView(inflater, container, savedInstanceState);
|
||||
|
||||
|
||||
@Override
|
||||
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
|
||||
updatePreferences(false);
|
||||
super.onCreateView(inflater, container, savedInstanceState);
|
||||
|
||||
if (container != null) {
|
||||
container.removeAllViews();
|
||||
}
|
||||
|
||||
View root = inflater.inflate(R.layout.startscreen_mainmenu, container, false);
|
||||
|
||||
|
||||
save_preview_holder = (ViewGroup) root.findViewById(R.id.save_preview_holder);
|
||||
save_preview_hero_icon = (ImageView) root.findViewById(R.id.save_preview_hero_icon);
|
||||
save_preview_hero_desc = (TextView) root.findViewById(R.id.save_preview_hero_desc);
|
||||
|
||||
|
||||
|
||||
startscreen_continue = (Button) root.findViewById(R.id.startscreen_continue);
|
||||
startscreen_continue.setOnClickListener(new OnClickListener() {
|
||||
@@ -114,7 +114,7 @@ public class StartScreenActivity_MainMenu extends Fragment {
|
||||
AndorsTrailApplication app = AndorsTrailApplication.getApplicationFromActivity(getActivity());
|
||||
if (hasExistingGame && app != null && app.getWorld() != null && app.getWorld().model != null
|
||||
&& app.getWorld().model.statistics != null && !app.getWorld().model.statistics.hasUnlimitedSaves()) {
|
||||
final CustomDialog d = CustomDialogFactory.createDialog(getActivity(),
|
||||
final Dialog d = CustomDialogFactory.createDialog(getActivity(),
|
||||
getString(R.string.startscreen_load_game),
|
||||
getResources().getDrawable(android.R.drawable.ic_delete),
|
||||
getString(R.string.startscreen_load_game_confirm),
|
||||
@@ -134,7 +134,7 @@ public class StartScreenActivity_MainMenu extends Fragment {
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
|
||||
if (AndorsTrailApplication.DEVELOPMENT_FORCE_STARTNEWGAME) {
|
||||
if (AndorsTrailApplication.DEVELOPMENT_DEBUGRESOURCES) {
|
||||
@@ -152,14 +152,14 @@ public class StartScreenActivity_MainMenu extends Fragment {
|
||||
checkAndRequestPermissions(getActivity());
|
||||
migrateDataOnDemand(getActivity());
|
||||
}
|
||||
|
||||
|
||||
return root;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void onResume() {
|
||||
super.onResume();
|
||||
|
||||
|
||||
String playerName;
|
||||
String displayInfo = null;
|
||||
int iconID = TileManager.CHAR_HERO;
|
||||
@@ -189,26 +189,38 @@ public class StartScreenActivity_MainMenu extends Fragment {
|
||||
setCurrentVersionForVersionCheck();
|
||||
checkAndRequestPermissions(getActivity());
|
||||
migrateDataOnDemand(getActivity());
|
||||
boolean hasSavegames = !Savegames.getUsedSavegameSlots(getActivity()).isEmpty();
|
||||
startscreen_load.setEnabled(hasSavegames);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
boolean hasSavegames = !Savegames.getUsedSavegameSlots(getActivity()).isEmpty();
|
||||
startscreen_load.setEnabled(hasSavegames);
|
||||
}
|
||||
|
||||
@TargetApi(29)
|
||||
public void migrateDataOnDemand(final Activity activity) {
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) {
|
||||
if (activity.getApplicationContext().checkSelfPermission(Manifest.permission.READ_EXTERNAL_STORAGE) == PackageManager.PERMISSION_GRANTED) {
|
||||
if (AndroidStorage.shouldMigrateToInternalStorage(activity.getApplicationContext())) {
|
||||
final CustomDialog d = CustomDialogFactory.createDialog(activity,
|
||||
final Dialog d = CustomDialogFactory.createDialog(activity,
|
||||
getString(R.string.startscreen_migration_title),
|
||||
activity.getResources().getDrawable(android.R.drawable.ic_dialog_alert),
|
||||
getString(R.string.startscreen_migration_text),
|
||||
null,
|
||||
true);
|
||||
CustomDialogFactory.addDismissButton(d, android.R.string.ok);
|
||||
d.setOnDismissListener(new DialogInterface.OnDismissListener() {
|
||||
@Override
|
||||
public void onDismiss(DialogInterface arg0) {
|
||||
boolean hasSavegames = !Savegames.getUsedSavegameSlots(getActivity()).isEmpty();
|
||||
startscreen_load.setEnabled(hasSavegames);
|
||||
}
|
||||
});
|
||||
CustomDialogFactory.show(d);
|
||||
if (!AndroidStorage.migrateToInternalStorage(activity.getApplicationContext())) {
|
||||
final CustomDialog errorDlg = CustomDialogFactory.createDialog(activity,
|
||||
final Dialog errorDlg = CustomDialogFactory.createDialog(activity,
|
||||
getString(R.string.startscreen_migration_title),
|
||||
activity.getResources().getDrawable(android.R.drawable.ic_dialog_alert),
|
||||
getString(R.string.startscreen_migration_failure),
|
||||
@@ -230,6 +242,7 @@ public class StartScreenActivity_MainMenu extends Fragment {
|
||||
private static final int READ_EXTERNAL_STORAGE_REQUEST=1;
|
||||
private static final int WRITE_EXTERNAL_STORAGE_REQUEST=2;
|
||||
|
||||
@TargetApi(23)
|
||||
public static void checkAndRequestPermissions(final Activity activity) {
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M && Build.VERSION.SDK_INT <= Build.VERSION_CODES.Q) {
|
||||
if (activity.getApplicationContext().checkSelfPermission(Manifest.permission.READ_EXTERNAL_STORAGE) != PackageManager.PERMISSION_GRANTED) {
|
||||
@@ -246,13 +259,13 @@ public class StartScreenActivity_MainMenu extends Fragment {
|
||||
super.onAttach(activity);
|
||||
listener = (OnNewGameRequestedListener) activity;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void onDetach() {
|
||||
super.onDetach();
|
||||
listener = null;
|
||||
}
|
||||
|
||||
|
||||
private void setButtonState(final String playerName, final String displayInfo, int iconID, boolean isDead) {
|
||||
startscreen_continue.setEnabled(hasExistingGame && !isDead);
|
||||
startscreen_newgame.setEnabled(true);
|
||||
@@ -292,9 +305,9 @@ public class StartScreenActivity_MainMenu extends Fragment {
|
||||
// .create().show();
|
||||
//
|
||||
//
|
||||
final CustomDialog d = CustomDialogFactory.createDialog(getActivity(),
|
||||
getString(R.string.startscreen_newgame),
|
||||
getResources().getDrawable(android.R.drawable.ic_delete),
|
||||
final Dialog d = CustomDialogFactory.createDialog(getActivity(),
|
||||
getString(R.string.startscreen_newgame),
|
||||
getResources().getDrawable(android.R.drawable.ic_delete),
|
||||
getResources().getString(R.string.startscreen_newgame_confirm),
|
||||
null,
|
||||
true);
|
||||
@@ -305,9 +318,9 @@ public class StartScreenActivity_MainMenu extends Fragment {
|
||||
}
|
||||
});
|
||||
CustomDialogFactory.addDismissButton(d, android.R.string.cancel);
|
||||
|
||||
|
||||
CustomDialogFactory.show(d);
|
||||
|
||||
|
||||
}
|
||||
|
||||
private static final String versionCheck = "lastversion";
|
||||
@@ -324,90 +337,64 @@ public class StartScreenActivity_MainMenu extends Fragment {
|
||||
e.putInt(versionCheck, AndorsTrailApplication.CURRENT_VERSION);
|
||||
e.commit();
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public void onActivityResult(int requestCode, int resultCode, Intent data) {
|
||||
super.onActivityResult(requestCode, resultCode, data);
|
||||
switch (requestCode) {
|
||||
case INTENTREQUEST_LOADGAME:
|
||||
boolean unsuccessful = resultCode != Activity.RESULT_OK;
|
||||
if(data == null) break;
|
||||
|
||||
final boolean wasImportOrExport = data.getBooleanExtra("import_export", false);
|
||||
if (wasImportOrExport) {
|
||||
String message = getImportExportMessage(!unsuccessful, data);
|
||||
Toast.makeText(getActivity(), message, Toast.LENGTH_LONG).show();
|
||||
break;
|
||||
}
|
||||
if (unsuccessful) break;
|
||||
final int slot = data.getIntExtra("slot", 1);
|
||||
continueGame(false, slot, null);
|
||||
break;
|
||||
case INTENTREQUEST_PREFERENCES:
|
||||
updatePreferences(true);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
private String getImportExportMessage(boolean successful, Intent data) {
|
||||
String message = "";
|
||||
boolean isImportWorldmap = data.getBooleanExtra("import_worldmap", false);
|
||||
boolean isImportSaves = data.getBooleanExtra("import_savegames", false);
|
||||
boolean isExport = data.getBooleanExtra("export", false);
|
||||
|
||||
if(isImportWorldmap) {
|
||||
message = getString(successful ? R.string.loadsave_import_worldmap_successfull : R.string.loadsave_import_worldmap_unsuccessfull);
|
||||
} else if(isImportSaves) {
|
||||
message = getString(successful ? R.string.loadsave_import_save_successfull : R.string.loadsave_import_save_unsuccessfull);
|
||||
} else if(isExport) {
|
||||
message = getString(successful ? R.string.loadsave_export_successfull : R.string.loadsave_export_unsuccessfull);
|
||||
@Override
|
||||
public void onActivityResult(int requestCode, int resultCode, Intent data) {
|
||||
super.onActivityResult(requestCode, resultCode, data);
|
||||
switch (requestCode) {
|
||||
case INTENTREQUEST_LOADGAME:
|
||||
if (resultCode != Activity.RESULT_OK) break;
|
||||
final int slot = data.getIntExtra("slot", 1);
|
||||
continueGame(false, slot, null);
|
||||
break;
|
||||
case INTENTREQUEST_PREFERENCES:
|
||||
updatePreferences(true);
|
||||
break;
|
||||
}
|
||||
|
||||
return message;
|
||||
}
|
||||
|
||||
private void updatePreferences(boolean alreadyStartedLoadingResources) {
|
||||
AndorsTrailApplication app = AndorsTrailApplication.getApplicationFromActivity(getActivity());
|
||||
AndorsTrailPreferences preferences = app.getPreferences();
|
||||
preferences.read(getActivity());
|
||||
if (app.setLocale(getActivity())) {
|
||||
if (alreadyStartedLoadingResources) {
|
||||
// Changing the locale after having loaded the game requires resources to
|
||||
// be re-loaded. Therefore, we just exit here.
|
||||
Toast.makeText(getActivity(), R.string.change_locale_requires_restart, Toast.LENGTH_LONG).show();
|
||||
doFinish();
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (ThemeHelper.changeTheme(preferences.selectedTheme)) {
|
||||
// Changing the theme requires a restart to re-create all activities.
|
||||
Toast.makeText(getActivity(), R.string.change_theme_requires_restart, Toast.LENGTH_LONG).show();
|
||||
doFinish();
|
||||
return;
|
||||
}
|
||||
app.getWorld().tileManager.updatePreferences(preferences);
|
||||
}
|
||||
|
||||
@SuppressLint("NewApi")
|
||||
private void doFinish() {
|
||||
//For Lollipop and above
|
||||
((AndorsTrailApplication)getActivity().getApplication()).discardWorld();
|
||||
getActivity().finish();
|
||||
}
|
||||
|
||||
private void updatePreferences(boolean alreadyStartedLoadingResources) {
|
||||
AndorsTrailApplication app = AndorsTrailApplication.getApplicationFromActivity(getActivity());
|
||||
AndorsTrailPreferences preferences = app.getPreferences();
|
||||
preferences.read(getActivity());
|
||||
if (app.setLocale(getActivity())) {
|
||||
if (alreadyStartedLoadingResources) {
|
||||
// Changing the locale after having loaded the game requires resources to
|
||||
// be re-loaded. Therefore, we just exit here.
|
||||
Toast.makeText(getActivity(), R.string.change_locale_requires_restart, Toast.LENGTH_LONG).show();
|
||||
doFinish();
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (ThemeHelper.changeTheme(preferences.selectedTheme)) {
|
||||
// Changing the theme requires a restart to re-create all activities.
|
||||
Toast.makeText(getActivity(), R.string.change_theme_requires_restart, Toast.LENGTH_LONG).show();
|
||||
doFinish();
|
||||
return;
|
||||
}
|
||||
app.getWorld().tileManager.updatePreferences(preferences);
|
||||
}
|
||||
|
||||
@SuppressLint("NewApi")
|
||||
private void doFinish() {
|
||||
//For Lollipop and above
|
||||
((AndorsTrailApplication) getActivity().getApplication()).discardWorld();
|
||||
getActivity().finish();
|
||||
}
|
||||
|
||||
|
||||
|
||||
public interface OnNewGameRequestedListener {
|
||||
public void onNewGameRequested();
|
||||
}
|
||||
|
||||
|
||||
private OnNewGameRequestedListener listener = null;
|
||||
|
||||
|
||||
private void createNewGame() {
|
||||
if (listener != null) {
|
||||
listener.onNewGameRequested();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -3,8 +3,7 @@ package com.gpl.rpg.AndorsTrail.activity.fragment;
|
||||
import android.app.Activity;
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
|
||||
import androidx.fragment.app.Fragment;
|
||||
import android.support.v4.app.Fragment;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.View.OnClickListener;
|
||||
@@ -40,7 +39,8 @@ public class StartScreenActivity_NewGame extends Fragment {
|
||||
}
|
||||
|
||||
View root = inflater.inflate(R.layout.startscreen_newgame, container, false);
|
||||
|
||||
|
||||
|
||||
startscreen_enterheroname = (TextView) root.findViewById(R.id.startscreen_enterheroname);
|
||||
|
||||
new SpinnerEmulator(root, R.id.startscreen_mode_selector_button, R.array.startscreen_mode_selector, R.string.startscreen_game_mode) {
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
package com.gpl.rpg.AndorsTrail.context;
|
||||
|
||||
import com.gpl.rpg.AndorsTrail.model.ChecksumBuilder;
|
||||
import com.gpl.rpg.AndorsTrail.model.ModelContainer;
|
||||
import com.gpl.rpg.AndorsTrail.model.ability.ActorConditionTypeCollection;
|
||||
import com.gpl.rpg.AndorsTrail.model.ability.SkillCollection;
|
||||
@@ -14,8 +13,6 @@ import com.gpl.rpg.AndorsTrail.resource.ConversationLoader;
|
||||
import com.gpl.rpg.AndorsTrail.resource.VisualEffectCollection;
|
||||
import com.gpl.rpg.AndorsTrail.resource.tiles.TileManager;
|
||||
|
||||
import java.security.DigestException;
|
||||
|
||||
public final class WorldContext {
|
||||
//Objectcollections
|
||||
public final ConversationLoader conversationLoader;
|
||||
@@ -65,11 +62,4 @@ public final class WorldContext {
|
||||
public void resetForNewGame() {
|
||||
maps.resetForNewGame();
|
||||
}
|
||||
|
||||
public byte[] getChecksum() throws DigestException {
|
||||
ChecksumBuilder checksumBuilder = new ChecksumBuilder();
|
||||
model.addToChecksum(checksumBuilder);
|
||||
maps.addToChecksum(checksumBuilder, this);
|
||||
return checksumBuilder.build();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -76,7 +76,8 @@ public final class ActorStatsController {
|
||||
c.magnitude -= magnitude;
|
||||
actorConditionListeners.onActorConditionMagnitudeChanged(actor, c);
|
||||
} else {
|
||||
actorConditionsRemove(actor, c, i);
|
||||
actor.conditions.remove(i);
|
||||
actorConditionListeners.onActorConditionRemoved(actor, c);
|
||||
}
|
||||
break;
|
||||
}
|
||||
@@ -231,9 +232,9 @@ public final class ActorStatsController {
|
||||
public void removeAllTemporaryConditions(final Actor actor) {
|
||||
for(int i = actor.conditions.size() - 1; i >= 0; --i) {
|
||||
ActorCondition c = actor.conditions.get(i);
|
||||
if (c.isTemporaryEffect() || c.isDurationForeverUntilSleep()) {
|
||||
actorConditionsRemove(actor, c, i);
|
||||
}
|
||||
if (!c.isTemporaryEffect()) continue;
|
||||
actor.conditions.remove(i);
|
||||
actorConditionListeners.onActorConditionRemoved(actor, c);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -241,7 +242,8 @@ public final class ActorStatsController {
|
||||
for(int i = actor.conditions.size() - 1; i >= 0; --i) {
|
||||
ActorCondition c = actor.conditions.get(i);
|
||||
if (!c.conditionType.conditionTypeID.equals(conditionTypeID)) continue;
|
||||
actorConditionsRemove(actor, c, i);
|
||||
actor.conditions.remove(i);
|
||||
actorConditionListeners.onActorConditionRemoved(actor, c);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -404,14 +406,14 @@ public final class ActorStatsController {
|
||||
ActorCondition c = actor.conditions.get(i);
|
||||
if (!c.isTemporaryEffect()) continue;
|
||||
if (c.duration <= 1) {
|
||||
actorConditionsRemove(actor, c, i);
|
||||
actor.conditions.remove(i);
|
||||
actorConditionListeners.onActorConditionRemoved(actor, c);
|
||||
removedAnyConditions = true;
|
||||
} else {
|
||||
c.duration -= 1;
|
||||
actorConditionListeners.onActorConditionDurationChanged(actor, c);
|
||||
}
|
||||
}
|
||||
// Immunities
|
||||
for(int i = actor.immunities.size() - 1; i >= 0; --i) {
|
||||
ActorCondition c = actor.immunities.get(i);
|
||||
if (!c.isTemporaryEffect()) continue;
|
||||
@@ -455,50 +457,6 @@ public final class ActorStatsController {
|
||||
}
|
||||
}
|
||||
|
||||
int actorConditionsRemove(Actor actor, ActorCondition c, int i) {
|
||||
int magnitude = 0; //default: No condition from worn items
|
||||
|
||||
if (actor instanceof Player) {
|
||||
Player player = (Player) actor;
|
||||
magnitude = gotConditionFromWornItem(player, c);
|
||||
if (magnitude > 0) { //condition from worn items?
|
||||
c.magnitude = magnitude; // -> readd condition
|
||||
actorConditionListeners.onActorConditionMagnitudeChanged(actor, c);
|
||||
c.duration = ActorCondition.DURATION_FOREVER;
|
||||
actorConditionListeners.onActorConditionDurationChanged(actor, c);
|
||||
}
|
||||
}
|
||||
if (magnitude == 0) {
|
||||
actor.conditions.remove(i);
|
||||
actorConditionListeners.onActorConditionRemoved(actor, c);
|
||||
}
|
||||
|
||||
return magnitude;
|
||||
}
|
||||
|
||||
int gotConditionFromWornItem(Player player, ActorCondition c) {
|
||||
int magnitude = 0; //Default: No worn item with this condition
|
||||
|
||||
for (Inventory.WearSlot slot : Inventory.WearSlot.values()) {
|
||||
ItemType t = player.inventory.getItemTypeInWearSlot(slot);
|
||||
if (t == null) continue;
|
||||
ItemTraits_OnEquip equipEffects = t.effects_equip;
|
||||
if (equipEffects == null) continue;
|
||||
if (equipEffects.addedConditions == null) continue;
|
||||
for (ActorConditionEffect e : equipEffects.addedConditions) {
|
||||
if (e.conditionType.conditionTypeID.equals(c.conditionType.conditionTypeID)) {
|
||||
if (e.magnitude == ActorCondition.MAGNITUDE_REMOVE_ALL) {
|
||||
return 0; //On an item-based immunity the result is always 0
|
||||
}
|
||||
if (magnitude < e.magnitude) {
|
||||
magnitude = e.magnitude;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return magnitude;
|
||||
}
|
||||
|
||||
public void applyUseEffect(Actor source, Actor target, ItemTraits_OnUse effect) {
|
||||
if (effect == null) return;
|
||||
|
||||
|
||||
@@ -250,8 +250,7 @@ public final class CombatController implements VisualEffectCompletedCallback {
|
||||
if (!loot.hasItemsOrGold()) {
|
||||
world.model.currentMaps.map.removeGroundLoot(loot);
|
||||
} else if (world.model.uiSelections.isInCombat) {
|
||||
if(!killedMonsterBags.contains(loot))
|
||||
killedMonsterBags.add(loot);
|
||||
killedMonsterBags.add(loot);
|
||||
}
|
||||
|
||||
combatActionListeners.onPlayerKilledMonster(killedMonster);
|
||||
@@ -580,13 +579,6 @@ public final class CombatController implements VisualEffectCompletedCallback {
|
||||
private static final int n = 50;
|
||||
private static final int F = 40;
|
||||
private static final float two_divided_by_PI = (float) (2f / Math.PI);
|
||||
/**
|
||||
* @implNote
|
||||
* formula: 50 * (1 + (2 / pi) * atan((attackChance - blockChance - n) / F))
|
||||
* <br/>
|
||||
* n = {@value n}; F = {@value F}
|
||||
* @return [0..100] . 100 == always hit.
|
||||
*/
|
||||
private static int getAttackHitChance(final Actor attacker, final Actor target) {
|
||||
final int c = attacker.getAttackChance() - target.getBlockChance();
|
||||
// (2/pi)*atan(..) will vary from -1 to +1 .
|
||||
@@ -595,10 +587,7 @@ public final class CombatController implements VisualEffectCompletedCallback {
|
||||
|
||||
private AttackResult attack(final Actor attacker, final Actor target) {
|
||||
int hitChance = getAttackHitChance(attacker, target);
|
||||
if (!Constants.roll100(hitChance)) {
|
||||
applyAttackMissStatusEffects(attacker, target);
|
||||
return AttackResult.MISS;
|
||||
}
|
||||
if (!Constants.roll100(hitChance)) return AttackResult.MISS;
|
||||
|
||||
int damage = Constants.rollValue(attacker.getDamagePotential());
|
||||
boolean isCriticalHit = false;
|
||||
@@ -632,21 +621,6 @@ public final class CombatController implements VisualEffectCompletedCallback {
|
||||
}
|
||||
}
|
||||
|
||||
private void applyAttackMissStatusEffects(Actor attacker, Actor target) {
|
||||
ItemTraits_OnUse[] onMissEffects = attacker.getOnMissEffects();
|
||||
ItemTraits_OnHitReceived[] onMissReceivedEffects = target.getOnMissReceivedEffects();
|
||||
if (onMissEffects != null) {
|
||||
for (ItemTraits_OnUse e : onMissEffects) {
|
||||
controllers.actorStatsController.applyUseEffect(attacker, target, e);
|
||||
}
|
||||
}
|
||||
if (onMissReceivedEffects != null) {
|
||||
for (ItemTraits_OnHitReceived e : onMissReceivedEffects) {
|
||||
controllers.actorStatsController.applyHitReceivedEffect(target, attacker, e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void endOfCombatRound() {
|
||||
world.model.worldData.tickWorldTime();
|
||||
controllers.gameRoundController.resetRoundTimers();
|
||||
|
||||
@@ -7,7 +7,7 @@ import com.gpl.rpg.AndorsTrail.util.ConstRange;
|
||||
import com.gpl.rpg.AndorsTrail.util.Range;
|
||||
|
||||
public final class Constants {
|
||||
public static final int PERCENT_EXP_LOST_WHEN_DIED = 20;
|
||||
public static final int PERCENT_EXP_LOST_WHEN_DIED = 30;
|
||||
public static final int LEVELUP_EFFECT_HEALTH = 5;
|
||||
public static final int LEVELUP_EFFECT_ATK_CH = 5;
|
||||
public static final int LEVELUP_EFFECT_ATK_DMG = 1;
|
||||
@@ -51,10 +51,6 @@ public final class Constants {
|
||||
public static final String CHEAT_DETECTION_FOLDER = "dEAGyGE3YojqXjI3x4x7";
|
||||
public static final String PASSIVE_ACHIEVEMENT_CHECK_PHRASE = "passive_achievement_check";
|
||||
|
||||
public static final String SAVEGAME_FILE_MIME_TYPE = "application/octet-stream";
|
||||
public static final String WORLDMAP_FILE_MIME_TYPE = "image/png";
|
||||
public static final String NO_FILE_EXTENSION_MIME_TYPE = "application/no_file_extension_mime_type";
|
||||
|
||||
public static final Random rnd = new Random();
|
||||
public static int rollValue(final ConstRange r) { return rollValue(r.max, r.current); }
|
||||
public static int rollValue(final ConstRange r, int bias) { return rollValue((r.max + 1) * 100 -1, r.current * 100 + bias)/100; }
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
package com.gpl.rpg.AndorsTrail.controller;
|
||||
|
||||
import static com.gpl.rpg.AndorsTrail.controller.SkillController.canLevelupSkillWithQuest;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import android.content.res.Resources;
|
||||
@@ -24,7 +22,6 @@ import com.gpl.rpg.AndorsTrail.model.conversation.Reply;
|
||||
import com.gpl.rpg.AndorsTrail.model.item.ItemTypeCollection;
|
||||
import com.gpl.rpg.AndorsTrail.model.item.Loot;
|
||||
import com.gpl.rpg.AndorsTrail.model.map.LayeredTileMap;
|
||||
import com.gpl.rpg.AndorsTrail.model.map.MapObject;
|
||||
import com.gpl.rpg.AndorsTrail.model.map.MonsterSpawnArea;
|
||||
import com.gpl.rpg.AndorsTrail.model.map.PredefinedMap;
|
||||
import com.gpl.rpg.AndorsTrail.model.quest.QuestLogEntry;
|
||||
@@ -127,9 +124,6 @@ public final class ConversationController {
|
||||
case changeMapFilter:
|
||||
changeMapFilter(res, effect.mapName, effect.effectID);
|
||||
break;
|
||||
case mapchange:
|
||||
mapchange(effect.mapName, effect.effectID);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -178,13 +172,6 @@ public final class ConversationController {
|
||||
}
|
||||
}
|
||||
|
||||
private void mapchange(String mapName, String place) {
|
||||
PredefinedMap map = findMapForScriptEffect(mapName);
|
||||
// controllers.mapController.activateMapObjectGroup(map, mapObjectGroupID);
|
||||
// controllerContext.movementController.placePlayerAsyncAt(MapObject.MapObjectType.newmap, effect.mapName, effect.effectID, 0, 0); //cbcbcb check
|
||||
controllers.movementController.placePlayerAsyncAt(MapObject.MapObjectType.newmap, mapName, place, 0, 0);
|
||||
}
|
||||
|
||||
private void addAlignmentReward(Player player, String faction, int delta) {
|
||||
player.addAlignment(faction, delta);
|
||||
MovementController.refreshMonsterAggressiveness(world.model.currentMaps.map, world.model.player);
|
||||
@@ -324,28 +311,6 @@ public final class ConversationController {
|
||||
case factionScoreEquals:
|
||||
result = player.getAlignment(requirement.requireID) == requirement.value;
|
||||
break;
|
||||
case date:
|
||||
result = world.model.worldData.getDate(requirement.requireID) >= requirement.value;
|
||||
break;
|
||||
case dateEquals:
|
||||
result = world.model.worldData.getDate(requirement.requireID) == requirement.value;
|
||||
break;
|
||||
case time:
|
||||
result = world.model.worldData.getTime(requirement.requireID) >= requirement.value;
|
||||
break;
|
||||
case timeEquals:
|
||||
result = world.model.worldData.getTime(requirement.requireID) == requirement.value;
|
||||
break;
|
||||
case skillIncrease:
|
||||
int levels;
|
||||
if (requirement.value <= 0){
|
||||
levels = 1;
|
||||
}else{
|
||||
levels = requirement.value;
|
||||
}
|
||||
SkillInfo skill = world.skills.getSkill(SkillCollection.SkillID.valueOf(requirement.requireID));
|
||||
result = canLevelupSkillWithQuest(player, skill, levels);
|
||||
break;
|
||||
default:
|
||||
result = true;
|
||||
}
|
||||
|
||||
@@ -2,7 +2,6 @@ package com.gpl.rpg.AndorsTrail.controller;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.os.Build;
|
||||
import android.util.SparseIntArray;
|
||||
import android.view.KeyEvent;
|
||||
import android.view.View;
|
||||
@@ -99,36 +98,28 @@ public final class InputController implements OnClickListener, OnLongClickListen
|
||||
|
||||
// Keys mapping to UP_LEFT
|
||||
key = KEY_MOVE_UP_LEFT;
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
|
||||
keyMap.put(KeyEvent.KEYCODE_DPAD_UP_LEFT, key);
|
||||
}
|
||||
keyMap.put(KeyEvent.KEYCODE_DPAD_UP_LEFT, key);
|
||||
keyMap.put(KeyEvent.KEYCODE_NUMPAD_7, key);
|
||||
keyMap.put(KeyEvent.KEYCODE_7, key);
|
||||
keyMap.put(KeyEvent.KEYCODE_MOVE_HOME, key);
|
||||
|
||||
// Keys mapping to UP_RIGHT
|
||||
key = KEY_MOVE_UP_RIGHT;
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
|
||||
keyMap.put(KeyEvent.KEYCODE_DPAD_UP_RIGHT, key);
|
||||
}
|
||||
keyMap.put(KeyEvent.KEYCODE_DPAD_UP_RIGHT, key);
|
||||
keyMap.put(KeyEvent.KEYCODE_NUMPAD_9, key);
|
||||
keyMap.put(KeyEvent.KEYCODE_9, key);
|
||||
keyMap.put(KeyEvent.KEYCODE_PAGE_UP, key);
|
||||
|
||||
// Keys mapping to DOWN_LEFT
|
||||
key = KEY_MOVE_DOWN_LEFT;
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
|
||||
keyMap.put(KeyEvent.KEYCODE_DPAD_DOWN_LEFT, key);
|
||||
}
|
||||
keyMap.put(KeyEvent.KEYCODE_DPAD_DOWN_LEFT, key);
|
||||
keyMap.put(KeyEvent.KEYCODE_NUMPAD_1, key);
|
||||
keyMap.put(KeyEvent.KEYCODE_1, key);
|
||||
keyMap.put(KeyEvent.KEYCODE_MOVE_END, key);
|
||||
|
||||
// Keys mapping to DOWN_RIGHT
|
||||
key = KEY_MOVE_DOWN_RIGHT;
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
|
||||
keyMap.put(KeyEvent.KEYCODE_DPAD_DOWN_RIGHT, key);
|
||||
}
|
||||
keyMap.put(KeyEvent.KEYCODE_DPAD_DOWN_RIGHT, key);
|
||||
keyMap.put(KeyEvent.KEYCODE_NUMPAD_3, key);
|
||||
keyMap.put(KeyEvent.KEYCODE_3, key);
|
||||
keyMap.put(KeyEvent.KEYCODE_PAGE_DOWN, key);
|
||||
|
||||
@@ -195,27 +195,19 @@ public final class ItemController {
|
||||
|
||||
public static void recalculateHitEffectsFromWornItems(Player player) {
|
||||
ArrayList<ItemTraits_OnUse> effects_onHit = null;
|
||||
ArrayList<ItemTraits_OnUse> effects_onMiss = null;
|
||||
ArrayList<ItemTraits_OnHitReceived> effects_onHitReceived = null;
|
||||
ArrayList<ItemTraits_OnHitReceived> effects_onMissReceived = null;
|
||||
for (Inventory.WearSlot slot : Inventory.WearSlot.values()) {
|
||||
ItemType type = player.inventory.getItemTypeInWearSlot(slot);
|
||||
if (type == null) continue;
|
||||
ItemTraits_OnUse eh = type.effects_hit;
|
||||
ItemTraits_OnHitReceived ehr = type.effects_hitReceived;
|
||||
ItemTraits_OnUse em = type.effects_miss;
|
||||
ItemTraits_OnHitReceived emr = type.effects_missReceived;
|
||||
if (eh == null && ehr == null && em == null && emr == null) continue;
|
||||
if (eh == null && ehr == null) continue;
|
||||
|
||||
if (effects_onHit == null) effects_onHit = new ArrayList<ItemTraits_OnUse>();
|
||||
if (eh != null) effects_onHit.add(eh);
|
||||
if (effects_onMiss == null) effects_onMiss = new ArrayList<ItemTraits_OnUse>();
|
||||
if (em != null) effects_onMiss.add(em);
|
||||
|
||||
if (effects_onHitReceived == null) effects_onHitReceived = new ArrayList<ItemTraits_OnHitReceived>();
|
||||
if (ehr != null) effects_onHitReceived.add(ehr);
|
||||
if (effects_onMissReceived == null) effects_onMissReceived = new ArrayList<ItemTraits_OnHitReceived>();
|
||||
if (emr != null) effects_onMissReceived.add(emr);
|
||||
}
|
||||
|
||||
if (effects_onHit != null) {
|
||||
@@ -225,13 +217,6 @@ public final class ItemController {
|
||||
} else {
|
||||
player.onHitEffects = null;
|
||||
}
|
||||
if (effects_onMiss != null) {
|
||||
ItemTraits_OnUse[] effects_ = new ItemTraits_OnUse[effects_onMiss.size()];
|
||||
effects_ = effects_onMiss.toArray(effects_);
|
||||
player.onMissEffects = effects_;
|
||||
} else {
|
||||
player.onMissEffects = null;
|
||||
}
|
||||
|
||||
if (effects_onHitReceived != null) {
|
||||
ItemTraits_OnHitReceived[] effects_ = new ItemTraits_OnHitReceived[effects_onHitReceived.size()];
|
||||
@@ -240,13 +225,6 @@ public final class ItemController {
|
||||
} else {
|
||||
player.onHitReceivedEffects = null;
|
||||
}
|
||||
if (effects_onMissReceived != null) {
|
||||
ItemTraits_OnHitReceived[] effects_ = new ItemTraits_OnHitReceived[effects_onMissReceived.size()];
|
||||
effects_ = effects_onMissReceived.toArray(effects_);
|
||||
player.onMissReceivedEffects = effects_;
|
||||
} else {
|
||||
player.onMissReceivedEffects = null;
|
||||
}
|
||||
}
|
||||
|
||||
public void consumeNonItemLoot(Loot loot) {
|
||||
|
||||
@@ -68,7 +68,6 @@ public final class MapController {
|
||||
case sign:
|
||||
if (o.id == null || o.id.length() <= 0) return;
|
||||
worldEventListeners.onPlayerSteppedOnMapSignArea(o);
|
||||
runScriptInArea(o);
|
||||
break;
|
||||
case newmap:
|
||||
if (o.map == null || o.place == null) return;
|
||||
@@ -80,7 +79,7 @@ public final class MapController {
|
||||
steppedOnRestArea(o);
|
||||
break;
|
||||
case script:
|
||||
runScriptInArea(o);
|
||||
runScriptArea(o);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -94,7 +93,7 @@ public final class MapController {
|
||||
return true;
|
||||
}
|
||||
|
||||
private void runScriptInArea(MapObject o) {
|
||||
private void runScriptArea(MapObject o) {
|
||||
Resources res = controllers.getResources();
|
||||
mapScriptExecutor.proceedToPhrase(res, o.id, true, true);
|
||||
controllers.mapController.applyCurrentMapReplacements(res, true);
|
||||
@@ -165,7 +164,6 @@ public final class MapController {
|
||||
return true;
|
||||
}
|
||||
worldEventListeners.onPlayerSteppedOnKeyArea(area);
|
||||
runScriptInArea(area);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
package com.gpl.rpg.AndorsTrail.controller;
|
||||
|
||||
import com.gpl.rpg.AndorsTrail.AndorsTrailApplication;
|
||||
import com.gpl.rpg.AndorsTrail.context.ControllerContext;
|
||||
import com.gpl.rpg.AndorsTrail.context.WorldContext;
|
||||
import com.gpl.rpg.AndorsTrail.controller.listeners.CombatActionListeners;
|
||||
@@ -18,7 +17,6 @@ import com.gpl.rpg.AndorsTrail.model.item.ItemCategory;
|
||||
import com.gpl.rpg.AndorsTrail.model.item.ItemType;
|
||||
import com.gpl.rpg.AndorsTrail.model.item.ItemTypeCollection;
|
||||
import com.gpl.rpg.AndorsTrail.util.ConstRange;
|
||||
import com.gpl.rpg.AndorsTrail.util.L;
|
||||
|
||||
public final class SkillController {
|
||||
private final ControllerContext controllers;
|
||||
@@ -60,9 +58,6 @@ public final class SkillController {
|
||||
|
||||
public static int getDropChanceRollBias(DropItem item, Player player) {
|
||||
if (player == null) return 0;
|
||||
if(item.itemType == null && AndorsTrailApplication.DEVELOPMENT_DEBUGMESSAGES){
|
||||
L.log("Item type missing: " + item + " " + player.id);
|
||||
}
|
||||
|
||||
if (ItemTypeCollection.isGoldItemType(item.itemType.id)) {
|
||||
return getRollBias(item, player, SkillID.coinfinder, SkillCollection.PER_SKILLPOINT_INCREASE_COINFINDER_CHANCE_PERCENT);
|
||||
@@ -91,17 +86,17 @@ public final class SkillController {
|
||||
}
|
||||
|
||||
|
||||
static boolean canLevelupSkillWithQuest(Player player, SkillInfo skill, int levels) {
|
||||
private static boolean canLevelupSkillWithQuest(Player player, SkillInfo skill) {
|
||||
final int playerSkillLevel = player.getSkillLevel(skill.id);
|
||||
if (skill.hasMaxLevel()) {
|
||||
if (playerSkillLevel + levels > skill.maxLevel) return false;
|
||||
if (playerSkillLevel >= skill.maxLevel) return false;
|
||||
}
|
||||
if (!skill.canLevelUpSkillTo(player, playerSkillLevel + levels)) return false;
|
||||
if (!skill.canLevelUpSkillTo(player, playerSkillLevel + 1)) return false;
|
||||
return true;
|
||||
}
|
||||
public static boolean canLevelupSkillManually(Player player, SkillInfo skill) {
|
||||
if (!player.hasAvailableSkillpoints()) return false;
|
||||
if (!canLevelupSkillWithQuest(player, skill, 1)) return false;
|
||||
if (!canLevelupSkillWithQuest(player, skill)) return false;
|
||||
if (skill.levelupVisibility == SkillInfo.LevelUpType.onlyByQuests) return false;
|
||||
if (skill.levelupVisibility == SkillInfo.LevelUpType.firstLevelRequiresQuest) {
|
||||
if (!player.hasSkill(skill.id)) return false;
|
||||
@@ -114,7 +109,7 @@ public final class SkillController {
|
||||
addSkillLevel(skill.id);
|
||||
}
|
||||
public boolean levelUpSkillByQuest(Player player, SkillInfo skill) {
|
||||
if (!canLevelupSkillWithQuest(player, skill, 1)) return false;
|
||||
if (!canLevelupSkillWithQuest(player, skill)) return false;
|
||||
addSkillLevel(skill.id);
|
||||
return true;
|
||||
}
|
||||
@@ -253,7 +248,6 @@ public final class SkillController {
|
||||
addPercentBlockChance(player, itemType, SkillCollection.PER_SKILLPOINT_INCREASE_HEAVY_ARMOR_BC_PERCENT * skillLevelHeavyArmor, 0);
|
||||
playerTraits.moveCost -= getPercentage(itemType.effects_equip.stats.increaseMoveCost, SkillCollection.PER_SKILLPOINT_INCREASE_HEAVY_ARMOR_MOVECOST_PERCENT * skillLevelHeavyArmor, 0);
|
||||
playerTraits.attackCost -= getPercentage(itemType.effects_equip.stats.increaseAttackCost, SkillCollection.PER_SKILLPOINT_INCREASE_HEAVY_ARMOR_ATKCOST_PERCENT * skillLevelHeavyArmor, 0);
|
||||
playerTraits.useItemCost -= getPercentage(itemType.effects_equip.stats.increaseUseItemCost, SkillCollection.PER_SKILLPOINT_INCREASE_HEAVY_ARMOR_USECOST_PERCENT * skillLevelHeavyArmor, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -21,21 +21,14 @@ import com.gpl.rpg.AndorsTrail.util.Coord;
|
||||
import com.gpl.rpg.AndorsTrail.util.CoordRect;
|
||||
import com.gpl.rpg.AndorsTrail.util.Size;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public final class VisualEffectController {
|
||||
private static final long EFFECT_UPDATE_INTERVAL = 25;
|
||||
private int effectCount = 0;
|
||||
|
||||
private final ControllerContext controllers;
|
||||
private final WorldContext world;
|
||||
private final VisualEffectCollection effectTypes;
|
||||
private final Handler animationHandler = new Handler();
|
||||
private final List<VisualEffectAnimation> activeAnimations = new ArrayList<>();
|
||||
|
||||
public final VisualEffectFrameListeners visualEffectFrameListeners = new VisualEffectFrameListeners();
|
||||
private long getEffectUpdateInterval() {
|
||||
return EFFECT_UPDATE_INTERVAL * controllers.preferences.attackspeed_milliseconds / AndorsTrailPreferences.ATTACKSPEED_DEFAULT_MILLISECONDS;
|
||||
}
|
||||
|
||||
public VisualEffectController(ControllerContext controllers, WorldContext world) {
|
||||
this.controllers = controllers;
|
||||
@@ -44,41 +37,11 @@ public final class VisualEffectController {
|
||||
}
|
||||
|
||||
public void startEffect(Coord position, VisualEffectCollection.VisualEffectID effectID, String displayValue, VisualEffectCompletedCallback callback, int callbackValue) {
|
||||
VisualEffectAnimation animation = new VisualEffectAnimation(effectTypes.getVisualEffect(effectID), position, displayValue, callback, callbackValue);
|
||||
animation.start();
|
||||
++effectCount;
|
||||
(new VisualEffectAnimation(effectTypes.getVisualEffect(effectID), position, displayValue, callback, callbackValue))
|
||||
.start();
|
||||
}
|
||||
|
||||
private void startAnimation(VisualEffectAnimation animation) {
|
||||
activeAnimations.add(animation);
|
||||
animation.update();
|
||||
if (activeAnimations.size() == 1) {
|
||||
animationHandler.postDelayed(animationRunnable, 0);
|
||||
}
|
||||
}
|
||||
|
||||
private final Runnable animationRunnable = new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
if(!activeAnimations.isEmpty()) {
|
||||
long updateInterval = getEffectUpdateInterval();
|
||||
if(updateInterval > 0) animationHandler.postDelayed(this, updateInterval);
|
||||
|
||||
for (int i = 0; i < activeAnimations.size(); i++) {
|
||||
VisualEffectAnimation animation = activeAnimations.get(i);
|
||||
animation.durationPassed += updateInterval;
|
||||
animation.updateFrame();
|
||||
animation.update();
|
||||
if (controllers.preferences.attackspeed_milliseconds <= 0 || animation.currentFrame >= animation.effect.lastFrame) {
|
||||
animation.onCompleted();
|
||||
activeAnimations.remove(i);
|
||||
i--;
|
||||
}
|
||||
}
|
||||
visualEffectFrameListeners.onNewAnimationFrames(activeAnimations);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
private VisualEffectCollection.VisualEffectID enqueuedEffectID = null;
|
||||
private int enqueuedEffectValue = 0;
|
||||
public void enqueueEffect(VisualEffectCollection.VisualEffectID effectID, int displayValue) {
|
||||
@@ -97,13 +60,15 @@ public final class VisualEffectController {
|
||||
}
|
||||
|
||||
public void startActorMoveEffect(Actor actor, PredefinedMap map, Coord origin, Coord destination, int duration, VisualEffectCompletedCallback callback, int callbackValue) {
|
||||
++effectCount;
|
||||
(new SpriteMoveAnimation(origin, destination, duration, actor, map, callback, callbackValue))
|
||||
.start();
|
||||
}
|
||||
|
||||
public final class SpriteMoveAnimation implements Runnable {
|
||||
private final Handler handler = new Handler();
|
||||
|
||||
public final class SpriteMoveAnimation extends Handler implements Runnable {
|
||||
|
||||
// private static final int millisecondsPerFrame=25;
|
||||
|
||||
private final VisualEffectCompletedCallback callback;
|
||||
private final int callbackValue;
|
||||
|
||||
@@ -117,6 +82,11 @@ public final class VisualEffectController {
|
||||
@Override
|
||||
public void run() {
|
||||
onCompleted();
|
||||
// update();
|
||||
// if (System.currentTimeMillis() - actor.vfxStartTime >= duration) {
|
||||
// } else {
|
||||
// postDelayed(this, millisecondsPerFrame);
|
||||
// }
|
||||
}
|
||||
|
||||
public SpriteMoveAnimation(Coord origin, Coord destination, int duration, Actor actor, PredefinedMap map, VisualEffectCompletedCallback callback, int callbackValue) {
|
||||
@@ -129,12 +99,19 @@ public final class VisualEffectController {
|
||||
this.destination = destination;
|
||||
|
||||
}
|
||||
|
||||
// private void update() {
|
||||
//
|
||||
// visualEffectFrameListeners.onNewSpriteMoveFrame(this);
|
||||
// }
|
||||
|
||||
private void onCompleted() {
|
||||
--effectCount;
|
||||
actor.hasVFXRunning = false;
|
||||
if (callback != null) callback.onVisualEffectCompleted(callbackValue);
|
||||
visualEffectFrameListeners.onSpriteMoveCompleted(this);
|
||||
}
|
||||
|
||||
|
||||
public void start() {
|
||||
actor.hasVFXRunning = true;
|
||||
@@ -143,9 +120,12 @@ public final class VisualEffectController {
|
||||
visualEffectFrameListeners.onSpriteMoveStarted(this);
|
||||
if (duration == 0 || !controllers.preferences.enableUiAnimations) onCompleted();
|
||||
else {
|
||||
handler.postDelayed(this, duration);
|
||||
postDelayed(this, duration);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
public static final Paint textPaint = new Paint();
|
||||
@@ -154,45 +134,41 @@ public final class VisualEffectController {
|
||||
textPaint.setAlpha(255);
|
||||
textPaint.setTextAlign(Align.CENTER);
|
||||
}
|
||||
|
||||
public final class VisualEffectAnimation extends Handler implements Runnable {
|
||||
|
||||
/// only for combat effects, movement & blood splatters etc. are handled elsewhere.
|
||||
public final class VisualEffectAnimation {
|
||||
public int tileID;
|
||||
public int textYOffset;
|
||||
public long durationPassed = 0;
|
||||
|
||||
private void updateFrame() {
|
||||
long frameDuration = (long) effect.millisecondPerFrame * controllers.preferences.attackspeed_milliseconds / AndorsTrailPreferences.ATTACKSPEED_DEFAULT_MILLISECONDS;
|
||||
while (frameDuration > 0 && durationPassed > frameDuration) {
|
||||
currentFrame++;
|
||||
durationPassed -= frameDuration;
|
||||
@Override
|
||||
public void run() {
|
||||
if (currentFrame >= effect.lastFrame) {
|
||||
onCompleted();
|
||||
} else {
|
||||
postDelayed(this, effect.millisecondPerFrame * controllers.preferences.attackspeed_milliseconds / AndorsTrailPreferences.ATTACKSPEED_DEFAULT_MILLISECONDS);
|
||||
update();
|
||||
}
|
||||
}
|
||||
|
||||
private void update() {
|
||||
if (currentFrame >= effect.lastFrame) {
|
||||
return;
|
||||
++currentFrame;
|
||||
int frame = currentFrame;
|
||||
|
||||
int tileID = effect.frameIconIDs[frame];
|
||||
int textYOffset = -2 * (frame);
|
||||
if (frame >= beginFadeAtFrame && displayText != null) {
|
||||
textPaint.setAlpha(255 * (effect.lastFrame - frame) / (effect.lastFrame - beginFadeAtFrame));
|
||||
}
|
||||
|
||||
tileID = effect.frameIconIDs[currentFrame];
|
||||
textYOffset = -2 * (currentFrame);
|
||||
|
||||
if (currentFrame >= beginFadeAtFrame && displayText != null) {
|
||||
textPaint.setAlpha(255 * (effect.lastFrame - currentFrame) / (effect.lastFrame - beginFadeAtFrame));
|
||||
}
|
||||
|
||||
area.topLeft.y = position.y - 1;
|
||||
visualEffectFrameListeners.onNewAnimationFrame(this, tileID, textYOffset);
|
||||
}
|
||||
|
||||
private void onCompleted() {
|
||||
--effectCount;
|
||||
visualEffectFrameListeners.onAnimationCompleted(this);
|
||||
if (callback != null) callback.onVisualEffectCompleted(callbackValue);
|
||||
}
|
||||
|
||||
public void start() {
|
||||
if (!controllers.preferences.enableUiAnimations
|
||||
|| effect.duration == 0
|
||||
|| controllers.preferences.attackspeed_milliseconds <= 0) onCompleted();
|
||||
else startAnimation(this);
|
||||
if (!controllers.preferences.enableUiAnimations) onCompleted();
|
||||
else postDelayed(this, 0);
|
||||
}
|
||||
|
||||
private int currentFrame = 0;
|
||||
@@ -221,7 +197,7 @@ public final class VisualEffectController {
|
||||
this.area = new CoordRect(new Coord(position.x - (widthNeededInTiles / 2), position.y - 1), new Size(widthNeededInTiles, 2));
|
||||
this.beginFadeAtFrame = effect.lastFrame / 2;
|
||||
}
|
||||
|
||||
|
||||
public Paint getTextPaint(){
|
||||
return textPaint;
|
||||
}
|
||||
@@ -232,7 +208,7 @@ public final class VisualEffectController {
|
||||
}
|
||||
|
||||
public boolean isRunningVisualEffect() {
|
||||
return !activeAnimations.isEmpty();
|
||||
return effectCount > 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -292,10 +268,10 @@ public final class VisualEffectController {
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void asyncUpdateArea(CoordRect area) {
|
||||
visualEffectFrameListeners.onAsyncAreaUpdate(area);
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -25,7 +25,6 @@ import com.gpl.rpg.AndorsTrail.context.WorldContext;
|
||||
import com.gpl.rpg.AndorsTrail.model.map.LayeredTileMap;
|
||||
import com.gpl.rpg.AndorsTrail.model.map.MapLayer;
|
||||
import com.gpl.rpg.AndorsTrail.model.map.PredefinedMap;
|
||||
import com.gpl.rpg.AndorsTrail.model.map.TMXMapTranslator;
|
||||
import com.gpl.rpg.AndorsTrail.model.map.WorldMapSegment;
|
||||
import com.gpl.rpg.AndorsTrail.model.map.WorldMapSegment.NamedWorldMapArea;
|
||||
import com.gpl.rpg.AndorsTrail.model.map.WorldMapSegment.WorldMapSegmentMap;
|
||||
@@ -315,32 +314,4 @@ public final class WorldMapController {
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public static void populateWorldMap(Context context, WorldContext world, Resources res) throws IOException {
|
||||
ensureWorldmapDirectoryExists(context);
|
||||
File dir = getWorldmapDirectory(context);
|
||||
|
||||
File idFile = new File(dir, world.model.player.id);
|
||||
if (idFile.exists()) return;
|
||||
idFile.createNewFile();
|
||||
|
||||
for (PredefinedMap map : world.maps.getAllMaps()) {
|
||||
if (!map.visited) continue;
|
||||
|
||||
String worldMapSegmentName = world.maps.getWorldMapSegmentNameForMap(map.name);
|
||||
if (worldMapSegmentName == null) continue;
|
||||
|
||||
boolean mapFileExists = fileForMapExists(context, map);
|
||||
File worldMapFile = getCombinedWorldMapFile(context, worldMapSegmentName);
|
||||
if (mapFileExists && worldMapFile.exists()) continue;
|
||||
|
||||
LayeredTileMap mapTiles = TMXMapTranslator.readLayeredTileMap(res, world.tileManager.tileCache, map);
|
||||
mapTiles.changeColorFilter(map.currentColorFilter);
|
||||
TileCollection cachedTiles = world.tileManager.loadTilesFor(map, mapTiles, world, res);
|
||||
|
||||
MapRenderer renderer = new MapRenderer(world, map, mapTiles, cachedTiles);
|
||||
updateCachedBitmap(context, map, renderer);
|
||||
updateWorldMapSegment(context, res, world, worldMapSegmentName);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,10 +4,8 @@ import com.gpl.rpg.AndorsTrail.controller.VisualEffectController.SpriteMoveAnima
|
||||
import com.gpl.rpg.AndorsTrail.controller.VisualEffectController.VisualEffectAnimation;
|
||||
import com.gpl.rpg.AndorsTrail.util.CoordRect;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface VisualEffectFrameListener {
|
||||
void onNewAnimationFrames(List<VisualEffectAnimation> effects);
|
||||
void onNewAnimationFrame(VisualEffectAnimation animation, int tileID, int textYOffset);
|
||||
void onAnimationCompleted(VisualEffectAnimation animation);
|
||||
void onSpriteMoveStarted(SpriteMoveAnimation animation);
|
||||
void onNewSpriteMoveFrame(SpriteMoveAnimation animation);
|
||||
|
||||
@@ -5,12 +5,10 @@ import com.gpl.rpg.AndorsTrail.controller.VisualEffectController.VisualEffectAni
|
||||
import com.gpl.rpg.AndorsTrail.util.CoordRect;
|
||||
import com.gpl.rpg.AndorsTrail.util.ListOfListeners;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public final class VisualEffectFrameListeners extends ListOfListeners<VisualEffectFrameListener> implements VisualEffectFrameListener {
|
||||
|
||||
private final Function1<VisualEffectFrameListener, List<VisualEffectAnimation>> onNewAnimationFrames = new Function1<VisualEffectFrameListener, List<VisualEffectAnimation>>() {
|
||||
@Override public void call(VisualEffectFrameListener listener, List<VisualEffectAnimation> effects) { listener.onNewAnimationFrames(effects); }
|
||||
private final Function3<VisualEffectFrameListener, VisualEffectAnimation, Integer, Integer> onNewAnimationFrame = new Function3<VisualEffectFrameListener, VisualEffectAnimation, Integer, Integer>() {
|
||||
@Override public void call(VisualEffectFrameListener listener, VisualEffectAnimation animation, Integer tileID, Integer textYOffset) { listener.onNewAnimationFrame(animation, tileID, textYOffset); }
|
||||
};
|
||||
|
||||
private final Function1<VisualEffectFrameListener, VisualEffectAnimation> onAnimationCompleted = new Function1<VisualEffectFrameListener, VisualEffectAnimation>() {
|
||||
@@ -32,10 +30,10 @@ public final class VisualEffectFrameListeners extends ListOfListeners<VisualEffe
|
||||
private final Function1<VisualEffectFrameListener, CoordRect> onAsyncAreaUpdate = new Function1<VisualEffectFrameListener, CoordRect>() {
|
||||
@Override public void call(VisualEffectFrameListener listener, CoordRect area) { listener.onAsyncAreaUpdate(area); }
|
||||
};
|
||||
|
||||
|
||||
@Override
|
||||
public void onNewAnimationFrames(List<VisualEffectAnimation> effects) {
|
||||
callAllListeners(this.onNewAnimationFrames, effects);
|
||||
public void onNewAnimationFrame(VisualEffectAnimation animation, int tileID, int textYOffset) {
|
||||
callAllListeners(this.onNewAnimationFrame, animation, tileID, textYOffset);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -1,115 +0,0 @@
|
||||
package com.gpl.rpg.AndorsTrail.model;
|
||||
|
||||
import android.os.Build;
|
||||
|
||||
import com.gpl.rpg.AndorsTrail.util.L;
|
||||
|
||||
import java.nio.ByteBuffer;
|
||||
import java.nio.ByteOrder;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.security.DigestException;
|
||||
import java.security.MessageDigest;
|
||||
import java.security.NoSuchAlgorithmException;
|
||||
|
||||
public class ChecksumBuilder {
|
||||
|
||||
public static final int CHECKSUM_LENGTH = 32;// 256 bits (depends on the hash algorithm)
|
||||
public static final String CHECKSUM_ALGORITHM = "SHA-256"; //Should be available in all Android versions
|
||||
private ByteBuffer buffer;
|
||||
private final MessageDigest digest;
|
||||
|
||||
private ChecksumBuilder(int initialCapacity, ByteOrder byteOrder) {
|
||||
buffer = ByteBuffer.allocate(initialCapacity);
|
||||
buffer.order(byteOrder);
|
||||
try {
|
||||
digest = MessageDigest.getInstance(CHECKSUM_ALGORITHM); // Or SHA-512 for even stronger hash
|
||||
} catch (NoSuchAlgorithmException e) {
|
||||
throw new RuntimeException("Hash algorithm not found", e);
|
||||
}
|
||||
}
|
||||
|
||||
private ChecksumBuilder(int initialCapacity) {
|
||||
this(initialCapacity, ByteOrder.BIG_ENDIAN); // Default to big-endian
|
||||
}
|
||||
|
||||
public ChecksumBuilder() {
|
||||
this(1024*10); // A reasonable default initial capacity
|
||||
}
|
||||
|
||||
// --- Methods for adding different data types ---
|
||||
|
||||
public ChecksumBuilder add(String value) {
|
||||
if (value != null) {
|
||||
byte[] bytes;
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
|
||||
bytes = value.getBytes(StandardCharsets.UTF_8);
|
||||
} else {
|
||||
bytes = value.getBytes();
|
||||
}
|
||||
add(bytes);
|
||||
} else {
|
||||
add(-1); // Use -1 to represent a null string
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
public ChecksumBuilder add(byte[] bytes) {
|
||||
add(bytes.length); // Add length prefix
|
||||
ensureCapacity(bytes.length + 4); // +4 for length prefix (int)
|
||||
buffer.put(bytes);
|
||||
return this;
|
||||
}
|
||||
|
||||
public ChecksumBuilder add(boolean value) {
|
||||
ensureCapacity(1);
|
||||
buffer.put(value ? (byte) 1 : (byte) 0);
|
||||
return this;
|
||||
}
|
||||
|
||||
public ChecksumBuilder add(long value) {
|
||||
ensureCapacity(8);
|
||||
buffer.putLong(value);
|
||||
return this;
|
||||
}
|
||||
|
||||
public ChecksumBuilder add(int value) {
|
||||
ensureCapacity(4);
|
||||
buffer.putInt(value);
|
||||
return this;
|
||||
}
|
||||
|
||||
public ChecksumBuilder add(float value) {
|
||||
ensureCapacity(8);
|
||||
buffer.putFloat(value);
|
||||
return this;
|
||||
}
|
||||
|
||||
public ChecksumBuilder add(double value) {
|
||||
ensureCapacity(4);
|
||||
buffer.putDouble(value);
|
||||
return this;
|
||||
}
|
||||
|
||||
// --- Method to finalize and get the checksum ---
|
||||
|
||||
public byte[] build() throws DigestException {
|
||||
buffer.flip(); // Prepare for reading
|
||||
digest.update(buffer);// Only use the actually used part of the buffer
|
||||
buffer.flip(); // Prepare for further writing
|
||||
return digest.digest();
|
||||
}
|
||||
|
||||
|
||||
// --- Utility method to ensure sufficient capacity ---
|
||||
private void ensureCapacity(int required) {
|
||||
if (buffer.remaining() < required) {
|
||||
int newCapacity = Math.max(buffer.capacity() * 2, buffer.capacity() + required);
|
||||
ByteBuffer newBuffer = ByteBuffer.allocate(newCapacity);
|
||||
newBuffer.order(buffer.order());
|
||||
buffer.flip(); // Prepare for reading
|
||||
newBuffer.put(buffer); // Copy existing data
|
||||
buffer = newBuffer; // Assign the new buffer to the field
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -3,7 +3,6 @@ package com.gpl.rpg.AndorsTrail.model;
|
||||
import java.io.DataInputStream;
|
||||
import java.io.DataOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.security.MessageDigest;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.Comparator;
|
||||
@@ -20,11 +19,8 @@ import com.gpl.rpg.AndorsTrail.model.actor.MonsterType;
|
||||
import com.gpl.rpg.AndorsTrail.model.item.ItemType;
|
||||
import com.gpl.rpg.AndorsTrail.model.map.PredefinedMap;
|
||||
import com.gpl.rpg.AndorsTrail.model.quest.Quest;
|
||||
import com.gpl.rpg.AndorsTrail.util.HashMapHelper;
|
||||
|
||||
public final class GameStatistics {
|
||||
private boolean isAlteredSavegame = false;
|
||||
private byte[] checksum = new byte[ChecksumBuilder.CHECKSUM_LENGTH];
|
||||
private int deaths = 0;
|
||||
private final HashMap<String, Integer> killedMonstersByTypeID = new HashMap<String, Integer>();
|
||||
private final HashMap<String, Integer> killedMonstersByName = new HashMap<String, Integer>();
|
||||
@@ -40,10 +36,10 @@ public final class GameStatistics {
|
||||
|
||||
public void addMonsterKill(MonsterType monsterType) {
|
||||
// Track monster kills by type ID, for savegame file
|
||||
killedMonstersByTypeID.put(monsterType.id, getNumberOfKillsForMonsterType(monsterType.id) + 1);
|
||||
killedMonstersByTypeID.put(monsterType.id, killedMonstersByTypeID.getOrDefault((monsterType.id), 0) + 1);
|
||||
|
||||
// Also track by name, for statistics display (multiple IDs w/same name don't matter to player)
|
||||
killedMonstersByName.put(monsterType.name, getNumberOfKillsForMonsterName(monsterType.name) + 1);
|
||||
killedMonstersByName.put(monsterType.name, killedMonstersByName.getOrDefault(monsterType.name, 0) + 1);
|
||||
}
|
||||
|
||||
public void addPlayerDeath(int lostExp) {
|
||||
@@ -54,7 +50,8 @@ public final class GameStatistics {
|
||||
}
|
||||
public void addItemUsage(ItemType type) {
|
||||
final String n = type.id;
|
||||
usedItems.put(n, HashMapHelper.getOrDefault(usedItems, n,0) + 1);
|
||||
if (!usedItems.containsKey(n)) usedItems.put(n, 1);
|
||||
else usedItems.put(n, usedItems.get(n) + 1);
|
||||
}
|
||||
|
||||
public int getDeaths() {
|
||||
@@ -70,18 +67,21 @@ public final class GameStatistics {
|
||||
public boolean hasUnlimitedLives() { return startLives == -1; }
|
||||
|
||||
public int getStartLives() { return startLives; }
|
||||
public boolean getIsAlteredSavegame() { return isAlteredSavegame; }
|
||||
|
||||
public int getLivesLeft() { return hasUnlimitedLives() ? -1 : startLives - deaths; }
|
||||
|
||||
public boolean isDead() { return !hasUnlimitedLives() && getLivesLeft() < 1; }
|
||||
|
||||
public int getNumberOfKillsForMonsterType(String monsterTypeID) {
|
||||
return HashMapHelper.getOrDefault(killedMonstersByTypeID, monsterTypeID, 0);
|
||||
Integer v = killedMonstersByTypeID.get(monsterTypeID);
|
||||
if (v == null) return 0;
|
||||
return v;
|
||||
}
|
||||
|
||||
public int getNumberOfKillsForMonsterName(String monsterName) {
|
||||
return HashMapHelper.getOrDefault(killedMonstersByName, monsterName, 0);
|
||||
Integer v = killedMonstersByName.get(monsterName);
|
||||
if (v == null) return 0;
|
||||
return v;
|
||||
}
|
||||
|
||||
public String getTop5MostCommonlyKilledMonsters(WorldContext world, Resources res) {
|
||||
@@ -144,15 +144,20 @@ public final class GameStatistics {
|
||||
}
|
||||
|
||||
public int getNumberOfUsedItems() {
|
||||
return HashMapHelper.sumIntegerValues(usedItems);
|
||||
int result = 0;
|
||||
for (int v : usedItems.values()) result += v;
|
||||
return result;
|
||||
}
|
||||
|
||||
public int getNumberOfTimesItemHasBeenUsed(String itemId) {
|
||||
return HashMapHelper.getOrDefault(usedItems, itemId, 0);
|
||||
if (!usedItems.containsKey(itemId)) return 0;
|
||||
return usedItems.get(itemId);
|
||||
}
|
||||
|
||||
public int getNumberOfKilledMonsters() {
|
||||
return HashMapHelper.sumIntegerValues(killedMonstersByTypeID);
|
||||
int result = 0;
|
||||
for (int v : killedMonstersByTypeID.values()) result += v;
|
||||
return result;
|
||||
}
|
||||
|
||||
private static final Comparator<Entry<String, Integer>> descendingValueComparator = new Comparator<Entry<String, Integer>>() {
|
||||
@@ -162,18 +167,6 @@ public final class GameStatistics {
|
||||
}
|
||||
};
|
||||
|
||||
public void setChecksum(byte[] checksum) {
|
||||
if (checksum.length != ChecksumBuilder.CHECKSUM_LENGTH) throw new IllegalArgumentException("Invalid checksum length.");
|
||||
this.checksum = checksum;
|
||||
}
|
||||
|
||||
public boolean compareChecksum(byte[] checksum) {
|
||||
return this.checksum.length == checksum.length && MessageDigest.isEqual(this.checksum, checksum);
|
||||
}
|
||||
|
||||
public void markAsAlteredSavegame() {
|
||||
isAlteredSavegame = true;
|
||||
}
|
||||
|
||||
// ====== PARCELABLE ===================================================================
|
||||
|
||||
@@ -193,7 +186,7 @@ public final class GameStatistics {
|
||||
// Also track by name, for statistics display (multiple IDs w/same name don't matter to player)
|
||||
MonsterType t = world.monsterTypes.getMonsterType(id);
|
||||
|
||||
if (t != null) killedMonstersByName.put(t.name, getNumberOfKillsForMonsterName(t.name) + value);
|
||||
if (t != null) killedMonstersByName.put(t.name, killedMonstersByName.getOrDefault(t.name, 0) + value);
|
||||
}
|
||||
|
||||
if (fileversion <= 17) return;
|
||||
@@ -210,11 +203,6 @@ public final class GameStatistics {
|
||||
|
||||
this.startLives = src.readInt();
|
||||
this.unlimitedSaves = src.readBoolean();
|
||||
if (fileversion < 81) return;
|
||||
this.isAlteredSavegame = src.readBoolean();
|
||||
final int checksumLength = src.readInt();
|
||||
this.checksum = new byte[checksumLength];
|
||||
if( src.read(checksum) != checksumLength) throw new IOException("Failed to read full checksum.");
|
||||
}
|
||||
|
||||
public void writeToParcel(DataOutputStream dest) throws IOException {
|
||||
@@ -234,29 +222,5 @@ public final class GameStatistics {
|
||||
dest.writeInt(spentGold);
|
||||
dest.writeInt(startLives);
|
||||
dest.writeBoolean(unlimitedSaves);
|
||||
dest.writeBoolean(isAlteredSavegame);
|
||||
dest.writeInt(checksum.length);
|
||||
dest.write(checksum);
|
||||
}
|
||||
|
||||
|
||||
public void addToChecksum(ChecksumBuilder builder) {
|
||||
builder.add(deaths);
|
||||
Set<Entry<String, Integer> > set = killedMonstersByTypeID.entrySet();
|
||||
builder.add(set.size());
|
||||
for (Entry<String, Integer> e : set) {
|
||||
builder.add(e.getKey());
|
||||
builder.add(e.getValue());
|
||||
}
|
||||
set = usedItems.entrySet();
|
||||
builder.add(set.size());
|
||||
for (Entry<String, Integer> e : set) {
|
||||
builder.add(e.getKey());
|
||||
builder.add(e.getValue());
|
||||
}
|
||||
builder.add(spentGold);
|
||||
builder.add(startLives);
|
||||
builder.add(unlimitedSaves);
|
||||
builder.add(isAlteredSavegame);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -51,12 +51,4 @@ public final class InterfaceData {
|
||||
}
|
||||
dest.writeUTF(selectedTabHeroInfo);
|
||||
}
|
||||
|
||||
public void addToChecksum(ChecksumBuilder builder) {
|
||||
builder.add(isMainActivityVisible);
|
||||
builder.add(isInCombat);
|
||||
builder.add(selectedPosition != null);
|
||||
if (selectedPosition != null) selectedPosition.addToChecksum(builder);
|
||||
builder.add(selectedTabHeroInfo);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -49,11 +49,4 @@ public final class ModelContainer {
|
||||
statistics.writeToParcel(dest);
|
||||
worldData.writeToParcel(dest);
|
||||
}
|
||||
public void addToChecksum(ChecksumBuilder builder){
|
||||
player.addToChecksum(builder);
|
||||
builder.add(currentMaps.map.name);
|
||||
uiSelections.addToChecksum(builder);
|
||||
statistics.addToChecksum(builder);
|
||||
worldData.addToChecksum(builder);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,8 +6,6 @@ import java.io.IOException;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import java.util.Calendar;
|
||||
|
||||
public final class WorldData {
|
||||
private long worldTime = 0; // Measured in number of game rounds
|
||||
private final HashMap<String, Long> timers = new HashMap<String, Long>();
|
||||
@@ -38,62 +36,6 @@ public final class WorldData {
|
||||
return v + duration <= worldTime;
|
||||
}
|
||||
|
||||
public int getDate(String format) {
|
||||
Calendar now = Calendar.getInstance();
|
||||
int ret;
|
||||
switch (format) {
|
||||
case "YYYYMMDD":
|
||||
ret = now.get(Calendar.YEAR)*10000 + (now.get(Calendar.MONTH) + 1)*100 + now.get(Calendar.DAY_OF_MONTH);
|
||||
break;
|
||||
case "YYYYMM":
|
||||
ret = now.get(Calendar.YEAR)*100 + (now.get(Calendar.MONTH) + 1);
|
||||
break;
|
||||
case "YYYY":
|
||||
ret = now.get(Calendar.YEAR);
|
||||
break;
|
||||
case "MMDD":
|
||||
ret = (now.get(Calendar.MONTH) + 1)*100 + now.get(Calendar.DAY_OF_MONTH);
|
||||
break;
|
||||
case "MM":
|
||||
ret = (now.get(Calendar.MONTH) + 1);
|
||||
break;
|
||||
case "DD":
|
||||
ret = now.get(Calendar.DAY_OF_MONTH);
|
||||
break;
|
||||
default:
|
||||
ret = 99999999; //never true
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
public int getTime(String format) {
|
||||
Calendar now = Calendar.getInstance();
|
||||
int ret;
|
||||
switch (format) {
|
||||
case "HHMMSS":
|
||||
ret = now.get(Calendar.HOUR_OF_DAY)*10000 + now.get(Calendar.MINUTE)*100 + now.get(Calendar.SECOND);
|
||||
break;
|
||||
case "HHMM":
|
||||
ret = now.get(Calendar.HOUR_OF_DAY)*100 + now.get(Calendar.MINUTE);
|
||||
break;
|
||||
case "HH":
|
||||
ret = now.get(Calendar.HOUR_OF_DAY);
|
||||
break;
|
||||
case "MMSS":
|
||||
ret = now.get(Calendar.MINUTE)*100 + now.get(Calendar.SECOND);
|
||||
break;
|
||||
case "MM":
|
||||
ret = now.get(Calendar.MINUTE);
|
||||
break;
|
||||
case "SS":
|
||||
ret = now.get(Calendar.SECOND);
|
||||
break;
|
||||
default:
|
||||
ret = 99999999; //never true
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
// ====== PARCELABLE ===================================================================
|
||||
|
||||
public WorldData(DataInputStream src, int fileversion) throws IOException {
|
||||
@@ -114,13 +56,4 @@ public final class WorldData {
|
||||
dest.writeLong(e.getValue());
|
||||
}
|
||||
}
|
||||
|
||||
public void addToChecksum(ChecksumBuilder builder) {
|
||||
builder.add(worldTime);
|
||||
builder.add(timers.size());
|
||||
for(Map.Entry<String, Long> e : timers.entrySet()) {
|
||||
builder.add(e.getKey());
|
||||
builder.add(e.getValue());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,12 +5,10 @@ import java.io.DataOutputStream;
|
||||
import java.io.IOException;
|
||||
|
||||
import com.gpl.rpg.AndorsTrail.context.WorldContext;
|
||||
import com.gpl.rpg.AndorsTrail.model.ChecksumBuilder;
|
||||
|
||||
public final class ActorCondition {
|
||||
public static final int MAGNITUDE_REMOVE_ALL = -99;
|
||||
public static final int DURATION_FOREVER = 999;
|
||||
public static final int DURATION_FOREVER_UNTIL_SLEEP = 998;
|
||||
public static final int DURATION_NONE = 0;
|
||||
|
||||
public final ActorConditionType conditionType;
|
||||
@@ -29,12 +27,7 @@ public final class ActorCondition {
|
||||
|
||||
public boolean isTemporaryEffect() { return isTemporaryEffect(duration); }
|
||||
public static boolean isTemporaryEffect(int duration) {
|
||||
return ( duration != DURATION_FOREVER && duration != DURATION_FOREVER_UNTIL_SLEEP );
|
||||
}
|
||||
|
||||
public boolean isDurationForeverUntilSleep() { return isDurationForeverUntilSleep(duration); }
|
||||
public static boolean isDurationForeverUntilSleep(int duration) {
|
||||
return ( duration == DURATION_FOREVER_UNTIL_SLEEP );
|
||||
return duration != DURATION_FOREVER;
|
||||
}
|
||||
|
||||
|
||||
@@ -52,11 +45,4 @@ public final class ActorCondition {
|
||||
dest.writeInt(magnitude);
|
||||
dest.writeInt(duration);
|
||||
}
|
||||
|
||||
public void addToChecksum(ChecksumBuilder builder) {
|
||||
builder.add(conditionType.conditionTypeID);
|
||||
builder.add(magnitude);
|
||||
builder.add(duration);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -10,7 +10,6 @@ public final class ActorConditionType {
|
||||
|
||||
public final String conditionTypeID;
|
||||
public final String name;
|
||||
public final String description;
|
||||
public final int iconID;
|
||||
public final ConditionCategory conditionCategory;
|
||||
public final boolean isStacking;
|
||||
@@ -22,7 +21,6 @@ public final class ActorConditionType {
|
||||
public ActorConditionType(
|
||||
String conditionTypeID
|
||||
, String name
|
||||
, String description
|
||||
, int iconID
|
||||
, ConditionCategory conditionCategory
|
||||
, boolean isStacking
|
||||
@@ -33,7 +31,6 @@ public final class ActorConditionType {
|
||||
) {
|
||||
this.conditionTypeID = conditionTypeID;
|
||||
this.name = name;
|
||||
this.description = description;
|
||||
this.iconID = iconID;
|
||||
this.conditionCategory = conditionCategory;
|
||||
this.isStacking = isStacking;
|
||||
|
||||
@@ -83,7 +83,7 @@ public final class SkillCollection {
|
||||
public static final int PER_SKILLPOINT_INCREASE_COINFINDER_CHANCE_PERCENT = 30;
|
||||
public static final int PER_SKILLPOINT_INCREASE_MAGICFINDER_CHANCE_PERCENT = 50;
|
||||
public static final int PER_SKILLPOINT_INCREASE_COINFINDER_QUANTITY_PERCENT = 50;
|
||||
public static final int PER_SKILLPOINT_INCREASE_MORE_EXP_PERCENT = 10;
|
||||
public static final int PER_SKILLPOINT_INCREASE_MORE_EXP_PERCENT = 5;
|
||||
public static final int PER_SKILLPOINT_INCREASE_CLEAVE_AP = 3;
|
||||
public static final int PER_SKILLPOINT_INCREASE_EATER_HEALTH = 1;
|
||||
public static final int PER_SKILLPOINT_INCREASE_FORTITUDE_HEALTH = 1;
|
||||
@@ -112,7 +112,6 @@ public final class SkillCollection {
|
||||
public static final int PER_SKILLPOINT_INCREASE_HEAVY_ARMOR_BC_PERCENT = 20;
|
||||
public static final int PER_SKILLPOINT_INCREASE_HEAVY_ARMOR_MOVECOST_PERCENT = 25;
|
||||
public static final int PER_SKILLPOINT_INCREASE_HEAVY_ARMOR_ATKCOST_PERCENT = 25;
|
||||
public static final int PER_SKILLPOINT_INCREASE_HEAVY_ARMOR_USECOST_PERCENT = 25;
|
||||
public static final int PER_SKILLPOINT_INCREASE_FIGHTSTYLE_2HAND_DMG_PERCENT = 30;
|
||||
public static final int PER_SKILLPOINT_INCREASE_SPECIALIZATION_2HAND_DMG_PERCENT = 50;
|
||||
public static final int PER_SKILLPOINT_INCREASE_SPECIALIZATION_2HAND_AC_PERCENT = 20;
|
||||
@@ -187,12 +186,12 @@ public final class SkillCollection {
|
||||
initializeSkill(new SkillInfo(SkillID.resistanceBlood, MAX_LEVEL_RESISTANCE, SkillInfo.LevelUpType.alwaysShown, SkillCategory.immunity, null, position++));
|
||||
initializeSkill(new SkillInfo(SkillID.shadowBless, 1, SkillInfo.LevelUpType.onlyByQuests, SkillCategory.immunity, null, position++));
|
||||
initializeSkill(new SkillInfo(SkillID.crit1, 1, SkillInfo.LevelUpType.alwaysShown, SkillCategory.criticals, new SkillLevelRequirement[] {
|
||||
SkillLevelRequirement.requireOtherSkill(SkillID.moreCriticals, 2)
|
||||
,SkillLevelRequirement.requireOtherSkill(SkillID.betterCriticals, 2)
|
||||
SkillLevelRequirement.requireOtherSkill(SkillID.moreCriticals, 3)
|
||||
,SkillLevelRequirement.requireOtherSkill(SkillID.betterCriticals, 3)
|
||||
}, position++));
|
||||
initializeSkill(new SkillInfo(SkillID.crit2, 1, SkillInfo.LevelUpType.alwaysShown, SkillCategory.criticals, new SkillLevelRequirement[] {
|
||||
SkillLevelRequirement.requireOtherSkill(SkillID.moreCriticals, 4)
|
||||
,SkillLevelRequirement.requireOtherSkill(SkillID.betterCriticals, 4)
|
||||
SkillLevelRequirement.requireOtherSkill(SkillID.moreCriticals, 6)
|
||||
,SkillLevelRequirement.requireOtherSkill(SkillID.betterCriticals, 6)
|
||||
,SkillLevelRequirement.requireOtherSkill(SkillID.crit1, 1)
|
||||
}, position++));
|
||||
initializeSkill(new SkillInfo(SkillID.rejuvenation, 1, SkillInfo.LevelUpType.alwaysShown, SkillCategory.immunity, new SkillLevelRequirement[] {
|
||||
|
||||
@@ -35,9 +35,7 @@ public class Actor {
|
||||
public int blockChance;
|
||||
public int damageResistance;
|
||||
public ItemTraits_OnUse[] onHitEffects;
|
||||
public ItemTraits_OnUse[] onMissEffects;
|
||||
public ItemTraits_OnHitReceived[] onHitReceivedEffects;
|
||||
public ItemTraits_OnHitReceived[] onMissReceivedEffects;
|
||||
public ItemTraits_OnUse onDeathEffects;
|
||||
public boolean hasVFXRunning = false;
|
||||
public long vfxStartTime = 0;
|
||||
@@ -71,12 +69,8 @@ public class Actor {
|
||||
public int getDamageResistance() { return damageResistance; }
|
||||
public ItemTraits_OnUse[] getOnHitEffects() { return onHitEffects; }
|
||||
public List<ItemTraits_OnUse> getOnHitEffectsAsList() { return onHitEffects == null ? null : Arrays.asList(onHitEffects); }
|
||||
public ItemTraits_OnUse[] getOnMissEffects() { return onMissEffects; }
|
||||
public List<ItemTraits_OnUse> getOnMissEffectsAsList() { return onMissEffects == null ? null : Arrays.asList(onMissEffects); }
|
||||
public ItemTraits_OnHitReceived[] getOnHitReceivedEffects() { return onHitReceivedEffects; }
|
||||
public List<ItemTraits_OnHitReceived> getOnHitReceivedEffectsAsList() { return onHitReceivedEffects == null ? null : Arrays.asList(onHitReceivedEffects); }
|
||||
public ItemTraits_OnHitReceived[] getOnMissReceivedEffects() { return onMissReceivedEffects; }
|
||||
public List<ItemTraits_OnHitReceived> getOnMissReceivedEffectsAsList() { return onMissReceivedEffects == null ? null : Arrays.asList(onMissReceivedEffects); }
|
||||
public ItemTraits_OnUse getOnDeathEffects() { return onDeathEffects; }
|
||||
|
||||
public boolean hasCriticalSkillEffect() { return getCriticalSkill() != 0; }
|
||||
|
||||
@@ -6,7 +6,6 @@ import java.io.IOException;
|
||||
|
||||
import com.gpl.rpg.AndorsTrail.context.WorldContext;
|
||||
import com.gpl.rpg.AndorsTrail.controller.Constants;
|
||||
import com.gpl.rpg.AndorsTrail.model.ChecksumBuilder;
|
||||
import com.gpl.rpg.AndorsTrail.model.ability.ActorCondition;
|
||||
import com.gpl.rpg.AndorsTrail.model.ability.SkillCollection;
|
||||
import com.gpl.rpg.AndorsTrail.model.item.DropList;
|
||||
@@ -30,14 +29,11 @@ public final class Monster extends Actor {
|
||||
public final MonsterType monsterType;
|
||||
public final MonsterSpawnArea area;
|
||||
|
||||
public final boolean isFlippedX;
|
||||
|
||||
public Monster(MonsterType monsterType, MonsterSpawnArea area) {
|
||||
super(monsterType.tileSize, false, monsterType.isImmuneToCriticalHits());
|
||||
this.monsterType = monsterType;
|
||||
this.area = area;
|
||||
this.iconID = monsterType.iconID;
|
||||
this.isFlippedX = Constants.roll100(monsterType.horizontalFlipChance);
|
||||
this.nextPosition = new CoordRect(new Coord(), monsterType.tileSize);
|
||||
resetStatsToBaseTraits();
|
||||
this.ap.setMax();
|
||||
@@ -197,43 +193,4 @@ public final class Monster extends Actor {
|
||||
dest.writeBoolean(false);
|
||||
}
|
||||
}
|
||||
|
||||
public void addToChecksum(ChecksumBuilder builder) {
|
||||
builder.add(getMonsterTypeID());
|
||||
if (attackCost == monsterType.attackCost
|
||||
&& attackChance == monsterType.attackChance
|
||||
&& criticalSkill == monsterType.criticalSkill
|
||||
&& criticalMultiplier == monsterType.criticalMultiplier
|
||||
&& damagePotential.equals(monsterType.damagePotential)
|
||||
&& blockChance == monsterType.blockChance
|
||||
&& damageResistance == monsterType.damageResistance
|
||||
) {
|
||||
builder.add(false);
|
||||
} else {
|
||||
builder.add(true);
|
||||
builder.add(attackCost);
|
||||
builder.add(attackChance);
|
||||
builder.add(criticalSkill);
|
||||
builder.add(criticalMultiplier);
|
||||
damagePotential.addToChecksum(builder);
|
||||
builder.add(blockChance);
|
||||
builder.add(damageResistance);
|
||||
}
|
||||
ap.addToChecksum(builder);
|
||||
health.addToChecksum(builder);
|
||||
position.addToChecksum(builder);
|
||||
builder.add(conditions.size());
|
||||
for (ActorCondition c : conditions) {
|
||||
c.addToChecksum(builder);
|
||||
}
|
||||
builder.add(moveCost);
|
||||
|
||||
builder.add(forceAggressive);
|
||||
if (shopItems != null) {
|
||||
builder.add(true);
|
||||
shopItems.addToChecksum(builder);
|
||||
} else {
|
||||
builder.add(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -37,7 +37,6 @@ public final class MonsterType {
|
||||
|
||||
public final Size tileSize;
|
||||
public final int iconID;
|
||||
public final int horizontalFlipChance;
|
||||
public final int maxAP;
|
||||
public final int maxHP;
|
||||
public final int moveCost;
|
||||
@@ -65,7 +64,6 @@ public final class MonsterType {
|
||||
, AggressionType aggressionType
|
||||
, Size tileSize
|
||||
, int iconID
|
||||
, int horizontalFlipChance
|
||||
, int maxAP
|
||||
, int maxHP
|
||||
, int moveCost
|
||||
@@ -92,7 +90,6 @@ public final class MonsterType {
|
||||
this.aggressionType = aggressionType;
|
||||
this.tileSize = tileSize;
|
||||
this.iconID = iconID;
|
||||
this.horizontalFlipChance = horizontalFlipChance;
|
||||
this.maxAP = maxAP;
|
||||
this.maxHP = maxHP;
|
||||
this.moveCost = moveCost;
|
||||
|
||||
@@ -19,7 +19,6 @@ import com.gpl.rpg.AndorsTrail.AndorsTrailApplication;
|
||||
import com.gpl.rpg.AndorsTrail.context.ControllerContext;
|
||||
import com.gpl.rpg.AndorsTrail.context.WorldContext;
|
||||
import com.gpl.rpg.AndorsTrail.controller.Constants;
|
||||
import com.gpl.rpg.AndorsTrail.model.ChecksumBuilder;
|
||||
import com.gpl.rpg.AndorsTrail.model.ability.ActorCondition;
|
||||
import com.gpl.rpg.AndorsTrail.model.ability.SkillCollection;
|
||||
import com.gpl.rpg.AndorsTrail.model.item.DropListCollection;
|
||||
@@ -112,7 +111,7 @@ public final class Player extends Actor {
|
||||
baseTraits.criticalSkill = 0;
|
||||
baseTraits.criticalMultiplier = 1;
|
||||
baseTraits.damagePotential.set(1, 1);
|
||||
baseTraits.blockChance = 9;
|
||||
baseTraits.blockChance = 0;
|
||||
baseTraits.damageResistance = 0;
|
||||
baseTraits.useItemCost = 5;
|
||||
baseTraits.reequipCost = 5;
|
||||
@@ -476,62 +475,5 @@ public final class Player extends Actor {
|
||||
dest.writeUTF(id);
|
||||
dest.writeLong(savedVersion);
|
||||
}
|
||||
public void addToChecksum(ChecksumBuilder builder) {
|
||||
//builder.add(baseTraits.iconID);// Do not add to checksum so that it can be changed without invalidating checksums
|
||||
builder.add(baseTraits.maxAP);
|
||||
builder.add(baseTraits.maxHP);
|
||||
//builder.add(name);// Do not add to checksum so that it can be changed without invalidating checksums
|
||||
builder.add(moveCost); // TODO: Should we really write this?
|
||||
builder.add(baseTraits.attackCost);
|
||||
builder.add(baseTraits.attackChance);
|
||||
builder.add(baseTraits.criticalSkill);
|
||||
builder.add(baseTraits.criticalMultiplier);
|
||||
baseTraits.damagePotential.addToChecksum(builder);
|
||||
builder.add(baseTraits.blockChance);
|
||||
builder.add(baseTraits.damageResistance);
|
||||
builder.add(baseTraits.moveCost);
|
||||
|
||||
ap.addToChecksum(builder);
|
||||
health.addToChecksum(builder);
|
||||
position.addToChecksum(builder);
|
||||
builder.add(conditions.size());
|
||||
for (ActorCondition c : conditions) {
|
||||
c.addToChecksum(builder);
|
||||
}
|
||||
builder.add(immunities.size());
|
||||
for (ActorCondition c : immunities) {
|
||||
c.addToChecksum(builder);
|
||||
}
|
||||
lastPosition.addToChecksum(builder);
|
||||
nextPosition.addToChecksum(builder);
|
||||
builder.add(level);
|
||||
builder.add(totalExperience);
|
||||
inventory.addToChecksum(builder);
|
||||
builder.add(baseTraits.useItemCost);
|
||||
builder.add(baseTraits.reequipCost);
|
||||
builder.add(skillLevels.size());
|
||||
for (int i = 0; i < skillLevels.size(); ++i) {
|
||||
builder.add(skillLevels.keyAt(i));
|
||||
builder.add(skillLevels.valueAt(i));
|
||||
}
|
||||
builder.add(spawnMap);
|
||||
builder.add(spawnPlace);
|
||||
builder.add(questProgress.size());
|
||||
for(Entry<String, LinkedHashSet<Integer> > e : questProgress.entrySet()) {
|
||||
builder.add(e.getKey());
|
||||
builder.add(e.getValue().size());
|
||||
for(int progress : e.getValue()) {
|
||||
builder.add(progress);
|
||||
}
|
||||
}
|
||||
builder.add(availableSkillIncreases);
|
||||
builder.add(alignments.size());
|
||||
for(Entry<String, Integer> e : alignments.entrySet()) {
|
||||
builder.add(e.getKey());
|
||||
builder.add(e.getValue());
|
||||
}
|
||||
builder.add(id);
|
||||
builder.add(savedVersion);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -5,7 +5,6 @@ import java.io.DataOutputStream;
|
||||
import java.io.IOException;
|
||||
|
||||
import com.gpl.rpg.AndorsTrail.context.WorldContext;
|
||||
import com.gpl.rpg.AndorsTrail.model.ChecksumBuilder;
|
||||
import com.gpl.rpg.AndorsTrail.savegames.LegacySavegameFormatReaderForItemContainer;
|
||||
|
||||
public final class Inventory extends ItemContainer {
|
||||
@@ -209,21 +208,4 @@ public final class Inventory extends ItemContainer {
|
||||
}
|
||||
}
|
||||
}
|
||||
public void addToChecksum(ChecksumBuilder builder) {
|
||||
super.addToChecksum(builder);
|
||||
builder.add(gold);
|
||||
builder.add(NUM_WORN_SLOTS);
|
||||
for(int i = 0; i < NUM_WORN_SLOTS; ++i) {
|
||||
if (wear[i] != null) {
|
||||
builder.add(wear[i].id);
|
||||
}
|
||||
}
|
||||
builder.add(NUM_QUICK_SLOTS);
|
||||
for(int i = 0; i < NUM_QUICK_SLOTS; ++i) {
|
||||
if (quickitem[i] != null) {
|
||||
builder.add(quickitem[i].id);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,7 +8,6 @@ import java.util.Collections;
|
||||
import java.util.Comparator;
|
||||
|
||||
import com.gpl.rpg.AndorsTrail.context.WorldContext;
|
||||
import com.gpl.rpg.AndorsTrail.model.ChecksumBuilder;
|
||||
import com.gpl.rpg.AndorsTrail.model.actor.Player;
|
||||
|
||||
public class ItemContainer {
|
||||
@@ -43,10 +42,6 @@ public class ItemContainer {
|
||||
dest.writeUTF(itemType.id);
|
||||
dest.writeInt(quantity);
|
||||
}
|
||||
public void addToChecksum(ChecksumBuilder builder) {
|
||||
builder.add(itemType.id);
|
||||
builder.add(quantity);
|
||||
}
|
||||
}
|
||||
|
||||
public void addItem(ItemType itemType, int quantity) {
|
||||
@@ -285,10 +280,4 @@ public class ItemContainer {
|
||||
e.writeToParcel(dest);
|
||||
}
|
||||
}
|
||||
public void addToChecksum(ChecksumBuilder builder) {
|
||||
builder.add(items.size());
|
||||
for (ItemEntry e : items) {
|
||||
e.addToChecksum(builder);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -33,10 +33,8 @@ public final class ItemType {
|
||||
public final ItemTraits_OnEquip effects_equip;
|
||||
public final ItemTraits_OnUse effects_use;
|
||||
public final ItemTraits_OnUse effects_hit;
|
||||
public final ItemTraits_OnUse effects_miss;
|
||||
public final ItemTraits_OnUse effects_kill;
|
||||
public final ItemTraits_OnHitReceived effects_hitReceived;
|
||||
public final ItemTraits_OnHitReceived effects_missReceived;
|
||||
|
||||
public ItemType(
|
||||
String id
|
||||
@@ -50,10 +48,8 @@ public final class ItemType {
|
||||
, ItemTraits_OnEquip effects_equip
|
||||
, ItemTraits_OnUse effects_use
|
||||
, ItemTraits_OnUse effects_hit
|
||||
, ItemTraits_OnUse effects_miss
|
||||
, ItemTraits_OnUse effects_kill
|
||||
, ItemTraits_OnHitReceived effects_hitReceived
|
||||
, ItemTraits_OnHitReceived effects_missReceived
|
||||
) {
|
||||
this.id = id;
|
||||
this.iconID = iconID;
|
||||
@@ -67,10 +63,8 @@ public final class ItemType {
|
||||
this.effects_equip = effects_equip;
|
||||
this.effects_use = effects_use;
|
||||
this.effects_hit = effects_hit;
|
||||
this.effects_miss = effects_miss;
|
||||
this.effects_kill = effects_kill;
|
||||
this.effects_hitReceived = effects_hitReceived;
|
||||
this.effects_missReceived = effects_missReceived;
|
||||
this.hasPersonalizedName = name.contains(Constants.PLACEHOLDER_PLAYERNAME);
|
||||
}
|
||||
|
||||
|
||||
@@ -5,7 +5,6 @@ import java.io.DataOutputStream;
|
||||
import java.io.IOException;
|
||||
|
||||
import com.gpl.rpg.AndorsTrail.context.WorldContext;
|
||||
import com.gpl.rpg.AndorsTrail.model.ChecksumBuilder;
|
||||
import com.gpl.rpg.AndorsTrail.savegames.LegacySavegameFormatReaderForItemContainer;
|
||||
import com.gpl.rpg.AndorsTrail.util.Coord;
|
||||
|
||||
@@ -89,12 +88,4 @@ public final class Loot {
|
||||
position.writeToParcel(dest);
|
||||
dest.writeBoolean(isVisible);
|
||||
}
|
||||
|
||||
public void addToChecksum(ChecksumBuilder builder) {
|
||||
builder.add(exp);
|
||||
builder.add(gold);
|
||||
items.addToChecksum(builder);
|
||||
position.addToChecksum(builder);
|
||||
builder.add(isVisible);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,7 +11,6 @@ import java.util.List;
|
||||
import com.gpl.rpg.AndorsTrail.AndorsTrailApplication;
|
||||
import com.gpl.rpg.AndorsTrail.context.ControllerContext;
|
||||
import com.gpl.rpg.AndorsTrail.context.WorldContext;
|
||||
import com.gpl.rpg.AndorsTrail.model.ChecksumBuilder;
|
||||
import com.gpl.rpg.AndorsTrail.savegames.LegacySavegameFormatReaderForMap;
|
||||
import com.gpl.rpg.AndorsTrail.util.L;
|
||||
|
||||
@@ -100,16 +99,4 @@ public final class MapCollection {
|
||||
map.writeToParcel(dest, world);
|
||||
}
|
||||
}
|
||||
|
||||
public void addToChecksum(ChecksumBuilder checksumBuilder, WorldContext world) {
|
||||
List<PredefinedMap> mapsToExport = new ArrayList<PredefinedMap>();
|
||||
for(PredefinedMap map : getAllMaps()) {
|
||||
if (shouldSaveMap(world, map)) mapsToExport.add(map);
|
||||
}
|
||||
checksumBuilder.add(mapsToExport.size());
|
||||
for(PredefinedMap map : mapsToExport) {
|
||||
checksumBuilder.add(map.name);
|
||||
map.addToChecksum(checksumBuilder, world);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,7 +8,6 @@ import java.util.concurrent.CopyOnWriteArrayList;
|
||||
|
||||
import com.gpl.rpg.AndorsTrail.context.WorldContext;
|
||||
import com.gpl.rpg.AndorsTrail.controller.Constants;
|
||||
import com.gpl.rpg.AndorsTrail.model.ChecksumBuilder;
|
||||
import com.gpl.rpg.AndorsTrail.model.actor.Monster;
|
||||
import com.gpl.rpg.AndorsTrail.model.actor.MonsterType;
|
||||
import com.gpl.rpg.AndorsTrail.util.Coord;
|
||||
@@ -18,7 +17,7 @@ import com.gpl.rpg.AndorsTrail.util.Range;
|
||||
public final class MonsterSpawnArea {
|
||||
public final CoordRect area;
|
||||
public final Range quantity;
|
||||
private final Range respawnspeed;
|
||||
private final Range spawnChance;
|
||||
public final String areaID;
|
||||
public final String[] monsterTypeIDs;
|
||||
public final List<Monster> monsters = new CopyOnWriteArrayList<Monster>();
|
||||
@@ -31,7 +30,7 @@ public final class MonsterSpawnArea {
|
||||
public MonsterSpawnArea(
|
||||
CoordRect area
|
||||
, Range quantity
|
||||
, Range respawnspeed
|
||||
, Range spawnChance
|
||||
, String areaID
|
||||
, String[] monsterTypeIDs
|
||||
, boolean isUnique
|
||||
@@ -41,7 +40,7 @@ public final class MonsterSpawnArea {
|
||||
) {
|
||||
this.area = area;
|
||||
this.quantity = quantity;
|
||||
this.respawnspeed = respawnspeed;
|
||||
this.spawnChance = spawnChance;
|
||||
this.areaID = areaID;
|
||||
this.monsterTypeIDs = monsterTypeIDs;
|
||||
this.isUnique = isUnique;
|
||||
@@ -102,7 +101,7 @@ public final class MonsterSpawnArea {
|
||||
}
|
||||
|
||||
public boolean rollShouldSpawn() {
|
||||
return Constants.rollResult(respawnspeed);
|
||||
return Constants.rollResult(spawnChance);
|
||||
}
|
||||
|
||||
public void removeAllMonsters() {
|
||||
@@ -141,12 +140,4 @@ public final class MonsterSpawnArea {
|
||||
m.writeToParcel(dest);
|
||||
}
|
||||
}
|
||||
|
||||
public void addToChecksum(ChecksumBuilder builder) {
|
||||
builder.add(isSpawning);
|
||||
builder.add(monsters.size());
|
||||
for (Monster m : monsters) {
|
||||
m.addToChecksum(builder);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12,7 +12,6 @@ import com.gpl.rpg.AndorsTrail.context.ControllerContext;
|
||||
import com.gpl.rpg.AndorsTrail.context.WorldContext;
|
||||
import com.gpl.rpg.AndorsTrail.controller.Constants;
|
||||
import com.gpl.rpg.AndorsTrail.controller.VisualEffectController.BloodSplatter;
|
||||
import com.gpl.rpg.AndorsTrail.model.ChecksumBuilder;
|
||||
import com.gpl.rpg.AndorsTrail.model.actor.Monster;
|
||||
import com.gpl.rpg.AndorsTrail.model.item.ItemType;
|
||||
import com.gpl.rpg.AndorsTrail.model.item.Loot;
|
||||
@@ -399,30 +398,4 @@ public final class PredefinedMap {
|
||||
dest.writeBoolean(visited);
|
||||
dest.writeUTF(lastSeenLayoutHash);
|
||||
}
|
||||
|
||||
public void addToChecksum(ChecksumBuilder builder, WorldContext world) {
|
||||
if (shouldSaveMapData(world)) {
|
||||
builder.add(true);
|
||||
builder.add(spawnAreas.length);
|
||||
for(MonsterSpawnArea a : spawnAreas) {
|
||||
builder.add(a.areaID);
|
||||
a.addToChecksum(builder);
|
||||
}
|
||||
builder.add(activeMapObjectGroups.size());
|
||||
for(String s : activeMapObjectGroups) {
|
||||
builder.add(s);
|
||||
}
|
||||
builder.add(groundBags.size());
|
||||
for(Loot l : groundBags) {
|
||||
l.addToChecksum(builder);
|
||||
}
|
||||
builder.add(currentColorFilter != null);
|
||||
if (currentColorFilter != null) builder.add(currentColorFilter);
|
||||
builder.add(lastVisitTime);
|
||||
} else {
|
||||
builder.add(false);
|
||||
}
|
||||
builder.add(visited);
|
||||
builder.add(lastSeenLayoutHash);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -115,7 +115,7 @@ public final class TMXMapTranslator {
|
||||
boolean isActiveForNewGame = true;
|
||||
boolean ignoreAreas = false;
|
||||
int maxQuantity = 1;
|
||||
int respawnspeed = 10;
|
||||
int spawnChance = 10;
|
||||
String spawnGroup = object.name;
|
||||
for (TMXProperty p : object.properties) {
|
||||
if (AndorsTrailApplication.DEVELOPMENT_VALIDATEDATA) {
|
||||
@@ -126,8 +126,8 @@ public final class TMXMapTranslator {
|
||||
}
|
||||
if (p.name.equalsIgnoreCase("quantity")) {
|
||||
maxQuantity = Integer.parseInt(p.value);
|
||||
} else if (p.name.equalsIgnoreCase("respawnspeed")) {
|
||||
respawnspeed = Integer.parseInt(p.value);
|
||||
} else if (p.name.equalsIgnoreCase("spawnchance")) {
|
||||
spawnChance = Integer.parseInt(p.value);
|
||||
} else if (p.name.equalsIgnoreCase("active")) {
|
||||
isActiveForNewGame = Boolean.parseBoolean(p.value);
|
||||
} else if (p.name.equalsIgnoreCase("ignoreAreas")) {
|
||||
@@ -155,7 +155,7 @@ public final class TMXMapTranslator {
|
||||
MonsterSpawnArea area = new MonsterSpawnArea(
|
||||
position
|
||||
,new Range(maxQuantity, 0)
|
||||
,new Range(1000, respawnspeed)
|
||||
,new Range(1000, spawnChance)
|
||||
,object.name
|
||||
,monsterTypeIDs
|
||||
,isUnique
|
||||
@@ -405,11 +405,6 @@ public final class TMXMapTranslator {
|
||||
int tileID = tileCache.getTileID(tile.tilesetName, tile.localId);
|
||||
result.tiles[dx][dy] = tileID;
|
||||
usedTileIDs.add(tileID);
|
||||
if(AndorsTrailApplication.DEVELOPMENT_VALIDATEDATA){
|
||||
if(tileID == 0){
|
||||
L.log("Tileid 0 in "+ tile.tilesetName);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return result;
|
||||
|
||||
@@ -21,11 +21,6 @@ public final class Requirement {
|
||||
,random
|
||||
,factionScoreEquals
|
||||
,wearRemove
|
||||
,date
|
||||
,dateEquals
|
||||
,time
|
||||
,timeEquals
|
||||
,skillIncrease // Check if possible to increase
|
||||
}
|
||||
|
||||
public final RequirementType requireType;
|
||||
@@ -86,13 +81,8 @@ public final class Requirement {
|
||||
case questProgress:
|
||||
return requireID != null && value >= 0;
|
||||
case skillLevel:
|
||||
case skillIncrease:
|
||||
return requireID != null && value >= 0;
|
||||
case spentGold:
|
||||
case date:
|
||||
case dateEquals:
|
||||
case time:
|
||||
case timeEquals:
|
||||
return value >= 0;
|
||||
case random:
|
||||
return chance != null;
|
||||
|
||||
@@ -18,7 +18,6 @@ public final class ScriptEffect {
|
||||
, deactivateMapObjectGroup
|
||||
, removeQuestProgress
|
||||
, changeMapFilter
|
||||
, mapchange
|
||||
}
|
||||
|
||||
public final ScriptEffectType type;
|
||||
|
||||
@@ -137,8 +137,7 @@ public final class ResourceLoader {
|
||||
final ItemTypeParser itemTypeParser = new ItemTypeParser(loader, world.actorConditionsTypes, world.itemCategories, translationLoader);
|
||||
final TypedArray itemsToLoad = r.obtainTypedArray(itemsResourceId);
|
||||
for (int i = 0; i < itemsToLoad.length(); ++i) {
|
||||
String s = readStringFromRaw(r, itemsToLoad, i);
|
||||
world.itemTypes.initialize(itemTypeParser, s);
|
||||
world.itemTypes.initialize(itemTypeParser, readStringFromRaw(r, itemsToLoad, i));
|
||||
}
|
||||
itemsToLoad.recycle();
|
||||
if (AndorsTrailApplication.DEVELOPMENT_DEBUGMESSAGES) timingCheckpoint("ItemTypeParser");
|
||||
@@ -251,20 +250,14 @@ public final class ResourceLoader {
|
||||
|
||||
private static void prepareTilesets(DynamicTileLoader loader, int mTileSize) {
|
||||
final Size sz1x1 = new Size(1, 1);
|
||||
final Size sz1x2 = new Size(1, 2);
|
||||
final Size sz2x1 = new Size(2, 1);
|
||||
final Size sz2x2 = new Size(2, 2);
|
||||
final Size sz2x3 = new Size(2, 3);
|
||||
final Size sz3x1 = new Size(3, 1);
|
||||
final Size sz4x1 = new Size(4, 1);
|
||||
final Size sz5x1 = new Size(5, 1);
|
||||
final Size sz6x1 = new Size(6, 1);
|
||||
final Size sz7x1 = new Size(7, 1);
|
||||
final Size sz7x4 = new Size(7, 4);
|
||||
final Size sz8x3 = new Size(8, 3);
|
||||
final Size sz8x4 = new Size(8, 4);
|
||||
final Size sz16x8 = new Size(16, 8);
|
||||
final Size sz16x10 = new Size(16, 10);
|
||||
final Size sz20x12 = new Size(20, 12);
|
||||
final Size mapTileSize = new Size(16, 8);
|
||||
final Size sz8x8 = new Size(8, 8);
|
||||
@@ -281,199 +274,83 @@ public final class ResourceLoader {
|
||||
loader.prepareTileset(R.drawable.ui_icon_immunity, "ui_icon_immunity", sz1x1, sz1x1, mTileSize);
|
||||
loader.prepareTileset(R.drawable.map_dynamic_placeholders, "map_dynamic_placeholders", new Size(10, 2), sz1x1, mTileSize);
|
||||
|
||||
loader.prepareTileset(R.drawable.actorconditions_1, "actorconditions_1", new Size(14, 8), sz1x1, mTileSize);
|
||||
loader.prepareTileset(R.drawable.actorconditions_2, "actorconditions_2", sz3x1, sz1x1, mTileSize);
|
||||
loader.prepareTileset(R.drawable.actorconditions_japozero, "actorconditions_japozero", new Size(16, 4), sz1x1, mTileSize);
|
||||
loader.prepareTileset(R.drawable.actorconditions_newb, "actorconditions_newb", new Size(20, 1), sz1x1, mTileSize);
|
||||
loader.prepareTileset(R.drawable.actorconditions_omi1, "actorconditions_omi1", sz2x1, sz1x1, mTileSize);
|
||||
loader.prepareTileset(R.drawable.actorconditions_omi2, "actorconditions_omi2", sz5x1, sz1x1, mTileSize);
|
||||
/*INSERT_ACTORCONDITIONS_TILESETS_HERE*/
|
||||
|
||||
loader.prepareTileset(R.drawable.items_armours, "items_armours", new Size(14, 3), sz1x1, mTileSize);
|
||||
loader.prepareTileset(R.drawable.items_weapons, "items_weapons", new Size(14, 6), sz1x1, mTileSize);
|
||||
loader.prepareTileset(R.drawable.items_jewelry, "items_jewelry", new Size(14, 1), sz1x1, mTileSize);
|
||||
loader.prepareTileset(R.drawable.items_consumables, "items_consumables", new Size(14, 5), sz1x1, mTileSize);
|
||||
loader.prepareTileset(R.drawable.items_books, "items_books", new Size(11, 1), sz1x1, mTileSize);
|
||||
loader.prepareTileset(R.drawable.items_misc, "items_misc", new Size(14, 4), sz1x1, mTileSize);
|
||||
loader.prepareTileset(R.drawable.items_misc_2, "items_misc_2", sz20x12, sz1x1, mTileSize);
|
||||
loader.prepareTileset(R.drawable.items_misc_3, "items_misc_3", sz20x12, sz1x1, mTileSize);
|
||||
loader.prepareTileset(R.drawable.items_misc_4, "items_misc_4", new Size(20, 4), sz1x1, mTileSize);
|
||||
loader.prepareTileset(R.drawable.items_misc_5, "items_misc_5", new Size(9, 5), sz1x1, mTileSize);
|
||||
loader.prepareTileset(R.drawable.items_misc_6, "items_misc_6", new Size(9, 4), sz1x1, mTileSize);
|
||||
loader.prepareTileset(R.drawable.items_reterski_1, "items_reterski_1", new Size(3, 10), sz1x1, mTileSize);
|
||||
loader.prepareTileset(R.drawable.items_tometik1, "items_tometik1", new Size(6, 10), sz1x1, mTileSize);
|
||||
loader.prepareTileset(R.drawable.items_tometik2, "items_tometik2", new Size(10, 10), sz1x1, mTileSize);
|
||||
loader.prepareTileset(R.drawable.items_tometik3, "items_tometik3", new Size(8, 6), sz1x1, mTileSize);
|
||||
loader.prepareTileset(R.drawable.items_necklaces_1, "items_necklaces_1", new Size(10, 3), sz1x1, mTileSize);
|
||||
loader.prepareTileset(R.drawable.items_weapons_2, "items_weapons_2", new Size(7, 1), sz1x1, mTileSize);
|
||||
loader.prepareTileset(R.drawable.items_weapons_3, "items_weapons_3", new Size(13, 5), sz1x1, mTileSize);
|
||||
|
||||
loader.prepareTileset(R.drawable.items_armours_2, "items_armours_2", sz7x1, sz1x1, mTileSize);
|
||||
loader.prepareTileset(R.drawable.items_armours_3, "items_armours_3", new Size(10, 4), sz1x1, mTileSize);
|
||||
loader.prepareTileset(R.drawable.items_consumables_omi1, "items_consumables_omi1", sz1x1, sz1x1, mTileSize);
|
||||
loader.prepareTileset(R.drawable.items_feygard1, "items_feygard1", new Size(6, 2), sz1x1, mTileSize);
|
||||
loader.prepareTileset(R.drawable.items_g03_package_omi1, "items_g03_package_omi1", sz1x1, sz1x1, mTileSize);
|
||||
loader.prepareTileset(R.drawable.items_japozero, "items_japozero", new Size(16, 37), sz1x1, mTileSize);
|
||||
loader.prepareTileset(R.drawable.items_newb, "items_newb", new Size(32, 27), sz1x1, mTileSize);
|
||||
loader.prepareTileset(R.drawable.items_omi2, "items_omi2", new Size(6, 5), sz1x1, mTileSize);
|
||||
loader.prepareTileset(R.drawable.items_omgeeky, "items_omgeeky", new Size(10, 3), sz1x1, mTileSize);
|
||||
loader.prepareTileset(R.drawable.items_phoenix01, "items_phoenix01", sz16x8, sz1x1, mTileSize);
|
||||
loader.prepareTileset(R.drawable.items_rijackson_1, "items_rijackson_1", new Size(5, 4), sz1x1, mTileSize);
|
||||
loader.prepareTileset(R.drawable.items_rings_1, "items_rings_1", new Size(10, 3), sz1x1, mTileSize);
|
||||
/*INSERT_ITEMS_TILESETS_HERE*/
|
||||
|
||||
loader.prepareTileset(R.drawable.monsters_armor1, "monsters_armor1", sz1x1, sz1x1, mTileSize);
|
||||
loader.prepareTileset(R.drawable.monsters_cyclops, "monsters_cyclops", sz1x1, sz2x3, mTileSize);
|
||||
loader.prepareTileset(R.drawable.monsters_demon1, "monsters_demon1", sz1x1, sz2x2, mTileSize);
|
||||
loader.prepareTileset(R.drawable.monsters_demon2, "monsters_demon2", sz1x1, sz2x2, mTileSize);
|
||||
loader.prepareTileset(R.drawable.monsters_dogs, "monsters_dogs", sz7x4, sz1x1, mTileSize);
|
||||
loader.prepareTileset(R.drawable.monsters_eye1, "monsters_eye1", sz1x1, sz1x1, mTileSize);
|
||||
loader.prepareTileset(R.drawable.monsters_eye2, "monsters_eye2", sz1x1, sz1x1, mTileSize);
|
||||
loader.prepareTileset(R.drawable.monsters_eye3, "monsters_eye3", sz1x1, sz1x1, mTileSize);
|
||||
loader.prepareTileset(R.drawable.monsters_eye4, "monsters_eye4", sz1x1, sz1x1, mTileSize);
|
||||
loader.prepareTileset(R.drawable.monsters_ghost1, "monsters_ghost1", sz1x1, sz1x1, mTileSize);
|
||||
loader.prepareTileset(R.drawable.monsters_hydra1, "monsters_hydra1", sz1x1, sz2x2, mTileSize);
|
||||
loader.prepareTileset(R.drawable.monsters_insects, "monsters_insects", sz16x8, sz1x1, mTileSize);
|
||||
loader.prepareTileset(R.drawable.monsters_johny, "monsters_johny", sz20x12, sz1x1, mTileSize);
|
||||
loader.prepareTileset(R.drawable.monsters_karvis1, "monsters_karvis1", sz2x1, sz1x1, mTileSize);
|
||||
loader.prepareTileset(R.drawable.monsters_karvis2, "monsters_karvis2", new Size(9, 1), sz1x1, mTileSize);
|
||||
loader.prepareTileset(R.drawable.monsters_ld1, "monsters_ld1", sz20x12, sz1x1, mTileSize);
|
||||
loader.prepareTileset(R.drawable.monsters_ld2, "monsters_ld2", sz20x12, sz1x1, mTileSize);
|
||||
loader.prepareTileset(R.drawable.monsters_liches, "monsters_liches", new Size(4, 1), sz1x1, mTileSize);
|
||||
loader.prepareTileset(R.drawable.monsters_mage, "monsters_mage", sz1x1, sz1x1, mTileSize);
|
||||
loader.prepareTileset(R.drawable.monsters_mage2, "monsters_mage2", sz1x1, sz1x1, mTileSize);
|
||||
loader.prepareTileset(R.drawable.monsters_man1, "monsters_man1", sz1x1, sz1x1, mTileSize);
|
||||
loader.prepareTileset(R.drawable.monsters_men, "monsters_men", new Size(9, 1), sz1x1, mTileSize);
|
||||
loader.prepareTileset(R.drawable.monsters_men2, "monsters_men2", new Size(10, 1), sz1x1, mTileSize);
|
||||
loader.prepareTileset(R.drawable.monsters_misc, "monsters_misc", new Size(13, 1), sz1x1, mTileSize);
|
||||
loader.prepareTileset(R.drawable.monsters_newb_1, "monsters_newb_1", new Size(40, 34), sz1x1, mTileSize);
|
||||
loader.prepareTileset(R.drawable.monsters_newb_2, "monsters_newb_2", new Size(8, 2), sz1x2, mTileSize);
|
||||
loader.prepareTileset(R.drawable.monsters_newb_3, "monsters_newb_3", new Size(10, 10), sz2x2, mTileSize);
|
||||
loader.prepareTileset(R.drawable.monsters_newb_4, "monsters_newb_4", new Size(4, 1), sz2x1, mTileSize);
|
||||
loader.prepareTileset(R.drawable.monsters_rats, "monsters_rats", new Size(5, 1), sz1x1, mTileSize);
|
||||
loader.prepareTileset(R.drawable.monsters_redshrike1, "monsters_redshrike1", sz7x1, sz1x1, mTileSize);
|
||||
loader.prepareTileset(R.drawable.monsters_rltiles1, "monsters_rltiles1", new Size(20, 8), sz1x1, mTileSize);
|
||||
loader.prepareTileset(R.drawable.monsters_rltiles2, "monsters_rltiles2", new Size(20, 9), sz1x1, mTileSize);
|
||||
loader.prepareTileset(R.drawable.monsters_rltiles3, "monsters_rltiles3", new Size(10, 3), sz1x1, mTileSize);
|
||||
loader.prepareTileset(R.drawable.monsters_rltiles4, "monsters_rltiles4", new Size(12, 4), sz1x1, mTileSize);
|
||||
loader.prepareTileset(R.drawable.monsters_rogue1, "monsters_rogue1", sz1x1, sz1x1, mTileSize);
|
||||
loader.prepareTileset(R.drawable.monsters_skeleton1, "monsters_skeleton1", sz1x1, sz1x1, mTileSize);
|
||||
loader.prepareTileset(R.drawable.monsters_skeleton2, "monsters_skeleton2", sz1x1, sz1x1, mTileSize);
|
||||
loader.prepareTileset(R.drawable.monsters_snakes, "monsters_snakes", sz6x1, sz1x1, mTileSize);
|
||||
loader.prepareTileset(R.drawable.monsters_tometik1, "monsters_tometik1", new Size(10, 9), sz1x1, mTileSize);
|
||||
loader.prepareTileset(R.drawable.monsters_tometik2, "monsters_tometik2", new Size(8, 10), sz1x1, mTileSize);
|
||||
loader.prepareTileset(R.drawable.monsters_tometik3, "monsters_tometik3", new Size(6, 13), sz1x1, mTileSize);
|
||||
loader.prepareTileset(R.drawable.monsters_tometik4, "monsters_tometik4", new Size(6, 13), sz1x1, mTileSize);
|
||||
loader.prepareTileset(R.drawable.monsters_tometik5, "monsters_tometik5", new Size(6, 16), sz1x1, mTileSize);
|
||||
loader.prepareTileset(R.drawable.monsters_tometik6, "monsters_tometik6", new Size(7, 6), sz1x1, mTileSize);
|
||||
loader.prepareTileset(R.drawable.monsters_tometik7, "monsters_tometik7", new Size(8, 11), sz1x1, mTileSize);
|
||||
loader.prepareTileset(R.drawable.monsters_tometik8, "monsters_tometik8", new Size(7, 9), sz1x1, mTileSize);
|
||||
loader.prepareTileset(R.drawable.monsters_tometik9, "monsters_tometik9", new Size(8, 8), sz1x1, mTileSize);
|
||||
loader.prepareTileset(R.drawable.monsters_tometik10, "monsters_tometik10", new Size(6, 13), sz1x1, mTileSize);
|
||||
loader.prepareTileset(R.drawable.monsters_wraiths, "monsters_wraiths", sz3x1, sz1x1, mTileSize);
|
||||
loader.prepareTileset(R.drawable.monsters_zombie1, "monsters_zombie1", sz1x1, sz1x1, mTileSize);
|
||||
loader.prepareTileset(R.drawable.monsters_zombie2, "monsters_zombie2", sz1x1, sz1x1, mTileSize);
|
||||
loader.prepareTileset(R.drawable.monsters_guynmart, "monsters_guynmart", new Size(8, 2), sz1x1, mTileSize);
|
||||
loader.prepareTileset(R.drawable.monsters_maksiu1, "monsters_maksiu1", new Size(4, 4), sz1x1, mTileSize);
|
||||
loader.prepareTileset(R.drawable.monsters_omi1, "monsters_omi1", sz2x1, sz1x1, mTileSize);
|
||||
loader.prepareTileset(R.drawable.monsters_omi1_b, "monsters_omi1_b", sz1x1, sz1x1, mTileSize);
|
||||
loader.prepareTileset(R.drawable.monsters_unknown, "monsters_unknown", sz1x1, sz1x1, mTileSize);
|
||||
loader.prepareTileset(R.drawable.monsters_arulirs, "monsters_arulirs", new Size(8, 2), sz1x1, mTileSize);
|
||||
loader.prepareTileset(R.drawable.monsters_fatboy73, "monsters_fatboy73", sz20x12, sz1x1, mTileSize);
|
||||
loader.prepareTileset(R.drawable.monsters_giantbasilisk, "monsters_giantbasilisk", sz1x1, sz2x2, mTileSize);
|
||||
loader.prepareTileset(R.drawable.monsters_gisons, "monsters_gisons", new Size(8, 2), sz1x1, mTileSize);
|
||||
loader.prepareTileset(R.drawable.monsters_bosses_2x2, "monsters_bosses_2x2", sz8x4, sz2x2, mTileSize);
|
||||
loader.prepareTileset(R.drawable.monsters_omi2, "monsters_omi2", sz8x3, sz1x1, mTileSize);
|
||||
loader.prepareTileset(R.drawable.monsters_phoenix01, "monsters_phoenix01", sz16x8, sz1x1, mTileSize);
|
||||
loader.prepareTileset(R.drawable.monsters_cats, "monsters_cats", new Size(10, 2), sz1x1, mTileSize);
|
||||
loader.prepareTileset(R.drawable.monsters_1x2, "monsters_1x2", new Size(10, 5), sz1x2, mTileSize);
|
||||
/*INSERT_NPCS_TILESETS_HERE*/
|
||||
|
||||
loader.prepareTileset(R.drawable.map_bed_1, "map_bed_1", sz16x10, sz1x1, mTileSize);
|
||||
loader.prepareTileset(R.drawable.map_boats_1, "map_boats_1", new Size(16, 9), sz1x1, mTileSize);
|
||||
loader.prepareTileset(R.drawable.map_border_1, "map_border_1", mapTileSize, sz1x1, mTileSize);
|
||||
loader.prepareTileset(R.drawable.map_bridge_1, "map_bridge_1", mapTileSize, sz1x1, mTileSize);
|
||||
loader.prepareTileset(R.drawable.map_bridge_2, "map_bridge_2", mapTileSize, sz1x1, mTileSize);
|
||||
loader.prepareTileset(R.drawable.map_brightport, "map_brightport", new Size(16, 7), sz1x1, mTileSize);
|
||||
loader.prepareTileset(R.drawable.map_broken_1, "map_broken_1", mapTileSize, sz1x1, mTileSize);
|
||||
loader.prepareTileset(R.drawable.map_cavewall_1, "map_cavewall_1", new Size(18, 6), sz1x1, mTileSize);
|
||||
loader.prepareTileset(R.drawable.map_cavewall_2, "map_cavewall_2", new Size(18, 6), sz1x1, mTileSize);
|
||||
loader.prepareTileset(R.drawable.map_cavewall_3, "map_cavewall_3", new Size(18, 6), sz1x1, mTileSize);
|
||||
loader.prepareTileset(R.drawable.map_cavewall_4, "map_cavewall_4", new Size(18, 6), sz1x1, mTileSize);
|
||||
loader.prepareTileset(R.drawable.map_cavewall_5, "map_cavewall_5", new Size(6, 6), sz1x1, mTileSize);
|
||||
loader.prepareTileset(R.drawable.map_cavewall_6, "map_cavewall_6", new Size(18, 6), sz1x1, mTileSize);
|
||||
loader.prepareTileset(R.drawable.map_chair_table_1, "map_chair_table_1", mapTileSize, sz1x1, mTileSize);
|
||||
loader.prepareTileset(R.drawable.map_chair_table_2, "map_chair_table_2", mapTileSize, sz1x1, mTileSize);
|
||||
loader.prepareTileset(R.drawable.map_crate_1, "map_crate_1", mapTileSize, sz1x1, mTileSize);
|
||||
loader.prepareTileset(R.drawable.map_cupboard_1, "map_cupboard_1", mapTileSize, sz1x1, mTileSize);
|
||||
loader.prepareTileset(R.drawable.map_curtain_1, "map_curtain_1", mapTileSize, sz1x1, mTileSize);
|
||||
loader.prepareTileset(R.drawable.map_entrance_1, "map_entrance_1", mapTileSize, sz1x1, mTileSize);
|
||||
loader.prepareTileset(R.drawable.map_entrance_2, "map_entrance_2", mapTileSize, sz1x1, mTileSize);
|
||||
loader.prepareTileset(R.drawable.map_entrance_3, "map_entrance_3", mapTileSize, sz1x1, mTileSize);
|
||||
loader.prepareTileset(R.drawable.map_fence_1, "map_fence_1", mapTileSize, sz1x1, mTileSize);
|
||||
loader.prepareTileset(R.drawable.map_fence_2, "map_fence_2", mapTileSize, sz1x1, mTileSize);
|
||||
loader.prepareTileset(R.drawable.map_fence_3, "map_fence_3", mapTileSize, sz1x1, mTileSize);
|
||||
loader.prepareTileset(R.drawable.map_fence_4, "map_fence_4", mapTileSize, sz1x1, mTileSize);
|
||||
loader.prepareTileset(R.drawable.map_ground_1, "map_ground_1", mapTileSize, sz1x1, mTileSize);
|
||||
loader.prepareTileset(R.drawable.map_ground_2, "map_ground_2", mapTileSize, sz1x1, mTileSize);
|
||||
loader.prepareTileset(R.drawable.map_ground_3, "map_ground_3", mapTileSize, sz1x1, mTileSize);
|
||||
loader.prepareTileset(R.drawable.map_ground_4, "map_ground_4", mapTileSize, sz1x1, mTileSize);
|
||||
loader.prepareTileset(R.drawable.map_ground_5, "map_ground_5", mapTileSize, sz1x1, mTileSize);
|
||||
loader.prepareTileset(R.drawable.map_ground_6, "map_ground_6", mapTileSize, sz1x1, mTileSize);
|
||||
loader.prepareTileset(R.drawable.map_ground_7, "map_ground_7", mapTileSize, sz1x1, mTileSize);
|
||||
loader.prepareTileset(R.drawable.map_ground_8, "map_ground_8", mapTileSize, sz1x1, mTileSize);
|
||||
loader.prepareTileset(R.drawable.map_ground_9, "map_ground_9", mapTileSize, sz1x1, mTileSize);
|
||||
loader.prepareTileset(R.drawable.map_guynmart, "map_guynmart", mapTileSize, sz1x1, mTileSize);
|
||||
loader.prepareTileset(R.drawable.map_house_1, "map_house_1", mapTileSize, sz1x1, mTileSize);
|
||||
loader.prepareTileset(R.drawable.map_house_2, "map_house_2", mapTileSize, sz1x1, mTileSize);
|
||||
loader.prepareTileset(R.drawable.map_indoor_1, "map_indoor_1", mapTileSize, sz1x1, mTileSize);
|
||||
loader.prepareTileset(R.drawable.map_indoor_2, "map_indoor_2", mapTileSize, sz1x1, mTileSize);
|
||||
loader.prepareTileset(R.drawable.map_items, "map_items", mapTileSize, sz1x1, mTileSize);
|
||||
loader.prepareTileset(R.drawable.map_kitchen_1, "map_kitchen_1", mapTileSize, sz1x1, mTileSize);
|
||||
loader.prepareTileset(R.drawable.map_outdoor_1, "map_outdoor_1", mapTileSize, sz1x1, mTileSize);
|
||||
loader.prepareTileset(R.drawable.map_outdoor_2, "map_outdoor_2", mapTileSize, sz1x1, mTileSize);
|
||||
loader.prepareTileset(R.drawable.map_pillar_1, "map_pillar_1", mapTileSize, sz1x1, mTileSize);
|
||||
loader.prepareTileset(R.drawable.map_pillar_2, "map_pillar_2", mapTileSize, sz1x1, mTileSize);
|
||||
loader.prepareTileset(R.drawable.map_pillar_3, "map_pillar_3", new Size(16, 10), sz1x1, mTileSize);
|
||||
loader.prepareTileset(R.drawable.map_plant_1, "map_plant_1", mapTileSize, sz1x1, mTileSize);
|
||||
loader.prepareTileset(R.drawable.map_plant_2, "map_plant_2", mapTileSize, sz1x1, mTileSize);
|
||||
loader.prepareTileset(R.drawable.map_plant_3, "map_plant_3", mapTileSize, sz1x1, mTileSize);
|
||||
loader.prepareTileset(R.drawable.map_plateau, "map_plateau", mapTileSize, sz1x1, mTileSize);
|
||||
loader.prepareTileset(R.drawable.map_plateau_2, "map_plateau_2", new Size(8, 8), sz1x1, mTileSize);
|
||||
loader.prepareTileset(R.drawable.map_ratdom, "map_ratdom", new Size(18, 6), sz1x1, mTileSize);
|
||||
loader.prepareTileset(R.drawable.map_rock_1, "map_rock_1", mapTileSize, sz1x1, mTileSize);
|
||||
loader.prepareTileset(R.drawable.map_rock_2, "map_rock_2", mapTileSize, sz1x1, mTileSize);
|
||||
loader.prepareTileset(R.drawable.map_rock_3, "map_rock_3", new Size(6, 5), sz1x1, mTileSize);
|
||||
loader.prepareTileset(R.drawable.map_roof_1, "map_roof_1", mapTileSize, sz1x1, mTileSize);
|
||||
loader.prepareTileset(R.drawable.map_roof_2, "map_roof_2", mapTileSize, sz1x1, mTileSize);
|
||||
loader.prepareTileset(R.drawable.map_roof_3, "map_roof_3", mapTileSize, sz1x1, mTileSize);
|
||||
loader.prepareTileset(R.drawable.map_roof_4, "map_roof_4", mapTileSize, sz1x1, mTileSize);
|
||||
loader.prepareTileset(R.drawable.map_roof_5, "map_roof_5", mapTileSize, sz1x1, mTileSize);
|
||||
loader.prepareTileset(R.drawable.map_shop_1, "map_shop_1", mapTileSize, sz1x1, mTileSize);
|
||||
loader.prepareTileset(R.drawable.map_sign_ladder_1, "map_sign_ladder_1", mapTileSize, sz1x1, mTileSize);
|
||||
loader.prepareTileset(R.drawable.map_sign_ladder_omi2, "map_sign_ladder_omi2", new Size(8, 4), sz1x1, mTileSize);
|
||||
loader.prepareTileset(R.drawable.map_table_1, "map_table_1", mapTileSize, sz1x1, mTileSize);
|
||||
loader.prepareTileset(R.drawable.map_table_2, "map_table_2", new Size(14, 8), sz1x1, mTileSize);
|
||||
loader.prepareTileset(R.drawable.map_temple_1, "map_temple_1", new Size(23, 16), sz1x1, mTileSize);
|
||||
loader.prepareTileset(R.drawable.map_trail_1, "map_trail_1", mapTileSize, sz1x1, mTileSize);
|
||||
loader.prepareTileset(R.drawable.map_transition_1, "map_transition_1", mapTileSize, sz1x1, mTileSize);
|
||||
loader.prepareTileset(R.drawable.map_transition_2, "map_transition_2", mapTileSize, sz1x1, mTileSize);
|
||||
loader.prepareTileset(R.drawable.map_transition_3, "map_transition_3", mapTileSize, sz1x1, mTileSize);
|
||||
loader.prepareTileset(R.drawable.map_transition_4, "map_transition_4", mapTileSize, sz1x1, mTileSize);
|
||||
loader.prepareTileset(R.drawable.map_transition_5, "map_transition_5", mapTileSize, sz1x1, mTileSize);
|
||||
loader.prepareTileset(R.drawable.map_transition_6, "map_transition_6", new Size(18, 8), sz1x1, mTileSize);
|
||||
loader.prepareTileset(R.drawable.map_tree_1, "map_tree_1", mapTileSize, sz1x1, mTileSize);
|
||||
loader.prepareTileset(R.drawable.map_tree_2, "map_tree_2", mapTileSize, sz1x1, mTileSize);
|
||||
loader.prepareTileset(R.drawable.map_tree_3, "map_tree_3", new Size(32, 17), sz1x1, mTileSize);
|
||||
loader.prepareTileset(R.drawable.map_tree_4, "map_tree_4", new Size(16, 8), sz1x1, mTileSize);
|
||||
loader.prepareTileset(R.drawable.map_wall_1, "map_wall_1", mapTileSize, sz1x1, mTileSize);
|
||||
loader.prepareTileset(R.drawable.map_wall_2, "map_wall_2", new Size(15, 8), sz1x1, mTileSize);
|
||||
loader.prepareTileset(R.drawable.map_wall_3, "map_wall_3", new Size(15, 8), sz1x1, mTileSize);
|
||||
loader.prepareTileset(R.drawable.map_wall_4, "map_wall_4", new Size(15, 8), sz1x1, mTileSize);
|
||||
loader.prepareTileset(R.drawable.map_window_1, "map_window_1", mapTileSize, sz1x1, mTileSize);
|
||||
loader.prepareTileset(R.drawable.map_window_2, "map_window_2", mapTileSize, sz1x1, mTileSize);
|
||||
loader.prepareTileset(R.drawable.map_items_japozero, "map_items_japozero", new Size(16, 37), sz1x1, mTileSize);
|
||||
/*INSERT_MAP_TILESETS_HERE*/
|
||||
loader.prepareTileset(R.drawable.monsters_bosses_2x2, "monsters_bosses_2x2", sz1x1, sz2x2, mTileSize);
|
||||
|
||||
loader.prepareTileset(R.drawable.map_0, "map_0", sz8x8, sz1x1, mTileSize);
|
||||
loader.prepareTileset(R.drawable.map_1, "map_1", sz8x8, sz1x1, mTileSize);
|
||||
loader.prepareTileset(R.drawable.map_10, "map_10", sz8x8, sz1x1, mTileSize);
|
||||
loader.prepareTileset(R.drawable.map_11, "map_11", sz8x8, sz1x1, mTileSize);
|
||||
loader.prepareTileset(R.drawable.map_12, "map_12", sz8x8, sz1x1, mTileSize);
|
||||
loader.prepareTileset(R.drawable.map_13, "map_13", sz8x8, sz1x1, mTileSize);
|
||||
loader.prepareTileset(R.drawable.map_14, "map_14", sz8x8, sz1x1, mTileSize);
|
||||
loader.prepareTileset(R.drawable.map_15, "map_15", sz8x8, sz1x1, mTileSize);
|
||||
loader.prepareTileset(R.drawable.map_16, "map_16", sz8x8, sz1x1, mTileSize);
|
||||
loader.prepareTileset(R.drawable.map_17, "map_17", sz8x8, sz1x1, mTileSize);
|
||||
loader.prepareTileset(R.drawable.map_18, "map_18", sz8x8, sz1x1, mTileSize);
|
||||
loader.prepareTileset(R.drawable.map_19, "map_19", sz8x8, sz1x1, mTileSize);
|
||||
loader.prepareTileset(R.drawable.map_2, "map_2", sz8x8, sz1x1, mTileSize);
|
||||
loader.prepareTileset(R.drawable.map_20, "map_20", sz8x8, sz1x1, mTileSize);
|
||||
loader.prepareTileset(R.drawable.map_21, "map_21", sz8x8, sz1x1, mTileSize);
|
||||
loader.prepareTileset(R.drawable.map_22, "map_22", sz8x8, sz1x1, mTileSize);
|
||||
loader.prepareTileset(R.drawable.map_23, "map_23", sz8x8, sz1x1, mTileSize);
|
||||
loader.prepareTileset(R.drawable.map_24, "map_24", sz8x8, sz1x1, mTileSize);
|
||||
loader.prepareTileset(R.drawable.map_25, "map_25", sz8x8, sz1x1, mTileSize);
|
||||
loader.prepareTileset(R.drawable.map_26, "map_26", sz8x8, sz1x1, mTileSize);
|
||||
loader.prepareTileset(R.drawable.map_27, "map_27", sz8x8, sz1x1, mTileSize);
|
||||
loader.prepareTileset(R.drawable.map_28, "map_28", sz8x8, sz1x1, mTileSize);
|
||||
loader.prepareTileset(R.drawable.map_29, "map_29", sz8x8, sz1x1, mTileSize);
|
||||
loader.prepareTileset(R.drawable.map_3, "map_3", sz8x8, sz1x1, mTileSize);
|
||||
loader.prepareTileset(R.drawable.map_30, "map_30", sz8x8, sz1x1, mTileSize);
|
||||
loader.prepareTileset(R.drawable.map_31, "map_31", sz8x8, sz1x1, mTileSize);
|
||||
loader.prepareTileset(R.drawable.map_32, "map_32", sz8x8, sz1x1, mTileSize);
|
||||
loader.prepareTileset(R.drawable.map_33, "map_33", sz8x8, sz1x1, mTileSize);
|
||||
loader.prepareTileset(R.drawable.map_34, "map_34", sz8x8, sz1x1, mTileSize);
|
||||
loader.prepareTileset(R.drawable.map_35, "map_35", sz8x8, sz1x1, mTileSize);
|
||||
loader.prepareTileset(R.drawable.map_36, "map_36", sz8x8, sz1x1, mTileSize);
|
||||
loader.prepareTileset(R.drawable.map_37, "map_37", sz8x8, sz1x1, mTileSize);
|
||||
loader.prepareTileset(R.drawable.map_38, "map_38", sz8x8, sz1x1, mTileSize);
|
||||
loader.prepareTileset(R.drawable.map_39, "map_39", sz8x8, sz1x1, mTileSize);
|
||||
loader.prepareTileset(R.drawable.map_4, "map_4", sz8x8, sz1x1, mTileSize);
|
||||
loader.prepareTileset(R.drawable.map_40, "map_40", sz8x8, sz1x1, mTileSize);
|
||||
loader.prepareTileset(R.drawable.map_41, "map_41", sz8x8, sz1x1, mTileSize);
|
||||
loader.prepareTileset(R.drawable.map_42, "map_42", sz8x8, sz1x1, mTileSize);
|
||||
loader.prepareTileset(R.drawable.map_43, "map_43", sz8x8, sz1x1, mTileSize);
|
||||
loader.prepareTileset(R.drawable.map_44, "map_44", sz8x8, sz1x1, mTileSize);
|
||||
loader.prepareTileset(R.drawable.map_45, "map_45", sz8x8, sz1x1, mTileSize);
|
||||
loader.prepareTileset(R.drawable.map_46, "map_46", sz8x8, sz1x1, mTileSize);
|
||||
loader.prepareTileset(R.drawable.map_47, "map_47", sz8x8, sz1x1, mTileSize);
|
||||
loader.prepareTileset(R.drawable.map_48, "map_48", sz8x8, sz1x1, mTileSize);
|
||||
loader.prepareTileset(R.drawable.map_49, "map_49", sz8x8, sz1x1, mTileSize);
|
||||
loader.prepareTileset(R.drawable.map_5, "map_5", sz8x8, sz1x1, mTileSize);
|
||||
loader.prepareTileset(R.drawable.map_50, "map_50", sz8x8, sz1x1, mTileSize);
|
||||
loader.prepareTileset(R.drawable.map_51, "map_51", sz8x8, sz1x1, mTileSize);
|
||||
loader.prepareTileset(R.drawable.map_52, "map_52", sz8x8, sz1x1, mTileSize);
|
||||
loader.prepareTileset(R.drawable.map_53, "map_53", sz8x8, sz1x1, mTileSize);
|
||||
loader.prepareTileset(R.drawable.map_54, "map_54", sz8x8, sz1x1, mTileSize);
|
||||
loader.prepareTileset(R.drawable.map_6, "map_6", sz8x8, sz1x1, mTileSize);
|
||||
loader.prepareTileset(R.drawable.map_7, "map_7", sz8x8, sz1x1, mTileSize);
|
||||
loader.prepareTileset(R.drawable.map_8, "map_8", sz8x8, sz1x1, mTileSize);
|
||||
loader.prepareTileset(R.drawable.map_9, "map_9", sz8x8, sz1x1, mTileSize);
|
||||
|
||||
loader.prepareTileset(R.drawable.obj_0, "obj_0", sz8x8, sz1x1, mTileSize);
|
||||
loader.prepareTileset(R.drawable.obj_1, "obj_1", sz8x8, sz1x1, mTileSize);
|
||||
loader.prepareTileset(R.drawable.obj_10, "obj_10", sz8x8, sz1x1, mTileSize);
|
||||
loader.prepareTileset(R.drawable.obj_11, "obj_11", sz8x8, sz1x1, mTileSize);
|
||||
loader.prepareTileset(R.drawable.obj_12, "obj_12", sz8x8, sz1x1, mTileSize);
|
||||
loader.prepareTileset(R.drawable.obj_13, "obj_13", sz8x8, sz1x1, mTileSize);
|
||||
loader.prepareTileset(R.drawable.obj_14, "obj_14", sz8x8, sz1x1, mTileSize);
|
||||
loader.prepareTileset(R.drawable.obj_2, "obj_2", sz8x8, sz1x1, mTileSize);
|
||||
loader.prepareTileset(R.drawable.obj_3, "obj_3", sz8x8, sz1x1, mTileSize);
|
||||
loader.prepareTileset(R.drawable.obj_4, "obj_4", sz8x8, sz1x1, mTileSize);
|
||||
loader.prepareTileset(R.drawable.obj_5, "obj_5", sz8x8, sz1x1, mTileSize);
|
||||
loader.prepareTileset(R.drawable.obj_6, "obj_6", sz8x8, sz1x1, mTileSize);
|
||||
loader.prepareTileset(R.drawable.obj_7, "obj_7", sz8x8, sz1x1, mTileSize);
|
||||
loader.prepareTileset(R.drawable.obj_8, "obj_8", sz8x8, sz1x1, mTileSize);
|
||||
loader.prepareTileset(R.drawable.obj_9, "obj_9", sz8x8, sz1x1, mTileSize);
|
||||
|
||||
loader.prepareTileset(R.drawable.effect_blood4, "effect_blood4", new Size(7, 2), sz1x1, mTileSize);
|
||||
loader.prepareTileset(R.drawable.effect_heal2, "effect_heal2", new Size(8, 2), sz1x1, mTileSize);
|
||||
|
||||
@@ -8,7 +8,7 @@ import com.gpl.rpg.AndorsTrail.resource.DynamicTileLoader;
|
||||
import com.gpl.rpg.AndorsTrail.resource.TranslationLoader;
|
||||
import com.gpl.rpg.AndorsTrail.resource.parsers.json.JsonCollectionParserFor;
|
||||
import com.gpl.rpg.AndorsTrail.resource.parsers.json.JsonFieldNames;
|
||||
import android.util.Pair;
|
||||
import com.gpl.rpg.AndorsTrail.util.Pair;
|
||||
|
||||
public final class ActorConditionsTypeParser extends JsonCollectionParserFor<ActorConditionType> {
|
||||
|
||||
@@ -26,7 +26,6 @@ public final class ActorConditionsTypeParser extends JsonCollectionParserFor<Act
|
||||
ActorConditionType result = new ActorConditionType(
|
||||
conditionTypeID
|
||||
,translationLoader.translateActorConditionName(o.getString(JsonFieldNames.ActorCondition.name))
|
||||
,translationLoader.translateActorConditionName(o.optString(JsonFieldNames.ActorCondition.description))
|
||||
,ResourceParserUtils.parseImageID(tileLoader, o.getString(JsonFieldNames.ActorCondition.iconID))
|
||||
,ActorConditionType.ConditionCategory.valueOf(o.getString(JsonFieldNames.ActorCondition.category))
|
||||
,o.optInt(JsonFieldNames.ActorCondition.isStacking) > 0
|
||||
|
||||
@@ -13,7 +13,7 @@ import com.gpl.rpg.AndorsTrail.resource.parsers.json.JsonArrayParserFor;
|
||||
import com.gpl.rpg.AndorsTrail.resource.parsers.json.JsonCollectionParserFor;
|
||||
import com.gpl.rpg.AndorsTrail.resource.parsers.json.JsonFieldNames;
|
||||
import com.gpl.rpg.AndorsTrail.util.L;
|
||||
import android.util.Pair;
|
||||
import com.gpl.rpg.AndorsTrail.util.Pair;
|
||||
|
||||
public final class ConversationListParser extends JsonCollectionParserFor<Phrase> {
|
||||
|
||||
|
||||
@@ -11,7 +11,7 @@ import com.gpl.rpg.AndorsTrail.resource.parsers.json.JsonArrayParserFor;
|
||||
import com.gpl.rpg.AndorsTrail.resource.parsers.json.JsonCollectionParserFor;
|
||||
import com.gpl.rpg.AndorsTrail.resource.parsers.json.JsonFieldNames;
|
||||
import com.gpl.rpg.AndorsTrail.util.L;
|
||||
import android.util.Pair;
|
||||
import com.gpl.rpg.AndorsTrail.util.Pair;
|
||||
|
||||
public final class DropListParser extends JsonCollectionParserFor<DropList> {
|
||||
|
||||
@@ -39,12 +39,6 @@ public final class DropListParser extends JsonCollectionParserFor<DropList> {
|
||||
if (items == null) {
|
||||
L.log("OPTIMIZE: Droplist \"" + droplistID + "\" has no dropped items.");
|
||||
}
|
||||
for (int i = 0; i < items.length; i++) {
|
||||
DropItem item = items[i];
|
||||
if (item.itemType == null) {
|
||||
L.log("Item at index " + i + " in droplist " + droplistID + " was null");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return new Pair<String, DropList>(droplistID, new DropList(items));
|
||||
|
||||
@@ -8,7 +8,7 @@ import com.gpl.rpg.AndorsTrail.model.item.ItemCategory;
|
||||
import com.gpl.rpg.AndorsTrail.resource.TranslationLoader;
|
||||
import com.gpl.rpg.AndorsTrail.resource.parsers.json.JsonCollectionParserFor;
|
||||
import com.gpl.rpg.AndorsTrail.resource.parsers.json.JsonFieldNames;
|
||||
import android.util.Pair;
|
||||
import com.gpl.rpg.AndorsTrail.util.Pair;
|
||||
|
||||
public final class ItemCategoryParser extends JsonCollectionParserFor<ItemCategory> {
|
||||
|
||||
|
||||
@@ -13,7 +13,7 @@ import com.gpl.rpg.AndorsTrail.resource.DynamicTileLoader;
|
||||
import com.gpl.rpg.AndorsTrail.resource.TranslationLoader;
|
||||
import com.gpl.rpg.AndorsTrail.resource.parsers.json.JsonCollectionParserFor;
|
||||
import com.gpl.rpg.AndorsTrail.resource.parsers.json.JsonFieldNames;
|
||||
import android.util.Pair;
|
||||
import com.gpl.rpg.AndorsTrail.util.Pair;
|
||||
|
||||
public final class ItemTypeParser extends JsonCollectionParserFor<ItemType> {
|
||||
|
||||
@@ -41,11 +41,9 @@ public final class ItemTypeParser extends JsonCollectionParserFor<ItemType> {
|
||||
final ItemTraits_OnEquip equipEffect = itemTraitsParser.parseItemTraits_OnEquip(o.optJSONObject(JsonFieldNames.ItemType.equipEffect));
|
||||
final ItemTraits_OnUse useEffect = itemTraitsParser.parseItemTraits_OnUse(o.optJSONObject(JsonFieldNames.ItemType.useEffect));
|
||||
final ItemTraits_OnUse hitEffect = itemTraitsParser.parseItemTraits_OnUse(o.optJSONObject(JsonFieldNames.ItemType.hitEffect));
|
||||
final ItemTraits_OnUse missEffect = itemTraitsParser.parseItemTraits_OnUse(o.optJSONObject(JsonFieldNames.ItemType.missEffect));
|
||||
final ItemTraits_OnUse killEffect = itemTraitsParser.parseItemTraits_OnUse(o.optJSONObject(JsonFieldNames.ItemType.killEffect));
|
||||
final ItemTraits_OnHitReceived hitReceivedEffect = itemTraitsParser.parseItemTraits_OnHitReceived(o.optJSONObject(JsonFieldNames.ItemType.hitReceivedEffect));
|
||||
final ItemTraits_OnHitReceived missReceivedEffect = itemTraitsParser.parseItemTraits_OnHitReceived(o.optJSONObject(JsonFieldNames.ItemType.missReceivedEffect));
|
||||
|
||||
|
||||
final int baseMarketCost = o.optInt(JsonFieldNames.ItemType.baseMarketCost);
|
||||
final boolean hasManualPrice = o.optInt(JsonFieldNames.ItemType.hasManualPrice, 0) > 0;
|
||||
final ItemType itemType = new ItemType(
|
||||
@@ -53,17 +51,15 @@ public final class ItemTypeParser extends JsonCollectionParserFor<ItemType> {
|
||||
, ResourceParserUtils.parseImageID(tileLoader, o.getString(JsonFieldNames.ItemType.iconID))
|
||||
, itemTypeName
|
||||
, description
|
||||
, itemCategories.getItemCategory(o.optString(JsonFieldNames.ItemType.category, "other"))
|
||||
, itemCategories.getItemCategory(o.getString(JsonFieldNames.ItemType.category))
|
||||
, ItemType.DisplayType.fromString(o.optString(JsonFieldNames.ItemType.displaytype, null), ItemType.DisplayType.ordinary)
|
||||
, hasManualPrice
|
||||
, baseMarketCost
|
||||
, equipEffect
|
||||
, useEffect
|
||||
, hitEffect
|
||||
, missEffect
|
||||
, killEffect
|
||||
, hitReceivedEffect
|
||||
, missReceivedEffect
|
||||
);
|
||||
return new Pair<String, ItemType>(id, itemType);
|
||||
}
|
||||
|
||||
@@ -14,7 +14,7 @@ import com.gpl.rpg.AndorsTrail.resource.TranslationLoader;
|
||||
import com.gpl.rpg.AndorsTrail.resource.parsers.json.JsonCollectionParserFor;
|
||||
import com.gpl.rpg.AndorsTrail.resource.parsers.json.JsonFieldNames;
|
||||
import com.gpl.rpg.AndorsTrail.util.ConstRange;
|
||||
import android.util.Pair;
|
||||
import com.gpl.rpg.AndorsTrail.util.Pair;
|
||||
import com.gpl.rpg.AndorsTrail.util.Size;
|
||||
|
||||
public final class MonsterTypeParser extends JsonCollectionParserFor<MonsterType> {
|
||||
@@ -55,8 +55,6 @@ public final class MonsterTypeParser extends JsonCollectionParserFor<MonsterType
|
||||
|
||||
final int exp = getExpectedMonsterExperience(attackCost, attackChance, damagePotential, criticalSkill, criticalMultiplier, blockChance, damageResistance, hitEffect, maxHP, maxAP);
|
||||
|
||||
final int horizontalFlipChance = o.optInt(JsonFieldNames.Monster.horizontalFlipChance, 0);
|
||||
|
||||
return new Pair<String, MonsterType>(monsterTypeID, new MonsterType(
|
||||
monsterTypeID
|
||||
, translationLoader.translateMonsterTypeName(o.getString(JsonFieldNames.Monster.name))
|
||||
@@ -70,7 +68,6 @@ public final class MonsterTypeParser extends JsonCollectionParserFor<MonsterType
|
||||
, MonsterType.AggressionType.fromString(o.optString(JsonFieldNames.Monster.movementAggressionType, null), MonsterType.AggressionType.none)
|
||||
, ResourceParserUtils.parseTilesetTileSize(tileLoader, o.optString(JsonFieldNames.Monster.iconID, null), size1x1)
|
||||
, ResourceParserUtils.parseImageID(tileLoader, o.getString(JsonFieldNames.Monster.iconID))
|
||||
, horizontalFlipChance
|
||||
, maxAP
|
||||
, maxHP
|
||||
, o.optInt(JsonFieldNames.Monster.moveCost, 10)
|
||||
|
||||
@@ -12,7 +12,7 @@ import com.gpl.rpg.AndorsTrail.resource.TranslationLoader;
|
||||
import com.gpl.rpg.AndorsTrail.resource.parsers.json.JsonArrayParserFor;
|
||||
import com.gpl.rpg.AndorsTrail.resource.parsers.json.JsonCollectionParserFor;
|
||||
import com.gpl.rpg.AndorsTrail.resource.parsers.json.JsonFieldNames;
|
||||
import android.util.Pair;
|
||||
import com.gpl.rpg.AndorsTrail.util.Pair;
|
||||
|
||||
public final class QuestParser extends JsonCollectionParserFor<Quest> {
|
||||
private final TranslationLoader translationLoader;
|
||||
|
||||
@@ -8,7 +8,6 @@ import org.xmlpull.v1.XmlPullParserException;
|
||||
import android.content.res.Resources;
|
||||
import android.content.res.XmlResourceParser;
|
||||
|
||||
import com.gpl.rpg.AndorsTrail.AndorsTrailApplication;
|
||||
import com.gpl.rpg.AndorsTrail.model.map.MapCollection;
|
||||
import com.gpl.rpg.AndorsTrail.model.map.WorldMapSegment;
|
||||
import com.gpl.rpg.AndorsTrail.model.map.WorldMapSegment.NamedWorldMapArea;
|
||||
@@ -16,7 +15,7 @@ import com.gpl.rpg.AndorsTrail.model.map.WorldMapSegment.WorldMapSegmentMap;
|
||||
import com.gpl.rpg.AndorsTrail.resource.TranslationLoader;
|
||||
import com.gpl.rpg.AndorsTrail.util.Coord;
|
||||
import com.gpl.rpg.AndorsTrail.util.L;
|
||||
import android.util.Pair;
|
||||
import com.gpl.rpg.AndorsTrail.util.Pair;
|
||||
import com.gpl.rpg.AndorsTrail.util.XmlResourceParserUtils;
|
||||
|
||||
public final class WorldMapParser {
|
||||
@@ -25,13 +24,11 @@ public final class WorldMapParser {
|
||||
}
|
||||
|
||||
private static void read(XmlResourceParser xrp, final MapCollection maps, final TranslationLoader translationLoader) {
|
||||
String s = "";
|
||||
if (AndorsTrailApplication.DEVELOPMENT_VALIDATEDATA) L.log("WorldMapParser:");
|
||||
try {
|
||||
int eventType;
|
||||
while ((eventType = xrp.next()) != XmlResourceParser.END_DOCUMENT) {
|
||||
if (eventType == XmlResourceParser.START_TAG) {
|
||||
s = xrp.getName();
|
||||
String s = xrp.getName();
|
||||
if (s.equals("segment")) {
|
||||
WorldMapSegment segment = parseSegment(xrp, maps, translationLoader);
|
||||
maps.worldMapSegments.put(segment.name, segment);
|
||||
@@ -40,7 +37,7 @@ public final class WorldMapParser {
|
||||
}
|
||||
xrp.close();
|
||||
} catch (Exception e) {
|
||||
L.log("Error reading worldmap: " + s + " " + e.toString());
|
||||
L.log("Error reading worldmap: " + e.toString());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -49,13 +46,11 @@ public final class WorldMapParser {
|
||||
final WorldMapSegment segment = new WorldMapSegment(segmentName);
|
||||
|
||||
final ArrayList<Pair<String, String>> mapsInNamedAreas = new ArrayList<Pair<String,String>>();
|
||||
if (AndorsTrailApplication.DEVELOPMENT_VALIDATEDATA) L.log("segment: " + segmentName);
|
||||
XmlResourceParserUtils.readCurrentTagUntilEnd(xrp, new XmlResourceParserUtils.TagHandler() {
|
||||
@Override
|
||||
public void handleTag(XmlResourceParser xrp, String tagName) throws XmlPullParserException, IOException {
|
||||
if (tagName.equals("map")) {
|
||||
String mapName = xrp.getAttributeValue(null, "id");
|
||||
if (AndorsTrailApplication.DEVELOPMENT_VALIDATEDATA) L.log(" map: " + mapName);
|
||||
if (maps.findPredefinedMap(mapName) == null) return;
|
||||
Coord mapPosition = new Coord(
|
||||
xrp.getAttributeIntValue(null, "x", -1),
|
||||
@@ -70,7 +65,6 @@ public final class WorldMapParser {
|
||||
String id = xrp.getAttributeValue(null, "id");
|
||||
String name = translationLoader.translateWorldmapLocation(xrp.getAttributeValue(null, "name"));
|
||||
String type = xrp.getAttributeValue(null, "type");
|
||||
if (AndorsTrailApplication.DEVELOPMENT_VALIDATEDATA) L.log(" namedarea: id=" + id + " name=" + name + " type=" + type);
|
||||
segment.namedAreas.put(id, new NamedWorldMapArea(id, name, type));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,7 +11,7 @@ import org.json.JSONException;
|
||||
|
||||
import com.gpl.rpg.AndorsTrail.AndorsTrailApplication;
|
||||
import com.gpl.rpg.AndorsTrail.util.L;
|
||||
import android.util.Pair;
|
||||
import com.gpl.rpg.AndorsTrail.util.Pair;
|
||||
|
||||
public abstract class JsonCollectionParserFor<T> extends JsonParserFor<Pair<String, T>> {
|
||||
public HashSet<String> parseRows(String input, HashMap<String, T> dest) {
|
||||
|
||||
@@ -4,7 +4,6 @@ public final class JsonFieldNames {
|
||||
public static final class ActorCondition {
|
||||
public static final String conditionTypeID = "id";
|
||||
public static final String name = "name";
|
||||
public static final String description = "description";
|
||||
public static final String iconID = "iconID";
|
||||
public static final String category = "category";
|
||||
public static final String isStacking = "isStacking";
|
||||
@@ -105,7 +104,6 @@ public final class JsonFieldNames {
|
||||
public static final class Monster {
|
||||
public static final String monsterTypeID = "id";
|
||||
public static final String iconID = "iconID";
|
||||
public static final String horizontalFlipChance = "horizontalFlipChance";
|
||||
public static final String name = "name";
|
||||
public static final String spawnGroup = "spawnGroup";
|
||||
public static final String monsterClass = "monsterClass";
|
||||
@@ -168,10 +166,8 @@ public final class JsonFieldNames {
|
||||
public static final String equipEffect = "equipEffect";
|
||||
public static final String useEffect = "useEffect";
|
||||
public static final String hitEffect = "hitEffect";
|
||||
public static final String missEffect = "missEffect";
|
||||
public static final String killEffect = "killEffect";
|
||||
public static final String hitReceivedEffect = "hitReceivedEffect";
|
||||
public static final String missReceivedEffect = "missReceivedEffect";
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -12,8 +12,6 @@ import android.graphics.Bitmap;
|
||||
import android.util.SparseArray;
|
||||
import android.util.SparseIntArray;
|
||||
|
||||
import com.gpl.rpg.AndorsTrail.AndorsTrailApplication;
|
||||
import com.gpl.rpg.AndorsTrail.util.L;
|
||||
import com.gpl.rpg.AndorsTrail.util.LruCache;
|
||||
|
||||
public final class TileCache {
|
||||
@@ -41,12 +39,7 @@ public final class TileCache {
|
||||
tileIDsPerLocalID.put(localID, tileID);
|
||||
}
|
||||
public int getTileID(String tileSetName, int localID) {
|
||||
|
||||
SparseIntArray sparseIntArray = tileIDsPerTilesetAndLocalID.get(tileSetName);
|
||||
if(AndorsTrailApplication.DEVELOPMENT_DEBUGMESSAGES && sparseIntArray == null){
|
||||
L.log("Could not get tile " + tileSetName + " " + localID);
|
||||
}
|
||||
return sparseIntArray.get(localID);
|
||||
return tileIDsPerTilesetAndLocalID.get(tileSetName).get(localID);
|
||||
}
|
||||
|
||||
private static final class ResourceFileTile {
|
||||
@@ -74,19 +67,13 @@ public final class TileCache {
|
||||
HashMap<ResourceFileTileset, SparseArray<ResourceFileTile>> tilesToLoadPerSourceFile = new HashMap<ResourceFileTileset, SparseArray<ResourceFileTile>>();
|
||||
for(int tileID : iconIDs) {
|
||||
ResourceFileTile tile = resourceTiles[tileID];
|
||||
if(tile == null && AndorsTrailApplication.DEVELOPMENT_DEBUGMESSAGES){
|
||||
L.log("could not find resourceTiles for id: " + tileID);
|
||||
L.log("iconIDs: " + iconIDs);
|
||||
}
|
||||
if(tile != null || AndorsTrailApplication.DEVELOPMENT_VALIDATEDATA){
|
||||
SparseArray<ResourceFileTile> tiles = tilesToLoadPerSourceFile.get(tile.tileset);
|
||||
if (tiles == null) {
|
||||
tiles = new SparseArray<TileCache.ResourceFileTile>();
|
||||
tilesToLoadPerSourceFile.put(tile.tileset, tiles);
|
||||
}
|
||||
tiles.put(tileID, tile);
|
||||
maxTileID = Math.max(maxTileID, tileID);
|
||||
SparseArray<ResourceFileTile> tiles = tilesToLoadPerSourceFile.get(tile.tileset);
|
||||
if (tiles == null) {
|
||||
tiles = new SparseArray<TileCache.ResourceFileTile>();
|
||||
tilesToLoadPerSourceFile.put(tile.tileset, tiles);
|
||||
}
|
||||
tiles.put(tileID, tile);
|
||||
maxTileID = Math.max(maxTileID, tileID);
|
||||
}
|
||||
|
||||
boolean hasLoadedTiles = false;
|
||||
|
||||
@@ -2,20 +2,14 @@ package com.gpl.rpg.AndorsTrail.resource.tiles;
|
||||
|
||||
import android.graphics.Bitmap;
|
||||
import android.graphics.Canvas;
|
||||
import android.graphics.Matrix;
|
||||
import android.graphics.Paint;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
public final class TileCollection {
|
||||
private final Bitmap[] bitmaps;
|
||||
private final Map<Integer, Bitmap> flippedBitmaps;
|
||||
public final int maxTileID;
|
||||
|
||||
public TileCollection(int maxTileID) {
|
||||
this.bitmaps = new Bitmap[maxTileID+1];
|
||||
this.flippedBitmaps = new HashMap<>();
|
||||
this.maxTileID = maxTileID;
|
||||
}
|
||||
|
||||
@@ -25,30 +19,9 @@ public final class TileCollection {
|
||||
|
||||
public void setBitmap(int tileID, Bitmap bitmap) {
|
||||
bitmaps[tileID] = bitmap;
|
||||
flippedBitmaps.remove(tileID); // Remove cached flipped version if it exists
|
||||
}
|
||||
|
||||
public void drawTile(Canvas canvas, int tile, int px, int py, Paint mPaint) {
|
||||
drawTile(canvas, tile, px, py, mPaint, false);
|
||||
}
|
||||
public void drawTile(Canvas canvas, int tile, int px, int py, Paint mPaint, boolean isFlippedX) {
|
||||
if (isFlippedX) {
|
||||
canvas.drawBitmap(getFlippedBitmap(tile), px, py, mPaint);
|
||||
} else canvas.drawBitmap(bitmaps[tile], px, py, mPaint);
|
||||
}
|
||||
|
||||
private Bitmap getFlippedBitmap(int tile) {
|
||||
if (flippedBitmaps.containsKey(tile)) {
|
||||
return flippedBitmaps.get(tile);
|
||||
}
|
||||
Bitmap flipped = flipBitmapX(bitmaps[tile]);
|
||||
flippedBitmaps.put(tile, flipped);
|
||||
return flipped;
|
||||
}
|
||||
|
||||
private static Bitmap flipBitmapX(Bitmap source) {
|
||||
Matrix matrix = new Matrix();
|
||||
matrix.postScale(-1, 1, source.getWidth() / 2f, source.getHeight() / 2f);
|
||||
return Bitmap.createBitmap(source, 0, 0, source.getWidth(), source.getHeight(), matrix, true);
|
||||
canvas.drawBitmap(bitmaps[tile], px, py, mPaint);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,7 +18,6 @@ import android.os.AsyncTask;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.gpl.rpg.AndorsTrail.AndorsTrailApplication;
|
||||
import com.gpl.rpg.AndorsTrail.AndorsTrailPreferences;
|
||||
import com.gpl.rpg.AndorsTrail.R;
|
||||
import com.gpl.rpg.AndorsTrail.context.WorldContext;
|
||||
@@ -34,7 +33,6 @@ import com.gpl.rpg.AndorsTrail.model.map.MapObject;
|
||||
import com.gpl.rpg.AndorsTrail.model.map.MonsterSpawnArea;
|
||||
import com.gpl.rpg.AndorsTrail.model.map.PredefinedMap;
|
||||
import com.gpl.rpg.AndorsTrail.model.map.TMXMapTranslator;
|
||||
import com.gpl.rpg.AndorsTrail.util.L;
|
||||
import com.gpl.rpg.AndorsTrail.util.ThemeHelper;
|
||||
|
||||
public final class TileManager {
|
||||
@@ -376,10 +374,6 @@ public final class TileManager {
|
||||
cachedTileIDs = getTileIDsFor(adjacentMap, adjacentMapTiles, world);
|
||||
tileIDsPerMap.put(mapName, cachedTileIDs);
|
||||
}
|
||||
|
||||
if(AndorsTrailApplication.DEVELOPMENT_DEBUGMESSAGES){
|
||||
L.log("TileIDsFor " + mapName + "\n" + cachedTileIDs);
|
||||
}
|
||||
dest.addAll(cachedTileIDs);
|
||||
}
|
||||
public void cacheAdjacentMaps(final Resources res, final WorldContext world, final PredefinedMap nextMap) {
|
||||
@@ -397,9 +391,6 @@ public final class TileManager {
|
||||
|
||||
HashSet<Integer> tileIDs = new HashSet<Integer>();
|
||||
for (String mapName : adjacentMapNames) {
|
||||
if(AndorsTrailApplication.DEVELOPMENT_DEBUGMESSAGES){
|
||||
L.log("addTileIDsFor " + mapName);
|
||||
}
|
||||
addTileIDsFor(tileIDs, mapName, res, world);
|
||||
}
|
||||
|
||||
|
||||
@@ -12,7 +12,6 @@ import java.io.InputStream;
|
||||
import java.io.OutputStream;
|
||||
import java.io.PrintWriter;
|
||||
import java.io.StringWriter;
|
||||
import java.security.DigestException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
@@ -28,7 +27,6 @@ import com.gpl.rpg.AndorsTrail.R;
|
||||
import com.gpl.rpg.AndorsTrail.context.ControllerContext;
|
||||
import com.gpl.rpg.AndorsTrail.context.WorldContext;
|
||||
import com.gpl.rpg.AndorsTrail.controller.Constants;
|
||||
import com.gpl.rpg.AndorsTrail.controller.WorldMapController;
|
||||
import com.gpl.rpg.AndorsTrail.model.ModelContainer;
|
||||
import com.gpl.rpg.AndorsTrail.resource.tiles.TileManager;
|
||||
import com.gpl.rpg.AndorsTrail.util.AndroidStorage;
|
||||
@@ -80,7 +78,7 @@ public final class Savegames {
|
||||
}
|
||||
|
||||
return true;
|
||||
} catch (IOException | DigestException e) {
|
||||
} catch (IOException e) {
|
||||
L.log("Error saving world: " + e.toString());
|
||||
return false;
|
||||
}
|
||||
@@ -88,7 +86,7 @@ public final class Savegames {
|
||||
|
||||
private static void writeBackup(Context androidContext, byte[] savegame, String playerId) throws IOException {
|
||||
File cheatDetectionFolder = AndroidStorage.getStorageDirectory(androidContext, Constants.CHEAT_DETECTION_FOLDER);
|
||||
ensureDirExists(cheatDetectionFolder);
|
||||
if (!cheatDetectionFolder.exists()) cheatDetectionFolder.mkdir();
|
||||
File backupFile = new File(cheatDetectionFolder, playerId + "X");
|
||||
FileOutputStream fileOutputStream = new FileOutputStream(backupFile);
|
||||
fileOutputStream.write(savegame);
|
||||
@@ -106,18 +104,18 @@ public final class Savegames {
|
||||
}
|
||||
|
||||
FileInputStream fos = getInputFile(androidContext, slot);
|
||||
LoadSavegameResult result = loadWorld(androidContext.getResources(), world, controllers, androidContext, fos, fh);
|
||||
LoadSavegameResult result = loadWorld(androidContext.getResources(), world, controllers, fos, fh);
|
||||
fos.close();
|
||||
if (result == LoadSavegameResult.success && slot != SLOT_QUICKSAVE && !world.model.statistics.hasUnlimitedSaves()) {
|
||||
// save to the quicksave slot before deleting the file
|
||||
if (!saveWorld(world, androidContext, SLOT_QUICKSAVE)) {
|
||||
// save to the quicksave slot before deleting the file
|
||||
if (!saveWorld(world, androidContext, SLOT_QUICKSAVE)) {
|
||||
return LoadSavegameResult.unknownError;
|
||||
}
|
||||
getSlotFile(slot, androidContext).delete();
|
||||
writeCheatCheck(androidContext, DENY_LOADING_BECAUSE_GAME_IS_CURRENTLY_PLAYED, fh.playerId);
|
||||
}
|
||||
return result;
|
||||
} catch (IOException | DigestException e) {
|
||||
} catch (IOException e) {
|
||||
if (AndorsTrailApplication.DEVELOPMENT_DEBUGMESSAGES) {
|
||||
L.log("Error loading world: " + e.toString());
|
||||
StringWriter sw = new StringWriter();
|
||||
@@ -132,13 +130,13 @@ public final class Savegames {
|
||||
private static boolean triedToCheat(Context androidContext, FileHeader fh) throws IOException {
|
||||
long savedVersionToCheck = 0;
|
||||
File cheatDetectionFolder = AndroidStorage.getStorageDirectory(androidContext, Constants.CHEAT_DETECTION_FOLDER);
|
||||
ensureDirExists(cheatDetectionFolder);
|
||||
if (!cheatDetectionFolder.exists()) cheatDetectionFolder.mkdir();
|
||||
File cheatDetectionFile = new File(cheatDetectionFolder, fh.playerId);
|
||||
if (cheatDetectionFile.exists()) {
|
||||
FileInputStream fileInputStream = new FileInputStream(cheatDetectionFile);
|
||||
DataInputStream dataInputStream = new DataInputStream(fileInputStream);
|
||||
final CheatDetection cheatDetection = new CheatDetection(dataInputStream);
|
||||
savedVersionToCheck = cheatDetection.savedVersion;
|
||||
savedVersionToCheck = cheatDetection.savedVersion;
|
||||
dataInputStream.close();
|
||||
fileInputStream.close();
|
||||
}
|
||||
@@ -153,7 +151,8 @@ public final class Savegames {
|
||||
final CheatDetection cheatDetection = new CheatDetection(dataInputStream);
|
||||
if (cheatDetection.savedVersion == DENY_LOADING_BECAUSE_GAME_IS_CURRENTLY_PLAYED) {
|
||||
savedVersionToCheck = DENY_LOADING_BECAUSE_GAME_IS_CURRENTLY_PLAYED;
|
||||
} else if (cheatDetection.savedVersion > savedVersionToCheck) {
|
||||
}
|
||||
else if (cheatDetection.savedVersion > savedVersionToCheck) {
|
||||
savedVersionToCheck = cheatDetection.savedVersion;
|
||||
}
|
||||
|
||||
@@ -176,20 +175,10 @@ public final class Savegames {
|
||||
return new FileOutputStream(getSlotFile(slot, androidContext));
|
||||
}
|
||||
}
|
||||
|
||||
private static void ensureSavegameDirectoryExists(Context context) {
|
||||
File dir = AndroidStorage.getStorageDirectory(context, Constants.FILENAME_SAVEGAME_DIRECTORY);
|
||||
ensureDirExists(dir);
|
||||
if (!dir.exists()) dir.mkdir();
|
||||
}
|
||||
|
||||
public static boolean ensureDirExists(File dir) {
|
||||
if (!dir.exists()) {
|
||||
boolean worked = dir.mkdir();
|
||||
return worked;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
private static FileInputStream getInputFile(Context androidContext, int slot) throws IOException {
|
||||
if (slot == SLOT_QUICKSAVE) {
|
||||
return androidContext.openFileInput(Constants.FILENAME_SAVEGAME_QUICKSAVE);
|
||||
@@ -200,66 +189,42 @@ public final class Savegames {
|
||||
|
||||
public static File getSlotFile(int slot, Context context) {
|
||||
File root = AndroidStorage.getStorageDirectory(context, Constants.FILENAME_SAVEGAME_DIRECTORY);
|
||||
return getSlotFile(slot, root);
|
||||
}
|
||||
|
||||
public static File getSlotFile(int slot, File directory) {
|
||||
return new File(directory, getSlotFileName(slot));
|
||||
}
|
||||
|
||||
public static String getSlotFileName(int slot) {
|
||||
return Constants.FILENAME_SAVEGAME_FILENAME_PREFIX + slot;
|
||||
return new File(root, Constants.FILENAME_SAVEGAME_FILENAME_PREFIX + slot);
|
||||
}
|
||||
|
||||
|
||||
public static void saveWorld(WorldContext world, OutputStream outStream, String displayInfo) throws IOException, DigestException {
|
||||
|
||||
public static void saveWorld(WorldContext world, OutputStream outStream, String displayInfo) throws IOException {
|
||||
DataOutputStream dest = new DataOutputStream(outStream);
|
||||
FileHeader.writeToParcel(dest, world.model.player.getName(),
|
||||
displayInfo, world.model.player.iconID,
|
||||
world.model.statistics.isDead(),
|
||||
world.model.statistics.hasUnlimitedSaves(),
|
||||
world.model.player.id,
|
||||
world.model.player.savedVersion,
|
||||
world.model.statistics.getIsAlteredSavegame());
|
||||
|
||||
byte[] checksum = world.getChecksum();
|
||||
world.model.statistics.setChecksum(checksum);
|
||||
|
||||
world.model.player.savedVersion);
|
||||
world.maps.writeToParcel(dest, world);
|
||||
world.model.writeToParcel(dest);
|
||||
dest.close();
|
||||
}
|
||||
|
||||
public static LoadSavegameResult loadWorld(Resources res, WorldContext world, ControllerContext controllers, Context androidContext, InputStream inState, FileHeader fh) throws IOException, DigestException {
|
||||
public static LoadSavegameResult loadWorld(Resources res, WorldContext world, ControllerContext controllers, InputStream inState, FileHeader fh) throws IOException {
|
||||
DataInputStream src = new DataInputStream(inState);
|
||||
final FileHeader header = new FileHeader(src, fh.skipIcon);
|
||||
if (header.fileversion > AndorsTrailApplication.CURRENT_VERSION)
|
||||
return LoadSavegameResult.savegameIsFromAFutureVersion;
|
||||
if (header.fileversion > AndorsTrailApplication.CURRENT_VERSION) return LoadSavegameResult.savegameIsFromAFutureVersion;
|
||||
|
||||
world.maps.readFromParcel(src, world, controllers, header.fileversion);
|
||||
world.model = new ModelContainer(src, world, controllers, header.fileversion);
|
||||
src.close();
|
||||
if (header.fileversion >= 81) {
|
||||
checkChecksum(world);
|
||||
}
|
||||
WorldMapController.populateWorldMap(androidContext, world, controllers.getResources());
|
||||
|
||||
|
||||
if (header.fileversion < 45) {
|
||||
LegacySavegamesContentAdaptations.adaptToNewContentForVersion45(world, controllers, res);
|
||||
}
|
||||
|
||||
|
||||
onWorldLoaded(res, world, controllers);
|
||||
|
||||
return LoadSavegameResult.success;
|
||||
}
|
||||
|
||||
private static void checkChecksum(WorldContext world) throws DigestException {
|
||||
byte[] checksum = world.getChecksum();
|
||||
if (!world.model.statistics.compareChecksum(checksum)) {
|
||||
world.model.statistics.markAsAlteredSavegame();
|
||||
}
|
||||
}
|
||||
|
||||
private static void onWorldLoaded(Resources res, WorldContext world, ControllerContext controllers) {
|
||||
controllers.actorStatsController.recalculatePlayerStats(world.model.player);
|
||||
controllers.mapController.resetMapsNotRecentlyVisited();
|
||||
@@ -286,7 +251,7 @@ public final class Savegames {
|
||||
|
||||
private static void writeCheatCheck(Context androidContext, long savedVersion, String playerId) throws IOException {
|
||||
File cheatDetectionFolder = AndroidStorage.getStorageDirectory(androidContext, Constants.CHEAT_DETECTION_FOLDER);
|
||||
ensureDirExists(cheatDetectionFolder);
|
||||
if (!cheatDetectionFolder.exists()) cheatDetectionFolder.mkdir();
|
||||
File cheatDetectionFile = new File(cheatDetectionFolder, playerId);
|
||||
FileOutputStream fileOutputStream = new FileOutputStream(cheatDetectionFile);
|
||||
DataOutputStream dataOutputStream = new DataOutputStream(fileOutputStream);
|
||||
@@ -320,7 +285,7 @@ public final class Savegames {
|
||||
Collections.sort(result);
|
||||
return result;
|
||||
} catch (Exception e) {
|
||||
return new ArrayList<Integer>();
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -342,12 +307,12 @@ public final class Savegames {
|
||||
}
|
||||
|
||||
|
||||
|
||||
public static final class FileHeader {
|
||||
public final int fileversion;
|
||||
public final String playerName;
|
||||
public final String displayInfo;
|
||||
public final int iconID;
|
||||
public final boolean isAlteredSavegame;
|
||||
public boolean skipIcon = false;
|
||||
public final boolean isDead;
|
||||
public final boolean hasUnlimitedSaves;
|
||||
@@ -363,8 +328,7 @@ public final class Savegames {
|
||||
|
||||
public FileHeader(DataInputStream src, boolean skipIcon) throws IOException {
|
||||
int fileversion = src.readInt();
|
||||
if (fileversion == 11)
|
||||
fileversion = 5; // Fileversion 5 had no version identifier, but the first byte was 11.
|
||||
if (fileversion == 11) fileversion = 5; // Fileversion 5 had no version identifier, but the first byte was 11.
|
||||
this.fileversion = fileversion;
|
||||
if (fileversion >= 14) { // Before fileversion 14 (0.6.7), we had no file header.
|
||||
this.playerName = src.readUTF();
|
||||
@@ -397,14 +361,9 @@ public final class Savegames {
|
||||
this.playerId = "";
|
||||
this.savedVersion = 0;
|
||||
}
|
||||
if(fileversion >= 81){
|
||||
this.isAlteredSavegame = src.readBoolean();
|
||||
}else{
|
||||
this.isAlteredSavegame = false;
|
||||
}
|
||||
}
|
||||
|
||||
public static void writeToParcel(DataOutputStream dest, String playerName, String displayInfo, int iconID, boolean isDead, boolean hasUnlimitedSaves, String playerId, long savedVersion, boolean isAlteredSavegame) throws IOException {
|
||||
public static void writeToParcel(DataOutputStream dest, String playerName, String displayInfo, int iconID, boolean isDead, boolean hasUnlimitedSaves, String playerId, long savedVersion) throws IOException {
|
||||
dest.writeInt(AndorsTrailApplication.CURRENT_VERSION);
|
||||
dest.writeUTF(playerName);
|
||||
dest.writeUTF(displayInfo);
|
||||
@@ -413,7 +372,6 @@ public final class Savegames {
|
||||
dest.writeBoolean(hasUnlimitedSaves);
|
||||
dest.writeUTF(playerId);
|
||||
dest.writeLong(savedVersion);
|
||||
dest.writeBoolean(isAlteredSavegame);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,58 +1,42 @@
|
||||
package com.gpl.rpg.AndorsTrail.util;
|
||||
|
||||
import android.content.ContentResolver;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.net.Uri;
|
||||
import android.os.Build;
|
||||
import android.os.Environment;
|
||||
import androidx.annotation.RequiresApi;
|
||||
import androidx.core.content.FileProvider;
|
||||
import androidx.documentfile.provider.DocumentFile;
|
||||
import android.support.v4.content.FileProvider;
|
||||
|
||||
import android.os.Handler;
|
||||
import android.os.Looper;
|
||||
|
||||
import com.gpl.rpg.AndorsTrail.R;
|
||||
import com.gpl.rpg.AndorsTrail.controller.Constants;
|
||||
import com.gpl.rpg.AndorsTrail.util.BackgroundWorker.BackgroundWorkerCallback;
|
||||
import com.gpl.rpg.AndorsTrail.view.CustomDialogFactory;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.OutputStream;
|
||||
import java.util.concurrent.CancellationException;
|
||||
import java.util.function.Consumer;
|
||||
import java.util.zip.ZipEntry;
|
||||
import java.util.zip.ZipInputStream;
|
||||
import java.util.zip.ZipOutputStream;
|
||||
|
||||
public final class AndroidStorage {
|
||||
public static File getStorageDirectory(Context context, String name) {
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) {
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.FROYO && Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) {
|
||||
return context.getExternalFilesDir(name);
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
File root = Environment.getExternalStorageDirectory();
|
||||
return new File(root, name);
|
||||
}
|
||||
}
|
||||
|
||||
public static boolean shouldMigrateToInternalStorage(Context context) {
|
||||
boolean ret = false;
|
||||
File externalSaveGameDirectory = new File(Environment.getExternalStorageDirectory(),
|
||||
Constants.FILENAME_SAVEGAME_DIRECTORY);
|
||||
File externalSaveGameDirectory = new File(Environment.getExternalStorageDirectory(), Constants.FILENAME_SAVEGAME_DIRECTORY);
|
||||
File internalSaveGameDirectory = getStorageDirectory(context, Constants.FILENAME_SAVEGAME_DIRECTORY);
|
||||
|
||||
if (externalSaveGameDirectory.exists()
|
||||
&& externalSaveGameDirectory.isDirectory()
|
||||
&& externalSaveGameDirectory.listFiles().length > 0
|
||||
&& (!internalSaveGameDirectory.exists()
|
||||
|| internalSaveGameDirectory.isDirectory()
|
||||
&& internalSaveGameDirectory.listFiles().length < 2)) {
|
||||
&& externalSaveGameDirectory.isDirectory()
|
||||
&& externalSaveGameDirectory.listFiles().length > 0
|
||||
&& (
|
||||
!internalSaveGameDirectory.exists()
|
||||
|| internalSaveGameDirectory.isDirectory() && internalSaveGameDirectory.listFiles().length < 2)
|
||||
) {
|
||||
ret = true;
|
||||
}
|
||||
return ret;
|
||||
@@ -61,11 +45,11 @@ public final class AndroidStorage {
|
||||
public static boolean migrateToInternalStorage(Context context) {
|
||||
try {
|
||||
copy(new File(Environment.getExternalStorageDirectory(), Constants.CHEAT_DETECTION_FOLDER),
|
||||
getStorageDirectory(context, Constants.CHEAT_DETECTION_FOLDER));
|
||||
getStorageDirectory(context, Constants.CHEAT_DETECTION_FOLDER));
|
||||
copy(new File(Environment.getExternalStorageDirectory(), Constants.FILENAME_SAVEGAME_DIRECTORY),
|
||||
getStorageDirectory(context, Constants.FILENAME_SAVEGAME_DIRECTORY));
|
||||
getStorageDirectory(context, Constants.FILENAME_SAVEGAME_DIRECTORY));
|
||||
} catch (IOException e) {
|
||||
L.log("Error migrating data: " + e);
|
||||
L.log("Error migrating data: " + e.toString());
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
@@ -92,381 +76,33 @@ public final class AndroidStorage {
|
||||
}
|
||||
}
|
||||
|
||||
public static void copyFile(File source, File target) throws IOException {
|
||||
try (InputStream in = new FileInputStream(source); OutputStream out = new FileOutputStream(target)) {
|
||||
copyStream(in, out);
|
||||
}
|
||||
}
|
||||
|
||||
public static void copyStream(InputStream in, OutputStream out) throws IOException {
|
||||
byte[] buf = new byte[1024];
|
||||
int length;
|
||||
while ((length = in.read(buf)) > 0) {
|
||||
out.write(buf, 0, length);
|
||||
}
|
||||
}
|
||||
|
||||
@RequiresApi(api = Build.VERSION_CODES.P)
|
||||
public static void createZipDocumentFileFromFilesAsync(File[] files,
|
||||
Context context,
|
||||
DocumentFile targetDirectory,
|
||||
String fileName,
|
||||
String loadingMessage,
|
||||
Consumer<Boolean> callback) {
|
||||
|
||||
BackgroundWorker<Boolean> worker = new BackgroundWorker<>();
|
||||
CustomDialogFactory.CustomDialog progressDialog = getLoadingDialog(context, loadingMessage);
|
||||
progressDialog.setOnCancelListener(dialog -> worker.cancel());
|
||||
ContentResolver resolver = context.getContentResolver();
|
||||
Handler handler = Handler.createAsync(Looper.getMainLooper());
|
||||
|
||||
|
||||
worker.setTask(workerCallback -> {
|
||||
try {
|
||||
workerCallback.onInitialize();
|
||||
|
||||
//region create zip file
|
||||
File zip = File.createTempFile("temp_worldmap", ".zip");
|
||||
try (OutputStream out = new FileOutputStream(zip)) {
|
||||
ZipOutputStream zipOut = new ZipOutputStream(out);
|
||||
for (int i = 0; i < files.length; i++) {
|
||||
File file = files[i];
|
||||
try (FileInputStream fis = new FileInputStream(file)) {
|
||||
workerCallback.onProgress((float) i / files.length);
|
||||
zipOut.putNextEntry(new ZipEntry(file.getName()));
|
||||
copyStream(fis, zipOut);
|
||||
zipOut.closeEntry();
|
||||
}
|
||||
}
|
||||
zipOut.close();
|
||||
}
|
||||
//endregion
|
||||
|
||||
DocumentFile worldmapZip = DocumentFile.fromFile(zip);
|
||||
DocumentFile worldmapTarget = targetDirectory.createFile("application/zip", fileName);
|
||||
if (worldmapTarget != null && worldmapTarget.exists()) {
|
||||
AndroidStorage.copyDocumentFile(worldmapZip, resolver, worldmapTarget);
|
||||
workerCallback.onComplete(true);
|
||||
} else {
|
||||
throw new FileNotFoundException("Could not create File");
|
||||
}
|
||||
} catch (NullPointerException e) {
|
||||
if (worker.isCancelled()) {
|
||||
workerCallback.onFailure(new CancellationException("Cancelled"));
|
||||
} else {
|
||||
workerCallback.onFailure(e);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
workerCallback.onFailure(e);
|
||||
private static void copyFile(File source, File target) throws IOException {
|
||||
InputStream in = null;
|
||||
OutputStream out = null;
|
||||
try {
|
||||
in = new FileInputStream(source);
|
||||
out = new FileOutputStream(target);
|
||||
byte[] buf = new byte[1024];
|
||||
int length;
|
||||
while ((length = in.read(buf)) > 0) {
|
||||
out.write(buf, 0, length);
|
||||
}
|
||||
});
|
||||
|
||||
worker.setCallback(getDefaultBackgroundWorkerCallback(handler, progressDialog, callback));
|
||||
worker.run();
|
||||
|
||||
|
||||
}
|
||||
|
||||
public static void unzipToDirectory(File zipFile,
|
||||
File targetDirectory,
|
||||
boolean overwriteNotSkip) throws IOException {
|
||||
|
||||
try (ZipInputStream zis = new ZipInputStream(new FileInputStream(zipFile))) {
|
||||
unzipStreamToDirectory(targetDirectory, overwriteNotSkip, zis);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@RequiresApi(api = Build.VERSION_CODES.P)
|
||||
public static void unzipDocumentFileToDirectoryAsync(DocumentFile zipFile,
|
||||
Context context,
|
||||
File targetDirectory,
|
||||
boolean overwriteNotSkip,
|
||||
String loadingMessage,
|
||||
Consumer<Boolean> callback) {
|
||||
|
||||
BackgroundWorker<Boolean> worker = new BackgroundWorker<>();
|
||||
CustomDialogFactory.CustomDialog progressDialog = getLoadingDialog(context, loadingMessage);
|
||||
progressDialog.setOnCancelListener(dialog -> worker.cancel());
|
||||
ContentResolver resolver = context.getContentResolver();
|
||||
Handler handler = Handler.createAsync(Looper.getMainLooper());
|
||||
|
||||
worker.setTask(workerCallback -> {
|
||||
try {
|
||||
workerCallback.onInitialize();
|
||||
workerCallback.onProgress(-1);//set dummy progress since we don't know the
|
||||
// progress of the unzip
|
||||
unzipDocumentFileToDirectory(zipFile, resolver, targetDirectory, overwriteNotSkip);
|
||||
workerCallback.onComplete(true);
|
||||
} catch (IOException e) {
|
||||
workerCallback.onFailure(e);
|
||||
} finally {
|
||||
if (in != null) {
|
||||
in.close();
|
||||
}
|
||||
});
|
||||
|
||||
worker.setCallback(getDefaultBackgroundWorkerCallback(handler, progressDialog, callback));
|
||||
worker.run();
|
||||
|
||||
}
|
||||
|
||||
public static void unzipDocumentFileToDirectory(DocumentFile zipFile,
|
||||
ContentResolver resolver,
|
||||
File targetDirectory,
|
||||
boolean overwriteNotSkip) throws IOException {
|
||||
try (ZipInputStream zis = new ZipInputStream(resolver.openInputStream(zipFile.getUri()))) {
|
||||
unzipStreamToDirectory(targetDirectory, overwriteNotSkip, zis);
|
||||
}
|
||||
}
|
||||
|
||||
private static void unzipStreamToDirectory(File targetDirectory,
|
||||
boolean overwriteNotSkip,
|
||||
ZipInputStream zis) throws IOException {
|
||||
ZipEntry entry;
|
||||
while ((entry = zis.getNextEntry()) != null) {
|
||||
File file = new File(targetDirectory, entry.getName());
|
||||
|
||||
if (entry.isDirectory()) {
|
||||
file.mkdirs();
|
||||
} else {
|
||||
file.getParentFile().mkdirs();
|
||||
if (file.exists() && !overwriteNotSkip) {
|
||||
continue;
|
||||
}
|
||||
|
||||
try (FileOutputStream fos = new FileOutputStream(file)) {
|
||||
copyStream(zis, fos);
|
||||
}
|
||||
if (out != null) {
|
||||
out.close();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static void copyDocumentFileToNewOrExistingFile(DocumentFile sourceFile,
|
||||
ContentResolver resolver,
|
||||
DocumentFile targetFolder) throws IOException {
|
||||
copyDocumentFileToNewOrExistingFile(sourceFile,
|
||||
resolver,
|
||||
targetFolder,
|
||||
Constants.NO_FILE_EXTENSION_MIME_TYPE);
|
||||
}
|
||||
|
||||
|
||||
public static void copyDocumentFileToNewOrExistingFile(DocumentFile sourceFile,
|
||||
ContentResolver resolver,
|
||||
DocumentFile targetFolder,
|
||||
String mimeType) throws IOException {
|
||||
String fileName = sourceFile.getName();
|
||||
DocumentFile file = targetFolder.findFile(fileName);
|
||||
if (file == null) {
|
||||
file = targetFolder.createFile(mimeType, fileName);
|
||||
}
|
||||
if (file == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
AndroidStorage.copyDocumentFile(sourceFile, resolver, file);
|
||||
}
|
||||
|
||||
public static void copyDocumentFile(DocumentFile sourceFile,
|
||||
ContentResolver resolver,
|
||||
DocumentFile targetFile) throws IOException {
|
||||
try (OutputStream outputStream = resolver.openOutputStream(targetFile.getUri());
|
||||
InputStream inputStream = resolver.openInputStream(sourceFile.getUri())) {
|
||||
copyStream(inputStream, outputStream);
|
||||
}
|
||||
}
|
||||
|
||||
public static String getUrlForFile(Context context, File worldmap) {
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) {
|
||||
String applicationId = context.getPackageName();
|
||||
Uri uri = FileProvider.getUriForFile(context, applicationId + ".fileprovider", worldmap);
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.FROYO && Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) {
|
||||
Uri uri = FileProvider.getUriForFile(context, "com.gpl.rpg.AndorsTrail.fileprovider", worldmap);
|
||||
return uri.toString();
|
||||
} else {
|
||||
return "file://" + worldmap.getAbsolutePath();
|
||||
}
|
||||
}
|
||||
|
||||
@RequiresApi(api = Build.VERSION_CODES.LOLLIPOP)
|
||||
public static Intent getNewOpenDirectoryIntent() {
|
||||
return new Intent(Intent.ACTION_OPEN_DOCUMENT_TREE);
|
||||
}
|
||||
|
||||
@RequiresApi(api = Build.VERSION_CODES.LOLLIPOP)
|
||||
public static Intent getNewSelectMultipleSavegameFilesIntent() {
|
||||
Intent intent = new Intent(Intent.ACTION_GET_CONTENT);
|
||||
intent.addCategory(Intent.CATEGORY_OPENABLE);
|
||||
intent.putExtra(Intent.EXTRA_ALLOW_MULTIPLE, true);
|
||||
intent.setType(Constants.SAVEGAME_FILE_MIME_TYPE);
|
||||
return intent;
|
||||
}
|
||||
|
||||
@RequiresApi(api = Build.VERSION_CODES.LOLLIPOP)
|
||||
public static Intent getNewSelectZipIntent() {
|
||||
Intent intent = new Intent(Intent.ACTION_GET_CONTENT);
|
||||
intent.addCategory(Intent.CATEGORY_OPENABLE);
|
||||
intent.setType("application/zip");
|
||||
return intent;
|
||||
}
|
||||
|
||||
@RequiresApi(api = Build.VERSION_CODES.P)
|
||||
public static void copyDocumentFilesFromToAsync(DocumentFile[] sources,
|
||||
Context context,
|
||||
DocumentFile[] targets,
|
||||
String loadingMessage,
|
||||
Consumer<Boolean> callback) {
|
||||
if (sources.length != targets.length) {
|
||||
throw new IllegalArgumentException("Both arrays, target & source have to have the same size");
|
||||
}
|
||||
|
||||
BackgroundWorker<Boolean> worker = new BackgroundWorker<>();
|
||||
|
||||
CustomDialogFactory.CustomDialog progressDialog = getLoadingDialog(context, loadingMessage);
|
||||
progressDialog.setOnCancelListener(dialog -> worker.cancel());
|
||||
|
||||
ContentResolver resolver = context.getContentResolver();
|
||||
Handler handler = Handler.createAsync(Looper.getMainLooper());
|
||||
|
||||
worker.setTask(workerCallback -> {
|
||||
try {
|
||||
workerCallback.onInitialize();
|
||||
for (int i = 0; i < sources.length; i++) {
|
||||
if (worker.isCancelled()) {
|
||||
workerCallback.onFailure(new CancellationException("Cancelled"));
|
||||
return;
|
||||
}
|
||||
DocumentFile source = sources[i];
|
||||
DocumentFile target = targets[i];
|
||||
|
||||
if (source == null || target == null) {
|
||||
continue;
|
||||
}
|
||||
|
||||
copyDocumentFile(source, resolver, target);
|
||||
float progress = i / (float) sources.length;
|
||||
workerCallback.onProgress(progress);
|
||||
}
|
||||
workerCallback.onComplete(true);
|
||||
} catch (NullPointerException e) {
|
||||
if (worker.isCancelled()) {
|
||||
workerCallback.onFailure(new CancellationException("Cancelled"));
|
||||
return;
|
||||
}
|
||||
} catch (Exception e) {
|
||||
workerCallback.onFailure(e);
|
||||
}
|
||||
});
|
||||
worker.setCallback(getDefaultBackgroundWorkerCallback(handler, progressDialog, callback));
|
||||
worker.run();
|
||||
}
|
||||
|
||||
@RequiresApi(api = Build.VERSION_CODES.P)
|
||||
public static void copyDocumentFilesToDirAsync(DocumentFile[] files,
|
||||
Context context,
|
||||
DocumentFile targetDirectory,
|
||||
String loadingMessage,
|
||||
Consumer<Boolean> callback) {
|
||||
BackgroundWorker<Boolean> worker = new BackgroundWorker<>();
|
||||
CustomDialogFactory.CustomDialog progressDialog = getLoadingDialog(context, loadingMessage);
|
||||
progressDialog.setOnCancelListener(dialog -> worker.cancel());
|
||||
ContentResolver resolver = context.getContentResolver();
|
||||
Handler handler = Handler.createAsync(Looper.getMainLooper());
|
||||
|
||||
worker.setTask(workerCallback -> {
|
||||
try {
|
||||
workerCallback.onInitialize();
|
||||
for (int i = 0; i < files.length; i++) {
|
||||
if (worker.isCancelled()) {
|
||||
workerCallback.onFailure(new CancellationException("Cancelled"));
|
||||
return;
|
||||
}
|
||||
DocumentFile file = files[i];
|
||||
if (file == null) {
|
||||
continue;
|
||||
}
|
||||
|
||||
copyDocumentFileToNewOrExistingFile(file, resolver, targetDirectory);
|
||||
float progress = i / (float) files.length;
|
||||
workerCallback.onProgress(progress);
|
||||
}
|
||||
workerCallback.onComplete(true);
|
||||
} catch (NullPointerException e) {
|
||||
if (worker.isCancelled()) {
|
||||
workerCallback.onFailure(new CancellationException("Cancelled"));
|
||||
}
|
||||
} catch (Exception e) {
|
||||
workerCallback.onFailure(e);
|
||||
}
|
||||
});
|
||||
worker.setCallback(getDefaultBackgroundWorkerCallback(handler, progressDialog, callback));
|
||||
worker.run();
|
||||
}
|
||||
|
||||
private static BackgroundWorkerCallback<Boolean> getDefaultBackgroundWorkerCallback(Handler handler,
|
||||
CustomDialogFactory.CustomDialog progressDialog,
|
||||
Consumer<Boolean> callback) {
|
||||
return new BackgroundWorkerCallback<Boolean>() {
|
||||
private int progress = -1;
|
||||
|
||||
@Override
|
||||
public void onInitialize() {
|
||||
handler.post(() -> {
|
||||
CustomDialogFactory.show(progressDialog);
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onProgress(float progress) {
|
||||
handler.post(() -> {
|
||||
int intProgress = (int) (progress * 100);
|
||||
if (this.progress == intProgress) {
|
||||
return;
|
||||
}
|
||||
|
||||
this.progress = intProgress;
|
||||
|
||||
if (progress == -1) {
|
||||
CustomDialogFactory.setDesc(progressDialog, null);
|
||||
return;
|
||||
}
|
||||
|
||||
CustomDialogFactory.setDesc(progressDialog, intProgress + "%");
|
||||
});
|
||||
}
|
||||
|
||||
@RequiresApi(api = Build.VERSION_CODES.N)
|
||||
@Override
|
||||
public void onFailure(Exception e) {
|
||||
this.onComplete(false);
|
||||
}
|
||||
|
||||
@RequiresApi(api = Build.VERSION_CODES.N)
|
||||
@Override
|
||||
public void onComplete(Boolean result) {
|
||||
handler.post(() -> {
|
||||
progressDialog.dismiss();
|
||||
callback.accept(result);
|
||||
});
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
private static CustomDialogFactory.CustomDialog getLoadingDialog(Context context) {
|
||||
return getLoadingDialog(context, null);
|
||||
}
|
||||
|
||||
private static CustomDialogFactory.CustomDialog getLoadingDialog(Context context, String message) {
|
||||
if (message == null) {
|
||||
message = context.getResources().getString(R.string.dialog_loading_message);
|
||||
}
|
||||
|
||||
CustomDialogFactory.CustomDialog dialog = CustomDialogFactory.createDialog(context,
|
||||
message,
|
||||
context.getResources()
|
||||
.getDrawable(R.drawable.loading_anim),
|
||||
null,
|
||||
null,
|
||||
true,
|
||||
false);
|
||||
CustomDialogFactory.addCancelButton(dialog, android.R.string.no);
|
||||
return dialog;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,46 +0,0 @@
|
||||
package com.gpl.rpg.AndorsTrail.util;
|
||||
|
||||
import java.util.concurrent.Executors;
|
||||
|
||||
public final class BackgroundWorker<T> {
|
||||
boolean cancelled = false;
|
||||
worker<T> task;
|
||||
BackgroundWorkerCallback<T> callback;
|
||||
|
||||
public void setTask(worker<T> task) {
|
||||
this.task = task;
|
||||
}
|
||||
|
||||
public void setCallback(BackgroundWorkerCallback<T> callback) {
|
||||
this.callback = callback;
|
||||
}
|
||||
|
||||
public void cancel() {
|
||||
cancelled = true;
|
||||
}
|
||||
|
||||
interface worker<T> {
|
||||
void doWork(BackgroundWorkerCallback<T> callback);
|
||||
}
|
||||
|
||||
interface BackgroundWorkerCallback<T> {
|
||||
void onInitialize();
|
||||
|
||||
default void onProgress(float progress) {
|
||||
}
|
||||
|
||||
void onFailure(Exception e);
|
||||
|
||||
void onComplete(T result);
|
||||
}
|
||||
|
||||
public void run() {
|
||||
Executors.newSingleThreadExecutor().execute(() -> {
|
||||
task.doWork(callback);
|
||||
});
|
||||
}
|
||||
|
||||
public boolean isCancelled() {
|
||||
return cancelled;
|
||||
}
|
||||
}
|
||||
@@ -1,7 +1,5 @@
|
||||
package com.gpl.rpg.AndorsTrail.util;
|
||||
|
||||
import com.gpl.rpg.AndorsTrail.model.ChecksumBuilder;
|
||||
|
||||
import java.io.DataInputStream;
|
||||
import java.io.DataOutputStream;
|
||||
import java.io.IOException;
|
||||
@@ -49,9 +47,4 @@ public final class Coord {
|
||||
dest.writeInt(x);
|
||||
dest.writeInt(y);
|
||||
}
|
||||
|
||||
public void addToChecksum(ChecksumBuilder builder) {
|
||||
builder.add(x);
|
||||
builder.add(y);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -30,18 +30,6 @@ public final class CoordRect {
|
||||
return true;
|
||||
}
|
||||
|
||||
public static CoordRect union(CoordRect r1, CoordRect r2) {
|
||||
int left = Math.min(r1.topLeft.x, r2.topLeft.x);
|
||||
int top = Math.min(r1.topLeft.y, r2.topLeft.y);
|
||||
int right = Math.max(r1.topLeft.x + r1.size.width, r2.topLeft.x + r2.size.width);
|
||||
int bottom = Math.max(r1.topLeft.y + r1.size.height, r2.topLeft.y + r2.size.height);
|
||||
|
||||
int width = right - left;
|
||||
int height = bottom - top;
|
||||
|
||||
return new CoordRect(new Coord(left, top), new Size(width, height));
|
||||
}
|
||||
|
||||
/*
|
||||
public static boolean contains(final int x, final int y, final Size size, final Coord p) {
|
||||
if (p.x < x) return false;
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user