Skip to content
This repository has been archived by the owner on Aug 19, 2024. It is now read-only.

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
Code release commit
  • Loading branch information
NotToDisturb committed Apr 29, 2020
0 parents commit 0bade39
Show file tree
Hide file tree
Showing 22 changed files with 2,161 additions and 0 deletions.
3 changes: 3 additions & 0 deletions .idea/.gitignore

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions .idea/.name

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions .idea/artifacts/Decomp_Trainer_Editor_jar.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions .idea/modules.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

124 changes: 124 additions & 0 deletions .idea/uiDesigner.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions .idea/vcs.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 11 additions & 0 deletions Decomp Trainer Editor.iml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
<module type="JAVA_MODULE" version="4">
<component name="NewModuleRootManager" inherit-compiler-output="true">
<exclude-output />
<content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
</module>
31 changes: 31 additions & 0 deletions src/main/MainActivity.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
package main;

import types.Trainer;
import types.TrainerClass;
import ui.Screen;

import java.io.File;
import java.util.LinkedHashMap;
import java.util.LinkedList;

public class MainActivity {
public static Screen screen;
public static File projectDirectory = null;

public static String currentTrainer = null;
public static LinkedHashMap<String, Integer> trainerIndexes;
public static LinkedHashMap<String, Integer> partyIndexes;
public static LinkedHashMap<String, TrainerClass> trainerClasses;
public static LinkedList<String> items;
public static LinkedHashMap<String, String> moves;
public static LinkedHashMap<String, String> species;
public static LinkedList<String> music;
public static LinkedList<String> aiFlags;
public static LinkedList<String> picList;
public static LinkedHashMap<String, String> picPaths;
public static LinkedHashMap<String, Trainer> loadedTrainers = new LinkedHashMap<>();

public static void main(String[] args){
screen = new Screen();
}
}
25 changes: 25 additions & 0 deletions src/main/Utils.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
package main;

import java.util.List;

public class Utils {
public static boolean isNumeric(String text){
if (text == null) return false;
try {
double d = Double.parseDouble(text);
}
catch (NumberFormatException exception) {
return false;
}
return true;
}

public static String getLongestString(List<String> list){
String longest = list.get(0);
for(String element : list){
if(element != null)
if(element.length() > longest.length()) longest = element;
}
return longest;
}
}
88 changes: 88 additions & 0 deletions src/types/PartyMember.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
package types;

import main.MainActivity;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.LinkedList;

public class PartyMember {
public static final String[] fields = {"iv", "lvl", "species", "heldItem", "moves"};

public String iv;
public String level;
public String species;
public String heldItem;
public ArrayList<String> moves;

public PartyMember(){
iv = "0";
level = "0";
LinkedList<String> keys = new LinkedList<>(MainActivity.species.keySet());
species = keys.get(0);
heldItem = MainActivity.items.get(0);
moves = new ArrayList<>();
}

public PartyMember(HashMap<String, String> values){
iv = values.get("iv");
level = values.get("lvl");
species = values.get("species");
heldItem = values.get("heldItem");
moves = extractMoves(values.get("moves"));
}

public static HashMap<String, String> templateValues(){
HashMap<String, String> template = new HashMap<>();
for(String field: fields){
template.put(field, "");
}
return template;
}

public static ArrayList<String> extractMoves(String moves){
if(moves.length() == 0) return new ArrayList<>();
return new ArrayList<>(Arrays.asList(moves.substring(1, moves.length() - 1).split(",")));
}

private String buildMoves(){
String moves = "";
for (int index = 0; index < this.moves.size(); index++) {
moves += this.moves.get(index);
if (index != this.moves.size() - 1) {
moves += ", ";
}
}
return "{" + moves + "}";
}

public boolean hasCustomMoves(){
boolean hasCustomMoves = false;
LinkedList<String> keys = new LinkedList<>(MainActivity.moves.keySet());
for (int index = 0; index < this.moves.size(); index++) {
if(!moves.get(index).equals(keys.get(0))) hasCustomMoves = true;
}
return hasCustomMoves;
}

public String buildMemberStruct(boolean partyHasCustomItems, boolean partyHasCustomMoves){
String struct = " {" + System.lineSeparator();
struct += " .iv = " + iv + "," + System.lineSeparator();
struct += " .lvl = " + level + "," + System.lineSeparator();
String speciesBuild = " .species = " + this.species;
String heldItemBuild = " .heldItem = " + this.heldItem;
String movesBuild = " .moves = " + buildMoves();
struct += speciesBuild + "," + System.lineSeparator();
if(partyHasCustomItems) {
if (!partyHasCustomMoves) struct += heldItemBuild + System.lineSeparator();
else{
struct += heldItemBuild + "," + System.lineSeparator();
struct += movesBuild + System.lineSeparator();
}
}
else if (partyHasCustomMoves) struct += movesBuild + System.lineSeparator();
struct += " }";
return struct;
}
}
Loading

0 comments on commit 0bade39

Please sign in to comment.