repo_name
stringlengths
7
104
file_path
stringlengths
13
198
context
stringlengths
67
7.15k
import_statement
stringlengths
16
4.43k
code
stringlengths
40
6.98k
prompt
stringlengths
227
8.27k
next_line
stringlengths
8
795
IceReaper/DesktopAdventuresToolkit
src/net/eiveo/original/sections/todo/not_converted_yet/CAUX.java
// Path: src/net/eiveo/utils/SmartByteArrayOutputStream.java // public class SmartByteArrayOutputStream { // private List<ByteArrayOutputStream> sections = new ArrayList<>(); // private ByteArrayOutputStream section; // // public SmartByteArrayOutputStream() { // this.section = new ByteArrayOutputStream(); // this.sections.add(this.section); // } // // public void sectionStart() { // this.section = new ByteArrayOutputStream(); // this.sections.add(this.section); // } // // public byte[] sectionEnd() { // byte[] result = this.section.toByteArray(); // sections.remove(sections.size() - 1); // this.section = sections.get(sections.size() - 1); // return result; // } // // public byte[] toByteArray() { // return this.section.toByteArray(); // } // // public void write(String string) { // for (byte byteData : string.getBytes()) { // this.section.write(byteData); // } // } // // public void write(byte value) { // this.section.write(value); // } // // public void write(byte[] value) { // for (byte byteData : value) { // this.section.write(byteData); // } // } // // public void write(short value) { // for (byte byteData : new byte[] { // (byte) value, // (byte)(value >> 8) // }) { // this.section.write(byteData); // } // } // // public void write(int value) { // for (byte byteData : new byte[] { // (byte) value, // (byte)(value >> 8), // (byte)(value >> 16), // (byte)(value >> 24) // }) { // this.section.write(byteData); // } // } // } // // Path: src/net/eiveo/utils/SmartByteBuffer.java // public class SmartByteBuffer { // private ByteBuffer byteBuffer; // // public int capacity() { // return this.byteBuffer.capacity(); // } // // public byte get() { // return this.byteBuffer.get(); // } // // public void get(byte[] dst) { // this.byteBuffer.get(dst); // } // // public int getInt() { // return this.byteBuffer.getInt(); // } // // public short getShort() { // return this.byteBuffer.getShort(); // } // // public String getString() { // String string = ""; // // while (true) { // byte character = this.get(); // if ((character & 0xff) == 0) { // break; // } else { // string += new String(new byte[] { character }); // } // } // // return string; // } // // public String getString(int index, int length) { // byte[] output = new byte[length]; // if (index > -1) { // this.position(index); // } // this.byteBuffer.get(output); // return new String(output); // } // // public void order(ByteOrder bo) { // this.byteBuffer.order(bo); // } // // public int position() { // return this.byteBuffer.position(); // } // // public void position(int newPosition) { // this.byteBuffer.position(newPosition); // } // // public static SmartByteBuffer wrap(byte[] array) { // SmartByteBuffer instance = new SmartByteBuffer(); // instance.byteBuffer = ByteBuffer.wrap(array); // return instance; // } // }
import java.util.LinkedHashMap; import java.util.Map; import java.util.Map.Entry; import net.eiveo.utils.SmartByteArrayOutputStream; import net.eiveo.utils.SmartByteBuffer;
package net.eiveo.original.sections.todo.not_converted_yet; public class CAUX { private Map<Short, Short> damage = new LinkedHashMap<>();
// Path: src/net/eiveo/utils/SmartByteArrayOutputStream.java // public class SmartByteArrayOutputStream { // private List<ByteArrayOutputStream> sections = new ArrayList<>(); // private ByteArrayOutputStream section; // // public SmartByteArrayOutputStream() { // this.section = new ByteArrayOutputStream(); // this.sections.add(this.section); // } // // public void sectionStart() { // this.section = new ByteArrayOutputStream(); // this.sections.add(this.section); // } // // public byte[] sectionEnd() { // byte[] result = this.section.toByteArray(); // sections.remove(sections.size() - 1); // this.section = sections.get(sections.size() - 1); // return result; // } // // public byte[] toByteArray() { // return this.section.toByteArray(); // } // // public void write(String string) { // for (byte byteData : string.getBytes()) { // this.section.write(byteData); // } // } // // public void write(byte value) { // this.section.write(value); // } // // public void write(byte[] value) { // for (byte byteData : value) { // this.section.write(byteData); // } // } // // public void write(short value) { // for (byte byteData : new byte[] { // (byte) value, // (byte)(value >> 8) // }) { // this.section.write(byteData); // } // } // // public void write(int value) { // for (byte byteData : new byte[] { // (byte) value, // (byte)(value >> 8), // (byte)(value >> 16), // (byte)(value >> 24) // }) { // this.section.write(byteData); // } // } // } // // Path: src/net/eiveo/utils/SmartByteBuffer.java // public class SmartByteBuffer { // private ByteBuffer byteBuffer; // // public int capacity() { // return this.byteBuffer.capacity(); // } // // public byte get() { // return this.byteBuffer.get(); // } // // public void get(byte[] dst) { // this.byteBuffer.get(dst); // } // // public int getInt() { // return this.byteBuffer.getInt(); // } // // public short getShort() { // return this.byteBuffer.getShort(); // } // // public String getString() { // String string = ""; // // while (true) { // byte character = this.get(); // if ((character & 0xff) == 0) { // break; // } else { // string += new String(new byte[] { character }); // } // } // // return string; // } // // public String getString(int index, int length) { // byte[] output = new byte[length]; // if (index > -1) { // this.position(index); // } // this.byteBuffer.get(output); // return new String(output); // } // // public void order(ByteOrder bo) { // this.byteBuffer.order(bo); // } // // public int position() { // return this.byteBuffer.position(); // } // // public void position(int newPosition) { // this.byteBuffer.position(newPosition); // } // // public static SmartByteBuffer wrap(byte[] array) { // SmartByteBuffer instance = new SmartByteBuffer(); // instance.byteBuffer = ByteBuffer.wrap(array); // return instance; // } // } // Path: src/net/eiveo/original/sections/todo/not_converted_yet/CAUX.java import java.util.LinkedHashMap; import java.util.Map; import java.util.Map.Entry; import net.eiveo.utils.SmartByteArrayOutputStream; import net.eiveo.utils.SmartByteBuffer; package net.eiveo.original.sections.todo.not_converted_yet; public class CAUX { private Map<Short, Short> damage = new LinkedHashMap<>();
public static CAUX read(SmartByteBuffer data) throws Exception {
IceReaper/DesktopAdventuresToolkit
src/net/eiveo/original/sections/todo/not_converted_yet/CAUX.java
// Path: src/net/eiveo/utils/SmartByteArrayOutputStream.java // public class SmartByteArrayOutputStream { // private List<ByteArrayOutputStream> sections = new ArrayList<>(); // private ByteArrayOutputStream section; // // public SmartByteArrayOutputStream() { // this.section = new ByteArrayOutputStream(); // this.sections.add(this.section); // } // // public void sectionStart() { // this.section = new ByteArrayOutputStream(); // this.sections.add(this.section); // } // // public byte[] sectionEnd() { // byte[] result = this.section.toByteArray(); // sections.remove(sections.size() - 1); // this.section = sections.get(sections.size() - 1); // return result; // } // // public byte[] toByteArray() { // return this.section.toByteArray(); // } // // public void write(String string) { // for (byte byteData : string.getBytes()) { // this.section.write(byteData); // } // } // // public void write(byte value) { // this.section.write(value); // } // // public void write(byte[] value) { // for (byte byteData : value) { // this.section.write(byteData); // } // } // // public void write(short value) { // for (byte byteData : new byte[] { // (byte) value, // (byte)(value >> 8) // }) { // this.section.write(byteData); // } // } // // public void write(int value) { // for (byte byteData : new byte[] { // (byte) value, // (byte)(value >> 8), // (byte)(value >> 16), // (byte)(value >> 24) // }) { // this.section.write(byteData); // } // } // } // // Path: src/net/eiveo/utils/SmartByteBuffer.java // public class SmartByteBuffer { // private ByteBuffer byteBuffer; // // public int capacity() { // return this.byteBuffer.capacity(); // } // // public byte get() { // return this.byteBuffer.get(); // } // // public void get(byte[] dst) { // this.byteBuffer.get(dst); // } // // public int getInt() { // return this.byteBuffer.getInt(); // } // // public short getShort() { // return this.byteBuffer.getShort(); // } // // public String getString() { // String string = ""; // // while (true) { // byte character = this.get(); // if ((character & 0xff) == 0) { // break; // } else { // string += new String(new byte[] { character }); // } // } // // return string; // } // // public String getString(int index, int length) { // byte[] output = new byte[length]; // if (index > -1) { // this.position(index); // } // this.byteBuffer.get(output); // return new String(output); // } // // public void order(ByteOrder bo) { // this.byteBuffer.order(bo); // } // // public int position() { // return this.byteBuffer.position(); // } // // public void position(int newPosition) { // this.byteBuffer.position(newPosition); // } // // public static SmartByteBuffer wrap(byte[] array) { // SmartByteBuffer instance = new SmartByteBuffer(); // instance.byteBuffer = ByteBuffer.wrap(array); // return instance; // } // }
import java.util.LinkedHashMap; import java.util.Map; import java.util.Map.Entry; import net.eiveo.utils.SmartByteArrayOutputStream; import net.eiveo.utils.SmartByteBuffer;
package net.eiveo.original.sections.todo.not_converted_yet; public class CAUX { private Map<Short, Short> damage = new LinkedHashMap<>(); public static CAUX read(SmartByteBuffer data) throws Exception { CAUX instance = new CAUX(); int length = data.getInt(); int lengthStart = data.position(); while (true) { short characterId = data.getShort(); if (characterId == -1) { break; } else { instance.damage.put(characterId, data.getShort()); } } if (lengthStart + length != data.position()) { throw new Exception("Length mismatch."); } return instance; }
// Path: src/net/eiveo/utils/SmartByteArrayOutputStream.java // public class SmartByteArrayOutputStream { // private List<ByteArrayOutputStream> sections = new ArrayList<>(); // private ByteArrayOutputStream section; // // public SmartByteArrayOutputStream() { // this.section = new ByteArrayOutputStream(); // this.sections.add(this.section); // } // // public void sectionStart() { // this.section = new ByteArrayOutputStream(); // this.sections.add(this.section); // } // // public byte[] sectionEnd() { // byte[] result = this.section.toByteArray(); // sections.remove(sections.size() - 1); // this.section = sections.get(sections.size() - 1); // return result; // } // // public byte[] toByteArray() { // return this.section.toByteArray(); // } // // public void write(String string) { // for (byte byteData : string.getBytes()) { // this.section.write(byteData); // } // } // // public void write(byte value) { // this.section.write(value); // } // // public void write(byte[] value) { // for (byte byteData : value) { // this.section.write(byteData); // } // } // // public void write(short value) { // for (byte byteData : new byte[] { // (byte) value, // (byte)(value >> 8) // }) { // this.section.write(byteData); // } // } // // public void write(int value) { // for (byte byteData : new byte[] { // (byte) value, // (byte)(value >> 8), // (byte)(value >> 16), // (byte)(value >> 24) // }) { // this.section.write(byteData); // } // } // } // // Path: src/net/eiveo/utils/SmartByteBuffer.java // public class SmartByteBuffer { // private ByteBuffer byteBuffer; // // public int capacity() { // return this.byteBuffer.capacity(); // } // // public byte get() { // return this.byteBuffer.get(); // } // // public void get(byte[] dst) { // this.byteBuffer.get(dst); // } // // public int getInt() { // return this.byteBuffer.getInt(); // } // // public short getShort() { // return this.byteBuffer.getShort(); // } // // public String getString() { // String string = ""; // // while (true) { // byte character = this.get(); // if ((character & 0xff) == 0) { // break; // } else { // string += new String(new byte[] { character }); // } // } // // return string; // } // // public String getString(int index, int length) { // byte[] output = new byte[length]; // if (index > -1) { // this.position(index); // } // this.byteBuffer.get(output); // return new String(output); // } // // public void order(ByteOrder bo) { // this.byteBuffer.order(bo); // } // // public int position() { // return this.byteBuffer.position(); // } // // public void position(int newPosition) { // this.byteBuffer.position(newPosition); // } // // public static SmartByteBuffer wrap(byte[] array) { // SmartByteBuffer instance = new SmartByteBuffer(); // instance.byteBuffer = ByteBuffer.wrap(array); // return instance; // } // } // Path: src/net/eiveo/original/sections/todo/not_converted_yet/CAUX.java import java.util.LinkedHashMap; import java.util.Map; import java.util.Map.Entry; import net.eiveo.utils.SmartByteArrayOutputStream; import net.eiveo.utils.SmartByteBuffer; package net.eiveo.original.sections.todo.not_converted_yet; public class CAUX { private Map<Short, Short> damage = new LinkedHashMap<>(); public static CAUX read(SmartByteBuffer data) throws Exception { CAUX instance = new CAUX(); int length = data.getInt(); int lengthStart = data.position(); while (true) { short characterId = data.getShort(); if (characterId == -1) { break; } else { instance.damage.put(characterId, data.getShort()); } } if (lengthStart + length != data.position()) { throw new Exception("Length mismatch."); } return instance; }
public void write(SmartByteArrayOutputStream outputStream) {
IceReaper/DesktopAdventuresToolkit
src/net/eiveo/utils/Image.java
// Path: src/net/eiveo/structured/Palette.java // public class Palette { // public int[] colors = new int[256]; // // public static Palette read(File root) throws Exception { // Palette instance = new Palette(); // // BufferedImage palette = ImageIO.read(new File(root, "palette.png")); // // for (int y = 0; y < 16; y++) { // for (int x = 0; x < 16; x++) { // instance.colors[x + y * 16] = palette.getRGB(x, y); // } // } // // return instance; // } // // public void write(File root) throws Exception { // BufferedImage paletteImage = new BufferedImage(16, 16, BufferedImage.TYPE_INT_ARGB); // // for (int y = 0; y < 16; y++) { // for (int x = 0; x < 16; x++) { // paletteImage.setRGB(x, y, colors[x + y * 16]); // } // } // // ImageIO.write(paletteImage, "png", new File(root, "palette.png")); // } // }
import java.awt.image.BufferedImage; import net.eiveo.structured.Palette;
package net.eiveo.utils; public class Image { public static boolean lastImageHadAlpha;
// Path: src/net/eiveo/structured/Palette.java // public class Palette { // public int[] colors = new int[256]; // // public static Palette read(File root) throws Exception { // Palette instance = new Palette(); // // BufferedImage palette = ImageIO.read(new File(root, "palette.png")); // // for (int y = 0; y < 16; y++) { // for (int x = 0; x < 16; x++) { // instance.colors[x + y * 16] = palette.getRGB(x, y); // } // } // // return instance; // } // // public void write(File root) throws Exception { // BufferedImage paletteImage = new BufferedImage(16, 16, BufferedImage.TYPE_INT_ARGB); // // for (int y = 0; y < 16; y++) { // for (int x = 0; x < 16; x++) { // paletteImage.setRGB(x, y, colors[x + y * 16]); // } // } // // ImageIO.write(paletteImage, "png", new File(root, "palette.png")); // } // } // Path: src/net/eiveo/utils/Image.java import java.awt.image.BufferedImage; import net.eiveo.structured.Palette; package net.eiveo.utils; public class Image { public static boolean lastImageHadAlpha;
public static BufferedImage indexedToImage(byte[] indexed, Palette palette, int width, int height, boolean hasAlpha) {
IceReaper/DesktopAdventuresToolkit
src/net/eiveo/original/sections/todo/determine_values/CHWP.java
// Path: src/net/eiveo/utils/SmartByteArrayOutputStream.java // public class SmartByteArrayOutputStream { // private List<ByteArrayOutputStream> sections = new ArrayList<>(); // private ByteArrayOutputStream section; // // public SmartByteArrayOutputStream() { // this.section = new ByteArrayOutputStream(); // this.sections.add(this.section); // } // // public void sectionStart() { // this.section = new ByteArrayOutputStream(); // this.sections.add(this.section); // } // // public byte[] sectionEnd() { // byte[] result = this.section.toByteArray(); // sections.remove(sections.size() - 1); // this.section = sections.get(sections.size() - 1); // return result; // } // // public byte[] toByteArray() { // return this.section.toByteArray(); // } // // public void write(String string) { // for (byte byteData : string.getBytes()) { // this.section.write(byteData); // } // } // // public void write(byte value) { // this.section.write(value); // } // // public void write(byte[] value) { // for (byte byteData : value) { // this.section.write(byteData); // } // } // // public void write(short value) { // for (byte byteData : new byte[] { // (byte) value, // (byte)(value >> 8) // }) { // this.section.write(byteData); // } // } // // public void write(int value) { // for (byte byteData : new byte[] { // (byte) value, // (byte)(value >> 8), // (byte)(value >> 16), // (byte)(value >> 24) // }) { // this.section.write(byteData); // } // } // } // // Path: src/net/eiveo/utils/SmartByteBuffer.java // public class SmartByteBuffer { // private ByteBuffer byteBuffer; // // public int capacity() { // return this.byteBuffer.capacity(); // } // // public byte get() { // return this.byteBuffer.get(); // } // // public void get(byte[] dst) { // this.byteBuffer.get(dst); // } // // public int getInt() { // return this.byteBuffer.getInt(); // } // // public short getShort() { // return this.byteBuffer.getShort(); // } // // public String getString() { // String string = ""; // // while (true) { // byte character = this.get(); // if ((character & 0xff) == 0) { // break; // } else { // string += new String(new byte[] { character }); // } // } // // return string; // } // // public String getString(int index, int length) { // byte[] output = new byte[length]; // if (index > -1) { // this.position(index); // } // this.byteBuffer.get(output); // return new String(output); // } // // public void order(ByteOrder bo) { // this.byteBuffer.order(bo); // } // // public int position() { // return this.byteBuffer.position(); // } // // public void position(int newPosition) { // this.byteBuffer.position(newPosition); // } // // public static SmartByteBuffer wrap(byte[] array) { // SmartByteBuffer instance = new SmartByteBuffer(); // instance.byteBuffer = ByteBuffer.wrap(array); // return instance; // } // }
import java.util.LinkedHashMap; import java.util.Map; import java.util.Map.Entry; import net.eiveo.utils.SmartByteArrayOutputStream; import net.eiveo.utils.SmartByteBuffer;
package net.eiveo.original.sections.todo.determine_values; public class CHWP { private Map<Short, Weapon> weapons = new LinkedHashMap<>();
// Path: src/net/eiveo/utils/SmartByteArrayOutputStream.java // public class SmartByteArrayOutputStream { // private List<ByteArrayOutputStream> sections = new ArrayList<>(); // private ByteArrayOutputStream section; // // public SmartByteArrayOutputStream() { // this.section = new ByteArrayOutputStream(); // this.sections.add(this.section); // } // // public void sectionStart() { // this.section = new ByteArrayOutputStream(); // this.sections.add(this.section); // } // // public byte[] sectionEnd() { // byte[] result = this.section.toByteArray(); // sections.remove(sections.size() - 1); // this.section = sections.get(sections.size() - 1); // return result; // } // // public byte[] toByteArray() { // return this.section.toByteArray(); // } // // public void write(String string) { // for (byte byteData : string.getBytes()) { // this.section.write(byteData); // } // } // // public void write(byte value) { // this.section.write(value); // } // // public void write(byte[] value) { // for (byte byteData : value) { // this.section.write(byteData); // } // } // // public void write(short value) { // for (byte byteData : new byte[] { // (byte) value, // (byte)(value >> 8) // }) { // this.section.write(byteData); // } // } // // public void write(int value) { // for (byte byteData : new byte[] { // (byte) value, // (byte)(value >> 8), // (byte)(value >> 16), // (byte)(value >> 24) // }) { // this.section.write(byteData); // } // } // } // // Path: src/net/eiveo/utils/SmartByteBuffer.java // public class SmartByteBuffer { // private ByteBuffer byteBuffer; // // public int capacity() { // return this.byteBuffer.capacity(); // } // // public byte get() { // return this.byteBuffer.get(); // } // // public void get(byte[] dst) { // this.byteBuffer.get(dst); // } // // public int getInt() { // return this.byteBuffer.getInt(); // } // // public short getShort() { // return this.byteBuffer.getShort(); // } // // public String getString() { // String string = ""; // // while (true) { // byte character = this.get(); // if ((character & 0xff) == 0) { // break; // } else { // string += new String(new byte[] { character }); // } // } // // return string; // } // // public String getString(int index, int length) { // byte[] output = new byte[length]; // if (index > -1) { // this.position(index); // } // this.byteBuffer.get(output); // return new String(output); // } // // public void order(ByteOrder bo) { // this.byteBuffer.order(bo); // } // // public int position() { // return this.byteBuffer.position(); // } // // public void position(int newPosition) { // this.byteBuffer.position(newPosition); // } // // public static SmartByteBuffer wrap(byte[] array) { // SmartByteBuffer instance = new SmartByteBuffer(); // instance.byteBuffer = ByteBuffer.wrap(array); // return instance; // } // } // Path: src/net/eiveo/original/sections/todo/determine_values/CHWP.java import java.util.LinkedHashMap; import java.util.Map; import java.util.Map.Entry; import net.eiveo.utils.SmartByteArrayOutputStream; import net.eiveo.utils.SmartByteBuffer; package net.eiveo.original.sections.todo.determine_values; public class CHWP { private Map<Short, Weapon> weapons = new LinkedHashMap<>();
public static CHWP read(SmartByteBuffer data) throws Exception {
IceReaper/DesktopAdventuresToolkit
src/net/eiveo/original/sections/todo/determine_values/CHWP.java
// Path: src/net/eiveo/utils/SmartByteArrayOutputStream.java // public class SmartByteArrayOutputStream { // private List<ByteArrayOutputStream> sections = new ArrayList<>(); // private ByteArrayOutputStream section; // // public SmartByteArrayOutputStream() { // this.section = new ByteArrayOutputStream(); // this.sections.add(this.section); // } // // public void sectionStart() { // this.section = new ByteArrayOutputStream(); // this.sections.add(this.section); // } // // public byte[] sectionEnd() { // byte[] result = this.section.toByteArray(); // sections.remove(sections.size() - 1); // this.section = sections.get(sections.size() - 1); // return result; // } // // public byte[] toByteArray() { // return this.section.toByteArray(); // } // // public void write(String string) { // for (byte byteData : string.getBytes()) { // this.section.write(byteData); // } // } // // public void write(byte value) { // this.section.write(value); // } // // public void write(byte[] value) { // for (byte byteData : value) { // this.section.write(byteData); // } // } // // public void write(short value) { // for (byte byteData : new byte[] { // (byte) value, // (byte)(value >> 8) // }) { // this.section.write(byteData); // } // } // // public void write(int value) { // for (byte byteData : new byte[] { // (byte) value, // (byte)(value >> 8), // (byte)(value >> 16), // (byte)(value >> 24) // }) { // this.section.write(byteData); // } // } // } // // Path: src/net/eiveo/utils/SmartByteBuffer.java // public class SmartByteBuffer { // private ByteBuffer byteBuffer; // // public int capacity() { // return this.byteBuffer.capacity(); // } // // public byte get() { // return this.byteBuffer.get(); // } // // public void get(byte[] dst) { // this.byteBuffer.get(dst); // } // // public int getInt() { // return this.byteBuffer.getInt(); // } // // public short getShort() { // return this.byteBuffer.getShort(); // } // // public String getString() { // String string = ""; // // while (true) { // byte character = this.get(); // if ((character & 0xff) == 0) { // break; // } else { // string += new String(new byte[] { character }); // } // } // // return string; // } // // public String getString(int index, int length) { // byte[] output = new byte[length]; // if (index > -1) { // this.position(index); // } // this.byteBuffer.get(output); // return new String(output); // } // // public void order(ByteOrder bo) { // this.byteBuffer.order(bo); // } // // public int position() { // return this.byteBuffer.position(); // } // // public void position(int newPosition) { // this.byteBuffer.position(newPosition); // } // // public static SmartByteBuffer wrap(byte[] array) { // SmartByteBuffer instance = new SmartByteBuffer(); // instance.byteBuffer = ByteBuffer.wrap(array); // return instance; // } // }
import java.util.LinkedHashMap; import java.util.Map; import java.util.Map.Entry; import net.eiveo.utils.SmartByteArrayOutputStream; import net.eiveo.utils.SmartByteBuffer;
package net.eiveo.original.sections.todo.determine_values; public class CHWP { private Map<Short, Weapon> weapons = new LinkedHashMap<>(); public static CHWP read(SmartByteBuffer data) throws Exception { CHWP instance = new CHWP(); int length = data.getInt(); int lengthStart = data.position(); while (true) { short characterId = data.getShort(); if (characterId == -1) { break; } else { instance.weapons.put(characterId, Weapon.read(data)); } } if (lengthStart + length != data.position()) { throw new Exception("Length mismatch."); } return instance; }
// Path: src/net/eiveo/utils/SmartByteArrayOutputStream.java // public class SmartByteArrayOutputStream { // private List<ByteArrayOutputStream> sections = new ArrayList<>(); // private ByteArrayOutputStream section; // // public SmartByteArrayOutputStream() { // this.section = new ByteArrayOutputStream(); // this.sections.add(this.section); // } // // public void sectionStart() { // this.section = new ByteArrayOutputStream(); // this.sections.add(this.section); // } // // public byte[] sectionEnd() { // byte[] result = this.section.toByteArray(); // sections.remove(sections.size() - 1); // this.section = sections.get(sections.size() - 1); // return result; // } // // public byte[] toByteArray() { // return this.section.toByteArray(); // } // // public void write(String string) { // for (byte byteData : string.getBytes()) { // this.section.write(byteData); // } // } // // public void write(byte value) { // this.section.write(value); // } // // public void write(byte[] value) { // for (byte byteData : value) { // this.section.write(byteData); // } // } // // public void write(short value) { // for (byte byteData : new byte[] { // (byte) value, // (byte)(value >> 8) // }) { // this.section.write(byteData); // } // } // // public void write(int value) { // for (byte byteData : new byte[] { // (byte) value, // (byte)(value >> 8), // (byte)(value >> 16), // (byte)(value >> 24) // }) { // this.section.write(byteData); // } // } // } // // Path: src/net/eiveo/utils/SmartByteBuffer.java // public class SmartByteBuffer { // private ByteBuffer byteBuffer; // // public int capacity() { // return this.byteBuffer.capacity(); // } // // public byte get() { // return this.byteBuffer.get(); // } // // public void get(byte[] dst) { // this.byteBuffer.get(dst); // } // // public int getInt() { // return this.byteBuffer.getInt(); // } // // public short getShort() { // return this.byteBuffer.getShort(); // } // // public String getString() { // String string = ""; // // while (true) { // byte character = this.get(); // if ((character & 0xff) == 0) { // break; // } else { // string += new String(new byte[] { character }); // } // } // // return string; // } // // public String getString(int index, int length) { // byte[] output = new byte[length]; // if (index > -1) { // this.position(index); // } // this.byteBuffer.get(output); // return new String(output); // } // // public void order(ByteOrder bo) { // this.byteBuffer.order(bo); // } // // public int position() { // return this.byteBuffer.position(); // } // // public void position(int newPosition) { // this.byteBuffer.position(newPosition); // } // // public static SmartByteBuffer wrap(byte[] array) { // SmartByteBuffer instance = new SmartByteBuffer(); // instance.byteBuffer = ByteBuffer.wrap(array); // return instance; // } // } // Path: src/net/eiveo/original/sections/todo/determine_values/CHWP.java import java.util.LinkedHashMap; import java.util.Map; import java.util.Map.Entry; import net.eiveo.utils.SmartByteArrayOutputStream; import net.eiveo.utils.SmartByteBuffer; package net.eiveo.original.sections.todo.determine_values; public class CHWP { private Map<Short, Weapon> weapons = new LinkedHashMap<>(); public static CHWP read(SmartByteBuffer data) throws Exception { CHWP instance = new CHWP(); int length = data.getInt(); int lengthStart = data.position(); while (true) { short characterId = data.getShort(); if (characterId == -1) { break; } else { instance.weapons.put(characterId, Weapon.read(data)); } } if (lengthStart + length != data.position()) { throw new Exception("Length mismatch."); } return instance; }
public void write(SmartByteArrayOutputStream outputStream) throws Exception {
IceReaper/DesktopAdventuresToolkit
src/net/eiveo/original/sections/todo/not_converted_yet/ICHA.java
// Path: src/net/eiveo/utils/SmartByteArrayOutputStream.java // public class SmartByteArrayOutputStream { // private List<ByteArrayOutputStream> sections = new ArrayList<>(); // private ByteArrayOutputStream section; // // public SmartByteArrayOutputStream() { // this.section = new ByteArrayOutputStream(); // this.sections.add(this.section); // } // // public void sectionStart() { // this.section = new ByteArrayOutputStream(); // this.sections.add(this.section); // } // // public byte[] sectionEnd() { // byte[] result = this.section.toByteArray(); // sections.remove(sections.size() - 1); // this.section = sections.get(sections.size() - 1); // return result; // } // // public byte[] toByteArray() { // return this.section.toByteArray(); // } // // public void write(String string) { // for (byte byteData : string.getBytes()) { // this.section.write(byteData); // } // } // // public void write(byte value) { // this.section.write(value); // } // // public void write(byte[] value) { // for (byte byteData : value) { // this.section.write(byteData); // } // } // // public void write(short value) { // for (byte byteData : new byte[] { // (byte) value, // (byte)(value >> 8) // }) { // this.section.write(byteData); // } // } // // public void write(int value) { // for (byte byteData : new byte[] { // (byte) value, // (byte)(value >> 8), // (byte)(value >> 16), // (byte)(value >> 24) // }) { // this.section.write(byteData); // } // } // } // // Path: src/net/eiveo/utils/SmartByteBuffer.java // public class SmartByteBuffer { // private ByteBuffer byteBuffer; // // public int capacity() { // return this.byteBuffer.capacity(); // } // // public byte get() { // return this.byteBuffer.get(); // } // // public void get(byte[] dst) { // this.byteBuffer.get(dst); // } // // public int getInt() { // return this.byteBuffer.getInt(); // } // // public short getShort() { // return this.byteBuffer.getShort(); // } // // public String getString() { // String string = ""; // // while (true) { // byte character = this.get(); // if ((character & 0xff) == 0) { // break; // } else { // string += new String(new byte[] { character }); // } // } // // return string; // } // // public String getString(int index, int length) { // byte[] output = new byte[length]; // if (index > -1) { // this.position(index); // } // this.byteBuffer.get(output); // return new String(output); // } // // public void order(ByteOrder bo) { // this.byteBuffer.order(bo); // } // // public int position() { // return this.byteBuffer.position(); // } // // public void position(int newPosition) { // this.byteBuffer.position(newPosition); // } // // public static SmartByteBuffer wrap(byte[] array) { // SmartByteBuffer instance = new SmartByteBuffer(); // instance.byteBuffer = ByteBuffer.wrap(array); // return instance; // } // }
import net.eiveo.utils.SmartByteArrayOutputStream; import net.eiveo.utils.SmartByteBuffer;
package net.eiveo.original.sections.todo.not_converted_yet; public class ICHA { private String name; private short type; private short subtype; private short[] frames = new short[24];
// Path: src/net/eiveo/utils/SmartByteArrayOutputStream.java // public class SmartByteArrayOutputStream { // private List<ByteArrayOutputStream> sections = new ArrayList<>(); // private ByteArrayOutputStream section; // // public SmartByteArrayOutputStream() { // this.section = new ByteArrayOutputStream(); // this.sections.add(this.section); // } // // public void sectionStart() { // this.section = new ByteArrayOutputStream(); // this.sections.add(this.section); // } // // public byte[] sectionEnd() { // byte[] result = this.section.toByteArray(); // sections.remove(sections.size() - 1); // this.section = sections.get(sections.size() - 1); // return result; // } // // public byte[] toByteArray() { // return this.section.toByteArray(); // } // // public void write(String string) { // for (byte byteData : string.getBytes()) { // this.section.write(byteData); // } // } // // public void write(byte value) { // this.section.write(value); // } // // public void write(byte[] value) { // for (byte byteData : value) { // this.section.write(byteData); // } // } // // public void write(short value) { // for (byte byteData : new byte[] { // (byte) value, // (byte)(value >> 8) // }) { // this.section.write(byteData); // } // } // // public void write(int value) { // for (byte byteData : new byte[] { // (byte) value, // (byte)(value >> 8), // (byte)(value >> 16), // (byte)(value >> 24) // }) { // this.section.write(byteData); // } // } // } // // Path: src/net/eiveo/utils/SmartByteBuffer.java // public class SmartByteBuffer { // private ByteBuffer byteBuffer; // // public int capacity() { // return this.byteBuffer.capacity(); // } // // public byte get() { // return this.byteBuffer.get(); // } // // public void get(byte[] dst) { // this.byteBuffer.get(dst); // } // // public int getInt() { // return this.byteBuffer.getInt(); // } // // public short getShort() { // return this.byteBuffer.getShort(); // } // // public String getString() { // String string = ""; // // while (true) { // byte character = this.get(); // if ((character & 0xff) == 0) { // break; // } else { // string += new String(new byte[] { character }); // } // } // // return string; // } // // public String getString(int index, int length) { // byte[] output = new byte[length]; // if (index > -1) { // this.position(index); // } // this.byteBuffer.get(output); // return new String(output); // } // // public void order(ByteOrder bo) { // this.byteBuffer.order(bo); // } // // public int position() { // return this.byteBuffer.position(); // } // // public void position(int newPosition) { // this.byteBuffer.position(newPosition); // } // // public static SmartByteBuffer wrap(byte[] array) { // SmartByteBuffer instance = new SmartByteBuffer(); // instance.byteBuffer = ByteBuffer.wrap(array); // return instance; // } // } // Path: src/net/eiveo/original/sections/todo/not_converted_yet/ICHA.java import net.eiveo.utils.SmartByteArrayOutputStream; import net.eiveo.utils.SmartByteBuffer; package net.eiveo.original.sections.todo.not_converted_yet; public class ICHA { private String name; private short type; private short subtype; private short[] frames = new short[24];
public static ICHA read(SmartByteBuffer data, boolean isYoda) throws Exception {
IceReaper/DesktopAdventuresToolkit
src/net/eiveo/original/sections/todo/not_converted_yet/ICHA.java
// Path: src/net/eiveo/utils/SmartByteArrayOutputStream.java // public class SmartByteArrayOutputStream { // private List<ByteArrayOutputStream> sections = new ArrayList<>(); // private ByteArrayOutputStream section; // // public SmartByteArrayOutputStream() { // this.section = new ByteArrayOutputStream(); // this.sections.add(this.section); // } // // public void sectionStart() { // this.section = new ByteArrayOutputStream(); // this.sections.add(this.section); // } // // public byte[] sectionEnd() { // byte[] result = this.section.toByteArray(); // sections.remove(sections.size() - 1); // this.section = sections.get(sections.size() - 1); // return result; // } // // public byte[] toByteArray() { // return this.section.toByteArray(); // } // // public void write(String string) { // for (byte byteData : string.getBytes()) { // this.section.write(byteData); // } // } // // public void write(byte value) { // this.section.write(value); // } // // public void write(byte[] value) { // for (byte byteData : value) { // this.section.write(byteData); // } // } // // public void write(short value) { // for (byte byteData : new byte[] { // (byte) value, // (byte)(value >> 8) // }) { // this.section.write(byteData); // } // } // // public void write(int value) { // for (byte byteData : new byte[] { // (byte) value, // (byte)(value >> 8), // (byte)(value >> 16), // (byte)(value >> 24) // }) { // this.section.write(byteData); // } // } // } // // Path: src/net/eiveo/utils/SmartByteBuffer.java // public class SmartByteBuffer { // private ByteBuffer byteBuffer; // // public int capacity() { // return this.byteBuffer.capacity(); // } // // public byte get() { // return this.byteBuffer.get(); // } // // public void get(byte[] dst) { // this.byteBuffer.get(dst); // } // // public int getInt() { // return this.byteBuffer.getInt(); // } // // public short getShort() { // return this.byteBuffer.getShort(); // } // // public String getString() { // String string = ""; // // while (true) { // byte character = this.get(); // if ((character & 0xff) == 0) { // break; // } else { // string += new String(new byte[] { character }); // } // } // // return string; // } // // public String getString(int index, int length) { // byte[] output = new byte[length]; // if (index > -1) { // this.position(index); // } // this.byteBuffer.get(output); // return new String(output); // } // // public void order(ByteOrder bo) { // this.byteBuffer.order(bo); // } // // public int position() { // return this.byteBuffer.position(); // } // // public void position(int newPosition) { // this.byteBuffer.position(newPosition); // } // // public static SmartByteBuffer wrap(byte[] array) { // SmartByteBuffer instance = new SmartByteBuffer(); // instance.byteBuffer = ByteBuffer.wrap(array); // return instance; // } // }
import net.eiveo.utils.SmartByteArrayOutputStream; import net.eiveo.utils.SmartByteBuffer;
package net.eiveo.original.sections.todo.not_converted_yet; public class ICHA { private String name; private short type; private short subtype; private short[] frames = new short[24]; public static ICHA read(SmartByteBuffer data, boolean isYoda) throws Exception { ICHA instance = new ICHA(); int length = data.getInt(); int lengthStart = data.position(); int nameStart = data.position(); instance.name = data.getString(); data.position(nameStart + 16); // filled with trash - bug instance.type = data.getShort(); instance.subtype = data.getShort(); if (isYoda) { data.getShort(); // -1 data.getShort(); // 0 data.getShort(); // 0 } for (int i = 0; i < 24; i++) { instance.frames[i] = data.getShort(); } if (lengthStart + length != data.position()) { throw new Exception("Length mismatch."); } return instance; }
// Path: src/net/eiveo/utils/SmartByteArrayOutputStream.java // public class SmartByteArrayOutputStream { // private List<ByteArrayOutputStream> sections = new ArrayList<>(); // private ByteArrayOutputStream section; // // public SmartByteArrayOutputStream() { // this.section = new ByteArrayOutputStream(); // this.sections.add(this.section); // } // // public void sectionStart() { // this.section = new ByteArrayOutputStream(); // this.sections.add(this.section); // } // // public byte[] sectionEnd() { // byte[] result = this.section.toByteArray(); // sections.remove(sections.size() - 1); // this.section = sections.get(sections.size() - 1); // return result; // } // // public byte[] toByteArray() { // return this.section.toByteArray(); // } // // public void write(String string) { // for (byte byteData : string.getBytes()) { // this.section.write(byteData); // } // } // // public void write(byte value) { // this.section.write(value); // } // // public void write(byte[] value) { // for (byte byteData : value) { // this.section.write(byteData); // } // } // // public void write(short value) { // for (byte byteData : new byte[] { // (byte) value, // (byte)(value >> 8) // }) { // this.section.write(byteData); // } // } // // public void write(int value) { // for (byte byteData : new byte[] { // (byte) value, // (byte)(value >> 8), // (byte)(value >> 16), // (byte)(value >> 24) // }) { // this.section.write(byteData); // } // } // } // // Path: src/net/eiveo/utils/SmartByteBuffer.java // public class SmartByteBuffer { // private ByteBuffer byteBuffer; // // public int capacity() { // return this.byteBuffer.capacity(); // } // // public byte get() { // return this.byteBuffer.get(); // } // // public void get(byte[] dst) { // this.byteBuffer.get(dst); // } // // public int getInt() { // return this.byteBuffer.getInt(); // } // // public short getShort() { // return this.byteBuffer.getShort(); // } // // public String getString() { // String string = ""; // // while (true) { // byte character = this.get(); // if ((character & 0xff) == 0) { // break; // } else { // string += new String(new byte[] { character }); // } // } // // return string; // } // // public String getString(int index, int length) { // byte[] output = new byte[length]; // if (index > -1) { // this.position(index); // } // this.byteBuffer.get(output); // return new String(output); // } // // public void order(ByteOrder bo) { // this.byteBuffer.order(bo); // } // // public int position() { // return this.byteBuffer.position(); // } // // public void position(int newPosition) { // this.byteBuffer.position(newPosition); // } // // public static SmartByteBuffer wrap(byte[] array) { // SmartByteBuffer instance = new SmartByteBuffer(); // instance.byteBuffer = ByteBuffer.wrap(array); // return instance; // } // } // Path: src/net/eiveo/original/sections/todo/not_converted_yet/ICHA.java import net.eiveo.utils.SmartByteArrayOutputStream; import net.eiveo.utils.SmartByteBuffer; package net.eiveo.original.sections.todo.not_converted_yet; public class ICHA { private String name; private short type; private short subtype; private short[] frames = new short[24]; public static ICHA read(SmartByteBuffer data, boolean isYoda) throws Exception { ICHA instance = new ICHA(); int length = data.getInt(); int lengthStart = data.position(); int nameStart = data.position(); instance.name = data.getString(); data.position(nameStart + 16); // filled with trash - bug instance.type = data.getShort(); instance.subtype = data.getShort(); if (isYoda) { data.getShort(); // -1 data.getShort(); // 0 data.getShort(); // 0 } for (int i = 0; i < 24; i++) { instance.frames[i] = data.getShort(); } if (lengthStart + length != data.position()) { throw new Exception("Length mismatch."); } return instance; }
public void write(SmartByteArrayOutputStream outputStream, boolean isYoda) throws Exception {
IceReaper/DesktopAdventuresToolkit
src/net/eiveo/original/sections/TILE.java
// Path: src/net/eiveo/utils/SmartByteArrayOutputStream.java // public class SmartByteArrayOutputStream { // private List<ByteArrayOutputStream> sections = new ArrayList<>(); // private ByteArrayOutputStream section; // // public SmartByteArrayOutputStream() { // this.section = new ByteArrayOutputStream(); // this.sections.add(this.section); // } // // public void sectionStart() { // this.section = new ByteArrayOutputStream(); // this.sections.add(this.section); // } // // public byte[] sectionEnd() { // byte[] result = this.section.toByteArray(); // sections.remove(sections.size() - 1); // this.section = sections.get(sections.size() - 1); // return result; // } // // public byte[] toByteArray() { // return this.section.toByteArray(); // } // // public void write(String string) { // for (byte byteData : string.getBytes()) { // this.section.write(byteData); // } // } // // public void write(byte value) { // this.section.write(value); // } // // public void write(byte[] value) { // for (byte byteData : value) { // this.section.write(byteData); // } // } // // public void write(short value) { // for (byte byteData : new byte[] { // (byte) value, // (byte)(value >> 8) // }) { // this.section.write(byteData); // } // } // // public void write(int value) { // for (byte byteData : new byte[] { // (byte) value, // (byte)(value >> 8), // (byte)(value >> 16), // (byte)(value >> 24) // }) { // this.section.write(byteData); // } // } // } // // Path: src/net/eiveo/utils/SmartByteBuffer.java // public class SmartByteBuffer { // private ByteBuffer byteBuffer; // // public int capacity() { // return this.byteBuffer.capacity(); // } // // public byte get() { // return this.byteBuffer.get(); // } // // public void get(byte[] dst) { // this.byteBuffer.get(dst); // } // // public int getInt() { // return this.byteBuffer.getInt(); // } // // public short getShort() { // return this.byteBuffer.getShort(); // } // // public String getString() { // String string = ""; // // while (true) { // byte character = this.get(); // if ((character & 0xff) == 0) { // break; // } else { // string += new String(new byte[] { character }); // } // } // // return string; // } // // public String getString(int index, int length) { // byte[] output = new byte[length]; // if (index > -1) { // this.position(index); // } // this.byteBuffer.get(output); // return new String(output); // } // // public void order(ByteOrder bo) { // this.byteBuffer.order(bo); // } // // public int position() { // return this.byteBuffer.position(); // } // // public void position(int newPosition) { // this.byteBuffer.position(newPosition); // } // // public static SmartByteBuffer wrap(byte[] array) { // SmartByteBuffer instance = new SmartByteBuffer(); // instance.byteBuffer = ByteBuffer.wrap(array); // return instance; // } // }
import java.util.ArrayList; import java.util.List; import net.eiveo.utils.SmartByteArrayOutputStream; import net.eiveo.utils.SmartByteBuffer;
package net.eiveo.original.sections; public class TILE { public List<Tile> tiles = new ArrayList<>();
// Path: src/net/eiveo/utils/SmartByteArrayOutputStream.java // public class SmartByteArrayOutputStream { // private List<ByteArrayOutputStream> sections = new ArrayList<>(); // private ByteArrayOutputStream section; // // public SmartByteArrayOutputStream() { // this.section = new ByteArrayOutputStream(); // this.sections.add(this.section); // } // // public void sectionStart() { // this.section = new ByteArrayOutputStream(); // this.sections.add(this.section); // } // // public byte[] sectionEnd() { // byte[] result = this.section.toByteArray(); // sections.remove(sections.size() - 1); // this.section = sections.get(sections.size() - 1); // return result; // } // // public byte[] toByteArray() { // return this.section.toByteArray(); // } // // public void write(String string) { // for (byte byteData : string.getBytes()) { // this.section.write(byteData); // } // } // // public void write(byte value) { // this.section.write(value); // } // // public void write(byte[] value) { // for (byte byteData : value) { // this.section.write(byteData); // } // } // // public void write(short value) { // for (byte byteData : new byte[] { // (byte) value, // (byte)(value >> 8) // }) { // this.section.write(byteData); // } // } // // public void write(int value) { // for (byte byteData : new byte[] { // (byte) value, // (byte)(value >> 8), // (byte)(value >> 16), // (byte)(value >> 24) // }) { // this.section.write(byteData); // } // } // } // // Path: src/net/eiveo/utils/SmartByteBuffer.java // public class SmartByteBuffer { // private ByteBuffer byteBuffer; // // public int capacity() { // return this.byteBuffer.capacity(); // } // // public byte get() { // return this.byteBuffer.get(); // } // // public void get(byte[] dst) { // this.byteBuffer.get(dst); // } // // public int getInt() { // return this.byteBuffer.getInt(); // } // // public short getShort() { // return this.byteBuffer.getShort(); // } // // public String getString() { // String string = ""; // // while (true) { // byte character = this.get(); // if ((character & 0xff) == 0) { // break; // } else { // string += new String(new byte[] { character }); // } // } // // return string; // } // // public String getString(int index, int length) { // byte[] output = new byte[length]; // if (index > -1) { // this.position(index); // } // this.byteBuffer.get(output); // return new String(output); // } // // public void order(ByteOrder bo) { // this.byteBuffer.order(bo); // } // // public int position() { // return this.byteBuffer.position(); // } // // public void position(int newPosition) { // this.byteBuffer.position(newPosition); // } // // public static SmartByteBuffer wrap(byte[] array) { // SmartByteBuffer instance = new SmartByteBuffer(); // instance.byteBuffer = ByteBuffer.wrap(array); // return instance; // } // } // Path: src/net/eiveo/original/sections/TILE.java import java.util.ArrayList; import java.util.List; import net.eiveo.utils.SmartByteArrayOutputStream; import net.eiveo.utils.SmartByteBuffer; package net.eiveo.original.sections; public class TILE { public List<Tile> tiles = new ArrayList<>();
public static TILE read(SmartByteBuffer data) throws Exception {
IceReaper/DesktopAdventuresToolkit
src/net/eiveo/original/sections/TILE.java
// Path: src/net/eiveo/utils/SmartByteArrayOutputStream.java // public class SmartByteArrayOutputStream { // private List<ByteArrayOutputStream> sections = new ArrayList<>(); // private ByteArrayOutputStream section; // // public SmartByteArrayOutputStream() { // this.section = new ByteArrayOutputStream(); // this.sections.add(this.section); // } // // public void sectionStart() { // this.section = new ByteArrayOutputStream(); // this.sections.add(this.section); // } // // public byte[] sectionEnd() { // byte[] result = this.section.toByteArray(); // sections.remove(sections.size() - 1); // this.section = sections.get(sections.size() - 1); // return result; // } // // public byte[] toByteArray() { // return this.section.toByteArray(); // } // // public void write(String string) { // for (byte byteData : string.getBytes()) { // this.section.write(byteData); // } // } // // public void write(byte value) { // this.section.write(value); // } // // public void write(byte[] value) { // for (byte byteData : value) { // this.section.write(byteData); // } // } // // public void write(short value) { // for (byte byteData : new byte[] { // (byte) value, // (byte)(value >> 8) // }) { // this.section.write(byteData); // } // } // // public void write(int value) { // for (byte byteData : new byte[] { // (byte) value, // (byte)(value >> 8), // (byte)(value >> 16), // (byte)(value >> 24) // }) { // this.section.write(byteData); // } // } // } // // Path: src/net/eiveo/utils/SmartByteBuffer.java // public class SmartByteBuffer { // private ByteBuffer byteBuffer; // // public int capacity() { // return this.byteBuffer.capacity(); // } // // public byte get() { // return this.byteBuffer.get(); // } // // public void get(byte[] dst) { // this.byteBuffer.get(dst); // } // // public int getInt() { // return this.byteBuffer.getInt(); // } // // public short getShort() { // return this.byteBuffer.getShort(); // } // // public String getString() { // String string = ""; // // while (true) { // byte character = this.get(); // if ((character & 0xff) == 0) { // break; // } else { // string += new String(new byte[] { character }); // } // } // // return string; // } // // public String getString(int index, int length) { // byte[] output = new byte[length]; // if (index > -1) { // this.position(index); // } // this.byteBuffer.get(output); // return new String(output); // } // // public void order(ByteOrder bo) { // this.byteBuffer.order(bo); // } // // public int position() { // return this.byteBuffer.position(); // } // // public void position(int newPosition) { // this.byteBuffer.position(newPosition); // } // // public static SmartByteBuffer wrap(byte[] array) { // SmartByteBuffer instance = new SmartByteBuffer(); // instance.byteBuffer = ByteBuffer.wrap(array); // return instance; // } // }
import java.util.ArrayList; import java.util.List; import net.eiveo.utils.SmartByteArrayOutputStream; import net.eiveo.utils.SmartByteBuffer;
package net.eiveo.original.sections; public class TILE { public List<Tile> tiles = new ArrayList<>(); public static TILE read(SmartByteBuffer data) throws Exception { TILE instance = new TILE(); int length = data.getInt(); int lengthStart = data.position(); while (data.position() < lengthStart + length) { instance.tiles.add(Tile.read(data)); } if (lengthStart + length != data.position()) { throw new Exception("Length mismatch."); } return instance; }
// Path: src/net/eiveo/utils/SmartByteArrayOutputStream.java // public class SmartByteArrayOutputStream { // private List<ByteArrayOutputStream> sections = new ArrayList<>(); // private ByteArrayOutputStream section; // // public SmartByteArrayOutputStream() { // this.section = new ByteArrayOutputStream(); // this.sections.add(this.section); // } // // public void sectionStart() { // this.section = new ByteArrayOutputStream(); // this.sections.add(this.section); // } // // public byte[] sectionEnd() { // byte[] result = this.section.toByteArray(); // sections.remove(sections.size() - 1); // this.section = sections.get(sections.size() - 1); // return result; // } // // public byte[] toByteArray() { // return this.section.toByteArray(); // } // // public void write(String string) { // for (byte byteData : string.getBytes()) { // this.section.write(byteData); // } // } // // public void write(byte value) { // this.section.write(value); // } // // public void write(byte[] value) { // for (byte byteData : value) { // this.section.write(byteData); // } // } // // public void write(short value) { // for (byte byteData : new byte[] { // (byte) value, // (byte)(value >> 8) // }) { // this.section.write(byteData); // } // } // // public void write(int value) { // for (byte byteData : new byte[] { // (byte) value, // (byte)(value >> 8), // (byte)(value >> 16), // (byte)(value >> 24) // }) { // this.section.write(byteData); // } // } // } // // Path: src/net/eiveo/utils/SmartByteBuffer.java // public class SmartByteBuffer { // private ByteBuffer byteBuffer; // // public int capacity() { // return this.byteBuffer.capacity(); // } // // public byte get() { // return this.byteBuffer.get(); // } // // public void get(byte[] dst) { // this.byteBuffer.get(dst); // } // // public int getInt() { // return this.byteBuffer.getInt(); // } // // public short getShort() { // return this.byteBuffer.getShort(); // } // // public String getString() { // String string = ""; // // while (true) { // byte character = this.get(); // if ((character & 0xff) == 0) { // break; // } else { // string += new String(new byte[] { character }); // } // } // // return string; // } // // public String getString(int index, int length) { // byte[] output = new byte[length]; // if (index > -1) { // this.position(index); // } // this.byteBuffer.get(output); // return new String(output); // } // // public void order(ByteOrder bo) { // this.byteBuffer.order(bo); // } // // public int position() { // return this.byteBuffer.position(); // } // // public void position(int newPosition) { // this.byteBuffer.position(newPosition); // } // // public static SmartByteBuffer wrap(byte[] array) { // SmartByteBuffer instance = new SmartByteBuffer(); // instance.byteBuffer = ByteBuffer.wrap(array); // return instance; // } // } // Path: src/net/eiveo/original/sections/TILE.java import java.util.ArrayList; import java.util.List; import net.eiveo.utils.SmartByteArrayOutputStream; import net.eiveo.utils.SmartByteBuffer; package net.eiveo.original.sections; public class TILE { public List<Tile> tiles = new ArrayList<>(); public static TILE read(SmartByteBuffer data) throws Exception { TILE instance = new TILE(); int length = data.getInt(); int lengthStart = data.position(); while (data.position() < lengthStart + length) { instance.tiles.add(Tile.read(data)); } if (lengthStart + length != data.position()) { throw new Exception("Length mismatch."); } return instance; }
public void write(SmartByteArrayOutputStream outputStream) {
IceReaper/DesktopAdventuresToolkit
src/net/eiveo/original/sections/todo/not_converted_yet/IZX3.java
// Path: src/net/eiveo/utils/SmartByteArrayOutputStream.java // public class SmartByteArrayOutputStream { // private List<ByteArrayOutputStream> sections = new ArrayList<>(); // private ByteArrayOutputStream section; // // public SmartByteArrayOutputStream() { // this.section = new ByteArrayOutputStream(); // this.sections.add(this.section); // } // // public void sectionStart() { // this.section = new ByteArrayOutputStream(); // this.sections.add(this.section); // } // // public byte[] sectionEnd() { // byte[] result = this.section.toByteArray(); // sections.remove(sections.size() - 1); // this.section = sections.get(sections.size() - 1); // return result; // } // // public byte[] toByteArray() { // return this.section.toByteArray(); // } // // public void write(String string) { // for (byte byteData : string.getBytes()) { // this.section.write(byteData); // } // } // // public void write(byte value) { // this.section.write(value); // } // // public void write(byte[] value) { // for (byte byteData : value) { // this.section.write(byteData); // } // } // // public void write(short value) { // for (byte byteData : new byte[] { // (byte) value, // (byte)(value >> 8) // }) { // this.section.write(byteData); // } // } // // public void write(int value) { // for (byte byteData : new byte[] { // (byte) value, // (byte)(value >> 8), // (byte)(value >> 16), // (byte)(value >> 24) // }) { // this.section.write(byteData); // } // } // } // // Path: src/net/eiveo/utils/SmartByteBuffer.java // public class SmartByteBuffer { // private ByteBuffer byteBuffer; // // public int capacity() { // return this.byteBuffer.capacity(); // } // // public byte get() { // return this.byteBuffer.get(); // } // // public void get(byte[] dst) { // this.byteBuffer.get(dst); // } // // public int getInt() { // return this.byteBuffer.getInt(); // } // // public short getShort() { // return this.byteBuffer.getShort(); // } // // public String getString() { // String string = ""; // // while (true) { // byte character = this.get(); // if ((character & 0xff) == 0) { // break; // } else { // string += new String(new byte[] { character }); // } // } // // return string; // } // // public String getString(int index, int length) { // byte[] output = new byte[length]; // if (index > -1) { // this.position(index); // } // this.byteBuffer.get(output); // return new String(output); // } // // public void order(ByteOrder bo) { // this.byteBuffer.order(bo); // } // // public int position() { // return this.byteBuffer.position(); // } // // public void position(int newPosition) { // this.byteBuffer.position(newPosition); // } // // public static SmartByteBuffer wrap(byte[] array) { // SmartByteBuffer instance = new SmartByteBuffer(); // instance.byteBuffer = ByteBuffer.wrap(array); // return instance; // } // }
import java.util.ArrayList; import java.util.List; import net.eiveo.utils.SmartByteArrayOutputStream; import net.eiveo.utils.SmartByteBuffer;
package net.eiveo.original.sections.todo.not_converted_yet; public class IZX3 { private List<Short> tileId = new ArrayList<>();
// Path: src/net/eiveo/utils/SmartByteArrayOutputStream.java // public class SmartByteArrayOutputStream { // private List<ByteArrayOutputStream> sections = new ArrayList<>(); // private ByteArrayOutputStream section; // // public SmartByteArrayOutputStream() { // this.section = new ByteArrayOutputStream(); // this.sections.add(this.section); // } // // public void sectionStart() { // this.section = new ByteArrayOutputStream(); // this.sections.add(this.section); // } // // public byte[] sectionEnd() { // byte[] result = this.section.toByteArray(); // sections.remove(sections.size() - 1); // this.section = sections.get(sections.size() - 1); // return result; // } // // public byte[] toByteArray() { // return this.section.toByteArray(); // } // // public void write(String string) { // for (byte byteData : string.getBytes()) { // this.section.write(byteData); // } // } // // public void write(byte value) { // this.section.write(value); // } // // public void write(byte[] value) { // for (byte byteData : value) { // this.section.write(byteData); // } // } // // public void write(short value) { // for (byte byteData : new byte[] { // (byte) value, // (byte)(value >> 8) // }) { // this.section.write(byteData); // } // } // // public void write(int value) { // for (byte byteData : new byte[] { // (byte) value, // (byte)(value >> 8), // (byte)(value >> 16), // (byte)(value >> 24) // }) { // this.section.write(byteData); // } // } // } // // Path: src/net/eiveo/utils/SmartByteBuffer.java // public class SmartByteBuffer { // private ByteBuffer byteBuffer; // // public int capacity() { // return this.byteBuffer.capacity(); // } // // public byte get() { // return this.byteBuffer.get(); // } // // public void get(byte[] dst) { // this.byteBuffer.get(dst); // } // // public int getInt() { // return this.byteBuffer.getInt(); // } // // public short getShort() { // return this.byteBuffer.getShort(); // } // // public String getString() { // String string = ""; // // while (true) { // byte character = this.get(); // if ((character & 0xff) == 0) { // break; // } else { // string += new String(new byte[] { character }); // } // } // // return string; // } // // public String getString(int index, int length) { // byte[] output = new byte[length]; // if (index > -1) { // this.position(index); // } // this.byteBuffer.get(output); // return new String(output); // } // // public void order(ByteOrder bo) { // this.byteBuffer.order(bo); // } // // public int position() { // return this.byteBuffer.position(); // } // // public void position(int newPosition) { // this.byteBuffer.position(newPosition); // } // // public static SmartByteBuffer wrap(byte[] array) { // SmartByteBuffer instance = new SmartByteBuffer(); // instance.byteBuffer = ByteBuffer.wrap(array); // return instance; // } // } // Path: src/net/eiveo/original/sections/todo/not_converted_yet/IZX3.java import java.util.ArrayList; import java.util.List; import net.eiveo.utils.SmartByteArrayOutputStream; import net.eiveo.utils.SmartByteBuffer; package net.eiveo.original.sections.todo.not_converted_yet; public class IZX3 { private List<Short> tileId = new ArrayList<>();
public static IZX3 read(SmartByteBuffer data) throws Exception {
IceReaper/DesktopAdventuresToolkit
src/net/eiveo/original/sections/todo/not_converted_yet/IZX3.java
// Path: src/net/eiveo/utils/SmartByteArrayOutputStream.java // public class SmartByteArrayOutputStream { // private List<ByteArrayOutputStream> sections = new ArrayList<>(); // private ByteArrayOutputStream section; // // public SmartByteArrayOutputStream() { // this.section = new ByteArrayOutputStream(); // this.sections.add(this.section); // } // // public void sectionStart() { // this.section = new ByteArrayOutputStream(); // this.sections.add(this.section); // } // // public byte[] sectionEnd() { // byte[] result = this.section.toByteArray(); // sections.remove(sections.size() - 1); // this.section = sections.get(sections.size() - 1); // return result; // } // // public byte[] toByteArray() { // return this.section.toByteArray(); // } // // public void write(String string) { // for (byte byteData : string.getBytes()) { // this.section.write(byteData); // } // } // // public void write(byte value) { // this.section.write(value); // } // // public void write(byte[] value) { // for (byte byteData : value) { // this.section.write(byteData); // } // } // // public void write(short value) { // for (byte byteData : new byte[] { // (byte) value, // (byte)(value >> 8) // }) { // this.section.write(byteData); // } // } // // public void write(int value) { // for (byte byteData : new byte[] { // (byte) value, // (byte)(value >> 8), // (byte)(value >> 16), // (byte)(value >> 24) // }) { // this.section.write(byteData); // } // } // } // // Path: src/net/eiveo/utils/SmartByteBuffer.java // public class SmartByteBuffer { // private ByteBuffer byteBuffer; // // public int capacity() { // return this.byteBuffer.capacity(); // } // // public byte get() { // return this.byteBuffer.get(); // } // // public void get(byte[] dst) { // this.byteBuffer.get(dst); // } // // public int getInt() { // return this.byteBuffer.getInt(); // } // // public short getShort() { // return this.byteBuffer.getShort(); // } // // public String getString() { // String string = ""; // // while (true) { // byte character = this.get(); // if ((character & 0xff) == 0) { // break; // } else { // string += new String(new byte[] { character }); // } // } // // return string; // } // // public String getString(int index, int length) { // byte[] output = new byte[length]; // if (index > -1) { // this.position(index); // } // this.byteBuffer.get(output); // return new String(output); // } // // public void order(ByteOrder bo) { // this.byteBuffer.order(bo); // } // // public int position() { // return this.byteBuffer.position(); // } // // public void position(int newPosition) { // this.byteBuffer.position(newPosition); // } // // public static SmartByteBuffer wrap(byte[] array) { // SmartByteBuffer instance = new SmartByteBuffer(); // instance.byteBuffer = ByteBuffer.wrap(array); // return instance; // } // }
import java.util.ArrayList; import java.util.List; import net.eiveo.utils.SmartByteArrayOutputStream; import net.eiveo.utils.SmartByteBuffer;
package net.eiveo.original.sections.todo.not_converted_yet; public class IZX3 { private List<Short> tileId = new ArrayList<>(); public static IZX3 read(SmartByteBuffer data) throws Exception { IZX3 instance = new IZX3(); // Somehow IZX3 includes identifier and the length int into the length. int length = data.getInt() - 8; int lengthStart = data.position(); short amount = data.getShort(); for (int j = 0; j < amount; j++) { instance.tileId.add(data.getShort()); } if (lengthStart + length != data.position()) { throw new Exception("Length mismatch."); } return instance; }
// Path: src/net/eiveo/utils/SmartByteArrayOutputStream.java // public class SmartByteArrayOutputStream { // private List<ByteArrayOutputStream> sections = new ArrayList<>(); // private ByteArrayOutputStream section; // // public SmartByteArrayOutputStream() { // this.section = new ByteArrayOutputStream(); // this.sections.add(this.section); // } // // public void sectionStart() { // this.section = new ByteArrayOutputStream(); // this.sections.add(this.section); // } // // public byte[] sectionEnd() { // byte[] result = this.section.toByteArray(); // sections.remove(sections.size() - 1); // this.section = sections.get(sections.size() - 1); // return result; // } // // public byte[] toByteArray() { // return this.section.toByteArray(); // } // // public void write(String string) { // for (byte byteData : string.getBytes()) { // this.section.write(byteData); // } // } // // public void write(byte value) { // this.section.write(value); // } // // public void write(byte[] value) { // for (byte byteData : value) { // this.section.write(byteData); // } // } // // public void write(short value) { // for (byte byteData : new byte[] { // (byte) value, // (byte)(value >> 8) // }) { // this.section.write(byteData); // } // } // // public void write(int value) { // for (byte byteData : new byte[] { // (byte) value, // (byte)(value >> 8), // (byte)(value >> 16), // (byte)(value >> 24) // }) { // this.section.write(byteData); // } // } // } // // Path: src/net/eiveo/utils/SmartByteBuffer.java // public class SmartByteBuffer { // private ByteBuffer byteBuffer; // // public int capacity() { // return this.byteBuffer.capacity(); // } // // public byte get() { // return this.byteBuffer.get(); // } // // public void get(byte[] dst) { // this.byteBuffer.get(dst); // } // // public int getInt() { // return this.byteBuffer.getInt(); // } // // public short getShort() { // return this.byteBuffer.getShort(); // } // // public String getString() { // String string = ""; // // while (true) { // byte character = this.get(); // if ((character & 0xff) == 0) { // break; // } else { // string += new String(new byte[] { character }); // } // } // // return string; // } // // public String getString(int index, int length) { // byte[] output = new byte[length]; // if (index > -1) { // this.position(index); // } // this.byteBuffer.get(output); // return new String(output); // } // // public void order(ByteOrder bo) { // this.byteBuffer.order(bo); // } // // public int position() { // return this.byteBuffer.position(); // } // // public void position(int newPosition) { // this.byteBuffer.position(newPosition); // } // // public static SmartByteBuffer wrap(byte[] array) { // SmartByteBuffer instance = new SmartByteBuffer(); // instance.byteBuffer = ByteBuffer.wrap(array); // return instance; // } // } // Path: src/net/eiveo/original/sections/todo/not_converted_yet/IZX3.java import java.util.ArrayList; import java.util.List; import net.eiveo.utils.SmartByteArrayOutputStream; import net.eiveo.utils.SmartByteBuffer; package net.eiveo.original.sections.todo.not_converted_yet; public class IZX3 { private List<Short> tileId = new ArrayList<>(); public static IZX3 read(SmartByteBuffer data) throws Exception { IZX3 instance = new IZX3(); // Somehow IZX3 includes identifier and the length int into the length. int length = data.getInt() - 8; int lengthStart = data.position(); short amount = data.getShort(); for (int j = 0; j < amount; j++) { instance.tileId.add(data.getShort()); } if (lengthStart + length != data.position()) { throw new Exception("Length mismatch."); } return instance; }
public void write(SmartByteArrayOutputStream outputStream) {
IceReaper/DesktopAdventuresToolkit
src/net/eiveo/original/sections/SNDS.java
// Path: src/net/eiveo/utils/SmartByteArrayOutputStream.java // public class SmartByteArrayOutputStream { // private List<ByteArrayOutputStream> sections = new ArrayList<>(); // private ByteArrayOutputStream section; // // public SmartByteArrayOutputStream() { // this.section = new ByteArrayOutputStream(); // this.sections.add(this.section); // } // // public void sectionStart() { // this.section = new ByteArrayOutputStream(); // this.sections.add(this.section); // } // // public byte[] sectionEnd() { // byte[] result = this.section.toByteArray(); // sections.remove(sections.size() - 1); // this.section = sections.get(sections.size() - 1); // return result; // } // // public byte[] toByteArray() { // return this.section.toByteArray(); // } // // public void write(String string) { // for (byte byteData : string.getBytes()) { // this.section.write(byteData); // } // } // // public void write(byte value) { // this.section.write(value); // } // // public void write(byte[] value) { // for (byte byteData : value) { // this.section.write(byteData); // } // } // // public void write(short value) { // for (byte byteData : new byte[] { // (byte) value, // (byte)(value >> 8) // }) { // this.section.write(byteData); // } // } // // public void write(int value) { // for (byte byteData : new byte[] { // (byte) value, // (byte)(value >> 8), // (byte)(value >> 16), // (byte)(value >> 24) // }) { // this.section.write(byteData); // } // } // } // // Path: src/net/eiveo/utils/SmartByteBuffer.java // public class SmartByteBuffer { // private ByteBuffer byteBuffer; // // public int capacity() { // return this.byteBuffer.capacity(); // } // // public byte get() { // return this.byteBuffer.get(); // } // // public void get(byte[] dst) { // this.byteBuffer.get(dst); // } // // public int getInt() { // return this.byteBuffer.getInt(); // } // // public short getShort() { // return this.byteBuffer.getShort(); // } // // public String getString() { // String string = ""; // // while (true) { // byte character = this.get(); // if ((character & 0xff) == 0) { // break; // } else { // string += new String(new byte[] { character }); // } // } // // return string; // } // // public String getString(int index, int length) { // byte[] output = new byte[length]; // if (index > -1) { // this.position(index); // } // this.byteBuffer.get(output); // return new String(output); // } // // public void order(ByteOrder bo) { // this.byteBuffer.order(bo); // } // // public int position() { // return this.byteBuffer.position(); // } // // public void position(int newPosition) { // this.byteBuffer.position(newPosition); // } // // public static SmartByteBuffer wrap(byte[] array) { // SmartByteBuffer instance = new SmartByteBuffer(); // instance.byteBuffer = ByteBuffer.wrap(array); // return instance; // } // }
import java.io.File; import java.nio.file.Files; import java.nio.file.StandardOpenOption; import java.util.ArrayList; import java.util.List; import net.eiveo.utils.SmartByteArrayOutputStream; import net.eiveo.utils.SmartByteBuffer;
package net.eiveo.original.sections; public class SNDS { public List<Sound> sounds = new ArrayList<>();
// Path: src/net/eiveo/utils/SmartByteArrayOutputStream.java // public class SmartByteArrayOutputStream { // private List<ByteArrayOutputStream> sections = new ArrayList<>(); // private ByteArrayOutputStream section; // // public SmartByteArrayOutputStream() { // this.section = new ByteArrayOutputStream(); // this.sections.add(this.section); // } // // public void sectionStart() { // this.section = new ByteArrayOutputStream(); // this.sections.add(this.section); // } // // public byte[] sectionEnd() { // byte[] result = this.section.toByteArray(); // sections.remove(sections.size() - 1); // this.section = sections.get(sections.size() - 1); // return result; // } // // public byte[] toByteArray() { // return this.section.toByteArray(); // } // // public void write(String string) { // for (byte byteData : string.getBytes()) { // this.section.write(byteData); // } // } // // public void write(byte value) { // this.section.write(value); // } // // public void write(byte[] value) { // for (byte byteData : value) { // this.section.write(byteData); // } // } // // public void write(short value) { // for (byte byteData : new byte[] { // (byte) value, // (byte)(value >> 8) // }) { // this.section.write(byteData); // } // } // // public void write(int value) { // for (byte byteData : new byte[] { // (byte) value, // (byte)(value >> 8), // (byte)(value >> 16), // (byte)(value >> 24) // }) { // this.section.write(byteData); // } // } // } // // Path: src/net/eiveo/utils/SmartByteBuffer.java // public class SmartByteBuffer { // private ByteBuffer byteBuffer; // // public int capacity() { // return this.byteBuffer.capacity(); // } // // public byte get() { // return this.byteBuffer.get(); // } // // public void get(byte[] dst) { // this.byteBuffer.get(dst); // } // // public int getInt() { // return this.byteBuffer.getInt(); // } // // public short getShort() { // return this.byteBuffer.getShort(); // } // // public String getString() { // String string = ""; // // while (true) { // byte character = this.get(); // if ((character & 0xff) == 0) { // break; // } else { // string += new String(new byte[] { character }); // } // } // // return string; // } // // public String getString(int index, int length) { // byte[] output = new byte[length]; // if (index > -1) { // this.position(index); // } // this.byteBuffer.get(output); // return new String(output); // } // // public void order(ByteOrder bo) { // this.byteBuffer.order(bo); // } // // public int position() { // return this.byteBuffer.position(); // } // // public void position(int newPosition) { // this.byteBuffer.position(newPosition); // } // // public static SmartByteBuffer wrap(byte[] array) { // SmartByteBuffer instance = new SmartByteBuffer(); // instance.byteBuffer = ByteBuffer.wrap(array); // return instance; // } // } // Path: src/net/eiveo/original/sections/SNDS.java import java.io.File; import java.nio.file.Files; import java.nio.file.StandardOpenOption; import java.util.ArrayList; import java.util.List; import net.eiveo.utils.SmartByteArrayOutputStream; import net.eiveo.utils.SmartByteBuffer; package net.eiveo.original.sections; public class SNDS { public List<Sound> sounds = new ArrayList<>();
public static SNDS read(SmartByteBuffer data, boolean isYoda, File root) throws Exception {
IceReaper/DesktopAdventuresToolkit
src/net/eiveo/original/sections/SNDS.java
// Path: src/net/eiveo/utils/SmartByteArrayOutputStream.java // public class SmartByteArrayOutputStream { // private List<ByteArrayOutputStream> sections = new ArrayList<>(); // private ByteArrayOutputStream section; // // public SmartByteArrayOutputStream() { // this.section = new ByteArrayOutputStream(); // this.sections.add(this.section); // } // // public void sectionStart() { // this.section = new ByteArrayOutputStream(); // this.sections.add(this.section); // } // // public byte[] sectionEnd() { // byte[] result = this.section.toByteArray(); // sections.remove(sections.size() - 1); // this.section = sections.get(sections.size() - 1); // return result; // } // // public byte[] toByteArray() { // return this.section.toByteArray(); // } // // public void write(String string) { // for (byte byteData : string.getBytes()) { // this.section.write(byteData); // } // } // // public void write(byte value) { // this.section.write(value); // } // // public void write(byte[] value) { // for (byte byteData : value) { // this.section.write(byteData); // } // } // // public void write(short value) { // for (byte byteData : new byte[] { // (byte) value, // (byte)(value >> 8) // }) { // this.section.write(byteData); // } // } // // public void write(int value) { // for (byte byteData : new byte[] { // (byte) value, // (byte)(value >> 8), // (byte)(value >> 16), // (byte)(value >> 24) // }) { // this.section.write(byteData); // } // } // } // // Path: src/net/eiveo/utils/SmartByteBuffer.java // public class SmartByteBuffer { // private ByteBuffer byteBuffer; // // public int capacity() { // return this.byteBuffer.capacity(); // } // // public byte get() { // return this.byteBuffer.get(); // } // // public void get(byte[] dst) { // this.byteBuffer.get(dst); // } // // public int getInt() { // return this.byteBuffer.getInt(); // } // // public short getShort() { // return this.byteBuffer.getShort(); // } // // public String getString() { // String string = ""; // // while (true) { // byte character = this.get(); // if ((character & 0xff) == 0) { // break; // } else { // string += new String(new byte[] { character }); // } // } // // return string; // } // // public String getString(int index, int length) { // byte[] output = new byte[length]; // if (index > -1) { // this.position(index); // } // this.byteBuffer.get(output); // return new String(output); // } // // public void order(ByteOrder bo) { // this.byteBuffer.order(bo); // } // // public int position() { // return this.byteBuffer.position(); // } // // public void position(int newPosition) { // this.byteBuffer.position(newPosition); // } // // public static SmartByteBuffer wrap(byte[] array) { // SmartByteBuffer instance = new SmartByteBuffer(); // instance.byteBuffer = ByteBuffer.wrap(array); // return instance; // } // }
import java.io.File; import java.nio.file.Files; import java.nio.file.StandardOpenOption; import java.util.ArrayList; import java.util.List; import net.eiveo.utils.SmartByteArrayOutputStream; import net.eiveo.utils.SmartByteBuffer;
package net.eiveo.original.sections; public class SNDS { public List<Sound> sounds = new ArrayList<>(); public static SNDS read(SmartByteBuffer data, boolean isYoda, File root) throws Exception { SNDS instance = new SNDS(); int length = data.getInt(); int lengthStart = data.position(); short numSounds = (short) (data.getShort() * -1); for (int i = 0; i < numSounds; i++) { instance.sounds.add(Sound.read(data, isYoda, root)); } if (lengthStart + length != data.position()) { throw new Exception("Length mismatch."); } return instance; }
// Path: src/net/eiveo/utils/SmartByteArrayOutputStream.java // public class SmartByteArrayOutputStream { // private List<ByteArrayOutputStream> sections = new ArrayList<>(); // private ByteArrayOutputStream section; // // public SmartByteArrayOutputStream() { // this.section = new ByteArrayOutputStream(); // this.sections.add(this.section); // } // // public void sectionStart() { // this.section = new ByteArrayOutputStream(); // this.sections.add(this.section); // } // // public byte[] sectionEnd() { // byte[] result = this.section.toByteArray(); // sections.remove(sections.size() - 1); // this.section = sections.get(sections.size() - 1); // return result; // } // // public byte[] toByteArray() { // return this.section.toByteArray(); // } // // public void write(String string) { // for (byte byteData : string.getBytes()) { // this.section.write(byteData); // } // } // // public void write(byte value) { // this.section.write(value); // } // // public void write(byte[] value) { // for (byte byteData : value) { // this.section.write(byteData); // } // } // // public void write(short value) { // for (byte byteData : new byte[] { // (byte) value, // (byte)(value >> 8) // }) { // this.section.write(byteData); // } // } // // public void write(int value) { // for (byte byteData : new byte[] { // (byte) value, // (byte)(value >> 8), // (byte)(value >> 16), // (byte)(value >> 24) // }) { // this.section.write(byteData); // } // } // } // // Path: src/net/eiveo/utils/SmartByteBuffer.java // public class SmartByteBuffer { // private ByteBuffer byteBuffer; // // public int capacity() { // return this.byteBuffer.capacity(); // } // // public byte get() { // return this.byteBuffer.get(); // } // // public void get(byte[] dst) { // this.byteBuffer.get(dst); // } // // public int getInt() { // return this.byteBuffer.getInt(); // } // // public short getShort() { // return this.byteBuffer.getShort(); // } // // public String getString() { // String string = ""; // // while (true) { // byte character = this.get(); // if ((character & 0xff) == 0) { // break; // } else { // string += new String(new byte[] { character }); // } // } // // return string; // } // // public String getString(int index, int length) { // byte[] output = new byte[length]; // if (index > -1) { // this.position(index); // } // this.byteBuffer.get(output); // return new String(output); // } // // public void order(ByteOrder bo) { // this.byteBuffer.order(bo); // } // // public int position() { // return this.byteBuffer.position(); // } // // public void position(int newPosition) { // this.byteBuffer.position(newPosition); // } // // public static SmartByteBuffer wrap(byte[] array) { // SmartByteBuffer instance = new SmartByteBuffer(); // instance.byteBuffer = ByteBuffer.wrap(array); // return instance; // } // } // Path: src/net/eiveo/original/sections/SNDS.java import java.io.File; import java.nio.file.Files; import java.nio.file.StandardOpenOption; import java.util.ArrayList; import java.util.List; import net.eiveo.utils.SmartByteArrayOutputStream; import net.eiveo.utils.SmartByteBuffer; package net.eiveo.original.sections; public class SNDS { public List<Sound> sounds = new ArrayList<>(); public static SNDS read(SmartByteBuffer data, boolean isYoda, File root) throws Exception { SNDS instance = new SNDS(); int length = data.getInt(); int lengthStart = data.position(); short numSounds = (short) (data.getShort() * -1); for (int i = 0; i < numSounds; i++) { instance.sounds.add(Sound.read(data, isYoda, root)); } if (lengthStart + length != data.position()) { throw new Exception("Length mismatch."); } return instance; }
public void write(SmartByteArrayOutputStream outputStream, boolean isYoda, File root) throws Exception {
IceReaper/DesktopAdventuresToolkit
src/net/eiveo/original/sections/todo/not_converted_yet/ZAX3.java
// Path: src/net/eiveo/utils/SmartByteArrayOutputStream.java // public class SmartByteArrayOutputStream { // private List<ByteArrayOutputStream> sections = new ArrayList<>(); // private ByteArrayOutputStream section; // // public SmartByteArrayOutputStream() { // this.section = new ByteArrayOutputStream(); // this.sections.add(this.section); // } // // public void sectionStart() { // this.section = new ByteArrayOutputStream(); // this.sections.add(this.section); // } // // public byte[] sectionEnd() { // byte[] result = this.section.toByteArray(); // sections.remove(sections.size() - 1); // this.section = sections.get(sections.size() - 1); // return result; // } // // public byte[] toByteArray() { // return this.section.toByteArray(); // } // // public void write(String string) { // for (byte byteData : string.getBytes()) { // this.section.write(byteData); // } // } // // public void write(byte value) { // this.section.write(value); // } // // public void write(byte[] value) { // for (byte byteData : value) { // this.section.write(byteData); // } // } // // public void write(short value) { // for (byte byteData : new byte[] { // (byte) value, // (byte)(value >> 8) // }) { // this.section.write(byteData); // } // } // // public void write(int value) { // for (byte byteData : new byte[] { // (byte) value, // (byte)(value >> 8), // (byte)(value >> 16), // (byte)(value >> 24) // }) { // this.section.write(byteData); // } // } // } // // Path: src/net/eiveo/utils/SmartByteBuffer.java // public class SmartByteBuffer { // private ByteBuffer byteBuffer; // // public int capacity() { // return this.byteBuffer.capacity(); // } // // public byte get() { // return this.byteBuffer.get(); // } // // public void get(byte[] dst) { // this.byteBuffer.get(dst); // } // // public int getInt() { // return this.byteBuffer.getInt(); // } // // public short getShort() { // return this.byteBuffer.getShort(); // } // // public String getString() { // String string = ""; // // while (true) { // byte character = this.get(); // if ((character & 0xff) == 0) { // break; // } else { // string += new String(new byte[] { character }); // } // } // // return string; // } // // public String getString(int index, int length) { // byte[] output = new byte[length]; // if (index > -1) { // this.position(index); // } // this.byteBuffer.get(output); // return new String(output); // } // // public void order(ByteOrder bo) { // this.byteBuffer.order(bo); // } // // public int position() { // return this.byteBuffer.position(); // } // // public void position(int newPosition) { // this.byteBuffer.position(newPosition); // } // // public static SmartByteBuffer wrap(byte[] array) { // SmartByteBuffer instance = new SmartByteBuffer(); // instance.byteBuffer = ByteBuffer.wrap(array); // return instance; // } // }
import java.util.ArrayList; import java.util.List; import net.eiveo.utils.SmartByteArrayOutputStream; import net.eiveo.utils.SmartByteBuffer;
package net.eiveo.original.sections.todo.not_converted_yet; public class ZAX3 { private List<IZX3> IZX3 = new ArrayList<>();
// Path: src/net/eiveo/utils/SmartByteArrayOutputStream.java // public class SmartByteArrayOutputStream { // private List<ByteArrayOutputStream> sections = new ArrayList<>(); // private ByteArrayOutputStream section; // // public SmartByteArrayOutputStream() { // this.section = new ByteArrayOutputStream(); // this.sections.add(this.section); // } // // public void sectionStart() { // this.section = new ByteArrayOutputStream(); // this.sections.add(this.section); // } // // public byte[] sectionEnd() { // byte[] result = this.section.toByteArray(); // sections.remove(sections.size() - 1); // this.section = sections.get(sections.size() - 1); // return result; // } // // public byte[] toByteArray() { // return this.section.toByteArray(); // } // // public void write(String string) { // for (byte byteData : string.getBytes()) { // this.section.write(byteData); // } // } // // public void write(byte value) { // this.section.write(value); // } // // public void write(byte[] value) { // for (byte byteData : value) { // this.section.write(byteData); // } // } // // public void write(short value) { // for (byte byteData : new byte[] { // (byte) value, // (byte)(value >> 8) // }) { // this.section.write(byteData); // } // } // // public void write(int value) { // for (byte byteData : new byte[] { // (byte) value, // (byte)(value >> 8), // (byte)(value >> 16), // (byte)(value >> 24) // }) { // this.section.write(byteData); // } // } // } // // Path: src/net/eiveo/utils/SmartByteBuffer.java // public class SmartByteBuffer { // private ByteBuffer byteBuffer; // // public int capacity() { // return this.byteBuffer.capacity(); // } // // public byte get() { // return this.byteBuffer.get(); // } // // public void get(byte[] dst) { // this.byteBuffer.get(dst); // } // // public int getInt() { // return this.byteBuffer.getInt(); // } // // public short getShort() { // return this.byteBuffer.getShort(); // } // // public String getString() { // String string = ""; // // while (true) { // byte character = this.get(); // if ((character & 0xff) == 0) { // break; // } else { // string += new String(new byte[] { character }); // } // } // // return string; // } // // public String getString(int index, int length) { // byte[] output = new byte[length]; // if (index > -1) { // this.position(index); // } // this.byteBuffer.get(output); // return new String(output); // } // // public void order(ByteOrder bo) { // this.byteBuffer.order(bo); // } // // public int position() { // return this.byteBuffer.position(); // } // // public void position(int newPosition) { // this.byteBuffer.position(newPosition); // } // // public static SmartByteBuffer wrap(byte[] array) { // SmartByteBuffer instance = new SmartByteBuffer(); // instance.byteBuffer = ByteBuffer.wrap(array); // return instance; // } // } // Path: src/net/eiveo/original/sections/todo/not_converted_yet/ZAX3.java import java.util.ArrayList; import java.util.List; import net.eiveo.utils.SmartByteArrayOutputStream; import net.eiveo.utils.SmartByteBuffer; package net.eiveo.original.sections.todo.not_converted_yet; public class ZAX3 { private List<IZX3> IZX3 = new ArrayList<>();
public static ZAX3 read(SmartByteBuffer data) throws Exception {
IceReaper/DesktopAdventuresToolkit
src/net/eiveo/original/sections/todo/not_converted_yet/ZAX3.java
// Path: src/net/eiveo/utils/SmartByteArrayOutputStream.java // public class SmartByteArrayOutputStream { // private List<ByteArrayOutputStream> sections = new ArrayList<>(); // private ByteArrayOutputStream section; // // public SmartByteArrayOutputStream() { // this.section = new ByteArrayOutputStream(); // this.sections.add(this.section); // } // // public void sectionStart() { // this.section = new ByteArrayOutputStream(); // this.sections.add(this.section); // } // // public byte[] sectionEnd() { // byte[] result = this.section.toByteArray(); // sections.remove(sections.size() - 1); // this.section = sections.get(sections.size() - 1); // return result; // } // // public byte[] toByteArray() { // return this.section.toByteArray(); // } // // public void write(String string) { // for (byte byteData : string.getBytes()) { // this.section.write(byteData); // } // } // // public void write(byte value) { // this.section.write(value); // } // // public void write(byte[] value) { // for (byte byteData : value) { // this.section.write(byteData); // } // } // // public void write(short value) { // for (byte byteData : new byte[] { // (byte) value, // (byte)(value >> 8) // }) { // this.section.write(byteData); // } // } // // public void write(int value) { // for (byte byteData : new byte[] { // (byte) value, // (byte)(value >> 8), // (byte)(value >> 16), // (byte)(value >> 24) // }) { // this.section.write(byteData); // } // } // } // // Path: src/net/eiveo/utils/SmartByteBuffer.java // public class SmartByteBuffer { // private ByteBuffer byteBuffer; // // public int capacity() { // return this.byteBuffer.capacity(); // } // // public byte get() { // return this.byteBuffer.get(); // } // // public void get(byte[] dst) { // this.byteBuffer.get(dst); // } // // public int getInt() { // return this.byteBuffer.getInt(); // } // // public short getShort() { // return this.byteBuffer.getShort(); // } // // public String getString() { // String string = ""; // // while (true) { // byte character = this.get(); // if ((character & 0xff) == 0) { // break; // } else { // string += new String(new byte[] { character }); // } // } // // return string; // } // // public String getString(int index, int length) { // byte[] output = new byte[length]; // if (index > -1) { // this.position(index); // } // this.byteBuffer.get(output); // return new String(output); // } // // public void order(ByteOrder bo) { // this.byteBuffer.order(bo); // } // // public int position() { // return this.byteBuffer.position(); // } // // public void position(int newPosition) { // this.byteBuffer.position(newPosition); // } // // public static SmartByteBuffer wrap(byte[] array) { // SmartByteBuffer instance = new SmartByteBuffer(); // instance.byteBuffer = ByteBuffer.wrap(array); // return instance; // } // }
import java.util.ArrayList; import java.util.List; import net.eiveo.utils.SmartByteArrayOutputStream; import net.eiveo.utils.SmartByteBuffer;
package net.eiveo.original.sections.todo.not_converted_yet; public class ZAX3 { private List<IZX3> IZX3 = new ArrayList<>(); public static ZAX3 read(SmartByteBuffer data) throws Exception { ZAX3 instance = new ZAX3(); int length = data.getInt(); int lengthStart = data.position(); while (length + lengthStart > data.position()) { String izx3 = data.getString(-1, 4); if (!izx3.equals("IZX3")) { throw new Exception("IZX3 mismatch."); } instance.IZX3.add(net.eiveo.original.sections.todo.not_converted_yet.IZX3.read(data)); } if (lengthStart + length != data.position()) { throw new Exception("Length mismatch."); } return instance; }
// Path: src/net/eiveo/utils/SmartByteArrayOutputStream.java // public class SmartByteArrayOutputStream { // private List<ByteArrayOutputStream> sections = new ArrayList<>(); // private ByteArrayOutputStream section; // // public SmartByteArrayOutputStream() { // this.section = new ByteArrayOutputStream(); // this.sections.add(this.section); // } // // public void sectionStart() { // this.section = new ByteArrayOutputStream(); // this.sections.add(this.section); // } // // public byte[] sectionEnd() { // byte[] result = this.section.toByteArray(); // sections.remove(sections.size() - 1); // this.section = sections.get(sections.size() - 1); // return result; // } // // public byte[] toByteArray() { // return this.section.toByteArray(); // } // // public void write(String string) { // for (byte byteData : string.getBytes()) { // this.section.write(byteData); // } // } // // public void write(byte value) { // this.section.write(value); // } // // public void write(byte[] value) { // for (byte byteData : value) { // this.section.write(byteData); // } // } // // public void write(short value) { // for (byte byteData : new byte[] { // (byte) value, // (byte)(value >> 8) // }) { // this.section.write(byteData); // } // } // // public void write(int value) { // for (byte byteData : new byte[] { // (byte) value, // (byte)(value >> 8), // (byte)(value >> 16), // (byte)(value >> 24) // }) { // this.section.write(byteData); // } // } // } // // Path: src/net/eiveo/utils/SmartByteBuffer.java // public class SmartByteBuffer { // private ByteBuffer byteBuffer; // // public int capacity() { // return this.byteBuffer.capacity(); // } // // public byte get() { // return this.byteBuffer.get(); // } // // public void get(byte[] dst) { // this.byteBuffer.get(dst); // } // // public int getInt() { // return this.byteBuffer.getInt(); // } // // public short getShort() { // return this.byteBuffer.getShort(); // } // // public String getString() { // String string = ""; // // while (true) { // byte character = this.get(); // if ((character & 0xff) == 0) { // break; // } else { // string += new String(new byte[] { character }); // } // } // // return string; // } // // public String getString(int index, int length) { // byte[] output = new byte[length]; // if (index > -1) { // this.position(index); // } // this.byteBuffer.get(output); // return new String(output); // } // // public void order(ByteOrder bo) { // this.byteBuffer.order(bo); // } // // public int position() { // return this.byteBuffer.position(); // } // // public void position(int newPosition) { // this.byteBuffer.position(newPosition); // } // // public static SmartByteBuffer wrap(byte[] array) { // SmartByteBuffer instance = new SmartByteBuffer(); // instance.byteBuffer = ByteBuffer.wrap(array); // return instance; // } // } // Path: src/net/eiveo/original/sections/todo/not_converted_yet/ZAX3.java import java.util.ArrayList; import java.util.List; import net.eiveo.utils.SmartByteArrayOutputStream; import net.eiveo.utils.SmartByteBuffer; package net.eiveo.original.sections.todo.not_converted_yet; public class ZAX3 { private List<IZX3> IZX3 = new ArrayList<>(); public static ZAX3 read(SmartByteBuffer data) throws Exception { ZAX3 instance = new ZAX3(); int length = data.getInt(); int lengthStart = data.position(); while (length + lengthStart > data.position()) { String izx3 = data.getString(-1, 4); if (!izx3.equals("IZX3")) { throw new Exception("IZX3 mismatch."); } instance.IZX3.add(net.eiveo.original.sections.todo.not_converted_yet.IZX3.read(data)); } if (lengthStart + length != data.position()) { throw new Exception("Length mismatch."); } return instance; }
public void write(SmartByteArrayOutputStream outputStream) {
IceReaper/DesktopAdventuresToolkit
src/net/eiveo/original/sections/todo/not_converted_yet/IZX2.java
// Path: src/net/eiveo/utils/SmartByteArrayOutputStream.java // public class SmartByteArrayOutputStream { // private List<ByteArrayOutputStream> sections = new ArrayList<>(); // private ByteArrayOutputStream section; // // public SmartByteArrayOutputStream() { // this.section = new ByteArrayOutputStream(); // this.sections.add(this.section); // } // // public void sectionStart() { // this.section = new ByteArrayOutputStream(); // this.sections.add(this.section); // } // // public byte[] sectionEnd() { // byte[] result = this.section.toByteArray(); // sections.remove(sections.size() - 1); // this.section = sections.get(sections.size() - 1); // return result; // } // // public byte[] toByteArray() { // return this.section.toByteArray(); // } // // public void write(String string) { // for (byte byteData : string.getBytes()) { // this.section.write(byteData); // } // } // // public void write(byte value) { // this.section.write(value); // } // // public void write(byte[] value) { // for (byte byteData : value) { // this.section.write(byteData); // } // } // // public void write(short value) { // for (byte byteData : new byte[] { // (byte) value, // (byte)(value >> 8) // }) { // this.section.write(byteData); // } // } // // public void write(int value) { // for (byte byteData : new byte[] { // (byte) value, // (byte)(value >> 8), // (byte)(value >> 16), // (byte)(value >> 24) // }) { // this.section.write(byteData); // } // } // } // // Path: src/net/eiveo/utils/SmartByteBuffer.java // public class SmartByteBuffer { // private ByteBuffer byteBuffer; // // public int capacity() { // return this.byteBuffer.capacity(); // } // // public byte get() { // return this.byteBuffer.get(); // } // // public void get(byte[] dst) { // this.byteBuffer.get(dst); // } // // public int getInt() { // return this.byteBuffer.getInt(); // } // // public short getShort() { // return this.byteBuffer.getShort(); // } // // public String getString() { // String string = ""; // // while (true) { // byte character = this.get(); // if ((character & 0xff) == 0) { // break; // } else { // string += new String(new byte[] { character }); // } // } // // return string; // } // // public String getString(int index, int length) { // byte[] output = new byte[length]; // if (index > -1) { // this.position(index); // } // this.byteBuffer.get(output); // return new String(output); // } // // public void order(ByteOrder bo) { // this.byteBuffer.order(bo); // } // // public int position() { // return this.byteBuffer.position(); // } // // public void position(int newPosition) { // this.byteBuffer.position(newPosition); // } // // public static SmartByteBuffer wrap(byte[] array) { // SmartByteBuffer instance = new SmartByteBuffer(); // instance.byteBuffer = ByteBuffer.wrap(array); // return instance; // } // }
import java.util.ArrayList; import java.util.List; import net.eiveo.utils.SmartByteArrayOutputStream; import net.eiveo.utils.SmartByteBuffer;
package net.eiveo.original.sections.todo.not_converted_yet; public class IZX2 { private List<Short> tileId = new ArrayList<>();
// Path: src/net/eiveo/utils/SmartByteArrayOutputStream.java // public class SmartByteArrayOutputStream { // private List<ByteArrayOutputStream> sections = new ArrayList<>(); // private ByteArrayOutputStream section; // // public SmartByteArrayOutputStream() { // this.section = new ByteArrayOutputStream(); // this.sections.add(this.section); // } // // public void sectionStart() { // this.section = new ByteArrayOutputStream(); // this.sections.add(this.section); // } // // public byte[] sectionEnd() { // byte[] result = this.section.toByteArray(); // sections.remove(sections.size() - 1); // this.section = sections.get(sections.size() - 1); // return result; // } // // public byte[] toByteArray() { // return this.section.toByteArray(); // } // // public void write(String string) { // for (byte byteData : string.getBytes()) { // this.section.write(byteData); // } // } // // public void write(byte value) { // this.section.write(value); // } // // public void write(byte[] value) { // for (byte byteData : value) { // this.section.write(byteData); // } // } // // public void write(short value) { // for (byte byteData : new byte[] { // (byte) value, // (byte)(value >> 8) // }) { // this.section.write(byteData); // } // } // // public void write(int value) { // for (byte byteData : new byte[] { // (byte) value, // (byte)(value >> 8), // (byte)(value >> 16), // (byte)(value >> 24) // }) { // this.section.write(byteData); // } // } // } // // Path: src/net/eiveo/utils/SmartByteBuffer.java // public class SmartByteBuffer { // private ByteBuffer byteBuffer; // // public int capacity() { // return this.byteBuffer.capacity(); // } // // public byte get() { // return this.byteBuffer.get(); // } // // public void get(byte[] dst) { // this.byteBuffer.get(dst); // } // // public int getInt() { // return this.byteBuffer.getInt(); // } // // public short getShort() { // return this.byteBuffer.getShort(); // } // // public String getString() { // String string = ""; // // while (true) { // byte character = this.get(); // if ((character & 0xff) == 0) { // break; // } else { // string += new String(new byte[] { character }); // } // } // // return string; // } // // public String getString(int index, int length) { // byte[] output = new byte[length]; // if (index > -1) { // this.position(index); // } // this.byteBuffer.get(output); // return new String(output); // } // // public void order(ByteOrder bo) { // this.byteBuffer.order(bo); // } // // public int position() { // return this.byteBuffer.position(); // } // // public void position(int newPosition) { // this.byteBuffer.position(newPosition); // } // // public static SmartByteBuffer wrap(byte[] array) { // SmartByteBuffer instance = new SmartByteBuffer(); // instance.byteBuffer = ByteBuffer.wrap(array); // return instance; // } // } // Path: src/net/eiveo/original/sections/todo/not_converted_yet/IZX2.java import java.util.ArrayList; import java.util.List; import net.eiveo.utils.SmartByteArrayOutputStream; import net.eiveo.utils.SmartByteBuffer; package net.eiveo.original.sections.todo.not_converted_yet; public class IZX2 { private List<Short> tileId = new ArrayList<>();
public static IZX2 read(SmartByteBuffer data) throws Exception {
IceReaper/DesktopAdventuresToolkit
src/net/eiveo/original/sections/todo/not_converted_yet/IZX2.java
// Path: src/net/eiveo/utils/SmartByteArrayOutputStream.java // public class SmartByteArrayOutputStream { // private List<ByteArrayOutputStream> sections = new ArrayList<>(); // private ByteArrayOutputStream section; // // public SmartByteArrayOutputStream() { // this.section = new ByteArrayOutputStream(); // this.sections.add(this.section); // } // // public void sectionStart() { // this.section = new ByteArrayOutputStream(); // this.sections.add(this.section); // } // // public byte[] sectionEnd() { // byte[] result = this.section.toByteArray(); // sections.remove(sections.size() - 1); // this.section = sections.get(sections.size() - 1); // return result; // } // // public byte[] toByteArray() { // return this.section.toByteArray(); // } // // public void write(String string) { // for (byte byteData : string.getBytes()) { // this.section.write(byteData); // } // } // // public void write(byte value) { // this.section.write(value); // } // // public void write(byte[] value) { // for (byte byteData : value) { // this.section.write(byteData); // } // } // // public void write(short value) { // for (byte byteData : new byte[] { // (byte) value, // (byte)(value >> 8) // }) { // this.section.write(byteData); // } // } // // public void write(int value) { // for (byte byteData : new byte[] { // (byte) value, // (byte)(value >> 8), // (byte)(value >> 16), // (byte)(value >> 24) // }) { // this.section.write(byteData); // } // } // } // // Path: src/net/eiveo/utils/SmartByteBuffer.java // public class SmartByteBuffer { // private ByteBuffer byteBuffer; // // public int capacity() { // return this.byteBuffer.capacity(); // } // // public byte get() { // return this.byteBuffer.get(); // } // // public void get(byte[] dst) { // this.byteBuffer.get(dst); // } // // public int getInt() { // return this.byteBuffer.getInt(); // } // // public short getShort() { // return this.byteBuffer.getShort(); // } // // public String getString() { // String string = ""; // // while (true) { // byte character = this.get(); // if ((character & 0xff) == 0) { // break; // } else { // string += new String(new byte[] { character }); // } // } // // return string; // } // // public String getString(int index, int length) { // byte[] output = new byte[length]; // if (index > -1) { // this.position(index); // } // this.byteBuffer.get(output); // return new String(output); // } // // public void order(ByteOrder bo) { // this.byteBuffer.order(bo); // } // // public int position() { // return this.byteBuffer.position(); // } // // public void position(int newPosition) { // this.byteBuffer.position(newPosition); // } // // public static SmartByteBuffer wrap(byte[] array) { // SmartByteBuffer instance = new SmartByteBuffer(); // instance.byteBuffer = ByteBuffer.wrap(array); // return instance; // } // }
import java.util.ArrayList; import java.util.List; import net.eiveo.utils.SmartByteArrayOutputStream; import net.eiveo.utils.SmartByteBuffer;
package net.eiveo.original.sections.todo.not_converted_yet; public class IZX2 { private List<Short> tileId = new ArrayList<>(); public static IZX2 read(SmartByteBuffer data) throws Exception { IZX2 instance = new IZX2(); // Somehow IZX2 includes identifier and the length int into the length. int length = data.getInt() - 8; int lengthStart = data.position(); short amount = data.getShort(); for (int j = 0; j < amount; j++) { instance.tileId.add(data.getShort()); } if (lengthStart + length != data.position()) { throw new Exception("Length mismatch."); } return instance; }
// Path: src/net/eiveo/utils/SmartByteArrayOutputStream.java // public class SmartByteArrayOutputStream { // private List<ByteArrayOutputStream> sections = new ArrayList<>(); // private ByteArrayOutputStream section; // // public SmartByteArrayOutputStream() { // this.section = new ByteArrayOutputStream(); // this.sections.add(this.section); // } // // public void sectionStart() { // this.section = new ByteArrayOutputStream(); // this.sections.add(this.section); // } // // public byte[] sectionEnd() { // byte[] result = this.section.toByteArray(); // sections.remove(sections.size() - 1); // this.section = sections.get(sections.size() - 1); // return result; // } // // public byte[] toByteArray() { // return this.section.toByteArray(); // } // // public void write(String string) { // for (byte byteData : string.getBytes()) { // this.section.write(byteData); // } // } // // public void write(byte value) { // this.section.write(value); // } // // public void write(byte[] value) { // for (byte byteData : value) { // this.section.write(byteData); // } // } // // public void write(short value) { // for (byte byteData : new byte[] { // (byte) value, // (byte)(value >> 8) // }) { // this.section.write(byteData); // } // } // // public void write(int value) { // for (byte byteData : new byte[] { // (byte) value, // (byte)(value >> 8), // (byte)(value >> 16), // (byte)(value >> 24) // }) { // this.section.write(byteData); // } // } // } // // Path: src/net/eiveo/utils/SmartByteBuffer.java // public class SmartByteBuffer { // private ByteBuffer byteBuffer; // // public int capacity() { // return this.byteBuffer.capacity(); // } // // public byte get() { // return this.byteBuffer.get(); // } // // public void get(byte[] dst) { // this.byteBuffer.get(dst); // } // // public int getInt() { // return this.byteBuffer.getInt(); // } // // public short getShort() { // return this.byteBuffer.getShort(); // } // // public String getString() { // String string = ""; // // while (true) { // byte character = this.get(); // if ((character & 0xff) == 0) { // break; // } else { // string += new String(new byte[] { character }); // } // } // // return string; // } // // public String getString(int index, int length) { // byte[] output = new byte[length]; // if (index > -1) { // this.position(index); // } // this.byteBuffer.get(output); // return new String(output); // } // // public void order(ByteOrder bo) { // this.byteBuffer.order(bo); // } // // public int position() { // return this.byteBuffer.position(); // } // // public void position(int newPosition) { // this.byteBuffer.position(newPosition); // } // // public static SmartByteBuffer wrap(byte[] array) { // SmartByteBuffer instance = new SmartByteBuffer(); // instance.byteBuffer = ByteBuffer.wrap(array); // return instance; // } // } // Path: src/net/eiveo/original/sections/todo/not_converted_yet/IZX2.java import java.util.ArrayList; import java.util.List; import net.eiveo.utils.SmartByteArrayOutputStream; import net.eiveo.utils.SmartByteBuffer; package net.eiveo.original.sections.todo.not_converted_yet; public class IZX2 { private List<Short> tileId = new ArrayList<>(); public static IZX2 read(SmartByteBuffer data) throws Exception { IZX2 instance = new IZX2(); // Somehow IZX2 includes identifier and the length int into the length. int length = data.getInt() - 8; int lengthStart = data.position(); short amount = data.getShort(); for (int j = 0; j < amount; j++) { instance.tileId.add(data.getShort()); } if (lengthStart + length != data.position()) { throw new Exception("Length mismatch."); } return instance; }
public void write(SmartByteArrayOutputStream outputStream) {
IceReaper/DesktopAdventuresToolkit
src/net/eiveo/original/sections/todo/determine_values/HTSP.java
// Path: src/net/eiveo/utils/SmartByteArrayOutputStream.java // public class SmartByteArrayOutputStream { // private List<ByteArrayOutputStream> sections = new ArrayList<>(); // private ByteArrayOutputStream section; // // public SmartByteArrayOutputStream() { // this.section = new ByteArrayOutputStream(); // this.sections.add(this.section); // } // // public void sectionStart() { // this.section = new ByteArrayOutputStream(); // this.sections.add(this.section); // } // // public byte[] sectionEnd() { // byte[] result = this.section.toByteArray(); // sections.remove(sections.size() - 1); // this.section = sections.get(sections.size() - 1); // return result; // } // // public byte[] toByteArray() { // return this.section.toByteArray(); // } // // public void write(String string) { // for (byte byteData : string.getBytes()) { // this.section.write(byteData); // } // } // // public void write(byte value) { // this.section.write(value); // } // // public void write(byte[] value) { // for (byte byteData : value) { // this.section.write(byteData); // } // } // // public void write(short value) { // for (byte byteData : new byte[] { // (byte) value, // (byte)(value >> 8) // }) { // this.section.write(byteData); // } // } // // public void write(int value) { // for (byte byteData : new byte[] { // (byte) value, // (byte)(value >> 8), // (byte)(value >> 16), // (byte)(value >> 24) // }) { // this.section.write(byteData); // } // } // } // // Path: src/net/eiveo/utils/SmartByteBuffer.java // public class SmartByteBuffer { // private ByteBuffer byteBuffer; // // public int capacity() { // return this.byteBuffer.capacity(); // } // // public byte get() { // return this.byteBuffer.get(); // } // // public void get(byte[] dst) { // this.byteBuffer.get(dst); // } // // public int getInt() { // return this.byteBuffer.getInt(); // } // // public short getShort() { // return this.byteBuffer.getShort(); // } // // public String getString() { // String string = ""; // // while (true) { // byte character = this.get(); // if ((character & 0xff) == 0) { // break; // } else { // string += new String(new byte[] { character }); // } // } // // return string; // } // // public String getString(int index, int length) { // byte[] output = new byte[length]; // if (index > -1) { // this.position(index); // } // this.byteBuffer.get(output); // return new String(output); // } // // public void order(ByteOrder bo) { // this.byteBuffer.order(bo); // } // // public int position() { // return this.byteBuffer.position(); // } // // public void position(int newPosition) { // this.byteBuffer.position(newPosition); // } // // public static SmartByteBuffer wrap(byte[] array) { // SmartByteBuffer instance = new SmartByteBuffer(); // instance.byteBuffer = ByteBuffer.wrap(array); // return instance; // } // }
import java.util.ArrayList; import java.util.LinkedHashMap; import java.util.List; import java.util.Map; import java.util.Map.Entry; import net.eiveo.utils.SmartByteArrayOutputStream; import net.eiveo.utils.SmartByteBuffer;
package net.eiveo.original.sections.todo.determine_values; public class HTSP { private Map<Short, List<Hotspot>> hotspots = new LinkedHashMap<>();
// Path: src/net/eiveo/utils/SmartByteArrayOutputStream.java // public class SmartByteArrayOutputStream { // private List<ByteArrayOutputStream> sections = new ArrayList<>(); // private ByteArrayOutputStream section; // // public SmartByteArrayOutputStream() { // this.section = new ByteArrayOutputStream(); // this.sections.add(this.section); // } // // public void sectionStart() { // this.section = new ByteArrayOutputStream(); // this.sections.add(this.section); // } // // public byte[] sectionEnd() { // byte[] result = this.section.toByteArray(); // sections.remove(sections.size() - 1); // this.section = sections.get(sections.size() - 1); // return result; // } // // public byte[] toByteArray() { // return this.section.toByteArray(); // } // // public void write(String string) { // for (byte byteData : string.getBytes()) { // this.section.write(byteData); // } // } // // public void write(byte value) { // this.section.write(value); // } // // public void write(byte[] value) { // for (byte byteData : value) { // this.section.write(byteData); // } // } // // public void write(short value) { // for (byte byteData : new byte[] { // (byte) value, // (byte)(value >> 8) // }) { // this.section.write(byteData); // } // } // // public void write(int value) { // for (byte byteData : new byte[] { // (byte) value, // (byte)(value >> 8), // (byte)(value >> 16), // (byte)(value >> 24) // }) { // this.section.write(byteData); // } // } // } // // Path: src/net/eiveo/utils/SmartByteBuffer.java // public class SmartByteBuffer { // private ByteBuffer byteBuffer; // // public int capacity() { // return this.byteBuffer.capacity(); // } // // public byte get() { // return this.byteBuffer.get(); // } // // public void get(byte[] dst) { // this.byteBuffer.get(dst); // } // // public int getInt() { // return this.byteBuffer.getInt(); // } // // public short getShort() { // return this.byteBuffer.getShort(); // } // // public String getString() { // String string = ""; // // while (true) { // byte character = this.get(); // if ((character & 0xff) == 0) { // break; // } else { // string += new String(new byte[] { character }); // } // } // // return string; // } // // public String getString(int index, int length) { // byte[] output = new byte[length]; // if (index > -1) { // this.position(index); // } // this.byteBuffer.get(output); // return new String(output); // } // // public void order(ByteOrder bo) { // this.byteBuffer.order(bo); // } // // public int position() { // return this.byteBuffer.position(); // } // // public void position(int newPosition) { // this.byteBuffer.position(newPosition); // } // // public static SmartByteBuffer wrap(byte[] array) { // SmartByteBuffer instance = new SmartByteBuffer(); // instance.byteBuffer = ByteBuffer.wrap(array); // return instance; // } // } // Path: src/net/eiveo/original/sections/todo/determine_values/HTSP.java import java.util.ArrayList; import java.util.LinkedHashMap; import java.util.List; import java.util.Map; import java.util.Map.Entry; import net.eiveo.utils.SmartByteArrayOutputStream; import net.eiveo.utils.SmartByteBuffer; package net.eiveo.original.sections.todo.determine_values; public class HTSP { private Map<Short, List<Hotspot>> hotspots = new LinkedHashMap<>();
public static HTSP read(SmartByteBuffer data) throws Exception {
IceReaper/DesktopAdventuresToolkit
src/net/eiveo/original/sections/todo/determine_values/HTSP.java
// Path: src/net/eiveo/utils/SmartByteArrayOutputStream.java // public class SmartByteArrayOutputStream { // private List<ByteArrayOutputStream> sections = new ArrayList<>(); // private ByteArrayOutputStream section; // // public SmartByteArrayOutputStream() { // this.section = new ByteArrayOutputStream(); // this.sections.add(this.section); // } // // public void sectionStart() { // this.section = new ByteArrayOutputStream(); // this.sections.add(this.section); // } // // public byte[] sectionEnd() { // byte[] result = this.section.toByteArray(); // sections.remove(sections.size() - 1); // this.section = sections.get(sections.size() - 1); // return result; // } // // public byte[] toByteArray() { // return this.section.toByteArray(); // } // // public void write(String string) { // for (byte byteData : string.getBytes()) { // this.section.write(byteData); // } // } // // public void write(byte value) { // this.section.write(value); // } // // public void write(byte[] value) { // for (byte byteData : value) { // this.section.write(byteData); // } // } // // public void write(short value) { // for (byte byteData : new byte[] { // (byte) value, // (byte)(value >> 8) // }) { // this.section.write(byteData); // } // } // // public void write(int value) { // for (byte byteData : new byte[] { // (byte) value, // (byte)(value >> 8), // (byte)(value >> 16), // (byte)(value >> 24) // }) { // this.section.write(byteData); // } // } // } // // Path: src/net/eiveo/utils/SmartByteBuffer.java // public class SmartByteBuffer { // private ByteBuffer byteBuffer; // // public int capacity() { // return this.byteBuffer.capacity(); // } // // public byte get() { // return this.byteBuffer.get(); // } // // public void get(byte[] dst) { // this.byteBuffer.get(dst); // } // // public int getInt() { // return this.byteBuffer.getInt(); // } // // public short getShort() { // return this.byteBuffer.getShort(); // } // // public String getString() { // String string = ""; // // while (true) { // byte character = this.get(); // if ((character & 0xff) == 0) { // break; // } else { // string += new String(new byte[] { character }); // } // } // // return string; // } // // public String getString(int index, int length) { // byte[] output = new byte[length]; // if (index > -1) { // this.position(index); // } // this.byteBuffer.get(output); // return new String(output); // } // // public void order(ByteOrder bo) { // this.byteBuffer.order(bo); // } // // public int position() { // return this.byteBuffer.position(); // } // // public void position(int newPosition) { // this.byteBuffer.position(newPosition); // } // // public static SmartByteBuffer wrap(byte[] array) { // SmartByteBuffer instance = new SmartByteBuffer(); // instance.byteBuffer = ByteBuffer.wrap(array); // return instance; // } // }
import java.util.ArrayList; import java.util.LinkedHashMap; import java.util.List; import java.util.Map; import java.util.Map.Entry; import net.eiveo.utils.SmartByteArrayOutputStream; import net.eiveo.utils.SmartByteBuffer;
package net.eiveo.original.sections.todo.determine_values; public class HTSP { private Map<Short, List<Hotspot>> hotspots = new LinkedHashMap<>(); public static HTSP read(SmartByteBuffer data) throws Exception { HTSP instance = new HTSP(); int length = data.getInt(); int lengthStart = data.position(); while (true) { short zoneId = data.getShort(); if (zoneId == -1) { break; } short amount = data.getShort(); List<Hotspot> hotspots = new ArrayList<>(); instance.hotspots.put(zoneId, hotspots); for (int i = 0; i < amount; i++) { hotspots.add(Hotspot.read(data)); } } if (lengthStart + length != data.position()) { throw new Exception("Length mismatch."); } return instance; }
// Path: src/net/eiveo/utils/SmartByteArrayOutputStream.java // public class SmartByteArrayOutputStream { // private List<ByteArrayOutputStream> sections = new ArrayList<>(); // private ByteArrayOutputStream section; // // public SmartByteArrayOutputStream() { // this.section = new ByteArrayOutputStream(); // this.sections.add(this.section); // } // // public void sectionStart() { // this.section = new ByteArrayOutputStream(); // this.sections.add(this.section); // } // // public byte[] sectionEnd() { // byte[] result = this.section.toByteArray(); // sections.remove(sections.size() - 1); // this.section = sections.get(sections.size() - 1); // return result; // } // // public byte[] toByteArray() { // return this.section.toByteArray(); // } // // public void write(String string) { // for (byte byteData : string.getBytes()) { // this.section.write(byteData); // } // } // // public void write(byte value) { // this.section.write(value); // } // // public void write(byte[] value) { // for (byte byteData : value) { // this.section.write(byteData); // } // } // // public void write(short value) { // for (byte byteData : new byte[] { // (byte) value, // (byte)(value >> 8) // }) { // this.section.write(byteData); // } // } // // public void write(int value) { // for (byte byteData : new byte[] { // (byte) value, // (byte)(value >> 8), // (byte)(value >> 16), // (byte)(value >> 24) // }) { // this.section.write(byteData); // } // } // } // // Path: src/net/eiveo/utils/SmartByteBuffer.java // public class SmartByteBuffer { // private ByteBuffer byteBuffer; // // public int capacity() { // return this.byteBuffer.capacity(); // } // // public byte get() { // return this.byteBuffer.get(); // } // // public void get(byte[] dst) { // this.byteBuffer.get(dst); // } // // public int getInt() { // return this.byteBuffer.getInt(); // } // // public short getShort() { // return this.byteBuffer.getShort(); // } // // public String getString() { // String string = ""; // // while (true) { // byte character = this.get(); // if ((character & 0xff) == 0) { // break; // } else { // string += new String(new byte[] { character }); // } // } // // return string; // } // // public String getString(int index, int length) { // byte[] output = new byte[length]; // if (index > -1) { // this.position(index); // } // this.byteBuffer.get(output); // return new String(output); // } // // public void order(ByteOrder bo) { // this.byteBuffer.order(bo); // } // // public int position() { // return this.byteBuffer.position(); // } // // public void position(int newPosition) { // this.byteBuffer.position(newPosition); // } // // public static SmartByteBuffer wrap(byte[] array) { // SmartByteBuffer instance = new SmartByteBuffer(); // instance.byteBuffer = ByteBuffer.wrap(array); // return instance; // } // } // Path: src/net/eiveo/original/sections/todo/determine_values/HTSP.java import java.util.ArrayList; import java.util.LinkedHashMap; import java.util.List; import java.util.Map; import java.util.Map.Entry; import net.eiveo.utils.SmartByteArrayOutputStream; import net.eiveo.utils.SmartByteBuffer; package net.eiveo.original.sections.todo.determine_values; public class HTSP { private Map<Short, List<Hotspot>> hotspots = new LinkedHashMap<>(); public static HTSP read(SmartByteBuffer data) throws Exception { HTSP instance = new HTSP(); int length = data.getInt(); int lengthStart = data.position(); while (true) { short zoneId = data.getShort(); if (zoneId == -1) { break; } short amount = data.getShort(); List<Hotspot> hotspots = new ArrayList<>(); instance.hotspots.put(zoneId, hotspots); for (int i = 0; i < amount; i++) { hotspots.add(Hotspot.read(data)); } } if (lengthStart + length != data.position()) { throw new Exception("Length mismatch."); } return instance; }
public void write(SmartByteArrayOutputStream outputStream) {
IceReaper/DesktopAdventuresToolkit
src/net/eiveo/original/Game.java
// Path: src/net/eiveo/utils/SmartByteBuffer.java // public class SmartByteBuffer { // private ByteBuffer byteBuffer; // // public int capacity() { // return this.byteBuffer.capacity(); // } // // public byte get() { // return this.byteBuffer.get(); // } // // public void get(byte[] dst) { // this.byteBuffer.get(dst); // } // // public int getInt() { // return this.byteBuffer.getInt(); // } // // public short getShort() { // return this.byteBuffer.getShort(); // } // // public String getString() { // String string = ""; // // while (true) { // byte character = this.get(); // if ((character & 0xff) == 0) { // break; // } else { // string += new String(new byte[] { character }); // } // } // // return string; // } // // public String getString(int index, int length) { // byte[] output = new byte[length]; // if (index > -1) { // this.position(index); // } // this.byteBuffer.get(output); // return new String(output); // } // // public void order(ByteOrder bo) { // this.byteBuffer.order(bo); // } // // public int position() { // return this.byteBuffer.position(); // } // // public void position(int newPosition) { // this.byteBuffer.position(newPosition); // } // // public static SmartByteBuffer wrap(byte[] array) { // SmartByteBuffer instance = new SmartByteBuffer(); // instance.byteBuffer = ByteBuffer.wrap(array); // return instance; // } // }
import java.io.File; import java.nio.ByteOrder; import java.nio.file.Files; import net.eiveo.utils.SmartByteBuffer;
package net.eiveo.original; public class Game { private static final int YODA_PALETTE_OFFSET = 0x550F0; private static final int INDY_PALETTE_OFFSET = 0x36656; public boolean isYoda; public byte[] palette = new byte[256 * 4]; public Container container; public static Game read(File container, File executable) throws Exception { Game instance = new Game();
// Path: src/net/eiveo/utils/SmartByteBuffer.java // public class SmartByteBuffer { // private ByteBuffer byteBuffer; // // public int capacity() { // return this.byteBuffer.capacity(); // } // // public byte get() { // return this.byteBuffer.get(); // } // // public void get(byte[] dst) { // this.byteBuffer.get(dst); // } // // public int getInt() { // return this.byteBuffer.getInt(); // } // // public short getShort() { // return this.byteBuffer.getShort(); // } // // public String getString() { // String string = ""; // // while (true) { // byte character = this.get(); // if ((character & 0xff) == 0) { // break; // } else { // string += new String(new byte[] { character }); // } // } // // return string; // } // // public String getString(int index, int length) { // byte[] output = new byte[length]; // if (index > -1) { // this.position(index); // } // this.byteBuffer.get(output); // return new String(output); // } // // public void order(ByteOrder bo) { // this.byteBuffer.order(bo); // } // // public int position() { // return this.byteBuffer.position(); // } // // public void position(int newPosition) { // this.byteBuffer.position(newPosition); // } // // public static SmartByteBuffer wrap(byte[] array) { // SmartByteBuffer instance = new SmartByteBuffer(); // instance.byteBuffer = ByteBuffer.wrap(array); // return instance; // } // } // Path: src/net/eiveo/original/Game.java import java.io.File; import java.nio.ByteOrder; import java.nio.file.Files; import net.eiveo.utils.SmartByteBuffer; package net.eiveo.original; public class Game { private static final int YODA_PALETTE_OFFSET = 0x550F0; private static final int INDY_PALETTE_OFFSET = 0x36656; public boolean isYoda; public byte[] palette = new byte[256 * 4]; public Container container; public static Game read(File container, File executable) throws Exception { Game instance = new Game();
SmartByteBuffer executableBuffer = SmartByteBuffer.wrap(Files.readAllBytes(executable.toPath()));
IceReaper/DesktopAdventuresToolkit
src/net/eiveo/original/sections/todo/not_converted_yet/CHAR.java
// Path: src/net/eiveo/utils/SmartByteArrayOutputStream.java // public class SmartByteArrayOutputStream { // private List<ByteArrayOutputStream> sections = new ArrayList<>(); // private ByteArrayOutputStream section; // // public SmartByteArrayOutputStream() { // this.section = new ByteArrayOutputStream(); // this.sections.add(this.section); // } // // public void sectionStart() { // this.section = new ByteArrayOutputStream(); // this.sections.add(this.section); // } // // public byte[] sectionEnd() { // byte[] result = this.section.toByteArray(); // sections.remove(sections.size() - 1); // this.section = sections.get(sections.size() - 1); // return result; // } // // public byte[] toByteArray() { // return this.section.toByteArray(); // } // // public void write(String string) { // for (byte byteData : string.getBytes()) { // this.section.write(byteData); // } // } // // public void write(byte value) { // this.section.write(value); // } // // public void write(byte[] value) { // for (byte byteData : value) { // this.section.write(byteData); // } // } // // public void write(short value) { // for (byte byteData : new byte[] { // (byte) value, // (byte)(value >> 8) // }) { // this.section.write(byteData); // } // } // // public void write(int value) { // for (byte byteData : new byte[] { // (byte) value, // (byte)(value >> 8), // (byte)(value >> 16), // (byte)(value >> 24) // }) { // this.section.write(byteData); // } // } // } // // Path: src/net/eiveo/utils/SmartByteBuffer.java // public class SmartByteBuffer { // private ByteBuffer byteBuffer; // // public int capacity() { // return this.byteBuffer.capacity(); // } // // public byte get() { // return this.byteBuffer.get(); // } // // public void get(byte[] dst) { // this.byteBuffer.get(dst); // } // // public int getInt() { // return this.byteBuffer.getInt(); // } // // public short getShort() { // return this.byteBuffer.getShort(); // } // // public String getString() { // String string = ""; // // while (true) { // byte character = this.get(); // if ((character & 0xff) == 0) { // break; // } else { // string += new String(new byte[] { character }); // } // } // // return string; // } // // public String getString(int index, int length) { // byte[] output = new byte[length]; // if (index > -1) { // this.position(index); // } // this.byteBuffer.get(output); // return new String(output); // } // // public void order(ByteOrder bo) { // this.byteBuffer.order(bo); // } // // public int position() { // return this.byteBuffer.position(); // } // // public void position(int newPosition) { // this.byteBuffer.position(newPosition); // } // // public static SmartByteBuffer wrap(byte[] array) { // SmartByteBuffer instance = new SmartByteBuffer(); // instance.byteBuffer = ByteBuffer.wrap(array); // return instance; // } // }
import java.util.ArrayList; import java.util.List; import net.eiveo.utils.SmartByteArrayOutputStream; import net.eiveo.utils.SmartByteBuffer;
package net.eiveo.original.sections.todo.not_converted_yet; public class CHAR { private List<ICHA> ICHA = new ArrayList<>();
// Path: src/net/eiveo/utils/SmartByteArrayOutputStream.java // public class SmartByteArrayOutputStream { // private List<ByteArrayOutputStream> sections = new ArrayList<>(); // private ByteArrayOutputStream section; // // public SmartByteArrayOutputStream() { // this.section = new ByteArrayOutputStream(); // this.sections.add(this.section); // } // // public void sectionStart() { // this.section = new ByteArrayOutputStream(); // this.sections.add(this.section); // } // // public byte[] sectionEnd() { // byte[] result = this.section.toByteArray(); // sections.remove(sections.size() - 1); // this.section = sections.get(sections.size() - 1); // return result; // } // // public byte[] toByteArray() { // return this.section.toByteArray(); // } // // public void write(String string) { // for (byte byteData : string.getBytes()) { // this.section.write(byteData); // } // } // // public void write(byte value) { // this.section.write(value); // } // // public void write(byte[] value) { // for (byte byteData : value) { // this.section.write(byteData); // } // } // // public void write(short value) { // for (byte byteData : new byte[] { // (byte) value, // (byte)(value >> 8) // }) { // this.section.write(byteData); // } // } // // public void write(int value) { // for (byte byteData : new byte[] { // (byte) value, // (byte)(value >> 8), // (byte)(value >> 16), // (byte)(value >> 24) // }) { // this.section.write(byteData); // } // } // } // // Path: src/net/eiveo/utils/SmartByteBuffer.java // public class SmartByteBuffer { // private ByteBuffer byteBuffer; // // public int capacity() { // return this.byteBuffer.capacity(); // } // // public byte get() { // return this.byteBuffer.get(); // } // // public void get(byte[] dst) { // this.byteBuffer.get(dst); // } // // public int getInt() { // return this.byteBuffer.getInt(); // } // // public short getShort() { // return this.byteBuffer.getShort(); // } // // public String getString() { // String string = ""; // // while (true) { // byte character = this.get(); // if ((character & 0xff) == 0) { // break; // } else { // string += new String(new byte[] { character }); // } // } // // return string; // } // // public String getString(int index, int length) { // byte[] output = new byte[length]; // if (index > -1) { // this.position(index); // } // this.byteBuffer.get(output); // return new String(output); // } // // public void order(ByteOrder bo) { // this.byteBuffer.order(bo); // } // // public int position() { // return this.byteBuffer.position(); // } // // public void position(int newPosition) { // this.byteBuffer.position(newPosition); // } // // public static SmartByteBuffer wrap(byte[] array) { // SmartByteBuffer instance = new SmartByteBuffer(); // instance.byteBuffer = ByteBuffer.wrap(array); // return instance; // } // } // Path: src/net/eiveo/original/sections/todo/not_converted_yet/CHAR.java import java.util.ArrayList; import java.util.List; import net.eiveo.utils.SmartByteArrayOutputStream; import net.eiveo.utils.SmartByteBuffer; package net.eiveo.original.sections.todo.not_converted_yet; public class CHAR { private List<ICHA> ICHA = new ArrayList<>();
public static CHAR read(SmartByteBuffer data, boolean isYoda) throws Exception {
IceReaper/DesktopAdventuresToolkit
src/net/eiveo/original/sections/todo/not_converted_yet/CHAR.java
// Path: src/net/eiveo/utils/SmartByteArrayOutputStream.java // public class SmartByteArrayOutputStream { // private List<ByteArrayOutputStream> sections = new ArrayList<>(); // private ByteArrayOutputStream section; // // public SmartByteArrayOutputStream() { // this.section = new ByteArrayOutputStream(); // this.sections.add(this.section); // } // // public void sectionStart() { // this.section = new ByteArrayOutputStream(); // this.sections.add(this.section); // } // // public byte[] sectionEnd() { // byte[] result = this.section.toByteArray(); // sections.remove(sections.size() - 1); // this.section = sections.get(sections.size() - 1); // return result; // } // // public byte[] toByteArray() { // return this.section.toByteArray(); // } // // public void write(String string) { // for (byte byteData : string.getBytes()) { // this.section.write(byteData); // } // } // // public void write(byte value) { // this.section.write(value); // } // // public void write(byte[] value) { // for (byte byteData : value) { // this.section.write(byteData); // } // } // // public void write(short value) { // for (byte byteData : new byte[] { // (byte) value, // (byte)(value >> 8) // }) { // this.section.write(byteData); // } // } // // public void write(int value) { // for (byte byteData : new byte[] { // (byte) value, // (byte)(value >> 8), // (byte)(value >> 16), // (byte)(value >> 24) // }) { // this.section.write(byteData); // } // } // } // // Path: src/net/eiveo/utils/SmartByteBuffer.java // public class SmartByteBuffer { // private ByteBuffer byteBuffer; // // public int capacity() { // return this.byteBuffer.capacity(); // } // // public byte get() { // return this.byteBuffer.get(); // } // // public void get(byte[] dst) { // this.byteBuffer.get(dst); // } // // public int getInt() { // return this.byteBuffer.getInt(); // } // // public short getShort() { // return this.byteBuffer.getShort(); // } // // public String getString() { // String string = ""; // // while (true) { // byte character = this.get(); // if ((character & 0xff) == 0) { // break; // } else { // string += new String(new byte[] { character }); // } // } // // return string; // } // // public String getString(int index, int length) { // byte[] output = new byte[length]; // if (index > -1) { // this.position(index); // } // this.byteBuffer.get(output); // return new String(output); // } // // public void order(ByteOrder bo) { // this.byteBuffer.order(bo); // } // // public int position() { // return this.byteBuffer.position(); // } // // public void position(int newPosition) { // this.byteBuffer.position(newPosition); // } // // public static SmartByteBuffer wrap(byte[] array) { // SmartByteBuffer instance = new SmartByteBuffer(); // instance.byteBuffer = ByteBuffer.wrap(array); // return instance; // } // }
import java.util.ArrayList; import java.util.List; import net.eiveo.utils.SmartByteArrayOutputStream; import net.eiveo.utils.SmartByteBuffer;
package net.eiveo.original.sections.todo.not_converted_yet; public class CHAR { private List<ICHA> ICHA = new ArrayList<>(); public static CHAR read(SmartByteBuffer data, boolean isYoda) throws Exception { CHAR instance = new CHAR(); int length = data.getInt(); int lengthStart = data.position(); while (true) { short characterId = data.getShort(); if (characterId == -1) { break; } String icha = data.getString(-1, 4); if (!icha.equals("ICHA")) { throw new Exception("ICHA mismatch."); } instance.ICHA.add(net.eiveo.original.sections.todo.not_converted_yet.ICHA.read(data, isYoda)); } if (lengthStart + length != data.position()) { throw new Exception("Length mismatch."); } return instance; }
// Path: src/net/eiveo/utils/SmartByteArrayOutputStream.java // public class SmartByteArrayOutputStream { // private List<ByteArrayOutputStream> sections = new ArrayList<>(); // private ByteArrayOutputStream section; // // public SmartByteArrayOutputStream() { // this.section = new ByteArrayOutputStream(); // this.sections.add(this.section); // } // // public void sectionStart() { // this.section = new ByteArrayOutputStream(); // this.sections.add(this.section); // } // // public byte[] sectionEnd() { // byte[] result = this.section.toByteArray(); // sections.remove(sections.size() - 1); // this.section = sections.get(sections.size() - 1); // return result; // } // // public byte[] toByteArray() { // return this.section.toByteArray(); // } // // public void write(String string) { // for (byte byteData : string.getBytes()) { // this.section.write(byteData); // } // } // // public void write(byte value) { // this.section.write(value); // } // // public void write(byte[] value) { // for (byte byteData : value) { // this.section.write(byteData); // } // } // // public void write(short value) { // for (byte byteData : new byte[] { // (byte) value, // (byte)(value >> 8) // }) { // this.section.write(byteData); // } // } // // public void write(int value) { // for (byte byteData : new byte[] { // (byte) value, // (byte)(value >> 8), // (byte)(value >> 16), // (byte)(value >> 24) // }) { // this.section.write(byteData); // } // } // } // // Path: src/net/eiveo/utils/SmartByteBuffer.java // public class SmartByteBuffer { // private ByteBuffer byteBuffer; // // public int capacity() { // return this.byteBuffer.capacity(); // } // // public byte get() { // return this.byteBuffer.get(); // } // // public void get(byte[] dst) { // this.byteBuffer.get(dst); // } // // public int getInt() { // return this.byteBuffer.getInt(); // } // // public short getShort() { // return this.byteBuffer.getShort(); // } // // public String getString() { // String string = ""; // // while (true) { // byte character = this.get(); // if ((character & 0xff) == 0) { // break; // } else { // string += new String(new byte[] { character }); // } // } // // return string; // } // // public String getString(int index, int length) { // byte[] output = new byte[length]; // if (index > -1) { // this.position(index); // } // this.byteBuffer.get(output); // return new String(output); // } // // public void order(ByteOrder bo) { // this.byteBuffer.order(bo); // } // // public int position() { // return this.byteBuffer.position(); // } // // public void position(int newPosition) { // this.byteBuffer.position(newPosition); // } // // public static SmartByteBuffer wrap(byte[] array) { // SmartByteBuffer instance = new SmartByteBuffer(); // instance.byteBuffer = ByteBuffer.wrap(array); // return instance; // } // } // Path: src/net/eiveo/original/sections/todo/not_converted_yet/CHAR.java import java.util.ArrayList; import java.util.List; import net.eiveo.utils.SmartByteArrayOutputStream; import net.eiveo.utils.SmartByteBuffer; package net.eiveo.original.sections.todo.not_converted_yet; public class CHAR { private List<ICHA> ICHA = new ArrayList<>(); public static CHAR read(SmartByteBuffer data, boolean isYoda) throws Exception { CHAR instance = new CHAR(); int length = data.getInt(); int lengthStart = data.position(); while (true) { short characterId = data.getShort(); if (characterId == -1) { break; } String icha = data.getString(-1, 4); if (!icha.equals("ICHA")) { throw new Exception("ICHA mismatch."); } instance.ICHA.add(net.eiveo.original.sections.todo.not_converted_yet.ICHA.read(data, isYoda)); } if (lengthStart + length != data.position()) { throw new Exception("Length mismatch."); } return instance; }
public void write(SmartByteArrayOutputStream outputStream, boolean isYoda) throws Exception {
IceReaper/DesktopAdventuresToolkit
src/net/eiveo/original/sections/todo/determine_values/IPUZ.java
// Path: src/net/eiveo/utils/SmartByteArrayOutputStream.java // public class SmartByteArrayOutputStream { // private List<ByteArrayOutputStream> sections = new ArrayList<>(); // private ByteArrayOutputStream section; // // public SmartByteArrayOutputStream() { // this.section = new ByteArrayOutputStream(); // this.sections.add(this.section); // } // // public void sectionStart() { // this.section = new ByteArrayOutputStream(); // this.sections.add(this.section); // } // // public byte[] sectionEnd() { // byte[] result = this.section.toByteArray(); // sections.remove(sections.size() - 1); // this.section = sections.get(sections.size() - 1); // return result; // } // // public byte[] toByteArray() { // return this.section.toByteArray(); // } // // public void write(String string) { // for (byte byteData : string.getBytes()) { // this.section.write(byteData); // } // } // // public void write(byte value) { // this.section.write(value); // } // // public void write(byte[] value) { // for (byte byteData : value) { // this.section.write(byteData); // } // } // // public void write(short value) { // for (byte byteData : new byte[] { // (byte) value, // (byte)(value >> 8) // }) { // this.section.write(byteData); // } // } // // public void write(int value) { // for (byte byteData : new byte[] { // (byte) value, // (byte)(value >> 8), // (byte)(value >> 16), // (byte)(value >> 24) // }) { // this.section.write(byteData); // } // } // } // // Path: src/net/eiveo/utils/SmartByteBuffer.java // public class SmartByteBuffer { // private ByteBuffer byteBuffer; // // public int capacity() { // return this.byteBuffer.capacity(); // } // // public byte get() { // return this.byteBuffer.get(); // } // // public void get(byte[] dst) { // this.byteBuffer.get(dst); // } // // public int getInt() { // return this.byteBuffer.getInt(); // } // // public short getShort() { // return this.byteBuffer.getShort(); // } // // public String getString() { // String string = ""; // // while (true) { // byte character = this.get(); // if ((character & 0xff) == 0) { // break; // } else { // string += new String(new byte[] { character }); // } // } // // return string; // } // // public String getString(int index, int length) { // byte[] output = new byte[length]; // if (index > -1) { // this.position(index); // } // this.byteBuffer.get(output); // return new String(output); // } // // public void order(ByteOrder bo) { // this.byteBuffer.order(bo); // } // // public int position() { // return this.byteBuffer.position(); // } // // public void position(int newPosition) { // this.byteBuffer.position(newPosition); // } // // public static SmartByteBuffer wrap(byte[] array) { // SmartByteBuffer instance = new SmartByteBuffer(); // instance.byteBuffer = ByteBuffer.wrap(array); // return instance; // } // }
import net.eiveo.utils.SmartByteArrayOutputStream; import net.eiveo.utils.SmartByteBuffer;
package net.eiveo.original.sections.todo.determine_values; public class IPUZ { private short type; private short unk1; private short unk2; private short unk3; private short unk4; private short unk5; private String[] texts = new String[4]; private short tileId; private short unk6;
// Path: src/net/eiveo/utils/SmartByteArrayOutputStream.java // public class SmartByteArrayOutputStream { // private List<ByteArrayOutputStream> sections = new ArrayList<>(); // private ByteArrayOutputStream section; // // public SmartByteArrayOutputStream() { // this.section = new ByteArrayOutputStream(); // this.sections.add(this.section); // } // // public void sectionStart() { // this.section = new ByteArrayOutputStream(); // this.sections.add(this.section); // } // // public byte[] sectionEnd() { // byte[] result = this.section.toByteArray(); // sections.remove(sections.size() - 1); // this.section = sections.get(sections.size() - 1); // return result; // } // // public byte[] toByteArray() { // return this.section.toByteArray(); // } // // public void write(String string) { // for (byte byteData : string.getBytes()) { // this.section.write(byteData); // } // } // // public void write(byte value) { // this.section.write(value); // } // // public void write(byte[] value) { // for (byte byteData : value) { // this.section.write(byteData); // } // } // // public void write(short value) { // for (byte byteData : new byte[] { // (byte) value, // (byte)(value >> 8) // }) { // this.section.write(byteData); // } // } // // public void write(int value) { // for (byte byteData : new byte[] { // (byte) value, // (byte)(value >> 8), // (byte)(value >> 16), // (byte)(value >> 24) // }) { // this.section.write(byteData); // } // } // } // // Path: src/net/eiveo/utils/SmartByteBuffer.java // public class SmartByteBuffer { // private ByteBuffer byteBuffer; // // public int capacity() { // return this.byteBuffer.capacity(); // } // // public byte get() { // return this.byteBuffer.get(); // } // // public void get(byte[] dst) { // this.byteBuffer.get(dst); // } // // public int getInt() { // return this.byteBuffer.getInt(); // } // // public short getShort() { // return this.byteBuffer.getShort(); // } // // public String getString() { // String string = ""; // // while (true) { // byte character = this.get(); // if ((character & 0xff) == 0) { // break; // } else { // string += new String(new byte[] { character }); // } // } // // return string; // } // // public String getString(int index, int length) { // byte[] output = new byte[length]; // if (index > -1) { // this.position(index); // } // this.byteBuffer.get(output); // return new String(output); // } // // public void order(ByteOrder bo) { // this.byteBuffer.order(bo); // } // // public int position() { // return this.byteBuffer.position(); // } // // public void position(int newPosition) { // this.byteBuffer.position(newPosition); // } // // public static SmartByteBuffer wrap(byte[] array) { // SmartByteBuffer instance = new SmartByteBuffer(); // instance.byteBuffer = ByteBuffer.wrap(array); // return instance; // } // } // Path: src/net/eiveo/original/sections/todo/determine_values/IPUZ.java import net.eiveo.utils.SmartByteArrayOutputStream; import net.eiveo.utils.SmartByteBuffer; package net.eiveo.original.sections.todo.determine_values; public class IPUZ { private short type; private short unk1; private short unk2; private short unk3; private short unk4; private short unk5; private String[] texts = new String[4]; private short tileId; private short unk6;
public static IPUZ read(SmartByteBuffer data, boolean isYoda) throws Exception {
IceReaper/DesktopAdventuresToolkit
src/net/eiveo/original/sections/todo/determine_values/IPUZ.java
// Path: src/net/eiveo/utils/SmartByteArrayOutputStream.java // public class SmartByteArrayOutputStream { // private List<ByteArrayOutputStream> sections = new ArrayList<>(); // private ByteArrayOutputStream section; // // public SmartByteArrayOutputStream() { // this.section = new ByteArrayOutputStream(); // this.sections.add(this.section); // } // // public void sectionStart() { // this.section = new ByteArrayOutputStream(); // this.sections.add(this.section); // } // // public byte[] sectionEnd() { // byte[] result = this.section.toByteArray(); // sections.remove(sections.size() - 1); // this.section = sections.get(sections.size() - 1); // return result; // } // // public byte[] toByteArray() { // return this.section.toByteArray(); // } // // public void write(String string) { // for (byte byteData : string.getBytes()) { // this.section.write(byteData); // } // } // // public void write(byte value) { // this.section.write(value); // } // // public void write(byte[] value) { // for (byte byteData : value) { // this.section.write(byteData); // } // } // // public void write(short value) { // for (byte byteData : new byte[] { // (byte) value, // (byte)(value >> 8) // }) { // this.section.write(byteData); // } // } // // public void write(int value) { // for (byte byteData : new byte[] { // (byte) value, // (byte)(value >> 8), // (byte)(value >> 16), // (byte)(value >> 24) // }) { // this.section.write(byteData); // } // } // } // // Path: src/net/eiveo/utils/SmartByteBuffer.java // public class SmartByteBuffer { // private ByteBuffer byteBuffer; // // public int capacity() { // return this.byteBuffer.capacity(); // } // // public byte get() { // return this.byteBuffer.get(); // } // // public void get(byte[] dst) { // this.byteBuffer.get(dst); // } // // public int getInt() { // return this.byteBuffer.getInt(); // } // // public short getShort() { // return this.byteBuffer.getShort(); // } // // public String getString() { // String string = ""; // // while (true) { // byte character = this.get(); // if ((character & 0xff) == 0) { // break; // } else { // string += new String(new byte[] { character }); // } // } // // return string; // } // // public String getString(int index, int length) { // byte[] output = new byte[length]; // if (index > -1) { // this.position(index); // } // this.byteBuffer.get(output); // return new String(output); // } // // public void order(ByteOrder bo) { // this.byteBuffer.order(bo); // } // // public int position() { // return this.byteBuffer.position(); // } // // public void position(int newPosition) { // this.byteBuffer.position(newPosition); // } // // public static SmartByteBuffer wrap(byte[] array) { // SmartByteBuffer instance = new SmartByteBuffer(); // instance.byteBuffer = ByteBuffer.wrap(array); // return instance; // } // }
import net.eiveo.utils.SmartByteArrayOutputStream; import net.eiveo.utils.SmartByteBuffer;
instance.unk2 = data.getShort(); // TODO what is this? type? data.getShort(); // 0 if (isYoda) { instance.unk3 = data.getShort(); // TODO what is this? low value like type, but can be -1 so its optional. instance.unk4 = data.getShort(); // 0 or -1 } instance.unk5 = data.getShort(); // TODO what is this? looks like flags for (int i = 0; i < 4; i++) { short strlen = data.getShort(); instance.texts[i] = data.getString(-1, strlen); } data.getShort(); // 0 instance.tileId = data.getShort(); if (isYoda) { instance.unk6 = data.getShort(); // TODO what is this? looks like binary data, maybe tileId2? } if (lengthStart + length != data.position()) { throw new Exception("Length mismatch."); } return instance; }
// Path: src/net/eiveo/utils/SmartByteArrayOutputStream.java // public class SmartByteArrayOutputStream { // private List<ByteArrayOutputStream> sections = new ArrayList<>(); // private ByteArrayOutputStream section; // // public SmartByteArrayOutputStream() { // this.section = new ByteArrayOutputStream(); // this.sections.add(this.section); // } // // public void sectionStart() { // this.section = new ByteArrayOutputStream(); // this.sections.add(this.section); // } // // public byte[] sectionEnd() { // byte[] result = this.section.toByteArray(); // sections.remove(sections.size() - 1); // this.section = sections.get(sections.size() - 1); // return result; // } // // public byte[] toByteArray() { // return this.section.toByteArray(); // } // // public void write(String string) { // for (byte byteData : string.getBytes()) { // this.section.write(byteData); // } // } // // public void write(byte value) { // this.section.write(value); // } // // public void write(byte[] value) { // for (byte byteData : value) { // this.section.write(byteData); // } // } // // public void write(short value) { // for (byte byteData : new byte[] { // (byte) value, // (byte)(value >> 8) // }) { // this.section.write(byteData); // } // } // // public void write(int value) { // for (byte byteData : new byte[] { // (byte) value, // (byte)(value >> 8), // (byte)(value >> 16), // (byte)(value >> 24) // }) { // this.section.write(byteData); // } // } // } // // Path: src/net/eiveo/utils/SmartByteBuffer.java // public class SmartByteBuffer { // private ByteBuffer byteBuffer; // // public int capacity() { // return this.byteBuffer.capacity(); // } // // public byte get() { // return this.byteBuffer.get(); // } // // public void get(byte[] dst) { // this.byteBuffer.get(dst); // } // // public int getInt() { // return this.byteBuffer.getInt(); // } // // public short getShort() { // return this.byteBuffer.getShort(); // } // // public String getString() { // String string = ""; // // while (true) { // byte character = this.get(); // if ((character & 0xff) == 0) { // break; // } else { // string += new String(new byte[] { character }); // } // } // // return string; // } // // public String getString(int index, int length) { // byte[] output = new byte[length]; // if (index > -1) { // this.position(index); // } // this.byteBuffer.get(output); // return new String(output); // } // // public void order(ByteOrder bo) { // this.byteBuffer.order(bo); // } // // public int position() { // return this.byteBuffer.position(); // } // // public void position(int newPosition) { // this.byteBuffer.position(newPosition); // } // // public static SmartByteBuffer wrap(byte[] array) { // SmartByteBuffer instance = new SmartByteBuffer(); // instance.byteBuffer = ByteBuffer.wrap(array); // return instance; // } // } // Path: src/net/eiveo/original/sections/todo/determine_values/IPUZ.java import net.eiveo.utils.SmartByteArrayOutputStream; import net.eiveo.utils.SmartByteBuffer; instance.unk2 = data.getShort(); // TODO what is this? type? data.getShort(); // 0 if (isYoda) { instance.unk3 = data.getShort(); // TODO what is this? low value like type, but can be -1 so its optional. instance.unk4 = data.getShort(); // 0 or -1 } instance.unk5 = data.getShort(); // TODO what is this? looks like flags for (int i = 0; i < 4; i++) { short strlen = data.getShort(); instance.texts[i] = data.getString(-1, strlen); } data.getShort(); // 0 instance.tileId = data.getShort(); if (isYoda) { instance.unk6 = data.getShort(); // TODO what is this? looks like binary data, maybe tileId2? } if (lengthStart + length != data.position()) { throw new Exception("Length mismatch."); } return instance; }
public void write(SmartByteArrayOutputStream outputStream, boolean isYoda) throws Exception {
IceReaper/DesktopAdventuresToolkit
src/net/eiveo/original/sections/todo/not_converted_yet/PNAM.java
// Path: src/net/eiveo/utils/SmartByteArrayOutputStream.java // public class SmartByteArrayOutputStream { // private List<ByteArrayOutputStream> sections = new ArrayList<>(); // private ByteArrayOutputStream section; // // public SmartByteArrayOutputStream() { // this.section = new ByteArrayOutputStream(); // this.sections.add(this.section); // } // // public void sectionStart() { // this.section = new ByteArrayOutputStream(); // this.sections.add(this.section); // } // // public byte[] sectionEnd() { // byte[] result = this.section.toByteArray(); // sections.remove(sections.size() - 1); // this.section = sections.get(sections.size() - 1); // return result; // } // // public byte[] toByteArray() { // return this.section.toByteArray(); // } // // public void write(String string) { // for (byte byteData : string.getBytes()) { // this.section.write(byteData); // } // } // // public void write(byte value) { // this.section.write(value); // } // // public void write(byte[] value) { // for (byte byteData : value) { // this.section.write(byteData); // } // } // // public void write(short value) { // for (byte byteData : new byte[] { // (byte) value, // (byte)(value >> 8) // }) { // this.section.write(byteData); // } // } // // public void write(int value) { // for (byte byteData : new byte[] { // (byte) value, // (byte)(value >> 8), // (byte)(value >> 16), // (byte)(value >> 24) // }) { // this.section.write(byteData); // } // } // } // // Path: src/net/eiveo/utils/SmartByteBuffer.java // public class SmartByteBuffer { // private ByteBuffer byteBuffer; // // public int capacity() { // return this.byteBuffer.capacity(); // } // // public byte get() { // return this.byteBuffer.get(); // } // // public void get(byte[] dst) { // this.byteBuffer.get(dst); // } // // public int getInt() { // return this.byteBuffer.getInt(); // } // // public short getShort() { // return this.byteBuffer.getShort(); // } // // public String getString() { // String string = ""; // // while (true) { // byte character = this.get(); // if ((character & 0xff) == 0) { // break; // } else { // string += new String(new byte[] { character }); // } // } // // return string; // } // // public String getString(int index, int length) { // byte[] output = new byte[length]; // if (index > -1) { // this.position(index); // } // this.byteBuffer.get(output); // return new String(output); // } // // public void order(ByteOrder bo) { // this.byteBuffer.order(bo); // } // // public int position() { // return this.byteBuffer.position(); // } // // public void position(int newPosition) { // this.byteBuffer.position(newPosition); // } // // public static SmartByteBuffer wrap(byte[] array) { // SmartByteBuffer instance = new SmartByteBuffer(); // instance.byteBuffer = ByteBuffer.wrap(array); // return instance; // } // }
import java.util.ArrayList; import java.util.List; import net.eiveo.utils.SmartByteArrayOutputStream; import net.eiveo.utils.SmartByteBuffer;
package net.eiveo.original.sections.todo.not_converted_yet; public class PNAM { private List<String> names = new ArrayList<>();
// Path: src/net/eiveo/utils/SmartByteArrayOutputStream.java // public class SmartByteArrayOutputStream { // private List<ByteArrayOutputStream> sections = new ArrayList<>(); // private ByteArrayOutputStream section; // // public SmartByteArrayOutputStream() { // this.section = new ByteArrayOutputStream(); // this.sections.add(this.section); // } // // public void sectionStart() { // this.section = new ByteArrayOutputStream(); // this.sections.add(this.section); // } // // public byte[] sectionEnd() { // byte[] result = this.section.toByteArray(); // sections.remove(sections.size() - 1); // this.section = sections.get(sections.size() - 1); // return result; // } // // public byte[] toByteArray() { // return this.section.toByteArray(); // } // // public void write(String string) { // for (byte byteData : string.getBytes()) { // this.section.write(byteData); // } // } // // public void write(byte value) { // this.section.write(value); // } // // public void write(byte[] value) { // for (byte byteData : value) { // this.section.write(byteData); // } // } // // public void write(short value) { // for (byte byteData : new byte[] { // (byte) value, // (byte)(value >> 8) // }) { // this.section.write(byteData); // } // } // // public void write(int value) { // for (byte byteData : new byte[] { // (byte) value, // (byte)(value >> 8), // (byte)(value >> 16), // (byte)(value >> 24) // }) { // this.section.write(byteData); // } // } // } // // Path: src/net/eiveo/utils/SmartByteBuffer.java // public class SmartByteBuffer { // private ByteBuffer byteBuffer; // // public int capacity() { // return this.byteBuffer.capacity(); // } // // public byte get() { // return this.byteBuffer.get(); // } // // public void get(byte[] dst) { // this.byteBuffer.get(dst); // } // // public int getInt() { // return this.byteBuffer.getInt(); // } // // public short getShort() { // return this.byteBuffer.getShort(); // } // // public String getString() { // String string = ""; // // while (true) { // byte character = this.get(); // if ((character & 0xff) == 0) { // break; // } else { // string += new String(new byte[] { character }); // } // } // // return string; // } // // public String getString(int index, int length) { // byte[] output = new byte[length]; // if (index > -1) { // this.position(index); // } // this.byteBuffer.get(output); // return new String(output); // } // // public void order(ByteOrder bo) { // this.byteBuffer.order(bo); // } // // public int position() { // return this.byteBuffer.position(); // } // // public void position(int newPosition) { // this.byteBuffer.position(newPosition); // } // // public static SmartByteBuffer wrap(byte[] array) { // SmartByteBuffer instance = new SmartByteBuffer(); // instance.byteBuffer = ByteBuffer.wrap(array); // return instance; // } // } // Path: src/net/eiveo/original/sections/todo/not_converted_yet/PNAM.java import java.util.ArrayList; import java.util.List; import net.eiveo.utils.SmartByteArrayOutputStream; import net.eiveo.utils.SmartByteBuffer; package net.eiveo.original.sections.todo.not_converted_yet; public class PNAM { private List<String> names = new ArrayList<>();
public static PNAM read(SmartByteBuffer data) throws Exception {
IceReaper/DesktopAdventuresToolkit
src/net/eiveo/original/sections/todo/not_converted_yet/PNAM.java
// Path: src/net/eiveo/utils/SmartByteArrayOutputStream.java // public class SmartByteArrayOutputStream { // private List<ByteArrayOutputStream> sections = new ArrayList<>(); // private ByteArrayOutputStream section; // // public SmartByteArrayOutputStream() { // this.section = new ByteArrayOutputStream(); // this.sections.add(this.section); // } // // public void sectionStart() { // this.section = new ByteArrayOutputStream(); // this.sections.add(this.section); // } // // public byte[] sectionEnd() { // byte[] result = this.section.toByteArray(); // sections.remove(sections.size() - 1); // this.section = sections.get(sections.size() - 1); // return result; // } // // public byte[] toByteArray() { // return this.section.toByteArray(); // } // // public void write(String string) { // for (byte byteData : string.getBytes()) { // this.section.write(byteData); // } // } // // public void write(byte value) { // this.section.write(value); // } // // public void write(byte[] value) { // for (byte byteData : value) { // this.section.write(byteData); // } // } // // public void write(short value) { // for (byte byteData : new byte[] { // (byte) value, // (byte)(value >> 8) // }) { // this.section.write(byteData); // } // } // // public void write(int value) { // for (byte byteData : new byte[] { // (byte) value, // (byte)(value >> 8), // (byte)(value >> 16), // (byte)(value >> 24) // }) { // this.section.write(byteData); // } // } // } // // Path: src/net/eiveo/utils/SmartByteBuffer.java // public class SmartByteBuffer { // private ByteBuffer byteBuffer; // // public int capacity() { // return this.byteBuffer.capacity(); // } // // public byte get() { // return this.byteBuffer.get(); // } // // public void get(byte[] dst) { // this.byteBuffer.get(dst); // } // // public int getInt() { // return this.byteBuffer.getInt(); // } // // public short getShort() { // return this.byteBuffer.getShort(); // } // // public String getString() { // String string = ""; // // while (true) { // byte character = this.get(); // if ((character & 0xff) == 0) { // break; // } else { // string += new String(new byte[] { character }); // } // } // // return string; // } // // public String getString(int index, int length) { // byte[] output = new byte[length]; // if (index > -1) { // this.position(index); // } // this.byteBuffer.get(output); // return new String(output); // } // // public void order(ByteOrder bo) { // this.byteBuffer.order(bo); // } // // public int position() { // return this.byteBuffer.position(); // } // // public void position(int newPosition) { // this.byteBuffer.position(newPosition); // } // // public static SmartByteBuffer wrap(byte[] array) { // SmartByteBuffer instance = new SmartByteBuffer(); // instance.byteBuffer = ByteBuffer.wrap(array); // return instance; // } // }
import java.util.ArrayList; import java.util.List; import net.eiveo.utils.SmartByteArrayOutputStream; import net.eiveo.utils.SmartByteBuffer;
package net.eiveo.original.sections.todo.not_converted_yet; public class PNAM { private List<String> names = new ArrayList<>(); public static PNAM read(SmartByteBuffer data) throws Exception { PNAM instance = new PNAM(); int length = data.getInt(); int lengthStart = data.position(); short numEntries = data.getShort(); for (int i = 0; i < numEntries; i++) { instance.names.add(data.getString(-1, 16).trim()); } if (lengthStart + length != data.position()) { throw new Exception("Length mismatch."); } return instance; }
// Path: src/net/eiveo/utils/SmartByteArrayOutputStream.java // public class SmartByteArrayOutputStream { // private List<ByteArrayOutputStream> sections = new ArrayList<>(); // private ByteArrayOutputStream section; // // public SmartByteArrayOutputStream() { // this.section = new ByteArrayOutputStream(); // this.sections.add(this.section); // } // // public void sectionStart() { // this.section = new ByteArrayOutputStream(); // this.sections.add(this.section); // } // // public byte[] sectionEnd() { // byte[] result = this.section.toByteArray(); // sections.remove(sections.size() - 1); // this.section = sections.get(sections.size() - 1); // return result; // } // // public byte[] toByteArray() { // return this.section.toByteArray(); // } // // public void write(String string) { // for (byte byteData : string.getBytes()) { // this.section.write(byteData); // } // } // // public void write(byte value) { // this.section.write(value); // } // // public void write(byte[] value) { // for (byte byteData : value) { // this.section.write(byteData); // } // } // // public void write(short value) { // for (byte byteData : new byte[] { // (byte) value, // (byte)(value >> 8) // }) { // this.section.write(byteData); // } // } // // public void write(int value) { // for (byte byteData : new byte[] { // (byte) value, // (byte)(value >> 8), // (byte)(value >> 16), // (byte)(value >> 24) // }) { // this.section.write(byteData); // } // } // } // // Path: src/net/eiveo/utils/SmartByteBuffer.java // public class SmartByteBuffer { // private ByteBuffer byteBuffer; // // public int capacity() { // return this.byteBuffer.capacity(); // } // // public byte get() { // return this.byteBuffer.get(); // } // // public void get(byte[] dst) { // this.byteBuffer.get(dst); // } // // public int getInt() { // return this.byteBuffer.getInt(); // } // // public short getShort() { // return this.byteBuffer.getShort(); // } // // public String getString() { // String string = ""; // // while (true) { // byte character = this.get(); // if ((character & 0xff) == 0) { // break; // } else { // string += new String(new byte[] { character }); // } // } // // return string; // } // // public String getString(int index, int length) { // byte[] output = new byte[length]; // if (index > -1) { // this.position(index); // } // this.byteBuffer.get(output); // return new String(output); // } // // public void order(ByteOrder bo) { // this.byteBuffer.order(bo); // } // // public int position() { // return this.byteBuffer.position(); // } // // public void position(int newPosition) { // this.byteBuffer.position(newPosition); // } // // public static SmartByteBuffer wrap(byte[] array) { // SmartByteBuffer instance = new SmartByteBuffer(); // instance.byteBuffer = ByteBuffer.wrap(array); // return instance; // } // } // Path: src/net/eiveo/original/sections/todo/not_converted_yet/PNAM.java import java.util.ArrayList; import java.util.List; import net.eiveo.utils.SmartByteArrayOutputStream; import net.eiveo.utils.SmartByteBuffer; package net.eiveo.original.sections.todo.not_converted_yet; public class PNAM { private List<String> names = new ArrayList<>(); public static PNAM read(SmartByteBuffer data) throws Exception { PNAM instance = new PNAM(); int length = data.getInt(); int lengthStart = data.position(); short numEntries = data.getShort(); for (int i = 0; i < numEntries; i++) { instance.names.add(data.getString(-1, 16).trim()); } if (lengthStart + length != data.position()) { throw new Exception("Length mismatch."); } return instance; }
public void write(SmartByteArrayOutputStream outputStream) {
IceReaper/DesktopAdventuresToolkit
src/net/eiveo/original/sections/ENDF.java
// Path: src/net/eiveo/utils/SmartByteArrayOutputStream.java // public class SmartByteArrayOutputStream { // private List<ByteArrayOutputStream> sections = new ArrayList<>(); // private ByteArrayOutputStream section; // // public SmartByteArrayOutputStream() { // this.section = new ByteArrayOutputStream(); // this.sections.add(this.section); // } // // public void sectionStart() { // this.section = new ByteArrayOutputStream(); // this.sections.add(this.section); // } // // public byte[] sectionEnd() { // byte[] result = this.section.toByteArray(); // sections.remove(sections.size() - 1); // this.section = sections.get(sections.size() - 1); // return result; // } // // public byte[] toByteArray() { // return this.section.toByteArray(); // } // // public void write(String string) { // for (byte byteData : string.getBytes()) { // this.section.write(byteData); // } // } // // public void write(byte value) { // this.section.write(value); // } // // public void write(byte[] value) { // for (byte byteData : value) { // this.section.write(byteData); // } // } // // public void write(short value) { // for (byte byteData : new byte[] { // (byte) value, // (byte)(value >> 8) // }) { // this.section.write(byteData); // } // } // // public void write(int value) { // for (byte byteData : new byte[] { // (byte) value, // (byte)(value >> 8), // (byte)(value >> 16), // (byte)(value >> 24) // }) { // this.section.write(byteData); // } // } // } // // Path: src/net/eiveo/utils/SmartByteBuffer.java // public class SmartByteBuffer { // private ByteBuffer byteBuffer; // // public int capacity() { // return this.byteBuffer.capacity(); // } // // public byte get() { // return this.byteBuffer.get(); // } // // public void get(byte[] dst) { // this.byteBuffer.get(dst); // } // // public int getInt() { // return this.byteBuffer.getInt(); // } // // public short getShort() { // return this.byteBuffer.getShort(); // } // // public String getString() { // String string = ""; // // while (true) { // byte character = this.get(); // if ((character & 0xff) == 0) { // break; // } else { // string += new String(new byte[] { character }); // } // } // // return string; // } // // public String getString(int index, int length) { // byte[] output = new byte[length]; // if (index > -1) { // this.position(index); // } // this.byteBuffer.get(output); // return new String(output); // } // // public void order(ByteOrder bo) { // this.byteBuffer.order(bo); // } // // public int position() { // return this.byteBuffer.position(); // } // // public void position(int newPosition) { // this.byteBuffer.position(newPosition); // } // // public static SmartByteBuffer wrap(byte[] array) { // SmartByteBuffer instance = new SmartByteBuffer(); // instance.byteBuffer = ByteBuffer.wrap(array); // return instance; // } // }
import net.eiveo.utils.SmartByteArrayOutputStream; import net.eiveo.utils.SmartByteBuffer;
package net.eiveo.original.sections; public class ENDF { public static ENDF read(SmartByteBuffer data) throws Exception { ENDF instance = new ENDF(); if (data.getInt() != 0 || data.position() != data.capacity()) { throw new Exception("Terminator mismatch."); } return instance; }
// Path: src/net/eiveo/utils/SmartByteArrayOutputStream.java // public class SmartByteArrayOutputStream { // private List<ByteArrayOutputStream> sections = new ArrayList<>(); // private ByteArrayOutputStream section; // // public SmartByteArrayOutputStream() { // this.section = new ByteArrayOutputStream(); // this.sections.add(this.section); // } // // public void sectionStart() { // this.section = new ByteArrayOutputStream(); // this.sections.add(this.section); // } // // public byte[] sectionEnd() { // byte[] result = this.section.toByteArray(); // sections.remove(sections.size() - 1); // this.section = sections.get(sections.size() - 1); // return result; // } // // public byte[] toByteArray() { // return this.section.toByteArray(); // } // // public void write(String string) { // for (byte byteData : string.getBytes()) { // this.section.write(byteData); // } // } // // public void write(byte value) { // this.section.write(value); // } // // public void write(byte[] value) { // for (byte byteData : value) { // this.section.write(byteData); // } // } // // public void write(short value) { // for (byte byteData : new byte[] { // (byte) value, // (byte)(value >> 8) // }) { // this.section.write(byteData); // } // } // // public void write(int value) { // for (byte byteData : new byte[] { // (byte) value, // (byte)(value >> 8), // (byte)(value >> 16), // (byte)(value >> 24) // }) { // this.section.write(byteData); // } // } // } // // Path: src/net/eiveo/utils/SmartByteBuffer.java // public class SmartByteBuffer { // private ByteBuffer byteBuffer; // // public int capacity() { // return this.byteBuffer.capacity(); // } // // public byte get() { // return this.byteBuffer.get(); // } // // public void get(byte[] dst) { // this.byteBuffer.get(dst); // } // // public int getInt() { // return this.byteBuffer.getInt(); // } // // public short getShort() { // return this.byteBuffer.getShort(); // } // // public String getString() { // String string = ""; // // while (true) { // byte character = this.get(); // if ((character & 0xff) == 0) { // break; // } else { // string += new String(new byte[] { character }); // } // } // // return string; // } // // public String getString(int index, int length) { // byte[] output = new byte[length]; // if (index > -1) { // this.position(index); // } // this.byteBuffer.get(output); // return new String(output); // } // // public void order(ByteOrder bo) { // this.byteBuffer.order(bo); // } // // public int position() { // return this.byteBuffer.position(); // } // // public void position(int newPosition) { // this.byteBuffer.position(newPosition); // } // // public static SmartByteBuffer wrap(byte[] array) { // SmartByteBuffer instance = new SmartByteBuffer(); // instance.byteBuffer = ByteBuffer.wrap(array); // return instance; // } // } // Path: src/net/eiveo/original/sections/ENDF.java import net.eiveo.utils.SmartByteArrayOutputStream; import net.eiveo.utils.SmartByteBuffer; package net.eiveo.original.sections; public class ENDF { public static ENDF read(SmartByteBuffer data) throws Exception { ENDF instance = new ENDF(); if (data.getInt() != 0 || data.position() != data.capacity()) { throw new Exception("Terminator mismatch."); } return instance; }
public void write(SmartByteArrayOutputStream outputStream) throws Exception {
IceReaper/DesktopAdventuresToolkit
src/net/eiveo/original/sections/todo/not_converted_yet/ZAX2.java
// Path: src/net/eiveo/utils/SmartByteArrayOutputStream.java // public class SmartByteArrayOutputStream { // private List<ByteArrayOutputStream> sections = new ArrayList<>(); // private ByteArrayOutputStream section; // // public SmartByteArrayOutputStream() { // this.section = new ByteArrayOutputStream(); // this.sections.add(this.section); // } // // public void sectionStart() { // this.section = new ByteArrayOutputStream(); // this.sections.add(this.section); // } // // public byte[] sectionEnd() { // byte[] result = this.section.toByteArray(); // sections.remove(sections.size() - 1); // this.section = sections.get(sections.size() - 1); // return result; // } // // public byte[] toByteArray() { // return this.section.toByteArray(); // } // // public void write(String string) { // for (byte byteData : string.getBytes()) { // this.section.write(byteData); // } // } // // public void write(byte value) { // this.section.write(value); // } // // public void write(byte[] value) { // for (byte byteData : value) { // this.section.write(byteData); // } // } // // public void write(short value) { // for (byte byteData : new byte[] { // (byte) value, // (byte)(value >> 8) // }) { // this.section.write(byteData); // } // } // // public void write(int value) { // for (byte byteData : new byte[] { // (byte) value, // (byte)(value >> 8), // (byte)(value >> 16), // (byte)(value >> 24) // }) { // this.section.write(byteData); // } // } // } // // Path: src/net/eiveo/utils/SmartByteBuffer.java // public class SmartByteBuffer { // private ByteBuffer byteBuffer; // // public int capacity() { // return this.byteBuffer.capacity(); // } // // public byte get() { // return this.byteBuffer.get(); // } // // public void get(byte[] dst) { // this.byteBuffer.get(dst); // } // // public int getInt() { // return this.byteBuffer.getInt(); // } // // public short getShort() { // return this.byteBuffer.getShort(); // } // // public String getString() { // String string = ""; // // while (true) { // byte character = this.get(); // if ((character & 0xff) == 0) { // break; // } else { // string += new String(new byte[] { character }); // } // } // // return string; // } // // public String getString(int index, int length) { // byte[] output = new byte[length]; // if (index > -1) { // this.position(index); // } // this.byteBuffer.get(output); // return new String(output); // } // // public void order(ByteOrder bo) { // this.byteBuffer.order(bo); // } // // public int position() { // return this.byteBuffer.position(); // } // // public void position(int newPosition) { // this.byteBuffer.position(newPosition); // } // // public static SmartByteBuffer wrap(byte[] array) { // SmartByteBuffer instance = new SmartByteBuffer(); // instance.byteBuffer = ByteBuffer.wrap(array); // return instance; // } // }
import java.util.ArrayList; import java.util.List; import net.eiveo.utils.SmartByteArrayOutputStream; import net.eiveo.utils.SmartByteBuffer;
package net.eiveo.original.sections.todo.not_converted_yet; public class ZAX2 { private List<IZX2> IZX2 = new ArrayList<>();
// Path: src/net/eiveo/utils/SmartByteArrayOutputStream.java // public class SmartByteArrayOutputStream { // private List<ByteArrayOutputStream> sections = new ArrayList<>(); // private ByteArrayOutputStream section; // // public SmartByteArrayOutputStream() { // this.section = new ByteArrayOutputStream(); // this.sections.add(this.section); // } // // public void sectionStart() { // this.section = new ByteArrayOutputStream(); // this.sections.add(this.section); // } // // public byte[] sectionEnd() { // byte[] result = this.section.toByteArray(); // sections.remove(sections.size() - 1); // this.section = sections.get(sections.size() - 1); // return result; // } // // public byte[] toByteArray() { // return this.section.toByteArray(); // } // // public void write(String string) { // for (byte byteData : string.getBytes()) { // this.section.write(byteData); // } // } // // public void write(byte value) { // this.section.write(value); // } // // public void write(byte[] value) { // for (byte byteData : value) { // this.section.write(byteData); // } // } // // public void write(short value) { // for (byte byteData : new byte[] { // (byte) value, // (byte)(value >> 8) // }) { // this.section.write(byteData); // } // } // // public void write(int value) { // for (byte byteData : new byte[] { // (byte) value, // (byte)(value >> 8), // (byte)(value >> 16), // (byte)(value >> 24) // }) { // this.section.write(byteData); // } // } // } // // Path: src/net/eiveo/utils/SmartByteBuffer.java // public class SmartByteBuffer { // private ByteBuffer byteBuffer; // // public int capacity() { // return this.byteBuffer.capacity(); // } // // public byte get() { // return this.byteBuffer.get(); // } // // public void get(byte[] dst) { // this.byteBuffer.get(dst); // } // // public int getInt() { // return this.byteBuffer.getInt(); // } // // public short getShort() { // return this.byteBuffer.getShort(); // } // // public String getString() { // String string = ""; // // while (true) { // byte character = this.get(); // if ((character & 0xff) == 0) { // break; // } else { // string += new String(new byte[] { character }); // } // } // // return string; // } // // public String getString(int index, int length) { // byte[] output = new byte[length]; // if (index > -1) { // this.position(index); // } // this.byteBuffer.get(output); // return new String(output); // } // // public void order(ByteOrder bo) { // this.byteBuffer.order(bo); // } // // public int position() { // return this.byteBuffer.position(); // } // // public void position(int newPosition) { // this.byteBuffer.position(newPosition); // } // // public static SmartByteBuffer wrap(byte[] array) { // SmartByteBuffer instance = new SmartByteBuffer(); // instance.byteBuffer = ByteBuffer.wrap(array); // return instance; // } // } // Path: src/net/eiveo/original/sections/todo/not_converted_yet/ZAX2.java import java.util.ArrayList; import java.util.List; import net.eiveo.utils.SmartByteArrayOutputStream; import net.eiveo.utils.SmartByteBuffer; package net.eiveo.original.sections.todo.not_converted_yet; public class ZAX2 { private List<IZX2> IZX2 = new ArrayList<>();
public static ZAX2 read(SmartByteBuffer data) throws Exception {
IceReaper/DesktopAdventuresToolkit
src/net/eiveo/original/sections/todo/not_converted_yet/ZAX2.java
// Path: src/net/eiveo/utils/SmartByteArrayOutputStream.java // public class SmartByteArrayOutputStream { // private List<ByteArrayOutputStream> sections = new ArrayList<>(); // private ByteArrayOutputStream section; // // public SmartByteArrayOutputStream() { // this.section = new ByteArrayOutputStream(); // this.sections.add(this.section); // } // // public void sectionStart() { // this.section = new ByteArrayOutputStream(); // this.sections.add(this.section); // } // // public byte[] sectionEnd() { // byte[] result = this.section.toByteArray(); // sections.remove(sections.size() - 1); // this.section = sections.get(sections.size() - 1); // return result; // } // // public byte[] toByteArray() { // return this.section.toByteArray(); // } // // public void write(String string) { // for (byte byteData : string.getBytes()) { // this.section.write(byteData); // } // } // // public void write(byte value) { // this.section.write(value); // } // // public void write(byte[] value) { // for (byte byteData : value) { // this.section.write(byteData); // } // } // // public void write(short value) { // for (byte byteData : new byte[] { // (byte) value, // (byte)(value >> 8) // }) { // this.section.write(byteData); // } // } // // public void write(int value) { // for (byte byteData : new byte[] { // (byte) value, // (byte)(value >> 8), // (byte)(value >> 16), // (byte)(value >> 24) // }) { // this.section.write(byteData); // } // } // } // // Path: src/net/eiveo/utils/SmartByteBuffer.java // public class SmartByteBuffer { // private ByteBuffer byteBuffer; // // public int capacity() { // return this.byteBuffer.capacity(); // } // // public byte get() { // return this.byteBuffer.get(); // } // // public void get(byte[] dst) { // this.byteBuffer.get(dst); // } // // public int getInt() { // return this.byteBuffer.getInt(); // } // // public short getShort() { // return this.byteBuffer.getShort(); // } // // public String getString() { // String string = ""; // // while (true) { // byte character = this.get(); // if ((character & 0xff) == 0) { // break; // } else { // string += new String(new byte[] { character }); // } // } // // return string; // } // // public String getString(int index, int length) { // byte[] output = new byte[length]; // if (index > -1) { // this.position(index); // } // this.byteBuffer.get(output); // return new String(output); // } // // public void order(ByteOrder bo) { // this.byteBuffer.order(bo); // } // // public int position() { // return this.byteBuffer.position(); // } // // public void position(int newPosition) { // this.byteBuffer.position(newPosition); // } // // public static SmartByteBuffer wrap(byte[] array) { // SmartByteBuffer instance = new SmartByteBuffer(); // instance.byteBuffer = ByteBuffer.wrap(array); // return instance; // } // }
import java.util.ArrayList; import java.util.List; import net.eiveo.utils.SmartByteArrayOutputStream; import net.eiveo.utils.SmartByteBuffer;
package net.eiveo.original.sections.todo.not_converted_yet; public class ZAX2 { private List<IZX2> IZX2 = new ArrayList<>(); public static ZAX2 read(SmartByteBuffer data) throws Exception { ZAX2 instance = new ZAX2(); int length = data.getInt(); int lengthStart = data.position(); while (length + lengthStart > data.position()) { String izx2 = data.getString(-1, 4); if (!izx2.equals("IZX2")) { throw new Exception("IZX2 mismatch."); } instance.IZX2.add(net.eiveo.original.sections.todo.not_converted_yet.IZX2.read(data)); } if (lengthStart + length != data.position()) { throw new Exception("Length mismatch."); } return instance; }
// Path: src/net/eiveo/utils/SmartByteArrayOutputStream.java // public class SmartByteArrayOutputStream { // private List<ByteArrayOutputStream> sections = new ArrayList<>(); // private ByteArrayOutputStream section; // // public SmartByteArrayOutputStream() { // this.section = new ByteArrayOutputStream(); // this.sections.add(this.section); // } // // public void sectionStart() { // this.section = new ByteArrayOutputStream(); // this.sections.add(this.section); // } // // public byte[] sectionEnd() { // byte[] result = this.section.toByteArray(); // sections.remove(sections.size() - 1); // this.section = sections.get(sections.size() - 1); // return result; // } // // public byte[] toByteArray() { // return this.section.toByteArray(); // } // // public void write(String string) { // for (byte byteData : string.getBytes()) { // this.section.write(byteData); // } // } // // public void write(byte value) { // this.section.write(value); // } // // public void write(byte[] value) { // for (byte byteData : value) { // this.section.write(byteData); // } // } // // public void write(short value) { // for (byte byteData : new byte[] { // (byte) value, // (byte)(value >> 8) // }) { // this.section.write(byteData); // } // } // // public void write(int value) { // for (byte byteData : new byte[] { // (byte) value, // (byte)(value >> 8), // (byte)(value >> 16), // (byte)(value >> 24) // }) { // this.section.write(byteData); // } // } // } // // Path: src/net/eiveo/utils/SmartByteBuffer.java // public class SmartByteBuffer { // private ByteBuffer byteBuffer; // // public int capacity() { // return this.byteBuffer.capacity(); // } // // public byte get() { // return this.byteBuffer.get(); // } // // public void get(byte[] dst) { // this.byteBuffer.get(dst); // } // // public int getInt() { // return this.byteBuffer.getInt(); // } // // public short getShort() { // return this.byteBuffer.getShort(); // } // // public String getString() { // String string = ""; // // while (true) { // byte character = this.get(); // if ((character & 0xff) == 0) { // break; // } else { // string += new String(new byte[] { character }); // } // } // // return string; // } // // public String getString(int index, int length) { // byte[] output = new byte[length]; // if (index > -1) { // this.position(index); // } // this.byteBuffer.get(output); // return new String(output); // } // // public void order(ByteOrder bo) { // this.byteBuffer.order(bo); // } // // public int position() { // return this.byteBuffer.position(); // } // // public void position(int newPosition) { // this.byteBuffer.position(newPosition); // } // // public static SmartByteBuffer wrap(byte[] array) { // SmartByteBuffer instance = new SmartByteBuffer(); // instance.byteBuffer = ByteBuffer.wrap(array); // return instance; // } // } // Path: src/net/eiveo/original/sections/todo/not_converted_yet/ZAX2.java import java.util.ArrayList; import java.util.List; import net.eiveo.utils.SmartByteArrayOutputStream; import net.eiveo.utils.SmartByteBuffer; package net.eiveo.original.sections.todo.not_converted_yet; public class ZAX2 { private List<IZX2> IZX2 = new ArrayList<>(); public static ZAX2 read(SmartByteBuffer data) throws Exception { ZAX2 instance = new ZAX2(); int length = data.getInt(); int lengthStart = data.position(); while (length + lengthStart > data.position()) { String izx2 = data.getString(-1, 4); if (!izx2.equals("IZX2")) { throw new Exception("IZX2 mismatch."); } instance.IZX2.add(net.eiveo.original.sections.todo.not_converted_yet.IZX2.read(data)); } if (lengthStart + length != data.position()) { throw new Exception("Length mismatch."); } return instance; }
public void write(SmartByteArrayOutputStream outputStream) {
IceReaper/DesktopAdventuresToolkit
src/net/eiveo/original/sections/todo/not_converted_yet/ZAX4.java
// Path: src/net/eiveo/original/sections/todo/determine_values/IZX4.java // public class IZX4 { // private short unk; // // public static IZX4 read(SmartByteBuffer data) throws Exception { // IZX4 instance = new IZX4(); // // int length = data.getInt(); // int lengthStart = data.position(); // // instance.unk = data.getShort(); // TODO mostly 1, sometimes 0 // // if (lengthStart + length != data.position()) { // throw new Exception("Length mismatch."); // } // // return instance; // } // // public void write(SmartByteArrayOutputStream outputStream) { // outputStream.write("IZX4"); // outputStream.sectionStart(); // // outputStream.write(this.unk); // // byte[] section = outputStream.sectionEnd(); // outputStream.write(section.length); // outputStream.write(section); // } // } // // Path: src/net/eiveo/utils/SmartByteArrayOutputStream.java // public class SmartByteArrayOutputStream { // private List<ByteArrayOutputStream> sections = new ArrayList<>(); // private ByteArrayOutputStream section; // // public SmartByteArrayOutputStream() { // this.section = new ByteArrayOutputStream(); // this.sections.add(this.section); // } // // public void sectionStart() { // this.section = new ByteArrayOutputStream(); // this.sections.add(this.section); // } // // public byte[] sectionEnd() { // byte[] result = this.section.toByteArray(); // sections.remove(sections.size() - 1); // this.section = sections.get(sections.size() - 1); // return result; // } // // public byte[] toByteArray() { // return this.section.toByteArray(); // } // // public void write(String string) { // for (byte byteData : string.getBytes()) { // this.section.write(byteData); // } // } // // public void write(byte value) { // this.section.write(value); // } // // public void write(byte[] value) { // for (byte byteData : value) { // this.section.write(byteData); // } // } // // public void write(short value) { // for (byte byteData : new byte[] { // (byte) value, // (byte)(value >> 8) // }) { // this.section.write(byteData); // } // } // // public void write(int value) { // for (byte byteData : new byte[] { // (byte) value, // (byte)(value >> 8), // (byte)(value >> 16), // (byte)(value >> 24) // }) { // this.section.write(byteData); // } // } // } // // Path: src/net/eiveo/utils/SmartByteBuffer.java // public class SmartByteBuffer { // private ByteBuffer byteBuffer; // // public int capacity() { // return this.byteBuffer.capacity(); // } // // public byte get() { // return this.byteBuffer.get(); // } // // public void get(byte[] dst) { // this.byteBuffer.get(dst); // } // // public int getInt() { // return this.byteBuffer.getInt(); // } // // public short getShort() { // return this.byteBuffer.getShort(); // } // // public String getString() { // String string = ""; // // while (true) { // byte character = this.get(); // if ((character & 0xff) == 0) { // break; // } else { // string += new String(new byte[] { character }); // } // } // // return string; // } // // public String getString(int index, int length) { // byte[] output = new byte[length]; // if (index > -1) { // this.position(index); // } // this.byteBuffer.get(output); // return new String(output); // } // // public void order(ByteOrder bo) { // this.byteBuffer.order(bo); // } // // public int position() { // return this.byteBuffer.position(); // } // // public void position(int newPosition) { // this.byteBuffer.position(newPosition); // } // // public static SmartByteBuffer wrap(byte[] array) { // SmartByteBuffer instance = new SmartByteBuffer(); // instance.byteBuffer = ByteBuffer.wrap(array); // return instance; // } // }
import java.util.ArrayList; import java.util.List; import net.eiveo.original.sections.todo.determine_values.IZX4; import net.eiveo.utils.SmartByteArrayOutputStream; import net.eiveo.utils.SmartByteBuffer;
package net.eiveo.original.sections.todo.not_converted_yet; public class ZAX4 { private List<IZX4> IZX4 = new ArrayList<>();
// Path: src/net/eiveo/original/sections/todo/determine_values/IZX4.java // public class IZX4 { // private short unk; // // public static IZX4 read(SmartByteBuffer data) throws Exception { // IZX4 instance = new IZX4(); // // int length = data.getInt(); // int lengthStart = data.position(); // // instance.unk = data.getShort(); // TODO mostly 1, sometimes 0 // // if (lengthStart + length != data.position()) { // throw new Exception("Length mismatch."); // } // // return instance; // } // // public void write(SmartByteArrayOutputStream outputStream) { // outputStream.write("IZX4"); // outputStream.sectionStart(); // // outputStream.write(this.unk); // // byte[] section = outputStream.sectionEnd(); // outputStream.write(section.length); // outputStream.write(section); // } // } // // Path: src/net/eiveo/utils/SmartByteArrayOutputStream.java // public class SmartByteArrayOutputStream { // private List<ByteArrayOutputStream> sections = new ArrayList<>(); // private ByteArrayOutputStream section; // // public SmartByteArrayOutputStream() { // this.section = new ByteArrayOutputStream(); // this.sections.add(this.section); // } // // public void sectionStart() { // this.section = new ByteArrayOutputStream(); // this.sections.add(this.section); // } // // public byte[] sectionEnd() { // byte[] result = this.section.toByteArray(); // sections.remove(sections.size() - 1); // this.section = sections.get(sections.size() - 1); // return result; // } // // public byte[] toByteArray() { // return this.section.toByteArray(); // } // // public void write(String string) { // for (byte byteData : string.getBytes()) { // this.section.write(byteData); // } // } // // public void write(byte value) { // this.section.write(value); // } // // public void write(byte[] value) { // for (byte byteData : value) { // this.section.write(byteData); // } // } // // public void write(short value) { // for (byte byteData : new byte[] { // (byte) value, // (byte)(value >> 8) // }) { // this.section.write(byteData); // } // } // // public void write(int value) { // for (byte byteData : new byte[] { // (byte) value, // (byte)(value >> 8), // (byte)(value >> 16), // (byte)(value >> 24) // }) { // this.section.write(byteData); // } // } // } // // Path: src/net/eiveo/utils/SmartByteBuffer.java // public class SmartByteBuffer { // private ByteBuffer byteBuffer; // // public int capacity() { // return this.byteBuffer.capacity(); // } // // public byte get() { // return this.byteBuffer.get(); // } // // public void get(byte[] dst) { // this.byteBuffer.get(dst); // } // // public int getInt() { // return this.byteBuffer.getInt(); // } // // public short getShort() { // return this.byteBuffer.getShort(); // } // // public String getString() { // String string = ""; // // while (true) { // byte character = this.get(); // if ((character & 0xff) == 0) { // break; // } else { // string += new String(new byte[] { character }); // } // } // // return string; // } // // public String getString(int index, int length) { // byte[] output = new byte[length]; // if (index > -1) { // this.position(index); // } // this.byteBuffer.get(output); // return new String(output); // } // // public void order(ByteOrder bo) { // this.byteBuffer.order(bo); // } // // public int position() { // return this.byteBuffer.position(); // } // // public void position(int newPosition) { // this.byteBuffer.position(newPosition); // } // // public static SmartByteBuffer wrap(byte[] array) { // SmartByteBuffer instance = new SmartByteBuffer(); // instance.byteBuffer = ByteBuffer.wrap(array); // return instance; // } // } // Path: src/net/eiveo/original/sections/todo/not_converted_yet/ZAX4.java import java.util.ArrayList; import java.util.List; import net.eiveo.original.sections.todo.determine_values.IZX4; import net.eiveo.utils.SmartByteArrayOutputStream; import net.eiveo.utils.SmartByteBuffer; package net.eiveo.original.sections.todo.not_converted_yet; public class ZAX4 { private List<IZX4> IZX4 = new ArrayList<>();
public static ZAX4 read(SmartByteBuffer data) throws Exception {
IceReaper/DesktopAdventuresToolkit
src/net/eiveo/original/sections/IZON.java
// Path: src/net/eiveo/utils/SmartByteArrayOutputStream.java // public class SmartByteArrayOutputStream { // private List<ByteArrayOutputStream> sections = new ArrayList<>(); // private ByteArrayOutputStream section; // // public SmartByteArrayOutputStream() { // this.section = new ByteArrayOutputStream(); // this.sections.add(this.section); // } // // public void sectionStart() { // this.section = new ByteArrayOutputStream(); // this.sections.add(this.section); // } // // public byte[] sectionEnd() { // byte[] result = this.section.toByteArray(); // sections.remove(sections.size() - 1); // this.section = sections.get(sections.size() - 1); // return result; // } // // public byte[] toByteArray() { // return this.section.toByteArray(); // } // // public void write(String string) { // for (byte byteData : string.getBytes()) { // this.section.write(byteData); // } // } // // public void write(byte value) { // this.section.write(value); // } // // public void write(byte[] value) { // for (byte byteData : value) { // this.section.write(byteData); // } // } // // public void write(short value) { // for (byte byteData : new byte[] { // (byte) value, // (byte)(value >> 8) // }) { // this.section.write(byteData); // } // } // // public void write(int value) { // for (byte byteData : new byte[] { // (byte) value, // (byte)(value >> 8), // (byte)(value >> 16), // (byte)(value >> 24) // }) { // this.section.write(byteData); // } // } // } // // Path: src/net/eiveo/utils/SmartByteBuffer.java // public class SmartByteBuffer { // private ByteBuffer byteBuffer; // // public int capacity() { // return this.byteBuffer.capacity(); // } // // public byte get() { // return this.byteBuffer.get(); // } // // public void get(byte[] dst) { // this.byteBuffer.get(dst); // } // // public int getInt() { // return this.byteBuffer.getInt(); // } // // public short getShort() { // return this.byteBuffer.getShort(); // } // // public String getString() { // String string = ""; // // while (true) { // byte character = this.get(); // if ((character & 0xff) == 0) { // break; // } else { // string += new String(new byte[] { character }); // } // } // // return string; // } // // public String getString(int index, int length) { // byte[] output = new byte[length]; // if (index > -1) { // this.position(index); // } // this.byteBuffer.get(output); // return new String(output); // } // // public void order(ByteOrder bo) { // this.byteBuffer.order(bo); // } // // public int position() { // return this.byteBuffer.position(); // } // // public void position(int newPosition) { // this.byteBuffer.position(newPosition); // } // // public static SmartByteBuffer wrap(byte[] array) { // SmartByteBuffer instance = new SmartByteBuffer(); // instance.byteBuffer = ByteBuffer.wrap(array); // return instance; // } // }
import net.eiveo.utils.SmartByteArrayOutputStream; import net.eiveo.utils.SmartByteBuffer;
package net.eiveo.original.sections; public class IZON { public short width; public short height; public short type; public short[] tiles; public Short world;
// Path: src/net/eiveo/utils/SmartByteArrayOutputStream.java // public class SmartByteArrayOutputStream { // private List<ByteArrayOutputStream> sections = new ArrayList<>(); // private ByteArrayOutputStream section; // // public SmartByteArrayOutputStream() { // this.section = new ByteArrayOutputStream(); // this.sections.add(this.section); // } // // public void sectionStart() { // this.section = new ByteArrayOutputStream(); // this.sections.add(this.section); // } // // public byte[] sectionEnd() { // byte[] result = this.section.toByteArray(); // sections.remove(sections.size() - 1); // this.section = sections.get(sections.size() - 1); // return result; // } // // public byte[] toByteArray() { // return this.section.toByteArray(); // } // // public void write(String string) { // for (byte byteData : string.getBytes()) { // this.section.write(byteData); // } // } // // public void write(byte value) { // this.section.write(value); // } // // public void write(byte[] value) { // for (byte byteData : value) { // this.section.write(byteData); // } // } // // public void write(short value) { // for (byte byteData : new byte[] { // (byte) value, // (byte)(value >> 8) // }) { // this.section.write(byteData); // } // } // // public void write(int value) { // for (byte byteData : new byte[] { // (byte) value, // (byte)(value >> 8), // (byte)(value >> 16), // (byte)(value >> 24) // }) { // this.section.write(byteData); // } // } // } // // Path: src/net/eiveo/utils/SmartByteBuffer.java // public class SmartByteBuffer { // private ByteBuffer byteBuffer; // // public int capacity() { // return this.byteBuffer.capacity(); // } // // public byte get() { // return this.byteBuffer.get(); // } // // public void get(byte[] dst) { // this.byteBuffer.get(dst); // } // // public int getInt() { // return this.byteBuffer.getInt(); // } // // public short getShort() { // return this.byteBuffer.getShort(); // } // // public String getString() { // String string = ""; // // while (true) { // byte character = this.get(); // if ((character & 0xff) == 0) { // break; // } else { // string += new String(new byte[] { character }); // } // } // // return string; // } // // public String getString(int index, int length) { // byte[] output = new byte[length]; // if (index > -1) { // this.position(index); // } // this.byteBuffer.get(output); // return new String(output); // } // // public void order(ByteOrder bo) { // this.byteBuffer.order(bo); // } // // public int position() { // return this.byteBuffer.position(); // } // // public void position(int newPosition) { // this.byteBuffer.position(newPosition); // } // // public static SmartByteBuffer wrap(byte[] array) { // SmartByteBuffer instance = new SmartByteBuffer(); // instance.byteBuffer = ByteBuffer.wrap(array); // return instance; // } // } // Path: src/net/eiveo/original/sections/IZON.java import net.eiveo.utils.SmartByteArrayOutputStream; import net.eiveo.utils.SmartByteBuffer; package net.eiveo.original.sections; public class IZON { public short width; public short height; public short type; public short[] tiles; public Short world;
public static IZON read(SmartByteBuffer data, boolean isYoda, short world) throws Exception {
IceReaper/DesktopAdventuresToolkit
src/net/eiveo/original/sections/IZON.java
// Path: src/net/eiveo/utils/SmartByteArrayOutputStream.java // public class SmartByteArrayOutputStream { // private List<ByteArrayOutputStream> sections = new ArrayList<>(); // private ByteArrayOutputStream section; // // public SmartByteArrayOutputStream() { // this.section = new ByteArrayOutputStream(); // this.sections.add(this.section); // } // // public void sectionStart() { // this.section = new ByteArrayOutputStream(); // this.sections.add(this.section); // } // // public byte[] sectionEnd() { // byte[] result = this.section.toByteArray(); // sections.remove(sections.size() - 1); // this.section = sections.get(sections.size() - 1); // return result; // } // // public byte[] toByteArray() { // return this.section.toByteArray(); // } // // public void write(String string) { // for (byte byteData : string.getBytes()) { // this.section.write(byteData); // } // } // // public void write(byte value) { // this.section.write(value); // } // // public void write(byte[] value) { // for (byte byteData : value) { // this.section.write(byteData); // } // } // // public void write(short value) { // for (byte byteData : new byte[] { // (byte) value, // (byte)(value >> 8) // }) { // this.section.write(byteData); // } // } // // public void write(int value) { // for (byte byteData : new byte[] { // (byte) value, // (byte)(value >> 8), // (byte)(value >> 16), // (byte)(value >> 24) // }) { // this.section.write(byteData); // } // } // } // // Path: src/net/eiveo/utils/SmartByteBuffer.java // public class SmartByteBuffer { // private ByteBuffer byteBuffer; // // public int capacity() { // return this.byteBuffer.capacity(); // } // // public byte get() { // return this.byteBuffer.get(); // } // // public void get(byte[] dst) { // this.byteBuffer.get(dst); // } // // public int getInt() { // return this.byteBuffer.getInt(); // } // // public short getShort() { // return this.byteBuffer.getShort(); // } // // public String getString() { // String string = ""; // // while (true) { // byte character = this.get(); // if ((character & 0xff) == 0) { // break; // } else { // string += new String(new byte[] { character }); // } // } // // return string; // } // // public String getString(int index, int length) { // byte[] output = new byte[length]; // if (index > -1) { // this.position(index); // } // this.byteBuffer.get(output); // return new String(output); // } // // public void order(ByteOrder bo) { // this.byteBuffer.order(bo); // } // // public int position() { // return this.byteBuffer.position(); // } // // public void position(int newPosition) { // this.byteBuffer.position(newPosition); // } // // public static SmartByteBuffer wrap(byte[] array) { // SmartByteBuffer instance = new SmartByteBuffer(); // instance.byteBuffer = ByteBuffer.wrap(array); // return instance; // } // }
import net.eiveo.utils.SmartByteArrayOutputStream; import net.eiveo.utils.SmartByteBuffer;
int length = data.getInt() - 8; int lengthStart = data.position(); instance.width = data.getShort(); instance.height = data.getShort(); instance.type = data.getShort(); data.getShort(); // 0 if (isYoda) { data.getShort(); // -1 instance.world = data.getShort(); if (instance.world != world) { throw new Exception("mapGroup mismatch."); } } instance.tiles = new short[instance.width * instance.height * 3]; for (int i = 0; i < instance.tiles.length; i++) { instance.tiles[i] = data.getShort(); } if (lengthStart + length != data.position()) { throw new Exception("Length mismatch."); } return instance; }
// Path: src/net/eiveo/utils/SmartByteArrayOutputStream.java // public class SmartByteArrayOutputStream { // private List<ByteArrayOutputStream> sections = new ArrayList<>(); // private ByteArrayOutputStream section; // // public SmartByteArrayOutputStream() { // this.section = new ByteArrayOutputStream(); // this.sections.add(this.section); // } // // public void sectionStart() { // this.section = new ByteArrayOutputStream(); // this.sections.add(this.section); // } // // public byte[] sectionEnd() { // byte[] result = this.section.toByteArray(); // sections.remove(sections.size() - 1); // this.section = sections.get(sections.size() - 1); // return result; // } // // public byte[] toByteArray() { // return this.section.toByteArray(); // } // // public void write(String string) { // for (byte byteData : string.getBytes()) { // this.section.write(byteData); // } // } // // public void write(byte value) { // this.section.write(value); // } // // public void write(byte[] value) { // for (byte byteData : value) { // this.section.write(byteData); // } // } // // public void write(short value) { // for (byte byteData : new byte[] { // (byte) value, // (byte)(value >> 8) // }) { // this.section.write(byteData); // } // } // // public void write(int value) { // for (byte byteData : new byte[] { // (byte) value, // (byte)(value >> 8), // (byte)(value >> 16), // (byte)(value >> 24) // }) { // this.section.write(byteData); // } // } // } // // Path: src/net/eiveo/utils/SmartByteBuffer.java // public class SmartByteBuffer { // private ByteBuffer byteBuffer; // // public int capacity() { // return this.byteBuffer.capacity(); // } // // public byte get() { // return this.byteBuffer.get(); // } // // public void get(byte[] dst) { // this.byteBuffer.get(dst); // } // // public int getInt() { // return this.byteBuffer.getInt(); // } // // public short getShort() { // return this.byteBuffer.getShort(); // } // // public String getString() { // String string = ""; // // while (true) { // byte character = this.get(); // if ((character & 0xff) == 0) { // break; // } else { // string += new String(new byte[] { character }); // } // } // // return string; // } // // public String getString(int index, int length) { // byte[] output = new byte[length]; // if (index > -1) { // this.position(index); // } // this.byteBuffer.get(output); // return new String(output); // } // // public void order(ByteOrder bo) { // this.byteBuffer.order(bo); // } // // public int position() { // return this.byteBuffer.position(); // } // // public void position(int newPosition) { // this.byteBuffer.position(newPosition); // } // // public static SmartByteBuffer wrap(byte[] array) { // SmartByteBuffer instance = new SmartByteBuffer(); // instance.byteBuffer = ByteBuffer.wrap(array); // return instance; // } // } // Path: src/net/eiveo/original/sections/IZON.java import net.eiveo.utils.SmartByteArrayOutputStream; import net.eiveo.utils.SmartByteBuffer; int length = data.getInt() - 8; int lengthStart = data.position(); instance.width = data.getShort(); instance.height = data.getShort(); instance.type = data.getShort(); data.getShort(); // 0 if (isYoda) { data.getShort(); // -1 instance.world = data.getShort(); if (instance.world != world) { throw new Exception("mapGroup mismatch."); } } instance.tiles = new short[instance.width * instance.height * 3]; for (int i = 0; i < instance.tiles.length; i++) { instance.tiles[i] = data.getShort(); } if (lengthStart + length != data.position()) { throw new Exception("Length mismatch."); } return instance; }
public void write(SmartByteArrayOutputStream outputStream, boolean isYoda) {
IceReaper/DesktopAdventuresToolkit
src/net/eiveo/original/sections/TNAM.java
// Path: src/net/eiveo/utils/SmartByteArrayOutputStream.java // public class SmartByteArrayOutputStream { // private List<ByteArrayOutputStream> sections = new ArrayList<>(); // private ByteArrayOutputStream section; // // public SmartByteArrayOutputStream() { // this.section = new ByteArrayOutputStream(); // this.sections.add(this.section); // } // // public void sectionStart() { // this.section = new ByteArrayOutputStream(); // this.sections.add(this.section); // } // // public byte[] sectionEnd() { // byte[] result = this.section.toByteArray(); // sections.remove(sections.size() - 1); // this.section = sections.get(sections.size() - 1); // return result; // } // // public byte[] toByteArray() { // return this.section.toByteArray(); // } // // public void write(String string) { // for (byte byteData : string.getBytes()) { // this.section.write(byteData); // } // } // // public void write(byte value) { // this.section.write(value); // } // // public void write(byte[] value) { // for (byte byteData : value) { // this.section.write(byteData); // } // } // // public void write(short value) { // for (byte byteData : new byte[] { // (byte) value, // (byte)(value >> 8) // }) { // this.section.write(byteData); // } // } // // public void write(int value) { // for (byte byteData : new byte[] { // (byte) value, // (byte)(value >> 8), // (byte)(value >> 16), // (byte)(value >> 24) // }) { // this.section.write(byteData); // } // } // } // // Path: src/net/eiveo/utils/SmartByteBuffer.java // public class SmartByteBuffer { // private ByteBuffer byteBuffer; // // public int capacity() { // return this.byteBuffer.capacity(); // } // // public byte get() { // return this.byteBuffer.get(); // } // // public void get(byte[] dst) { // this.byteBuffer.get(dst); // } // // public int getInt() { // return this.byteBuffer.getInt(); // } // // public short getShort() { // return this.byteBuffer.getShort(); // } // // public String getString() { // String string = ""; // // while (true) { // byte character = this.get(); // if ((character & 0xff) == 0) { // break; // } else { // string += new String(new byte[] { character }); // } // } // // return string; // } // // public String getString(int index, int length) { // byte[] output = new byte[length]; // if (index > -1) { // this.position(index); // } // this.byteBuffer.get(output); // return new String(output); // } // // public void order(ByteOrder bo) { // this.byteBuffer.order(bo); // } // // public int position() { // return this.byteBuffer.position(); // } // // public void position(int newPosition) { // this.byteBuffer.position(newPosition); // } // // public static SmartByteBuffer wrap(byte[] array) { // SmartByteBuffer instance = new SmartByteBuffer(); // instance.byteBuffer = ByteBuffer.wrap(array); // return instance; // } // }
import java.util.LinkedHashMap; import java.util.Map; import java.util.Map.Entry; import net.eiveo.utils.SmartByteArrayOutputStream; import net.eiveo.utils.SmartByteBuffer;
package net.eiveo.original.sections; public class TNAM { public Map<Short, String> names = new LinkedHashMap<>();
// Path: src/net/eiveo/utils/SmartByteArrayOutputStream.java // public class SmartByteArrayOutputStream { // private List<ByteArrayOutputStream> sections = new ArrayList<>(); // private ByteArrayOutputStream section; // // public SmartByteArrayOutputStream() { // this.section = new ByteArrayOutputStream(); // this.sections.add(this.section); // } // // public void sectionStart() { // this.section = new ByteArrayOutputStream(); // this.sections.add(this.section); // } // // public byte[] sectionEnd() { // byte[] result = this.section.toByteArray(); // sections.remove(sections.size() - 1); // this.section = sections.get(sections.size() - 1); // return result; // } // // public byte[] toByteArray() { // return this.section.toByteArray(); // } // // public void write(String string) { // for (byte byteData : string.getBytes()) { // this.section.write(byteData); // } // } // // public void write(byte value) { // this.section.write(value); // } // // public void write(byte[] value) { // for (byte byteData : value) { // this.section.write(byteData); // } // } // // public void write(short value) { // for (byte byteData : new byte[] { // (byte) value, // (byte)(value >> 8) // }) { // this.section.write(byteData); // } // } // // public void write(int value) { // for (byte byteData : new byte[] { // (byte) value, // (byte)(value >> 8), // (byte)(value >> 16), // (byte)(value >> 24) // }) { // this.section.write(byteData); // } // } // } // // Path: src/net/eiveo/utils/SmartByteBuffer.java // public class SmartByteBuffer { // private ByteBuffer byteBuffer; // // public int capacity() { // return this.byteBuffer.capacity(); // } // // public byte get() { // return this.byteBuffer.get(); // } // // public void get(byte[] dst) { // this.byteBuffer.get(dst); // } // // public int getInt() { // return this.byteBuffer.getInt(); // } // // public short getShort() { // return this.byteBuffer.getShort(); // } // // public String getString() { // String string = ""; // // while (true) { // byte character = this.get(); // if ((character & 0xff) == 0) { // break; // } else { // string += new String(new byte[] { character }); // } // } // // return string; // } // // public String getString(int index, int length) { // byte[] output = new byte[length]; // if (index > -1) { // this.position(index); // } // this.byteBuffer.get(output); // return new String(output); // } // // public void order(ByteOrder bo) { // this.byteBuffer.order(bo); // } // // public int position() { // return this.byteBuffer.position(); // } // // public void position(int newPosition) { // this.byteBuffer.position(newPosition); // } // // public static SmartByteBuffer wrap(byte[] array) { // SmartByteBuffer instance = new SmartByteBuffer(); // instance.byteBuffer = ByteBuffer.wrap(array); // return instance; // } // } // Path: src/net/eiveo/original/sections/TNAM.java import java.util.LinkedHashMap; import java.util.Map; import java.util.Map.Entry; import net.eiveo.utils.SmartByteArrayOutputStream; import net.eiveo.utils.SmartByteBuffer; package net.eiveo.original.sections; public class TNAM { public Map<Short, String> names = new LinkedHashMap<>();
public static TNAM read(SmartByteBuffer data, boolean isYoda) throws Exception {
IceReaper/DesktopAdventuresToolkit
src/net/eiveo/original/sections/TNAM.java
// Path: src/net/eiveo/utils/SmartByteArrayOutputStream.java // public class SmartByteArrayOutputStream { // private List<ByteArrayOutputStream> sections = new ArrayList<>(); // private ByteArrayOutputStream section; // // public SmartByteArrayOutputStream() { // this.section = new ByteArrayOutputStream(); // this.sections.add(this.section); // } // // public void sectionStart() { // this.section = new ByteArrayOutputStream(); // this.sections.add(this.section); // } // // public byte[] sectionEnd() { // byte[] result = this.section.toByteArray(); // sections.remove(sections.size() - 1); // this.section = sections.get(sections.size() - 1); // return result; // } // // public byte[] toByteArray() { // return this.section.toByteArray(); // } // // public void write(String string) { // for (byte byteData : string.getBytes()) { // this.section.write(byteData); // } // } // // public void write(byte value) { // this.section.write(value); // } // // public void write(byte[] value) { // for (byte byteData : value) { // this.section.write(byteData); // } // } // // public void write(short value) { // for (byte byteData : new byte[] { // (byte) value, // (byte)(value >> 8) // }) { // this.section.write(byteData); // } // } // // public void write(int value) { // for (byte byteData : new byte[] { // (byte) value, // (byte)(value >> 8), // (byte)(value >> 16), // (byte)(value >> 24) // }) { // this.section.write(byteData); // } // } // } // // Path: src/net/eiveo/utils/SmartByteBuffer.java // public class SmartByteBuffer { // private ByteBuffer byteBuffer; // // public int capacity() { // return this.byteBuffer.capacity(); // } // // public byte get() { // return this.byteBuffer.get(); // } // // public void get(byte[] dst) { // this.byteBuffer.get(dst); // } // // public int getInt() { // return this.byteBuffer.getInt(); // } // // public short getShort() { // return this.byteBuffer.getShort(); // } // // public String getString() { // String string = ""; // // while (true) { // byte character = this.get(); // if ((character & 0xff) == 0) { // break; // } else { // string += new String(new byte[] { character }); // } // } // // return string; // } // // public String getString(int index, int length) { // byte[] output = new byte[length]; // if (index > -1) { // this.position(index); // } // this.byteBuffer.get(output); // return new String(output); // } // // public void order(ByteOrder bo) { // this.byteBuffer.order(bo); // } // // public int position() { // return this.byteBuffer.position(); // } // // public void position(int newPosition) { // this.byteBuffer.position(newPosition); // } // // public static SmartByteBuffer wrap(byte[] array) { // SmartByteBuffer instance = new SmartByteBuffer(); // instance.byteBuffer = ByteBuffer.wrap(array); // return instance; // } // }
import java.util.LinkedHashMap; import java.util.Map; import java.util.Map.Entry; import net.eiveo.utils.SmartByteArrayOutputStream; import net.eiveo.utils.SmartByteBuffer;
package net.eiveo.original.sections; public class TNAM { public Map<Short, String> names = new LinkedHashMap<>(); public static TNAM read(SmartByteBuffer data, boolean isYoda) throws Exception { TNAM instance = new TNAM(); int length = data.getInt(); int lengthStart = data.position(); while (true) { short tileId = data.getShort(); if (tileId == -1) { break; } else { instance.names.put(tileId, data.getString(-1, isYoda ? 24 : 16).trim()); } } if (lengthStart + length != data.position()) { throw new Exception("Length mismatch."); } return instance; }
// Path: src/net/eiveo/utils/SmartByteArrayOutputStream.java // public class SmartByteArrayOutputStream { // private List<ByteArrayOutputStream> sections = new ArrayList<>(); // private ByteArrayOutputStream section; // // public SmartByteArrayOutputStream() { // this.section = new ByteArrayOutputStream(); // this.sections.add(this.section); // } // // public void sectionStart() { // this.section = new ByteArrayOutputStream(); // this.sections.add(this.section); // } // // public byte[] sectionEnd() { // byte[] result = this.section.toByteArray(); // sections.remove(sections.size() - 1); // this.section = sections.get(sections.size() - 1); // return result; // } // // public byte[] toByteArray() { // return this.section.toByteArray(); // } // // public void write(String string) { // for (byte byteData : string.getBytes()) { // this.section.write(byteData); // } // } // // public void write(byte value) { // this.section.write(value); // } // // public void write(byte[] value) { // for (byte byteData : value) { // this.section.write(byteData); // } // } // // public void write(short value) { // for (byte byteData : new byte[] { // (byte) value, // (byte)(value >> 8) // }) { // this.section.write(byteData); // } // } // // public void write(int value) { // for (byte byteData : new byte[] { // (byte) value, // (byte)(value >> 8), // (byte)(value >> 16), // (byte)(value >> 24) // }) { // this.section.write(byteData); // } // } // } // // Path: src/net/eiveo/utils/SmartByteBuffer.java // public class SmartByteBuffer { // private ByteBuffer byteBuffer; // // public int capacity() { // return this.byteBuffer.capacity(); // } // // public byte get() { // return this.byteBuffer.get(); // } // // public void get(byte[] dst) { // this.byteBuffer.get(dst); // } // // public int getInt() { // return this.byteBuffer.getInt(); // } // // public short getShort() { // return this.byteBuffer.getShort(); // } // // public String getString() { // String string = ""; // // while (true) { // byte character = this.get(); // if ((character & 0xff) == 0) { // break; // } else { // string += new String(new byte[] { character }); // } // } // // return string; // } // // public String getString(int index, int length) { // byte[] output = new byte[length]; // if (index > -1) { // this.position(index); // } // this.byteBuffer.get(output); // return new String(output); // } // // public void order(ByteOrder bo) { // this.byteBuffer.order(bo); // } // // public int position() { // return this.byteBuffer.position(); // } // // public void position(int newPosition) { // this.byteBuffer.position(newPosition); // } // // public static SmartByteBuffer wrap(byte[] array) { // SmartByteBuffer instance = new SmartByteBuffer(); // instance.byteBuffer = ByteBuffer.wrap(array); // return instance; // } // } // Path: src/net/eiveo/original/sections/TNAM.java import java.util.LinkedHashMap; import java.util.Map; import java.util.Map.Entry; import net.eiveo.utils.SmartByteArrayOutputStream; import net.eiveo.utils.SmartByteBuffer; package net.eiveo.original.sections; public class TNAM { public Map<Short, String> names = new LinkedHashMap<>(); public static TNAM read(SmartByteBuffer data, boolean isYoda) throws Exception { TNAM instance = new TNAM(); int length = data.getInt(); int lengthStart = data.position(); while (true) { short tileId = data.getShort(); if (tileId == -1) { break; } else { instance.names.put(tileId, data.getString(-1, isYoda ? 24 : 16).trim()); } } if (lengthStart + length != data.position()) { throw new Exception("Length mismatch."); } return instance; }
public void write(SmartByteArrayOutputStream outputStream, boolean isYoda) {
IceReaper/DesktopAdventuresToolkit
src/net/eiveo/original/sections/VERS.java
// Path: src/net/eiveo/utils/SmartByteArrayOutputStream.java // public class SmartByteArrayOutputStream { // private List<ByteArrayOutputStream> sections = new ArrayList<>(); // private ByteArrayOutputStream section; // // public SmartByteArrayOutputStream() { // this.section = new ByteArrayOutputStream(); // this.sections.add(this.section); // } // // public void sectionStart() { // this.section = new ByteArrayOutputStream(); // this.sections.add(this.section); // } // // public byte[] sectionEnd() { // byte[] result = this.section.toByteArray(); // sections.remove(sections.size() - 1); // this.section = sections.get(sections.size() - 1); // return result; // } // // public byte[] toByteArray() { // return this.section.toByteArray(); // } // // public void write(String string) { // for (byte byteData : string.getBytes()) { // this.section.write(byteData); // } // } // // public void write(byte value) { // this.section.write(value); // } // // public void write(byte[] value) { // for (byte byteData : value) { // this.section.write(byteData); // } // } // // public void write(short value) { // for (byte byteData : new byte[] { // (byte) value, // (byte)(value >> 8) // }) { // this.section.write(byteData); // } // } // // public void write(int value) { // for (byte byteData : new byte[] { // (byte) value, // (byte)(value >> 8), // (byte)(value >> 16), // (byte)(value >> 24) // }) { // this.section.write(byteData); // } // } // } // // Path: src/net/eiveo/utils/SmartByteBuffer.java // public class SmartByteBuffer { // private ByteBuffer byteBuffer; // // public int capacity() { // return this.byteBuffer.capacity(); // } // // public byte get() { // return this.byteBuffer.get(); // } // // public void get(byte[] dst) { // this.byteBuffer.get(dst); // } // // public int getInt() { // return this.byteBuffer.getInt(); // } // // public short getShort() { // return this.byteBuffer.getShort(); // } // // public String getString() { // String string = ""; // // while (true) { // byte character = this.get(); // if ((character & 0xff) == 0) { // break; // } else { // string += new String(new byte[] { character }); // } // } // // return string; // } // // public String getString(int index, int length) { // byte[] output = new byte[length]; // if (index > -1) { // this.position(index); // } // this.byteBuffer.get(output); // return new String(output); // } // // public void order(ByteOrder bo) { // this.byteBuffer.order(bo); // } // // public int position() { // return this.byteBuffer.position(); // } // // public void position(int newPosition) { // this.byteBuffer.position(newPosition); // } // // public static SmartByteBuffer wrap(byte[] array) { // SmartByteBuffer instance = new SmartByteBuffer(); // instance.byteBuffer = ByteBuffer.wrap(array); // return instance; // } // }
import net.eiveo.utils.SmartByteArrayOutputStream; import net.eiveo.utils.SmartByteBuffer;
package net.eiveo.original.sections; public class VERS { public static VERS read(SmartByteBuffer data) throws Exception { VERS instance = new VERS(); if (data.getInt() != 512) { throw new Exception("Version mismatch."); } return instance; }
// Path: src/net/eiveo/utils/SmartByteArrayOutputStream.java // public class SmartByteArrayOutputStream { // private List<ByteArrayOutputStream> sections = new ArrayList<>(); // private ByteArrayOutputStream section; // // public SmartByteArrayOutputStream() { // this.section = new ByteArrayOutputStream(); // this.sections.add(this.section); // } // // public void sectionStart() { // this.section = new ByteArrayOutputStream(); // this.sections.add(this.section); // } // // public byte[] sectionEnd() { // byte[] result = this.section.toByteArray(); // sections.remove(sections.size() - 1); // this.section = sections.get(sections.size() - 1); // return result; // } // // public byte[] toByteArray() { // return this.section.toByteArray(); // } // // public void write(String string) { // for (byte byteData : string.getBytes()) { // this.section.write(byteData); // } // } // // public void write(byte value) { // this.section.write(value); // } // // public void write(byte[] value) { // for (byte byteData : value) { // this.section.write(byteData); // } // } // // public void write(short value) { // for (byte byteData : new byte[] { // (byte) value, // (byte)(value >> 8) // }) { // this.section.write(byteData); // } // } // // public void write(int value) { // for (byte byteData : new byte[] { // (byte) value, // (byte)(value >> 8), // (byte)(value >> 16), // (byte)(value >> 24) // }) { // this.section.write(byteData); // } // } // } // // Path: src/net/eiveo/utils/SmartByteBuffer.java // public class SmartByteBuffer { // private ByteBuffer byteBuffer; // // public int capacity() { // return this.byteBuffer.capacity(); // } // // public byte get() { // return this.byteBuffer.get(); // } // // public void get(byte[] dst) { // this.byteBuffer.get(dst); // } // // public int getInt() { // return this.byteBuffer.getInt(); // } // // public short getShort() { // return this.byteBuffer.getShort(); // } // // public String getString() { // String string = ""; // // while (true) { // byte character = this.get(); // if ((character & 0xff) == 0) { // break; // } else { // string += new String(new byte[] { character }); // } // } // // return string; // } // // public String getString(int index, int length) { // byte[] output = new byte[length]; // if (index > -1) { // this.position(index); // } // this.byteBuffer.get(output); // return new String(output); // } // // public void order(ByteOrder bo) { // this.byteBuffer.order(bo); // } // // public int position() { // return this.byteBuffer.position(); // } // // public void position(int newPosition) { // this.byteBuffer.position(newPosition); // } // // public static SmartByteBuffer wrap(byte[] array) { // SmartByteBuffer instance = new SmartByteBuffer(); // instance.byteBuffer = ByteBuffer.wrap(array); // return instance; // } // } // Path: src/net/eiveo/original/sections/VERS.java import net.eiveo.utils.SmartByteArrayOutputStream; import net.eiveo.utils.SmartByteBuffer; package net.eiveo.original.sections; public class VERS { public static VERS read(SmartByteBuffer data) throws Exception { VERS instance = new VERS(); if (data.getInt() != 512) { throw new Exception("Version mismatch."); } return instance; }
public void write(SmartByteArrayOutputStream outputStream) {
Expugn/S-argo
src/main/java/io/github/spugn/Sargo/CharacterScout/Memorial.java
// Path: src/main/java/io/github/spugn/Sargo/Objects/Banner.java // public class Banner // { // private int bannerID; // private String bannerName; // private int bannerType; // private int bannerWepType; // private ArrayList<Character> characters; // private ArrayList<Weapon> weapons; // // public int getBannerID() // { // return bannerID; // } // // public String getBannerName() // { // return bannerName; // } // // public int getBannerType() // { // return bannerType; // } // // public int getBannerWepType() // { // return bannerWepType; // } // // public ArrayList<Character> getCharacters() // { // return characters; // } // // public ArrayList<Weapon> getWeapons() // { // return weapons; // } // // public void setBannerID(int bannerID) // { // this.bannerID = bannerID; // } // // public void setBannerName(String bannerName) // { // this.bannerName = bannerName; // } // // public void setBannerType(int bannerType) // { // this.bannerType = bannerType; // } // // public void setBannerWepType(int bannerWepType) // { // this.bannerWepType = bannerWepType; // } // // public void setCharacters(ArrayList<Character> characters) // { // this.characters = characters; // } // // public void setWeapons(ArrayList<Weapon> weapons) // { // this.weapons = weapons; // } // // public String bannerTypeToString() // { // switch(bannerType) // { // case 0: // return "Normal"; // case 1: // return "Step Up"; // case 2: // return "Record Crystal"; // case 3: // return "Step Up v2"; // case 4: // return "Birthday Step Up"; // case 5: // return "Record Crystal v2"; // case 6: // return "Memorial Scout"; // case 7: // return "Step Up v3"; // case 8: // return "Record Crystal v3"; // case 9: // return "Event"; // case 10: // return "SAO Game 5th Anniversary Step Up"; // case 11: // return "Record Crystal v4"; // case 12: // return "Step Up v4"; // case 13: // return "Step Up v5"; // case 14: // return "SAO Game 5th Anniversary Step Up v2"; // case 15: // return "Step Up v6"; // case 16: // return "SAO Game 5th Anniversary Step Up v3"; // case 17: // return "Step Up v7"; // case 18: // return "Record Crystal v5"; // case 19: // return "Step Up v8"; // case 20: // return "Record Crystal v6"; // case 21: // return "Step Up v9"; // default: // return "Unknown"; // } // } // // @Override // public String toString() // { // return bannerID + ") " + bannerName; // } // } // // Path: src/main/java/io/github/spugn/Sargo/Objects/Character.java // public class Character // { // private String prefix; // private String name; // private int rarity; // private String imagePath; // // public Character() // { // prefix = ""; // name = "null"; // rarity = 1; // imagePath = ""; // } // // public void setPrefix(String prefix) // { // this.prefix = prefix; // } // // public void setName(String name) // { // this.name = name; // } // // public void setRarity(int rarity) // { // this.rarity = rarity; // } // // public void setImagePath(String imagePath) // { // this.imagePath = imagePath; // } // // public String getPrefix() // { // return prefix; // } // // public String getName() // { // return name; // } // // public int getRarity() // { // return rarity; // } // // public String getImagePath() // { // return imagePath; // } // // @Override // public String toString() // { // if (prefix.isEmpty()) // { // return rarity + "★ " + name; // } // return rarity + "★ [" + prefix + "] " + name; // } // // public String toStringNoName() // { // if (prefix.isEmpty()) // { // return rarity + "★ " + name; // } // return rarity + "★ [" + prefix + "]"; // } // }
import discord4j.core.object.entity.Message; import io.github.spugn.Sargo.Objects.Banner; import io.github.spugn.Sargo.Objects.Character; import java.util.List;
package io.github.spugn.Sargo.CharacterScout; /** * MEMORIAL CHARACTER SCOUT * <p> * Memorial Scouts are similar to {@link Normal} scouts where there are * no added benefits no matter how many scouts you do, however, * it has a special gimmick of only allowing single scouts priced * at 1 Memory Diamond per scout. * </p> * * @author S'pugn * @version 1.0 * @since v2.0 * @see Normal * @see CharacterScout */ public class Memorial extends CharacterScout { public Memorial(Message message, int bannerID, String choice, String discordID) { super(message, bannerID, choice, discordID); run(); } @Override protected void initBannerInfo() { /* MEMORIAL SCOUTS DO NOT NEED TO INITIALIZE ANY BANNER INFORMATION. */ } @Override protected void modifyScoutData() { // REMOVE 1.5% FROM PLATINUM (IT'S ORIGINAL VALUE) COPPER = COPPER + (PLATINUM - (PLATINUM / 1.5)); PLATINUM = PLATINUM / 1.5; singleScoutPrice = 1; } @Override protected void updateBannerData() { /* MEMORIAL SCOUTS DO NOT HAVE ANY BANNER DATA UPDATES. */ } @Override
// Path: src/main/java/io/github/spugn/Sargo/Objects/Banner.java // public class Banner // { // private int bannerID; // private String bannerName; // private int bannerType; // private int bannerWepType; // private ArrayList<Character> characters; // private ArrayList<Weapon> weapons; // // public int getBannerID() // { // return bannerID; // } // // public String getBannerName() // { // return bannerName; // } // // public int getBannerType() // { // return bannerType; // } // // public int getBannerWepType() // { // return bannerWepType; // } // // public ArrayList<Character> getCharacters() // { // return characters; // } // // public ArrayList<Weapon> getWeapons() // { // return weapons; // } // // public void setBannerID(int bannerID) // { // this.bannerID = bannerID; // } // // public void setBannerName(String bannerName) // { // this.bannerName = bannerName; // } // // public void setBannerType(int bannerType) // { // this.bannerType = bannerType; // } // // public void setBannerWepType(int bannerWepType) // { // this.bannerWepType = bannerWepType; // } // // public void setCharacters(ArrayList<Character> characters) // { // this.characters = characters; // } // // public void setWeapons(ArrayList<Weapon> weapons) // { // this.weapons = weapons; // } // // public String bannerTypeToString() // { // switch(bannerType) // { // case 0: // return "Normal"; // case 1: // return "Step Up"; // case 2: // return "Record Crystal"; // case 3: // return "Step Up v2"; // case 4: // return "Birthday Step Up"; // case 5: // return "Record Crystal v2"; // case 6: // return "Memorial Scout"; // case 7: // return "Step Up v3"; // case 8: // return "Record Crystal v3"; // case 9: // return "Event"; // case 10: // return "SAO Game 5th Anniversary Step Up"; // case 11: // return "Record Crystal v4"; // case 12: // return "Step Up v4"; // case 13: // return "Step Up v5"; // case 14: // return "SAO Game 5th Anniversary Step Up v2"; // case 15: // return "Step Up v6"; // case 16: // return "SAO Game 5th Anniversary Step Up v3"; // case 17: // return "Step Up v7"; // case 18: // return "Record Crystal v5"; // case 19: // return "Step Up v8"; // case 20: // return "Record Crystal v6"; // case 21: // return "Step Up v9"; // default: // return "Unknown"; // } // } // // @Override // public String toString() // { // return bannerID + ") " + bannerName; // } // } // // Path: src/main/java/io/github/spugn/Sargo/Objects/Character.java // public class Character // { // private String prefix; // private String name; // private int rarity; // private String imagePath; // // public Character() // { // prefix = ""; // name = "null"; // rarity = 1; // imagePath = ""; // } // // public void setPrefix(String prefix) // { // this.prefix = prefix; // } // // public void setName(String name) // { // this.name = name; // } // // public void setRarity(int rarity) // { // this.rarity = rarity; // } // // public void setImagePath(String imagePath) // { // this.imagePath = imagePath; // } // // public String getPrefix() // { // return prefix; // } // // public String getName() // { // return name; // } // // public int getRarity() // { // return rarity; // } // // public String getImagePath() // { // return imagePath; // } // // @Override // public String toString() // { // if (prefix.isEmpty()) // { // return rarity + "★ " + name; // } // return rarity + "★ [" + prefix + "] " + name; // } // // public String toStringNoName() // { // if (prefix.isEmpty()) // { // return rarity + "★ " + name; // } // return rarity + "★ [" + prefix + "]"; // } // } // Path: src/main/java/io/github/spugn/Sargo/CharacterScout/Memorial.java import discord4j.core.object.entity.Message; import io.github.spugn.Sargo.Objects.Banner; import io.github.spugn.Sargo.Objects.Character; import java.util.List; package io.github.spugn.Sargo.CharacterScout; /** * MEMORIAL CHARACTER SCOUT * <p> * Memorial Scouts are similar to {@link Normal} scouts where there are * no added benefits no matter how many scouts you do, however, * it has a special gimmick of only allowing single scouts priced * at 1 Memory Diamond per scout. * </p> * * @author S'pugn * @version 1.0 * @since v2.0 * @see Normal * @see CharacterScout */ public class Memorial extends CharacterScout { public Memorial(Message message, int bannerID, String choice, String discordID) { super(message, bannerID, choice, discordID); run(); } @Override protected void initBannerInfo() { /* MEMORIAL SCOUTS DO NOT NEED TO INITIALIZE ANY BANNER INFORMATION. */ } @Override protected void modifyScoutData() { // REMOVE 1.5% FROM PLATINUM (IT'S ORIGINAL VALUE) COPPER = COPPER + (PLATINUM - (PLATINUM / 1.5)); PLATINUM = PLATINUM / 1.5; singleScoutPrice = 1; } @Override protected void updateBannerData() { /* MEMORIAL SCOUTS DO NOT HAVE ANY BANNER DATA UPDATES. */ } @Override
protected Character randGoldCharacter()
Expugn/S-argo
src/main/java/io/github/spugn/Sargo/CharacterScout/Event.java
// Path: src/main/java/io/github/spugn/Sargo/Objects/Character.java // public class Character // { // private String prefix; // private String name; // private int rarity; // private String imagePath; // // public Character() // { // prefix = ""; // name = "null"; // rarity = 1; // imagePath = ""; // } // // public void setPrefix(String prefix) // { // this.prefix = prefix; // } // // public void setName(String name) // { // this.name = name; // } // // public void setRarity(int rarity) // { // this.rarity = rarity; // } // // public void setImagePath(String imagePath) // { // this.imagePath = imagePath; // } // // public String getPrefix() // { // return prefix; // } // // public String getName() // { // return name; // } // // public int getRarity() // { // return rarity; // } // // public String getImagePath() // { // return imagePath; // } // // @Override // public String toString() // { // if (prefix.isEmpty()) // { // return rarity + "★ " + name; // } // return rarity + "★ [" + prefix + "] " + name; // } // // public String toStringNoName() // { // if (prefix.isEmpty()) // { // return rarity + "★ " + name; // } // return rarity + "★ [" + prefix + "]"; // } // }
import discord4j.core.object.entity.Message; import io.github.spugn.Sargo.Objects.Character;
package io.github.spugn.Sargo.CharacterScout; public class Event extends CharacterScout { public Event(Message message, int bannerID, String choice, String discordID) { super(message, bannerID, choice, discordID); run(); } @Override protected void initBannerInfo() { /* EVENT SCOUTS DO NOT NEED TO INITIALIZE ANY BANNER INFORMATION. */ } @Override protected void modifyScoutData() { singleScoutPrice = 0; } @Override protected void updateBannerData() { /* EVENT SCOUTS DO NOT HAVE ANY BANNER DATA UPDATES. */ } @Override
// Path: src/main/java/io/github/spugn/Sargo/Objects/Character.java // public class Character // { // private String prefix; // private String name; // private int rarity; // private String imagePath; // // public Character() // { // prefix = ""; // name = "null"; // rarity = 1; // imagePath = ""; // } // // public void setPrefix(String prefix) // { // this.prefix = prefix; // } // // public void setName(String name) // { // this.name = name; // } // // public void setRarity(int rarity) // { // this.rarity = rarity; // } // // public void setImagePath(String imagePath) // { // this.imagePath = imagePath; // } // // public String getPrefix() // { // return prefix; // } // // public String getName() // { // return name; // } // // public int getRarity() // { // return rarity; // } // // public String getImagePath() // { // return imagePath; // } // // @Override // public String toString() // { // if (prefix.isEmpty()) // { // return rarity + "★ " + name; // } // return rarity + "★ [" + prefix + "] " + name; // } // // public String toStringNoName() // { // if (prefix.isEmpty()) // { // return rarity + "★ " + name; // } // return rarity + "★ [" + prefix + "]"; // } // } // Path: src/main/java/io/github/spugn/Sargo/CharacterScout/Event.java import discord4j.core.object.entity.Message; import io.github.spugn.Sargo.Objects.Character; package io.github.spugn.Sargo.CharacterScout; public class Event extends CharacterScout { public Event(Message message, int bannerID, String choice, String discordID) { super(message, bannerID, choice, discordID); run(); } @Override protected void initBannerInfo() { /* EVENT SCOUTS DO NOT NEED TO INITIALIZE ANY BANNER INFORMATION. */ } @Override protected void modifyScoutData() { singleScoutPrice = 0; } @Override protected void updateBannerData() { /* EVENT SCOUTS DO NOT HAVE ANY BANNER DATA UPDATES. */ } @Override
protected Character randGoldCharacter()
Expugn/S-argo
src/main/java/io/github/spugn/Sargo/CharacterScout/StepUp.java
// Path: src/main/java/io/github/spugn/Sargo/Objects/Banner.java // public class Banner // { // private int bannerID; // private String bannerName; // private int bannerType; // private int bannerWepType; // private ArrayList<Character> characters; // private ArrayList<Weapon> weapons; // // public int getBannerID() // { // return bannerID; // } // // public String getBannerName() // { // return bannerName; // } // // public int getBannerType() // { // return bannerType; // } // // public int getBannerWepType() // { // return bannerWepType; // } // // public ArrayList<Character> getCharacters() // { // return characters; // } // // public ArrayList<Weapon> getWeapons() // { // return weapons; // } // // public void setBannerID(int bannerID) // { // this.bannerID = bannerID; // } // // public void setBannerName(String bannerName) // { // this.bannerName = bannerName; // } // // public void setBannerType(int bannerType) // { // this.bannerType = bannerType; // } // // public void setBannerWepType(int bannerWepType) // { // this.bannerWepType = bannerWepType; // } // // public void setCharacters(ArrayList<Character> characters) // { // this.characters = characters; // } // // public void setWeapons(ArrayList<Weapon> weapons) // { // this.weapons = weapons; // } // // public String bannerTypeToString() // { // switch(bannerType) // { // case 0: // return "Normal"; // case 1: // return "Step Up"; // case 2: // return "Record Crystal"; // case 3: // return "Step Up v2"; // case 4: // return "Birthday Step Up"; // case 5: // return "Record Crystal v2"; // case 6: // return "Memorial Scout"; // case 7: // return "Step Up v3"; // case 8: // return "Record Crystal v3"; // case 9: // return "Event"; // case 10: // return "SAO Game 5th Anniversary Step Up"; // case 11: // return "Record Crystal v4"; // case 12: // return "Step Up v4"; // case 13: // return "Step Up v5"; // case 14: // return "SAO Game 5th Anniversary Step Up v2"; // case 15: // return "Step Up v6"; // case 16: // return "SAO Game 5th Anniversary Step Up v3"; // case 17: // return "Step Up v7"; // case 18: // return "Record Crystal v5"; // case 19: // return "Step Up v8"; // case 20: // return "Record Crystal v6"; // case 21: // return "Step Up v9"; // default: // return "Unknown"; // } // } // // @Override // public String toString() // { // return bannerID + ") " + bannerName; // } // } // // Path: src/main/java/io/github/spugn/Sargo/Objects/Character.java // public class Character // { // private String prefix; // private String name; // private int rarity; // private String imagePath; // // public Character() // { // prefix = ""; // name = "null"; // rarity = 1; // imagePath = ""; // } // // public void setPrefix(String prefix) // { // this.prefix = prefix; // } // // public void setName(String name) // { // this.name = name; // } // // public void setRarity(int rarity) // { // this.rarity = rarity; // } // // public void setImagePath(String imagePath) // { // this.imagePath = imagePath; // } // // public String getPrefix() // { // return prefix; // } // // public String getName() // { // return name; // } // // public int getRarity() // { // return rarity; // } // // public String getImagePath() // { // return imagePath; // } // // @Override // public String toString() // { // if (prefix.isEmpty()) // { // return rarity + "★ " + name; // } // return rarity + "★ [" + prefix + "] " + name; // } // // public String toStringNoName() // { // if (prefix.isEmpty()) // { // return rarity + "★ " + name; // } // return rarity + "★ [" + prefix + "]"; // } // }
import discord4j.core.object.entity.Message; import io.github.spugn.Sargo.Objects.Banner; import io.github.spugn.Sargo.Objects.Character; import java.util.List;
multiScoutPrice = 200; COPPER = COPPER - ((GOLD * 1.5) - GOLD) ; GOLD = GOLD * 1.5; break; case 5: COPPER = COPPER - ((GOLD * 2.0) - GOLD); GOLD = GOLD * 2.0; break; default: break; } } } @Override protected void updateBannerData() { int currentStep = USER.getBannerData(SELECTED_BANNER.getBannerName()); currentStep++; if (currentStep > 5) { USER.changeValue(SELECTED_BANNER.getBannerName(), 1); } else { USER.changeValue(SELECTED_BANNER.getBannerName(), currentStep); } } @Override
// Path: src/main/java/io/github/spugn/Sargo/Objects/Banner.java // public class Banner // { // private int bannerID; // private String bannerName; // private int bannerType; // private int bannerWepType; // private ArrayList<Character> characters; // private ArrayList<Weapon> weapons; // // public int getBannerID() // { // return bannerID; // } // // public String getBannerName() // { // return bannerName; // } // // public int getBannerType() // { // return bannerType; // } // // public int getBannerWepType() // { // return bannerWepType; // } // // public ArrayList<Character> getCharacters() // { // return characters; // } // // public ArrayList<Weapon> getWeapons() // { // return weapons; // } // // public void setBannerID(int bannerID) // { // this.bannerID = bannerID; // } // // public void setBannerName(String bannerName) // { // this.bannerName = bannerName; // } // // public void setBannerType(int bannerType) // { // this.bannerType = bannerType; // } // // public void setBannerWepType(int bannerWepType) // { // this.bannerWepType = bannerWepType; // } // // public void setCharacters(ArrayList<Character> characters) // { // this.characters = characters; // } // // public void setWeapons(ArrayList<Weapon> weapons) // { // this.weapons = weapons; // } // // public String bannerTypeToString() // { // switch(bannerType) // { // case 0: // return "Normal"; // case 1: // return "Step Up"; // case 2: // return "Record Crystal"; // case 3: // return "Step Up v2"; // case 4: // return "Birthday Step Up"; // case 5: // return "Record Crystal v2"; // case 6: // return "Memorial Scout"; // case 7: // return "Step Up v3"; // case 8: // return "Record Crystal v3"; // case 9: // return "Event"; // case 10: // return "SAO Game 5th Anniversary Step Up"; // case 11: // return "Record Crystal v4"; // case 12: // return "Step Up v4"; // case 13: // return "Step Up v5"; // case 14: // return "SAO Game 5th Anniversary Step Up v2"; // case 15: // return "Step Up v6"; // case 16: // return "SAO Game 5th Anniversary Step Up v3"; // case 17: // return "Step Up v7"; // case 18: // return "Record Crystal v5"; // case 19: // return "Step Up v8"; // case 20: // return "Record Crystal v6"; // case 21: // return "Step Up v9"; // default: // return "Unknown"; // } // } // // @Override // public String toString() // { // return bannerID + ") " + bannerName; // } // } // // Path: src/main/java/io/github/spugn/Sargo/Objects/Character.java // public class Character // { // private String prefix; // private String name; // private int rarity; // private String imagePath; // // public Character() // { // prefix = ""; // name = "null"; // rarity = 1; // imagePath = ""; // } // // public void setPrefix(String prefix) // { // this.prefix = prefix; // } // // public void setName(String name) // { // this.name = name; // } // // public void setRarity(int rarity) // { // this.rarity = rarity; // } // // public void setImagePath(String imagePath) // { // this.imagePath = imagePath; // } // // public String getPrefix() // { // return prefix; // } // // public String getName() // { // return name; // } // // public int getRarity() // { // return rarity; // } // // public String getImagePath() // { // return imagePath; // } // // @Override // public String toString() // { // if (prefix.isEmpty()) // { // return rarity + "★ " + name; // } // return rarity + "★ [" + prefix + "] " + name; // } // // public String toStringNoName() // { // if (prefix.isEmpty()) // { // return rarity + "★ " + name; // } // return rarity + "★ [" + prefix + "]"; // } // } // Path: src/main/java/io/github/spugn/Sargo/CharacterScout/StepUp.java import discord4j.core.object.entity.Message; import io.github.spugn.Sargo.Objects.Banner; import io.github.spugn.Sargo.Objects.Character; import java.util.List; multiScoutPrice = 200; COPPER = COPPER - ((GOLD * 1.5) - GOLD) ; GOLD = GOLD * 1.5; break; case 5: COPPER = COPPER - ((GOLD * 2.0) - GOLD); GOLD = GOLD * 2.0; break; default: break; } } } @Override protected void updateBannerData() { int currentStep = USER.getBannerData(SELECTED_BANNER.getBannerName()); currentStep++; if (currentStep > 5) { USER.changeValue(SELECTED_BANNER.getBannerName(), 1); } else { USER.changeValue(SELECTED_BANNER.getBannerName(), currentStep); } } @Override
protected Character randGoldCharacter()
Expugn/S-argo
src/main/java/io/github/spugn/Sargo/CharacterScout/StepUp.java
// Path: src/main/java/io/github/spugn/Sargo/Objects/Banner.java // public class Banner // { // private int bannerID; // private String bannerName; // private int bannerType; // private int bannerWepType; // private ArrayList<Character> characters; // private ArrayList<Weapon> weapons; // // public int getBannerID() // { // return bannerID; // } // // public String getBannerName() // { // return bannerName; // } // // public int getBannerType() // { // return bannerType; // } // // public int getBannerWepType() // { // return bannerWepType; // } // // public ArrayList<Character> getCharacters() // { // return characters; // } // // public ArrayList<Weapon> getWeapons() // { // return weapons; // } // // public void setBannerID(int bannerID) // { // this.bannerID = bannerID; // } // // public void setBannerName(String bannerName) // { // this.bannerName = bannerName; // } // // public void setBannerType(int bannerType) // { // this.bannerType = bannerType; // } // // public void setBannerWepType(int bannerWepType) // { // this.bannerWepType = bannerWepType; // } // // public void setCharacters(ArrayList<Character> characters) // { // this.characters = characters; // } // // public void setWeapons(ArrayList<Weapon> weapons) // { // this.weapons = weapons; // } // // public String bannerTypeToString() // { // switch(bannerType) // { // case 0: // return "Normal"; // case 1: // return "Step Up"; // case 2: // return "Record Crystal"; // case 3: // return "Step Up v2"; // case 4: // return "Birthday Step Up"; // case 5: // return "Record Crystal v2"; // case 6: // return "Memorial Scout"; // case 7: // return "Step Up v3"; // case 8: // return "Record Crystal v3"; // case 9: // return "Event"; // case 10: // return "SAO Game 5th Anniversary Step Up"; // case 11: // return "Record Crystal v4"; // case 12: // return "Step Up v4"; // case 13: // return "Step Up v5"; // case 14: // return "SAO Game 5th Anniversary Step Up v2"; // case 15: // return "Step Up v6"; // case 16: // return "SAO Game 5th Anniversary Step Up v3"; // case 17: // return "Step Up v7"; // case 18: // return "Record Crystal v5"; // case 19: // return "Step Up v8"; // case 20: // return "Record Crystal v6"; // case 21: // return "Step Up v9"; // default: // return "Unknown"; // } // } // // @Override // public String toString() // { // return bannerID + ") " + bannerName; // } // } // // Path: src/main/java/io/github/spugn/Sargo/Objects/Character.java // public class Character // { // private String prefix; // private String name; // private int rarity; // private String imagePath; // // public Character() // { // prefix = ""; // name = "null"; // rarity = 1; // imagePath = ""; // } // // public void setPrefix(String prefix) // { // this.prefix = prefix; // } // // public void setName(String name) // { // this.name = name; // } // // public void setRarity(int rarity) // { // this.rarity = rarity; // } // // public void setImagePath(String imagePath) // { // this.imagePath = imagePath; // } // // public String getPrefix() // { // return prefix; // } // // public String getName() // { // return name; // } // // public int getRarity() // { // return rarity; // } // // public String getImagePath() // { // return imagePath; // } // // @Override // public String toString() // { // if (prefix.isEmpty()) // { // return rarity + "★ " + name; // } // return rarity + "★ [" + prefix + "] " + name; // } // // public String toStringNoName() // { // if (prefix.isEmpty()) // { // return rarity + "★ " + name; // } // return rarity + "★ [" + prefix + "]"; // } // }
import discord4j.core.object.entity.Message; import io.github.spugn.Sargo.Objects.Banner; import io.github.spugn.Sargo.Objects.Character; import java.util.List;
break; case 5: COPPER = COPPER - ((GOLD * 2.0) - GOLD); GOLD = GOLD * 2.0; break; default: break; } } } @Override protected void updateBannerData() { int currentStep = USER.getBannerData(SELECTED_BANNER.getBannerName()); currentStep++; if (currentStep > 5) { USER.changeValue(SELECTED_BANNER.getBannerName(), 1); } else { USER.changeValue(SELECTED_BANNER.getBannerName(), currentStep); } } @Override protected Character randGoldCharacter() { int randIndex = GOLD_BANNERS.get(RNG.nextInt(GOLD_BANNERS.size()));
// Path: src/main/java/io/github/spugn/Sargo/Objects/Banner.java // public class Banner // { // private int bannerID; // private String bannerName; // private int bannerType; // private int bannerWepType; // private ArrayList<Character> characters; // private ArrayList<Weapon> weapons; // // public int getBannerID() // { // return bannerID; // } // // public String getBannerName() // { // return bannerName; // } // // public int getBannerType() // { // return bannerType; // } // // public int getBannerWepType() // { // return bannerWepType; // } // // public ArrayList<Character> getCharacters() // { // return characters; // } // // public ArrayList<Weapon> getWeapons() // { // return weapons; // } // // public void setBannerID(int bannerID) // { // this.bannerID = bannerID; // } // // public void setBannerName(String bannerName) // { // this.bannerName = bannerName; // } // // public void setBannerType(int bannerType) // { // this.bannerType = bannerType; // } // // public void setBannerWepType(int bannerWepType) // { // this.bannerWepType = bannerWepType; // } // // public void setCharacters(ArrayList<Character> characters) // { // this.characters = characters; // } // // public void setWeapons(ArrayList<Weapon> weapons) // { // this.weapons = weapons; // } // // public String bannerTypeToString() // { // switch(bannerType) // { // case 0: // return "Normal"; // case 1: // return "Step Up"; // case 2: // return "Record Crystal"; // case 3: // return "Step Up v2"; // case 4: // return "Birthday Step Up"; // case 5: // return "Record Crystal v2"; // case 6: // return "Memorial Scout"; // case 7: // return "Step Up v3"; // case 8: // return "Record Crystal v3"; // case 9: // return "Event"; // case 10: // return "SAO Game 5th Anniversary Step Up"; // case 11: // return "Record Crystal v4"; // case 12: // return "Step Up v4"; // case 13: // return "Step Up v5"; // case 14: // return "SAO Game 5th Anniversary Step Up v2"; // case 15: // return "Step Up v6"; // case 16: // return "SAO Game 5th Anniversary Step Up v3"; // case 17: // return "Step Up v7"; // case 18: // return "Record Crystal v5"; // case 19: // return "Step Up v8"; // case 20: // return "Record Crystal v6"; // case 21: // return "Step Up v9"; // default: // return "Unknown"; // } // } // // @Override // public String toString() // { // return bannerID + ") " + bannerName; // } // } // // Path: src/main/java/io/github/spugn/Sargo/Objects/Character.java // public class Character // { // private String prefix; // private String name; // private int rarity; // private String imagePath; // // public Character() // { // prefix = ""; // name = "null"; // rarity = 1; // imagePath = ""; // } // // public void setPrefix(String prefix) // { // this.prefix = prefix; // } // // public void setName(String name) // { // this.name = name; // } // // public void setRarity(int rarity) // { // this.rarity = rarity; // } // // public void setImagePath(String imagePath) // { // this.imagePath = imagePath; // } // // public String getPrefix() // { // return prefix; // } // // public String getName() // { // return name; // } // // public int getRarity() // { // return rarity; // } // // public String getImagePath() // { // return imagePath; // } // // @Override // public String toString() // { // if (prefix.isEmpty()) // { // return rarity + "★ " + name; // } // return rarity + "★ [" + prefix + "] " + name; // } // // public String toStringNoName() // { // if (prefix.isEmpty()) // { // return rarity + "★ " + name; // } // return rarity + "★ [" + prefix + "]"; // } // } // Path: src/main/java/io/github/spugn/Sargo/CharacterScout/StepUp.java import discord4j.core.object.entity.Message; import io.github.spugn.Sargo.Objects.Banner; import io.github.spugn.Sargo.Objects.Character; import java.util.List; break; case 5: COPPER = COPPER - ((GOLD * 2.0) - GOLD); GOLD = GOLD * 2.0; break; default: break; } } } @Override protected void updateBannerData() { int currentStep = USER.getBannerData(SELECTED_BANNER.getBannerName()); currentStep++; if (currentStep > 5) { USER.changeValue(SELECTED_BANNER.getBannerName(), 1); } else { USER.changeValue(SELECTED_BANNER.getBannerName(), currentStep); } } @Override protected Character randGoldCharacter() { int randIndex = GOLD_BANNERS.get(RNG.nextInt(GOLD_BANNERS.size()));
Banner randBanner = BANNERS.get(randIndex - 1);
Expugn/S-argo
src/main/java/io/github/spugn/Sargo/TicketScout/Normal.java
// Path: src/main/java/io/github/spugn/Sargo/Objects/Item.java // public class Item // { // private String name; // private int quantity; // private int value; // private String imagePath; // // public Item() // { // name = "null"; // quantity = 0; // value = -1; // imagePath = ""; // } // // public Item(String name, int quantity, int value) // { // this.name = name; // this.quantity = quantity; // this.value = value; // imagePath = ""; // } // // public void setName(String name) // { // this.name = name; // } // // public void setQuantity(int quantity) // { // this.quantity = quantity; // } // // public void setImagePath(String imagePath) // { // this.imagePath = imagePath; // } // // public String getName() // { // return name; // } // // public String getImagePath() // { // if (imagePath.isEmpty()) // { // return "images/Items/" + name.replaceAll(" ", "_") + ".png"; // } // return imagePath; // } // // public int getQuantity() // { // return quantity; // } // // public int getValue() // { // return value; // } // // @Override // public String toString() // { // return name + " x" + quantity; // } // } // // Path: src/main/java/io/github/spugn/Sargo/Utilities/GitHubImage.java // public class GitHubImage // { // private String filePath; // private final String GITHUB_IMAGE; // // public GitHubImage(String filePath) // { // GITHUB_IMAGE = LoginSettingsParser.getGitHubRepoURL(); // this.filePath = filePath; // } // // public String getURL() // { // String url = GITHUB_IMAGE + filePath; // // /* REPLACE ALL SPACES WITH %20 */ // url = url.replaceAll(" ", "%20"); // // /* REPLACE ALL ★ WITH %E2%98%85 */ // url = url.replaceAll("★", "%E2%98%85"); // // return url; // } // }
import discord4j.core.object.entity.Message; import io.github.spugn.Sargo.Objects.Item; import io.github.spugn.Sargo.Utilities.GitHubImage;
package io.github.spugn.Sargo.TicketScout; public class Normal extends TicketScout { public Normal(Message message, String choice, String discordID) { super(message, choice, discordID); run(); } @Override protected void initItems() {
// Path: src/main/java/io/github/spugn/Sargo/Objects/Item.java // public class Item // { // private String name; // private int quantity; // private int value; // private String imagePath; // // public Item() // { // name = "null"; // quantity = 0; // value = -1; // imagePath = ""; // } // // public Item(String name, int quantity, int value) // { // this.name = name; // this.quantity = quantity; // this.value = value; // imagePath = ""; // } // // public void setName(String name) // { // this.name = name; // } // // public void setQuantity(int quantity) // { // this.quantity = quantity; // } // // public void setImagePath(String imagePath) // { // this.imagePath = imagePath; // } // // public String getName() // { // return name; // } // // public String getImagePath() // { // if (imagePath.isEmpty()) // { // return "images/Items/" + name.replaceAll(" ", "_") + ".png"; // } // return imagePath; // } // // public int getQuantity() // { // return quantity; // } // // public int getValue() // { // return value; // } // // @Override // public String toString() // { // return name + " x" + quantity; // } // } // // Path: src/main/java/io/github/spugn/Sargo/Utilities/GitHubImage.java // public class GitHubImage // { // private String filePath; // private final String GITHUB_IMAGE; // // public GitHubImage(String filePath) // { // GITHUB_IMAGE = LoginSettingsParser.getGitHubRepoURL(); // this.filePath = filePath; // } // // public String getURL() // { // String url = GITHUB_IMAGE + filePath; // // /* REPLACE ALL SPACES WITH %20 */ // url = url.replaceAll(" ", "%20"); // // /* REPLACE ALL ★ WITH %E2%98%85 */ // url = url.replaceAll("★", "%E2%98%85"); // // return url; // } // } // Path: src/main/java/io/github/spugn/Sargo/TicketScout/Normal.java import discord4j.core.object.entity.Message; import io.github.spugn.Sargo.Objects.Item; import io.github.spugn.Sargo.Utilities.GitHubImage; package io.github.spugn.Sargo.TicketScout; public class Normal extends TicketScout { public Normal(Message message, String choice, String discordID) { super(message, choice, discordID); run(); } @Override protected void initItems() {
attributeItemsList.add(new Item("HP Shard", 50, 2500));
Expugn/S-argo
src/main/java/io/github/spugn/Sargo/TicketScout/Normal.java
// Path: src/main/java/io/github/spugn/Sargo/Objects/Item.java // public class Item // { // private String name; // private int quantity; // private int value; // private String imagePath; // // public Item() // { // name = "null"; // quantity = 0; // value = -1; // imagePath = ""; // } // // public Item(String name, int quantity, int value) // { // this.name = name; // this.quantity = quantity; // this.value = value; // imagePath = ""; // } // // public void setName(String name) // { // this.name = name; // } // // public void setQuantity(int quantity) // { // this.quantity = quantity; // } // // public void setImagePath(String imagePath) // { // this.imagePath = imagePath; // } // // public String getName() // { // return name; // } // // public String getImagePath() // { // if (imagePath.isEmpty()) // { // return "images/Items/" + name.replaceAll(" ", "_") + ".png"; // } // return imagePath; // } // // public int getQuantity() // { // return quantity; // } // // public int getValue() // { // return value; // } // // @Override // public String toString() // { // return name + " x" + quantity; // } // } // // Path: src/main/java/io/github/spugn/Sargo/Utilities/GitHubImage.java // public class GitHubImage // { // private String filePath; // private final String GITHUB_IMAGE; // // public GitHubImage(String filePath) // { // GITHUB_IMAGE = LoginSettingsParser.getGitHubRepoURL(); // this.filePath = filePath; // } // // public String getURL() // { // String url = GITHUB_IMAGE + filePath; // // /* REPLACE ALL SPACES WITH %20 */ // url = url.replaceAll(" ", "%20"); // // /* REPLACE ALL ★ WITH %E2%98%85 */ // url = url.replaceAll("★", "%E2%98%85"); // // return url; // } // }
import discord4j.core.object.entity.Message; import io.github.spugn.Sargo.Objects.Item; import io.github.spugn.Sargo.Utilities.GitHubImage;
/* MEDALLIONS AND LV. 80 KEY */ else if (value == 3) { item = medallionsAndKeyList.get(RNG.nextInt(medallionsAndKeyList.size())); } /* STARDUST */ else if (value == 4) { item = new Item("Stardust (Medium)", 10, 500); } /* RAINBOW ESSENCE */ else if (value == 5) { item = new Item("Rainbow Essence", 1, -1); } /* COL */ else { item = new Item("Col", 50000, 50000); } giveCol(item); return item; } @Override protected void setupScoutMenu() { if (!SIMPLE_MESSAGE) {
// Path: src/main/java/io/github/spugn/Sargo/Objects/Item.java // public class Item // { // private String name; // private int quantity; // private int value; // private String imagePath; // // public Item() // { // name = "null"; // quantity = 0; // value = -1; // imagePath = ""; // } // // public Item(String name, int quantity, int value) // { // this.name = name; // this.quantity = quantity; // this.value = value; // imagePath = ""; // } // // public void setName(String name) // { // this.name = name; // } // // public void setQuantity(int quantity) // { // this.quantity = quantity; // } // // public void setImagePath(String imagePath) // { // this.imagePath = imagePath; // } // // public String getName() // { // return name; // } // // public String getImagePath() // { // if (imagePath.isEmpty()) // { // return "images/Items/" + name.replaceAll(" ", "_") + ".png"; // } // return imagePath; // } // // public int getQuantity() // { // return quantity; // } // // public int getValue() // { // return value; // } // // @Override // public String toString() // { // return name + " x" + quantity; // } // } // // Path: src/main/java/io/github/spugn/Sargo/Utilities/GitHubImage.java // public class GitHubImage // { // private String filePath; // private final String GITHUB_IMAGE; // // public GitHubImage(String filePath) // { // GITHUB_IMAGE = LoginSettingsParser.getGitHubRepoURL(); // this.filePath = filePath; // } // // public String getURL() // { // String url = GITHUB_IMAGE + filePath; // // /* REPLACE ALL SPACES WITH %20 */ // url = url.replaceAll(" ", "%20"); // // /* REPLACE ALL ★ WITH %E2%98%85 */ // url = url.replaceAll("★", "%E2%98%85"); // // return url; // } // } // Path: src/main/java/io/github/spugn/Sargo/TicketScout/Normal.java import discord4j.core.object.entity.Message; import io.github.spugn.Sargo.Objects.Item; import io.github.spugn.Sargo.Utilities.GitHubImage; /* MEDALLIONS AND LV. 80 KEY */ else if (value == 3) { item = medallionsAndKeyList.get(RNG.nextInt(medallionsAndKeyList.size())); } /* STARDUST */ else if (value == 4) { item = new Item("Stardust (Medium)", 10, 500); } /* RAINBOW ESSENCE */ else if (value == 5) { item = new Item("Rainbow Essence", 1, -1); } /* COL */ else { item = new Item("Col", 50000, 50000); } giveCol(item); return item; } @Override protected void setupScoutMenu() { if (!SIMPLE_MESSAGE) {
sMenu = sMenu.andThen(s -> s.setAuthor("Normal Ticket Scout", "", new GitHubImage("images/System/Scout_Icon.png").getURL())
Expugn/S-argo
src/main/java/io/github/spugn/Sargo/TicketScout/Plusv2.java
// Path: src/main/java/io/github/spugn/Sargo/Objects/Item.java // public class Item // { // private String name; // private int quantity; // private int value; // private String imagePath; // // public Item() // { // name = "null"; // quantity = 0; // value = -1; // imagePath = ""; // } // // public Item(String name, int quantity, int value) // { // this.name = name; // this.quantity = quantity; // this.value = value; // imagePath = ""; // } // // public void setName(String name) // { // this.name = name; // } // // public void setQuantity(int quantity) // { // this.quantity = quantity; // } // // public void setImagePath(String imagePath) // { // this.imagePath = imagePath; // } // // public String getName() // { // return name; // } // // public String getImagePath() // { // if (imagePath.isEmpty()) // { // return "images/Items/" + name.replaceAll(" ", "_") + ".png"; // } // return imagePath; // } // // public int getQuantity() // { // return quantity; // } // // public int getValue() // { // return value; // } // // @Override // public String toString() // { // return name + " x" + quantity; // } // } // // Path: src/main/java/io/github/spugn/Sargo/Utilities/GitHubImage.java // public class GitHubImage // { // private String filePath; // private final String GITHUB_IMAGE; // // public GitHubImage(String filePath) // { // GITHUB_IMAGE = LoginSettingsParser.getGitHubRepoURL(); // this.filePath = filePath; // } // // public String getURL() // { // String url = GITHUB_IMAGE + filePath; // // /* REPLACE ALL SPACES WITH %20 */ // url = url.replaceAll(" ", "%20"); // // /* REPLACE ALL ★ WITH %E2%98%85 */ // url = url.replaceAll("★", "%E2%98%85"); // // return url; // } // }
import discord4j.core.object.entity.Message; import io.github.spugn.Sargo.Objects.Item; import io.github.spugn.Sargo.Utilities.GitHubImage;
package io.github.spugn.Sargo.TicketScout; public class Plusv2 extends TicketScout { public Plusv2(Message message, String choice, String discordID) { super(message, choice, discordID); run(); } @Override protected void initItems() {
// Path: src/main/java/io/github/spugn/Sargo/Objects/Item.java // public class Item // { // private String name; // private int quantity; // private int value; // private String imagePath; // // public Item() // { // name = "null"; // quantity = 0; // value = -1; // imagePath = ""; // } // // public Item(String name, int quantity, int value) // { // this.name = name; // this.quantity = quantity; // this.value = value; // imagePath = ""; // } // // public void setName(String name) // { // this.name = name; // } // // public void setQuantity(int quantity) // { // this.quantity = quantity; // } // // public void setImagePath(String imagePath) // { // this.imagePath = imagePath; // } // // public String getName() // { // return name; // } // // public String getImagePath() // { // if (imagePath.isEmpty()) // { // return "images/Items/" + name.replaceAll(" ", "_") + ".png"; // } // return imagePath; // } // // public int getQuantity() // { // return quantity; // } // // public int getValue() // { // return value; // } // // @Override // public String toString() // { // return name + " x" + quantity; // } // } // // Path: src/main/java/io/github/spugn/Sargo/Utilities/GitHubImage.java // public class GitHubImage // { // private String filePath; // private final String GITHUB_IMAGE; // // public GitHubImage(String filePath) // { // GITHUB_IMAGE = LoginSettingsParser.getGitHubRepoURL(); // this.filePath = filePath; // } // // public String getURL() // { // String url = GITHUB_IMAGE + filePath; // // /* REPLACE ALL SPACES WITH %20 */ // url = url.replaceAll(" ", "%20"); // // /* REPLACE ALL ★ WITH %E2%98%85 */ // url = url.replaceAll("★", "%E2%98%85"); // // return url; // } // } // Path: src/main/java/io/github/spugn/Sargo/TicketScout/Plusv2.java import discord4j.core.object.entity.Message; import io.github.spugn.Sargo.Objects.Item; import io.github.spugn.Sargo.Utilities.GitHubImage; package io.github.spugn.Sargo.TicketScout; public class Plusv2 extends TicketScout { public Plusv2(Message message, String choice, String discordID) { super(message, choice, discordID); run(); } @Override protected void initItems() {
medallionsAndKeyList.add(new Item("Void Medallion", 3, 7500));
Expugn/S-argo
src/main/java/io/github/spugn/Sargo/TicketScout/Plusv2.java
// Path: src/main/java/io/github/spugn/Sargo/Objects/Item.java // public class Item // { // private String name; // private int quantity; // private int value; // private String imagePath; // // public Item() // { // name = "null"; // quantity = 0; // value = -1; // imagePath = ""; // } // // public Item(String name, int quantity, int value) // { // this.name = name; // this.quantity = quantity; // this.value = value; // imagePath = ""; // } // // public void setName(String name) // { // this.name = name; // } // // public void setQuantity(int quantity) // { // this.quantity = quantity; // } // // public void setImagePath(String imagePath) // { // this.imagePath = imagePath; // } // // public String getName() // { // return name; // } // // public String getImagePath() // { // if (imagePath.isEmpty()) // { // return "images/Items/" + name.replaceAll(" ", "_") + ".png"; // } // return imagePath; // } // // public int getQuantity() // { // return quantity; // } // // public int getValue() // { // return value; // } // // @Override // public String toString() // { // return name + " x" + quantity; // } // } // // Path: src/main/java/io/github/spugn/Sargo/Utilities/GitHubImage.java // public class GitHubImage // { // private String filePath; // private final String GITHUB_IMAGE; // // public GitHubImage(String filePath) // { // GITHUB_IMAGE = LoginSettingsParser.getGitHubRepoURL(); // this.filePath = filePath; // } // // public String getURL() // { // String url = GITHUB_IMAGE + filePath; // // /* REPLACE ALL SPACES WITH %20 */ // url = url.replaceAll(" ", "%20"); // // /* REPLACE ALL ★ WITH %E2%98%85 */ // url = url.replaceAll("★", "%E2%98%85"); // // return url; // } // }
import discord4j.core.object.entity.Message; import io.github.spugn.Sargo.Objects.Item; import io.github.spugn.Sargo.Utilities.GitHubImage;
package io.github.spugn.Sargo.TicketScout; public class Plusv2 extends TicketScout { public Plusv2(Message message, String choice, String discordID) { super(message, choice, discordID); run(); } @Override protected void initItems() { medallionsAndKeyList.add(new Item("Void Medallion", 3, 7500)); medallionsAndKeyList.add(new Item("Fire Medallion", 3, 7500)); medallionsAndKeyList.add(new Item("Water Medallion", 3, 7500)); medallionsAndKeyList.add(new Item("Wind Medallion", 3, 7500)); medallionsAndKeyList.add(new Item("Holy Medallion", 3, 7500)); medallionsAndKeyList.add(new Item("Dark Medallion", 3, 7500)); medallionsAndKeyList.add(new Item("Earth Medallion", 3, 7500)); } @Override protected int scout() { double d; d = RNG.nextDouble() * 100; double exchangeSwordR3 = 8; double exchangeSwordR4 = 1; double medallions = 47.796; double stardust = 18.207; double upgradeCrystal = 15; double memoryFragment = 6; /* EXCHANGE SWORD R3 */ if (d < exchangeSwordR3) { return 1; } /* EXCHANGE SWORD R4 */ else if (d < exchangeSwordR3 + exchangeSwordR4) { return 2; } /* MEDALLIONS */ else if (d < exchangeSwordR3 + exchangeSwordR4 + medallions) { return 3; } /* STARDUST */ else if (d < exchangeSwordR3 + exchangeSwordR4 + medallions + stardust) { return 4; } /* UPGRADE CRYSTAL */ else if (d < exchangeSwordR3 + exchangeSwordR4 + medallions + stardust + upgradeCrystal) { return 5; } /* MEMORY FRAGMENT */ else if (d < exchangeSwordR3 + exchangeSwordR4 + medallions + stardust + upgradeCrystal + memoryFragment) { return 6; } /* RAINBOW ESSENCE */ else { return 7; } } @Override protected Item getItem(int value) { Item item; /* EXCHANGE SWORD R3 */ if (value == 1) { item = new Item("Exchange Sword R3", 1, -1); } /* EXCHANGE SWORD R4 */ else if (value == 2) { item = new Item("Exchange Sword R4", 1, -1); } /* MEDALLIONS */ else if (value == 3) { item = medallionsAndKeyList.get(RNG.nextInt(medallionsAndKeyList.size())); } /* STARDUST */ else if (value == 4) { item = new Item("Stardust (Medium)", 20, 1000); } /* UPGRADE CRYSTAL */ else if (value == 5) { item = new Item("Upgrade Crystal", 1, -1); } /* MEMORY FRAGMENT */ else if (value == 6) { item = new Item("Memory Fragment", 1, -1); } /* RAINBOW ESSENCE */ else { item = new Item("Rainbow Essence", 1, -1); } giveCol(item); return item; } @Override protected void setupScoutMenu() { if (!SIMPLE_MESSAGE) {
// Path: src/main/java/io/github/spugn/Sargo/Objects/Item.java // public class Item // { // private String name; // private int quantity; // private int value; // private String imagePath; // // public Item() // { // name = "null"; // quantity = 0; // value = -1; // imagePath = ""; // } // // public Item(String name, int quantity, int value) // { // this.name = name; // this.quantity = quantity; // this.value = value; // imagePath = ""; // } // // public void setName(String name) // { // this.name = name; // } // // public void setQuantity(int quantity) // { // this.quantity = quantity; // } // // public void setImagePath(String imagePath) // { // this.imagePath = imagePath; // } // // public String getName() // { // return name; // } // // public String getImagePath() // { // if (imagePath.isEmpty()) // { // return "images/Items/" + name.replaceAll(" ", "_") + ".png"; // } // return imagePath; // } // // public int getQuantity() // { // return quantity; // } // // public int getValue() // { // return value; // } // // @Override // public String toString() // { // return name + " x" + quantity; // } // } // // Path: src/main/java/io/github/spugn/Sargo/Utilities/GitHubImage.java // public class GitHubImage // { // private String filePath; // private final String GITHUB_IMAGE; // // public GitHubImage(String filePath) // { // GITHUB_IMAGE = LoginSettingsParser.getGitHubRepoURL(); // this.filePath = filePath; // } // // public String getURL() // { // String url = GITHUB_IMAGE + filePath; // // /* REPLACE ALL SPACES WITH %20 */ // url = url.replaceAll(" ", "%20"); // // /* REPLACE ALL ★ WITH %E2%98%85 */ // url = url.replaceAll("★", "%E2%98%85"); // // return url; // } // } // Path: src/main/java/io/github/spugn/Sargo/TicketScout/Plusv2.java import discord4j.core.object.entity.Message; import io.github.spugn.Sargo.Objects.Item; import io.github.spugn.Sargo.Utilities.GitHubImage; package io.github.spugn.Sargo.TicketScout; public class Plusv2 extends TicketScout { public Plusv2(Message message, String choice, String discordID) { super(message, choice, discordID); run(); } @Override protected void initItems() { medallionsAndKeyList.add(new Item("Void Medallion", 3, 7500)); medallionsAndKeyList.add(new Item("Fire Medallion", 3, 7500)); medallionsAndKeyList.add(new Item("Water Medallion", 3, 7500)); medallionsAndKeyList.add(new Item("Wind Medallion", 3, 7500)); medallionsAndKeyList.add(new Item("Holy Medallion", 3, 7500)); medallionsAndKeyList.add(new Item("Dark Medallion", 3, 7500)); medallionsAndKeyList.add(new Item("Earth Medallion", 3, 7500)); } @Override protected int scout() { double d; d = RNG.nextDouble() * 100; double exchangeSwordR3 = 8; double exchangeSwordR4 = 1; double medallions = 47.796; double stardust = 18.207; double upgradeCrystal = 15; double memoryFragment = 6; /* EXCHANGE SWORD R3 */ if (d < exchangeSwordR3) { return 1; } /* EXCHANGE SWORD R4 */ else if (d < exchangeSwordR3 + exchangeSwordR4) { return 2; } /* MEDALLIONS */ else if (d < exchangeSwordR3 + exchangeSwordR4 + medallions) { return 3; } /* STARDUST */ else if (d < exchangeSwordR3 + exchangeSwordR4 + medallions + stardust) { return 4; } /* UPGRADE CRYSTAL */ else if (d < exchangeSwordR3 + exchangeSwordR4 + medallions + stardust + upgradeCrystal) { return 5; } /* MEMORY FRAGMENT */ else if (d < exchangeSwordR3 + exchangeSwordR4 + medallions + stardust + upgradeCrystal + memoryFragment) { return 6; } /* RAINBOW ESSENCE */ else { return 7; } } @Override protected Item getItem(int value) { Item item; /* EXCHANGE SWORD R3 */ if (value == 1) { item = new Item("Exchange Sword R3", 1, -1); } /* EXCHANGE SWORD R4 */ else if (value == 2) { item = new Item("Exchange Sword R4", 1, -1); } /* MEDALLIONS */ else if (value == 3) { item = medallionsAndKeyList.get(RNG.nextInt(medallionsAndKeyList.size())); } /* STARDUST */ else if (value == 4) { item = new Item("Stardust (Medium)", 20, 1000); } /* UPGRADE CRYSTAL */ else if (value == 5) { item = new Item("Upgrade Crystal", 1, -1); } /* MEMORY FRAGMENT */ else if (value == 6) { item = new Item("Memory Fragment", 1, -1); } /* RAINBOW ESSENCE */ else { item = new Item("Rainbow Essence", 1, -1); } giveCol(item); return item; } @Override protected void setupScoutMenu() { if (!SIMPLE_MESSAGE) {
sMenu = sMenu.andThen(s -> s.setAuthor("Plus Ticket v2 Scout", "", new GitHubImage("images/System/Scout_Icon.png").getURL())
Expugn/S-argo
src/main/java/io/github/spugn/Sargo/TicketScout/Plus.java
// Path: src/main/java/io/github/spugn/Sargo/Objects/Item.java // public class Item // { // private String name; // private int quantity; // private int value; // private String imagePath; // // public Item() // { // name = "null"; // quantity = 0; // value = -1; // imagePath = ""; // } // // public Item(String name, int quantity, int value) // { // this.name = name; // this.quantity = quantity; // this.value = value; // imagePath = ""; // } // // public void setName(String name) // { // this.name = name; // } // // public void setQuantity(int quantity) // { // this.quantity = quantity; // } // // public void setImagePath(String imagePath) // { // this.imagePath = imagePath; // } // // public String getName() // { // return name; // } // // public String getImagePath() // { // if (imagePath.isEmpty()) // { // return "images/Items/" + name.replaceAll(" ", "_") + ".png"; // } // return imagePath; // } // // public int getQuantity() // { // return quantity; // } // // public int getValue() // { // return value; // } // // @Override // public String toString() // { // return name + " x" + quantity; // } // } // // Path: src/main/java/io/github/spugn/Sargo/Utilities/GitHubImage.java // public class GitHubImage // { // private String filePath; // private final String GITHUB_IMAGE; // // public GitHubImage(String filePath) // { // GITHUB_IMAGE = LoginSettingsParser.getGitHubRepoURL(); // this.filePath = filePath; // } // // public String getURL() // { // String url = GITHUB_IMAGE + filePath; // // /* REPLACE ALL SPACES WITH %20 */ // url = url.replaceAll(" ", "%20"); // // /* REPLACE ALL ★ WITH %E2%98%85 */ // url = url.replaceAll("★", "%E2%98%85"); // // return url; // } // }
import discord4j.core.object.entity.Message; import io.github.spugn.Sargo.Objects.Item; import io.github.spugn.Sargo.Utilities.GitHubImage;
package io.github.spugn.Sargo.TicketScout; public class Plus extends TicketScout { public Plus(Message message, String choice, String discordID) { super(message, choice, discordID); run(); } @Override protected void initItems() {
// Path: src/main/java/io/github/spugn/Sargo/Objects/Item.java // public class Item // { // private String name; // private int quantity; // private int value; // private String imagePath; // // public Item() // { // name = "null"; // quantity = 0; // value = -1; // imagePath = ""; // } // // public Item(String name, int quantity, int value) // { // this.name = name; // this.quantity = quantity; // this.value = value; // imagePath = ""; // } // // public void setName(String name) // { // this.name = name; // } // // public void setQuantity(int quantity) // { // this.quantity = quantity; // } // // public void setImagePath(String imagePath) // { // this.imagePath = imagePath; // } // // public String getName() // { // return name; // } // // public String getImagePath() // { // if (imagePath.isEmpty()) // { // return "images/Items/" + name.replaceAll(" ", "_") + ".png"; // } // return imagePath; // } // // public int getQuantity() // { // return quantity; // } // // public int getValue() // { // return value; // } // // @Override // public String toString() // { // return name + " x" + quantity; // } // } // // Path: src/main/java/io/github/spugn/Sargo/Utilities/GitHubImage.java // public class GitHubImage // { // private String filePath; // private final String GITHUB_IMAGE; // // public GitHubImage(String filePath) // { // GITHUB_IMAGE = LoginSettingsParser.getGitHubRepoURL(); // this.filePath = filePath; // } // // public String getURL() // { // String url = GITHUB_IMAGE + filePath; // // /* REPLACE ALL SPACES WITH %20 */ // url = url.replaceAll(" ", "%20"); // // /* REPLACE ALL ★ WITH %E2%98%85 */ // url = url.replaceAll("★", "%E2%98%85"); // // return url; // } // } // Path: src/main/java/io/github/spugn/Sargo/TicketScout/Plus.java import discord4j.core.object.entity.Message; import io.github.spugn.Sargo.Objects.Item; import io.github.spugn.Sargo.Utilities.GitHubImage; package io.github.spugn.Sargo.TicketScout; public class Plus extends TicketScout { public Plus(Message message, String choice, String discordID) { super(message, choice, discordID); run(); } @Override protected void initItems() {
medallionsAndKeyList.add(new Item("Void Medallion", 3, 7500));
Expugn/S-argo
src/main/java/io/github/spugn/Sargo/TicketScout/Plus.java
// Path: src/main/java/io/github/spugn/Sargo/Objects/Item.java // public class Item // { // private String name; // private int quantity; // private int value; // private String imagePath; // // public Item() // { // name = "null"; // quantity = 0; // value = -1; // imagePath = ""; // } // // public Item(String name, int quantity, int value) // { // this.name = name; // this.quantity = quantity; // this.value = value; // imagePath = ""; // } // // public void setName(String name) // { // this.name = name; // } // // public void setQuantity(int quantity) // { // this.quantity = quantity; // } // // public void setImagePath(String imagePath) // { // this.imagePath = imagePath; // } // // public String getName() // { // return name; // } // // public String getImagePath() // { // if (imagePath.isEmpty()) // { // return "images/Items/" + name.replaceAll(" ", "_") + ".png"; // } // return imagePath; // } // // public int getQuantity() // { // return quantity; // } // // public int getValue() // { // return value; // } // // @Override // public String toString() // { // return name + " x" + quantity; // } // } // // Path: src/main/java/io/github/spugn/Sargo/Utilities/GitHubImage.java // public class GitHubImage // { // private String filePath; // private final String GITHUB_IMAGE; // // public GitHubImage(String filePath) // { // GITHUB_IMAGE = LoginSettingsParser.getGitHubRepoURL(); // this.filePath = filePath; // } // // public String getURL() // { // String url = GITHUB_IMAGE + filePath; // // /* REPLACE ALL SPACES WITH %20 */ // url = url.replaceAll(" ", "%20"); // // /* REPLACE ALL ★ WITH %E2%98%85 */ // url = url.replaceAll("★", "%E2%98%85"); // // return url; // } // }
import discord4j.core.object.entity.Message; import io.github.spugn.Sargo.Objects.Item; import io.github.spugn.Sargo.Utilities.GitHubImage;
package io.github.spugn.Sargo.TicketScout; public class Plus extends TicketScout { public Plus(Message message, String choice, String discordID) { super(message, choice, discordID); run(); } @Override protected void initItems() { medallionsAndKeyList.add(new Item("Void Medallion", 3, 7500)); medallionsAndKeyList.add(new Item("Fire Medallion", 3, 7500)); medallionsAndKeyList.add(new Item("Water Medallion", 3, 7500)); medallionsAndKeyList.add(new Item("Wind Medallion", 3, 7500)); medallionsAndKeyList.add(new Item("Holy Medallion", 3, 7500)); medallionsAndKeyList.add(new Item("Dark Medallion", 3, 7500)); medallionsAndKeyList.add(new Item("Earth Medallion", 3, 7500)); } @Override protected int scout() { double d; d = RNG.nextDouble() * 100; double exchangeSwordR3 = 8; double exchangeSwordR4 = 1; double medallions = 63; double stardust = 24; /* EXCHANGE SWORD R3 */ if (d < exchangeSwordR3) { return 1; } /* EXCHANGE SWORD R4 */ else if (d < exchangeSwordR3 + exchangeSwordR4) { return 2; } /* MEDALLIONS */ else if (d < exchangeSwordR3 + exchangeSwordR4 + medallions) { return 3; } /* STARDUST */ else if (d < exchangeSwordR3 + exchangeSwordR4 + medallions + stardust) { return 4; } /* RAINBOW ESSENCE */ else { return 5; } } @Override protected Item getItem(int value) { Item item; /* EXCHANGE SWORD R3 */ if (value == 1) { item = new Item("Exchange Sword R3", 1, -1); } /* EXCHANGE SWORD R4 */ else if (value == 2) { item = new Item("Exchange Sword R4", 1, -1); } /* MEDALLIONS */ else if (value == 3) { item = medallionsAndKeyList.get(RNG.nextInt(medallionsAndKeyList.size())); } /* STARDUST */ else if (value == 4) { item = new Item("Stardust (Medium)", 20, 1000); } /* RAINBOW ESSENCE */ else { item = new Item("Rainbow Essence", 1, -1); } giveCol(item); return item; } @Override protected void setupScoutMenu() { if (!SIMPLE_MESSAGE) {
// Path: src/main/java/io/github/spugn/Sargo/Objects/Item.java // public class Item // { // private String name; // private int quantity; // private int value; // private String imagePath; // // public Item() // { // name = "null"; // quantity = 0; // value = -1; // imagePath = ""; // } // // public Item(String name, int quantity, int value) // { // this.name = name; // this.quantity = quantity; // this.value = value; // imagePath = ""; // } // // public void setName(String name) // { // this.name = name; // } // // public void setQuantity(int quantity) // { // this.quantity = quantity; // } // // public void setImagePath(String imagePath) // { // this.imagePath = imagePath; // } // // public String getName() // { // return name; // } // // public String getImagePath() // { // if (imagePath.isEmpty()) // { // return "images/Items/" + name.replaceAll(" ", "_") + ".png"; // } // return imagePath; // } // // public int getQuantity() // { // return quantity; // } // // public int getValue() // { // return value; // } // // @Override // public String toString() // { // return name + " x" + quantity; // } // } // // Path: src/main/java/io/github/spugn/Sargo/Utilities/GitHubImage.java // public class GitHubImage // { // private String filePath; // private final String GITHUB_IMAGE; // // public GitHubImage(String filePath) // { // GITHUB_IMAGE = LoginSettingsParser.getGitHubRepoURL(); // this.filePath = filePath; // } // // public String getURL() // { // String url = GITHUB_IMAGE + filePath; // // /* REPLACE ALL SPACES WITH %20 */ // url = url.replaceAll(" ", "%20"); // // /* REPLACE ALL ★ WITH %E2%98%85 */ // url = url.replaceAll("★", "%E2%98%85"); // // return url; // } // } // Path: src/main/java/io/github/spugn/Sargo/TicketScout/Plus.java import discord4j.core.object.entity.Message; import io.github.spugn.Sargo.Objects.Item; import io.github.spugn.Sargo.Utilities.GitHubImage; package io.github.spugn.Sargo.TicketScout; public class Plus extends TicketScout { public Plus(Message message, String choice, String discordID) { super(message, choice, discordID); run(); } @Override protected void initItems() { medallionsAndKeyList.add(new Item("Void Medallion", 3, 7500)); medallionsAndKeyList.add(new Item("Fire Medallion", 3, 7500)); medallionsAndKeyList.add(new Item("Water Medallion", 3, 7500)); medallionsAndKeyList.add(new Item("Wind Medallion", 3, 7500)); medallionsAndKeyList.add(new Item("Holy Medallion", 3, 7500)); medallionsAndKeyList.add(new Item("Dark Medallion", 3, 7500)); medallionsAndKeyList.add(new Item("Earth Medallion", 3, 7500)); } @Override protected int scout() { double d; d = RNG.nextDouble() * 100; double exchangeSwordR3 = 8; double exchangeSwordR4 = 1; double medallions = 63; double stardust = 24; /* EXCHANGE SWORD R3 */ if (d < exchangeSwordR3) { return 1; } /* EXCHANGE SWORD R4 */ else if (d < exchangeSwordR3 + exchangeSwordR4) { return 2; } /* MEDALLIONS */ else if (d < exchangeSwordR3 + exchangeSwordR4 + medallions) { return 3; } /* STARDUST */ else if (d < exchangeSwordR3 + exchangeSwordR4 + medallions + stardust) { return 4; } /* RAINBOW ESSENCE */ else { return 5; } } @Override protected Item getItem(int value) { Item item; /* EXCHANGE SWORD R3 */ if (value == 1) { item = new Item("Exchange Sword R3", 1, -1); } /* EXCHANGE SWORD R4 */ else if (value == 2) { item = new Item("Exchange Sword R4", 1, -1); } /* MEDALLIONS */ else if (value == 3) { item = medallionsAndKeyList.get(RNG.nextInt(medallionsAndKeyList.size())); } /* STARDUST */ else if (value == 4) { item = new Item("Stardust (Medium)", 20, 1000); } /* RAINBOW ESSENCE */ else { item = new Item("Rainbow Essence", 1, -1); } giveCol(item); return item; } @Override protected void setupScoutMenu() { if (!SIMPLE_MESSAGE) {
sMenu = sMenu.andThen(s -> s.setAuthor("Plus Ticket Scout", "", new GitHubImage("images/System/Scout_Icon.png").getURL())
Expugn/S-argo
src/main/java/io/github/spugn/Sargo/CharacterScout/Normal.java
// Path: src/main/java/io/github/spugn/Sargo/Objects/Banner.java // public class Banner // { // private int bannerID; // private String bannerName; // private int bannerType; // private int bannerWepType; // private ArrayList<Character> characters; // private ArrayList<Weapon> weapons; // // public int getBannerID() // { // return bannerID; // } // // public String getBannerName() // { // return bannerName; // } // // public int getBannerType() // { // return bannerType; // } // // public int getBannerWepType() // { // return bannerWepType; // } // // public ArrayList<Character> getCharacters() // { // return characters; // } // // public ArrayList<Weapon> getWeapons() // { // return weapons; // } // // public void setBannerID(int bannerID) // { // this.bannerID = bannerID; // } // // public void setBannerName(String bannerName) // { // this.bannerName = bannerName; // } // // public void setBannerType(int bannerType) // { // this.bannerType = bannerType; // } // // public void setBannerWepType(int bannerWepType) // { // this.bannerWepType = bannerWepType; // } // // public void setCharacters(ArrayList<Character> characters) // { // this.characters = characters; // } // // public void setWeapons(ArrayList<Weapon> weapons) // { // this.weapons = weapons; // } // // public String bannerTypeToString() // { // switch(bannerType) // { // case 0: // return "Normal"; // case 1: // return "Step Up"; // case 2: // return "Record Crystal"; // case 3: // return "Step Up v2"; // case 4: // return "Birthday Step Up"; // case 5: // return "Record Crystal v2"; // case 6: // return "Memorial Scout"; // case 7: // return "Step Up v3"; // case 8: // return "Record Crystal v3"; // case 9: // return "Event"; // case 10: // return "SAO Game 5th Anniversary Step Up"; // case 11: // return "Record Crystal v4"; // case 12: // return "Step Up v4"; // case 13: // return "Step Up v5"; // case 14: // return "SAO Game 5th Anniversary Step Up v2"; // case 15: // return "Step Up v6"; // case 16: // return "SAO Game 5th Anniversary Step Up v3"; // case 17: // return "Step Up v7"; // case 18: // return "Record Crystal v5"; // case 19: // return "Step Up v8"; // case 20: // return "Record Crystal v6"; // case 21: // return "Step Up v9"; // default: // return "Unknown"; // } // } // // @Override // public String toString() // { // return bannerID + ") " + bannerName; // } // } // // Path: src/main/java/io/github/spugn/Sargo/Objects/Character.java // public class Character // { // private String prefix; // private String name; // private int rarity; // private String imagePath; // // public Character() // { // prefix = ""; // name = "null"; // rarity = 1; // imagePath = ""; // } // // public void setPrefix(String prefix) // { // this.prefix = prefix; // } // // public void setName(String name) // { // this.name = name; // } // // public void setRarity(int rarity) // { // this.rarity = rarity; // } // // public void setImagePath(String imagePath) // { // this.imagePath = imagePath; // } // // public String getPrefix() // { // return prefix; // } // // public String getName() // { // return name; // } // // public int getRarity() // { // return rarity; // } // // public String getImagePath() // { // return imagePath; // } // // @Override // public String toString() // { // if (prefix.isEmpty()) // { // return rarity + "★ " + name; // } // return rarity + "★ [" + prefix + "] " + name; // } // // public String toStringNoName() // { // if (prefix.isEmpty()) // { // return rarity + "★ " + name; // } // return rarity + "★ [" + prefix + "]"; // } // }
import discord4j.core.object.entity.Message; import io.github.spugn.Sargo.Objects.Banner; import io.github.spugn.Sargo.Objects.Character; import java.util.List;
package io.github.spugn.Sargo.CharacterScout; /** * NORMAL CHARACTER SCOUT * <p> * Normal Scouts are scouts that have static pull rates every time. * Compared to other scout types, there are no special gimmicks. * </p> * * @author S'pugn * @version 1.0 * @since v2.0 * @see CharacterScout */ public class Normal extends CharacterScout { public Normal(Message message, int bannerID, String choice, String discordID) { super(message, bannerID, choice, discordID); run(); } @Override protected void initBannerInfo() { /* NORMAL SCOUTS DO NOT NEED TO INITIALIZE ANY BANNER INFORMATION. */ } @Override protected void modifyScoutData() { // REMOVE 1.5% FROM PLATINUM (IT'S ORIGINAL VALUE) COPPER = COPPER + (PLATINUM - (PLATINUM / 1.5)); PLATINUM = PLATINUM / 1.5; /* NORMAL SCOUTS DO NOT MODIFY ANY SCOUT DATA. */ } @Override protected void updateBannerData() { /* NORMAL SCOUTS DO NOT HAVE ANY BANNER DATA UPDATES. */ } @Override
// Path: src/main/java/io/github/spugn/Sargo/Objects/Banner.java // public class Banner // { // private int bannerID; // private String bannerName; // private int bannerType; // private int bannerWepType; // private ArrayList<Character> characters; // private ArrayList<Weapon> weapons; // // public int getBannerID() // { // return bannerID; // } // // public String getBannerName() // { // return bannerName; // } // // public int getBannerType() // { // return bannerType; // } // // public int getBannerWepType() // { // return bannerWepType; // } // // public ArrayList<Character> getCharacters() // { // return characters; // } // // public ArrayList<Weapon> getWeapons() // { // return weapons; // } // // public void setBannerID(int bannerID) // { // this.bannerID = bannerID; // } // // public void setBannerName(String bannerName) // { // this.bannerName = bannerName; // } // // public void setBannerType(int bannerType) // { // this.bannerType = bannerType; // } // // public void setBannerWepType(int bannerWepType) // { // this.bannerWepType = bannerWepType; // } // // public void setCharacters(ArrayList<Character> characters) // { // this.characters = characters; // } // // public void setWeapons(ArrayList<Weapon> weapons) // { // this.weapons = weapons; // } // // public String bannerTypeToString() // { // switch(bannerType) // { // case 0: // return "Normal"; // case 1: // return "Step Up"; // case 2: // return "Record Crystal"; // case 3: // return "Step Up v2"; // case 4: // return "Birthday Step Up"; // case 5: // return "Record Crystal v2"; // case 6: // return "Memorial Scout"; // case 7: // return "Step Up v3"; // case 8: // return "Record Crystal v3"; // case 9: // return "Event"; // case 10: // return "SAO Game 5th Anniversary Step Up"; // case 11: // return "Record Crystal v4"; // case 12: // return "Step Up v4"; // case 13: // return "Step Up v5"; // case 14: // return "SAO Game 5th Anniversary Step Up v2"; // case 15: // return "Step Up v6"; // case 16: // return "SAO Game 5th Anniversary Step Up v3"; // case 17: // return "Step Up v7"; // case 18: // return "Record Crystal v5"; // case 19: // return "Step Up v8"; // case 20: // return "Record Crystal v6"; // case 21: // return "Step Up v9"; // default: // return "Unknown"; // } // } // // @Override // public String toString() // { // return bannerID + ") " + bannerName; // } // } // // Path: src/main/java/io/github/spugn/Sargo/Objects/Character.java // public class Character // { // private String prefix; // private String name; // private int rarity; // private String imagePath; // // public Character() // { // prefix = ""; // name = "null"; // rarity = 1; // imagePath = ""; // } // // public void setPrefix(String prefix) // { // this.prefix = prefix; // } // // public void setName(String name) // { // this.name = name; // } // // public void setRarity(int rarity) // { // this.rarity = rarity; // } // // public void setImagePath(String imagePath) // { // this.imagePath = imagePath; // } // // public String getPrefix() // { // return prefix; // } // // public String getName() // { // return name; // } // // public int getRarity() // { // return rarity; // } // // public String getImagePath() // { // return imagePath; // } // // @Override // public String toString() // { // if (prefix.isEmpty()) // { // return rarity + "★ " + name; // } // return rarity + "★ [" + prefix + "] " + name; // } // // public String toStringNoName() // { // if (prefix.isEmpty()) // { // return rarity + "★ " + name; // } // return rarity + "★ [" + prefix + "]"; // } // } // Path: src/main/java/io/github/spugn/Sargo/CharacterScout/Normal.java import discord4j.core.object.entity.Message; import io.github.spugn.Sargo.Objects.Banner; import io.github.spugn.Sargo.Objects.Character; import java.util.List; package io.github.spugn.Sargo.CharacterScout; /** * NORMAL CHARACTER SCOUT * <p> * Normal Scouts are scouts that have static pull rates every time. * Compared to other scout types, there are no special gimmicks. * </p> * * @author S'pugn * @version 1.0 * @since v2.0 * @see CharacterScout */ public class Normal extends CharacterScout { public Normal(Message message, int bannerID, String choice, String discordID) { super(message, bannerID, choice, discordID); run(); } @Override protected void initBannerInfo() { /* NORMAL SCOUTS DO NOT NEED TO INITIALIZE ANY BANNER INFORMATION. */ } @Override protected void modifyScoutData() { // REMOVE 1.5% FROM PLATINUM (IT'S ORIGINAL VALUE) COPPER = COPPER + (PLATINUM - (PLATINUM / 1.5)); PLATINUM = PLATINUM / 1.5; /* NORMAL SCOUTS DO NOT MODIFY ANY SCOUT DATA. */ } @Override protected void updateBannerData() { /* NORMAL SCOUTS DO NOT HAVE ANY BANNER DATA UPDATES. */ } @Override
protected Character randGoldCharacter()
Expugn/S-argo
src/main/java/io/github/spugn/Sargo/CharacterScout/Normal.java
// Path: src/main/java/io/github/spugn/Sargo/Objects/Banner.java // public class Banner // { // private int bannerID; // private String bannerName; // private int bannerType; // private int bannerWepType; // private ArrayList<Character> characters; // private ArrayList<Weapon> weapons; // // public int getBannerID() // { // return bannerID; // } // // public String getBannerName() // { // return bannerName; // } // // public int getBannerType() // { // return bannerType; // } // // public int getBannerWepType() // { // return bannerWepType; // } // // public ArrayList<Character> getCharacters() // { // return characters; // } // // public ArrayList<Weapon> getWeapons() // { // return weapons; // } // // public void setBannerID(int bannerID) // { // this.bannerID = bannerID; // } // // public void setBannerName(String bannerName) // { // this.bannerName = bannerName; // } // // public void setBannerType(int bannerType) // { // this.bannerType = bannerType; // } // // public void setBannerWepType(int bannerWepType) // { // this.bannerWepType = bannerWepType; // } // // public void setCharacters(ArrayList<Character> characters) // { // this.characters = characters; // } // // public void setWeapons(ArrayList<Weapon> weapons) // { // this.weapons = weapons; // } // // public String bannerTypeToString() // { // switch(bannerType) // { // case 0: // return "Normal"; // case 1: // return "Step Up"; // case 2: // return "Record Crystal"; // case 3: // return "Step Up v2"; // case 4: // return "Birthday Step Up"; // case 5: // return "Record Crystal v2"; // case 6: // return "Memorial Scout"; // case 7: // return "Step Up v3"; // case 8: // return "Record Crystal v3"; // case 9: // return "Event"; // case 10: // return "SAO Game 5th Anniversary Step Up"; // case 11: // return "Record Crystal v4"; // case 12: // return "Step Up v4"; // case 13: // return "Step Up v5"; // case 14: // return "SAO Game 5th Anniversary Step Up v2"; // case 15: // return "Step Up v6"; // case 16: // return "SAO Game 5th Anniversary Step Up v3"; // case 17: // return "Step Up v7"; // case 18: // return "Record Crystal v5"; // case 19: // return "Step Up v8"; // case 20: // return "Record Crystal v6"; // case 21: // return "Step Up v9"; // default: // return "Unknown"; // } // } // // @Override // public String toString() // { // return bannerID + ") " + bannerName; // } // } // // Path: src/main/java/io/github/spugn/Sargo/Objects/Character.java // public class Character // { // private String prefix; // private String name; // private int rarity; // private String imagePath; // // public Character() // { // prefix = ""; // name = "null"; // rarity = 1; // imagePath = ""; // } // // public void setPrefix(String prefix) // { // this.prefix = prefix; // } // // public void setName(String name) // { // this.name = name; // } // // public void setRarity(int rarity) // { // this.rarity = rarity; // } // // public void setImagePath(String imagePath) // { // this.imagePath = imagePath; // } // // public String getPrefix() // { // return prefix; // } // // public String getName() // { // return name; // } // // public int getRarity() // { // return rarity; // } // // public String getImagePath() // { // return imagePath; // } // // @Override // public String toString() // { // if (prefix.isEmpty()) // { // return rarity + "★ " + name; // } // return rarity + "★ [" + prefix + "] " + name; // } // // public String toStringNoName() // { // if (prefix.isEmpty()) // { // return rarity + "★ " + name; // } // return rarity + "★ [" + prefix + "]"; // } // }
import discord4j.core.object.entity.Message; import io.github.spugn.Sargo.Objects.Banner; import io.github.spugn.Sargo.Objects.Character; import java.util.List;
package io.github.spugn.Sargo.CharacterScout; /** * NORMAL CHARACTER SCOUT * <p> * Normal Scouts are scouts that have static pull rates every time. * Compared to other scout types, there are no special gimmicks. * </p> * * @author S'pugn * @version 1.0 * @since v2.0 * @see CharacterScout */ public class Normal extends CharacterScout { public Normal(Message message, int bannerID, String choice, String discordID) { super(message, bannerID, choice, discordID); run(); } @Override protected void initBannerInfo() { /* NORMAL SCOUTS DO NOT NEED TO INITIALIZE ANY BANNER INFORMATION. */ } @Override protected void modifyScoutData() { // REMOVE 1.5% FROM PLATINUM (IT'S ORIGINAL VALUE) COPPER = COPPER + (PLATINUM - (PLATINUM / 1.5)); PLATINUM = PLATINUM / 1.5; /* NORMAL SCOUTS DO NOT MODIFY ANY SCOUT DATA. */ } @Override protected void updateBannerData() { /* NORMAL SCOUTS DO NOT HAVE ANY BANNER DATA UPDATES. */ } @Override protected Character randGoldCharacter() { int randIndex = GOLD_BANNERS.get(RNG.nextInt(GOLD_BANNERS.size()));
// Path: src/main/java/io/github/spugn/Sargo/Objects/Banner.java // public class Banner // { // private int bannerID; // private String bannerName; // private int bannerType; // private int bannerWepType; // private ArrayList<Character> characters; // private ArrayList<Weapon> weapons; // // public int getBannerID() // { // return bannerID; // } // // public String getBannerName() // { // return bannerName; // } // // public int getBannerType() // { // return bannerType; // } // // public int getBannerWepType() // { // return bannerWepType; // } // // public ArrayList<Character> getCharacters() // { // return characters; // } // // public ArrayList<Weapon> getWeapons() // { // return weapons; // } // // public void setBannerID(int bannerID) // { // this.bannerID = bannerID; // } // // public void setBannerName(String bannerName) // { // this.bannerName = bannerName; // } // // public void setBannerType(int bannerType) // { // this.bannerType = bannerType; // } // // public void setBannerWepType(int bannerWepType) // { // this.bannerWepType = bannerWepType; // } // // public void setCharacters(ArrayList<Character> characters) // { // this.characters = characters; // } // // public void setWeapons(ArrayList<Weapon> weapons) // { // this.weapons = weapons; // } // // public String bannerTypeToString() // { // switch(bannerType) // { // case 0: // return "Normal"; // case 1: // return "Step Up"; // case 2: // return "Record Crystal"; // case 3: // return "Step Up v2"; // case 4: // return "Birthday Step Up"; // case 5: // return "Record Crystal v2"; // case 6: // return "Memorial Scout"; // case 7: // return "Step Up v3"; // case 8: // return "Record Crystal v3"; // case 9: // return "Event"; // case 10: // return "SAO Game 5th Anniversary Step Up"; // case 11: // return "Record Crystal v4"; // case 12: // return "Step Up v4"; // case 13: // return "Step Up v5"; // case 14: // return "SAO Game 5th Anniversary Step Up v2"; // case 15: // return "Step Up v6"; // case 16: // return "SAO Game 5th Anniversary Step Up v3"; // case 17: // return "Step Up v7"; // case 18: // return "Record Crystal v5"; // case 19: // return "Step Up v8"; // case 20: // return "Record Crystal v6"; // case 21: // return "Step Up v9"; // default: // return "Unknown"; // } // } // // @Override // public String toString() // { // return bannerID + ") " + bannerName; // } // } // // Path: src/main/java/io/github/spugn/Sargo/Objects/Character.java // public class Character // { // private String prefix; // private String name; // private int rarity; // private String imagePath; // // public Character() // { // prefix = ""; // name = "null"; // rarity = 1; // imagePath = ""; // } // // public void setPrefix(String prefix) // { // this.prefix = prefix; // } // // public void setName(String name) // { // this.name = name; // } // // public void setRarity(int rarity) // { // this.rarity = rarity; // } // // public void setImagePath(String imagePath) // { // this.imagePath = imagePath; // } // // public String getPrefix() // { // return prefix; // } // // public String getName() // { // return name; // } // // public int getRarity() // { // return rarity; // } // // public String getImagePath() // { // return imagePath; // } // // @Override // public String toString() // { // if (prefix.isEmpty()) // { // return rarity + "★ " + name; // } // return rarity + "★ [" + prefix + "] " + name; // } // // public String toStringNoName() // { // if (prefix.isEmpty()) // { // return rarity + "★ " + name; // } // return rarity + "★ [" + prefix + "]"; // } // } // Path: src/main/java/io/github/spugn/Sargo/CharacterScout/Normal.java import discord4j.core.object.entity.Message; import io.github.spugn.Sargo.Objects.Banner; import io.github.spugn.Sargo.Objects.Character; import java.util.List; package io.github.spugn.Sargo.CharacterScout; /** * NORMAL CHARACTER SCOUT * <p> * Normal Scouts are scouts that have static pull rates every time. * Compared to other scout types, there are no special gimmicks. * </p> * * @author S'pugn * @version 1.0 * @since v2.0 * @see CharacterScout */ public class Normal extends CharacterScout { public Normal(Message message, int bannerID, String choice, String discordID) { super(message, bannerID, choice, discordID); run(); } @Override protected void initBannerInfo() { /* NORMAL SCOUTS DO NOT NEED TO INITIALIZE ANY BANNER INFORMATION. */ } @Override protected void modifyScoutData() { // REMOVE 1.5% FROM PLATINUM (IT'S ORIGINAL VALUE) COPPER = COPPER + (PLATINUM - (PLATINUM / 1.5)); PLATINUM = PLATINUM / 1.5; /* NORMAL SCOUTS DO NOT MODIFY ANY SCOUT DATA. */ } @Override protected void updateBannerData() { /* NORMAL SCOUTS DO NOT HAVE ANY BANNER DATA UPDATES. */ } @Override protected Character randGoldCharacter() { int randIndex = GOLD_BANNERS.get(RNG.nextInt(GOLD_BANNERS.size()));
Banner randBanner = BANNERS.get(randIndex - 1);
Expugn/S-argo
src/main/java/io/github/spugn/Sargo/CharacterScout/SAOGameFifthAnniversaryStepUpv3.java
// Path: src/main/java/io/github/spugn/Sargo/Objects/Banner.java // public class Banner // { // private int bannerID; // private String bannerName; // private int bannerType; // private int bannerWepType; // private ArrayList<Character> characters; // private ArrayList<Weapon> weapons; // // public int getBannerID() // { // return bannerID; // } // // public String getBannerName() // { // return bannerName; // } // // public int getBannerType() // { // return bannerType; // } // // public int getBannerWepType() // { // return bannerWepType; // } // // public ArrayList<Character> getCharacters() // { // return characters; // } // // public ArrayList<Weapon> getWeapons() // { // return weapons; // } // // public void setBannerID(int bannerID) // { // this.bannerID = bannerID; // } // // public void setBannerName(String bannerName) // { // this.bannerName = bannerName; // } // // public void setBannerType(int bannerType) // { // this.bannerType = bannerType; // } // // public void setBannerWepType(int bannerWepType) // { // this.bannerWepType = bannerWepType; // } // // public void setCharacters(ArrayList<Character> characters) // { // this.characters = characters; // } // // public void setWeapons(ArrayList<Weapon> weapons) // { // this.weapons = weapons; // } // // public String bannerTypeToString() // { // switch(bannerType) // { // case 0: // return "Normal"; // case 1: // return "Step Up"; // case 2: // return "Record Crystal"; // case 3: // return "Step Up v2"; // case 4: // return "Birthday Step Up"; // case 5: // return "Record Crystal v2"; // case 6: // return "Memorial Scout"; // case 7: // return "Step Up v3"; // case 8: // return "Record Crystal v3"; // case 9: // return "Event"; // case 10: // return "SAO Game 5th Anniversary Step Up"; // case 11: // return "Record Crystal v4"; // case 12: // return "Step Up v4"; // case 13: // return "Step Up v5"; // case 14: // return "SAO Game 5th Anniversary Step Up v2"; // case 15: // return "Step Up v6"; // case 16: // return "SAO Game 5th Anniversary Step Up v3"; // case 17: // return "Step Up v7"; // case 18: // return "Record Crystal v5"; // case 19: // return "Step Up v8"; // case 20: // return "Record Crystal v6"; // case 21: // return "Step Up v9"; // default: // return "Unknown"; // } // } // // @Override // public String toString() // { // return bannerID + ") " + bannerName; // } // } // // Path: src/main/java/io/github/spugn/Sargo/Objects/Character.java // public class Character // { // private String prefix; // private String name; // private int rarity; // private String imagePath; // // public Character() // { // prefix = ""; // name = "null"; // rarity = 1; // imagePath = ""; // } // // public void setPrefix(String prefix) // { // this.prefix = prefix; // } // // public void setName(String name) // { // this.name = name; // } // // public void setRarity(int rarity) // { // this.rarity = rarity; // } // // public void setImagePath(String imagePath) // { // this.imagePath = imagePath; // } // // public String getPrefix() // { // return prefix; // } // // public String getName() // { // return name; // } // // public int getRarity() // { // return rarity; // } // // public String getImagePath() // { // return imagePath; // } // // @Override // public String toString() // { // if (prefix.isEmpty()) // { // return rarity + "★ " + name; // } // return rarity + "★ [" + prefix + "] " + name; // } // // public String toStringNoName() // { // if (prefix.isEmpty()) // { // return rarity + "★ " + name; // } // return rarity + "★ [" + prefix + "]"; // } // }
import discord4j.core.object.entity.Message; import io.github.spugn.Sargo.Objects.Banner; import io.github.spugn.Sargo.Objects.Character; import java.util.List;
PLATINUM = PLATINUM * 1.5; break; case 5: guaranteeOnePlatinum = true; break; case 6: COPPER = COPPER - ((PLATINUM * 2.0) - PLATINUM); PLATINUM = PLATINUM * 2.0; default: break; } } } @Override protected void updateBannerData() { int currentStep = USER.getBannerData(SELECTED_BANNER.getBannerName()); currentStep++; if (currentStep > 6) { USER.changeValue(SELECTED_BANNER.getBannerName(), 6); } else { USER.changeValue(SELECTED_BANNER.getBannerName(), currentStep); } } @Override
// Path: src/main/java/io/github/spugn/Sargo/Objects/Banner.java // public class Banner // { // private int bannerID; // private String bannerName; // private int bannerType; // private int bannerWepType; // private ArrayList<Character> characters; // private ArrayList<Weapon> weapons; // // public int getBannerID() // { // return bannerID; // } // // public String getBannerName() // { // return bannerName; // } // // public int getBannerType() // { // return bannerType; // } // // public int getBannerWepType() // { // return bannerWepType; // } // // public ArrayList<Character> getCharacters() // { // return characters; // } // // public ArrayList<Weapon> getWeapons() // { // return weapons; // } // // public void setBannerID(int bannerID) // { // this.bannerID = bannerID; // } // // public void setBannerName(String bannerName) // { // this.bannerName = bannerName; // } // // public void setBannerType(int bannerType) // { // this.bannerType = bannerType; // } // // public void setBannerWepType(int bannerWepType) // { // this.bannerWepType = bannerWepType; // } // // public void setCharacters(ArrayList<Character> characters) // { // this.characters = characters; // } // // public void setWeapons(ArrayList<Weapon> weapons) // { // this.weapons = weapons; // } // // public String bannerTypeToString() // { // switch(bannerType) // { // case 0: // return "Normal"; // case 1: // return "Step Up"; // case 2: // return "Record Crystal"; // case 3: // return "Step Up v2"; // case 4: // return "Birthday Step Up"; // case 5: // return "Record Crystal v2"; // case 6: // return "Memorial Scout"; // case 7: // return "Step Up v3"; // case 8: // return "Record Crystal v3"; // case 9: // return "Event"; // case 10: // return "SAO Game 5th Anniversary Step Up"; // case 11: // return "Record Crystal v4"; // case 12: // return "Step Up v4"; // case 13: // return "Step Up v5"; // case 14: // return "SAO Game 5th Anniversary Step Up v2"; // case 15: // return "Step Up v6"; // case 16: // return "SAO Game 5th Anniversary Step Up v3"; // case 17: // return "Step Up v7"; // case 18: // return "Record Crystal v5"; // case 19: // return "Step Up v8"; // case 20: // return "Record Crystal v6"; // case 21: // return "Step Up v9"; // default: // return "Unknown"; // } // } // // @Override // public String toString() // { // return bannerID + ") " + bannerName; // } // } // // Path: src/main/java/io/github/spugn/Sargo/Objects/Character.java // public class Character // { // private String prefix; // private String name; // private int rarity; // private String imagePath; // // public Character() // { // prefix = ""; // name = "null"; // rarity = 1; // imagePath = ""; // } // // public void setPrefix(String prefix) // { // this.prefix = prefix; // } // // public void setName(String name) // { // this.name = name; // } // // public void setRarity(int rarity) // { // this.rarity = rarity; // } // // public void setImagePath(String imagePath) // { // this.imagePath = imagePath; // } // // public String getPrefix() // { // return prefix; // } // // public String getName() // { // return name; // } // // public int getRarity() // { // return rarity; // } // // public String getImagePath() // { // return imagePath; // } // // @Override // public String toString() // { // if (prefix.isEmpty()) // { // return rarity + "★ " + name; // } // return rarity + "★ [" + prefix + "] " + name; // } // // public String toStringNoName() // { // if (prefix.isEmpty()) // { // return rarity + "★ " + name; // } // return rarity + "★ [" + prefix + "]"; // } // } // Path: src/main/java/io/github/spugn/Sargo/CharacterScout/SAOGameFifthAnniversaryStepUpv3.java import discord4j.core.object.entity.Message; import io.github.spugn.Sargo.Objects.Banner; import io.github.spugn.Sargo.Objects.Character; import java.util.List; PLATINUM = PLATINUM * 1.5; break; case 5: guaranteeOnePlatinum = true; break; case 6: COPPER = COPPER - ((PLATINUM * 2.0) - PLATINUM); PLATINUM = PLATINUM * 2.0; default: break; } } } @Override protected void updateBannerData() { int currentStep = USER.getBannerData(SELECTED_BANNER.getBannerName()); currentStep++; if (currentStep > 6) { USER.changeValue(SELECTED_BANNER.getBannerName(), 6); } else { USER.changeValue(SELECTED_BANNER.getBannerName(), currentStep); } } @Override
protected Character randGoldCharacter()
Expugn/S-argo
src/main/java/io/github/spugn/Sargo/CharacterScout/SAOGameFifthAnniversaryStepUpv3.java
// Path: src/main/java/io/github/spugn/Sargo/Objects/Banner.java // public class Banner // { // private int bannerID; // private String bannerName; // private int bannerType; // private int bannerWepType; // private ArrayList<Character> characters; // private ArrayList<Weapon> weapons; // // public int getBannerID() // { // return bannerID; // } // // public String getBannerName() // { // return bannerName; // } // // public int getBannerType() // { // return bannerType; // } // // public int getBannerWepType() // { // return bannerWepType; // } // // public ArrayList<Character> getCharacters() // { // return characters; // } // // public ArrayList<Weapon> getWeapons() // { // return weapons; // } // // public void setBannerID(int bannerID) // { // this.bannerID = bannerID; // } // // public void setBannerName(String bannerName) // { // this.bannerName = bannerName; // } // // public void setBannerType(int bannerType) // { // this.bannerType = bannerType; // } // // public void setBannerWepType(int bannerWepType) // { // this.bannerWepType = bannerWepType; // } // // public void setCharacters(ArrayList<Character> characters) // { // this.characters = characters; // } // // public void setWeapons(ArrayList<Weapon> weapons) // { // this.weapons = weapons; // } // // public String bannerTypeToString() // { // switch(bannerType) // { // case 0: // return "Normal"; // case 1: // return "Step Up"; // case 2: // return "Record Crystal"; // case 3: // return "Step Up v2"; // case 4: // return "Birthday Step Up"; // case 5: // return "Record Crystal v2"; // case 6: // return "Memorial Scout"; // case 7: // return "Step Up v3"; // case 8: // return "Record Crystal v3"; // case 9: // return "Event"; // case 10: // return "SAO Game 5th Anniversary Step Up"; // case 11: // return "Record Crystal v4"; // case 12: // return "Step Up v4"; // case 13: // return "Step Up v5"; // case 14: // return "SAO Game 5th Anniversary Step Up v2"; // case 15: // return "Step Up v6"; // case 16: // return "SAO Game 5th Anniversary Step Up v3"; // case 17: // return "Step Up v7"; // case 18: // return "Record Crystal v5"; // case 19: // return "Step Up v8"; // case 20: // return "Record Crystal v6"; // case 21: // return "Step Up v9"; // default: // return "Unknown"; // } // } // // @Override // public String toString() // { // return bannerID + ") " + bannerName; // } // } // // Path: src/main/java/io/github/spugn/Sargo/Objects/Character.java // public class Character // { // private String prefix; // private String name; // private int rarity; // private String imagePath; // // public Character() // { // prefix = ""; // name = "null"; // rarity = 1; // imagePath = ""; // } // // public void setPrefix(String prefix) // { // this.prefix = prefix; // } // // public void setName(String name) // { // this.name = name; // } // // public void setRarity(int rarity) // { // this.rarity = rarity; // } // // public void setImagePath(String imagePath) // { // this.imagePath = imagePath; // } // // public String getPrefix() // { // return prefix; // } // // public String getName() // { // return name; // } // // public int getRarity() // { // return rarity; // } // // public String getImagePath() // { // return imagePath; // } // // @Override // public String toString() // { // if (prefix.isEmpty()) // { // return rarity + "★ " + name; // } // return rarity + "★ [" + prefix + "] " + name; // } // // public String toStringNoName() // { // if (prefix.isEmpty()) // { // return rarity + "★ " + name; // } // return rarity + "★ [" + prefix + "]"; // } // }
import discord4j.core.object.entity.Message; import io.github.spugn.Sargo.Objects.Banner; import io.github.spugn.Sargo.Objects.Character; import java.util.List;
PLATINUM = PLATINUM * 2.0; default: break; } } } @Override protected void updateBannerData() { int currentStep = USER.getBannerData(SELECTED_BANNER.getBannerName()); currentStep++; if (currentStep > 6) { USER.changeValue(SELECTED_BANNER.getBannerName(), 6); } else { USER.changeValue(SELECTED_BANNER.getBannerName(), currentStep); } } @Override protected Character randGoldCharacter() { /* GET A RANDOM GOLD VARIANT CHARACTER, IF THERE IS A PLATINUM VARIANT OF THAT CHARACTER IN THE BANNER THEN GET A NEW CHARACTER. */ Character c = null; boolean charInBanner = true; int randIndex;
// Path: src/main/java/io/github/spugn/Sargo/Objects/Banner.java // public class Banner // { // private int bannerID; // private String bannerName; // private int bannerType; // private int bannerWepType; // private ArrayList<Character> characters; // private ArrayList<Weapon> weapons; // // public int getBannerID() // { // return bannerID; // } // // public String getBannerName() // { // return bannerName; // } // // public int getBannerType() // { // return bannerType; // } // // public int getBannerWepType() // { // return bannerWepType; // } // // public ArrayList<Character> getCharacters() // { // return characters; // } // // public ArrayList<Weapon> getWeapons() // { // return weapons; // } // // public void setBannerID(int bannerID) // { // this.bannerID = bannerID; // } // // public void setBannerName(String bannerName) // { // this.bannerName = bannerName; // } // // public void setBannerType(int bannerType) // { // this.bannerType = bannerType; // } // // public void setBannerWepType(int bannerWepType) // { // this.bannerWepType = bannerWepType; // } // // public void setCharacters(ArrayList<Character> characters) // { // this.characters = characters; // } // // public void setWeapons(ArrayList<Weapon> weapons) // { // this.weapons = weapons; // } // // public String bannerTypeToString() // { // switch(bannerType) // { // case 0: // return "Normal"; // case 1: // return "Step Up"; // case 2: // return "Record Crystal"; // case 3: // return "Step Up v2"; // case 4: // return "Birthday Step Up"; // case 5: // return "Record Crystal v2"; // case 6: // return "Memorial Scout"; // case 7: // return "Step Up v3"; // case 8: // return "Record Crystal v3"; // case 9: // return "Event"; // case 10: // return "SAO Game 5th Anniversary Step Up"; // case 11: // return "Record Crystal v4"; // case 12: // return "Step Up v4"; // case 13: // return "Step Up v5"; // case 14: // return "SAO Game 5th Anniversary Step Up v2"; // case 15: // return "Step Up v6"; // case 16: // return "SAO Game 5th Anniversary Step Up v3"; // case 17: // return "Step Up v7"; // case 18: // return "Record Crystal v5"; // case 19: // return "Step Up v8"; // case 20: // return "Record Crystal v6"; // case 21: // return "Step Up v9"; // default: // return "Unknown"; // } // } // // @Override // public String toString() // { // return bannerID + ") " + bannerName; // } // } // // Path: src/main/java/io/github/spugn/Sargo/Objects/Character.java // public class Character // { // private String prefix; // private String name; // private int rarity; // private String imagePath; // // public Character() // { // prefix = ""; // name = "null"; // rarity = 1; // imagePath = ""; // } // // public void setPrefix(String prefix) // { // this.prefix = prefix; // } // // public void setName(String name) // { // this.name = name; // } // // public void setRarity(int rarity) // { // this.rarity = rarity; // } // // public void setImagePath(String imagePath) // { // this.imagePath = imagePath; // } // // public String getPrefix() // { // return prefix; // } // // public String getName() // { // return name; // } // // public int getRarity() // { // return rarity; // } // // public String getImagePath() // { // return imagePath; // } // // @Override // public String toString() // { // if (prefix.isEmpty()) // { // return rarity + "★ " + name; // } // return rarity + "★ [" + prefix + "] " + name; // } // // public String toStringNoName() // { // if (prefix.isEmpty()) // { // return rarity + "★ " + name; // } // return rarity + "★ [" + prefix + "]"; // } // } // Path: src/main/java/io/github/spugn/Sargo/CharacterScout/SAOGameFifthAnniversaryStepUpv3.java import discord4j.core.object.entity.Message; import io.github.spugn.Sargo.Objects.Banner; import io.github.spugn.Sargo.Objects.Character; import java.util.List; PLATINUM = PLATINUM * 2.0; default: break; } } } @Override protected void updateBannerData() { int currentStep = USER.getBannerData(SELECTED_BANNER.getBannerName()); currentStep++; if (currentStep > 6) { USER.changeValue(SELECTED_BANNER.getBannerName(), 6); } else { USER.changeValue(SELECTED_BANNER.getBannerName(), currentStep); } } @Override protected Character randGoldCharacter() { /* GET A RANDOM GOLD VARIANT CHARACTER, IF THERE IS A PLATINUM VARIANT OF THAT CHARACTER IN THE BANNER THEN GET A NEW CHARACTER. */ Character c = null; boolean charInBanner = true; int randIndex;
Banner randBanner;
Expugn/S-argo
src/main/java/io/github/spugn/Sargo/CharacterScout/SAOGameFifthAnniversaryStepUpv2.java
// Path: src/main/java/io/github/spugn/Sargo/Objects/Banner.java // public class Banner // { // private int bannerID; // private String bannerName; // private int bannerType; // private int bannerWepType; // private ArrayList<Character> characters; // private ArrayList<Weapon> weapons; // // public int getBannerID() // { // return bannerID; // } // // public String getBannerName() // { // return bannerName; // } // // public int getBannerType() // { // return bannerType; // } // // public int getBannerWepType() // { // return bannerWepType; // } // // public ArrayList<Character> getCharacters() // { // return characters; // } // // public ArrayList<Weapon> getWeapons() // { // return weapons; // } // // public void setBannerID(int bannerID) // { // this.bannerID = bannerID; // } // // public void setBannerName(String bannerName) // { // this.bannerName = bannerName; // } // // public void setBannerType(int bannerType) // { // this.bannerType = bannerType; // } // // public void setBannerWepType(int bannerWepType) // { // this.bannerWepType = bannerWepType; // } // // public void setCharacters(ArrayList<Character> characters) // { // this.characters = characters; // } // // public void setWeapons(ArrayList<Weapon> weapons) // { // this.weapons = weapons; // } // // public String bannerTypeToString() // { // switch(bannerType) // { // case 0: // return "Normal"; // case 1: // return "Step Up"; // case 2: // return "Record Crystal"; // case 3: // return "Step Up v2"; // case 4: // return "Birthday Step Up"; // case 5: // return "Record Crystal v2"; // case 6: // return "Memorial Scout"; // case 7: // return "Step Up v3"; // case 8: // return "Record Crystal v3"; // case 9: // return "Event"; // case 10: // return "SAO Game 5th Anniversary Step Up"; // case 11: // return "Record Crystal v4"; // case 12: // return "Step Up v4"; // case 13: // return "Step Up v5"; // case 14: // return "SAO Game 5th Anniversary Step Up v2"; // case 15: // return "Step Up v6"; // case 16: // return "SAO Game 5th Anniversary Step Up v3"; // case 17: // return "Step Up v7"; // case 18: // return "Record Crystal v5"; // case 19: // return "Step Up v8"; // case 20: // return "Record Crystal v6"; // case 21: // return "Step Up v9"; // default: // return "Unknown"; // } // } // // @Override // public String toString() // { // return bannerID + ") " + bannerName; // } // } // // Path: src/main/java/io/github/spugn/Sargo/Objects/Character.java // public class Character // { // private String prefix; // private String name; // private int rarity; // private String imagePath; // // public Character() // { // prefix = ""; // name = "null"; // rarity = 1; // imagePath = ""; // } // // public void setPrefix(String prefix) // { // this.prefix = prefix; // } // // public void setName(String name) // { // this.name = name; // } // // public void setRarity(int rarity) // { // this.rarity = rarity; // } // // public void setImagePath(String imagePath) // { // this.imagePath = imagePath; // } // // public String getPrefix() // { // return prefix; // } // // public String getName() // { // return name; // } // // public int getRarity() // { // return rarity; // } // // public String getImagePath() // { // return imagePath; // } // // @Override // public String toString() // { // if (prefix.isEmpty()) // { // return rarity + "★ " + name; // } // return rarity + "★ [" + prefix + "] " + name; // } // // public String toStringNoName() // { // if (prefix.isEmpty()) // { // return rarity + "★ " + name; // } // return rarity + "★ [" + prefix + "]"; // } // }
import discord4j.core.object.entity.Message; import io.github.spugn.Sargo.Objects.Banner; import io.github.spugn.Sargo.Objects.Character; import java.util.List;
PLATINUM = PLATINUM * 1.5; break; case 5: guaranteeOnePlatinum = true; break; case 6: COPPER = COPPER - ((PLATINUM * 2.0) - PLATINUM); PLATINUM = PLATINUM * 2.0; default: break; } } } @Override protected void updateBannerData() { int currentStep = USER.getBannerData(SELECTED_BANNER.getBannerName()); currentStep++; if (currentStep > 6) { USER.changeValue(SELECTED_BANNER.getBannerName(), 6); } else { USER.changeValue(SELECTED_BANNER.getBannerName(), currentStep); } } @Override
// Path: src/main/java/io/github/spugn/Sargo/Objects/Banner.java // public class Banner // { // private int bannerID; // private String bannerName; // private int bannerType; // private int bannerWepType; // private ArrayList<Character> characters; // private ArrayList<Weapon> weapons; // // public int getBannerID() // { // return bannerID; // } // // public String getBannerName() // { // return bannerName; // } // // public int getBannerType() // { // return bannerType; // } // // public int getBannerWepType() // { // return bannerWepType; // } // // public ArrayList<Character> getCharacters() // { // return characters; // } // // public ArrayList<Weapon> getWeapons() // { // return weapons; // } // // public void setBannerID(int bannerID) // { // this.bannerID = bannerID; // } // // public void setBannerName(String bannerName) // { // this.bannerName = bannerName; // } // // public void setBannerType(int bannerType) // { // this.bannerType = bannerType; // } // // public void setBannerWepType(int bannerWepType) // { // this.bannerWepType = bannerWepType; // } // // public void setCharacters(ArrayList<Character> characters) // { // this.characters = characters; // } // // public void setWeapons(ArrayList<Weapon> weapons) // { // this.weapons = weapons; // } // // public String bannerTypeToString() // { // switch(bannerType) // { // case 0: // return "Normal"; // case 1: // return "Step Up"; // case 2: // return "Record Crystal"; // case 3: // return "Step Up v2"; // case 4: // return "Birthday Step Up"; // case 5: // return "Record Crystal v2"; // case 6: // return "Memorial Scout"; // case 7: // return "Step Up v3"; // case 8: // return "Record Crystal v3"; // case 9: // return "Event"; // case 10: // return "SAO Game 5th Anniversary Step Up"; // case 11: // return "Record Crystal v4"; // case 12: // return "Step Up v4"; // case 13: // return "Step Up v5"; // case 14: // return "SAO Game 5th Anniversary Step Up v2"; // case 15: // return "Step Up v6"; // case 16: // return "SAO Game 5th Anniversary Step Up v3"; // case 17: // return "Step Up v7"; // case 18: // return "Record Crystal v5"; // case 19: // return "Step Up v8"; // case 20: // return "Record Crystal v6"; // case 21: // return "Step Up v9"; // default: // return "Unknown"; // } // } // // @Override // public String toString() // { // return bannerID + ") " + bannerName; // } // } // // Path: src/main/java/io/github/spugn/Sargo/Objects/Character.java // public class Character // { // private String prefix; // private String name; // private int rarity; // private String imagePath; // // public Character() // { // prefix = ""; // name = "null"; // rarity = 1; // imagePath = ""; // } // // public void setPrefix(String prefix) // { // this.prefix = prefix; // } // // public void setName(String name) // { // this.name = name; // } // // public void setRarity(int rarity) // { // this.rarity = rarity; // } // // public void setImagePath(String imagePath) // { // this.imagePath = imagePath; // } // // public String getPrefix() // { // return prefix; // } // // public String getName() // { // return name; // } // // public int getRarity() // { // return rarity; // } // // public String getImagePath() // { // return imagePath; // } // // @Override // public String toString() // { // if (prefix.isEmpty()) // { // return rarity + "★ " + name; // } // return rarity + "★ [" + prefix + "] " + name; // } // // public String toStringNoName() // { // if (prefix.isEmpty()) // { // return rarity + "★ " + name; // } // return rarity + "★ [" + prefix + "]"; // } // } // Path: src/main/java/io/github/spugn/Sargo/CharacterScout/SAOGameFifthAnniversaryStepUpv2.java import discord4j.core.object.entity.Message; import io.github.spugn.Sargo.Objects.Banner; import io.github.spugn.Sargo.Objects.Character; import java.util.List; PLATINUM = PLATINUM * 1.5; break; case 5: guaranteeOnePlatinum = true; break; case 6: COPPER = COPPER - ((PLATINUM * 2.0) - PLATINUM); PLATINUM = PLATINUM * 2.0; default: break; } } } @Override protected void updateBannerData() { int currentStep = USER.getBannerData(SELECTED_BANNER.getBannerName()); currentStep++; if (currentStep > 6) { USER.changeValue(SELECTED_BANNER.getBannerName(), 6); } else { USER.changeValue(SELECTED_BANNER.getBannerName(), currentStep); } } @Override
protected Character randGoldCharacter()
Expugn/S-argo
src/main/java/io/github/spugn/Sargo/CharacterScout/SAOGameFifthAnniversaryStepUpv2.java
// Path: src/main/java/io/github/spugn/Sargo/Objects/Banner.java // public class Banner // { // private int bannerID; // private String bannerName; // private int bannerType; // private int bannerWepType; // private ArrayList<Character> characters; // private ArrayList<Weapon> weapons; // // public int getBannerID() // { // return bannerID; // } // // public String getBannerName() // { // return bannerName; // } // // public int getBannerType() // { // return bannerType; // } // // public int getBannerWepType() // { // return bannerWepType; // } // // public ArrayList<Character> getCharacters() // { // return characters; // } // // public ArrayList<Weapon> getWeapons() // { // return weapons; // } // // public void setBannerID(int bannerID) // { // this.bannerID = bannerID; // } // // public void setBannerName(String bannerName) // { // this.bannerName = bannerName; // } // // public void setBannerType(int bannerType) // { // this.bannerType = bannerType; // } // // public void setBannerWepType(int bannerWepType) // { // this.bannerWepType = bannerWepType; // } // // public void setCharacters(ArrayList<Character> characters) // { // this.characters = characters; // } // // public void setWeapons(ArrayList<Weapon> weapons) // { // this.weapons = weapons; // } // // public String bannerTypeToString() // { // switch(bannerType) // { // case 0: // return "Normal"; // case 1: // return "Step Up"; // case 2: // return "Record Crystal"; // case 3: // return "Step Up v2"; // case 4: // return "Birthday Step Up"; // case 5: // return "Record Crystal v2"; // case 6: // return "Memorial Scout"; // case 7: // return "Step Up v3"; // case 8: // return "Record Crystal v3"; // case 9: // return "Event"; // case 10: // return "SAO Game 5th Anniversary Step Up"; // case 11: // return "Record Crystal v4"; // case 12: // return "Step Up v4"; // case 13: // return "Step Up v5"; // case 14: // return "SAO Game 5th Anniversary Step Up v2"; // case 15: // return "Step Up v6"; // case 16: // return "SAO Game 5th Anniversary Step Up v3"; // case 17: // return "Step Up v7"; // case 18: // return "Record Crystal v5"; // case 19: // return "Step Up v8"; // case 20: // return "Record Crystal v6"; // case 21: // return "Step Up v9"; // default: // return "Unknown"; // } // } // // @Override // public String toString() // { // return bannerID + ") " + bannerName; // } // } // // Path: src/main/java/io/github/spugn/Sargo/Objects/Character.java // public class Character // { // private String prefix; // private String name; // private int rarity; // private String imagePath; // // public Character() // { // prefix = ""; // name = "null"; // rarity = 1; // imagePath = ""; // } // // public void setPrefix(String prefix) // { // this.prefix = prefix; // } // // public void setName(String name) // { // this.name = name; // } // // public void setRarity(int rarity) // { // this.rarity = rarity; // } // // public void setImagePath(String imagePath) // { // this.imagePath = imagePath; // } // // public String getPrefix() // { // return prefix; // } // // public String getName() // { // return name; // } // // public int getRarity() // { // return rarity; // } // // public String getImagePath() // { // return imagePath; // } // // @Override // public String toString() // { // if (prefix.isEmpty()) // { // return rarity + "★ " + name; // } // return rarity + "★ [" + prefix + "] " + name; // } // // public String toStringNoName() // { // if (prefix.isEmpty()) // { // return rarity + "★ " + name; // } // return rarity + "★ [" + prefix + "]"; // } // }
import discord4j.core.object.entity.Message; import io.github.spugn.Sargo.Objects.Banner; import io.github.spugn.Sargo.Objects.Character; import java.util.List;
PLATINUM = PLATINUM * 2.0; default: break; } } } @Override protected void updateBannerData() { int currentStep = USER.getBannerData(SELECTED_BANNER.getBannerName()); currentStep++; if (currentStep > 6) { USER.changeValue(SELECTED_BANNER.getBannerName(), 6); } else { USER.changeValue(SELECTED_BANNER.getBannerName(), currentStep); } } @Override protected Character randGoldCharacter() { /* GET A RANDOM GOLD VARIANT CHARACTER, IF THERE IS A PLATINUM VARIANT OF THAT CHARACTER IN THE BANNER THEN GET A NEW CHARACTER. */ Character c = null; boolean charInBanner = true; int randIndex;
// Path: src/main/java/io/github/spugn/Sargo/Objects/Banner.java // public class Banner // { // private int bannerID; // private String bannerName; // private int bannerType; // private int bannerWepType; // private ArrayList<Character> characters; // private ArrayList<Weapon> weapons; // // public int getBannerID() // { // return bannerID; // } // // public String getBannerName() // { // return bannerName; // } // // public int getBannerType() // { // return bannerType; // } // // public int getBannerWepType() // { // return bannerWepType; // } // // public ArrayList<Character> getCharacters() // { // return characters; // } // // public ArrayList<Weapon> getWeapons() // { // return weapons; // } // // public void setBannerID(int bannerID) // { // this.bannerID = bannerID; // } // // public void setBannerName(String bannerName) // { // this.bannerName = bannerName; // } // // public void setBannerType(int bannerType) // { // this.bannerType = bannerType; // } // // public void setBannerWepType(int bannerWepType) // { // this.bannerWepType = bannerWepType; // } // // public void setCharacters(ArrayList<Character> characters) // { // this.characters = characters; // } // // public void setWeapons(ArrayList<Weapon> weapons) // { // this.weapons = weapons; // } // // public String bannerTypeToString() // { // switch(bannerType) // { // case 0: // return "Normal"; // case 1: // return "Step Up"; // case 2: // return "Record Crystal"; // case 3: // return "Step Up v2"; // case 4: // return "Birthday Step Up"; // case 5: // return "Record Crystal v2"; // case 6: // return "Memorial Scout"; // case 7: // return "Step Up v3"; // case 8: // return "Record Crystal v3"; // case 9: // return "Event"; // case 10: // return "SAO Game 5th Anniversary Step Up"; // case 11: // return "Record Crystal v4"; // case 12: // return "Step Up v4"; // case 13: // return "Step Up v5"; // case 14: // return "SAO Game 5th Anniversary Step Up v2"; // case 15: // return "Step Up v6"; // case 16: // return "SAO Game 5th Anniversary Step Up v3"; // case 17: // return "Step Up v7"; // case 18: // return "Record Crystal v5"; // case 19: // return "Step Up v8"; // case 20: // return "Record Crystal v6"; // case 21: // return "Step Up v9"; // default: // return "Unknown"; // } // } // // @Override // public String toString() // { // return bannerID + ") " + bannerName; // } // } // // Path: src/main/java/io/github/spugn/Sargo/Objects/Character.java // public class Character // { // private String prefix; // private String name; // private int rarity; // private String imagePath; // // public Character() // { // prefix = ""; // name = "null"; // rarity = 1; // imagePath = ""; // } // // public void setPrefix(String prefix) // { // this.prefix = prefix; // } // // public void setName(String name) // { // this.name = name; // } // // public void setRarity(int rarity) // { // this.rarity = rarity; // } // // public void setImagePath(String imagePath) // { // this.imagePath = imagePath; // } // // public String getPrefix() // { // return prefix; // } // // public String getName() // { // return name; // } // // public int getRarity() // { // return rarity; // } // // public String getImagePath() // { // return imagePath; // } // // @Override // public String toString() // { // if (prefix.isEmpty()) // { // return rarity + "★ " + name; // } // return rarity + "★ [" + prefix + "] " + name; // } // // public String toStringNoName() // { // if (prefix.isEmpty()) // { // return rarity + "★ " + name; // } // return rarity + "★ [" + prefix + "]"; // } // } // Path: src/main/java/io/github/spugn/Sargo/CharacterScout/SAOGameFifthAnniversaryStepUpv2.java import discord4j.core.object.entity.Message; import io.github.spugn.Sargo.Objects.Banner; import io.github.spugn.Sargo.Objects.Character; import java.util.List; PLATINUM = PLATINUM * 2.0; default: break; } } } @Override protected void updateBannerData() { int currentStep = USER.getBannerData(SELECTED_BANNER.getBannerName()); currentStep++; if (currentStep > 6) { USER.changeValue(SELECTED_BANNER.getBannerName(), 6); } else { USER.changeValue(SELECTED_BANNER.getBannerName(), currentStep); } } @Override protected Character randGoldCharacter() { /* GET A RANDOM GOLD VARIANT CHARACTER, IF THERE IS A PLATINUM VARIANT OF THAT CHARACTER IN THE BANNER THEN GET A NEW CHARACTER. */ Character c = null; boolean charInBanner = true; int randIndex;
Banner randBanner;
Expugn/S-argo
src/main/java/io/github/spugn/Sargo/TicketScout/Normalv2.java
// Path: src/main/java/io/github/spugn/Sargo/Objects/Item.java // public class Item // { // private String name; // private int quantity; // private int value; // private String imagePath; // // public Item() // { // name = "null"; // quantity = 0; // value = -1; // imagePath = ""; // } // // public Item(String name, int quantity, int value) // { // this.name = name; // this.quantity = quantity; // this.value = value; // imagePath = ""; // } // // public void setName(String name) // { // this.name = name; // } // // public void setQuantity(int quantity) // { // this.quantity = quantity; // } // // public void setImagePath(String imagePath) // { // this.imagePath = imagePath; // } // // public String getName() // { // return name; // } // // public String getImagePath() // { // if (imagePath.isEmpty()) // { // return "images/Items/" + name.replaceAll(" ", "_") + ".png"; // } // return imagePath; // } // // public int getQuantity() // { // return quantity; // } // // public int getValue() // { // return value; // } // // @Override // public String toString() // { // return name + " x" + quantity; // } // } // // Path: src/main/java/io/github/spugn/Sargo/Utilities/GitHubImage.java // public class GitHubImage // { // private String filePath; // private final String GITHUB_IMAGE; // // public GitHubImage(String filePath) // { // GITHUB_IMAGE = LoginSettingsParser.getGitHubRepoURL(); // this.filePath = filePath; // } // // public String getURL() // { // String url = GITHUB_IMAGE + filePath; // // /* REPLACE ALL SPACES WITH %20 */ // url = url.replaceAll(" ", "%20"); // // /* REPLACE ALL ★ WITH %E2%98%85 */ // url = url.replaceAll("★", "%E2%98%85"); // // return url; // } // }
import discord4j.core.object.entity.Message; import io.github.spugn.Sargo.Objects.Item; import io.github.spugn.Sargo.Utilities.GitHubImage;
package io.github.spugn.Sargo.TicketScout; public class Normalv2 extends TicketScout { public Normalv2(Message message, String choice, String discordID) { super(message, choice, discordID); run(); } @Override protected void initItems() {
// Path: src/main/java/io/github/spugn/Sargo/Objects/Item.java // public class Item // { // private String name; // private int quantity; // private int value; // private String imagePath; // // public Item() // { // name = "null"; // quantity = 0; // value = -1; // imagePath = ""; // } // // public Item(String name, int quantity, int value) // { // this.name = name; // this.quantity = quantity; // this.value = value; // imagePath = ""; // } // // public void setName(String name) // { // this.name = name; // } // // public void setQuantity(int quantity) // { // this.quantity = quantity; // } // // public void setImagePath(String imagePath) // { // this.imagePath = imagePath; // } // // public String getName() // { // return name; // } // // public String getImagePath() // { // if (imagePath.isEmpty()) // { // return "images/Items/" + name.replaceAll(" ", "_") + ".png"; // } // return imagePath; // } // // public int getQuantity() // { // return quantity; // } // // public int getValue() // { // return value; // } // // @Override // public String toString() // { // return name + " x" + quantity; // } // } // // Path: src/main/java/io/github/spugn/Sargo/Utilities/GitHubImage.java // public class GitHubImage // { // private String filePath; // private final String GITHUB_IMAGE; // // public GitHubImage(String filePath) // { // GITHUB_IMAGE = LoginSettingsParser.getGitHubRepoURL(); // this.filePath = filePath; // } // // public String getURL() // { // String url = GITHUB_IMAGE + filePath; // // /* REPLACE ALL SPACES WITH %20 */ // url = url.replaceAll(" ", "%20"); // // /* REPLACE ALL ★ WITH %E2%98%85 */ // url = url.replaceAll("★", "%E2%98%85"); // // return url; // } // } // Path: src/main/java/io/github/spugn/Sargo/TicketScout/Normalv2.java import discord4j.core.object.entity.Message; import io.github.spugn.Sargo.Objects.Item; import io.github.spugn.Sargo.Utilities.GitHubImage; package io.github.spugn.Sargo.TicketScout; public class Normalv2 extends TicketScout { public Normalv2(Message message, String choice, String discordID) { super(message, choice, discordID); run(); } @Override protected void initItems() {
attributeItemsList.add(new Item("HP Shard", 50, 2500));
Expugn/S-argo
src/main/java/io/github/spugn/Sargo/TicketScout/Normalv2.java
// Path: src/main/java/io/github/spugn/Sargo/Objects/Item.java // public class Item // { // private String name; // private int quantity; // private int value; // private String imagePath; // // public Item() // { // name = "null"; // quantity = 0; // value = -1; // imagePath = ""; // } // // public Item(String name, int quantity, int value) // { // this.name = name; // this.quantity = quantity; // this.value = value; // imagePath = ""; // } // // public void setName(String name) // { // this.name = name; // } // // public void setQuantity(int quantity) // { // this.quantity = quantity; // } // // public void setImagePath(String imagePath) // { // this.imagePath = imagePath; // } // // public String getName() // { // return name; // } // // public String getImagePath() // { // if (imagePath.isEmpty()) // { // return "images/Items/" + name.replaceAll(" ", "_") + ".png"; // } // return imagePath; // } // // public int getQuantity() // { // return quantity; // } // // public int getValue() // { // return value; // } // // @Override // public String toString() // { // return name + " x" + quantity; // } // } // // Path: src/main/java/io/github/spugn/Sargo/Utilities/GitHubImage.java // public class GitHubImage // { // private String filePath; // private final String GITHUB_IMAGE; // // public GitHubImage(String filePath) // { // GITHUB_IMAGE = LoginSettingsParser.getGitHubRepoURL(); // this.filePath = filePath; // } // // public String getURL() // { // String url = GITHUB_IMAGE + filePath; // // /* REPLACE ALL SPACES WITH %20 */ // url = url.replaceAll(" ", "%20"); // // /* REPLACE ALL ★ WITH %E2%98%85 */ // url = url.replaceAll("★", "%E2%98%85"); // // return url; // } // }
import discord4j.core.object.entity.Message; import io.github.spugn.Sargo.Objects.Item; import io.github.spugn.Sargo.Utilities.GitHubImage;
/* RAINBOW ESSENCE */ else if (value == 5) { item = new Item("Rainbow Essence", 1, -1); } /* UPGRADE CRYSTAL */ else if (value == 6) { item = new Item("Upgrade Crystal", 1, -1); } /* MEMORY FRAGMENT */ else if (value == 7) { item = new Item("Memory Fragment", 1, -1); } /* COL */ else { item = new Item("Col", 50000, 50000); } giveCol(item); return item; } @Override protected void setupScoutMenu() { if (!SIMPLE_MESSAGE) {
// Path: src/main/java/io/github/spugn/Sargo/Objects/Item.java // public class Item // { // private String name; // private int quantity; // private int value; // private String imagePath; // // public Item() // { // name = "null"; // quantity = 0; // value = -1; // imagePath = ""; // } // // public Item(String name, int quantity, int value) // { // this.name = name; // this.quantity = quantity; // this.value = value; // imagePath = ""; // } // // public void setName(String name) // { // this.name = name; // } // // public void setQuantity(int quantity) // { // this.quantity = quantity; // } // // public void setImagePath(String imagePath) // { // this.imagePath = imagePath; // } // // public String getName() // { // return name; // } // // public String getImagePath() // { // if (imagePath.isEmpty()) // { // return "images/Items/" + name.replaceAll(" ", "_") + ".png"; // } // return imagePath; // } // // public int getQuantity() // { // return quantity; // } // // public int getValue() // { // return value; // } // // @Override // public String toString() // { // return name + " x" + quantity; // } // } // // Path: src/main/java/io/github/spugn/Sargo/Utilities/GitHubImage.java // public class GitHubImage // { // private String filePath; // private final String GITHUB_IMAGE; // // public GitHubImage(String filePath) // { // GITHUB_IMAGE = LoginSettingsParser.getGitHubRepoURL(); // this.filePath = filePath; // } // // public String getURL() // { // String url = GITHUB_IMAGE + filePath; // // /* REPLACE ALL SPACES WITH %20 */ // url = url.replaceAll(" ", "%20"); // // /* REPLACE ALL ★ WITH %E2%98%85 */ // url = url.replaceAll("★", "%E2%98%85"); // // return url; // } // } // Path: src/main/java/io/github/spugn/Sargo/TicketScout/Normalv2.java import discord4j.core.object.entity.Message; import io.github.spugn.Sargo.Objects.Item; import io.github.spugn.Sargo.Utilities.GitHubImage; /* RAINBOW ESSENCE */ else if (value == 5) { item = new Item("Rainbow Essence", 1, -1); } /* UPGRADE CRYSTAL */ else if (value == 6) { item = new Item("Upgrade Crystal", 1, -1); } /* MEMORY FRAGMENT */ else if (value == 7) { item = new Item("Memory Fragment", 1, -1); } /* COL */ else { item = new Item("Col", 50000, 50000); } giveCol(item); return item; } @Override protected void setupScoutMenu() { if (!SIMPLE_MESSAGE) {
sMenu = sMenu.andThen(s -> s.setAuthor("Normal Ticket v2 Scout", "", new GitHubImage("images/System/Scout_Icon.png").getURL())
Expugn/S-argo
src/main/java/io/github/spugn/Sargo/CharacterScout/StepUpv5.java
// Path: src/main/java/io/github/spugn/Sargo/Objects/Banner.java // public class Banner // { // private int bannerID; // private String bannerName; // private int bannerType; // private int bannerWepType; // private ArrayList<Character> characters; // private ArrayList<Weapon> weapons; // // public int getBannerID() // { // return bannerID; // } // // public String getBannerName() // { // return bannerName; // } // // public int getBannerType() // { // return bannerType; // } // // public int getBannerWepType() // { // return bannerWepType; // } // // public ArrayList<Character> getCharacters() // { // return characters; // } // // public ArrayList<Weapon> getWeapons() // { // return weapons; // } // // public void setBannerID(int bannerID) // { // this.bannerID = bannerID; // } // // public void setBannerName(String bannerName) // { // this.bannerName = bannerName; // } // // public void setBannerType(int bannerType) // { // this.bannerType = bannerType; // } // // public void setBannerWepType(int bannerWepType) // { // this.bannerWepType = bannerWepType; // } // // public void setCharacters(ArrayList<Character> characters) // { // this.characters = characters; // } // // public void setWeapons(ArrayList<Weapon> weapons) // { // this.weapons = weapons; // } // // public String bannerTypeToString() // { // switch(bannerType) // { // case 0: // return "Normal"; // case 1: // return "Step Up"; // case 2: // return "Record Crystal"; // case 3: // return "Step Up v2"; // case 4: // return "Birthday Step Up"; // case 5: // return "Record Crystal v2"; // case 6: // return "Memorial Scout"; // case 7: // return "Step Up v3"; // case 8: // return "Record Crystal v3"; // case 9: // return "Event"; // case 10: // return "SAO Game 5th Anniversary Step Up"; // case 11: // return "Record Crystal v4"; // case 12: // return "Step Up v4"; // case 13: // return "Step Up v5"; // case 14: // return "SAO Game 5th Anniversary Step Up v2"; // case 15: // return "Step Up v6"; // case 16: // return "SAO Game 5th Anniversary Step Up v3"; // case 17: // return "Step Up v7"; // case 18: // return "Record Crystal v5"; // case 19: // return "Step Up v8"; // case 20: // return "Record Crystal v6"; // case 21: // return "Step Up v9"; // default: // return "Unknown"; // } // } // // @Override // public String toString() // { // return bannerID + ") " + bannerName; // } // } // // Path: src/main/java/io/github/spugn/Sargo/Objects/Character.java // public class Character // { // private String prefix; // private String name; // private int rarity; // private String imagePath; // // public Character() // { // prefix = ""; // name = "null"; // rarity = 1; // imagePath = ""; // } // // public void setPrefix(String prefix) // { // this.prefix = prefix; // } // // public void setName(String name) // { // this.name = name; // } // // public void setRarity(int rarity) // { // this.rarity = rarity; // } // // public void setImagePath(String imagePath) // { // this.imagePath = imagePath; // } // // public String getPrefix() // { // return prefix; // } // // public String getName() // { // return name; // } // // public int getRarity() // { // return rarity; // } // // public String getImagePath() // { // return imagePath; // } // // @Override // public String toString() // { // if (prefix.isEmpty()) // { // return rarity + "★ " + name; // } // return rarity + "★ [" + prefix + "] " + name; // } // // public String toStringNoName() // { // if (prefix.isEmpty()) // { // return rarity + "★ " + name; // } // return rarity + "★ [" + prefix + "]"; // } // }
import discord4j.core.object.entity.Message; import io.github.spugn.Sargo.Objects.Banner; import io.github.spugn.Sargo.Objects.Character; import java.util.List;
PLATINUM = PLATINUM * 1.5; break; case 5: guaranteeOnePlatinum = true; break; case 6: COPPER = COPPER - ((PLATINUM * 2.0) - PLATINUM); PLATINUM = PLATINUM * 2.0; default: break; } } } @Override protected void updateBannerData() { int currentStep = USER.getBannerData(SELECTED_BANNER.getBannerName()); currentStep++; if (currentStep > 6) { USER.changeValue(SELECTED_BANNER.getBannerName(), 6); } else { USER.changeValue(SELECTED_BANNER.getBannerName(), currentStep); } } @Override
// Path: src/main/java/io/github/spugn/Sargo/Objects/Banner.java // public class Banner // { // private int bannerID; // private String bannerName; // private int bannerType; // private int bannerWepType; // private ArrayList<Character> characters; // private ArrayList<Weapon> weapons; // // public int getBannerID() // { // return bannerID; // } // // public String getBannerName() // { // return bannerName; // } // // public int getBannerType() // { // return bannerType; // } // // public int getBannerWepType() // { // return bannerWepType; // } // // public ArrayList<Character> getCharacters() // { // return characters; // } // // public ArrayList<Weapon> getWeapons() // { // return weapons; // } // // public void setBannerID(int bannerID) // { // this.bannerID = bannerID; // } // // public void setBannerName(String bannerName) // { // this.bannerName = bannerName; // } // // public void setBannerType(int bannerType) // { // this.bannerType = bannerType; // } // // public void setBannerWepType(int bannerWepType) // { // this.bannerWepType = bannerWepType; // } // // public void setCharacters(ArrayList<Character> characters) // { // this.characters = characters; // } // // public void setWeapons(ArrayList<Weapon> weapons) // { // this.weapons = weapons; // } // // public String bannerTypeToString() // { // switch(bannerType) // { // case 0: // return "Normal"; // case 1: // return "Step Up"; // case 2: // return "Record Crystal"; // case 3: // return "Step Up v2"; // case 4: // return "Birthday Step Up"; // case 5: // return "Record Crystal v2"; // case 6: // return "Memorial Scout"; // case 7: // return "Step Up v3"; // case 8: // return "Record Crystal v3"; // case 9: // return "Event"; // case 10: // return "SAO Game 5th Anniversary Step Up"; // case 11: // return "Record Crystal v4"; // case 12: // return "Step Up v4"; // case 13: // return "Step Up v5"; // case 14: // return "SAO Game 5th Anniversary Step Up v2"; // case 15: // return "Step Up v6"; // case 16: // return "SAO Game 5th Anniversary Step Up v3"; // case 17: // return "Step Up v7"; // case 18: // return "Record Crystal v5"; // case 19: // return "Step Up v8"; // case 20: // return "Record Crystal v6"; // case 21: // return "Step Up v9"; // default: // return "Unknown"; // } // } // // @Override // public String toString() // { // return bannerID + ") " + bannerName; // } // } // // Path: src/main/java/io/github/spugn/Sargo/Objects/Character.java // public class Character // { // private String prefix; // private String name; // private int rarity; // private String imagePath; // // public Character() // { // prefix = ""; // name = "null"; // rarity = 1; // imagePath = ""; // } // // public void setPrefix(String prefix) // { // this.prefix = prefix; // } // // public void setName(String name) // { // this.name = name; // } // // public void setRarity(int rarity) // { // this.rarity = rarity; // } // // public void setImagePath(String imagePath) // { // this.imagePath = imagePath; // } // // public String getPrefix() // { // return prefix; // } // // public String getName() // { // return name; // } // // public int getRarity() // { // return rarity; // } // // public String getImagePath() // { // return imagePath; // } // // @Override // public String toString() // { // if (prefix.isEmpty()) // { // return rarity + "★ " + name; // } // return rarity + "★ [" + prefix + "] " + name; // } // // public String toStringNoName() // { // if (prefix.isEmpty()) // { // return rarity + "★ " + name; // } // return rarity + "★ [" + prefix + "]"; // } // } // Path: src/main/java/io/github/spugn/Sargo/CharacterScout/StepUpv5.java import discord4j.core.object.entity.Message; import io.github.spugn.Sargo.Objects.Banner; import io.github.spugn.Sargo.Objects.Character; import java.util.List; PLATINUM = PLATINUM * 1.5; break; case 5: guaranteeOnePlatinum = true; break; case 6: COPPER = COPPER - ((PLATINUM * 2.0) - PLATINUM); PLATINUM = PLATINUM * 2.0; default: break; } } } @Override protected void updateBannerData() { int currentStep = USER.getBannerData(SELECTED_BANNER.getBannerName()); currentStep++; if (currentStep > 6) { USER.changeValue(SELECTED_BANNER.getBannerName(), 6); } else { USER.changeValue(SELECTED_BANNER.getBannerName(), currentStep); } } @Override
protected Character randGoldCharacter()
Expugn/S-argo
src/main/java/io/github/spugn/Sargo/CharacterScout/StepUpv5.java
// Path: src/main/java/io/github/spugn/Sargo/Objects/Banner.java // public class Banner // { // private int bannerID; // private String bannerName; // private int bannerType; // private int bannerWepType; // private ArrayList<Character> characters; // private ArrayList<Weapon> weapons; // // public int getBannerID() // { // return bannerID; // } // // public String getBannerName() // { // return bannerName; // } // // public int getBannerType() // { // return bannerType; // } // // public int getBannerWepType() // { // return bannerWepType; // } // // public ArrayList<Character> getCharacters() // { // return characters; // } // // public ArrayList<Weapon> getWeapons() // { // return weapons; // } // // public void setBannerID(int bannerID) // { // this.bannerID = bannerID; // } // // public void setBannerName(String bannerName) // { // this.bannerName = bannerName; // } // // public void setBannerType(int bannerType) // { // this.bannerType = bannerType; // } // // public void setBannerWepType(int bannerWepType) // { // this.bannerWepType = bannerWepType; // } // // public void setCharacters(ArrayList<Character> characters) // { // this.characters = characters; // } // // public void setWeapons(ArrayList<Weapon> weapons) // { // this.weapons = weapons; // } // // public String bannerTypeToString() // { // switch(bannerType) // { // case 0: // return "Normal"; // case 1: // return "Step Up"; // case 2: // return "Record Crystal"; // case 3: // return "Step Up v2"; // case 4: // return "Birthday Step Up"; // case 5: // return "Record Crystal v2"; // case 6: // return "Memorial Scout"; // case 7: // return "Step Up v3"; // case 8: // return "Record Crystal v3"; // case 9: // return "Event"; // case 10: // return "SAO Game 5th Anniversary Step Up"; // case 11: // return "Record Crystal v4"; // case 12: // return "Step Up v4"; // case 13: // return "Step Up v5"; // case 14: // return "SAO Game 5th Anniversary Step Up v2"; // case 15: // return "Step Up v6"; // case 16: // return "SAO Game 5th Anniversary Step Up v3"; // case 17: // return "Step Up v7"; // case 18: // return "Record Crystal v5"; // case 19: // return "Step Up v8"; // case 20: // return "Record Crystal v6"; // case 21: // return "Step Up v9"; // default: // return "Unknown"; // } // } // // @Override // public String toString() // { // return bannerID + ") " + bannerName; // } // } // // Path: src/main/java/io/github/spugn/Sargo/Objects/Character.java // public class Character // { // private String prefix; // private String name; // private int rarity; // private String imagePath; // // public Character() // { // prefix = ""; // name = "null"; // rarity = 1; // imagePath = ""; // } // // public void setPrefix(String prefix) // { // this.prefix = prefix; // } // // public void setName(String name) // { // this.name = name; // } // // public void setRarity(int rarity) // { // this.rarity = rarity; // } // // public void setImagePath(String imagePath) // { // this.imagePath = imagePath; // } // // public String getPrefix() // { // return prefix; // } // // public String getName() // { // return name; // } // // public int getRarity() // { // return rarity; // } // // public String getImagePath() // { // return imagePath; // } // // @Override // public String toString() // { // if (prefix.isEmpty()) // { // return rarity + "★ " + name; // } // return rarity + "★ [" + prefix + "] " + name; // } // // public String toStringNoName() // { // if (prefix.isEmpty()) // { // return rarity + "★ " + name; // } // return rarity + "★ [" + prefix + "]"; // } // }
import discord4j.core.object.entity.Message; import io.github.spugn.Sargo.Objects.Banner; import io.github.spugn.Sargo.Objects.Character; import java.util.List;
PLATINUM = PLATINUM * 2.0; default: break; } } } @Override protected void updateBannerData() { int currentStep = USER.getBannerData(SELECTED_BANNER.getBannerName()); currentStep++; if (currentStep > 6) { USER.changeValue(SELECTED_BANNER.getBannerName(), 6); } else { USER.changeValue(SELECTED_BANNER.getBannerName(), currentStep); } } @Override protected Character randGoldCharacter() { /* GET A RANDOM GOLD VARIANT CHARACTER, IF THERE IS A PLATINUM VARIANT OF THAT CHARACTER IN THE BANNER THEN GET A NEW CHARACTER. */ Character c = null; boolean charInBanner = true; int randIndex;
// Path: src/main/java/io/github/spugn/Sargo/Objects/Banner.java // public class Banner // { // private int bannerID; // private String bannerName; // private int bannerType; // private int bannerWepType; // private ArrayList<Character> characters; // private ArrayList<Weapon> weapons; // // public int getBannerID() // { // return bannerID; // } // // public String getBannerName() // { // return bannerName; // } // // public int getBannerType() // { // return bannerType; // } // // public int getBannerWepType() // { // return bannerWepType; // } // // public ArrayList<Character> getCharacters() // { // return characters; // } // // public ArrayList<Weapon> getWeapons() // { // return weapons; // } // // public void setBannerID(int bannerID) // { // this.bannerID = bannerID; // } // // public void setBannerName(String bannerName) // { // this.bannerName = bannerName; // } // // public void setBannerType(int bannerType) // { // this.bannerType = bannerType; // } // // public void setBannerWepType(int bannerWepType) // { // this.bannerWepType = bannerWepType; // } // // public void setCharacters(ArrayList<Character> characters) // { // this.characters = characters; // } // // public void setWeapons(ArrayList<Weapon> weapons) // { // this.weapons = weapons; // } // // public String bannerTypeToString() // { // switch(bannerType) // { // case 0: // return "Normal"; // case 1: // return "Step Up"; // case 2: // return "Record Crystal"; // case 3: // return "Step Up v2"; // case 4: // return "Birthday Step Up"; // case 5: // return "Record Crystal v2"; // case 6: // return "Memorial Scout"; // case 7: // return "Step Up v3"; // case 8: // return "Record Crystal v3"; // case 9: // return "Event"; // case 10: // return "SAO Game 5th Anniversary Step Up"; // case 11: // return "Record Crystal v4"; // case 12: // return "Step Up v4"; // case 13: // return "Step Up v5"; // case 14: // return "SAO Game 5th Anniversary Step Up v2"; // case 15: // return "Step Up v6"; // case 16: // return "SAO Game 5th Anniversary Step Up v3"; // case 17: // return "Step Up v7"; // case 18: // return "Record Crystal v5"; // case 19: // return "Step Up v8"; // case 20: // return "Record Crystal v6"; // case 21: // return "Step Up v9"; // default: // return "Unknown"; // } // } // // @Override // public String toString() // { // return bannerID + ") " + bannerName; // } // } // // Path: src/main/java/io/github/spugn/Sargo/Objects/Character.java // public class Character // { // private String prefix; // private String name; // private int rarity; // private String imagePath; // // public Character() // { // prefix = ""; // name = "null"; // rarity = 1; // imagePath = ""; // } // // public void setPrefix(String prefix) // { // this.prefix = prefix; // } // // public void setName(String name) // { // this.name = name; // } // // public void setRarity(int rarity) // { // this.rarity = rarity; // } // // public void setImagePath(String imagePath) // { // this.imagePath = imagePath; // } // // public String getPrefix() // { // return prefix; // } // // public String getName() // { // return name; // } // // public int getRarity() // { // return rarity; // } // // public String getImagePath() // { // return imagePath; // } // // @Override // public String toString() // { // if (prefix.isEmpty()) // { // return rarity + "★ " + name; // } // return rarity + "★ [" + prefix + "] " + name; // } // // public String toStringNoName() // { // if (prefix.isEmpty()) // { // return rarity + "★ " + name; // } // return rarity + "★ [" + prefix + "]"; // } // } // Path: src/main/java/io/github/spugn/Sargo/CharacterScout/StepUpv5.java import discord4j.core.object.entity.Message; import io.github.spugn.Sargo.Objects.Banner; import io.github.spugn.Sargo.Objects.Character; import java.util.List; PLATINUM = PLATINUM * 2.0; default: break; } } } @Override protected void updateBannerData() { int currentStep = USER.getBannerData(SELECTED_BANNER.getBannerName()); currentStep++; if (currentStep > 6) { USER.changeValue(SELECTED_BANNER.getBannerName(), 6); } else { USER.changeValue(SELECTED_BANNER.getBannerName(), currentStep); } } @Override protected Character randGoldCharacter() { /* GET A RANDOM GOLD VARIANT CHARACTER, IF THERE IS A PLATINUM VARIANT OF THAT CHARACTER IN THE BANNER THEN GET A NEW CHARACTER. */ Character c = null; boolean charInBanner = true; int randIndex;
Banner randBanner;
Expugn/S-argo
src/main/java/io/github/spugn/Sargo/CharacterScout/StepUpv2.java
// Path: src/main/java/io/github/spugn/Sargo/Objects/Banner.java // public class Banner // { // private int bannerID; // private String bannerName; // private int bannerType; // private int bannerWepType; // private ArrayList<Character> characters; // private ArrayList<Weapon> weapons; // // public int getBannerID() // { // return bannerID; // } // // public String getBannerName() // { // return bannerName; // } // // public int getBannerType() // { // return bannerType; // } // // public int getBannerWepType() // { // return bannerWepType; // } // // public ArrayList<Character> getCharacters() // { // return characters; // } // // public ArrayList<Weapon> getWeapons() // { // return weapons; // } // // public void setBannerID(int bannerID) // { // this.bannerID = bannerID; // } // // public void setBannerName(String bannerName) // { // this.bannerName = bannerName; // } // // public void setBannerType(int bannerType) // { // this.bannerType = bannerType; // } // // public void setBannerWepType(int bannerWepType) // { // this.bannerWepType = bannerWepType; // } // // public void setCharacters(ArrayList<Character> characters) // { // this.characters = characters; // } // // public void setWeapons(ArrayList<Weapon> weapons) // { // this.weapons = weapons; // } // // public String bannerTypeToString() // { // switch(bannerType) // { // case 0: // return "Normal"; // case 1: // return "Step Up"; // case 2: // return "Record Crystal"; // case 3: // return "Step Up v2"; // case 4: // return "Birthday Step Up"; // case 5: // return "Record Crystal v2"; // case 6: // return "Memorial Scout"; // case 7: // return "Step Up v3"; // case 8: // return "Record Crystal v3"; // case 9: // return "Event"; // case 10: // return "SAO Game 5th Anniversary Step Up"; // case 11: // return "Record Crystal v4"; // case 12: // return "Step Up v4"; // case 13: // return "Step Up v5"; // case 14: // return "SAO Game 5th Anniversary Step Up v2"; // case 15: // return "Step Up v6"; // case 16: // return "SAO Game 5th Anniversary Step Up v3"; // case 17: // return "Step Up v7"; // case 18: // return "Record Crystal v5"; // case 19: // return "Step Up v8"; // case 20: // return "Record Crystal v6"; // case 21: // return "Step Up v9"; // default: // return "Unknown"; // } // } // // @Override // public String toString() // { // return bannerID + ") " + bannerName; // } // } // // Path: src/main/java/io/github/spugn/Sargo/Objects/Character.java // public class Character // { // private String prefix; // private String name; // private int rarity; // private String imagePath; // // public Character() // { // prefix = ""; // name = "null"; // rarity = 1; // imagePath = ""; // } // // public void setPrefix(String prefix) // { // this.prefix = prefix; // } // // public void setName(String name) // { // this.name = name; // } // // public void setRarity(int rarity) // { // this.rarity = rarity; // } // // public void setImagePath(String imagePath) // { // this.imagePath = imagePath; // } // // public String getPrefix() // { // return prefix; // } // // public String getName() // { // return name; // } // // public int getRarity() // { // return rarity; // } // // public String getImagePath() // { // return imagePath; // } // // @Override // public String toString() // { // if (prefix.isEmpty()) // { // return rarity + "★ " + name; // } // return rarity + "★ [" + prefix + "] " + name; // } // // public String toStringNoName() // { // if (prefix.isEmpty()) // { // return rarity + "★ " + name; // } // return rarity + "★ [" + prefix + "]"; // } // }
import discord4j.core.object.entity.Message; import io.github.spugn.Sargo.Objects.Banner; import io.github.spugn.Sargo.Objects.Character; import java.util.List;
PLATINUM = PLATINUM * 1.5; break; case 5: guaranteeOnePlatinum = true; break; case 6: COPPER = COPPER - ((PLATINUM * 2.0) - PLATINUM); PLATINUM = PLATINUM * 2.0; default: break; } } } @Override protected void updateBannerData() { int currentStep = USER.getBannerData(SELECTED_BANNER.getBannerName()); currentStep++; if (currentStep > 6) { USER.changeValue(SELECTED_BANNER.getBannerName(), 6); } else { USER.changeValue(SELECTED_BANNER.getBannerName(), currentStep); } } @Override
// Path: src/main/java/io/github/spugn/Sargo/Objects/Banner.java // public class Banner // { // private int bannerID; // private String bannerName; // private int bannerType; // private int bannerWepType; // private ArrayList<Character> characters; // private ArrayList<Weapon> weapons; // // public int getBannerID() // { // return bannerID; // } // // public String getBannerName() // { // return bannerName; // } // // public int getBannerType() // { // return bannerType; // } // // public int getBannerWepType() // { // return bannerWepType; // } // // public ArrayList<Character> getCharacters() // { // return characters; // } // // public ArrayList<Weapon> getWeapons() // { // return weapons; // } // // public void setBannerID(int bannerID) // { // this.bannerID = bannerID; // } // // public void setBannerName(String bannerName) // { // this.bannerName = bannerName; // } // // public void setBannerType(int bannerType) // { // this.bannerType = bannerType; // } // // public void setBannerWepType(int bannerWepType) // { // this.bannerWepType = bannerWepType; // } // // public void setCharacters(ArrayList<Character> characters) // { // this.characters = characters; // } // // public void setWeapons(ArrayList<Weapon> weapons) // { // this.weapons = weapons; // } // // public String bannerTypeToString() // { // switch(bannerType) // { // case 0: // return "Normal"; // case 1: // return "Step Up"; // case 2: // return "Record Crystal"; // case 3: // return "Step Up v2"; // case 4: // return "Birthday Step Up"; // case 5: // return "Record Crystal v2"; // case 6: // return "Memorial Scout"; // case 7: // return "Step Up v3"; // case 8: // return "Record Crystal v3"; // case 9: // return "Event"; // case 10: // return "SAO Game 5th Anniversary Step Up"; // case 11: // return "Record Crystal v4"; // case 12: // return "Step Up v4"; // case 13: // return "Step Up v5"; // case 14: // return "SAO Game 5th Anniversary Step Up v2"; // case 15: // return "Step Up v6"; // case 16: // return "SAO Game 5th Anniversary Step Up v3"; // case 17: // return "Step Up v7"; // case 18: // return "Record Crystal v5"; // case 19: // return "Step Up v8"; // case 20: // return "Record Crystal v6"; // case 21: // return "Step Up v9"; // default: // return "Unknown"; // } // } // // @Override // public String toString() // { // return bannerID + ") " + bannerName; // } // } // // Path: src/main/java/io/github/spugn/Sargo/Objects/Character.java // public class Character // { // private String prefix; // private String name; // private int rarity; // private String imagePath; // // public Character() // { // prefix = ""; // name = "null"; // rarity = 1; // imagePath = ""; // } // // public void setPrefix(String prefix) // { // this.prefix = prefix; // } // // public void setName(String name) // { // this.name = name; // } // // public void setRarity(int rarity) // { // this.rarity = rarity; // } // // public void setImagePath(String imagePath) // { // this.imagePath = imagePath; // } // // public String getPrefix() // { // return prefix; // } // // public String getName() // { // return name; // } // // public int getRarity() // { // return rarity; // } // // public String getImagePath() // { // return imagePath; // } // // @Override // public String toString() // { // if (prefix.isEmpty()) // { // return rarity + "★ " + name; // } // return rarity + "★ [" + prefix + "] " + name; // } // // public String toStringNoName() // { // if (prefix.isEmpty()) // { // return rarity + "★ " + name; // } // return rarity + "★ [" + prefix + "]"; // } // } // Path: src/main/java/io/github/spugn/Sargo/CharacterScout/StepUpv2.java import discord4j.core.object.entity.Message; import io.github.spugn.Sargo.Objects.Banner; import io.github.spugn.Sargo.Objects.Character; import java.util.List; PLATINUM = PLATINUM * 1.5; break; case 5: guaranteeOnePlatinum = true; break; case 6: COPPER = COPPER - ((PLATINUM * 2.0) - PLATINUM); PLATINUM = PLATINUM * 2.0; default: break; } } } @Override protected void updateBannerData() { int currentStep = USER.getBannerData(SELECTED_BANNER.getBannerName()); currentStep++; if (currentStep > 6) { USER.changeValue(SELECTED_BANNER.getBannerName(), 6); } else { USER.changeValue(SELECTED_BANNER.getBannerName(), currentStep); } } @Override
protected Character randGoldCharacter()
Expugn/S-argo
src/main/java/io/github/spugn/Sargo/CharacterScout/StepUpv2.java
// Path: src/main/java/io/github/spugn/Sargo/Objects/Banner.java // public class Banner // { // private int bannerID; // private String bannerName; // private int bannerType; // private int bannerWepType; // private ArrayList<Character> characters; // private ArrayList<Weapon> weapons; // // public int getBannerID() // { // return bannerID; // } // // public String getBannerName() // { // return bannerName; // } // // public int getBannerType() // { // return bannerType; // } // // public int getBannerWepType() // { // return bannerWepType; // } // // public ArrayList<Character> getCharacters() // { // return characters; // } // // public ArrayList<Weapon> getWeapons() // { // return weapons; // } // // public void setBannerID(int bannerID) // { // this.bannerID = bannerID; // } // // public void setBannerName(String bannerName) // { // this.bannerName = bannerName; // } // // public void setBannerType(int bannerType) // { // this.bannerType = bannerType; // } // // public void setBannerWepType(int bannerWepType) // { // this.bannerWepType = bannerWepType; // } // // public void setCharacters(ArrayList<Character> characters) // { // this.characters = characters; // } // // public void setWeapons(ArrayList<Weapon> weapons) // { // this.weapons = weapons; // } // // public String bannerTypeToString() // { // switch(bannerType) // { // case 0: // return "Normal"; // case 1: // return "Step Up"; // case 2: // return "Record Crystal"; // case 3: // return "Step Up v2"; // case 4: // return "Birthday Step Up"; // case 5: // return "Record Crystal v2"; // case 6: // return "Memorial Scout"; // case 7: // return "Step Up v3"; // case 8: // return "Record Crystal v3"; // case 9: // return "Event"; // case 10: // return "SAO Game 5th Anniversary Step Up"; // case 11: // return "Record Crystal v4"; // case 12: // return "Step Up v4"; // case 13: // return "Step Up v5"; // case 14: // return "SAO Game 5th Anniversary Step Up v2"; // case 15: // return "Step Up v6"; // case 16: // return "SAO Game 5th Anniversary Step Up v3"; // case 17: // return "Step Up v7"; // case 18: // return "Record Crystal v5"; // case 19: // return "Step Up v8"; // case 20: // return "Record Crystal v6"; // case 21: // return "Step Up v9"; // default: // return "Unknown"; // } // } // // @Override // public String toString() // { // return bannerID + ") " + bannerName; // } // } // // Path: src/main/java/io/github/spugn/Sargo/Objects/Character.java // public class Character // { // private String prefix; // private String name; // private int rarity; // private String imagePath; // // public Character() // { // prefix = ""; // name = "null"; // rarity = 1; // imagePath = ""; // } // // public void setPrefix(String prefix) // { // this.prefix = prefix; // } // // public void setName(String name) // { // this.name = name; // } // // public void setRarity(int rarity) // { // this.rarity = rarity; // } // // public void setImagePath(String imagePath) // { // this.imagePath = imagePath; // } // // public String getPrefix() // { // return prefix; // } // // public String getName() // { // return name; // } // // public int getRarity() // { // return rarity; // } // // public String getImagePath() // { // return imagePath; // } // // @Override // public String toString() // { // if (prefix.isEmpty()) // { // return rarity + "★ " + name; // } // return rarity + "★ [" + prefix + "] " + name; // } // // public String toStringNoName() // { // if (prefix.isEmpty()) // { // return rarity + "★ " + name; // } // return rarity + "★ [" + prefix + "]"; // } // }
import discord4j.core.object.entity.Message; import io.github.spugn.Sargo.Objects.Banner; import io.github.spugn.Sargo.Objects.Character; import java.util.List;
guaranteeOnePlatinum = true; break; case 6: COPPER = COPPER - ((PLATINUM * 2.0) - PLATINUM); PLATINUM = PLATINUM * 2.0; default: break; } } } @Override protected void updateBannerData() { int currentStep = USER.getBannerData(SELECTED_BANNER.getBannerName()); currentStep++; if (currentStep > 6) { USER.changeValue(SELECTED_BANNER.getBannerName(), 6); } else { USER.changeValue(SELECTED_BANNER.getBannerName(), currentStep); } } @Override protected Character randGoldCharacter() { int randIndex = GOLD_BANNERS.get(RNG.nextInt(GOLD_BANNERS.size()));
// Path: src/main/java/io/github/spugn/Sargo/Objects/Banner.java // public class Banner // { // private int bannerID; // private String bannerName; // private int bannerType; // private int bannerWepType; // private ArrayList<Character> characters; // private ArrayList<Weapon> weapons; // // public int getBannerID() // { // return bannerID; // } // // public String getBannerName() // { // return bannerName; // } // // public int getBannerType() // { // return bannerType; // } // // public int getBannerWepType() // { // return bannerWepType; // } // // public ArrayList<Character> getCharacters() // { // return characters; // } // // public ArrayList<Weapon> getWeapons() // { // return weapons; // } // // public void setBannerID(int bannerID) // { // this.bannerID = bannerID; // } // // public void setBannerName(String bannerName) // { // this.bannerName = bannerName; // } // // public void setBannerType(int bannerType) // { // this.bannerType = bannerType; // } // // public void setBannerWepType(int bannerWepType) // { // this.bannerWepType = bannerWepType; // } // // public void setCharacters(ArrayList<Character> characters) // { // this.characters = characters; // } // // public void setWeapons(ArrayList<Weapon> weapons) // { // this.weapons = weapons; // } // // public String bannerTypeToString() // { // switch(bannerType) // { // case 0: // return "Normal"; // case 1: // return "Step Up"; // case 2: // return "Record Crystal"; // case 3: // return "Step Up v2"; // case 4: // return "Birthday Step Up"; // case 5: // return "Record Crystal v2"; // case 6: // return "Memorial Scout"; // case 7: // return "Step Up v3"; // case 8: // return "Record Crystal v3"; // case 9: // return "Event"; // case 10: // return "SAO Game 5th Anniversary Step Up"; // case 11: // return "Record Crystal v4"; // case 12: // return "Step Up v4"; // case 13: // return "Step Up v5"; // case 14: // return "SAO Game 5th Anniversary Step Up v2"; // case 15: // return "Step Up v6"; // case 16: // return "SAO Game 5th Anniversary Step Up v3"; // case 17: // return "Step Up v7"; // case 18: // return "Record Crystal v5"; // case 19: // return "Step Up v8"; // case 20: // return "Record Crystal v6"; // case 21: // return "Step Up v9"; // default: // return "Unknown"; // } // } // // @Override // public String toString() // { // return bannerID + ") " + bannerName; // } // } // // Path: src/main/java/io/github/spugn/Sargo/Objects/Character.java // public class Character // { // private String prefix; // private String name; // private int rarity; // private String imagePath; // // public Character() // { // prefix = ""; // name = "null"; // rarity = 1; // imagePath = ""; // } // // public void setPrefix(String prefix) // { // this.prefix = prefix; // } // // public void setName(String name) // { // this.name = name; // } // // public void setRarity(int rarity) // { // this.rarity = rarity; // } // // public void setImagePath(String imagePath) // { // this.imagePath = imagePath; // } // // public String getPrefix() // { // return prefix; // } // // public String getName() // { // return name; // } // // public int getRarity() // { // return rarity; // } // // public String getImagePath() // { // return imagePath; // } // // @Override // public String toString() // { // if (prefix.isEmpty()) // { // return rarity + "★ " + name; // } // return rarity + "★ [" + prefix + "] " + name; // } // // public String toStringNoName() // { // if (prefix.isEmpty()) // { // return rarity + "★ " + name; // } // return rarity + "★ [" + prefix + "]"; // } // } // Path: src/main/java/io/github/spugn/Sargo/CharacterScout/StepUpv2.java import discord4j.core.object.entity.Message; import io.github.spugn.Sargo.Objects.Banner; import io.github.spugn.Sargo.Objects.Character; import java.util.List; guaranteeOnePlatinum = true; break; case 6: COPPER = COPPER - ((PLATINUM * 2.0) - PLATINUM); PLATINUM = PLATINUM * 2.0; default: break; } } } @Override protected void updateBannerData() { int currentStep = USER.getBannerData(SELECTED_BANNER.getBannerName()); currentStep++; if (currentStep > 6) { USER.changeValue(SELECTED_BANNER.getBannerName(), 6); } else { USER.changeValue(SELECTED_BANNER.getBannerName(), currentStep); } } @Override protected Character randGoldCharacter() { int randIndex = GOLD_BANNERS.get(RNG.nextInt(GOLD_BANNERS.size()));
Banner randBanner = BANNERS.get(randIndex - 1);
Expugn/S-argo
src/main/java/io/github/spugn/Sargo/CharacterScout/SAOGameFifthAnniversaryStepUp.java
// Path: src/main/java/io/github/spugn/Sargo/Objects/Banner.java // public class Banner // { // private int bannerID; // private String bannerName; // private int bannerType; // private int bannerWepType; // private ArrayList<Character> characters; // private ArrayList<Weapon> weapons; // // public int getBannerID() // { // return bannerID; // } // // public String getBannerName() // { // return bannerName; // } // // public int getBannerType() // { // return bannerType; // } // // public int getBannerWepType() // { // return bannerWepType; // } // // public ArrayList<Character> getCharacters() // { // return characters; // } // // public ArrayList<Weapon> getWeapons() // { // return weapons; // } // // public void setBannerID(int bannerID) // { // this.bannerID = bannerID; // } // // public void setBannerName(String bannerName) // { // this.bannerName = bannerName; // } // // public void setBannerType(int bannerType) // { // this.bannerType = bannerType; // } // // public void setBannerWepType(int bannerWepType) // { // this.bannerWepType = bannerWepType; // } // // public void setCharacters(ArrayList<Character> characters) // { // this.characters = characters; // } // // public void setWeapons(ArrayList<Weapon> weapons) // { // this.weapons = weapons; // } // // public String bannerTypeToString() // { // switch(bannerType) // { // case 0: // return "Normal"; // case 1: // return "Step Up"; // case 2: // return "Record Crystal"; // case 3: // return "Step Up v2"; // case 4: // return "Birthday Step Up"; // case 5: // return "Record Crystal v2"; // case 6: // return "Memorial Scout"; // case 7: // return "Step Up v3"; // case 8: // return "Record Crystal v3"; // case 9: // return "Event"; // case 10: // return "SAO Game 5th Anniversary Step Up"; // case 11: // return "Record Crystal v4"; // case 12: // return "Step Up v4"; // case 13: // return "Step Up v5"; // case 14: // return "SAO Game 5th Anniversary Step Up v2"; // case 15: // return "Step Up v6"; // case 16: // return "SAO Game 5th Anniversary Step Up v3"; // case 17: // return "Step Up v7"; // case 18: // return "Record Crystal v5"; // case 19: // return "Step Up v8"; // case 20: // return "Record Crystal v6"; // case 21: // return "Step Up v9"; // default: // return "Unknown"; // } // } // // @Override // public String toString() // { // return bannerID + ") " + bannerName; // } // } // // Path: src/main/java/io/github/spugn/Sargo/Objects/Character.java // public class Character // { // private String prefix; // private String name; // private int rarity; // private String imagePath; // // public Character() // { // prefix = ""; // name = "null"; // rarity = 1; // imagePath = ""; // } // // public void setPrefix(String prefix) // { // this.prefix = prefix; // } // // public void setName(String name) // { // this.name = name; // } // // public void setRarity(int rarity) // { // this.rarity = rarity; // } // // public void setImagePath(String imagePath) // { // this.imagePath = imagePath; // } // // public String getPrefix() // { // return prefix; // } // // public String getName() // { // return name; // } // // public int getRarity() // { // return rarity; // } // // public String getImagePath() // { // return imagePath; // } // // @Override // public String toString() // { // if (prefix.isEmpty()) // { // return rarity + "★ " + name; // } // return rarity + "★ [" + prefix + "] " + name; // } // // public String toStringNoName() // { // if (prefix.isEmpty()) // { // return rarity + "★ " + name; // } // return rarity + "★ [" + prefix + "]"; // } // }
import discord4j.core.object.entity.Message; import io.github.spugn.Sargo.Objects.Banner; import io.github.spugn.Sargo.Objects.Character; import java.util.List;
PLATINUM = PLATINUM * 1.5; break; case 5: guaranteeOnePlatinum = true; break; case 6: COPPER = COPPER - ((PLATINUM * 2.0) - PLATINUM); PLATINUM = PLATINUM * 2.0; default: break; } } } @Override protected void updateBannerData() { int currentStep = USER.getBannerData(SELECTED_BANNER.getBannerName()); currentStep++; if (currentStep > 6) { USER.changeValue(SELECTED_BANNER.getBannerName(), 6); } else { USER.changeValue(SELECTED_BANNER.getBannerName(), currentStep); } } @Override
// Path: src/main/java/io/github/spugn/Sargo/Objects/Banner.java // public class Banner // { // private int bannerID; // private String bannerName; // private int bannerType; // private int bannerWepType; // private ArrayList<Character> characters; // private ArrayList<Weapon> weapons; // // public int getBannerID() // { // return bannerID; // } // // public String getBannerName() // { // return bannerName; // } // // public int getBannerType() // { // return bannerType; // } // // public int getBannerWepType() // { // return bannerWepType; // } // // public ArrayList<Character> getCharacters() // { // return characters; // } // // public ArrayList<Weapon> getWeapons() // { // return weapons; // } // // public void setBannerID(int bannerID) // { // this.bannerID = bannerID; // } // // public void setBannerName(String bannerName) // { // this.bannerName = bannerName; // } // // public void setBannerType(int bannerType) // { // this.bannerType = bannerType; // } // // public void setBannerWepType(int bannerWepType) // { // this.bannerWepType = bannerWepType; // } // // public void setCharacters(ArrayList<Character> characters) // { // this.characters = characters; // } // // public void setWeapons(ArrayList<Weapon> weapons) // { // this.weapons = weapons; // } // // public String bannerTypeToString() // { // switch(bannerType) // { // case 0: // return "Normal"; // case 1: // return "Step Up"; // case 2: // return "Record Crystal"; // case 3: // return "Step Up v2"; // case 4: // return "Birthday Step Up"; // case 5: // return "Record Crystal v2"; // case 6: // return "Memorial Scout"; // case 7: // return "Step Up v3"; // case 8: // return "Record Crystal v3"; // case 9: // return "Event"; // case 10: // return "SAO Game 5th Anniversary Step Up"; // case 11: // return "Record Crystal v4"; // case 12: // return "Step Up v4"; // case 13: // return "Step Up v5"; // case 14: // return "SAO Game 5th Anniversary Step Up v2"; // case 15: // return "Step Up v6"; // case 16: // return "SAO Game 5th Anniversary Step Up v3"; // case 17: // return "Step Up v7"; // case 18: // return "Record Crystal v5"; // case 19: // return "Step Up v8"; // case 20: // return "Record Crystal v6"; // case 21: // return "Step Up v9"; // default: // return "Unknown"; // } // } // // @Override // public String toString() // { // return bannerID + ") " + bannerName; // } // } // // Path: src/main/java/io/github/spugn/Sargo/Objects/Character.java // public class Character // { // private String prefix; // private String name; // private int rarity; // private String imagePath; // // public Character() // { // prefix = ""; // name = "null"; // rarity = 1; // imagePath = ""; // } // // public void setPrefix(String prefix) // { // this.prefix = prefix; // } // // public void setName(String name) // { // this.name = name; // } // // public void setRarity(int rarity) // { // this.rarity = rarity; // } // // public void setImagePath(String imagePath) // { // this.imagePath = imagePath; // } // // public String getPrefix() // { // return prefix; // } // // public String getName() // { // return name; // } // // public int getRarity() // { // return rarity; // } // // public String getImagePath() // { // return imagePath; // } // // @Override // public String toString() // { // if (prefix.isEmpty()) // { // return rarity + "★ " + name; // } // return rarity + "★ [" + prefix + "] " + name; // } // // public String toStringNoName() // { // if (prefix.isEmpty()) // { // return rarity + "★ " + name; // } // return rarity + "★ [" + prefix + "]"; // } // } // Path: src/main/java/io/github/spugn/Sargo/CharacterScout/SAOGameFifthAnniversaryStepUp.java import discord4j.core.object.entity.Message; import io.github.spugn.Sargo.Objects.Banner; import io.github.spugn.Sargo.Objects.Character; import java.util.List; PLATINUM = PLATINUM * 1.5; break; case 5: guaranteeOnePlatinum = true; break; case 6: COPPER = COPPER - ((PLATINUM * 2.0) - PLATINUM); PLATINUM = PLATINUM * 2.0; default: break; } } } @Override protected void updateBannerData() { int currentStep = USER.getBannerData(SELECTED_BANNER.getBannerName()); currentStep++; if (currentStep > 6) { USER.changeValue(SELECTED_BANNER.getBannerName(), 6); } else { USER.changeValue(SELECTED_BANNER.getBannerName(), currentStep); } } @Override
protected Character randGoldCharacter()
Expugn/S-argo
src/main/java/io/github/spugn/Sargo/CharacterScout/SAOGameFifthAnniversaryStepUp.java
// Path: src/main/java/io/github/spugn/Sargo/Objects/Banner.java // public class Banner // { // private int bannerID; // private String bannerName; // private int bannerType; // private int bannerWepType; // private ArrayList<Character> characters; // private ArrayList<Weapon> weapons; // // public int getBannerID() // { // return bannerID; // } // // public String getBannerName() // { // return bannerName; // } // // public int getBannerType() // { // return bannerType; // } // // public int getBannerWepType() // { // return bannerWepType; // } // // public ArrayList<Character> getCharacters() // { // return characters; // } // // public ArrayList<Weapon> getWeapons() // { // return weapons; // } // // public void setBannerID(int bannerID) // { // this.bannerID = bannerID; // } // // public void setBannerName(String bannerName) // { // this.bannerName = bannerName; // } // // public void setBannerType(int bannerType) // { // this.bannerType = bannerType; // } // // public void setBannerWepType(int bannerWepType) // { // this.bannerWepType = bannerWepType; // } // // public void setCharacters(ArrayList<Character> characters) // { // this.characters = characters; // } // // public void setWeapons(ArrayList<Weapon> weapons) // { // this.weapons = weapons; // } // // public String bannerTypeToString() // { // switch(bannerType) // { // case 0: // return "Normal"; // case 1: // return "Step Up"; // case 2: // return "Record Crystal"; // case 3: // return "Step Up v2"; // case 4: // return "Birthday Step Up"; // case 5: // return "Record Crystal v2"; // case 6: // return "Memorial Scout"; // case 7: // return "Step Up v3"; // case 8: // return "Record Crystal v3"; // case 9: // return "Event"; // case 10: // return "SAO Game 5th Anniversary Step Up"; // case 11: // return "Record Crystal v4"; // case 12: // return "Step Up v4"; // case 13: // return "Step Up v5"; // case 14: // return "SAO Game 5th Anniversary Step Up v2"; // case 15: // return "Step Up v6"; // case 16: // return "SAO Game 5th Anniversary Step Up v3"; // case 17: // return "Step Up v7"; // case 18: // return "Record Crystal v5"; // case 19: // return "Step Up v8"; // case 20: // return "Record Crystal v6"; // case 21: // return "Step Up v9"; // default: // return "Unknown"; // } // } // // @Override // public String toString() // { // return bannerID + ") " + bannerName; // } // } // // Path: src/main/java/io/github/spugn/Sargo/Objects/Character.java // public class Character // { // private String prefix; // private String name; // private int rarity; // private String imagePath; // // public Character() // { // prefix = ""; // name = "null"; // rarity = 1; // imagePath = ""; // } // // public void setPrefix(String prefix) // { // this.prefix = prefix; // } // // public void setName(String name) // { // this.name = name; // } // // public void setRarity(int rarity) // { // this.rarity = rarity; // } // // public void setImagePath(String imagePath) // { // this.imagePath = imagePath; // } // // public String getPrefix() // { // return prefix; // } // // public String getName() // { // return name; // } // // public int getRarity() // { // return rarity; // } // // public String getImagePath() // { // return imagePath; // } // // @Override // public String toString() // { // if (prefix.isEmpty()) // { // return rarity + "★ " + name; // } // return rarity + "★ [" + prefix + "] " + name; // } // // public String toStringNoName() // { // if (prefix.isEmpty()) // { // return rarity + "★ " + name; // } // return rarity + "★ [" + prefix + "]"; // } // }
import discord4j.core.object.entity.Message; import io.github.spugn.Sargo.Objects.Banner; import io.github.spugn.Sargo.Objects.Character; import java.util.List;
PLATINUM = PLATINUM * 2.0; default: break; } } } @Override protected void updateBannerData() { int currentStep = USER.getBannerData(SELECTED_BANNER.getBannerName()); currentStep++; if (currentStep > 6) { USER.changeValue(SELECTED_BANNER.getBannerName(), 6); } else { USER.changeValue(SELECTED_BANNER.getBannerName(), currentStep); } } @Override protected Character randGoldCharacter() { /* GET A RANDOM GOLD VARIANT CHARACTER, IF THERE IS A PLATINUM VARIANT OF THAT CHARACTER IN THE BANNER THEN GET A NEW CHARACTER. */ Character c = null; boolean charInBanner = true; int randIndex;
// Path: src/main/java/io/github/spugn/Sargo/Objects/Banner.java // public class Banner // { // private int bannerID; // private String bannerName; // private int bannerType; // private int bannerWepType; // private ArrayList<Character> characters; // private ArrayList<Weapon> weapons; // // public int getBannerID() // { // return bannerID; // } // // public String getBannerName() // { // return bannerName; // } // // public int getBannerType() // { // return bannerType; // } // // public int getBannerWepType() // { // return bannerWepType; // } // // public ArrayList<Character> getCharacters() // { // return characters; // } // // public ArrayList<Weapon> getWeapons() // { // return weapons; // } // // public void setBannerID(int bannerID) // { // this.bannerID = bannerID; // } // // public void setBannerName(String bannerName) // { // this.bannerName = bannerName; // } // // public void setBannerType(int bannerType) // { // this.bannerType = bannerType; // } // // public void setBannerWepType(int bannerWepType) // { // this.bannerWepType = bannerWepType; // } // // public void setCharacters(ArrayList<Character> characters) // { // this.characters = characters; // } // // public void setWeapons(ArrayList<Weapon> weapons) // { // this.weapons = weapons; // } // // public String bannerTypeToString() // { // switch(bannerType) // { // case 0: // return "Normal"; // case 1: // return "Step Up"; // case 2: // return "Record Crystal"; // case 3: // return "Step Up v2"; // case 4: // return "Birthday Step Up"; // case 5: // return "Record Crystal v2"; // case 6: // return "Memorial Scout"; // case 7: // return "Step Up v3"; // case 8: // return "Record Crystal v3"; // case 9: // return "Event"; // case 10: // return "SAO Game 5th Anniversary Step Up"; // case 11: // return "Record Crystal v4"; // case 12: // return "Step Up v4"; // case 13: // return "Step Up v5"; // case 14: // return "SAO Game 5th Anniversary Step Up v2"; // case 15: // return "Step Up v6"; // case 16: // return "SAO Game 5th Anniversary Step Up v3"; // case 17: // return "Step Up v7"; // case 18: // return "Record Crystal v5"; // case 19: // return "Step Up v8"; // case 20: // return "Record Crystal v6"; // case 21: // return "Step Up v9"; // default: // return "Unknown"; // } // } // // @Override // public String toString() // { // return bannerID + ") " + bannerName; // } // } // // Path: src/main/java/io/github/spugn/Sargo/Objects/Character.java // public class Character // { // private String prefix; // private String name; // private int rarity; // private String imagePath; // // public Character() // { // prefix = ""; // name = "null"; // rarity = 1; // imagePath = ""; // } // // public void setPrefix(String prefix) // { // this.prefix = prefix; // } // // public void setName(String name) // { // this.name = name; // } // // public void setRarity(int rarity) // { // this.rarity = rarity; // } // // public void setImagePath(String imagePath) // { // this.imagePath = imagePath; // } // // public String getPrefix() // { // return prefix; // } // // public String getName() // { // return name; // } // // public int getRarity() // { // return rarity; // } // // public String getImagePath() // { // return imagePath; // } // // @Override // public String toString() // { // if (prefix.isEmpty()) // { // return rarity + "★ " + name; // } // return rarity + "★ [" + prefix + "] " + name; // } // // public String toStringNoName() // { // if (prefix.isEmpty()) // { // return rarity + "★ " + name; // } // return rarity + "★ [" + prefix + "]"; // } // } // Path: src/main/java/io/github/spugn/Sargo/CharacterScout/SAOGameFifthAnniversaryStepUp.java import discord4j.core.object.entity.Message; import io.github.spugn.Sargo.Objects.Banner; import io.github.spugn.Sargo.Objects.Character; import java.util.List; PLATINUM = PLATINUM * 2.0; default: break; } } } @Override protected void updateBannerData() { int currentStep = USER.getBannerData(SELECTED_BANNER.getBannerName()); currentStep++; if (currentStep > 6) { USER.changeValue(SELECTED_BANNER.getBannerName(), 6); } else { USER.changeValue(SELECTED_BANNER.getBannerName(), currentStep); } } @Override protected Character randGoldCharacter() { /* GET A RANDOM GOLD VARIANT CHARACTER, IF THERE IS A PLATINUM VARIANT OF THAT CHARACTER IN THE BANNER THEN GET A NEW CHARACTER. */ Character c = null; boolean charInBanner = true; int randIndex;
Banner randBanner;
Expugn/S-argo
src/main/java/io/github/spugn/Sargo/XMLParsers/SettingsParser.java
// Path: src/main/java/io/github/spugn/Sargo/Exceptions/FailedToReadSettingFileException.java // public class FailedToReadSettingFileException extends SargoException // { // private static final String ERROR_TITLE = "FAILED TO READ BANNER FILE"; // private static final int ERROR_CODE = 102; // private final String ERROR_TEXT; // // public FailedToReadSettingFileException() // { // ERROR_TEXT = "An error has occurred when trying to read the Setting file.\n" + // "Try restarting the bot or correct the issue manually."; // } // // @Override // public void displayErrorMessage() // { // System.out.println(ERROR_TITLE + " - " + ERROR_TEXT + "\nError Code: " + ERROR_CODE); // } // }
import io.github.spugn.Sargo.Exceptions.FailedToReadSettingFileException; import javax.xml.stream.XMLEventReader; import javax.xml.stream.XMLInputFactory; import javax.xml.stream.XMLStreamException; import javax.xml.stream.events.Attribute; import javax.xml.stream.events.XMLEvent; import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.IOException; import java.io.InputStream; import java.util.*;
package io.github.spugn.Sargo.XMLParsers; /** * SETTINGS PARSER * <p> * This class reads the Settings.xml file and saves the data * to variables. * </p> * * @author S'pugn * @version 1.1 * @since v1.0 */ @Deprecated public class SettingsParser { /* BOT SETTINGS */ private static String botToken; private static boolean isNoGUI; private static String gitHubRepoURL; private static String botOwnerDiscordID; /* COMMAND SETTINGS */ private static boolean useMention; private static char commandPrefix; private static boolean deleteUserMessage; private static List<String> ignoredChannelNames; /* SCOUT SETTINGS */ private static boolean isDisableImages; private static boolean isSimpleMessage; private static boolean isRarityStars; private static String scoutMaster; private static double copperRates; private static double silverRates; private static double goldRates; private static double platinumRates; private static List<Double> recordCrystalRates; private static List<Double> circulatingRecordCrystalRates; //private static List<Integer> goldBanners; //private static List<Integer> goldBannersv2; /* SHOP SETTINGS */ private static int maxShopLimit; private static Map<String, Map<Double, Integer>> shopItems; public static String getBotToken() { return botToken; } public static boolean isNoGUI() { return isNoGUI; } public static String getGitHubRepoURL() { return gitHubRepoURL; } public static String getBotOwnerDiscordID() { return botOwnerDiscordID; } public static boolean isUseMention() { return useMention; } public static char getCommandPrefix() { return commandPrefix; } public static boolean isDeleteUserMessage() { return deleteUserMessage; } public static List<String> getIgnoredChannelNames() { return ignoredChannelNames; } public static boolean isDisableImages() { return isDisableImages; } public static boolean isSimpleMessage() { return isSimpleMessage; } public static boolean isRarityStars() { return isRarityStars; } public static String getScoutMaster() { return scoutMaster; } public static double getCopperRates() { return copperRates; } public static double getSilverRates() { return silverRates; } public static double getGoldRates() { return goldRates; } public static double getPlatinumRates() { return platinumRates; } public static List<Double> getRecordCrystalRates() { return recordCrystalRates; } public static List<Double> getCirculatingRecordCrystalRates() { return circulatingRecordCrystalRates; } public static List<Integer> getGoldBanners() { return BannerParser.getGoldBanners(); } public static List<Integer> getGoldBannersv2() { return BannerParser.getGoldBannersv2(); } public static int getMaxShopLimit() { return maxShopLimit; } public static Map<String, Map<Double, Integer>> getShopItems() { return shopItems; } /** * Reads the data in the Settings.xml file and saves the data in variables. */ public void reloadSettings(String configFile) { try { tryRead(configFile); }
// Path: src/main/java/io/github/spugn/Sargo/Exceptions/FailedToReadSettingFileException.java // public class FailedToReadSettingFileException extends SargoException // { // private static final String ERROR_TITLE = "FAILED TO READ BANNER FILE"; // private static final int ERROR_CODE = 102; // private final String ERROR_TEXT; // // public FailedToReadSettingFileException() // { // ERROR_TEXT = "An error has occurred when trying to read the Setting file.\n" + // "Try restarting the bot or correct the issue manually."; // } // // @Override // public void displayErrorMessage() // { // System.out.println(ERROR_TITLE + " - " + ERROR_TEXT + "\nError Code: " + ERROR_CODE); // } // } // Path: src/main/java/io/github/spugn/Sargo/XMLParsers/SettingsParser.java import io.github.spugn.Sargo.Exceptions.FailedToReadSettingFileException; import javax.xml.stream.XMLEventReader; import javax.xml.stream.XMLInputFactory; import javax.xml.stream.XMLStreamException; import javax.xml.stream.events.Attribute; import javax.xml.stream.events.XMLEvent; import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.IOException; import java.io.InputStream; import java.util.*; package io.github.spugn.Sargo.XMLParsers; /** * SETTINGS PARSER * <p> * This class reads the Settings.xml file and saves the data * to variables. * </p> * * @author S'pugn * @version 1.1 * @since v1.0 */ @Deprecated public class SettingsParser { /* BOT SETTINGS */ private static String botToken; private static boolean isNoGUI; private static String gitHubRepoURL; private static String botOwnerDiscordID; /* COMMAND SETTINGS */ private static boolean useMention; private static char commandPrefix; private static boolean deleteUserMessage; private static List<String> ignoredChannelNames; /* SCOUT SETTINGS */ private static boolean isDisableImages; private static boolean isSimpleMessage; private static boolean isRarityStars; private static String scoutMaster; private static double copperRates; private static double silverRates; private static double goldRates; private static double platinumRates; private static List<Double> recordCrystalRates; private static List<Double> circulatingRecordCrystalRates; //private static List<Integer> goldBanners; //private static List<Integer> goldBannersv2; /* SHOP SETTINGS */ private static int maxShopLimit; private static Map<String, Map<Double, Integer>> shopItems; public static String getBotToken() { return botToken; } public static boolean isNoGUI() { return isNoGUI; } public static String getGitHubRepoURL() { return gitHubRepoURL; } public static String getBotOwnerDiscordID() { return botOwnerDiscordID; } public static boolean isUseMention() { return useMention; } public static char getCommandPrefix() { return commandPrefix; } public static boolean isDeleteUserMessage() { return deleteUserMessage; } public static List<String> getIgnoredChannelNames() { return ignoredChannelNames; } public static boolean isDisableImages() { return isDisableImages; } public static boolean isSimpleMessage() { return isSimpleMessage; } public static boolean isRarityStars() { return isRarityStars; } public static String getScoutMaster() { return scoutMaster; } public static double getCopperRates() { return copperRates; } public static double getSilverRates() { return silverRates; } public static double getGoldRates() { return goldRates; } public static double getPlatinumRates() { return platinumRates; } public static List<Double> getRecordCrystalRates() { return recordCrystalRates; } public static List<Double> getCirculatingRecordCrystalRates() { return circulatingRecordCrystalRates; } public static List<Integer> getGoldBanners() { return BannerParser.getGoldBanners(); } public static List<Integer> getGoldBannersv2() { return BannerParser.getGoldBannersv2(); } public static int getMaxShopLimit() { return maxShopLimit; } public static Map<String, Map<Double, Integer>> getShopItems() { return shopItems; } /** * Reads the data in the Settings.xml file and saves the data in variables. */ public void reloadSettings(String configFile) { try { tryRead(configFile); }
catch (FailedToReadSettingFileException e)
Expugn/S-argo
src/main/java/io/github/spugn/Sargo/CharacterScout/BirthdayStepUp.java
// Path: src/main/java/io/github/spugn/Sargo/Objects/Banner.java // public class Banner // { // private int bannerID; // private String bannerName; // private int bannerType; // private int bannerWepType; // private ArrayList<Character> characters; // private ArrayList<Weapon> weapons; // // public int getBannerID() // { // return bannerID; // } // // public String getBannerName() // { // return bannerName; // } // // public int getBannerType() // { // return bannerType; // } // // public int getBannerWepType() // { // return bannerWepType; // } // // public ArrayList<Character> getCharacters() // { // return characters; // } // // public ArrayList<Weapon> getWeapons() // { // return weapons; // } // // public void setBannerID(int bannerID) // { // this.bannerID = bannerID; // } // // public void setBannerName(String bannerName) // { // this.bannerName = bannerName; // } // // public void setBannerType(int bannerType) // { // this.bannerType = bannerType; // } // // public void setBannerWepType(int bannerWepType) // { // this.bannerWepType = bannerWepType; // } // // public void setCharacters(ArrayList<Character> characters) // { // this.characters = characters; // } // // public void setWeapons(ArrayList<Weapon> weapons) // { // this.weapons = weapons; // } // // public String bannerTypeToString() // { // switch(bannerType) // { // case 0: // return "Normal"; // case 1: // return "Step Up"; // case 2: // return "Record Crystal"; // case 3: // return "Step Up v2"; // case 4: // return "Birthday Step Up"; // case 5: // return "Record Crystal v2"; // case 6: // return "Memorial Scout"; // case 7: // return "Step Up v3"; // case 8: // return "Record Crystal v3"; // case 9: // return "Event"; // case 10: // return "SAO Game 5th Anniversary Step Up"; // case 11: // return "Record Crystal v4"; // case 12: // return "Step Up v4"; // case 13: // return "Step Up v5"; // case 14: // return "SAO Game 5th Anniversary Step Up v2"; // case 15: // return "Step Up v6"; // case 16: // return "SAO Game 5th Anniversary Step Up v3"; // case 17: // return "Step Up v7"; // case 18: // return "Record Crystal v5"; // case 19: // return "Step Up v8"; // case 20: // return "Record Crystal v6"; // case 21: // return "Step Up v9"; // default: // return "Unknown"; // } // } // // @Override // public String toString() // { // return bannerID + ") " + bannerName; // } // } // // Path: src/main/java/io/github/spugn/Sargo/Objects/Character.java // public class Character // { // private String prefix; // private String name; // private int rarity; // private String imagePath; // // public Character() // { // prefix = ""; // name = "null"; // rarity = 1; // imagePath = ""; // } // // public void setPrefix(String prefix) // { // this.prefix = prefix; // } // // public void setName(String name) // { // this.name = name; // } // // public void setRarity(int rarity) // { // this.rarity = rarity; // } // // public void setImagePath(String imagePath) // { // this.imagePath = imagePath; // } // // public String getPrefix() // { // return prefix; // } // // public String getName() // { // return name; // } // // public int getRarity() // { // return rarity; // } // // public String getImagePath() // { // return imagePath; // } // // @Override // public String toString() // { // if (prefix.isEmpty()) // { // return rarity + "★ " + name; // } // return rarity + "★ [" + prefix + "] " + name; // } // // public String toStringNoName() // { // if (prefix.isEmpty()) // { // return rarity + "★ " + name; // } // return rarity + "★ [" + prefix + "]"; // } // }
import discord4j.core.object.entity.Message; import io.github.spugn.Sargo.Objects.Banner; import io.github.spugn.Sargo.Objects.Character; import java.util.List;
{ case 1: multiScoutPrice = 125; break; case 3: COPPER = COPPER - (((PLATINUM * 2.0) - PLATINUM) + ((GOLD * 2.0) - GOLD)); GOLD = GOLD * 2.0; PLATINUM = PLATINUM * 2.0; default: break; } } } @Override protected void updateBannerData() { int currentStep = USER.getBannerData(SELECTED_BANNER.getBannerName()); currentStep++; if (currentStep > 3) { USER.changeValue(SELECTED_BANNER.getBannerName(), 1); } else { USER.changeValue(SELECTED_BANNER.getBannerName(), currentStep); } } @Override
// Path: src/main/java/io/github/spugn/Sargo/Objects/Banner.java // public class Banner // { // private int bannerID; // private String bannerName; // private int bannerType; // private int bannerWepType; // private ArrayList<Character> characters; // private ArrayList<Weapon> weapons; // // public int getBannerID() // { // return bannerID; // } // // public String getBannerName() // { // return bannerName; // } // // public int getBannerType() // { // return bannerType; // } // // public int getBannerWepType() // { // return bannerWepType; // } // // public ArrayList<Character> getCharacters() // { // return characters; // } // // public ArrayList<Weapon> getWeapons() // { // return weapons; // } // // public void setBannerID(int bannerID) // { // this.bannerID = bannerID; // } // // public void setBannerName(String bannerName) // { // this.bannerName = bannerName; // } // // public void setBannerType(int bannerType) // { // this.bannerType = bannerType; // } // // public void setBannerWepType(int bannerWepType) // { // this.bannerWepType = bannerWepType; // } // // public void setCharacters(ArrayList<Character> characters) // { // this.characters = characters; // } // // public void setWeapons(ArrayList<Weapon> weapons) // { // this.weapons = weapons; // } // // public String bannerTypeToString() // { // switch(bannerType) // { // case 0: // return "Normal"; // case 1: // return "Step Up"; // case 2: // return "Record Crystal"; // case 3: // return "Step Up v2"; // case 4: // return "Birthday Step Up"; // case 5: // return "Record Crystal v2"; // case 6: // return "Memorial Scout"; // case 7: // return "Step Up v3"; // case 8: // return "Record Crystal v3"; // case 9: // return "Event"; // case 10: // return "SAO Game 5th Anniversary Step Up"; // case 11: // return "Record Crystal v4"; // case 12: // return "Step Up v4"; // case 13: // return "Step Up v5"; // case 14: // return "SAO Game 5th Anniversary Step Up v2"; // case 15: // return "Step Up v6"; // case 16: // return "SAO Game 5th Anniversary Step Up v3"; // case 17: // return "Step Up v7"; // case 18: // return "Record Crystal v5"; // case 19: // return "Step Up v8"; // case 20: // return "Record Crystal v6"; // case 21: // return "Step Up v9"; // default: // return "Unknown"; // } // } // // @Override // public String toString() // { // return bannerID + ") " + bannerName; // } // } // // Path: src/main/java/io/github/spugn/Sargo/Objects/Character.java // public class Character // { // private String prefix; // private String name; // private int rarity; // private String imagePath; // // public Character() // { // prefix = ""; // name = "null"; // rarity = 1; // imagePath = ""; // } // // public void setPrefix(String prefix) // { // this.prefix = prefix; // } // // public void setName(String name) // { // this.name = name; // } // // public void setRarity(int rarity) // { // this.rarity = rarity; // } // // public void setImagePath(String imagePath) // { // this.imagePath = imagePath; // } // // public String getPrefix() // { // return prefix; // } // // public String getName() // { // return name; // } // // public int getRarity() // { // return rarity; // } // // public String getImagePath() // { // return imagePath; // } // // @Override // public String toString() // { // if (prefix.isEmpty()) // { // return rarity + "★ " + name; // } // return rarity + "★ [" + prefix + "] " + name; // } // // public String toStringNoName() // { // if (prefix.isEmpty()) // { // return rarity + "★ " + name; // } // return rarity + "★ [" + prefix + "]"; // } // } // Path: src/main/java/io/github/spugn/Sargo/CharacterScout/BirthdayStepUp.java import discord4j.core.object.entity.Message; import io.github.spugn.Sargo.Objects.Banner; import io.github.spugn.Sargo.Objects.Character; import java.util.List; { case 1: multiScoutPrice = 125; break; case 3: COPPER = COPPER - (((PLATINUM * 2.0) - PLATINUM) + ((GOLD * 2.0) - GOLD)); GOLD = GOLD * 2.0; PLATINUM = PLATINUM * 2.0; default: break; } } } @Override protected void updateBannerData() { int currentStep = USER.getBannerData(SELECTED_BANNER.getBannerName()); currentStep++; if (currentStep > 3) { USER.changeValue(SELECTED_BANNER.getBannerName(), 1); } else { USER.changeValue(SELECTED_BANNER.getBannerName(), currentStep); } } @Override
protected Character randGoldCharacter()
Expugn/S-argo
src/main/java/io/github/spugn/Sargo/CharacterScout/BirthdayStepUp.java
// Path: src/main/java/io/github/spugn/Sargo/Objects/Banner.java // public class Banner // { // private int bannerID; // private String bannerName; // private int bannerType; // private int bannerWepType; // private ArrayList<Character> characters; // private ArrayList<Weapon> weapons; // // public int getBannerID() // { // return bannerID; // } // // public String getBannerName() // { // return bannerName; // } // // public int getBannerType() // { // return bannerType; // } // // public int getBannerWepType() // { // return bannerWepType; // } // // public ArrayList<Character> getCharacters() // { // return characters; // } // // public ArrayList<Weapon> getWeapons() // { // return weapons; // } // // public void setBannerID(int bannerID) // { // this.bannerID = bannerID; // } // // public void setBannerName(String bannerName) // { // this.bannerName = bannerName; // } // // public void setBannerType(int bannerType) // { // this.bannerType = bannerType; // } // // public void setBannerWepType(int bannerWepType) // { // this.bannerWepType = bannerWepType; // } // // public void setCharacters(ArrayList<Character> characters) // { // this.characters = characters; // } // // public void setWeapons(ArrayList<Weapon> weapons) // { // this.weapons = weapons; // } // // public String bannerTypeToString() // { // switch(bannerType) // { // case 0: // return "Normal"; // case 1: // return "Step Up"; // case 2: // return "Record Crystal"; // case 3: // return "Step Up v2"; // case 4: // return "Birthday Step Up"; // case 5: // return "Record Crystal v2"; // case 6: // return "Memorial Scout"; // case 7: // return "Step Up v3"; // case 8: // return "Record Crystal v3"; // case 9: // return "Event"; // case 10: // return "SAO Game 5th Anniversary Step Up"; // case 11: // return "Record Crystal v4"; // case 12: // return "Step Up v4"; // case 13: // return "Step Up v5"; // case 14: // return "SAO Game 5th Anniversary Step Up v2"; // case 15: // return "Step Up v6"; // case 16: // return "SAO Game 5th Anniversary Step Up v3"; // case 17: // return "Step Up v7"; // case 18: // return "Record Crystal v5"; // case 19: // return "Step Up v8"; // case 20: // return "Record Crystal v6"; // case 21: // return "Step Up v9"; // default: // return "Unknown"; // } // } // // @Override // public String toString() // { // return bannerID + ") " + bannerName; // } // } // // Path: src/main/java/io/github/spugn/Sargo/Objects/Character.java // public class Character // { // private String prefix; // private String name; // private int rarity; // private String imagePath; // // public Character() // { // prefix = ""; // name = "null"; // rarity = 1; // imagePath = ""; // } // // public void setPrefix(String prefix) // { // this.prefix = prefix; // } // // public void setName(String name) // { // this.name = name; // } // // public void setRarity(int rarity) // { // this.rarity = rarity; // } // // public void setImagePath(String imagePath) // { // this.imagePath = imagePath; // } // // public String getPrefix() // { // return prefix; // } // // public String getName() // { // return name; // } // // public int getRarity() // { // return rarity; // } // // public String getImagePath() // { // return imagePath; // } // // @Override // public String toString() // { // if (prefix.isEmpty()) // { // return rarity + "★ " + name; // } // return rarity + "★ [" + prefix + "] " + name; // } // // public String toStringNoName() // { // if (prefix.isEmpty()) // { // return rarity + "★ " + name; // } // return rarity + "★ [" + prefix + "]"; // } // }
import discord4j.core.object.entity.Message; import io.github.spugn.Sargo.Objects.Banner; import io.github.spugn.Sargo.Objects.Character; import java.util.List;
break; case 3: COPPER = COPPER - (((PLATINUM * 2.0) - PLATINUM) + ((GOLD * 2.0) - GOLD)); GOLD = GOLD * 2.0; PLATINUM = PLATINUM * 2.0; default: break; } } } @Override protected void updateBannerData() { int currentStep = USER.getBannerData(SELECTED_BANNER.getBannerName()); currentStep++; if (currentStep > 3) { USER.changeValue(SELECTED_BANNER.getBannerName(), 1); } else { USER.changeValue(SELECTED_BANNER.getBannerName(), currentStep); } } @Override protected Character randGoldCharacter() { int randIndex = GOLD_BANNERS.get(RNG.nextInt(GOLD_BANNERS.size()));
// Path: src/main/java/io/github/spugn/Sargo/Objects/Banner.java // public class Banner // { // private int bannerID; // private String bannerName; // private int bannerType; // private int bannerWepType; // private ArrayList<Character> characters; // private ArrayList<Weapon> weapons; // // public int getBannerID() // { // return bannerID; // } // // public String getBannerName() // { // return bannerName; // } // // public int getBannerType() // { // return bannerType; // } // // public int getBannerWepType() // { // return bannerWepType; // } // // public ArrayList<Character> getCharacters() // { // return characters; // } // // public ArrayList<Weapon> getWeapons() // { // return weapons; // } // // public void setBannerID(int bannerID) // { // this.bannerID = bannerID; // } // // public void setBannerName(String bannerName) // { // this.bannerName = bannerName; // } // // public void setBannerType(int bannerType) // { // this.bannerType = bannerType; // } // // public void setBannerWepType(int bannerWepType) // { // this.bannerWepType = bannerWepType; // } // // public void setCharacters(ArrayList<Character> characters) // { // this.characters = characters; // } // // public void setWeapons(ArrayList<Weapon> weapons) // { // this.weapons = weapons; // } // // public String bannerTypeToString() // { // switch(bannerType) // { // case 0: // return "Normal"; // case 1: // return "Step Up"; // case 2: // return "Record Crystal"; // case 3: // return "Step Up v2"; // case 4: // return "Birthday Step Up"; // case 5: // return "Record Crystal v2"; // case 6: // return "Memorial Scout"; // case 7: // return "Step Up v3"; // case 8: // return "Record Crystal v3"; // case 9: // return "Event"; // case 10: // return "SAO Game 5th Anniversary Step Up"; // case 11: // return "Record Crystal v4"; // case 12: // return "Step Up v4"; // case 13: // return "Step Up v5"; // case 14: // return "SAO Game 5th Anniversary Step Up v2"; // case 15: // return "Step Up v6"; // case 16: // return "SAO Game 5th Anniversary Step Up v3"; // case 17: // return "Step Up v7"; // case 18: // return "Record Crystal v5"; // case 19: // return "Step Up v8"; // case 20: // return "Record Crystal v6"; // case 21: // return "Step Up v9"; // default: // return "Unknown"; // } // } // // @Override // public String toString() // { // return bannerID + ") " + bannerName; // } // } // // Path: src/main/java/io/github/spugn/Sargo/Objects/Character.java // public class Character // { // private String prefix; // private String name; // private int rarity; // private String imagePath; // // public Character() // { // prefix = ""; // name = "null"; // rarity = 1; // imagePath = ""; // } // // public void setPrefix(String prefix) // { // this.prefix = prefix; // } // // public void setName(String name) // { // this.name = name; // } // // public void setRarity(int rarity) // { // this.rarity = rarity; // } // // public void setImagePath(String imagePath) // { // this.imagePath = imagePath; // } // // public String getPrefix() // { // return prefix; // } // // public String getName() // { // return name; // } // // public int getRarity() // { // return rarity; // } // // public String getImagePath() // { // return imagePath; // } // // @Override // public String toString() // { // if (prefix.isEmpty()) // { // return rarity + "★ " + name; // } // return rarity + "★ [" + prefix + "] " + name; // } // // public String toStringNoName() // { // if (prefix.isEmpty()) // { // return rarity + "★ " + name; // } // return rarity + "★ [" + prefix + "]"; // } // } // Path: src/main/java/io/github/spugn/Sargo/CharacterScout/BirthdayStepUp.java import discord4j.core.object.entity.Message; import io.github.spugn.Sargo.Objects.Banner; import io.github.spugn.Sargo.Objects.Character; import java.util.List; break; case 3: COPPER = COPPER - (((PLATINUM * 2.0) - PLATINUM) + ((GOLD * 2.0) - GOLD)); GOLD = GOLD * 2.0; PLATINUM = PLATINUM * 2.0; default: break; } } } @Override protected void updateBannerData() { int currentStep = USER.getBannerData(SELECTED_BANNER.getBannerName()); currentStep++; if (currentStep > 3) { USER.changeValue(SELECTED_BANNER.getBannerName(), 1); } else { USER.changeValue(SELECTED_BANNER.getBannerName(), currentStep); } } @Override protected Character randGoldCharacter() { int randIndex = GOLD_BANNERS.get(RNG.nextInt(GOLD_BANNERS.size()));
Banner randBanner = BANNERS.get(randIndex - 1);
Expugn/S-argo
src/main/java/io/github/spugn/Sargo/Functions/Help.java
// Path: src/main/java/io/github/spugn/Sargo/Utilities/GitHubImage.java // public class GitHubImage // { // private String filePath; // private final String GITHUB_IMAGE; // // public GitHubImage(String filePath) // { // GITHUB_IMAGE = LoginSettingsParser.getGitHubRepoURL(); // this.filePath = filePath; // } // // public String getURL() // { // String url = GITHUB_IMAGE + filePath; // // /* REPLACE ALL SPACES WITH %20 */ // url = url.replaceAll(" ", "%20"); // // /* REPLACE ALL ★ WITH %E2%98%85 */ // url = url.replaceAll("★", "%E2%98%85"); // // return url; // } // }
import discord4j.core.object.entity.Message; import io.github.spugn.Sargo.Utilities.GitHubImage; import java.awt.*;
"`scout [nts/ntsi/ntm/ntmi]` - Perform a normal ticket scout." + "\n" + "`scout [pts/ptsi/ptm/ptmi]` - Perform a plus ticket scout." + "\n" + "`scout [nt2s/nt2si/nt2m/nt2mi]` - Perform a normal ticket v2 scout." + "\n" + "`scout [pt2s/pt2si/pt2m/pt2mi]` - Perform a plus ticket v2 scout." + "\n"; final String shopHelp = "`shop` - View the shop." + "\n" + "`shop [Item ID] [Quantity]` - \"Buy\" a Memory Diamond bundle(s)." + "\n"; final String profileHelp = "`profile` - View your basic profile." + "\n" + "`profile [info/i] [Banner ID]` - View your collected/missing characters in a banner." + "\n" + "`profile [data/d]` - View your Step/Record Crystal data." + "\n" + "`profile [search/s] [Character Name]` - Search for that character in your collection." + "\n"; //final String userSearchHelp = // "`user [@name]` - View a user's basic profile." + "\n"; final String resetHelp = "`reset` - Reset your data file." + "\n" + "`reset [Banner ID] c` - Reset your character data for a banner." + "\n" + "`reset [Banner ID] w` - Reset your weapon data for a banner." + "\n" + "`reset [Banner ID] a` - Reset all data for a banner." + "\n\n" + "**Resetting all data includes your Step or Record Crystal data as well.**" + "\n"; // CREATE AND PRINT HELP MENU message.getChannel().block().createMessage( s -> s.setEmbed( embed -> embed .setColor(new Color(91, 255, 105))
// Path: src/main/java/io/github/spugn/Sargo/Utilities/GitHubImage.java // public class GitHubImage // { // private String filePath; // private final String GITHUB_IMAGE; // // public GitHubImage(String filePath) // { // GITHUB_IMAGE = LoginSettingsParser.getGitHubRepoURL(); // this.filePath = filePath; // } // // public String getURL() // { // String url = GITHUB_IMAGE + filePath; // // /* REPLACE ALL SPACES WITH %20 */ // url = url.replaceAll(" ", "%20"); // // /* REPLACE ALL ★ WITH %E2%98%85 */ // url = url.replaceAll("★", "%E2%98%85"); // // return url; // } // } // Path: src/main/java/io/github/spugn/Sargo/Functions/Help.java import discord4j.core.object.entity.Message; import io.github.spugn.Sargo.Utilities.GitHubImage; import java.awt.*; "`scout [nts/ntsi/ntm/ntmi]` - Perform a normal ticket scout." + "\n" + "`scout [pts/ptsi/ptm/ptmi]` - Perform a plus ticket scout." + "\n" + "`scout [nt2s/nt2si/nt2m/nt2mi]` - Perform a normal ticket v2 scout." + "\n" + "`scout [pt2s/pt2si/pt2m/pt2mi]` - Perform a plus ticket v2 scout." + "\n"; final String shopHelp = "`shop` - View the shop." + "\n" + "`shop [Item ID] [Quantity]` - \"Buy\" a Memory Diamond bundle(s)." + "\n"; final String profileHelp = "`profile` - View your basic profile." + "\n" + "`profile [info/i] [Banner ID]` - View your collected/missing characters in a banner." + "\n" + "`profile [data/d]` - View your Step/Record Crystal data." + "\n" + "`profile [search/s] [Character Name]` - Search for that character in your collection." + "\n"; //final String userSearchHelp = // "`user [@name]` - View a user's basic profile." + "\n"; final String resetHelp = "`reset` - Reset your data file." + "\n" + "`reset [Banner ID] c` - Reset your character data for a banner." + "\n" + "`reset [Banner ID] w` - Reset your weapon data for a banner." + "\n" + "`reset [Banner ID] a` - Reset all data for a banner." + "\n\n" + "**Resetting all data includes your Step or Record Crystal data as well.**" + "\n"; // CREATE AND PRINT HELP MENU message.getChannel().block().createMessage( s -> s.setEmbed( embed -> embed .setColor(new Color(91, 255, 105))
.setAuthor("Help Menu", null, new GitHubImage("images/System/Help_Icon.png").getURL())
Expugn/S-argo
src/main/java/io/github/spugn/Sargo/CharacterScout/StepUpv4.java
// Path: src/main/java/io/github/spugn/Sargo/Objects/Banner.java // public class Banner // { // private int bannerID; // private String bannerName; // private int bannerType; // private int bannerWepType; // private ArrayList<Character> characters; // private ArrayList<Weapon> weapons; // // public int getBannerID() // { // return bannerID; // } // // public String getBannerName() // { // return bannerName; // } // // public int getBannerType() // { // return bannerType; // } // // public int getBannerWepType() // { // return bannerWepType; // } // // public ArrayList<Character> getCharacters() // { // return characters; // } // // public ArrayList<Weapon> getWeapons() // { // return weapons; // } // // public void setBannerID(int bannerID) // { // this.bannerID = bannerID; // } // // public void setBannerName(String bannerName) // { // this.bannerName = bannerName; // } // // public void setBannerType(int bannerType) // { // this.bannerType = bannerType; // } // // public void setBannerWepType(int bannerWepType) // { // this.bannerWepType = bannerWepType; // } // // public void setCharacters(ArrayList<Character> characters) // { // this.characters = characters; // } // // public void setWeapons(ArrayList<Weapon> weapons) // { // this.weapons = weapons; // } // // public String bannerTypeToString() // { // switch(bannerType) // { // case 0: // return "Normal"; // case 1: // return "Step Up"; // case 2: // return "Record Crystal"; // case 3: // return "Step Up v2"; // case 4: // return "Birthday Step Up"; // case 5: // return "Record Crystal v2"; // case 6: // return "Memorial Scout"; // case 7: // return "Step Up v3"; // case 8: // return "Record Crystal v3"; // case 9: // return "Event"; // case 10: // return "SAO Game 5th Anniversary Step Up"; // case 11: // return "Record Crystal v4"; // case 12: // return "Step Up v4"; // case 13: // return "Step Up v5"; // case 14: // return "SAO Game 5th Anniversary Step Up v2"; // case 15: // return "Step Up v6"; // case 16: // return "SAO Game 5th Anniversary Step Up v3"; // case 17: // return "Step Up v7"; // case 18: // return "Record Crystal v5"; // case 19: // return "Step Up v8"; // case 20: // return "Record Crystal v6"; // case 21: // return "Step Up v9"; // default: // return "Unknown"; // } // } // // @Override // public String toString() // { // return bannerID + ") " + bannerName; // } // } // // Path: src/main/java/io/github/spugn/Sargo/Objects/Character.java // public class Character // { // private String prefix; // private String name; // private int rarity; // private String imagePath; // // public Character() // { // prefix = ""; // name = "null"; // rarity = 1; // imagePath = ""; // } // // public void setPrefix(String prefix) // { // this.prefix = prefix; // } // // public void setName(String name) // { // this.name = name; // } // // public void setRarity(int rarity) // { // this.rarity = rarity; // } // // public void setImagePath(String imagePath) // { // this.imagePath = imagePath; // } // // public String getPrefix() // { // return prefix; // } // // public String getName() // { // return name; // } // // public int getRarity() // { // return rarity; // } // // public String getImagePath() // { // return imagePath; // } // // @Override // public String toString() // { // if (prefix.isEmpty()) // { // return rarity + "★ " + name; // } // return rarity + "★ [" + prefix + "] " + name; // } // // public String toStringNoName() // { // if (prefix.isEmpty()) // { // return rarity + "★ " + name; // } // return rarity + "★ [" + prefix + "]"; // } // }
import discord4j.core.object.entity.Message; import io.github.spugn.Sargo.Objects.Banner; import io.github.spugn.Sargo.Objects.Character; import java.util.List;
PLATINUM = PLATINUM * 1.5; break; case 5: guaranteeOnePlatinum = true; break; case 6: COPPER = COPPER - ((PLATINUM * 2.0) - PLATINUM); PLATINUM = PLATINUM * 2.0; default: break; } } } @Override protected void updateBannerData() { int currentStep = USER.getBannerData(SELECTED_BANNER.getBannerName()); currentStep++; if (currentStep > 6) { USER.changeValue(SELECTED_BANNER.getBannerName(), 6); } else { USER.changeValue(SELECTED_BANNER.getBannerName(), currentStep); } } @Override
// Path: src/main/java/io/github/spugn/Sargo/Objects/Banner.java // public class Banner // { // private int bannerID; // private String bannerName; // private int bannerType; // private int bannerWepType; // private ArrayList<Character> characters; // private ArrayList<Weapon> weapons; // // public int getBannerID() // { // return bannerID; // } // // public String getBannerName() // { // return bannerName; // } // // public int getBannerType() // { // return bannerType; // } // // public int getBannerWepType() // { // return bannerWepType; // } // // public ArrayList<Character> getCharacters() // { // return characters; // } // // public ArrayList<Weapon> getWeapons() // { // return weapons; // } // // public void setBannerID(int bannerID) // { // this.bannerID = bannerID; // } // // public void setBannerName(String bannerName) // { // this.bannerName = bannerName; // } // // public void setBannerType(int bannerType) // { // this.bannerType = bannerType; // } // // public void setBannerWepType(int bannerWepType) // { // this.bannerWepType = bannerWepType; // } // // public void setCharacters(ArrayList<Character> characters) // { // this.characters = characters; // } // // public void setWeapons(ArrayList<Weapon> weapons) // { // this.weapons = weapons; // } // // public String bannerTypeToString() // { // switch(bannerType) // { // case 0: // return "Normal"; // case 1: // return "Step Up"; // case 2: // return "Record Crystal"; // case 3: // return "Step Up v2"; // case 4: // return "Birthday Step Up"; // case 5: // return "Record Crystal v2"; // case 6: // return "Memorial Scout"; // case 7: // return "Step Up v3"; // case 8: // return "Record Crystal v3"; // case 9: // return "Event"; // case 10: // return "SAO Game 5th Anniversary Step Up"; // case 11: // return "Record Crystal v4"; // case 12: // return "Step Up v4"; // case 13: // return "Step Up v5"; // case 14: // return "SAO Game 5th Anniversary Step Up v2"; // case 15: // return "Step Up v6"; // case 16: // return "SAO Game 5th Anniversary Step Up v3"; // case 17: // return "Step Up v7"; // case 18: // return "Record Crystal v5"; // case 19: // return "Step Up v8"; // case 20: // return "Record Crystal v6"; // case 21: // return "Step Up v9"; // default: // return "Unknown"; // } // } // // @Override // public String toString() // { // return bannerID + ") " + bannerName; // } // } // // Path: src/main/java/io/github/spugn/Sargo/Objects/Character.java // public class Character // { // private String prefix; // private String name; // private int rarity; // private String imagePath; // // public Character() // { // prefix = ""; // name = "null"; // rarity = 1; // imagePath = ""; // } // // public void setPrefix(String prefix) // { // this.prefix = prefix; // } // // public void setName(String name) // { // this.name = name; // } // // public void setRarity(int rarity) // { // this.rarity = rarity; // } // // public void setImagePath(String imagePath) // { // this.imagePath = imagePath; // } // // public String getPrefix() // { // return prefix; // } // // public String getName() // { // return name; // } // // public int getRarity() // { // return rarity; // } // // public String getImagePath() // { // return imagePath; // } // // @Override // public String toString() // { // if (prefix.isEmpty()) // { // return rarity + "★ " + name; // } // return rarity + "★ [" + prefix + "] " + name; // } // // public String toStringNoName() // { // if (prefix.isEmpty()) // { // return rarity + "★ " + name; // } // return rarity + "★ [" + prefix + "]"; // } // } // Path: src/main/java/io/github/spugn/Sargo/CharacterScout/StepUpv4.java import discord4j.core.object.entity.Message; import io.github.spugn.Sargo.Objects.Banner; import io.github.spugn.Sargo.Objects.Character; import java.util.List; PLATINUM = PLATINUM * 1.5; break; case 5: guaranteeOnePlatinum = true; break; case 6: COPPER = COPPER - ((PLATINUM * 2.0) - PLATINUM); PLATINUM = PLATINUM * 2.0; default: break; } } } @Override protected void updateBannerData() { int currentStep = USER.getBannerData(SELECTED_BANNER.getBannerName()); currentStep++; if (currentStep > 6) { USER.changeValue(SELECTED_BANNER.getBannerName(), 6); } else { USER.changeValue(SELECTED_BANNER.getBannerName(), currentStep); } } @Override
protected Character randGoldCharacter()
Expugn/S-argo
src/main/java/io/github/spugn/Sargo/CharacterScout/StepUpv4.java
// Path: src/main/java/io/github/spugn/Sargo/Objects/Banner.java // public class Banner // { // private int bannerID; // private String bannerName; // private int bannerType; // private int bannerWepType; // private ArrayList<Character> characters; // private ArrayList<Weapon> weapons; // // public int getBannerID() // { // return bannerID; // } // // public String getBannerName() // { // return bannerName; // } // // public int getBannerType() // { // return bannerType; // } // // public int getBannerWepType() // { // return bannerWepType; // } // // public ArrayList<Character> getCharacters() // { // return characters; // } // // public ArrayList<Weapon> getWeapons() // { // return weapons; // } // // public void setBannerID(int bannerID) // { // this.bannerID = bannerID; // } // // public void setBannerName(String bannerName) // { // this.bannerName = bannerName; // } // // public void setBannerType(int bannerType) // { // this.bannerType = bannerType; // } // // public void setBannerWepType(int bannerWepType) // { // this.bannerWepType = bannerWepType; // } // // public void setCharacters(ArrayList<Character> characters) // { // this.characters = characters; // } // // public void setWeapons(ArrayList<Weapon> weapons) // { // this.weapons = weapons; // } // // public String bannerTypeToString() // { // switch(bannerType) // { // case 0: // return "Normal"; // case 1: // return "Step Up"; // case 2: // return "Record Crystal"; // case 3: // return "Step Up v2"; // case 4: // return "Birthday Step Up"; // case 5: // return "Record Crystal v2"; // case 6: // return "Memorial Scout"; // case 7: // return "Step Up v3"; // case 8: // return "Record Crystal v3"; // case 9: // return "Event"; // case 10: // return "SAO Game 5th Anniversary Step Up"; // case 11: // return "Record Crystal v4"; // case 12: // return "Step Up v4"; // case 13: // return "Step Up v5"; // case 14: // return "SAO Game 5th Anniversary Step Up v2"; // case 15: // return "Step Up v6"; // case 16: // return "SAO Game 5th Anniversary Step Up v3"; // case 17: // return "Step Up v7"; // case 18: // return "Record Crystal v5"; // case 19: // return "Step Up v8"; // case 20: // return "Record Crystal v6"; // case 21: // return "Step Up v9"; // default: // return "Unknown"; // } // } // // @Override // public String toString() // { // return bannerID + ") " + bannerName; // } // } // // Path: src/main/java/io/github/spugn/Sargo/Objects/Character.java // public class Character // { // private String prefix; // private String name; // private int rarity; // private String imagePath; // // public Character() // { // prefix = ""; // name = "null"; // rarity = 1; // imagePath = ""; // } // // public void setPrefix(String prefix) // { // this.prefix = prefix; // } // // public void setName(String name) // { // this.name = name; // } // // public void setRarity(int rarity) // { // this.rarity = rarity; // } // // public void setImagePath(String imagePath) // { // this.imagePath = imagePath; // } // // public String getPrefix() // { // return prefix; // } // // public String getName() // { // return name; // } // // public int getRarity() // { // return rarity; // } // // public String getImagePath() // { // return imagePath; // } // // @Override // public String toString() // { // if (prefix.isEmpty()) // { // return rarity + "★ " + name; // } // return rarity + "★ [" + prefix + "] " + name; // } // // public String toStringNoName() // { // if (prefix.isEmpty()) // { // return rarity + "★ " + name; // } // return rarity + "★ [" + prefix + "]"; // } // }
import discord4j.core.object.entity.Message; import io.github.spugn.Sargo.Objects.Banner; import io.github.spugn.Sargo.Objects.Character; import java.util.List;
PLATINUM = PLATINUM * 2.0; default: break; } } } @Override protected void updateBannerData() { int currentStep = USER.getBannerData(SELECTED_BANNER.getBannerName()); currentStep++; if (currentStep > 6) { USER.changeValue(SELECTED_BANNER.getBannerName(), 6); } else { USER.changeValue(SELECTED_BANNER.getBannerName(), currentStep); } } @Override protected Character randGoldCharacter() { /* GET A RANDOM GOLD VARIANT CHARACTER, IF THERE IS A PLATINUM VARIANT OF THAT CHARACTER IN THE BANNER THEN GET A NEW CHARACTER. */ Character c = null; boolean charInBanner = true; int randIndex;
// Path: src/main/java/io/github/spugn/Sargo/Objects/Banner.java // public class Banner // { // private int bannerID; // private String bannerName; // private int bannerType; // private int bannerWepType; // private ArrayList<Character> characters; // private ArrayList<Weapon> weapons; // // public int getBannerID() // { // return bannerID; // } // // public String getBannerName() // { // return bannerName; // } // // public int getBannerType() // { // return bannerType; // } // // public int getBannerWepType() // { // return bannerWepType; // } // // public ArrayList<Character> getCharacters() // { // return characters; // } // // public ArrayList<Weapon> getWeapons() // { // return weapons; // } // // public void setBannerID(int bannerID) // { // this.bannerID = bannerID; // } // // public void setBannerName(String bannerName) // { // this.bannerName = bannerName; // } // // public void setBannerType(int bannerType) // { // this.bannerType = bannerType; // } // // public void setBannerWepType(int bannerWepType) // { // this.bannerWepType = bannerWepType; // } // // public void setCharacters(ArrayList<Character> characters) // { // this.characters = characters; // } // // public void setWeapons(ArrayList<Weapon> weapons) // { // this.weapons = weapons; // } // // public String bannerTypeToString() // { // switch(bannerType) // { // case 0: // return "Normal"; // case 1: // return "Step Up"; // case 2: // return "Record Crystal"; // case 3: // return "Step Up v2"; // case 4: // return "Birthday Step Up"; // case 5: // return "Record Crystal v2"; // case 6: // return "Memorial Scout"; // case 7: // return "Step Up v3"; // case 8: // return "Record Crystal v3"; // case 9: // return "Event"; // case 10: // return "SAO Game 5th Anniversary Step Up"; // case 11: // return "Record Crystal v4"; // case 12: // return "Step Up v4"; // case 13: // return "Step Up v5"; // case 14: // return "SAO Game 5th Anniversary Step Up v2"; // case 15: // return "Step Up v6"; // case 16: // return "SAO Game 5th Anniversary Step Up v3"; // case 17: // return "Step Up v7"; // case 18: // return "Record Crystal v5"; // case 19: // return "Step Up v8"; // case 20: // return "Record Crystal v6"; // case 21: // return "Step Up v9"; // default: // return "Unknown"; // } // } // // @Override // public String toString() // { // return bannerID + ") " + bannerName; // } // } // // Path: src/main/java/io/github/spugn/Sargo/Objects/Character.java // public class Character // { // private String prefix; // private String name; // private int rarity; // private String imagePath; // // public Character() // { // prefix = ""; // name = "null"; // rarity = 1; // imagePath = ""; // } // // public void setPrefix(String prefix) // { // this.prefix = prefix; // } // // public void setName(String name) // { // this.name = name; // } // // public void setRarity(int rarity) // { // this.rarity = rarity; // } // // public void setImagePath(String imagePath) // { // this.imagePath = imagePath; // } // // public String getPrefix() // { // return prefix; // } // // public String getName() // { // return name; // } // // public int getRarity() // { // return rarity; // } // // public String getImagePath() // { // return imagePath; // } // // @Override // public String toString() // { // if (prefix.isEmpty()) // { // return rarity + "★ " + name; // } // return rarity + "★ [" + prefix + "] " + name; // } // // public String toStringNoName() // { // if (prefix.isEmpty()) // { // return rarity + "★ " + name; // } // return rarity + "★ [" + prefix + "]"; // } // } // Path: src/main/java/io/github/spugn/Sargo/CharacterScout/StepUpv4.java import discord4j.core.object.entity.Message; import io.github.spugn.Sargo.Objects.Banner; import io.github.spugn.Sargo.Objects.Character; import java.util.List; PLATINUM = PLATINUM * 2.0; default: break; } } } @Override protected void updateBannerData() { int currentStep = USER.getBannerData(SELECTED_BANNER.getBannerName()); currentStep++; if (currentStep > 6) { USER.changeValue(SELECTED_BANNER.getBannerName(), 6); } else { USER.changeValue(SELECTED_BANNER.getBannerName(), currentStep); } } @Override protected Character randGoldCharacter() { /* GET A RANDOM GOLD VARIANT CHARACTER, IF THERE IS A PLATINUM VARIANT OF THAT CHARACTER IN THE BANNER THEN GET A NEW CHARACTER. */ Character c = null; boolean charInBanner = true; int randIndex;
Banner randBanner;
Expugn/S-argo
src/main/java/io/github/spugn/Sargo/CharacterScout/RecordCrystalv4.java
// Path: src/main/java/io/github/spugn/Sargo/Objects/Banner.java // public class Banner // { // private int bannerID; // private String bannerName; // private int bannerType; // private int bannerWepType; // private ArrayList<Character> characters; // private ArrayList<Weapon> weapons; // // public int getBannerID() // { // return bannerID; // } // // public String getBannerName() // { // return bannerName; // } // // public int getBannerType() // { // return bannerType; // } // // public int getBannerWepType() // { // return bannerWepType; // } // // public ArrayList<Character> getCharacters() // { // return characters; // } // // public ArrayList<Weapon> getWeapons() // { // return weapons; // } // // public void setBannerID(int bannerID) // { // this.bannerID = bannerID; // } // // public void setBannerName(String bannerName) // { // this.bannerName = bannerName; // } // // public void setBannerType(int bannerType) // { // this.bannerType = bannerType; // } // // public void setBannerWepType(int bannerWepType) // { // this.bannerWepType = bannerWepType; // } // // public void setCharacters(ArrayList<Character> characters) // { // this.characters = characters; // } // // public void setWeapons(ArrayList<Weapon> weapons) // { // this.weapons = weapons; // } // // public String bannerTypeToString() // { // switch(bannerType) // { // case 0: // return "Normal"; // case 1: // return "Step Up"; // case 2: // return "Record Crystal"; // case 3: // return "Step Up v2"; // case 4: // return "Birthday Step Up"; // case 5: // return "Record Crystal v2"; // case 6: // return "Memorial Scout"; // case 7: // return "Step Up v3"; // case 8: // return "Record Crystal v3"; // case 9: // return "Event"; // case 10: // return "SAO Game 5th Anniversary Step Up"; // case 11: // return "Record Crystal v4"; // case 12: // return "Step Up v4"; // case 13: // return "Step Up v5"; // case 14: // return "SAO Game 5th Anniversary Step Up v2"; // case 15: // return "Step Up v6"; // case 16: // return "SAO Game 5th Anniversary Step Up v3"; // case 17: // return "Step Up v7"; // case 18: // return "Record Crystal v5"; // case 19: // return "Step Up v8"; // case 20: // return "Record Crystal v6"; // case 21: // return "Step Up v9"; // default: // return "Unknown"; // } // } // // @Override // public String toString() // { // return bannerID + ") " + bannerName; // } // } // // Path: src/main/java/io/github/spugn/Sargo/Objects/Character.java // public class Character // { // private String prefix; // private String name; // private int rarity; // private String imagePath; // // public Character() // { // prefix = ""; // name = "null"; // rarity = 1; // imagePath = ""; // } // // public void setPrefix(String prefix) // { // this.prefix = prefix; // } // // public void setName(String name) // { // this.name = name; // } // // public void setRarity(int rarity) // { // this.rarity = rarity; // } // // public void setImagePath(String imagePath) // { // this.imagePath = imagePath; // } // // public String getPrefix() // { // return prefix; // } // // public String getName() // { // return name; // } // // public int getRarity() // { // return rarity; // } // // public String getImagePath() // { // return imagePath; // } // // @Override // public String toString() // { // if (prefix.isEmpty()) // { // return rarity + "★ " + name; // } // return rarity + "★ [" + prefix + "] " + name; // } // // public String toStringNoName() // { // if (prefix.isEmpty()) // { // return rarity + "★ " + name; // } // return rarity + "★ [" + prefix + "]"; // } // }
import discord4j.core.object.entity.Message; import io.github.spugn.Sargo.Objects.Banner; import io.github.spugn.Sargo.Objects.Character; import java.util.List;
} @Override protected void modifyScoutData() { if (CHOICE.equalsIgnoreCase("m") || CHOICE.equalsIgnoreCase("mi")) { switch (bannerTypeData) { case -1: multiScoutPrice = 125; bannerTypeData = 0; USER.changeValue(SELECTED_BANNER.getBannerName(), bannerTypeData); break; default: break; } } } @Override protected void updateBannerData() { rcGet = getRecordCrystals(); bannerTypeData += rcGet; USER.changeValue(SELECTED_BANNER.getBannerName(), bannerTypeData); } @Override
// Path: src/main/java/io/github/spugn/Sargo/Objects/Banner.java // public class Banner // { // private int bannerID; // private String bannerName; // private int bannerType; // private int bannerWepType; // private ArrayList<Character> characters; // private ArrayList<Weapon> weapons; // // public int getBannerID() // { // return bannerID; // } // // public String getBannerName() // { // return bannerName; // } // // public int getBannerType() // { // return bannerType; // } // // public int getBannerWepType() // { // return bannerWepType; // } // // public ArrayList<Character> getCharacters() // { // return characters; // } // // public ArrayList<Weapon> getWeapons() // { // return weapons; // } // // public void setBannerID(int bannerID) // { // this.bannerID = bannerID; // } // // public void setBannerName(String bannerName) // { // this.bannerName = bannerName; // } // // public void setBannerType(int bannerType) // { // this.bannerType = bannerType; // } // // public void setBannerWepType(int bannerWepType) // { // this.bannerWepType = bannerWepType; // } // // public void setCharacters(ArrayList<Character> characters) // { // this.characters = characters; // } // // public void setWeapons(ArrayList<Weapon> weapons) // { // this.weapons = weapons; // } // // public String bannerTypeToString() // { // switch(bannerType) // { // case 0: // return "Normal"; // case 1: // return "Step Up"; // case 2: // return "Record Crystal"; // case 3: // return "Step Up v2"; // case 4: // return "Birthday Step Up"; // case 5: // return "Record Crystal v2"; // case 6: // return "Memorial Scout"; // case 7: // return "Step Up v3"; // case 8: // return "Record Crystal v3"; // case 9: // return "Event"; // case 10: // return "SAO Game 5th Anniversary Step Up"; // case 11: // return "Record Crystal v4"; // case 12: // return "Step Up v4"; // case 13: // return "Step Up v5"; // case 14: // return "SAO Game 5th Anniversary Step Up v2"; // case 15: // return "Step Up v6"; // case 16: // return "SAO Game 5th Anniversary Step Up v3"; // case 17: // return "Step Up v7"; // case 18: // return "Record Crystal v5"; // case 19: // return "Step Up v8"; // case 20: // return "Record Crystal v6"; // case 21: // return "Step Up v9"; // default: // return "Unknown"; // } // } // // @Override // public String toString() // { // return bannerID + ") " + bannerName; // } // } // // Path: src/main/java/io/github/spugn/Sargo/Objects/Character.java // public class Character // { // private String prefix; // private String name; // private int rarity; // private String imagePath; // // public Character() // { // prefix = ""; // name = "null"; // rarity = 1; // imagePath = ""; // } // // public void setPrefix(String prefix) // { // this.prefix = prefix; // } // // public void setName(String name) // { // this.name = name; // } // // public void setRarity(int rarity) // { // this.rarity = rarity; // } // // public void setImagePath(String imagePath) // { // this.imagePath = imagePath; // } // // public String getPrefix() // { // return prefix; // } // // public String getName() // { // return name; // } // // public int getRarity() // { // return rarity; // } // // public String getImagePath() // { // return imagePath; // } // // @Override // public String toString() // { // if (prefix.isEmpty()) // { // return rarity + "★ " + name; // } // return rarity + "★ [" + prefix + "] " + name; // } // // public String toStringNoName() // { // if (prefix.isEmpty()) // { // return rarity + "★ " + name; // } // return rarity + "★ [" + prefix + "]"; // } // } // Path: src/main/java/io/github/spugn/Sargo/CharacterScout/RecordCrystalv4.java import discord4j.core.object.entity.Message; import io.github.spugn.Sargo.Objects.Banner; import io.github.spugn.Sargo.Objects.Character; import java.util.List; } @Override protected void modifyScoutData() { if (CHOICE.equalsIgnoreCase("m") || CHOICE.equalsIgnoreCase("mi")) { switch (bannerTypeData) { case -1: multiScoutPrice = 125; bannerTypeData = 0; USER.changeValue(SELECTED_BANNER.getBannerName(), bannerTypeData); break; default: break; } } } @Override protected void updateBannerData() { rcGet = getRecordCrystals(); bannerTypeData += rcGet; USER.changeValue(SELECTED_BANNER.getBannerName(), bannerTypeData); } @Override
protected Character randGoldCharacter()
Expugn/S-argo
src/main/java/io/github/spugn/Sargo/CharacterScout/RecordCrystalv4.java
// Path: src/main/java/io/github/spugn/Sargo/Objects/Banner.java // public class Banner // { // private int bannerID; // private String bannerName; // private int bannerType; // private int bannerWepType; // private ArrayList<Character> characters; // private ArrayList<Weapon> weapons; // // public int getBannerID() // { // return bannerID; // } // // public String getBannerName() // { // return bannerName; // } // // public int getBannerType() // { // return bannerType; // } // // public int getBannerWepType() // { // return bannerWepType; // } // // public ArrayList<Character> getCharacters() // { // return characters; // } // // public ArrayList<Weapon> getWeapons() // { // return weapons; // } // // public void setBannerID(int bannerID) // { // this.bannerID = bannerID; // } // // public void setBannerName(String bannerName) // { // this.bannerName = bannerName; // } // // public void setBannerType(int bannerType) // { // this.bannerType = bannerType; // } // // public void setBannerWepType(int bannerWepType) // { // this.bannerWepType = bannerWepType; // } // // public void setCharacters(ArrayList<Character> characters) // { // this.characters = characters; // } // // public void setWeapons(ArrayList<Weapon> weapons) // { // this.weapons = weapons; // } // // public String bannerTypeToString() // { // switch(bannerType) // { // case 0: // return "Normal"; // case 1: // return "Step Up"; // case 2: // return "Record Crystal"; // case 3: // return "Step Up v2"; // case 4: // return "Birthday Step Up"; // case 5: // return "Record Crystal v2"; // case 6: // return "Memorial Scout"; // case 7: // return "Step Up v3"; // case 8: // return "Record Crystal v3"; // case 9: // return "Event"; // case 10: // return "SAO Game 5th Anniversary Step Up"; // case 11: // return "Record Crystal v4"; // case 12: // return "Step Up v4"; // case 13: // return "Step Up v5"; // case 14: // return "SAO Game 5th Anniversary Step Up v2"; // case 15: // return "Step Up v6"; // case 16: // return "SAO Game 5th Anniversary Step Up v3"; // case 17: // return "Step Up v7"; // case 18: // return "Record Crystal v5"; // case 19: // return "Step Up v8"; // case 20: // return "Record Crystal v6"; // case 21: // return "Step Up v9"; // default: // return "Unknown"; // } // } // // @Override // public String toString() // { // return bannerID + ") " + bannerName; // } // } // // Path: src/main/java/io/github/spugn/Sargo/Objects/Character.java // public class Character // { // private String prefix; // private String name; // private int rarity; // private String imagePath; // // public Character() // { // prefix = ""; // name = "null"; // rarity = 1; // imagePath = ""; // } // // public void setPrefix(String prefix) // { // this.prefix = prefix; // } // // public void setName(String name) // { // this.name = name; // } // // public void setRarity(int rarity) // { // this.rarity = rarity; // } // // public void setImagePath(String imagePath) // { // this.imagePath = imagePath; // } // // public String getPrefix() // { // return prefix; // } // // public String getName() // { // return name; // } // // public int getRarity() // { // return rarity; // } // // public String getImagePath() // { // return imagePath; // } // // @Override // public String toString() // { // if (prefix.isEmpty()) // { // return rarity + "★ " + name; // } // return rarity + "★ [" + prefix + "] " + name; // } // // public String toStringNoName() // { // if (prefix.isEmpty()) // { // return rarity + "★ " + name; // } // return rarity + "★ [" + prefix + "]"; // } // }
import discord4j.core.object.entity.Message; import io.github.spugn.Sargo.Objects.Banner; import io.github.spugn.Sargo.Objects.Character; import java.util.List;
protected void modifyScoutData() { if (CHOICE.equalsIgnoreCase("m") || CHOICE.equalsIgnoreCase("mi")) { switch (bannerTypeData) { case -1: multiScoutPrice = 125; bannerTypeData = 0; USER.changeValue(SELECTED_BANNER.getBannerName(), bannerTypeData); break; default: break; } } } @Override protected void updateBannerData() { rcGet = getRecordCrystals(); bannerTypeData += rcGet; USER.changeValue(SELECTED_BANNER.getBannerName(), bannerTypeData); } @Override protected Character randGoldCharacter() { int randIndex = GOLD_BANNERS_V2.get(RNG.nextInt(GOLD_BANNERS_V2.size()));
// Path: src/main/java/io/github/spugn/Sargo/Objects/Banner.java // public class Banner // { // private int bannerID; // private String bannerName; // private int bannerType; // private int bannerWepType; // private ArrayList<Character> characters; // private ArrayList<Weapon> weapons; // // public int getBannerID() // { // return bannerID; // } // // public String getBannerName() // { // return bannerName; // } // // public int getBannerType() // { // return bannerType; // } // // public int getBannerWepType() // { // return bannerWepType; // } // // public ArrayList<Character> getCharacters() // { // return characters; // } // // public ArrayList<Weapon> getWeapons() // { // return weapons; // } // // public void setBannerID(int bannerID) // { // this.bannerID = bannerID; // } // // public void setBannerName(String bannerName) // { // this.bannerName = bannerName; // } // // public void setBannerType(int bannerType) // { // this.bannerType = bannerType; // } // // public void setBannerWepType(int bannerWepType) // { // this.bannerWepType = bannerWepType; // } // // public void setCharacters(ArrayList<Character> characters) // { // this.characters = characters; // } // // public void setWeapons(ArrayList<Weapon> weapons) // { // this.weapons = weapons; // } // // public String bannerTypeToString() // { // switch(bannerType) // { // case 0: // return "Normal"; // case 1: // return "Step Up"; // case 2: // return "Record Crystal"; // case 3: // return "Step Up v2"; // case 4: // return "Birthday Step Up"; // case 5: // return "Record Crystal v2"; // case 6: // return "Memorial Scout"; // case 7: // return "Step Up v3"; // case 8: // return "Record Crystal v3"; // case 9: // return "Event"; // case 10: // return "SAO Game 5th Anniversary Step Up"; // case 11: // return "Record Crystal v4"; // case 12: // return "Step Up v4"; // case 13: // return "Step Up v5"; // case 14: // return "SAO Game 5th Anniversary Step Up v2"; // case 15: // return "Step Up v6"; // case 16: // return "SAO Game 5th Anniversary Step Up v3"; // case 17: // return "Step Up v7"; // case 18: // return "Record Crystal v5"; // case 19: // return "Step Up v8"; // case 20: // return "Record Crystal v6"; // case 21: // return "Step Up v9"; // default: // return "Unknown"; // } // } // // @Override // public String toString() // { // return bannerID + ") " + bannerName; // } // } // // Path: src/main/java/io/github/spugn/Sargo/Objects/Character.java // public class Character // { // private String prefix; // private String name; // private int rarity; // private String imagePath; // // public Character() // { // prefix = ""; // name = "null"; // rarity = 1; // imagePath = ""; // } // // public void setPrefix(String prefix) // { // this.prefix = prefix; // } // // public void setName(String name) // { // this.name = name; // } // // public void setRarity(int rarity) // { // this.rarity = rarity; // } // // public void setImagePath(String imagePath) // { // this.imagePath = imagePath; // } // // public String getPrefix() // { // return prefix; // } // // public String getName() // { // return name; // } // // public int getRarity() // { // return rarity; // } // // public String getImagePath() // { // return imagePath; // } // // @Override // public String toString() // { // if (prefix.isEmpty()) // { // return rarity + "★ " + name; // } // return rarity + "★ [" + prefix + "] " + name; // } // // public String toStringNoName() // { // if (prefix.isEmpty()) // { // return rarity + "★ " + name; // } // return rarity + "★ [" + prefix + "]"; // } // } // Path: src/main/java/io/github/spugn/Sargo/CharacterScout/RecordCrystalv4.java import discord4j.core.object.entity.Message; import io.github.spugn.Sargo.Objects.Banner; import io.github.spugn.Sargo.Objects.Character; import java.util.List; protected void modifyScoutData() { if (CHOICE.equalsIgnoreCase("m") || CHOICE.equalsIgnoreCase("mi")) { switch (bannerTypeData) { case -1: multiScoutPrice = 125; bannerTypeData = 0; USER.changeValue(SELECTED_BANNER.getBannerName(), bannerTypeData); break; default: break; } } } @Override protected void updateBannerData() { rcGet = getRecordCrystals(); bannerTypeData += rcGet; USER.changeValue(SELECTED_BANNER.getBannerName(), bannerTypeData); } @Override protected Character randGoldCharacter() { int randIndex = GOLD_BANNERS_V2.get(RNG.nextInt(GOLD_BANNERS_V2.size()));
Banner randBanner = BANNERS.get(randIndex - 1);
Expugn/S-argo
src/main/java/io/github/spugn/Sargo/CharacterScout/StepUpv6.java
// Path: src/main/java/io/github/spugn/Sargo/Objects/Banner.java // public class Banner // { // private int bannerID; // private String bannerName; // private int bannerType; // private int bannerWepType; // private ArrayList<Character> characters; // private ArrayList<Weapon> weapons; // // public int getBannerID() // { // return bannerID; // } // // public String getBannerName() // { // return bannerName; // } // // public int getBannerType() // { // return bannerType; // } // // public int getBannerWepType() // { // return bannerWepType; // } // // public ArrayList<Character> getCharacters() // { // return characters; // } // // public ArrayList<Weapon> getWeapons() // { // return weapons; // } // // public void setBannerID(int bannerID) // { // this.bannerID = bannerID; // } // // public void setBannerName(String bannerName) // { // this.bannerName = bannerName; // } // // public void setBannerType(int bannerType) // { // this.bannerType = bannerType; // } // // public void setBannerWepType(int bannerWepType) // { // this.bannerWepType = bannerWepType; // } // // public void setCharacters(ArrayList<Character> characters) // { // this.characters = characters; // } // // public void setWeapons(ArrayList<Weapon> weapons) // { // this.weapons = weapons; // } // // public String bannerTypeToString() // { // switch(bannerType) // { // case 0: // return "Normal"; // case 1: // return "Step Up"; // case 2: // return "Record Crystal"; // case 3: // return "Step Up v2"; // case 4: // return "Birthday Step Up"; // case 5: // return "Record Crystal v2"; // case 6: // return "Memorial Scout"; // case 7: // return "Step Up v3"; // case 8: // return "Record Crystal v3"; // case 9: // return "Event"; // case 10: // return "SAO Game 5th Anniversary Step Up"; // case 11: // return "Record Crystal v4"; // case 12: // return "Step Up v4"; // case 13: // return "Step Up v5"; // case 14: // return "SAO Game 5th Anniversary Step Up v2"; // case 15: // return "Step Up v6"; // case 16: // return "SAO Game 5th Anniversary Step Up v3"; // case 17: // return "Step Up v7"; // case 18: // return "Record Crystal v5"; // case 19: // return "Step Up v8"; // case 20: // return "Record Crystal v6"; // case 21: // return "Step Up v9"; // default: // return "Unknown"; // } // } // // @Override // public String toString() // { // return bannerID + ") " + bannerName; // } // } // // Path: src/main/java/io/github/spugn/Sargo/Objects/Character.java // public class Character // { // private String prefix; // private String name; // private int rarity; // private String imagePath; // // public Character() // { // prefix = ""; // name = "null"; // rarity = 1; // imagePath = ""; // } // // public void setPrefix(String prefix) // { // this.prefix = prefix; // } // // public void setName(String name) // { // this.name = name; // } // // public void setRarity(int rarity) // { // this.rarity = rarity; // } // // public void setImagePath(String imagePath) // { // this.imagePath = imagePath; // } // // public String getPrefix() // { // return prefix; // } // // public String getName() // { // return name; // } // // public int getRarity() // { // return rarity; // } // // public String getImagePath() // { // return imagePath; // } // // @Override // public String toString() // { // if (prefix.isEmpty()) // { // return rarity + "★ " + name; // } // return rarity + "★ [" + prefix + "] " + name; // } // // public String toStringNoName() // { // if (prefix.isEmpty()) // { // return rarity + "★ " + name; // } // return rarity + "★ [" + prefix + "]"; // } // }
import discord4j.core.object.entity.Message; import io.github.spugn.Sargo.Objects.Banner; import io.github.spugn.Sargo.Objects.Character; import java.util.List;
switch (bannerTypeData) { case 1: multiScoutPrice = 125; break; case 3: COPPER = COPPER - ((PLATINUM * 2.0) - PLATINUM); PLATINUM = PLATINUM * 2.0; default: break; } } } @Override protected void updateBannerData() { int currentStep = USER.getBannerData(SELECTED_BANNER.getBannerName()); currentStep++; if (currentStep > 3) { USER.changeValue(SELECTED_BANNER.getBannerName(), 1); } else { USER.changeValue(SELECTED_BANNER.getBannerName(), currentStep); } } @Override
// Path: src/main/java/io/github/spugn/Sargo/Objects/Banner.java // public class Banner // { // private int bannerID; // private String bannerName; // private int bannerType; // private int bannerWepType; // private ArrayList<Character> characters; // private ArrayList<Weapon> weapons; // // public int getBannerID() // { // return bannerID; // } // // public String getBannerName() // { // return bannerName; // } // // public int getBannerType() // { // return bannerType; // } // // public int getBannerWepType() // { // return bannerWepType; // } // // public ArrayList<Character> getCharacters() // { // return characters; // } // // public ArrayList<Weapon> getWeapons() // { // return weapons; // } // // public void setBannerID(int bannerID) // { // this.bannerID = bannerID; // } // // public void setBannerName(String bannerName) // { // this.bannerName = bannerName; // } // // public void setBannerType(int bannerType) // { // this.bannerType = bannerType; // } // // public void setBannerWepType(int bannerWepType) // { // this.bannerWepType = bannerWepType; // } // // public void setCharacters(ArrayList<Character> characters) // { // this.characters = characters; // } // // public void setWeapons(ArrayList<Weapon> weapons) // { // this.weapons = weapons; // } // // public String bannerTypeToString() // { // switch(bannerType) // { // case 0: // return "Normal"; // case 1: // return "Step Up"; // case 2: // return "Record Crystal"; // case 3: // return "Step Up v2"; // case 4: // return "Birthday Step Up"; // case 5: // return "Record Crystal v2"; // case 6: // return "Memorial Scout"; // case 7: // return "Step Up v3"; // case 8: // return "Record Crystal v3"; // case 9: // return "Event"; // case 10: // return "SAO Game 5th Anniversary Step Up"; // case 11: // return "Record Crystal v4"; // case 12: // return "Step Up v4"; // case 13: // return "Step Up v5"; // case 14: // return "SAO Game 5th Anniversary Step Up v2"; // case 15: // return "Step Up v6"; // case 16: // return "SAO Game 5th Anniversary Step Up v3"; // case 17: // return "Step Up v7"; // case 18: // return "Record Crystal v5"; // case 19: // return "Step Up v8"; // case 20: // return "Record Crystal v6"; // case 21: // return "Step Up v9"; // default: // return "Unknown"; // } // } // // @Override // public String toString() // { // return bannerID + ") " + bannerName; // } // } // // Path: src/main/java/io/github/spugn/Sargo/Objects/Character.java // public class Character // { // private String prefix; // private String name; // private int rarity; // private String imagePath; // // public Character() // { // prefix = ""; // name = "null"; // rarity = 1; // imagePath = ""; // } // // public void setPrefix(String prefix) // { // this.prefix = prefix; // } // // public void setName(String name) // { // this.name = name; // } // // public void setRarity(int rarity) // { // this.rarity = rarity; // } // // public void setImagePath(String imagePath) // { // this.imagePath = imagePath; // } // // public String getPrefix() // { // return prefix; // } // // public String getName() // { // return name; // } // // public int getRarity() // { // return rarity; // } // // public String getImagePath() // { // return imagePath; // } // // @Override // public String toString() // { // if (prefix.isEmpty()) // { // return rarity + "★ " + name; // } // return rarity + "★ [" + prefix + "] " + name; // } // // public String toStringNoName() // { // if (prefix.isEmpty()) // { // return rarity + "★ " + name; // } // return rarity + "★ [" + prefix + "]"; // } // } // Path: src/main/java/io/github/spugn/Sargo/CharacterScout/StepUpv6.java import discord4j.core.object.entity.Message; import io.github.spugn.Sargo.Objects.Banner; import io.github.spugn.Sargo.Objects.Character; import java.util.List; switch (bannerTypeData) { case 1: multiScoutPrice = 125; break; case 3: COPPER = COPPER - ((PLATINUM * 2.0) - PLATINUM); PLATINUM = PLATINUM * 2.0; default: break; } } } @Override protected void updateBannerData() { int currentStep = USER.getBannerData(SELECTED_BANNER.getBannerName()); currentStep++; if (currentStep > 3) { USER.changeValue(SELECTED_BANNER.getBannerName(), 1); } else { USER.changeValue(SELECTED_BANNER.getBannerName(), currentStep); } } @Override
protected Character randGoldCharacter()
Expugn/S-argo
src/main/java/io/github/spugn/Sargo/CharacterScout/StepUpv6.java
// Path: src/main/java/io/github/spugn/Sargo/Objects/Banner.java // public class Banner // { // private int bannerID; // private String bannerName; // private int bannerType; // private int bannerWepType; // private ArrayList<Character> characters; // private ArrayList<Weapon> weapons; // // public int getBannerID() // { // return bannerID; // } // // public String getBannerName() // { // return bannerName; // } // // public int getBannerType() // { // return bannerType; // } // // public int getBannerWepType() // { // return bannerWepType; // } // // public ArrayList<Character> getCharacters() // { // return characters; // } // // public ArrayList<Weapon> getWeapons() // { // return weapons; // } // // public void setBannerID(int bannerID) // { // this.bannerID = bannerID; // } // // public void setBannerName(String bannerName) // { // this.bannerName = bannerName; // } // // public void setBannerType(int bannerType) // { // this.bannerType = bannerType; // } // // public void setBannerWepType(int bannerWepType) // { // this.bannerWepType = bannerWepType; // } // // public void setCharacters(ArrayList<Character> characters) // { // this.characters = characters; // } // // public void setWeapons(ArrayList<Weapon> weapons) // { // this.weapons = weapons; // } // // public String bannerTypeToString() // { // switch(bannerType) // { // case 0: // return "Normal"; // case 1: // return "Step Up"; // case 2: // return "Record Crystal"; // case 3: // return "Step Up v2"; // case 4: // return "Birthday Step Up"; // case 5: // return "Record Crystal v2"; // case 6: // return "Memorial Scout"; // case 7: // return "Step Up v3"; // case 8: // return "Record Crystal v3"; // case 9: // return "Event"; // case 10: // return "SAO Game 5th Anniversary Step Up"; // case 11: // return "Record Crystal v4"; // case 12: // return "Step Up v4"; // case 13: // return "Step Up v5"; // case 14: // return "SAO Game 5th Anniversary Step Up v2"; // case 15: // return "Step Up v6"; // case 16: // return "SAO Game 5th Anniversary Step Up v3"; // case 17: // return "Step Up v7"; // case 18: // return "Record Crystal v5"; // case 19: // return "Step Up v8"; // case 20: // return "Record Crystal v6"; // case 21: // return "Step Up v9"; // default: // return "Unknown"; // } // } // // @Override // public String toString() // { // return bannerID + ") " + bannerName; // } // } // // Path: src/main/java/io/github/spugn/Sargo/Objects/Character.java // public class Character // { // private String prefix; // private String name; // private int rarity; // private String imagePath; // // public Character() // { // prefix = ""; // name = "null"; // rarity = 1; // imagePath = ""; // } // // public void setPrefix(String prefix) // { // this.prefix = prefix; // } // // public void setName(String name) // { // this.name = name; // } // // public void setRarity(int rarity) // { // this.rarity = rarity; // } // // public void setImagePath(String imagePath) // { // this.imagePath = imagePath; // } // // public String getPrefix() // { // return prefix; // } // // public String getName() // { // return name; // } // // public int getRarity() // { // return rarity; // } // // public String getImagePath() // { // return imagePath; // } // // @Override // public String toString() // { // if (prefix.isEmpty()) // { // return rarity + "★ " + name; // } // return rarity + "★ [" + prefix + "] " + name; // } // // public String toStringNoName() // { // if (prefix.isEmpty()) // { // return rarity + "★ " + name; // } // return rarity + "★ [" + prefix + "]"; // } // }
import discord4j.core.object.entity.Message; import io.github.spugn.Sargo.Objects.Banner; import io.github.spugn.Sargo.Objects.Character; import java.util.List;
PLATINUM = PLATINUM * 2.0; default: break; } } } @Override protected void updateBannerData() { int currentStep = USER.getBannerData(SELECTED_BANNER.getBannerName()); currentStep++; if (currentStep > 3) { USER.changeValue(SELECTED_BANNER.getBannerName(), 1); } else { USER.changeValue(SELECTED_BANNER.getBannerName(), currentStep); } } @Override protected Character randGoldCharacter() { /* GET A RANDOM GOLD VARIANT CHARACTER, IF THERE IS A PLATINUM VARIANT OF THAT CHARACTER IN THE BANNER THEN GET A NEW CHARACTER. */ Character c = null; boolean charInBanner = true; int randIndex;
// Path: src/main/java/io/github/spugn/Sargo/Objects/Banner.java // public class Banner // { // private int bannerID; // private String bannerName; // private int bannerType; // private int bannerWepType; // private ArrayList<Character> characters; // private ArrayList<Weapon> weapons; // // public int getBannerID() // { // return bannerID; // } // // public String getBannerName() // { // return bannerName; // } // // public int getBannerType() // { // return bannerType; // } // // public int getBannerWepType() // { // return bannerWepType; // } // // public ArrayList<Character> getCharacters() // { // return characters; // } // // public ArrayList<Weapon> getWeapons() // { // return weapons; // } // // public void setBannerID(int bannerID) // { // this.bannerID = bannerID; // } // // public void setBannerName(String bannerName) // { // this.bannerName = bannerName; // } // // public void setBannerType(int bannerType) // { // this.bannerType = bannerType; // } // // public void setBannerWepType(int bannerWepType) // { // this.bannerWepType = bannerWepType; // } // // public void setCharacters(ArrayList<Character> characters) // { // this.characters = characters; // } // // public void setWeapons(ArrayList<Weapon> weapons) // { // this.weapons = weapons; // } // // public String bannerTypeToString() // { // switch(bannerType) // { // case 0: // return "Normal"; // case 1: // return "Step Up"; // case 2: // return "Record Crystal"; // case 3: // return "Step Up v2"; // case 4: // return "Birthday Step Up"; // case 5: // return "Record Crystal v2"; // case 6: // return "Memorial Scout"; // case 7: // return "Step Up v3"; // case 8: // return "Record Crystal v3"; // case 9: // return "Event"; // case 10: // return "SAO Game 5th Anniversary Step Up"; // case 11: // return "Record Crystal v4"; // case 12: // return "Step Up v4"; // case 13: // return "Step Up v5"; // case 14: // return "SAO Game 5th Anniversary Step Up v2"; // case 15: // return "Step Up v6"; // case 16: // return "SAO Game 5th Anniversary Step Up v3"; // case 17: // return "Step Up v7"; // case 18: // return "Record Crystal v5"; // case 19: // return "Step Up v8"; // case 20: // return "Record Crystal v6"; // case 21: // return "Step Up v9"; // default: // return "Unknown"; // } // } // // @Override // public String toString() // { // return bannerID + ") " + bannerName; // } // } // // Path: src/main/java/io/github/spugn/Sargo/Objects/Character.java // public class Character // { // private String prefix; // private String name; // private int rarity; // private String imagePath; // // public Character() // { // prefix = ""; // name = "null"; // rarity = 1; // imagePath = ""; // } // // public void setPrefix(String prefix) // { // this.prefix = prefix; // } // // public void setName(String name) // { // this.name = name; // } // // public void setRarity(int rarity) // { // this.rarity = rarity; // } // // public void setImagePath(String imagePath) // { // this.imagePath = imagePath; // } // // public String getPrefix() // { // return prefix; // } // // public String getName() // { // return name; // } // // public int getRarity() // { // return rarity; // } // // public String getImagePath() // { // return imagePath; // } // // @Override // public String toString() // { // if (prefix.isEmpty()) // { // return rarity + "★ " + name; // } // return rarity + "★ [" + prefix + "] " + name; // } // // public String toStringNoName() // { // if (prefix.isEmpty()) // { // return rarity + "★ " + name; // } // return rarity + "★ [" + prefix + "]"; // } // } // Path: src/main/java/io/github/spugn/Sargo/CharacterScout/StepUpv6.java import discord4j.core.object.entity.Message; import io.github.spugn.Sargo.Objects.Banner; import io.github.spugn.Sargo.Objects.Character; import java.util.List; PLATINUM = PLATINUM * 2.0; default: break; } } } @Override protected void updateBannerData() { int currentStep = USER.getBannerData(SELECTED_BANNER.getBannerName()); currentStep++; if (currentStep > 3) { USER.changeValue(SELECTED_BANNER.getBannerName(), 1); } else { USER.changeValue(SELECTED_BANNER.getBannerName(), currentStep); } } @Override protected Character randGoldCharacter() { /* GET A RANDOM GOLD VARIANT CHARACTER, IF THERE IS A PLATINUM VARIANT OF THAT CHARACTER IN THE BANNER THEN GET A NEW CHARACTER. */ Character c = null; boolean charInBanner = true; int randIndex;
Banner randBanner;
Expugn/S-argo
src/main/java/io/github/spugn/Sargo/CharacterScout/RecordCrystalv3.java
// Path: src/main/java/io/github/spugn/Sargo/Objects/Banner.java // public class Banner // { // private int bannerID; // private String bannerName; // private int bannerType; // private int bannerWepType; // private ArrayList<Character> characters; // private ArrayList<Weapon> weapons; // // public int getBannerID() // { // return bannerID; // } // // public String getBannerName() // { // return bannerName; // } // // public int getBannerType() // { // return bannerType; // } // // public int getBannerWepType() // { // return bannerWepType; // } // // public ArrayList<Character> getCharacters() // { // return characters; // } // // public ArrayList<Weapon> getWeapons() // { // return weapons; // } // // public void setBannerID(int bannerID) // { // this.bannerID = bannerID; // } // // public void setBannerName(String bannerName) // { // this.bannerName = bannerName; // } // // public void setBannerType(int bannerType) // { // this.bannerType = bannerType; // } // // public void setBannerWepType(int bannerWepType) // { // this.bannerWepType = bannerWepType; // } // // public void setCharacters(ArrayList<Character> characters) // { // this.characters = characters; // } // // public void setWeapons(ArrayList<Weapon> weapons) // { // this.weapons = weapons; // } // // public String bannerTypeToString() // { // switch(bannerType) // { // case 0: // return "Normal"; // case 1: // return "Step Up"; // case 2: // return "Record Crystal"; // case 3: // return "Step Up v2"; // case 4: // return "Birthday Step Up"; // case 5: // return "Record Crystal v2"; // case 6: // return "Memorial Scout"; // case 7: // return "Step Up v3"; // case 8: // return "Record Crystal v3"; // case 9: // return "Event"; // case 10: // return "SAO Game 5th Anniversary Step Up"; // case 11: // return "Record Crystal v4"; // case 12: // return "Step Up v4"; // case 13: // return "Step Up v5"; // case 14: // return "SAO Game 5th Anniversary Step Up v2"; // case 15: // return "Step Up v6"; // case 16: // return "SAO Game 5th Anniversary Step Up v3"; // case 17: // return "Step Up v7"; // case 18: // return "Record Crystal v5"; // case 19: // return "Step Up v8"; // case 20: // return "Record Crystal v6"; // case 21: // return "Step Up v9"; // default: // return "Unknown"; // } // } // // @Override // public String toString() // { // return bannerID + ") " + bannerName; // } // } // // Path: src/main/java/io/github/spugn/Sargo/Objects/Character.java // public class Character // { // private String prefix; // private String name; // private int rarity; // private String imagePath; // // public Character() // { // prefix = ""; // name = "null"; // rarity = 1; // imagePath = ""; // } // // public void setPrefix(String prefix) // { // this.prefix = prefix; // } // // public void setName(String name) // { // this.name = name; // } // // public void setRarity(int rarity) // { // this.rarity = rarity; // } // // public void setImagePath(String imagePath) // { // this.imagePath = imagePath; // } // // public String getPrefix() // { // return prefix; // } // // public String getName() // { // return name; // } // // public int getRarity() // { // return rarity; // } // // public String getImagePath() // { // return imagePath; // } // // @Override // public String toString() // { // if (prefix.isEmpty()) // { // return rarity + "★ " + name; // } // return rarity + "★ [" + prefix + "] " + name; // } // // public String toStringNoName() // { // if (prefix.isEmpty()) // { // return rarity + "★ " + name; // } // return rarity + "★ [" + prefix + "]"; // } // }
import discord4j.core.object.entity.Message; import io.github.spugn.Sargo.Objects.Banner; import io.github.spugn.Sargo.Objects.Character; import java.util.List;
{ // REMOVE 1.5% FROM PLATINUM (IT'S ORIGINAL VALUE) COPPER = COPPER + (PLATINUM - (PLATINUM / 1.5)); PLATINUM = PLATINUM / 1.5; if (CHOICE.equalsIgnoreCase("m") || CHOICE.equalsIgnoreCase("mi")) { switch (bannerTypeData) { case -1: multiScoutPrice = 125; bannerTypeData = 0; USER.changeValue(SELECTED_BANNER.getBannerName(), bannerTypeData); break; default: break; } } } @Override protected void updateBannerData() { rcGet = getRecordCrystals(); bannerTypeData += rcGet; USER.changeValue(SELECTED_BANNER.getBannerName(), bannerTypeData); } @Override
// Path: src/main/java/io/github/spugn/Sargo/Objects/Banner.java // public class Banner // { // private int bannerID; // private String bannerName; // private int bannerType; // private int bannerWepType; // private ArrayList<Character> characters; // private ArrayList<Weapon> weapons; // // public int getBannerID() // { // return bannerID; // } // // public String getBannerName() // { // return bannerName; // } // // public int getBannerType() // { // return bannerType; // } // // public int getBannerWepType() // { // return bannerWepType; // } // // public ArrayList<Character> getCharacters() // { // return characters; // } // // public ArrayList<Weapon> getWeapons() // { // return weapons; // } // // public void setBannerID(int bannerID) // { // this.bannerID = bannerID; // } // // public void setBannerName(String bannerName) // { // this.bannerName = bannerName; // } // // public void setBannerType(int bannerType) // { // this.bannerType = bannerType; // } // // public void setBannerWepType(int bannerWepType) // { // this.bannerWepType = bannerWepType; // } // // public void setCharacters(ArrayList<Character> characters) // { // this.characters = characters; // } // // public void setWeapons(ArrayList<Weapon> weapons) // { // this.weapons = weapons; // } // // public String bannerTypeToString() // { // switch(bannerType) // { // case 0: // return "Normal"; // case 1: // return "Step Up"; // case 2: // return "Record Crystal"; // case 3: // return "Step Up v2"; // case 4: // return "Birthday Step Up"; // case 5: // return "Record Crystal v2"; // case 6: // return "Memorial Scout"; // case 7: // return "Step Up v3"; // case 8: // return "Record Crystal v3"; // case 9: // return "Event"; // case 10: // return "SAO Game 5th Anniversary Step Up"; // case 11: // return "Record Crystal v4"; // case 12: // return "Step Up v4"; // case 13: // return "Step Up v5"; // case 14: // return "SAO Game 5th Anniversary Step Up v2"; // case 15: // return "Step Up v6"; // case 16: // return "SAO Game 5th Anniversary Step Up v3"; // case 17: // return "Step Up v7"; // case 18: // return "Record Crystal v5"; // case 19: // return "Step Up v8"; // case 20: // return "Record Crystal v6"; // case 21: // return "Step Up v9"; // default: // return "Unknown"; // } // } // // @Override // public String toString() // { // return bannerID + ") " + bannerName; // } // } // // Path: src/main/java/io/github/spugn/Sargo/Objects/Character.java // public class Character // { // private String prefix; // private String name; // private int rarity; // private String imagePath; // // public Character() // { // prefix = ""; // name = "null"; // rarity = 1; // imagePath = ""; // } // // public void setPrefix(String prefix) // { // this.prefix = prefix; // } // // public void setName(String name) // { // this.name = name; // } // // public void setRarity(int rarity) // { // this.rarity = rarity; // } // // public void setImagePath(String imagePath) // { // this.imagePath = imagePath; // } // // public String getPrefix() // { // return prefix; // } // // public String getName() // { // return name; // } // // public int getRarity() // { // return rarity; // } // // public String getImagePath() // { // return imagePath; // } // // @Override // public String toString() // { // if (prefix.isEmpty()) // { // return rarity + "★ " + name; // } // return rarity + "★ [" + prefix + "] " + name; // } // // public String toStringNoName() // { // if (prefix.isEmpty()) // { // return rarity + "★ " + name; // } // return rarity + "★ [" + prefix + "]"; // } // } // Path: src/main/java/io/github/spugn/Sargo/CharacterScout/RecordCrystalv3.java import discord4j.core.object.entity.Message; import io.github.spugn.Sargo.Objects.Banner; import io.github.spugn.Sargo.Objects.Character; import java.util.List; { // REMOVE 1.5% FROM PLATINUM (IT'S ORIGINAL VALUE) COPPER = COPPER + (PLATINUM - (PLATINUM / 1.5)); PLATINUM = PLATINUM / 1.5; if (CHOICE.equalsIgnoreCase("m") || CHOICE.equalsIgnoreCase("mi")) { switch (bannerTypeData) { case -1: multiScoutPrice = 125; bannerTypeData = 0; USER.changeValue(SELECTED_BANNER.getBannerName(), bannerTypeData); break; default: break; } } } @Override protected void updateBannerData() { rcGet = getRecordCrystals(); bannerTypeData += rcGet; USER.changeValue(SELECTED_BANNER.getBannerName(), bannerTypeData); } @Override
protected Character randGoldCharacter()
Expugn/S-argo
src/main/java/io/github/spugn/Sargo/CharacterScout/RecordCrystalv3.java
// Path: src/main/java/io/github/spugn/Sargo/Objects/Banner.java // public class Banner // { // private int bannerID; // private String bannerName; // private int bannerType; // private int bannerWepType; // private ArrayList<Character> characters; // private ArrayList<Weapon> weapons; // // public int getBannerID() // { // return bannerID; // } // // public String getBannerName() // { // return bannerName; // } // // public int getBannerType() // { // return bannerType; // } // // public int getBannerWepType() // { // return bannerWepType; // } // // public ArrayList<Character> getCharacters() // { // return characters; // } // // public ArrayList<Weapon> getWeapons() // { // return weapons; // } // // public void setBannerID(int bannerID) // { // this.bannerID = bannerID; // } // // public void setBannerName(String bannerName) // { // this.bannerName = bannerName; // } // // public void setBannerType(int bannerType) // { // this.bannerType = bannerType; // } // // public void setBannerWepType(int bannerWepType) // { // this.bannerWepType = bannerWepType; // } // // public void setCharacters(ArrayList<Character> characters) // { // this.characters = characters; // } // // public void setWeapons(ArrayList<Weapon> weapons) // { // this.weapons = weapons; // } // // public String bannerTypeToString() // { // switch(bannerType) // { // case 0: // return "Normal"; // case 1: // return "Step Up"; // case 2: // return "Record Crystal"; // case 3: // return "Step Up v2"; // case 4: // return "Birthday Step Up"; // case 5: // return "Record Crystal v2"; // case 6: // return "Memorial Scout"; // case 7: // return "Step Up v3"; // case 8: // return "Record Crystal v3"; // case 9: // return "Event"; // case 10: // return "SAO Game 5th Anniversary Step Up"; // case 11: // return "Record Crystal v4"; // case 12: // return "Step Up v4"; // case 13: // return "Step Up v5"; // case 14: // return "SAO Game 5th Anniversary Step Up v2"; // case 15: // return "Step Up v6"; // case 16: // return "SAO Game 5th Anniversary Step Up v3"; // case 17: // return "Step Up v7"; // case 18: // return "Record Crystal v5"; // case 19: // return "Step Up v8"; // case 20: // return "Record Crystal v6"; // case 21: // return "Step Up v9"; // default: // return "Unknown"; // } // } // // @Override // public String toString() // { // return bannerID + ") " + bannerName; // } // } // // Path: src/main/java/io/github/spugn/Sargo/Objects/Character.java // public class Character // { // private String prefix; // private String name; // private int rarity; // private String imagePath; // // public Character() // { // prefix = ""; // name = "null"; // rarity = 1; // imagePath = ""; // } // // public void setPrefix(String prefix) // { // this.prefix = prefix; // } // // public void setName(String name) // { // this.name = name; // } // // public void setRarity(int rarity) // { // this.rarity = rarity; // } // // public void setImagePath(String imagePath) // { // this.imagePath = imagePath; // } // // public String getPrefix() // { // return prefix; // } // // public String getName() // { // return name; // } // // public int getRarity() // { // return rarity; // } // // public String getImagePath() // { // return imagePath; // } // // @Override // public String toString() // { // if (prefix.isEmpty()) // { // return rarity + "★ " + name; // } // return rarity + "★ [" + prefix + "] " + name; // } // // public String toStringNoName() // { // if (prefix.isEmpty()) // { // return rarity + "★ " + name; // } // return rarity + "★ [" + prefix + "]"; // } // }
import discord4j.core.object.entity.Message; import io.github.spugn.Sargo.Objects.Banner; import io.github.spugn.Sargo.Objects.Character; import java.util.List;
PLATINUM = PLATINUM / 1.5; if (CHOICE.equalsIgnoreCase("m") || CHOICE.equalsIgnoreCase("mi")) { switch (bannerTypeData) { case -1: multiScoutPrice = 125; bannerTypeData = 0; USER.changeValue(SELECTED_BANNER.getBannerName(), bannerTypeData); break; default: break; } } } @Override protected void updateBannerData() { rcGet = getRecordCrystals(); bannerTypeData += rcGet; USER.changeValue(SELECTED_BANNER.getBannerName(), bannerTypeData); } @Override protected Character randGoldCharacter() { int randIndex = GOLD_BANNERS_V2.get(RNG.nextInt(GOLD_BANNERS_V2.size()));
// Path: src/main/java/io/github/spugn/Sargo/Objects/Banner.java // public class Banner // { // private int bannerID; // private String bannerName; // private int bannerType; // private int bannerWepType; // private ArrayList<Character> characters; // private ArrayList<Weapon> weapons; // // public int getBannerID() // { // return bannerID; // } // // public String getBannerName() // { // return bannerName; // } // // public int getBannerType() // { // return bannerType; // } // // public int getBannerWepType() // { // return bannerWepType; // } // // public ArrayList<Character> getCharacters() // { // return characters; // } // // public ArrayList<Weapon> getWeapons() // { // return weapons; // } // // public void setBannerID(int bannerID) // { // this.bannerID = bannerID; // } // // public void setBannerName(String bannerName) // { // this.bannerName = bannerName; // } // // public void setBannerType(int bannerType) // { // this.bannerType = bannerType; // } // // public void setBannerWepType(int bannerWepType) // { // this.bannerWepType = bannerWepType; // } // // public void setCharacters(ArrayList<Character> characters) // { // this.characters = characters; // } // // public void setWeapons(ArrayList<Weapon> weapons) // { // this.weapons = weapons; // } // // public String bannerTypeToString() // { // switch(bannerType) // { // case 0: // return "Normal"; // case 1: // return "Step Up"; // case 2: // return "Record Crystal"; // case 3: // return "Step Up v2"; // case 4: // return "Birthday Step Up"; // case 5: // return "Record Crystal v2"; // case 6: // return "Memorial Scout"; // case 7: // return "Step Up v3"; // case 8: // return "Record Crystal v3"; // case 9: // return "Event"; // case 10: // return "SAO Game 5th Anniversary Step Up"; // case 11: // return "Record Crystal v4"; // case 12: // return "Step Up v4"; // case 13: // return "Step Up v5"; // case 14: // return "SAO Game 5th Anniversary Step Up v2"; // case 15: // return "Step Up v6"; // case 16: // return "SAO Game 5th Anniversary Step Up v3"; // case 17: // return "Step Up v7"; // case 18: // return "Record Crystal v5"; // case 19: // return "Step Up v8"; // case 20: // return "Record Crystal v6"; // case 21: // return "Step Up v9"; // default: // return "Unknown"; // } // } // // @Override // public String toString() // { // return bannerID + ") " + bannerName; // } // } // // Path: src/main/java/io/github/spugn/Sargo/Objects/Character.java // public class Character // { // private String prefix; // private String name; // private int rarity; // private String imagePath; // // public Character() // { // prefix = ""; // name = "null"; // rarity = 1; // imagePath = ""; // } // // public void setPrefix(String prefix) // { // this.prefix = prefix; // } // // public void setName(String name) // { // this.name = name; // } // // public void setRarity(int rarity) // { // this.rarity = rarity; // } // // public void setImagePath(String imagePath) // { // this.imagePath = imagePath; // } // // public String getPrefix() // { // return prefix; // } // // public String getName() // { // return name; // } // // public int getRarity() // { // return rarity; // } // // public String getImagePath() // { // return imagePath; // } // // @Override // public String toString() // { // if (prefix.isEmpty()) // { // return rarity + "★ " + name; // } // return rarity + "★ [" + prefix + "] " + name; // } // // public String toStringNoName() // { // if (prefix.isEmpty()) // { // return rarity + "★ " + name; // } // return rarity + "★ [" + prefix + "]"; // } // } // Path: src/main/java/io/github/spugn/Sargo/CharacterScout/RecordCrystalv3.java import discord4j.core.object.entity.Message; import io.github.spugn.Sargo.Objects.Banner; import io.github.spugn.Sargo.Objects.Character; import java.util.List; PLATINUM = PLATINUM / 1.5; if (CHOICE.equalsIgnoreCase("m") || CHOICE.equalsIgnoreCase("mi")) { switch (bannerTypeData) { case -1: multiScoutPrice = 125; bannerTypeData = 0; USER.changeValue(SELECTED_BANNER.getBannerName(), bannerTypeData); break; default: break; } } } @Override protected void updateBannerData() { rcGet = getRecordCrystals(); bannerTypeData += rcGet; USER.changeValue(SELECTED_BANNER.getBannerName(), bannerTypeData); } @Override protected Character randGoldCharacter() { int randIndex = GOLD_BANNERS_V2.get(RNG.nextInt(GOLD_BANNERS_V2.size()));
Banner randBanner = BANNERS.get(randIndex - 1);
Expugn/S-argo
src/main/java/io/github/spugn/Sargo/CharacterScout/RecordCrystalv2.java
// Path: src/main/java/io/github/spugn/Sargo/Objects/Banner.java // public class Banner // { // private int bannerID; // private String bannerName; // private int bannerType; // private int bannerWepType; // private ArrayList<Character> characters; // private ArrayList<Weapon> weapons; // // public int getBannerID() // { // return bannerID; // } // // public String getBannerName() // { // return bannerName; // } // // public int getBannerType() // { // return bannerType; // } // // public int getBannerWepType() // { // return bannerWepType; // } // // public ArrayList<Character> getCharacters() // { // return characters; // } // // public ArrayList<Weapon> getWeapons() // { // return weapons; // } // // public void setBannerID(int bannerID) // { // this.bannerID = bannerID; // } // // public void setBannerName(String bannerName) // { // this.bannerName = bannerName; // } // // public void setBannerType(int bannerType) // { // this.bannerType = bannerType; // } // // public void setBannerWepType(int bannerWepType) // { // this.bannerWepType = bannerWepType; // } // // public void setCharacters(ArrayList<Character> characters) // { // this.characters = characters; // } // // public void setWeapons(ArrayList<Weapon> weapons) // { // this.weapons = weapons; // } // // public String bannerTypeToString() // { // switch(bannerType) // { // case 0: // return "Normal"; // case 1: // return "Step Up"; // case 2: // return "Record Crystal"; // case 3: // return "Step Up v2"; // case 4: // return "Birthday Step Up"; // case 5: // return "Record Crystal v2"; // case 6: // return "Memorial Scout"; // case 7: // return "Step Up v3"; // case 8: // return "Record Crystal v3"; // case 9: // return "Event"; // case 10: // return "SAO Game 5th Anniversary Step Up"; // case 11: // return "Record Crystal v4"; // case 12: // return "Step Up v4"; // case 13: // return "Step Up v5"; // case 14: // return "SAO Game 5th Anniversary Step Up v2"; // case 15: // return "Step Up v6"; // case 16: // return "SAO Game 5th Anniversary Step Up v3"; // case 17: // return "Step Up v7"; // case 18: // return "Record Crystal v5"; // case 19: // return "Step Up v8"; // case 20: // return "Record Crystal v6"; // case 21: // return "Step Up v9"; // default: // return "Unknown"; // } // } // // @Override // public String toString() // { // return bannerID + ") " + bannerName; // } // } // // Path: src/main/java/io/github/spugn/Sargo/Objects/Character.java // public class Character // { // private String prefix; // private String name; // private int rarity; // private String imagePath; // // public Character() // { // prefix = ""; // name = "null"; // rarity = 1; // imagePath = ""; // } // // public void setPrefix(String prefix) // { // this.prefix = prefix; // } // // public void setName(String name) // { // this.name = name; // } // // public void setRarity(int rarity) // { // this.rarity = rarity; // } // // public void setImagePath(String imagePath) // { // this.imagePath = imagePath; // } // // public String getPrefix() // { // return prefix; // } // // public String getName() // { // return name; // } // // public int getRarity() // { // return rarity; // } // // public String getImagePath() // { // return imagePath; // } // // @Override // public String toString() // { // if (prefix.isEmpty()) // { // return rarity + "★ " + name; // } // return rarity + "★ [" + prefix + "] " + name; // } // // public String toStringNoName() // { // if (prefix.isEmpty()) // { // return rarity + "★ " + name; // } // return rarity + "★ [" + prefix + "]"; // } // }
import discord4j.core.object.entity.Message; import io.github.spugn.Sargo.Objects.Banner; import io.github.spugn.Sargo.Objects.Character; import java.util.List;
{ // REMOVE 1.5% FROM PLATINUM (IT'S ORIGINAL VALUE) COPPER = COPPER + (PLATINUM - (PLATINUM / 1.5)); PLATINUM = PLATINUM / 1.5; if (CHOICE.equalsIgnoreCase("m") || CHOICE.equalsIgnoreCase("mi")) { switch (bannerTypeData) { case -1: multiScoutPrice = 125; bannerTypeData = 0; USER.changeValue(SELECTED_BANNER.getBannerName(), bannerTypeData); break; default: break; } } } @Override protected void updateBannerData() { rcGet = getRecordCrystals(); bannerTypeData += rcGet; USER.changeValue(SELECTED_BANNER.getBannerName(), bannerTypeData); } @Override
// Path: src/main/java/io/github/spugn/Sargo/Objects/Banner.java // public class Banner // { // private int bannerID; // private String bannerName; // private int bannerType; // private int bannerWepType; // private ArrayList<Character> characters; // private ArrayList<Weapon> weapons; // // public int getBannerID() // { // return bannerID; // } // // public String getBannerName() // { // return bannerName; // } // // public int getBannerType() // { // return bannerType; // } // // public int getBannerWepType() // { // return bannerWepType; // } // // public ArrayList<Character> getCharacters() // { // return characters; // } // // public ArrayList<Weapon> getWeapons() // { // return weapons; // } // // public void setBannerID(int bannerID) // { // this.bannerID = bannerID; // } // // public void setBannerName(String bannerName) // { // this.bannerName = bannerName; // } // // public void setBannerType(int bannerType) // { // this.bannerType = bannerType; // } // // public void setBannerWepType(int bannerWepType) // { // this.bannerWepType = bannerWepType; // } // // public void setCharacters(ArrayList<Character> characters) // { // this.characters = characters; // } // // public void setWeapons(ArrayList<Weapon> weapons) // { // this.weapons = weapons; // } // // public String bannerTypeToString() // { // switch(bannerType) // { // case 0: // return "Normal"; // case 1: // return "Step Up"; // case 2: // return "Record Crystal"; // case 3: // return "Step Up v2"; // case 4: // return "Birthday Step Up"; // case 5: // return "Record Crystal v2"; // case 6: // return "Memorial Scout"; // case 7: // return "Step Up v3"; // case 8: // return "Record Crystal v3"; // case 9: // return "Event"; // case 10: // return "SAO Game 5th Anniversary Step Up"; // case 11: // return "Record Crystal v4"; // case 12: // return "Step Up v4"; // case 13: // return "Step Up v5"; // case 14: // return "SAO Game 5th Anniversary Step Up v2"; // case 15: // return "Step Up v6"; // case 16: // return "SAO Game 5th Anniversary Step Up v3"; // case 17: // return "Step Up v7"; // case 18: // return "Record Crystal v5"; // case 19: // return "Step Up v8"; // case 20: // return "Record Crystal v6"; // case 21: // return "Step Up v9"; // default: // return "Unknown"; // } // } // // @Override // public String toString() // { // return bannerID + ") " + bannerName; // } // } // // Path: src/main/java/io/github/spugn/Sargo/Objects/Character.java // public class Character // { // private String prefix; // private String name; // private int rarity; // private String imagePath; // // public Character() // { // prefix = ""; // name = "null"; // rarity = 1; // imagePath = ""; // } // // public void setPrefix(String prefix) // { // this.prefix = prefix; // } // // public void setName(String name) // { // this.name = name; // } // // public void setRarity(int rarity) // { // this.rarity = rarity; // } // // public void setImagePath(String imagePath) // { // this.imagePath = imagePath; // } // // public String getPrefix() // { // return prefix; // } // // public String getName() // { // return name; // } // // public int getRarity() // { // return rarity; // } // // public String getImagePath() // { // return imagePath; // } // // @Override // public String toString() // { // if (prefix.isEmpty()) // { // return rarity + "★ " + name; // } // return rarity + "★ [" + prefix + "] " + name; // } // // public String toStringNoName() // { // if (prefix.isEmpty()) // { // return rarity + "★ " + name; // } // return rarity + "★ [" + prefix + "]"; // } // } // Path: src/main/java/io/github/spugn/Sargo/CharacterScout/RecordCrystalv2.java import discord4j.core.object.entity.Message; import io.github.spugn.Sargo.Objects.Banner; import io.github.spugn.Sargo.Objects.Character; import java.util.List; { // REMOVE 1.5% FROM PLATINUM (IT'S ORIGINAL VALUE) COPPER = COPPER + (PLATINUM - (PLATINUM / 1.5)); PLATINUM = PLATINUM / 1.5; if (CHOICE.equalsIgnoreCase("m") || CHOICE.equalsIgnoreCase("mi")) { switch (bannerTypeData) { case -1: multiScoutPrice = 125; bannerTypeData = 0; USER.changeValue(SELECTED_BANNER.getBannerName(), bannerTypeData); break; default: break; } } } @Override protected void updateBannerData() { rcGet = getRecordCrystals(); bannerTypeData += rcGet; USER.changeValue(SELECTED_BANNER.getBannerName(), bannerTypeData); } @Override
protected Character randGoldCharacter()
Expugn/S-argo
src/main/java/io/github/spugn/Sargo/CharacterScout/RecordCrystalv2.java
// Path: src/main/java/io/github/spugn/Sargo/Objects/Banner.java // public class Banner // { // private int bannerID; // private String bannerName; // private int bannerType; // private int bannerWepType; // private ArrayList<Character> characters; // private ArrayList<Weapon> weapons; // // public int getBannerID() // { // return bannerID; // } // // public String getBannerName() // { // return bannerName; // } // // public int getBannerType() // { // return bannerType; // } // // public int getBannerWepType() // { // return bannerWepType; // } // // public ArrayList<Character> getCharacters() // { // return characters; // } // // public ArrayList<Weapon> getWeapons() // { // return weapons; // } // // public void setBannerID(int bannerID) // { // this.bannerID = bannerID; // } // // public void setBannerName(String bannerName) // { // this.bannerName = bannerName; // } // // public void setBannerType(int bannerType) // { // this.bannerType = bannerType; // } // // public void setBannerWepType(int bannerWepType) // { // this.bannerWepType = bannerWepType; // } // // public void setCharacters(ArrayList<Character> characters) // { // this.characters = characters; // } // // public void setWeapons(ArrayList<Weapon> weapons) // { // this.weapons = weapons; // } // // public String bannerTypeToString() // { // switch(bannerType) // { // case 0: // return "Normal"; // case 1: // return "Step Up"; // case 2: // return "Record Crystal"; // case 3: // return "Step Up v2"; // case 4: // return "Birthday Step Up"; // case 5: // return "Record Crystal v2"; // case 6: // return "Memorial Scout"; // case 7: // return "Step Up v3"; // case 8: // return "Record Crystal v3"; // case 9: // return "Event"; // case 10: // return "SAO Game 5th Anniversary Step Up"; // case 11: // return "Record Crystal v4"; // case 12: // return "Step Up v4"; // case 13: // return "Step Up v5"; // case 14: // return "SAO Game 5th Anniversary Step Up v2"; // case 15: // return "Step Up v6"; // case 16: // return "SAO Game 5th Anniversary Step Up v3"; // case 17: // return "Step Up v7"; // case 18: // return "Record Crystal v5"; // case 19: // return "Step Up v8"; // case 20: // return "Record Crystal v6"; // case 21: // return "Step Up v9"; // default: // return "Unknown"; // } // } // // @Override // public String toString() // { // return bannerID + ") " + bannerName; // } // } // // Path: src/main/java/io/github/spugn/Sargo/Objects/Character.java // public class Character // { // private String prefix; // private String name; // private int rarity; // private String imagePath; // // public Character() // { // prefix = ""; // name = "null"; // rarity = 1; // imagePath = ""; // } // // public void setPrefix(String prefix) // { // this.prefix = prefix; // } // // public void setName(String name) // { // this.name = name; // } // // public void setRarity(int rarity) // { // this.rarity = rarity; // } // // public void setImagePath(String imagePath) // { // this.imagePath = imagePath; // } // // public String getPrefix() // { // return prefix; // } // // public String getName() // { // return name; // } // // public int getRarity() // { // return rarity; // } // // public String getImagePath() // { // return imagePath; // } // // @Override // public String toString() // { // if (prefix.isEmpty()) // { // return rarity + "★ " + name; // } // return rarity + "★ [" + prefix + "] " + name; // } // // public String toStringNoName() // { // if (prefix.isEmpty()) // { // return rarity + "★ " + name; // } // return rarity + "★ [" + prefix + "]"; // } // }
import discord4j.core.object.entity.Message; import io.github.spugn.Sargo.Objects.Banner; import io.github.spugn.Sargo.Objects.Character; import java.util.List;
PLATINUM = PLATINUM / 1.5; if (CHOICE.equalsIgnoreCase("m") || CHOICE.equalsIgnoreCase("mi")) { switch (bannerTypeData) { case -1: multiScoutPrice = 125; bannerTypeData = 0; USER.changeValue(SELECTED_BANNER.getBannerName(), bannerTypeData); break; default: break; } } } @Override protected void updateBannerData() { rcGet = getRecordCrystals(); bannerTypeData += rcGet; USER.changeValue(SELECTED_BANNER.getBannerName(), bannerTypeData); } @Override protected Character randGoldCharacter() { int randIndex = GOLD_BANNERS_V2.get(RNG.nextInt(GOLD_BANNERS_V2.size()));
// Path: src/main/java/io/github/spugn/Sargo/Objects/Banner.java // public class Banner // { // private int bannerID; // private String bannerName; // private int bannerType; // private int bannerWepType; // private ArrayList<Character> characters; // private ArrayList<Weapon> weapons; // // public int getBannerID() // { // return bannerID; // } // // public String getBannerName() // { // return bannerName; // } // // public int getBannerType() // { // return bannerType; // } // // public int getBannerWepType() // { // return bannerWepType; // } // // public ArrayList<Character> getCharacters() // { // return characters; // } // // public ArrayList<Weapon> getWeapons() // { // return weapons; // } // // public void setBannerID(int bannerID) // { // this.bannerID = bannerID; // } // // public void setBannerName(String bannerName) // { // this.bannerName = bannerName; // } // // public void setBannerType(int bannerType) // { // this.bannerType = bannerType; // } // // public void setBannerWepType(int bannerWepType) // { // this.bannerWepType = bannerWepType; // } // // public void setCharacters(ArrayList<Character> characters) // { // this.characters = characters; // } // // public void setWeapons(ArrayList<Weapon> weapons) // { // this.weapons = weapons; // } // // public String bannerTypeToString() // { // switch(bannerType) // { // case 0: // return "Normal"; // case 1: // return "Step Up"; // case 2: // return "Record Crystal"; // case 3: // return "Step Up v2"; // case 4: // return "Birthday Step Up"; // case 5: // return "Record Crystal v2"; // case 6: // return "Memorial Scout"; // case 7: // return "Step Up v3"; // case 8: // return "Record Crystal v3"; // case 9: // return "Event"; // case 10: // return "SAO Game 5th Anniversary Step Up"; // case 11: // return "Record Crystal v4"; // case 12: // return "Step Up v4"; // case 13: // return "Step Up v5"; // case 14: // return "SAO Game 5th Anniversary Step Up v2"; // case 15: // return "Step Up v6"; // case 16: // return "SAO Game 5th Anniversary Step Up v3"; // case 17: // return "Step Up v7"; // case 18: // return "Record Crystal v5"; // case 19: // return "Step Up v8"; // case 20: // return "Record Crystal v6"; // case 21: // return "Step Up v9"; // default: // return "Unknown"; // } // } // // @Override // public String toString() // { // return bannerID + ") " + bannerName; // } // } // // Path: src/main/java/io/github/spugn/Sargo/Objects/Character.java // public class Character // { // private String prefix; // private String name; // private int rarity; // private String imagePath; // // public Character() // { // prefix = ""; // name = "null"; // rarity = 1; // imagePath = ""; // } // // public void setPrefix(String prefix) // { // this.prefix = prefix; // } // // public void setName(String name) // { // this.name = name; // } // // public void setRarity(int rarity) // { // this.rarity = rarity; // } // // public void setImagePath(String imagePath) // { // this.imagePath = imagePath; // } // // public String getPrefix() // { // return prefix; // } // // public String getName() // { // return name; // } // // public int getRarity() // { // return rarity; // } // // public String getImagePath() // { // return imagePath; // } // // @Override // public String toString() // { // if (prefix.isEmpty()) // { // return rarity + "★ " + name; // } // return rarity + "★ [" + prefix + "] " + name; // } // // public String toStringNoName() // { // if (prefix.isEmpty()) // { // return rarity + "★ " + name; // } // return rarity + "★ [" + prefix + "]"; // } // } // Path: src/main/java/io/github/spugn/Sargo/CharacterScout/RecordCrystalv2.java import discord4j.core.object.entity.Message; import io.github.spugn.Sargo.Objects.Banner; import io.github.spugn.Sargo.Objects.Character; import java.util.List; PLATINUM = PLATINUM / 1.5; if (CHOICE.equalsIgnoreCase("m") || CHOICE.equalsIgnoreCase("mi")) { switch (bannerTypeData) { case -1: multiScoutPrice = 125; bannerTypeData = 0; USER.changeValue(SELECTED_BANNER.getBannerName(), bannerTypeData); break; default: break; } } } @Override protected void updateBannerData() { rcGet = getRecordCrystals(); bannerTypeData += rcGet; USER.changeValue(SELECTED_BANNER.getBannerName(), bannerTypeData); } @Override protected Character randGoldCharacter() { int randIndex = GOLD_BANNERS_V2.get(RNG.nextInt(GOLD_BANNERS_V2.size()));
Banner randBanner = BANNERS.get(randIndex - 1);
Expugn/S-argo
src/main/java/io/github/spugn/Sargo/CharacterScout/StepUpv3.java
// Path: src/main/java/io/github/spugn/Sargo/Objects/Banner.java // public class Banner // { // private int bannerID; // private String bannerName; // private int bannerType; // private int bannerWepType; // private ArrayList<Character> characters; // private ArrayList<Weapon> weapons; // // public int getBannerID() // { // return bannerID; // } // // public String getBannerName() // { // return bannerName; // } // // public int getBannerType() // { // return bannerType; // } // // public int getBannerWepType() // { // return bannerWepType; // } // // public ArrayList<Character> getCharacters() // { // return characters; // } // // public ArrayList<Weapon> getWeapons() // { // return weapons; // } // // public void setBannerID(int bannerID) // { // this.bannerID = bannerID; // } // // public void setBannerName(String bannerName) // { // this.bannerName = bannerName; // } // // public void setBannerType(int bannerType) // { // this.bannerType = bannerType; // } // // public void setBannerWepType(int bannerWepType) // { // this.bannerWepType = bannerWepType; // } // // public void setCharacters(ArrayList<Character> characters) // { // this.characters = characters; // } // // public void setWeapons(ArrayList<Weapon> weapons) // { // this.weapons = weapons; // } // // public String bannerTypeToString() // { // switch(bannerType) // { // case 0: // return "Normal"; // case 1: // return "Step Up"; // case 2: // return "Record Crystal"; // case 3: // return "Step Up v2"; // case 4: // return "Birthday Step Up"; // case 5: // return "Record Crystal v2"; // case 6: // return "Memorial Scout"; // case 7: // return "Step Up v3"; // case 8: // return "Record Crystal v3"; // case 9: // return "Event"; // case 10: // return "SAO Game 5th Anniversary Step Up"; // case 11: // return "Record Crystal v4"; // case 12: // return "Step Up v4"; // case 13: // return "Step Up v5"; // case 14: // return "SAO Game 5th Anniversary Step Up v2"; // case 15: // return "Step Up v6"; // case 16: // return "SAO Game 5th Anniversary Step Up v3"; // case 17: // return "Step Up v7"; // case 18: // return "Record Crystal v5"; // case 19: // return "Step Up v8"; // case 20: // return "Record Crystal v6"; // case 21: // return "Step Up v9"; // default: // return "Unknown"; // } // } // // @Override // public String toString() // { // return bannerID + ") " + bannerName; // } // } // // Path: src/main/java/io/github/spugn/Sargo/Objects/Character.java // public class Character // { // private String prefix; // private String name; // private int rarity; // private String imagePath; // // public Character() // { // prefix = ""; // name = "null"; // rarity = 1; // imagePath = ""; // } // // public void setPrefix(String prefix) // { // this.prefix = prefix; // } // // public void setName(String name) // { // this.name = name; // } // // public void setRarity(int rarity) // { // this.rarity = rarity; // } // // public void setImagePath(String imagePath) // { // this.imagePath = imagePath; // } // // public String getPrefix() // { // return prefix; // } // // public String getName() // { // return name; // } // // public int getRarity() // { // return rarity; // } // // public String getImagePath() // { // return imagePath; // } // // @Override // public String toString() // { // if (prefix.isEmpty()) // { // return rarity + "★ " + name; // } // return rarity + "★ [" + prefix + "] " + name; // } // // public String toStringNoName() // { // if (prefix.isEmpty()) // { // return rarity + "★ " + name; // } // return rarity + "★ [" + prefix + "]"; // } // }
import discord4j.core.object.entity.Message; import io.github.spugn.Sargo.Objects.Banner; import io.github.spugn.Sargo.Objects.Character; import java.util.List;
switch (bannerTypeData) { case 1: multiScoutPrice = 125; break; case 3: COPPER = COPPER - ((PLATINUM * 2.0) - PLATINUM); PLATINUM = PLATINUM * 2.0; default: break; } } } @Override protected void updateBannerData() { int currentStep = USER.getBannerData(SELECTED_BANNER.getBannerName()); currentStep++; if (currentStep > 3) { USER.changeValue(SELECTED_BANNER.getBannerName(), 1); } else { USER.changeValue(SELECTED_BANNER.getBannerName(), currentStep); } } @Override
// Path: src/main/java/io/github/spugn/Sargo/Objects/Banner.java // public class Banner // { // private int bannerID; // private String bannerName; // private int bannerType; // private int bannerWepType; // private ArrayList<Character> characters; // private ArrayList<Weapon> weapons; // // public int getBannerID() // { // return bannerID; // } // // public String getBannerName() // { // return bannerName; // } // // public int getBannerType() // { // return bannerType; // } // // public int getBannerWepType() // { // return bannerWepType; // } // // public ArrayList<Character> getCharacters() // { // return characters; // } // // public ArrayList<Weapon> getWeapons() // { // return weapons; // } // // public void setBannerID(int bannerID) // { // this.bannerID = bannerID; // } // // public void setBannerName(String bannerName) // { // this.bannerName = bannerName; // } // // public void setBannerType(int bannerType) // { // this.bannerType = bannerType; // } // // public void setBannerWepType(int bannerWepType) // { // this.bannerWepType = bannerWepType; // } // // public void setCharacters(ArrayList<Character> characters) // { // this.characters = characters; // } // // public void setWeapons(ArrayList<Weapon> weapons) // { // this.weapons = weapons; // } // // public String bannerTypeToString() // { // switch(bannerType) // { // case 0: // return "Normal"; // case 1: // return "Step Up"; // case 2: // return "Record Crystal"; // case 3: // return "Step Up v2"; // case 4: // return "Birthday Step Up"; // case 5: // return "Record Crystal v2"; // case 6: // return "Memorial Scout"; // case 7: // return "Step Up v3"; // case 8: // return "Record Crystal v3"; // case 9: // return "Event"; // case 10: // return "SAO Game 5th Anniversary Step Up"; // case 11: // return "Record Crystal v4"; // case 12: // return "Step Up v4"; // case 13: // return "Step Up v5"; // case 14: // return "SAO Game 5th Anniversary Step Up v2"; // case 15: // return "Step Up v6"; // case 16: // return "SAO Game 5th Anniversary Step Up v3"; // case 17: // return "Step Up v7"; // case 18: // return "Record Crystal v5"; // case 19: // return "Step Up v8"; // case 20: // return "Record Crystal v6"; // case 21: // return "Step Up v9"; // default: // return "Unknown"; // } // } // // @Override // public String toString() // { // return bannerID + ") " + bannerName; // } // } // // Path: src/main/java/io/github/spugn/Sargo/Objects/Character.java // public class Character // { // private String prefix; // private String name; // private int rarity; // private String imagePath; // // public Character() // { // prefix = ""; // name = "null"; // rarity = 1; // imagePath = ""; // } // // public void setPrefix(String prefix) // { // this.prefix = prefix; // } // // public void setName(String name) // { // this.name = name; // } // // public void setRarity(int rarity) // { // this.rarity = rarity; // } // // public void setImagePath(String imagePath) // { // this.imagePath = imagePath; // } // // public String getPrefix() // { // return prefix; // } // // public String getName() // { // return name; // } // // public int getRarity() // { // return rarity; // } // // public String getImagePath() // { // return imagePath; // } // // @Override // public String toString() // { // if (prefix.isEmpty()) // { // return rarity + "★ " + name; // } // return rarity + "★ [" + prefix + "] " + name; // } // // public String toStringNoName() // { // if (prefix.isEmpty()) // { // return rarity + "★ " + name; // } // return rarity + "★ [" + prefix + "]"; // } // } // Path: src/main/java/io/github/spugn/Sargo/CharacterScout/StepUpv3.java import discord4j.core.object.entity.Message; import io.github.spugn.Sargo.Objects.Banner; import io.github.spugn.Sargo.Objects.Character; import java.util.List; switch (bannerTypeData) { case 1: multiScoutPrice = 125; break; case 3: COPPER = COPPER - ((PLATINUM * 2.0) - PLATINUM); PLATINUM = PLATINUM * 2.0; default: break; } } } @Override protected void updateBannerData() { int currentStep = USER.getBannerData(SELECTED_BANNER.getBannerName()); currentStep++; if (currentStep > 3) { USER.changeValue(SELECTED_BANNER.getBannerName(), 1); } else { USER.changeValue(SELECTED_BANNER.getBannerName(), currentStep); } } @Override
protected Character randGoldCharacter()
Expugn/S-argo
src/main/java/io/github/spugn/Sargo/CharacterScout/StepUpv3.java
// Path: src/main/java/io/github/spugn/Sargo/Objects/Banner.java // public class Banner // { // private int bannerID; // private String bannerName; // private int bannerType; // private int bannerWepType; // private ArrayList<Character> characters; // private ArrayList<Weapon> weapons; // // public int getBannerID() // { // return bannerID; // } // // public String getBannerName() // { // return bannerName; // } // // public int getBannerType() // { // return bannerType; // } // // public int getBannerWepType() // { // return bannerWepType; // } // // public ArrayList<Character> getCharacters() // { // return characters; // } // // public ArrayList<Weapon> getWeapons() // { // return weapons; // } // // public void setBannerID(int bannerID) // { // this.bannerID = bannerID; // } // // public void setBannerName(String bannerName) // { // this.bannerName = bannerName; // } // // public void setBannerType(int bannerType) // { // this.bannerType = bannerType; // } // // public void setBannerWepType(int bannerWepType) // { // this.bannerWepType = bannerWepType; // } // // public void setCharacters(ArrayList<Character> characters) // { // this.characters = characters; // } // // public void setWeapons(ArrayList<Weapon> weapons) // { // this.weapons = weapons; // } // // public String bannerTypeToString() // { // switch(bannerType) // { // case 0: // return "Normal"; // case 1: // return "Step Up"; // case 2: // return "Record Crystal"; // case 3: // return "Step Up v2"; // case 4: // return "Birthday Step Up"; // case 5: // return "Record Crystal v2"; // case 6: // return "Memorial Scout"; // case 7: // return "Step Up v3"; // case 8: // return "Record Crystal v3"; // case 9: // return "Event"; // case 10: // return "SAO Game 5th Anniversary Step Up"; // case 11: // return "Record Crystal v4"; // case 12: // return "Step Up v4"; // case 13: // return "Step Up v5"; // case 14: // return "SAO Game 5th Anniversary Step Up v2"; // case 15: // return "Step Up v6"; // case 16: // return "SAO Game 5th Anniversary Step Up v3"; // case 17: // return "Step Up v7"; // case 18: // return "Record Crystal v5"; // case 19: // return "Step Up v8"; // case 20: // return "Record Crystal v6"; // case 21: // return "Step Up v9"; // default: // return "Unknown"; // } // } // // @Override // public String toString() // { // return bannerID + ") " + bannerName; // } // } // // Path: src/main/java/io/github/spugn/Sargo/Objects/Character.java // public class Character // { // private String prefix; // private String name; // private int rarity; // private String imagePath; // // public Character() // { // prefix = ""; // name = "null"; // rarity = 1; // imagePath = ""; // } // // public void setPrefix(String prefix) // { // this.prefix = prefix; // } // // public void setName(String name) // { // this.name = name; // } // // public void setRarity(int rarity) // { // this.rarity = rarity; // } // // public void setImagePath(String imagePath) // { // this.imagePath = imagePath; // } // // public String getPrefix() // { // return prefix; // } // // public String getName() // { // return name; // } // // public int getRarity() // { // return rarity; // } // // public String getImagePath() // { // return imagePath; // } // // @Override // public String toString() // { // if (prefix.isEmpty()) // { // return rarity + "★ " + name; // } // return rarity + "★ [" + prefix + "] " + name; // } // // public String toStringNoName() // { // if (prefix.isEmpty()) // { // return rarity + "★ " + name; // } // return rarity + "★ [" + prefix + "]"; // } // }
import discord4j.core.object.entity.Message; import io.github.spugn.Sargo.Objects.Banner; import io.github.spugn.Sargo.Objects.Character; import java.util.List;
PLATINUM = PLATINUM * 2.0; default: break; } } } @Override protected void updateBannerData() { int currentStep = USER.getBannerData(SELECTED_BANNER.getBannerName()); currentStep++; if (currentStep > 3) { USER.changeValue(SELECTED_BANNER.getBannerName(), 1); } else { USER.changeValue(SELECTED_BANNER.getBannerName(), currentStep); } } @Override protected Character randGoldCharacter() { /* GET A RANDOM GOLD VARIANT CHARACTER, IF THERE IS A PLATINUM VARIANT OF THAT CHARACTER IN THE BANNER THEN GET A NEW CHARACTER. */ Character c = null; boolean charInBanner = true; int randIndex;
// Path: src/main/java/io/github/spugn/Sargo/Objects/Banner.java // public class Banner // { // private int bannerID; // private String bannerName; // private int bannerType; // private int bannerWepType; // private ArrayList<Character> characters; // private ArrayList<Weapon> weapons; // // public int getBannerID() // { // return bannerID; // } // // public String getBannerName() // { // return bannerName; // } // // public int getBannerType() // { // return bannerType; // } // // public int getBannerWepType() // { // return bannerWepType; // } // // public ArrayList<Character> getCharacters() // { // return characters; // } // // public ArrayList<Weapon> getWeapons() // { // return weapons; // } // // public void setBannerID(int bannerID) // { // this.bannerID = bannerID; // } // // public void setBannerName(String bannerName) // { // this.bannerName = bannerName; // } // // public void setBannerType(int bannerType) // { // this.bannerType = bannerType; // } // // public void setBannerWepType(int bannerWepType) // { // this.bannerWepType = bannerWepType; // } // // public void setCharacters(ArrayList<Character> characters) // { // this.characters = characters; // } // // public void setWeapons(ArrayList<Weapon> weapons) // { // this.weapons = weapons; // } // // public String bannerTypeToString() // { // switch(bannerType) // { // case 0: // return "Normal"; // case 1: // return "Step Up"; // case 2: // return "Record Crystal"; // case 3: // return "Step Up v2"; // case 4: // return "Birthday Step Up"; // case 5: // return "Record Crystal v2"; // case 6: // return "Memorial Scout"; // case 7: // return "Step Up v3"; // case 8: // return "Record Crystal v3"; // case 9: // return "Event"; // case 10: // return "SAO Game 5th Anniversary Step Up"; // case 11: // return "Record Crystal v4"; // case 12: // return "Step Up v4"; // case 13: // return "Step Up v5"; // case 14: // return "SAO Game 5th Anniversary Step Up v2"; // case 15: // return "Step Up v6"; // case 16: // return "SAO Game 5th Anniversary Step Up v3"; // case 17: // return "Step Up v7"; // case 18: // return "Record Crystal v5"; // case 19: // return "Step Up v8"; // case 20: // return "Record Crystal v6"; // case 21: // return "Step Up v9"; // default: // return "Unknown"; // } // } // // @Override // public String toString() // { // return bannerID + ") " + bannerName; // } // } // // Path: src/main/java/io/github/spugn/Sargo/Objects/Character.java // public class Character // { // private String prefix; // private String name; // private int rarity; // private String imagePath; // // public Character() // { // prefix = ""; // name = "null"; // rarity = 1; // imagePath = ""; // } // // public void setPrefix(String prefix) // { // this.prefix = prefix; // } // // public void setName(String name) // { // this.name = name; // } // // public void setRarity(int rarity) // { // this.rarity = rarity; // } // // public void setImagePath(String imagePath) // { // this.imagePath = imagePath; // } // // public String getPrefix() // { // return prefix; // } // // public String getName() // { // return name; // } // // public int getRarity() // { // return rarity; // } // // public String getImagePath() // { // return imagePath; // } // // @Override // public String toString() // { // if (prefix.isEmpty()) // { // return rarity + "★ " + name; // } // return rarity + "★ [" + prefix + "] " + name; // } // // public String toStringNoName() // { // if (prefix.isEmpty()) // { // return rarity + "★ " + name; // } // return rarity + "★ [" + prefix + "]"; // } // } // Path: src/main/java/io/github/spugn/Sargo/CharacterScout/StepUpv3.java import discord4j.core.object.entity.Message; import io.github.spugn.Sargo.Objects.Banner; import io.github.spugn.Sargo.Objects.Character; import java.util.List; PLATINUM = PLATINUM * 2.0; default: break; } } } @Override protected void updateBannerData() { int currentStep = USER.getBannerData(SELECTED_BANNER.getBannerName()); currentStep++; if (currentStep > 3) { USER.changeValue(SELECTED_BANNER.getBannerName(), 1); } else { USER.changeValue(SELECTED_BANNER.getBannerName(), currentStep); } } @Override protected Character randGoldCharacter() { /* GET A RANDOM GOLD VARIANT CHARACTER, IF THERE IS A PLATINUM VARIANT OF THAT CHARACTER IN THE BANNER THEN GET A NEW CHARACTER. */ Character c = null; boolean charInBanner = true; int randIndex;
Banner randBanner;
Expugn/S-argo
src/main/java/io/github/spugn/Sargo/XMLParsers/ScoutMasterParser.java
// Path: src/main/java/io/github/spugn/Sargo/Utilities/GitHubImage.java // public class GitHubImage // { // private String filePath; // private final String GITHUB_IMAGE; // // public GitHubImage(String filePath) // { // GITHUB_IMAGE = LoginSettingsParser.getGitHubRepoURL(); // this.filePath = filePath; // } // // public String getURL() // { // String url = GITHUB_IMAGE + filePath; // // /* REPLACE ALL SPACES WITH %20 */ // url = url.replaceAll(" ", "%20"); // // /* REPLACE ALL ★ WITH %E2%98%85 */ // url = url.replaceAll("★", "%E2%98%85"); // // return url; // } // }
import io.github.spugn.Sargo.Utilities.GitHubImage; import javax.xml.stream.XMLEventReader; import javax.xml.stream.XMLInputFactory; import javax.xml.stream.XMLStreamException; import javax.xml.stream.events.Attribute; import javax.xml.stream.events.XMLEvent; import java.io.*; import java.util.ArrayList; import java.util.Iterator; import java.util.List; import java.util.Random;
{ return (sao_or_alo) ? image_sao_stars_URL : image_alo_stars_URL; } default: return (sao_or_alo) ? image_sao_smile_URL : image_alo_smile_URL; } } /** * Returns a random quote from the list in the ScoutMaster file. * @return String of text that should be displayed in the scout result. */ public String getQuote() { return quotes.get(new Random().nextInt(quotes.size())); } /** * Initializes default data that is used if there is an error when * parsing the ScoutMaster file. */ private void initDefaults() { botName = "S'argo"; //image_sao_smile_URL = new GitHubImage("images/System/Argo_Smile.png").getURL(); //image_sao_grin_URL = new GitHubImage("images/System/Argo_Grin.png").getURL(); //image_sao_smug_URL = new GitHubImage("images/System/Argo_Smug.png").getURL(); //image_sao_flowers_URL = new GitHubImage("images/System/Argo_Flowers.png").getURL();
// Path: src/main/java/io/github/spugn/Sargo/Utilities/GitHubImage.java // public class GitHubImage // { // private String filePath; // private final String GITHUB_IMAGE; // // public GitHubImage(String filePath) // { // GITHUB_IMAGE = LoginSettingsParser.getGitHubRepoURL(); // this.filePath = filePath; // } // // public String getURL() // { // String url = GITHUB_IMAGE + filePath; // // /* REPLACE ALL SPACES WITH %20 */ // url = url.replaceAll(" ", "%20"); // // /* REPLACE ALL ★ WITH %E2%98%85 */ // url = url.replaceAll("★", "%E2%98%85"); // // return url; // } // } // Path: src/main/java/io/github/spugn/Sargo/XMLParsers/ScoutMasterParser.java import io.github.spugn.Sargo.Utilities.GitHubImage; import javax.xml.stream.XMLEventReader; import javax.xml.stream.XMLInputFactory; import javax.xml.stream.XMLStreamException; import javax.xml.stream.events.Attribute; import javax.xml.stream.events.XMLEvent; import java.io.*; import java.util.ArrayList; import java.util.Iterator; import java.util.List; import java.util.Random; { return (sao_or_alo) ? image_sao_stars_URL : image_alo_stars_URL; } default: return (sao_or_alo) ? image_sao_smile_URL : image_alo_smile_URL; } } /** * Returns a random quote from the list in the ScoutMaster file. * @return String of text that should be displayed in the scout result. */ public String getQuote() { return quotes.get(new Random().nextInt(quotes.size())); } /** * Initializes default data that is used if there is an error when * parsing the ScoutMaster file. */ private void initDefaults() { botName = "S'argo"; //image_sao_smile_URL = new GitHubImage("images/System/Argo_Smile.png").getURL(); //image_sao_grin_URL = new GitHubImage("images/System/Argo_Grin.png").getURL(); //image_sao_smug_URL = new GitHubImage("images/System/Argo_Smug.png").getURL(); //image_sao_flowers_URL = new GitHubImage("images/System/Argo_Flowers.png").getURL();
image_sao_smile_URL = new GitHubImage("images/System/Argo_SAO_Smile.png").getURL();
state-machine-systems/envy
src/test/java/com/statemachinesystems/envy/features/InheritanceTest.java
// Path: src/test/java/com/statemachinesystems/envy/common/FeatureTest.java // public abstract class FeatureTest { // // protected Envy envy() { // return envy(valueParserFactory(), configSource()); // } // // protected Envy envy(ValueParserFactory valueParserFactory) { // return envy(valueParserFactory, configSource()); // } // // protected Envy envy(ConfigSource configSource) { // return envy(valueParserFactory(), configSource); // } // // protected Envy envy(ValueParserFactory valueParserFactory, ConfigSource configSource) { // return new Envy(valueParserFactory, configSource); // } // // protected ValueParserFactory valueParserFactory() { // List<ValueParser<?>> valueParsers = new ArrayList<ValueParser<?>>(Envy.defaultValueParsers()); // return new ValueParserFactory(valueParsers); // } // // protected StubConfigSource configSource() { // return new StubConfigSource(); // } // } // // Path: src/test/java/com/statemachinesystems/envy/common/StubConfigSource.java // public class StubConfigSource implements ConfigSource { // // private final Map<Parameter, String> params; // // public StubConfigSource() { // this.params = new HashMap<Parameter, String>(); // } // // public StubConfigSource add(String parameter, String value) { // params.put(new Parameter(parameter), value); // return this; // } // // @Override // public String getValue(Parameter parameter) { // return params.get(parameter); // } // }
import com.statemachinesystems.envy.common.FeatureTest; import com.statemachinesystems.envy.common.StubConfigSource; import org.junit.Test; import static org.hamcrest.CoreMatchers.is; import static org.junit.Assert.assertThat;
package com.statemachinesystems.envy.features; public class InheritanceTest extends FeatureTest { public interface A { String a1(); Integer a2(); } public interface B extends A { String a1(); int b(); } public interface C { String c(); } public interface D extends B, C { int d(); } @Override
// Path: src/test/java/com/statemachinesystems/envy/common/FeatureTest.java // public abstract class FeatureTest { // // protected Envy envy() { // return envy(valueParserFactory(), configSource()); // } // // protected Envy envy(ValueParserFactory valueParserFactory) { // return envy(valueParserFactory, configSource()); // } // // protected Envy envy(ConfigSource configSource) { // return envy(valueParserFactory(), configSource); // } // // protected Envy envy(ValueParserFactory valueParserFactory, ConfigSource configSource) { // return new Envy(valueParserFactory, configSource); // } // // protected ValueParserFactory valueParserFactory() { // List<ValueParser<?>> valueParsers = new ArrayList<ValueParser<?>>(Envy.defaultValueParsers()); // return new ValueParserFactory(valueParsers); // } // // protected StubConfigSource configSource() { // return new StubConfigSource(); // } // } // // Path: src/test/java/com/statemachinesystems/envy/common/StubConfigSource.java // public class StubConfigSource implements ConfigSource { // // private final Map<Parameter, String> params; // // public StubConfigSource() { // this.params = new HashMap<Parameter, String>(); // } // // public StubConfigSource add(String parameter, String value) { // params.put(new Parameter(parameter), value); // return this; // } // // @Override // public String getValue(Parameter parameter) { // return params.get(parameter); // } // } // Path: src/test/java/com/statemachinesystems/envy/features/InheritanceTest.java import com.statemachinesystems.envy.common.FeatureTest; import com.statemachinesystems.envy.common.StubConfigSource; import org.junit.Test; import static org.hamcrest.CoreMatchers.is; import static org.junit.Assert.assertThat; package com.statemachinesystems.envy.features; public class InheritanceTest extends FeatureTest { public interface A { String a1(); Integer a2(); } public interface B extends A { String a1(); int b(); } public interface C { String c(); } public interface D extends B, C { int d(); } @Override
protected StubConfigSource configSource() {
state-machine-systems/envy
src/main/java/com/statemachinesystems/envy/sources/EnvironmentVariableConfigSource.java
// Path: src/main/java/com/statemachinesystems/envy/ConfigSource.java // public interface ConfigSource { // // /** // * Retrieves the configuration value associated with the given parameter. // * // * @param parameter the parameter to retrieve. // * @return the value associated with the parameter, or null if no value was present // */ // String getValue(Parameter parameter); // } // // Path: src/main/java/com/statemachinesystems/envy/Parameter.java // public class Parameter { // // private static final String unicodeAlphaNumeric = "[\\p{L}\\d]+"; // private static final String separator = "[._]"; // // private static final Pattern validNamePattern = // Pattern.compile(String.format("(%s)(%s%s)*", unicodeAlphaNumeric, separator, unicodeAlphaNumeric)); // // public static Parameter fromMethodName(String name) { // int prefixLength = getBeanPropertyPrefixLength(name); // // return fromPropertyName(name.substring(prefixLength)); // } // // private static Parameter fromPropertyName(String name) { // PropertyNameParser parser = new PropertyNameParser(name); // // StringBuilder buf = new StringBuilder(); // for (String part : parser.parse()) { // if (buf.length() > 0) { // buf.append('_'); // } // buf.append(part.toUpperCase()); // } // return new Parameter(buf.toString()); // } // // private static int getBeanPropertyPrefixLength(String name) { // if (hasBeanPropertyPrefix(name, "get")) { // return "get".length(); // } else if (hasBeanPropertyPrefix(name, "is")) { // return "is".length(); // } else { // return 0; // } // } // // private static boolean hasBeanPropertyPrefix(String name, String prefix) { // return name.length() > prefix.length() // && name.startsWith(prefix) // && Character.isUpperCase(name.charAt(prefix.length())); // } // // private final String name; // // public Parameter(String name) { // if (name == null) { // throw new NullPointerException("Name must not be null"); // } // if (! validNamePattern.matcher(name).matches()) { // throw new IllegalArgumentException("Invalid name format: " + name); // } // this.name = name; // } // // public String asEnvironmentVariableName() { // return name.toUpperCase().replaceAll("\\.", "_"); // } // // public String asSystemPropertyName() { // return name.toLowerCase().replaceAll("_", "."); // } // // public Parameter join(Parameter other) { // return new Parameter( // String.format("%s_%s", this.asEnvironmentVariableName(), other.asEnvironmentVariableName())); // } // // @Override // public String toString() { // return this.asEnvironmentVariableName(); // } // // @Override // public boolean equals(Object o) { // if (this == o) return true; // if (o == null || getClass() != o.getClass()) return false; // // Parameter that = (Parameter) o; // // return this.asEnvironmentVariableName().equals(that.asEnvironmentVariableName()); // } // // @Override // public int hashCode() { // return this.asEnvironmentVariableName().hashCode(); // } // }
import com.statemachinesystems.envy.ConfigSource; import com.statemachinesystems.envy.Parameter;
package com.statemachinesystems.envy.sources; /** * A {@link com.statemachinesystems.envy.ConfigSource} implementation * that retrieves configuration values from environment variables using an * <code>UPPER_CASE_UNDERSCORED</code> naming convention. */ public class EnvironmentVariableConfigSource implements ConfigSource { @Override
// Path: src/main/java/com/statemachinesystems/envy/ConfigSource.java // public interface ConfigSource { // // /** // * Retrieves the configuration value associated with the given parameter. // * // * @param parameter the parameter to retrieve. // * @return the value associated with the parameter, or null if no value was present // */ // String getValue(Parameter parameter); // } // // Path: src/main/java/com/statemachinesystems/envy/Parameter.java // public class Parameter { // // private static final String unicodeAlphaNumeric = "[\\p{L}\\d]+"; // private static final String separator = "[._]"; // // private static final Pattern validNamePattern = // Pattern.compile(String.format("(%s)(%s%s)*", unicodeAlphaNumeric, separator, unicodeAlphaNumeric)); // // public static Parameter fromMethodName(String name) { // int prefixLength = getBeanPropertyPrefixLength(name); // // return fromPropertyName(name.substring(prefixLength)); // } // // private static Parameter fromPropertyName(String name) { // PropertyNameParser parser = new PropertyNameParser(name); // // StringBuilder buf = new StringBuilder(); // for (String part : parser.parse()) { // if (buf.length() > 0) { // buf.append('_'); // } // buf.append(part.toUpperCase()); // } // return new Parameter(buf.toString()); // } // // private static int getBeanPropertyPrefixLength(String name) { // if (hasBeanPropertyPrefix(name, "get")) { // return "get".length(); // } else if (hasBeanPropertyPrefix(name, "is")) { // return "is".length(); // } else { // return 0; // } // } // // private static boolean hasBeanPropertyPrefix(String name, String prefix) { // return name.length() > prefix.length() // && name.startsWith(prefix) // && Character.isUpperCase(name.charAt(prefix.length())); // } // // private final String name; // // public Parameter(String name) { // if (name == null) { // throw new NullPointerException("Name must not be null"); // } // if (! validNamePattern.matcher(name).matches()) { // throw new IllegalArgumentException("Invalid name format: " + name); // } // this.name = name; // } // // public String asEnvironmentVariableName() { // return name.toUpperCase().replaceAll("\\.", "_"); // } // // public String asSystemPropertyName() { // return name.toLowerCase().replaceAll("_", "."); // } // // public Parameter join(Parameter other) { // return new Parameter( // String.format("%s_%s", this.asEnvironmentVariableName(), other.asEnvironmentVariableName())); // } // // @Override // public String toString() { // return this.asEnvironmentVariableName(); // } // // @Override // public boolean equals(Object o) { // if (this == o) return true; // if (o == null || getClass() != o.getClass()) return false; // // Parameter that = (Parameter) o; // // return this.asEnvironmentVariableName().equals(that.asEnvironmentVariableName()); // } // // @Override // public int hashCode() { // return this.asEnvironmentVariableName().hashCode(); // } // } // Path: src/main/java/com/statemachinesystems/envy/sources/EnvironmentVariableConfigSource.java import com.statemachinesystems.envy.ConfigSource; import com.statemachinesystems.envy.Parameter; package com.statemachinesystems.envy.sources; /** * A {@link com.statemachinesystems.envy.ConfigSource} implementation * that retrieves configuration values from environment variables using an * <code>UPPER_CASE_UNDERSCORED</code> naming convention. */ public class EnvironmentVariableConfigSource implements ConfigSource { @Override
public String getValue(Parameter parameter) {
state-machine-systems/envy
src/test/java/com/statemachinesystems/envy/features/SensitiveValuesTest.java
// Path: src/main/java/com/statemachinesystems/envy/ConfigSource.java // public interface ConfigSource { // // /** // * Retrieves the configuration value associated with the given parameter. // * // * @param parameter the parameter to retrieve. // * @return the value associated with the parameter, or null if no value was present // */ // String getValue(Parameter parameter); // } // // Path: src/test/java/com/statemachinesystems/envy/common/FeatureTest.java // public abstract class FeatureTest { // // protected Envy envy() { // return envy(valueParserFactory(), configSource()); // } // // protected Envy envy(ValueParserFactory valueParserFactory) { // return envy(valueParserFactory, configSource()); // } // // protected Envy envy(ConfigSource configSource) { // return envy(valueParserFactory(), configSource); // } // // protected Envy envy(ValueParserFactory valueParserFactory, ConfigSource configSource) { // return new Envy(valueParserFactory, configSource); // } // // protected ValueParserFactory valueParserFactory() { // List<ValueParser<?>> valueParsers = new ArrayList<ValueParser<?>>(Envy.defaultValueParsers()); // return new ValueParserFactory(valueParsers); // } // // protected StubConfigSource configSource() { // return new StubConfigSource(); // } // } // // Path: src/main/java/com/statemachinesystems/envy/values/SensitiveValue.java // public class SensitiveValue<T> extends ResolvedValue<T> { // // public static final String MASKED_VALUE = "******"; // // protected SensitiveValue(T value, Status status) { // super(value, status); // } // // @Override // public String format(Object proxy) { // return getStatus() == Status.MISSING // ? super.format(proxy) // : MASKED_VALUE; // } // }
import com.statemachinesystems.envy.ConfigSource; import com.statemachinesystems.envy.Nullable; import com.statemachinesystems.envy.Sensitive; import com.statemachinesystems.envy.common.FeatureTest; import com.statemachinesystems.envy.values.SensitiveValue; import org.junit.Test; import java.util.Optional; import static org.hamcrest.CoreMatchers.containsString; import static org.hamcrest.CoreMatchers.not; import static org.junit.Assert.assertThat;
Credentials credentials(); } interface NestedSensitive { @Nullable @Sensitive Credentials credentials(); } interface OptionalSensitive { @Sensitive Optional<Integer> secretNumber(); } interface NestedOptional { @Sensitive Optional<Credentials> credentials(); } interface Sub1 extends Credentials { String type(); } interface Sub2 extends Credentials { @Override String password(); } @Test public void masksSensitiveValues() {
// Path: src/main/java/com/statemachinesystems/envy/ConfigSource.java // public interface ConfigSource { // // /** // * Retrieves the configuration value associated with the given parameter. // * // * @param parameter the parameter to retrieve. // * @return the value associated with the parameter, or null if no value was present // */ // String getValue(Parameter parameter); // } // // Path: src/test/java/com/statemachinesystems/envy/common/FeatureTest.java // public abstract class FeatureTest { // // protected Envy envy() { // return envy(valueParserFactory(), configSource()); // } // // protected Envy envy(ValueParserFactory valueParserFactory) { // return envy(valueParserFactory, configSource()); // } // // protected Envy envy(ConfigSource configSource) { // return envy(valueParserFactory(), configSource); // } // // protected Envy envy(ValueParserFactory valueParserFactory, ConfigSource configSource) { // return new Envy(valueParserFactory, configSource); // } // // protected ValueParserFactory valueParserFactory() { // List<ValueParser<?>> valueParsers = new ArrayList<ValueParser<?>>(Envy.defaultValueParsers()); // return new ValueParserFactory(valueParsers); // } // // protected StubConfigSource configSource() { // return new StubConfigSource(); // } // } // // Path: src/main/java/com/statemachinesystems/envy/values/SensitiveValue.java // public class SensitiveValue<T> extends ResolvedValue<T> { // // public static final String MASKED_VALUE = "******"; // // protected SensitiveValue(T value, Status status) { // super(value, status); // } // // @Override // public String format(Object proxy) { // return getStatus() == Status.MISSING // ? super.format(proxy) // : MASKED_VALUE; // } // } // Path: src/test/java/com/statemachinesystems/envy/features/SensitiveValuesTest.java import com.statemachinesystems.envy.ConfigSource; import com.statemachinesystems.envy.Nullable; import com.statemachinesystems.envy.Sensitive; import com.statemachinesystems.envy.common.FeatureTest; import com.statemachinesystems.envy.values.SensitiveValue; import org.junit.Test; import java.util.Optional; import static org.hamcrest.CoreMatchers.containsString; import static org.hamcrest.CoreMatchers.not; import static org.junit.Assert.assertThat; Credentials credentials(); } interface NestedSensitive { @Nullable @Sensitive Credentials credentials(); } interface OptionalSensitive { @Sensitive Optional<Integer> secretNumber(); } interface NestedOptional { @Sensitive Optional<Credentials> credentials(); } interface Sub1 extends Credentials { String type(); } interface Sub2 extends Credentials { @Override String password(); } @Test public void masksSensitiveValues() {
ConfigSource configSource = configSource()
state-machine-systems/envy
src/test/java/com/statemachinesystems/envy/features/SensitiveValuesTest.java
// Path: src/main/java/com/statemachinesystems/envy/ConfigSource.java // public interface ConfigSource { // // /** // * Retrieves the configuration value associated with the given parameter. // * // * @param parameter the parameter to retrieve. // * @return the value associated with the parameter, or null if no value was present // */ // String getValue(Parameter parameter); // } // // Path: src/test/java/com/statemachinesystems/envy/common/FeatureTest.java // public abstract class FeatureTest { // // protected Envy envy() { // return envy(valueParserFactory(), configSource()); // } // // protected Envy envy(ValueParserFactory valueParserFactory) { // return envy(valueParserFactory, configSource()); // } // // protected Envy envy(ConfigSource configSource) { // return envy(valueParserFactory(), configSource); // } // // protected Envy envy(ValueParserFactory valueParserFactory, ConfigSource configSource) { // return new Envy(valueParserFactory, configSource); // } // // protected ValueParserFactory valueParserFactory() { // List<ValueParser<?>> valueParsers = new ArrayList<ValueParser<?>>(Envy.defaultValueParsers()); // return new ValueParserFactory(valueParsers); // } // // protected StubConfigSource configSource() { // return new StubConfigSource(); // } // } // // Path: src/main/java/com/statemachinesystems/envy/values/SensitiveValue.java // public class SensitiveValue<T> extends ResolvedValue<T> { // // public static final String MASKED_VALUE = "******"; // // protected SensitiveValue(T value, Status status) { // super(value, status); // } // // @Override // public String format(Object proxy) { // return getStatus() == Status.MISSING // ? super.format(proxy) // : MASKED_VALUE; // } // }
import com.statemachinesystems.envy.ConfigSource; import com.statemachinesystems.envy.Nullable; import com.statemachinesystems.envy.Sensitive; import com.statemachinesystems.envy.common.FeatureTest; import com.statemachinesystems.envy.values.SensitiveValue; import org.junit.Test; import java.util.Optional; import static org.hamcrest.CoreMatchers.containsString; import static org.hamcrest.CoreMatchers.not; import static org.junit.Assert.assertThat;
@Sensitive Credentials credentials(); } interface OptionalSensitive { @Sensitive Optional<Integer> secretNumber(); } interface NestedOptional { @Sensitive Optional<Credentials> credentials(); } interface Sub1 extends Credentials { String type(); } interface Sub2 extends Credentials { @Override String password(); } @Test public void masksSensitiveValues() { ConfigSource configSource = configSource() .add("username", "scott") .add("password", "tiger"); Credentials config = envy(configSource).proxy(Credentials.class); assertThat(config.toString(), not(containsString("tiger")));
// Path: src/main/java/com/statemachinesystems/envy/ConfigSource.java // public interface ConfigSource { // // /** // * Retrieves the configuration value associated with the given parameter. // * // * @param parameter the parameter to retrieve. // * @return the value associated with the parameter, or null if no value was present // */ // String getValue(Parameter parameter); // } // // Path: src/test/java/com/statemachinesystems/envy/common/FeatureTest.java // public abstract class FeatureTest { // // protected Envy envy() { // return envy(valueParserFactory(), configSource()); // } // // protected Envy envy(ValueParserFactory valueParserFactory) { // return envy(valueParserFactory, configSource()); // } // // protected Envy envy(ConfigSource configSource) { // return envy(valueParserFactory(), configSource); // } // // protected Envy envy(ValueParserFactory valueParserFactory, ConfigSource configSource) { // return new Envy(valueParserFactory, configSource); // } // // protected ValueParserFactory valueParserFactory() { // List<ValueParser<?>> valueParsers = new ArrayList<ValueParser<?>>(Envy.defaultValueParsers()); // return new ValueParserFactory(valueParsers); // } // // protected StubConfigSource configSource() { // return new StubConfigSource(); // } // } // // Path: src/main/java/com/statemachinesystems/envy/values/SensitiveValue.java // public class SensitiveValue<T> extends ResolvedValue<T> { // // public static final String MASKED_VALUE = "******"; // // protected SensitiveValue(T value, Status status) { // super(value, status); // } // // @Override // public String format(Object proxy) { // return getStatus() == Status.MISSING // ? super.format(proxy) // : MASKED_VALUE; // } // } // Path: src/test/java/com/statemachinesystems/envy/features/SensitiveValuesTest.java import com.statemachinesystems.envy.ConfigSource; import com.statemachinesystems.envy.Nullable; import com.statemachinesystems.envy.Sensitive; import com.statemachinesystems.envy.common.FeatureTest; import com.statemachinesystems.envy.values.SensitiveValue; import org.junit.Test; import java.util.Optional; import static org.hamcrest.CoreMatchers.containsString; import static org.hamcrest.CoreMatchers.not; import static org.junit.Assert.assertThat; @Sensitive Credentials credentials(); } interface OptionalSensitive { @Sensitive Optional<Integer> secretNumber(); } interface NestedOptional { @Sensitive Optional<Credentials> credentials(); } interface Sub1 extends Credentials { String type(); } interface Sub2 extends Credentials { @Override String password(); } @Test public void masksSensitiveValues() { ConfigSource configSource = configSource() .add("username", "scott") .add("password", "tiger"); Credentials config = envy(configSource).proxy(Credentials.class); assertThat(config.toString(), not(containsString("tiger")));
assertThat(config.toString(), containsString(SensitiveValue.MASKED_VALUE));
state-machine-systems/envy
src/main/java/com/statemachinesystems/envy/sources/DelegatingConfigSource.java
// Path: src/main/java/com/statemachinesystems/envy/ConfigSource.java // public interface ConfigSource { // // /** // * Retrieves the configuration value associated with the given parameter. // * // * @param parameter the parameter to retrieve. // * @return the value associated with the parameter, or null if no value was present // */ // String getValue(Parameter parameter); // } // // Path: src/main/java/com/statemachinesystems/envy/Parameter.java // public class Parameter { // // private static final String unicodeAlphaNumeric = "[\\p{L}\\d]+"; // private static final String separator = "[._]"; // // private static final Pattern validNamePattern = // Pattern.compile(String.format("(%s)(%s%s)*", unicodeAlphaNumeric, separator, unicodeAlphaNumeric)); // // public static Parameter fromMethodName(String name) { // int prefixLength = getBeanPropertyPrefixLength(name); // // return fromPropertyName(name.substring(prefixLength)); // } // // private static Parameter fromPropertyName(String name) { // PropertyNameParser parser = new PropertyNameParser(name); // // StringBuilder buf = new StringBuilder(); // for (String part : parser.parse()) { // if (buf.length() > 0) { // buf.append('_'); // } // buf.append(part.toUpperCase()); // } // return new Parameter(buf.toString()); // } // // private static int getBeanPropertyPrefixLength(String name) { // if (hasBeanPropertyPrefix(name, "get")) { // return "get".length(); // } else if (hasBeanPropertyPrefix(name, "is")) { // return "is".length(); // } else { // return 0; // } // } // // private static boolean hasBeanPropertyPrefix(String name, String prefix) { // return name.length() > prefix.length() // && name.startsWith(prefix) // && Character.isUpperCase(name.charAt(prefix.length())); // } // // private final String name; // // public Parameter(String name) { // if (name == null) { // throw new NullPointerException("Name must not be null"); // } // if (! validNamePattern.matcher(name).matches()) { // throw new IllegalArgumentException("Invalid name format: " + name); // } // this.name = name; // } // // public String asEnvironmentVariableName() { // return name.toUpperCase().replaceAll("\\.", "_"); // } // // public String asSystemPropertyName() { // return name.toLowerCase().replaceAll("_", "."); // } // // public Parameter join(Parameter other) { // return new Parameter( // String.format("%s_%s", this.asEnvironmentVariableName(), other.asEnvironmentVariableName())); // } // // @Override // public String toString() { // return this.asEnvironmentVariableName(); // } // // @Override // public boolean equals(Object o) { // if (this == o) return true; // if (o == null || getClass() != o.getClass()) return false; // // Parameter that = (Parameter) o; // // return this.asEnvironmentVariableName().equals(that.asEnvironmentVariableName()); // } // // @Override // public int hashCode() { // return this.asEnvironmentVariableName().hashCode(); // } // }
import com.statemachinesystems.envy.ConfigSource; import com.statemachinesystems.envy.Parameter;
package com.statemachinesystems.envy.sources; /** * A composite {@link com.statemachinesystems.envy.ConfigSource} implementation * that retrieves configuration values from its component sources in preference order. */ public class DelegatingConfigSource implements ConfigSource { private final ConfigSource[] sources; /** * Creates a {@link com.statemachinesystems.envy.sources.DelegatingConfigSource} using * the given component sources in preference order. * * @param sources component {@link com.statemachinesystems.envy.ConfigSource}s in preference order */ public DelegatingConfigSource(ConfigSource... sources) { this.sources = sources; } @Override
// Path: src/main/java/com/statemachinesystems/envy/ConfigSource.java // public interface ConfigSource { // // /** // * Retrieves the configuration value associated with the given parameter. // * // * @param parameter the parameter to retrieve. // * @return the value associated with the parameter, or null if no value was present // */ // String getValue(Parameter parameter); // } // // Path: src/main/java/com/statemachinesystems/envy/Parameter.java // public class Parameter { // // private static final String unicodeAlphaNumeric = "[\\p{L}\\d]+"; // private static final String separator = "[._]"; // // private static final Pattern validNamePattern = // Pattern.compile(String.format("(%s)(%s%s)*", unicodeAlphaNumeric, separator, unicodeAlphaNumeric)); // // public static Parameter fromMethodName(String name) { // int prefixLength = getBeanPropertyPrefixLength(name); // // return fromPropertyName(name.substring(prefixLength)); // } // // private static Parameter fromPropertyName(String name) { // PropertyNameParser parser = new PropertyNameParser(name); // // StringBuilder buf = new StringBuilder(); // for (String part : parser.parse()) { // if (buf.length() > 0) { // buf.append('_'); // } // buf.append(part.toUpperCase()); // } // return new Parameter(buf.toString()); // } // // private static int getBeanPropertyPrefixLength(String name) { // if (hasBeanPropertyPrefix(name, "get")) { // return "get".length(); // } else if (hasBeanPropertyPrefix(name, "is")) { // return "is".length(); // } else { // return 0; // } // } // // private static boolean hasBeanPropertyPrefix(String name, String prefix) { // return name.length() > prefix.length() // && name.startsWith(prefix) // && Character.isUpperCase(name.charAt(prefix.length())); // } // // private final String name; // // public Parameter(String name) { // if (name == null) { // throw new NullPointerException("Name must not be null"); // } // if (! validNamePattern.matcher(name).matches()) { // throw new IllegalArgumentException("Invalid name format: " + name); // } // this.name = name; // } // // public String asEnvironmentVariableName() { // return name.toUpperCase().replaceAll("\\.", "_"); // } // // public String asSystemPropertyName() { // return name.toLowerCase().replaceAll("_", "."); // } // // public Parameter join(Parameter other) { // return new Parameter( // String.format("%s_%s", this.asEnvironmentVariableName(), other.asEnvironmentVariableName())); // } // // @Override // public String toString() { // return this.asEnvironmentVariableName(); // } // // @Override // public boolean equals(Object o) { // if (this == o) return true; // if (o == null || getClass() != o.getClass()) return false; // // Parameter that = (Parameter) o; // // return this.asEnvironmentVariableName().equals(that.asEnvironmentVariableName()); // } // // @Override // public int hashCode() { // return this.asEnvironmentVariableName().hashCode(); // } // } // Path: src/main/java/com/statemachinesystems/envy/sources/DelegatingConfigSource.java import com.statemachinesystems.envy.ConfigSource; import com.statemachinesystems.envy.Parameter; package com.statemachinesystems.envy.sources; /** * A composite {@link com.statemachinesystems.envy.ConfigSource} implementation * that retrieves configuration values from its component sources in preference order. */ public class DelegatingConfigSource implements ConfigSource { private final ConfigSource[] sources; /** * Creates a {@link com.statemachinesystems.envy.sources.DelegatingConfigSource} using * the given component sources in preference order. * * @param sources component {@link com.statemachinesystems.envy.ConfigSource}s in preference order */ public DelegatingConfigSource(ConfigSource... sources) { this.sources = sources; } @Override
public String getValue(Parameter parameter) {
state-machine-systems/envy
src/test/java/com/statemachinesystems/envy/features/OptionalWrapperTest.java
// Path: src/main/java/com/statemachinesystems/envy/ConfigSource.java // public interface ConfigSource { // // /** // * Retrieves the configuration value associated with the given parameter. // * // * @param parameter the parameter to retrieve. // * @return the value associated with the parameter, or null if no value was present // */ // String getValue(Parameter parameter); // } // // Path: src/main/java/com/statemachinesystems/envy/UnsupportedTypeException.java // public class UnsupportedTypeException extends RuntimeException { // // public UnsupportedTypeException(String message) { // super(message); // } // } // // Path: src/test/java/com/statemachinesystems/envy/common/FeatureTest.java // public abstract class FeatureTest { // // protected Envy envy() { // return envy(valueParserFactory(), configSource()); // } // // protected Envy envy(ValueParserFactory valueParserFactory) { // return envy(valueParserFactory, configSource()); // } // // protected Envy envy(ConfigSource configSource) { // return envy(valueParserFactory(), configSource); // } // // protected Envy envy(ValueParserFactory valueParserFactory, ConfigSource configSource) { // return new Envy(valueParserFactory, configSource); // } // // protected ValueParserFactory valueParserFactory() { // List<ValueParser<?>> valueParsers = new ArrayList<ValueParser<?>>(Envy.defaultValueParsers()); // return new ValueParserFactory(valueParsers); // } // // protected StubConfigSource configSource() { // return new StubConfigSource(); // } // }
import com.statemachinesystems.envy.ConfigSource; import com.statemachinesystems.envy.Default; import com.statemachinesystems.envy.Nullable; import com.statemachinesystems.envy.UnsupportedTypeException; import com.statemachinesystems.envy.common.FeatureTest; import org.junit.Test; import scala.Option; import java.util.Optional; import static org.hamcrest.CoreMatchers.equalTo; import static org.junit.Assert.assertArrayEquals; import static org.junit.Assert.assertThat;
public void nullableAnnotationHasNoEffectForAbsentValue() { Java8WithAnnotation java8 = envy().proxy(Java8WithAnnotation.class); assertThat(java8.foo(), equalTo(Optional.<Integer>empty())); } @Test public void wrapsArray() { Java8WithArray java8 = envy(configSource().add("foo", "1,2,3")).proxy(Java8WithArray.class); assertArrayEquals(new Integer[]{1, 2, 3}, java8.foo().get()); } @Test public void wrapsPrimitiveArray() { Java8WithPrimitiveArray java8 = envy(configSource().add("foo", "1,2,3")).proxy(Java8WithPrimitiveArray.class); assertArrayEquals(new int[]{1, 2, 3}, java8.foo().get()); } @Test public void wrapsProvidedNestedValue() { Java8WithNested java8 = envy(configSource().add("foo.bar", "baz")).proxy(Java8WithNested.class); assertThat(java8.foo().get().bar(), equalTo("baz")); } @Test public void wrapsMissingNestedValue() { Java8WithNested java8 = envy().proxy(Java8WithNested.class); assertThat(java8.foo(), equalTo(Optional.<Java8WithNested.Nested>empty())); }
// Path: src/main/java/com/statemachinesystems/envy/ConfigSource.java // public interface ConfigSource { // // /** // * Retrieves the configuration value associated with the given parameter. // * // * @param parameter the parameter to retrieve. // * @return the value associated with the parameter, or null if no value was present // */ // String getValue(Parameter parameter); // } // // Path: src/main/java/com/statemachinesystems/envy/UnsupportedTypeException.java // public class UnsupportedTypeException extends RuntimeException { // // public UnsupportedTypeException(String message) { // super(message); // } // } // // Path: src/test/java/com/statemachinesystems/envy/common/FeatureTest.java // public abstract class FeatureTest { // // protected Envy envy() { // return envy(valueParserFactory(), configSource()); // } // // protected Envy envy(ValueParserFactory valueParserFactory) { // return envy(valueParserFactory, configSource()); // } // // protected Envy envy(ConfigSource configSource) { // return envy(valueParserFactory(), configSource); // } // // protected Envy envy(ValueParserFactory valueParserFactory, ConfigSource configSource) { // return new Envy(valueParserFactory, configSource); // } // // protected ValueParserFactory valueParserFactory() { // List<ValueParser<?>> valueParsers = new ArrayList<ValueParser<?>>(Envy.defaultValueParsers()); // return new ValueParserFactory(valueParsers); // } // // protected StubConfigSource configSource() { // return new StubConfigSource(); // } // } // Path: src/test/java/com/statemachinesystems/envy/features/OptionalWrapperTest.java import com.statemachinesystems.envy.ConfigSource; import com.statemachinesystems.envy.Default; import com.statemachinesystems.envy.Nullable; import com.statemachinesystems.envy.UnsupportedTypeException; import com.statemachinesystems.envy.common.FeatureTest; import org.junit.Test; import scala.Option; import java.util.Optional; import static org.hamcrest.CoreMatchers.equalTo; import static org.junit.Assert.assertArrayEquals; import static org.junit.Assert.assertThat; public void nullableAnnotationHasNoEffectForAbsentValue() { Java8WithAnnotation java8 = envy().proxy(Java8WithAnnotation.class); assertThat(java8.foo(), equalTo(Optional.<Integer>empty())); } @Test public void wrapsArray() { Java8WithArray java8 = envy(configSource().add("foo", "1,2,3")).proxy(Java8WithArray.class); assertArrayEquals(new Integer[]{1, 2, 3}, java8.foo().get()); } @Test public void wrapsPrimitiveArray() { Java8WithPrimitiveArray java8 = envy(configSource().add("foo", "1,2,3")).proxy(Java8WithPrimitiveArray.class); assertArrayEquals(new int[]{1, 2, 3}, java8.foo().get()); } @Test public void wrapsProvidedNestedValue() { Java8WithNested java8 = envy(configSource().add("foo.bar", "baz")).proxy(Java8WithNested.class); assertThat(java8.foo().get().bar(), equalTo("baz")); } @Test public void wrapsMissingNestedValue() { Java8WithNested java8 = envy().proxy(Java8WithNested.class); assertThat(java8.foo(), equalTo(Optional.<Java8WithNested.Nested>empty())); }
@Test(expected = UnsupportedTypeException.class)
state-machine-systems/envy
src/test/java/com/statemachinesystems/envy/features/OptionalWrapperTest.java
// Path: src/main/java/com/statemachinesystems/envy/ConfigSource.java // public interface ConfigSource { // // /** // * Retrieves the configuration value associated with the given parameter. // * // * @param parameter the parameter to retrieve. // * @return the value associated with the parameter, or null if no value was present // */ // String getValue(Parameter parameter); // } // // Path: src/main/java/com/statemachinesystems/envy/UnsupportedTypeException.java // public class UnsupportedTypeException extends RuntimeException { // // public UnsupportedTypeException(String message) { // super(message); // } // } // // Path: src/test/java/com/statemachinesystems/envy/common/FeatureTest.java // public abstract class FeatureTest { // // protected Envy envy() { // return envy(valueParserFactory(), configSource()); // } // // protected Envy envy(ValueParserFactory valueParserFactory) { // return envy(valueParserFactory, configSource()); // } // // protected Envy envy(ConfigSource configSource) { // return envy(valueParserFactory(), configSource); // } // // protected Envy envy(ValueParserFactory valueParserFactory, ConfigSource configSource) { // return new Envy(valueParserFactory, configSource); // } // // protected ValueParserFactory valueParserFactory() { // List<ValueParser<?>> valueParsers = new ArrayList<ValueParser<?>>(Envy.defaultValueParsers()); // return new ValueParserFactory(valueParsers); // } // // protected StubConfigSource configSource() { // return new StubConfigSource(); // } // }
import com.statemachinesystems.envy.ConfigSource; import com.statemachinesystems.envy.Default; import com.statemachinesystems.envy.Nullable; import com.statemachinesystems.envy.UnsupportedTypeException; import com.statemachinesystems.envy.common.FeatureTest; import org.junit.Test; import scala.Option; import java.util.Optional; import static org.hamcrest.CoreMatchers.equalTo; import static org.junit.Assert.assertArrayEquals; import static org.junit.Assert.assertThat;
} @Test public void wrapsMissingNestedValue() { Java8WithNested java8 = envy().proxy(Java8WithNested.class); assertThat(java8.foo(), equalTo(Optional.<Java8WithNested.Nested>empty())); } @Test(expected = UnsupportedTypeException.class) public void rejectsArrayOfOptionalValues() { envy().proxy(Java8WithArrayOfOptional.class); } @Test(expected = UnsupportedTypeException.class) public void rejectsOptionalOptional() { envy().proxy(Java8WithOptionalOptional.class); } @Test(expected = UnsupportedTypeException.class) public void rejectsWildcard() { envy().proxy(Java8WithWildcard.class); } @Test(expected = UnsupportedTypeException.class) public void rejectsGenericArray() { envy().proxy(Java8WithArrayOfGenericType.class); } @Test public void optionalNestedConfigWithDefaultsAndAllValuesProvidedIsPopulated() {
// Path: src/main/java/com/statemachinesystems/envy/ConfigSource.java // public interface ConfigSource { // // /** // * Retrieves the configuration value associated with the given parameter. // * // * @param parameter the parameter to retrieve. // * @return the value associated with the parameter, or null if no value was present // */ // String getValue(Parameter parameter); // } // // Path: src/main/java/com/statemachinesystems/envy/UnsupportedTypeException.java // public class UnsupportedTypeException extends RuntimeException { // // public UnsupportedTypeException(String message) { // super(message); // } // } // // Path: src/test/java/com/statemachinesystems/envy/common/FeatureTest.java // public abstract class FeatureTest { // // protected Envy envy() { // return envy(valueParserFactory(), configSource()); // } // // protected Envy envy(ValueParserFactory valueParserFactory) { // return envy(valueParserFactory, configSource()); // } // // protected Envy envy(ConfigSource configSource) { // return envy(valueParserFactory(), configSource); // } // // protected Envy envy(ValueParserFactory valueParserFactory, ConfigSource configSource) { // return new Envy(valueParserFactory, configSource); // } // // protected ValueParserFactory valueParserFactory() { // List<ValueParser<?>> valueParsers = new ArrayList<ValueParser<?>>(Envy.defaultValueParsers()); // return new ValueParserFactory(valueParsers); // } // // protected StubConfigSource configSource() { // return new StubConfigSource(); // } // } // Path: src/test/java/com/statemachinesystems/envy/features/OptionalWrapperTest.java import com.statemachinesystems.envy.ConfigSource; import com.statemachinesystems.envy.Default; import com.statemachinesystems.envy.Nullable; import com.statemachinesystems.envy.UnsupportedTypeException; import com.statemachinesystems.envy.common.FeatureTest; import org.junit.Test; import scala.Option; import java.util.Optional; import static org.hamcrest.CoreMatchers.equalTo; import static org.junit.Assert.assertArrayEquals; import static org.junit.Assert.assertThat; } @Test public void wrapsMissingNestedValue() { Java8WithNested java8 = envy().proxy(Java8WithNested.class); assertThat(java8.foo(), equalTo(Optional.<Java8WithNested.Nested>empty())); } @Test(expected = UnsupportedTypeException.class) public void rejectsArrayOfOptionalValues() { envy().proxy(Java8WithArrayOfOptional.class); } @Test(expected = UnsupportedTypeException.class) public void rejectsOptionalOptional() { envy().proxy(Java8WithOptionalOptional.class); } @Test(expected = UnsupportedTypeException.class) public void rejectsWildcard() { envy().proxy(Java8WithWildcard.class); } @Test(expected = UnsupportedTypeException.class) public void rejectsGenericArray() { envy().proxy(Java8WithArrayOfGenericType.class); } @Test public void optionalNestedConfigWithDefaultsAndAllValuesProvidedIsPopulated() {
ConfigSource configSource = configSource().add("foo.bar", "x").add("foo.baz", "y");
state-machine-systems/envy
src/test/java/com/statemachinesystems/envy/features/PrefixTest.java
// Path: src/test/java/com/statemachinesystems/envy/common/FeatureTest.java // public abstract class FeatureTest { // // protected Envy envy() { // return envy(valueParserFactory(), configSource()); // } // // protected Envy envy(ValueParserFactory valueParserFactory) { // return envy(valueParserFactory, configSource()); // } // // protected Envy envy(ConfigSource configSource) { // return envy(valueParserFactory(), configSource); // } // // protected Envy envy(ValueParserFactory valueParserFactory, ConfigSource configSource) { // return new Envy(valueParserFactory, configSource); // } // // protected ValueParserFactory valueParserFactory() { // List<ValueParser<?>> valueParsers = new ArrayList<ValueParser<?>>(Envy.defaultValueParsers()); // return new ValueParserFactory(valueParsers); // } // // protected StubConfigSource configSource() { // return new StubConfigSource(); // } // } // // Path: src/test/java/com/statemachinesystems/envy/common/StubConfigSource.java // public class StubConfigSource implements ConfigSource { // // private final Map<Parameter, String> params; // // public StubConfigSource() { // this.params = new HashMap<Parameter, String>(); // } // // public StubConfigSource add(String parameter, String value) { // params.put(new Parameter(parameter), value); // return this; // } // // @Override // public String getValue(Parameter parameter) { // return params.get(parameter); // } // }
import com.statemachinesystems.envy.Name; import com.statemachinesystems.envy.Prefix; import com.statemachinesystems.envy.common.FeatureTest; import com.statemachinesystems.envy.common.StubConfigSource; import org.junit.Test; import static org.hamcrest.CoreMatchers.is; import static org.junit.Assert.assertThat;
package com.statemachinesystems.envy.features; public class PrefixTest extends FeatureTest { @Prefix("xxx") @SuppressWarnings("unused") interface A { int inherited(); @Name("custom.name.inherited") int inheritedWithCustomName(); @Name("xxx") int customNameOverridden(); @Name("xxx") int customNameRemoved(); } @Prefix("custom.prefix") interface B extends A { int plain(); @Name("custom.name") int withCustomName(); @Name("overridden.custom.name") int customNameOverridden(); int customNameRemoved(); } @Override
// Path: src/test/java/com/statemachinesystems/envy/common/FeatureTest.java // public abstract class FeatureTest { // // protected Envy envy() { // return envy(valueParserFactory(), configSource()); // } // // protected Envy envy(ValueParserFactory valueParserFactory) { // return envy(valueParserFactory, configSource()); // } // // protected Envy envy(ConfigSource configSource) { // return envy(valueParserFactory(), configSource); // } // // protected Envy envy(ValueParserFactory valueParserFactory, ConfigSource configSource) { // return new Envy(valueParserFactory, configSource); // } // // protected ValueParserFactory valueParserFactory() { // List<ValueParser<?>> valueParsers = new ArrayList<ValueParser<?>>(Envy.defaultValueParsers()); // return new ValueParserFactory(valueParsers); // } // // protected StubConfigSource configSource() { // return new StubConfigSource(); // } // } // // Path: src/test/java/com/statemachinesystems/envy/common/StubConfigSource.java // public class StubConfigSource implements ConfigSource { // // private final Map<Parameter, String> params; // // public StubConfigSource() { // this.params = new HashMap<Parameter, String>(); // } // // public StubConfigSource add(String parameter, String value) { // params.put(new Parameter(parameter), value); // return this; // } // // @Override // public String getValue(Parameter parameter) { // return params.get(parameter); // } // } // Path: src/test/java/com/statemachinesystems/envy/features/PrefixTest.java import com.statemachinesystems.envy.Name; import com.statemachinesystems.envy.Prefix; import com.statemachinesystems.envy.common.FeatureTest; import com.statemachinesystems.envy.common.StubConfigSource; import org.junit.Test; import static org.hamcrest.CoreMatchers.is; import static org.junit.Assert.assertThat; package com.statemachinesystems.envy.features; public class PrefixTest extends FeatureTest { @Prefix("xxx") @SuppressWarnings("unused") interface A { int inherited(); @Name("custom.name.inherited") int inheritedWithCustomName(); @Name("xxx") int customNameOverridden(); @Name("xxx") int customNameRemoved(); } @Prefix("custom.prefix") interface B extends A { int plain(); @Name("custom.name") int withCustomName(); @Name("overridden.custom.name") int customNameOverridden(); int customNameRemoved(); } @Override
protected StubConfigSource configSource() {
state-machine-systems/envy
src/main/java/com/statemachinesystems/envy/sources/SystemPropertyConfigSource.java
// Path: src/main/java/com/statemachinesystems/envy/ConfigSource.java // public interface ConfigSource { // // /** // * Retrieves the configuration value associated with the given parameter. // * // * @param parameter the parameter to retrieve. // * @return the value associated with the parameter, or null if no value was present // */ // String getValue(Parameter parameter); // } // // Path: src/main/java/com/statemachinesystems/envy/Parameter.java // public class Parameter { // // private static final String unicodeAlphaNumeric = "[\\p{L}\\d]+"; // private static final String separator = "[._]"; // // private static final Pattern validNamePattern = // Pattern.compile(String.format("(%s)(%s%s)*", unicodeAlphaNumeric, separator, unicodeAlphaNumeric)); // // public static Parameter fromMethodName(String name) { // int prefixLength = getBeanPropertyPrefixLength(name); // // return fromPropertyName(name.substring(prefixLength)); // } // // private static Parameter fromPropertyName(String name) { // PropertyNameParser parser = new PropertyNameParser(name); // // StringBuilder buf = new StringBuilder(); // for (String part : parser.parse()) { // if (buf.length() > 0) { // buf.append('_'); // } // buf.append(part.toUpperCase()); // } // return new Parameter(buf.toString()); // } // // private static int getBeanPropertyPrefixLength(String name) { // if (hasBeanPropertyPrefix(name, "get")) { // return "get".length(); // } else if (hasBeanPropertyPrefix(name, "is")) { // return "is".length(); // } else { // return 0; // } // } // // private static boolean hasBeanPropertyPrefix(String name, String prefix) { // return name.length() > prefix.length() // && name.startsWith(prefix) // && Character.isUpperCase(name.charAt(prefix.length())); // } // // private final String name; // // public Parameter(String name) { // if (name == null) { // throw new NullPointerException("Name must not be null"); // } // if (! validNamePattern.matcher(name).matches()) { // throw new IllegalArgumentException("Invalid name format: " + name); // } // this.name = name; // } // // public String asEnvironmentVariableName() { // return name.toUpperCase().replaceAll("\\.", "_"); // } // // public String asSystemPropertyName() { // return name.toLowerCase().replaceAll("_", "."); // } // // public Parameter join(Parameter other) { // return new Parameter( // String.format("%s_%s", this.asEnvironmentVariableName(), other.asEnvironmentVariableName())); // } // // @Override // public String toString() { // return this.asEnvironmentVariableName(); // } // // @Override // public boolean equals(Object o) { // if (this == o) return true; // if (o == null || getClass() != o.getClass()) return false; // // Parameter that = (Parameter) o; // // return this.asEnvironmentVariableName().equals(that.asEnvironmentVariableName()); // } // // @Override // public int hashCode() { // return this.asEnvironmentVariableName().hashCode(); // } // }
import com.statemachinesystems.envy.ConfigSource; import com.statemachinesystems.envy.Parameter;
package com.statemachinesystems.envy.sources; /** * A {@link com.statemachinesystems.envy.ConfigSource} implementation * that retrieves configuration values from JVM system properties using a * <code>lower.case.dotted</code> naming convention. */ public class SystemPropertyConfigSource implements ConfigSource { @Override
// Path: src/main/java/com/statemachinesystems/envy/ConfigSource.java // public interface ConfigSource { // // /** // * Retrieves the configuration value associated with the given parameter. // * // * @param parameter the parameter to retrieve. // * @return the value associated with the parameter, or null if no value was present // */ // String getValue(Parameter parameter); // } // // Path: src/main/java/com/statemachinesystems/envy/Parameter.java // public class Parameter { // // private static final String unicodeAlphaNumeric = "[\\p{L}\\d]+"; // private static final String separator = "[._]"; // // private static final Pattern validNamePattern = // Pattern.compile(String.format("(%s)(%s%s)*", unicodeAlphaNumeric, separator, unicodeAlphaNumeric)); // // public static Parameter fromMethodName(String name) { // int prefixLength = getBeanPropertyPrefixLength(name); // // return fromPropertyName(name.substring(prefixLength)); // } // // private static Parameter fromPropertyName(String name) { // PropertyNameParser parser = new PropertyNameParser(name); // // StringBuilder buf = new StringBuilder(); // for (String part : parser.parse()) { // if (buf.length() > 0) { // buf.append('_'); // } // buf.append(part.toUpperCase()); // } // return new Parameter(buf.toString()); // } // // private static int getBeanPropertyPrefixLength(String name) { // if (hasBeanPropertyPrefix(name, "get")) { // return "get".length(); // } else if (hasBeanPropertyPrefix(name, "is")) { // return "is".length(); // } else { // return 0; // } // } // // private static boolean hasBeanPropertyPrefix(String name, String prefix) { // return name.length() > prefix.length() // && name.startsWith(prefix) // && Character.isUpperCase(name.charAt(prefix.length())); // } // // private final String name; // // public Parameter(String name) { // if (name == null) { // throw new NullPointerException("Name must not be null"); // } // if (! validNamePattern.matcher(name).matches()) { // throw new IllegalArgumentException("Invalid name format: " + name); // } // this.name = name; // } // // public String asEnvironmentVariableName() { // return name.toUpperCase().replaceAll("\\.", "_"); // } // // public String asSystemPropertyName() { // return name.toLowerCase().replaceAll("_", "."); // } // // public Parameter join(Parameter other) { // return new Parameter( // String.format("%s_%s", this.asEnvironmentVariableName(), other.asEnvironmentVariableName())); // } // // @Override // public String toString() { // return this.asEnvironmentVariableName(); // } // // @Override // public boolean equals(Object o) { // if (this == o) return true; // if (o == null || getClass() != o.getClass()) return false; // // Parameter that = (Parameter) o; // // return this.asEnvironmentVariableName().equals(that.asEnvironmentVariableName()); // } // // @Override // public int hashCode() { // return this.asEnvironmentVariableName().hashCode(); // } // } // Path: src/main/java/com/statemachinesystems/envy/sources/SystemPropertyConfigSource.java import com.statemachinesystems.envy.ConfigSource; import com.statemachinesystems.envy.Parameter; package com.statemachinesystems.envy.sources; /** * A {@link com.statemachinesystems.envy.ConfigSource} implementation * that retrieves configuration values from JVM system properties using a * <code>lower.case.dotted</code> naming convention. */ public class SystemPropertyConfigSource implements ConfigSource { @Override
public String getValue(Parameter parameter) {
state-machine-systems/envy
src/test/java/com/statemachinesystems/envy/features/ToStringTest.java
// Path: src/main/java/com/statemachinesystems/envy/ConfigSource.java // public interface ConfigSource { // // /** // * Retrieves the configuration value associated with the given parameter. // * // * @param parameter the parameter to retrieve. // * @return the value associated with the parameter, or null if no value was present // */ // String getValue(Parameter parameter); // } // // Path: src/test/java/com/statemachinesystems/envy/common/FeatureTest.java // public abstract class FeatureTest { // // protected Envy envy() { // return envy(valueParserFactory(), configSource()); // } // // protected Envy envy(ValueParserFactory valueParserFactory) { // return envy(valueParserFactory, configSource()); // } // // protected Envy envy(ConfigSource configSource) { // return envy(valueParserFactory(), configSource); // } // // protected Envy envy(ValueParserFactory valueParserFactory, ConfigSource configSource) { // return new Envy(valueParserFactory, configSource); // } // // protected ValueParserFactory valueParserFactory() { // List<ValueParser<?>> valueParsers = new ArrayList<ValueParser<?>>(Envy.defaultValueParsers()); // return new ValueParserFactory(valueParsers); // } // // protected StubConfigSource configSource() { // return new StubConfigSource(); // } // }
import com.statemachinesystems.envy.ConfigSource; import com.statemachinesystems.envy.common.FeatureTest; import org.junit.Test; import static org.hamcrest.CoreMatchers.*; import static org.junit.Assert.assertThat;
package com.statemachinesystems.envy.features; public class ToStringTest extends FeatureTest { @SuppressWarnings("unused") public interface Config { int getFoo(); String getBar(); int[] getBaz(); } @Test public void toStringMethodFormatsUsingMethodNames() {
// Path: src/main/java/com/statemachinesystems/envy/ConfigSource.java // public interface ConfigSource { // // /** // * Retrieves the configuration value associated with the given parameter. // * // * @param parameter the parameter to retrieve. // * @return the value associated with the parameter, or null if no value was present // */ // String getValue(Parameter parameter); // } // // Path: src/test/java/com/statemachinesystems/envy/common/FeatureTest.java // public abstract class FeatureTest { // // protected Envy envy() { // return envy(valueParserFactory(), configSource()); // } // // protected Envy envy(ValueParserFactory valueParserFactory) { // return envy(valueParserFactory, configSource()); // } // // protected Envy envy(ConfigSource configSource) { // return envy(valueParserFactory(), configSource); // } // // protected Envy envy(ValueParserFactory valueParserFactory, ConfigSource configSource) { // return new Envy(valueParserFactory, configSource); // } // // protected ValueParserFactory valueParserFactory() { // List<ValueParser<?>> valueParsers = new ArrayList<ValueParser<?>>(Envy.defaultValueParsers()); // return new ValueParserFactory(valueParsers); // } // // protected StubConfigSource configSource() { // return new StubConfigSource(); // } // } // Path: src/test/java/com/statemachinesystems/envy/features/ToStringTest.java import com.statemachinesystems.envy.ConfigSource; import com.statemachinesystems.envy.common.FeatureTest; import org.junit.Test; import static org.hamcrest.CoreMatchers.*; import static org.junit.Assert.assertThat; package com.statemachinesystems.envy.features; public class ToStringTest extends FeatureTest { @SuppressWarnings("unused") public interface Config { int getFoo(); String getBar(); int[] getBaz(); } @Test public void toStringMethodFormatsUsingMethodNames() {
ConfigSource configSource = configSource()
state-machine-systems/envy
src/test/java/com/statemachinesystems/envy/DelegatingConfigSourceTest.java
// Path: src/test/java/com/statemachinesystems/envy/common/StubConfigSource.java // public class StubConfigSource implements ConfigSource { // // private final Map<Parameter, String> params; // // public StubConfigSource() { // this.params = new HashMap<Parameter, String>(); // } // // public StubConfigSource add(String parameter, String value) { // params.put(new Parameter(parameter), value); // return this; // } // // @Override // public String getValue(Parameter parameter) { // return params.get(parameter); // } // } // // Path: src/main/java/com/statemachinesystems/envy/sources/DelegatingConfigSource.java // public class DelegatingConfigSource implements ConfigSource { // // private final ConfigSource[] sources; // // /** // * Creates a {@link com.statemachinesystems.envy.sources.DelegatingConfigSource} using // * the given component sources in preference order. // * // * @param sources component {@link com.statemachinesystems.envy.ConfigSource}s in preference order // */ // public DelegatingConfigSource(ConfigSource... sources) { // this.sources = sources; // } // // @Override // public String getValue(Parameter parameter) { // for (ConfigSource source : sources) { // String value = source.getValue(parameter); // if (value != null) { // return value; // } // } // return null; // } // }
import com.statemachinesystems.envy.common.StubConfigSource; import com.statemachinesystems.envy.sources.DelegatingConfigSource; import org.junit.Test; import static org.junit.Assert.assertThat; import static org.hamcrest.CoreMatchers.equalTo; import static org.hamcrest.CoreMatchers.nullValue;
package com.statemachinesystems.envy; public class DelegatingConfigSourceTest { @Test public void looksUpValuesInMultipleConfigSources() {
// Path: src/test/java/com/statemachinesystems/envy/common/StubConfigSource.java // public class StubConfigSource implements ConfigSource { // // private final Map<Parameter, String> params; // // public StubConfigSource() { // this.params = new HashMap<Parameter, String>(); // } // // public StubConfigSource add(String parameter, String value) { // params.put(new Parameter(parameter), value); // return this; // } // // @Override // public String getValue(Parameter parameter) { // return params.get(parameter); // } // } // // Path: src/main/java/com/statemachinesystems/envy/sources/DelegatingConfigSource.java // public class DelegatingConfigSource implements ConfigSource { // // private final ConfigSource[] sources; // // /** // * Creates a {@link com.statemachinesystems.envy.sources.DelegatingConfigSource} using // * the given component sources in preference order. // * // * @param sources component {@link com.statemachinesystems.envy.ConfigSource}s in preference order // */ // public DelegatingConfigSource(ConfigSource... sources) { // this.sources = sources; // } // // @Override // public String getValue(Parameter parameter) { // for (ConfigSource source : sources) { // String value = source.getValue(parameter); // if (value != null) { // return value; // } // } // return null; // } // } // Path: src/test/java/com/statemachinesystems/envy/DelegatingConfigSourceTest.java import com.statemachinesystems.envy.common.StubConfigSource; import com.statemachinesystems.envy.sources.DelegatingConfigSource; import org.junit.Test; import static org.junit.Assert.assertThat; import static org.hamcrest.CoreMatchers.equalTo; import static org.hamcrest.CoreMatchers.nullValue; package com.statemachinesystems.envy; public class DelegatingConfigSourceTest { @Test public void looksUpValuesInMultipleConfigSources() {
ConfigSource source1 = new StubConfigSource().add("foo", "1");
state-machine-systems/envy
src/test/java/com/statemachinesystems/envy/DelegatingConfigSourceTest.java
// Path: src/test/java/com/statemachinesystems/envy/common/StubConfigSource.java // public class StubConfigSource implements ConfigSource { // // private final Map<Parameter, String> params; // // public StubConfigSource() { // this.params = new HashMap<Parameter, String>(); // } // // public StubConfigSource add(String parameter, String value) { // params.put(new Parameter(parameter), value); // return this; // } // // @Override // public String getValue(Parameter parameter) { // return params.get(parameter); // } // } // // Path: src/main/java/com/statemachinesystems/envy/sources/DelegatingConfigSource.java // public class DelegatingConfigSource implements ConfigSource { // // private final ConfigSource[] sources; // // /** // * Creates a {@link com.statemachinesystems.envy.sources.DelegatingConfigSource} using // * the given component sources in preference order. // * // * @param sources component {@link com.statemachinesystems.envy.ConfigSource}s in preference order // */ // public DelegatingConfigSource(ConfigSource... sources) { // this.sources = sources; // } // // @Override // public String getValue(Parameter parameter) { // for (ConfigSource source : sources) { // String value = source.getValue(parameter); // if (value != null) { // return value; // } // } // return null; // } // }
import com.statemachinesystems.envy.common.StubConfigSource; import com.statemachinesystems.envy.sources.DelegatingConfigSource; import org.junit.Test; import static org.junit.Assert.assertThat; import static org.hamcrest.CoreMatchers.equalTo; import static org.hamcrest.CoreMatchers.nullValue;
package com.statemachinesystems.envy; public class DelegatingConfigSourceTest { @Test public void looksUpValuesInMultipleConfigSources() { ConfigSource source1 = new StubConfigSource().add("foo", "1"); ConfigSource source2 = new StubConfigSource().add("bar", "2");
// Path: src/test/java/com/statemachinesystems/envy/common/StubConfigSource.java // public class StubConfigSource implements ConfigSource { // // private final Map<Parameter, String> params; // // public StubConfigSource() { // this.params = new HashMap<Parameter, String>(); // } // // public StubConfigSource add(String parameter, String value) { // params.put(new Parameter(parameter), value); // return this; // } // // @Override // public String getValue(Parameter parameter) { // return params.get(parameter); // } // } // // Path: src/main/java/com/statemachinesystems/envy/sources/DelegatingConfigSource.java // public class DelegatingConfigSource implements ConfigSource { // // private final ConfigSource[] sources; // // /** // * Creates a {@link com.statemachinesystems.envy.sources.DelegatingConfigSource} using // * the given component sources in preference order. // * // * @param sources component {@link com.statemachinesystems.envy.ConfigSource}s in preference order // */ // public DelegatingConfigSource(ConfigSource... sources) { // this.sources = sources; // } // // @Override // public String getValue(Parameter parameter) { // for (ConfigSource source : sources) { // String value = source.getValue(parameter); // if (value != null) { // return value; // } // } // return null; // } // } // Path: src/test/java/com/statemachinesystems/envy/DelegatingConfigSourceTest.java import com.statemachinesystems.envy.common.StubConfigSource; import com.statemachinesystems.envy.sources.DelegatingConfigSource; import org.junit.Test; import static org.junit.Assert.assertThat; import static org.hamcrest.CoreMatchers.equalTo; import static org.hamcrest.CoreMatchers.nullValue; package com.statemachinesystems.envy; public class DelegatingConfigSourceTest { @Test public void looksUpValuesInMultipleConfigSources() { ConfigSource source1 = new StubConfigSource().add("foo", "1"); ConfigSource source2 = new StubConfigSource().add("bar", "2");
ConfigSource configSource = new DelegatingConfigSource(source1, source2);
state-machine-systems/envy
src/main/java/com/statemachinesystems/envy/parsers/EnumValueParser.java
// Path: src/main/java/com/statemachinesystems/envy/ValueParser.java // public interface ValueParser<T> { // // /** // * Parse the given string into a value of the required type. // * // * @param value the string to parse // * @return a value of the required type // */ // T parseValue(String value); // // /** // * Provide the type required by this parser. // * // * @return a {@link java.lang.Class} object representing the required type // */ // Class<T> getValueClass(); // } // // Path: src/main/java/com/statemachinesystems/envy/Assertions.java // public static void assertEnum(Class<?> c) { // if (! c.isEnum()) { // throw new IllegalArgumentException( // String.format("%s is not an enum", c.getCanonicalName())); // } // }
import com.statemachinesystems.envy.ValueParser; import static com.statemachinesystems.envy.Assertions.assertEnum;
package com.statemachinesystems.envy.parsers; /** * {@link ValueParser} implementation for enum values. * * @param <T> the enum type to be parsed */ public class EnumValueParser<T extends Enum<T>> implements ValueParser<T> { private final Class<T> enumClass; public EnumValueParser(Class<T> enumClass) {
// Path: src/main/java/com/statemachinesystems/envy/ValueParser.java // public interface ValueParser<T> { // // /** // * Parse the given string into a value of the required type. // * // * @param value the string to parse // * @return a value of the required type // */ // T parseValue(String value); // // /** // * Provide the type required by this parser. // * // * @return a {@link java.lang.Class} object representing the required type // */ // Class<T> getValueClass(); // } // // Path: src/main/java/com/statemachinesystems/envy/Assertions.java // public static void assertEnum(Class<?> c) { // if (! c.isEnum()) { // throw new IllegalArgumentException( // String.format("%s is not an enum", c.getCanonicalName())); // } // } // Path: src/main/java/com/statemachinesystems/envy/parsers/EnumValueParser.java import com.statemachinesystems.envy.ValueParser; import static com.statemachinesystems.envy.Assertions.assertEnum; package com.statemachinesystems.envy.parsers; /** * {@link ValueParser} implementation for enum values. * * @param <T> the enum type to be parsed */ public class EnumValueParser<T extends Enum<T>> implements ValueParser<T> { private final Class<T> enumClass; public EnumValueParser(Class<T> enumClass) {
assertEnum(enumClass);
state-machine-systems/envy
src/main/java/com/statemachinesystems/envy/Conversions.java
// Path: src/main/java/com/statemachinesystems/envy/Assertions.java // public static void assertArray(Class<?> c) { // if (! c.isArray()) { // throw new IllegalArgumentException( // String.format("%s is not an array", c.getCanonicalName())); // } // }
import java.lang.reflect.Array; import java.util.HashMap; import java.util.Map; import static com.statemachinesystems.envy.Assertions.assertArray;
private static void registerBoxedClassForPrimitive(Class<?> primitive, Class<?> boxed) { primitiveToBoxed.put(primitive, boxed); boxedToPrimitive.put(boxed, primitive); } public static Class<?> toBoxed(Class<?> c) { return c.isPrimitive() ? primitiveToBoxed.get(c) : c; } public static Class<?> toPrimitive(Class<?> c) { if (c.isPrimitive()) { return c; } Class<?> primitive = boxedToPrimitive.get(c); if (primitive == null) { throw new IllegalArgumentException( String.format("%s is not a wrapper class", c.getSimpleName())); } return primitive; } public static boolean isPrimitiveArray(Class<?> c) { return c.isArray() && c.getComponentType().isPrimitive(); } @SuppressWarnings("unchecked") public static <T> T boxedArrayToPrimitiveArray(Object src) {
// Path: src/main/java/com/statemachinesystems/envy/Assertions.java // public static void assertArray(Class<?> c) { // if (! c.isArray()) { // throw new IllegalArgumentException( // String.format("%s is not an array", c.getCanonicalName())); // } // } // Path: src/main/java/com/statemachinesystems/envy/Conversions.java import java.lang.reflect.Array; import java.util.HashMap; import java.util.Map; import static com.statemachinesystems.envy.Assertions.assertArray; private static void registerBoxedClassForPrimitive(Class<?> primitive, Class<?> boxed) { primitiveToBoxed.put(primitive, boxed); boxedToPrimitive.put(boxed, primitive); } public static Class<?> toBoxed(Class<?> c) { return c.isPrimitive() ? primitiveToBoxed.get(c) : c; } public static Class<?> toPrimitive(Class<?> c) { if (c.isPrimitive()) { return c; } Class<?> primitive = boxedToPrimitive.get(c); if (primitive == null) { throw new IllegalArgumentException( String.format("%s is not a wrapper class", c.getSimpleName())); } return primitive; } public static boolean isPrimitiveArray(Class<?> c) { return c.isArray() && c.getComponentType().isPrimitive(); } @SuppressWarnings("unchecked") public static <T> T boxedArrayToPrimitiveArray(Object src) {
assertArray(src.getClass());
state-machine-systems/envy
src/test/java/com/statemachinesystems/envy/ConfigExtractorTest.java
// Path: src/test/java/com/statemachinesystems/envy/common/StubConfigSource.java // public class StubConfigSource implements ConfigSource { // // private final Map<Parameter, String> params; // // public StubConfigSource() { // this.params = new HashMap<Parameter, String>(); // } // // public StubConfigSource add(String parameter, String value) { // params.put(new Parameter(parameter), value); // return this; // } // // @Override // public String getValue(Parameter parameter) { // return params.get(parameter); // } // } // // Path: src/main/java/com/statemachinesystems/envy/parsers/IntegerValueParser.java // public class IntegerValueParser implements ValueParser<Integer> { // // @Override // public Integer parseValue(String value) { // return Integer.parseInt(value); // } // // @Override // public Class<Integer> getValueClass() { // return Integer.class; // } // // } // // Path: src/main/java/com/statemachinesystems/envy/parsers/ObjectAsStringValueParser.java // public class ObjectAsStringValueParser implements ValueParser<Object> { // // private final StringValueParser valueParser = new StringValueParser(); // // @Override // public Object parseValue(String value) { // return valueParser.parseValue(value); // } // // @Override // public Class<Object> getValueClass() { // return Object.class; // } // } // // Path: src/main/java/com/statemachinesystems/envy/parsers/StringValueParser.java // public class StringValueParser implements ValueParser<String> { // // @Override // public String parseValue(String value) { // return value; // } // // @Override // public Class<String> getValueClass() { // return String.class; // } // } // // Path: src/main/java/com/statemachinesystems/envy/values/ConfigValue.java // public interface ConfigValue<T> extends Serializable { // // static <T> ConfigValue<T> of(T value, ConfigValue.Status status, Method method) { // return method.getAnnotation(Sensitive.class) != null // ? new SensitiveValue<>(value, status) // : new ResolvedValue<>(value, status); // } // // enum Status { // CONFIGURED, // MISSING, // DEFAULTED // } // // /** // * Returns the fully extracted and parsed value, or a default. // * // * @param proxy the proxy this value belongs to // */ // T getValue(Object proxy); // // /** // * Returns the value formatted as a String. // * // * @param proxy the proxy this value belongs to // * @return the value formatted as a String // */ // String format(Object proxy); // // /** // * Indicates whether the value was found in the underlying {@link ConfigSource}, // * missing, or replaced by a default value. // */ // Status getStatus(); // } // // Path: src/main/java/com/statemachinesystems/envy/values/ConfigValue.java // enum Status { // CONFIGURED, // MISSING, // DEFAULTED // }
import com.statemachinesystems.envy.common.StubConfigSource; import com.statemachinesystems.envy.parsers.IntegerValueParser; import com.statemachinesystems.envy.parsers.ObjectAsStringValueParser; import com.statemachinesystems.envy.parsers.StringValueParser; import com.statemachinesystems.envy.values.ConfigValue; import com.statemachinesystems.envy.values.ConfigValue.Status; import org.junit.Before; import org.junit.Test; import static org.junit.Assert.*;
Integer missing(); @SuppressWarnings("deprecation") @Optional Integer optionalNonNull(); @SuppressWarnings("deprecation") @Optional Integer optionalNull(); Object methodWithObjectReturnType(); } @SuppressWarnings("unused") public interface BadConfigCombiningNullableWithPrimitive { @Nullable int notNullable(); } @SuppressWarnings("unused") public interface BadConfigWithOverriddenObjectMethod { @Override String toString(); } @SuppressWarnings("unused") public interface BadConfigWithVoidReturnType { void methodWithVoidReturnType(); }
// Path: src/test/java/com/statemachinesystems/envy/common/StubConfigSource.java // public class StubConfigSource implements ConfigSource { // // private final Map<Parameter, String> params; // // public StubConfigSource() { // this.params = new HashMap<Parameter, String>(); // } // // public StubConfigSource add(String parameter, String value) { // params.put(new Parameter(parameter), value); // return this; // } // // @Override // public String getValue(Parameter parameter) { // return params.get(parameter); // } // } // // Path: src/main/java/com/statemachinesystems/envy/parsers/IntegerValueParser.java // public class IntegerValueParser implements ValueParser<Integer> { // // @Override // public Integer parseValue(String value) { // return Integer.parseInt(value); // } // // @Override // public Class<Integer> getValueClass() { // return Integer.class; // } // // } // // Path: src/main/java/com/statemachinesystems/envy/parsers/ObjectAsStringValueParser.java // public class ObjectAsStringValueParser implements ValueParser<Object> { // // private final StringValueParser valueParser = new StringValueParser(); // // @Override // public Object parseValue(String value) { // return valueParser.parseValue(value); // } // // @Override // public Class<Object> getValueClass() { // return Object.class; // } // } // // Path: src/main/java/com/statemachinesystems/envy/parsers/StringValueParser.java // public class StringValueParser implements ValueParser<String> { // // @Override // public String parseValue(String value) { // return value; // } // // @Override // public Class<String> getValueClass() { // return String.class; // } // } // // Path: src/main/java/com/statemachinesystems/envy/values/ConfigValue.java // public interface ConfigValue<T> extends Serializable { // // static <T> ConfigValue<T> of(T value, ConfigValue.Status status, Method method) { // return method.getAnnotation(Sensitive.class) != null // ? new SensitiveValue<>(value, status) // : new ResolvedValue<>(value, status); // } // // enum Status { // CONFIGURED, // MISSING, // DEFAULTED // } // // /** // * Returns the fully extracted and parsed value, or a default. // * // * @param proxy the proxy this value belongs to // */ // T getValue(Object proxy); // // /** // * Returns the value formatted as a String. // * // * @param proxy the proxy this value belongs to // * @return the value formatted as a String // */ // String format(Object proxy); // // /** // * Indicates whether the value was found in the underlying {@link ConfigSource}, // * missing, or replaced by a default value. // */ // Status getStatus(); // } // // Path: src/main/java/com/statemachinesystems/envy/values/ConfigValue.java // enum Status { // CONFIGURED, // MISSING, // DEFAULTED // } // Path: src/test/java/com/statemachinesystems/envy/ConfigExtractorTest.java import com.statemachinesystems.envy.common.StubConfigSource; import com.statemachinesystems.envy.parsers.IntegerValueParser; import com.statemachinesystems.envy.parsers.ObjectAsStringValueParser; import com.statemachinesystems.envy.parsers.StringValueParser; import com.statemachinesystems.envy.values.ConfigValue; import com.statemachinesystems.envy.values.ConfigValue.Status; import org.junit.Before; import org.junit.Test; import static org.junit.Assert.*; Integer missing(); @SuppressWarnings("deprecation") @Optional Integer optionalNonNull(); @SuppressWarnings("deprecation") @Optional Integer optionalNull(); Object methodWithObjectReturnType(); } @SuppressWarnings("unused") public interface BadConfigCombiningNullableWithPrimitive { @Nullable int notNullable(); } @SuppressWarnings("unused") public interface BadConfigWithOverriddenObjectMethod { @Override String toString(); } @SuppressWarnings("unused") public interface BadConfigWithVoidReturnType { void methodWithVoidReturnType(); }
private StubConfigSource configSource;
state-machine-systems/envy
src/test/java/com/statemachinesystems/envy/ConfigExtractorTest.java
// Path: src/test/java/com/statemachinesystems/envy/common/StubConfigSource.java // public class StubConfigSource implements ConfigSource { // // private final Map<Parameter, String> params; // // public StubConfigSource() { // this.params = new HashMap<Parameter, String>(); // } // // public StubConfigSource add(String parameter, String value) { // params.put(new Parameter(parameter), value); // return this; // } // // @Override // public String getValue(Parameter parameter) { // return params.get(parameter); // } // } // // Path: src/main/java/com/statemachinesystems/envy/parsers/IntegerValueParser.java // public class IntegerValueParser implements ValueParser<Integer> { // // @Override // public Integer parseValue(String value) { // return Integer.parseInt(value); // } // // @Override // public Class<Integer> getValueClass() { // return Integer.class; // } // // } // // Path: src/main/java/com/statemachinesystems/envy/parsers/ObjectAsStringValueParser.java // public class ObjectAsStringValueParser implements ValueParser<Object> { // // private final StringValueParser valueParser = new StringValueParser(); // // @Override // public Object parseValue(String value) { // return valueParser.parseValue(value); // } // // @Override // public Class<Object> getValueClass() { // return Object.class; // } // } // // Path: src/main/java/com/statemachinesystems/envy/parsers/StringValueParser.java // public class StringValueParser implements ValueParser<String> { // // @Override // public String parseValue(String value) { // return value; // } // // @Override // public Class<String> getValueClass() { // return String.class; // } // } // // Path: src/main/java/com/statemachinesystems/envy/values/ConfigValue.java // public interface ConfigValue<T> extends Serializable { // // static <T> ConfigValue<T> of(T value, ConfigValue.Status status, Method method) { // return method.getAnnotation(Sensitive.class) != null // ? new SensitiveValue<>(value, status) // : new ResolvedValue<>(value, status); // } // // enum Status { // CONFIGURED, // MISSING, // DEFAULTED // } // // /** // * Returns the fully extracted and parsed value, or a default. // * // * @param proxy the proxy this value belongs to // */ // T getValue(Object proxy); // // /** // * Returns the value formatted as a String. // * // * @param proxy the proxy this value belongs to // * @return the value formatted as a String // */ // String format(Object proxy); // // /** // * Indicates whether the value was found in the underlying {@link ConfigSource}, // * missing, or replaced by a default value. // */ // Status getStatus(); // } // // Path: src/main/java/com/statemachinesystems/envy/values/ConfigValue.java // enum Status { // CONFIGURED, // MISSING, // DEFAULTED // }
import com.statemachinesystems.envy.common.StubConfigSource; import com.statemachinesystems.envy.parsers.IntegerValueParser; import com.statemachinesystems.envy.parsers.ObjectAsStringValueParser; import com.statemachinesystems.envy.parsers.StringValueParser; import com.statemachinesystems.envy.values.ConfigValue; import com.statemachinesystems.envy.values.ConfigValue.Status; import org.junit.Before; import org.junit.Test; import static org.junit.Assert.*;
public interface BadConfigWithOverriddenObjectMethod { @Override String toString(); } @SuppressWarnings("unused") public interface BadConfigWithVoidReturnType { void methodWithVoidReturnType(); } private StubConfigSource configSource; private ValueParserFactory valueParserFactory; private ConfigExtractor configExtractor; @Before public void setUp() { configSource = new StubConfigSource() .add("A_STRING", "foo") .add("A_BOXED_INTEGER", "10") .add("A_PRIMITIVE_INTEGER", "15") .add("AN_ARRAY_OF_BOXED_INTEGERS", "7") .add("AN_ARRAY_OF_PRIMITIVE_INTEGERS", "1,2,3") .add("CUSTOM_PARAMETER_NAME", "bar") .add("NULLABLE", "5") .add("OPTIONAL_NON_NULL", "6") .add("METHOD_WITH_OBJECT_RETURN_TYPE", "bar") .add("INT_IN_SUB_INTERFACE", "37") .add("INT_IN_SUB_SUB_INTERFACE", "98") .add("ANOTHER_STRING", "baz");
// Path: src/test/java/com/statemachinesystems/envy/common/StubConfigSource.java // public class StubConfigSource implements ConfigSource { // // private final Map<Parameter, String> params; // // public StubConfigSource() { // this.params = new HashMap<Parameter, String>(); // } // // public StubConfigSource add(String parameter, String value) { // params.put(new Parameter(parameter), value); // return this; // } // // @Override // public String getValue(Parameter parameter) { // return params.get(parameter); // } // } // // Path: src/main/java/com/statemachinesystems/envy/parsers/IntegerValueParser.java // public class IntegerValueParser implements ValueParser<Integer> { // // @Override // public Integer parseValue(String value) { // return Integer.parseInt(value); // } // // @Override // public Class<Integer> getValueClass() { // return Integer.class; // } // // } // // Path: src/main/java/com/statemachinesystems/envy/parsers/ObjectAsStringValueParser.java // public class ObjectAsStringValueParser implements ValueParser<Object> { // // private final StringValueParser valueParser = new StringValueParser(); // // @Override // public Object parseValue(String value) { // return valueParser.parseValue(value); // } // // @Override // public Class<Object> getValueClass() { // return Object.class; // } // } // // Path: src/main/java/com/statemachinesystems/envy/parsers/StringValueParser.java // public class StringValueParser implements ValueParser<String> { // // @Override // public String parseValue(String value) { // return value; // } // // @Override // public Class<String> getValueClass() { // return String.class; // } // } // // Path: src/main/java/com/statemachinesystems/envy/values/ConfigValue.java // public interface ConfigValue<T> extends Serializable { // // static <T> ConfigValue<T> of(T value, ConfigValue.Status status, Method method) { // return method.getAnnotation(Sensitive.class) != null // ? new SensitiveValue<>(value, status) // : new ResolvedValue<>(value, status); // } // // enum Status { // CONFIGURED, // MISSING, // DEFAULTED // } // // /** // * Returns the fully extracted and parsed value, or a default. // * // * @param proxy the proxy this value belongs to // */ // T getValue(Object proxy); // // /** // * Returns the value formatted as a String. // * // * @param proxy the proxy this value belongs to // * @return the value formatted as a String // */ // String format(Object proxy); // // /** // * Indicates whether the value was found in the underlying {@link ConfigSource}, // * missing, or replaced by a default value. // */ // Status getStatus(); // } // // Path: src/main/java/com/statemachinesystems/envy/values/ConfigValue.java // enum Status { // CONFIGURED, // MISSING, // DEFAULTED // } // Path: src/test/java/com/statemachinesystems/envy/ConfigExtractorTest.java import com.statemachinesystems.envy.common.StubConfigSource; import com.statemachinesystems.envy.parsers.IntegerValueParser; import com.statemachinesystems.envy.parsers.ObjectAsStringValueParser; import com.statemachinesystems.envy.parsers.StringValueParser; import com.statemachinesystems.envy.values.ConfigValue; import com.statemachinesystems.envy.values.ConfigValue.Status; import org.junit.Before; import org.junit.Test; import static org.junit.Assert.*; public interface BadConfigWithOverriddenObjectMethod { @Override String toString(); } @SuppressWarnings("unused") public interface BadConfigWithVoidReturnType { void methodWithVoidReturnType(); } private StubConfigSource configSource; private ValueParserFactory valueParserFactory; private ConfigExtractor configExtractor; @Before public void setUp() { configSource = new StubConfigSource() .add("A_STRING", "foo") .add("A_BOXED_INTEGER", "10") .add("A_PRIMITIVE_INTEGER", "15") .add("AN_ARRAY_OF_BOXED_INTEGERS", "7") .add("AN_ARRAY_OF_PRIMITIVE_INTEGERS", "1,2,3") .add("CUSTOM_PARAMETER_NAME", "bar") .add("NULLABLE", "5") .add("OPTIONAL_NON_NULL", "6") .add("METHOD_WITH_OBJECT_RETURN_TYPE", "bar") .add("INT_IN_SUB_INTERFACE", "37") .add("INT_IN_SUB_SUB_INTERFACE", "98") .add("ANOTHER_STRING", "baz");
valueParserFactory = new ValueParserFactory(new StringValueParser(), new IntegerValueParser(),
state-machine-systems/envy
src/test/java/com/statemachinesystems/envy/ConfigExtractorTest.java
// Path: src/test/java/com/statemachinesystems/envy/common/StubConfigSource.java // public class StubConfigSource implements ConfigSource { // // private final Map<Parameter, String> params; // // public StubConfigSource() { // this.params = new HashMap<Parameter, String>(); // } // // public StubConfigSource add(String parameter, String value) { // params.put(new Parameter(parameter), value); // return this; // } // // @Override // public String getValue(Parameter parameter) { // return params.get(parameter); // } // } // // Path: src/main/java/com/statemachinesystems/envy/parsers/IntegerValueParser.java // public class IntegerValueParser implements ValueParser<Integer> { // // @Override // public Integer parseValue(String value) { // return Integer.parseInt(value); // } // // @Override // public Class<Integer> getValueClass() { // return Integer.class; // } // // } // // Path: src/main/java/com/statemachinesystems/envy/parsers/ObjectAsStringValueParser.java // public class ObjectAsStringValueParser implements ValueParser<Object> { // // private final StringValueParser valueParser = new StringValueParser(); // // @Override // public Object parseValue(String value) { // return valueParser.parseValue(value); // } // // @Override // public Class<Object> getValueClass() { // return Object.class; // } // } // // Path: src/main/java/com/statemachinesystems/envy/parsers/StringValueParser.java // public class StringValueParser implements ValueParser<String> { // // @Override // public String parseValue(String value) { // return value; // } // // @Override // public Class<String> getValueClass() { // return String.class; // } // } // // Path: src/main/java/com/statemachinesystems/envy/values/ConfigValue.java // public interface ConfigValue<T> extends Serializable { // // static <T> ConfigValue<T> of(T value, ConfigValue.Status status, Method method) { // return method.getAnnotation(Sensitive.class) != null // ? new SensitiveValue<>(value, status) // : new ResolvedValue<>(value, status); // } // // enum Status { // CONFIGURED, // MISSING, // DEFAULTED // } // // /** // * Returns the fully extracted and parsed value, or a default. // * // * @param proxy the proxy this value belongs to // */ // T getValue(Object proxy); // // /** // * Returns the value formatted as a String. // * // * @param proxy the proxy this value belongs to // * @return the value formatted as a String // */ // String format(Object proxy); // // /** // * Indicates whether the value was found in the underlying {@link ConfigSource}, // * missing, or replaced by a default value. // */ // Status getStatus(); // } // // Path: src/main/java/com/statemachinesystems/envy/values/ConfigValue.java // enum Status { // CONFIGURED, // MISSING, // DEFAULTED // }
import com.statemachinesystems.envy.common.StubConfigSource; import com.statemachinesystems.envy.parsers.IntegerValueParser; import com.statemachinesystems.envy.parsers.ObjectAsStringValueParser; import com.statemachinesystems.envy.parsers.StringValueParser; import com.statemachinesystems.envy.values.ConfigValue; import com.statemachinesystems.envy.values.ConfigValue.Status; import org.junit.Before; import org.junit.Test; import static org.junit.Assert.*;
public interface BadConfigWithOverriddenObjectMethod { @Override String toString(); } @SuppressWarnings("unused") public interface BadConfigWithVoidReturnType { void methodWithVoidReturnType(); } private StubConfigSource configSource; private ValueParserFactory valueParserFactory; private ConfigExtractor configExtractor; @Before public void setUp() { configSource = new StubConfigSource() .add("A_STRING", "foo") .add("A_BOXED_INTEGER", "10") .add("A_PRIMITIVE_INTEGER", "15") .add("AN_ARRAY_OF_BOXED_INTEGERS", "7") .add("AN_ARRAY_OF_PRIMITIVE_INTEGERS", "1,2,3") .add("CUSTOM_PARAMETER_NAME", "bar") .add("NULLABLE", "5") .add("OPTIONAL_NON_NULL", "6") .add("METHOD_WITH_OBJECT_RETURN_TYPE", "bar") .add("INT_IN_SUB_INTERFACE", "37") .add("INT_IN_SUB_SUB_INTERFACE", "98") .add("ANOTHER_STRING", "baz");
// Path: src/test/java/com/statemachinesystems/envy/common/StubConfigSource.java // public class StubConfigSource implements ConfigSource { // // private final Map<Parameter, String> params; // // public StubConfigSource() { // this.params = new HashMap<Parameter, String>(); // } // // public StubConfigSource add(String parameter, String value) { // params.put(new Parameter(parameter), value); // return this; // } // // @Override // public String getValue(Parameter parameter) { // return params.get(parameter); // } // } // // Path: src/main/java/com/statemachinesystems/envy/parsers/IntegerValueParser.java // public class IntegerValueParser implements ValueParser<Integer> { // // @Override // public Integer parseValue(String value) { // return Integer.parseInt(value); // } // // @Override // public Class<Integer> getValueClass() { // return Integer.class; // } // // } // // Path: src/main/java/com/statemachinesystems/envy/parsers/ObjectAsStringValueParser.java // public class ObjectAsStringValueParser implements ValueParser<Object> { // // private final StringValueParser valueParser = new StringValueParser(); // // @Override // public Object parseValue(String value) { // return valueParser.parseValue(value); // } // // @Override // public Class<Object> getValueClass() { // return Object.class; // } // } // // Path: src/main/java/com/statemachinesystems/envy/parsers/StringValueParser.java // public class StringValueParser implements ValueParser<String> { // // @Override // public String parseValue(String value) { // return value; // } // // @Override // public Class<String> getValueClass() { // return String.class; // } // } // // Path: src/main/java/com/statemachinesystems/envy/values/ConfigValue.java // public interface ConfigValue<T> extends Serializable { // // static <T> ConfigValue<T> of(T value, ConfigValue.Status status, Method method) { // return method.getAnnotation(Sensitive.class) != null // ? new SensitiveValue<>(value, status) // : new ResolvedValue<>(value, status); // } // // enum Status { // CONFIGURED, // MISSING, // DEFAULTED // } // // /** // * Returns the fully extracted and parsed value, or a default. // * // * @param proxy the proxy this value belongs to // */ // T getValue(Object proxy); // // /** // * Returns the value formatted as a String. // * // * @param proxy the proxy this value belongs to // * @return the value formatted as a String // */ // String format(Object proxy); // // /** // * Indicates whether the value was found in the underlying {@link ConfigSource}, // * missing, or replaced by a default value. // */ // Status getStatus(); // } // // Path: src/main/java/com/statemachinesystems/envy/values/ConfigValue.java // enum Status { // CONFIGURED, // MISSING, // DEFAULTED // } // Path: src/test/java/com/statemachinesystems/envy/ConfigExtractorTest.java import com.statemachinesystems.envy.common.StubConfigSource; import com.statemachinesystems.envy.parsers.IntegerValueParser; import com.statemachinesystems.envy.parsers.ObjectAsStringValueParser; import com.statemachinesystems.envy.parsers.StringValueParser; import com.statemachinesystems.envy.values.ConfigValue; import com.statemachinesystems.envy.values.ConfigValue.Status; import org.junit.Before; import org.junit.Test; import static org.junit.Assert.*; public interface BadConfigWithOverriddenObjectMethod { @Override String toString(); } @SuppressWarnings("unused") public interface BadConfigWithVoidReturnType { void methodWithVoidReturnType(); } private StubConfigSource configSource; private ValueParserFactory valueParserFactory; private ConfigExtractor configExtractor; @Before public void setUp() { configSource = new StubConfigSource() .add("A_STRING", "foo") .add("A_BOXED_INTEGER", "10") .add("A_PRIMITIVE_INTEGER", "15") .add("AN_ARRAY_OF_BOXED_INTEGERS", "7") .add("AN_ARRAY_OF_PRIMITIVE_INTEGERS", "1,2,3") .add("CUSTOM_PARAMETER_NAME", "bar") .add("NULLABLE", "5") .add("OPTIONAL_NON_NULL", "6") .add("METHOD_WITH_OBJECT_RETURN_TYPE", "bar") .add("INT_IN_SUB_INTERFACE", "37") .add("INT_IN_SUB_SUB_INTERFACE", "98") .add("ANOTHER_STRING", "baz");
valueParserFactory = new ValueParserFactory(new StringValueParser(), new IntegerValueParser(),
state-machine-systems/envy
src/test/java/com/statemachinesystems/envy/ConfigExtractorTest.java
// Path: src/test/java/com/statemachinesystems/envy/common/StubConfigSource.java // public class StubConfigSource implements ConfigSource { // // private final Map<Parameter, String> params; // // public StubConfigSource() { // this.params = new HashMap<Parameter, String>(); // } // // public StubConfigSource add(String parameter, String value) { // params.put(new Parameter(parameter), value); // return this; // } // // @Override // public String getValue(Parameter parameter) { // return params.get(parameter); // } // } // // Path: src/main/java/com/statemachinesystems/envy/parsers/IntegerValueParser.java // public class IntegerValueParser implements ValueParser<Integer> { // // @Override // public Integer parseValue(String value) { // return Integer.parseInt(value); // } // // @Override // public Class<Integer> getValueClass() { // return Integer.class; // } // // } // // Path: src/main/java/com/statemachinesystems/envy/parsers/ObjectAsStringValueParser.java // public class ObjectAsStringValueParser implements ValueParser<Object> { // // private final StringValueParser valueParser = new StringValueParser(); // // @Override // public Object parseValue(String value) { // return valueParser.parseValue(value); // } // // @Override // public Class<Object> getValueClass() { // return Object.class; // } // } // // Path: src/main/java/com/statemachinesystems/envy/parsers/StringValueParser.java // public class StringValueParser implements ValueParser<String> { // // @Override // public String parseValue(String value) { // return value; // } // // @Override // public Class<String> getValueClass() { // return String.class; // } // } // // Path: src/main/java/com/statemachinesystems/envy/values/ConfigValue.java // public interface ConfigValue<T> extends Serializable { // // static <T> ConfigValue<T> of(T value, ConfigValue.Status status, Method method) { // return method.getAnnotation(Sensitive.class) != null // ? new SensitiveValue<>(value, status) // : new ResolvedValue<>(value, status); // } // // enum Status { // CONFIGURED, // MISSING, // DEFAULTED // } // // /** // * Returns the fully extracted and parsed value, or a default. // * // * @param proxy the proxy this value belongs to // */ // T getValue(Object proxy); // // /** // * Returns the value formatted as a String. // * // * @param proxy the proxy this value belongs to // * @return the value formatted as a String // */ // String format(Object proxy); // // /** // * Indicates whether the value was found in the underlying {@link ConfigSource}, // * missing, or replaced by a default value. // */ // Status getStatus(); // } // // Path: src/main/java/com/statemachinesystems/envy/values/ConfigValue.java // enum Status { // CONFIGURED, // MISSING, // DEFAULTED // }
import com.statemachinesystems.envy.common.StubConfigSource; import com.statemachinesystems.envy.parsers.IntegerValueParser; import com.statemachinesystems.envy.parsers.ObjectAsStringValueParser; import com.statemachinesystems.envy.parsers.StringValueParser; import com.statemachinesystems.envy.values.ConfigValue; import com.statemachinesystems.envy.values.ConfigValue.Status; import org.junit.Before; import org.junit.Test; import static org.junit.Assert.*;
@Override String toString(); } @SuppressWarnings("unused") public interface BadConfigWithVoidReturnType { void methodWithVoidReturnType(); } private StubConfigSource configSource; private ValueParserFactory valueParserFactory; private ConfigExtractor configExtractor; @Before public void setUp() { configSource = new StubConfigSource() .add("A_STRING", "foo") .add("A_BOXED_INTEGER", "10") .add("A_PRIMITIVE_INTEGER", "15") .add("AN_ARRAY_OF_BOXED_INTEGERS", "7") .add("AN_ARRAY_OF_PRIMITIVE_INTEGERS", "1,2,3") .add("CUSTOM_PARAMETER_NAME", "bar") .add("NULLABLE", "5") .add("OPTIONAL_NON_NULL", "6") .add("METHOD_WITH_OBJECT_RETURN_TYPE", "bar") .add("INT_IN_SUB_INTERFACE", "37") .add("INT_IN_SUB_SUB_INTERFACE", "98") .add("ANOTHER_STRING", "baz"); valueParserFactory = new ValueParserFactory(new StringValueParser(), new IntegerValueParser(),
// Path: src/test/java/com/statemachinesystems/envy/common/StubConfigSource.java // public class StubConfigSource implements ConfigSource { // // private final Map<Parameter, String> params; // // public StubConfigSource() { // this.params = new HashMap<Parameter, String>(); // } // // public StubConfigSource add(String parameter, String value) { // params.put(new Parameter(parameter), value); // return this; // } // // @Override // public String getValue(Parameter parameter) { // return params.get(parameter); // } // } // // Path: src/main/java/com/statemachinesystems/envy/parsers/IntegerValueParser.java // public class IntegerValueParser implements ValueParser<Integer> { // // @Override // public Integer parseValue(String value) { // return Integer.parseInt(value); // } // // @Override // public Class<Integer> getValueClass() { // return Integer.class; // } // // } // // Path: src/main/java/com/statemachinesystems/envy/parsers/ObjectAsStringValueParser.java // public class ObjectAsStringValueParser implements ValueParser<Object> { // // private final StringValueParser valueParser = new StringValueParser(); // // @Override // public Object parseValue(String value) { // return valueParser.parseValue(value); // } // // @Override // public Class<Object> getValueClass() { // return Object.class; // } // } // // Path: src/main/java/com/statemachinesystems/envy/parsers/StringValueParser.java // public class StringValueParser implements ValueParser<String> { // // @Override // public String parseValue(String value) { // return value; // } // // @Override // public Class<String> getValueClass() { // return String.class; // } // } // // Path: src/main/java/com/statemachinesystems/envy/values/ConfigValue.java // public interface ConfigValue<T> extends Serializable { // // static <T> ConfigValue<T> of(T value, ConfigValue.Status status, Method method) { // return method.getAnnotation(Sensitive.class) != null // ? new SensitiveValue<>(value, status) // : new ResolvedValue<>(value, status); // } // // enum Status { // CONFIGURED, // MISSING, // DEFAULTED // } // // /** // * Returns the fully extracted and parsed value, or a default. // * // * @param proxy the proxy this value belongs to // */ // T getValue(Object proxy); // // /** // * Returns the value formatted as a String. // * // * @param proxy the proxy this value belongs to // * @return the value formatted as a String // */ // String format(Object proxy); // // /** // * Indicates whether the value was found in the underlying {@link ConfigSource}, // * missing, or replaced by a default value. // */ // Status getStatus(); // } // // Path: src/main/java/com/statemachinesystems/envy/values/ConfigValue.java // enum Status { // CONFIGURED, // MISSING, // DEFAULTED // } // Path: src/test/java/com/statemachinesystems/envy/ConfigExtractorTest.java import com.statemachinesystems.envy.common.StubConfigSource; import com.statemachinesystems.envy.parsers.IntegerValueParser; import com.statemachinesystems.envy.parsers.ObjectAsStringValueParser; import com.statemachinesystems.envy.parsers.StringValueParser; import com.statemachinesystems.envy.values.ConfigValue; import com.statemachinesystems.envy.values.ConfigValue.Status; import org.junit.Before; import org.junit.Test; import static org.junit.Assert.*; @Override String toString(); } @SuppressWarnings("unused") public interface BadConfigWithVoidReturnType { void methodWithVoidReturnType(); } private StubConfigSource configSource; private ValueParserFactory valueParserFactory; private ConfigExtractor configExtractor; @Before public void setUp() { configSource = new StubConfigSource() .add("A_STRING", "foo") .add("A_BOXED_INTEGER", "10") .add("A_PRIMITIVE_INTEGER", "15") .add("AN_ARRAY_OF_BOXED_INTEGERS", "7") .add("AN_ARRAY_OF_PRIMITIVE_INTEGERS", "1,2,3") .add("CUSTOM_PARAMETER_NAME", "bar") .add("NULLABLE", "5") .add("OPTIONAL_NON_NULL", "6") .add("METHOD_WITH_OBJECT_RETURN_TYPE", "bar") .add("INT_IN_SUB_INTERFACE", "37") .add("INT_IN_SUB_SUB_INTERFACE", "98") .add("ANOTHER_STRING", "baz"); valueParserFactory = new ValueParserFactory(new StringValueParser(), new IntegerValueParser(),
new ObjectAsStringValueParser());
state-machine-systems/envy
src/test/java/com/statemachinesystems/envy/ConfigExtractorTest.java
// Path: src/test/java/com/statemachinesystems/envy/common/StubConfigSource.java // public class StubConfigSource implements ConfigSource { // // private final Map<Parameter, String> params; // // public StubConfigSource() { // this.params = new HashMap<Parameter, String>(); // } // // public StubConfigSource add(String parameter, String value) { // params.put(new Parameter(parameter), value); // return this; // } // // @Override // public String getValue(Parameter parameter) { // return params.get(parameter); // } // } // // Path: src/main/java/com/statemachinesystems/envy/parsers/IntegerValueParser.java // public class IntegerValueParser implements ValueParser<Integer> { // // @Override // public Integer parseValue(String value) { // return Integer.parseInt(value); // } // // @Override // public Class<Integer> getValueClass() { // return Integer.class; // } // // } // // Path: src/main/java/com/statemachinesystems/envy/parsers/ObjectAsStringValueParser.java // public class ObjectAsStringValueParser implements ValueParser<Object> { // // private final StringValueParser valueParser = new StringValueParser(); // // @Override // public Object parseValue(String value) { // return valueParser.parseValue(value); // } // // @Override // public Class<Object> getValueClass() { // return Object.class; // } // } // // Path: src/main/java/com/statemachinesystems/envy/parsers/StringValueParser.java // public class StringValueParser implements ValueParser<String> { // // @Override // public String parseValue(String value) { // return value; // } // // @Override // public Class<String> getValueClass() { // return String.class; // } // } // // Path: src/main/java/com/statemachinesystems/envy/values/ConfigValue.java // public interface ConfigValue<T> extends Serializable { // // static <T> ConfigValue<T> of(T value, ConfigValue.Status status, Method method) { // return method.getAnnotation(Sensitive.class) != null // ? new SensitiveValue<>(value, status) // : new ResolvedValue<>(value, status); // } // // enum Status { // CONFIGURED, // MISSING, // DEFAULTED // } // // /** // * Returns the fully extracted and parsed value, or a default. // * // * @param proxy the proxy this value belongs to // */ // T getValue(Object proxy); // // /** // * Returns the value formatted as a String. // * // * @param proxy the proxy this value belongs to // * @return the value formatted as a String // */ // String format(Object proxy); // // /** // * Indicates whether the value was found in the underlying {@link ConfigSource}, // * missing, or replaced by a default value. // */ // Status getStatus(); // } // // Path: src/main/java/com/statemachinesystems/envy/values/ConfigValue.java // enum Status { // CONFIGURED, // MISSING, // DEFAULTED // }
import com.statemachinesystems.envy.common.StubConfigSource; import com.statemachinesystems.envy.parsers.IntegerValueParser; import com.statemachinesystems.envy.parsers.ObjectAsStringValueParser; import com.statemachinesystems.envy.parsers.StringValueParser; import com.statemachinesystems.envy.values.ConfigValue; import com.statemachinesystems.envy.values.ConfigValue.Status; import org.junit.Before; import org.junit.Test; import static org.junit.Assert.*;
} private StubConfigSource configSource; private ValueParserFactory valueParserFactory; private ConfigExtractor configExtractor; @Before public void setUp() { configSource = new StubConfigSource() .add("A_STRING", "foo") .add("A_BOXED_INTEGER", "10") .add("A_PRIMITIVE_INTEGER", "15") .add("AN_ARRAY_OF_BOXED_INTEGERS", "7") .add("AN_ARRAY_OF_PRIMITIVE_INTEGERS", "1,2,3") .add("CUSTOM_PARAMETER_NAME", "bar") .add("NULLABLE", "5") .add("OPTIONAL_NON_NULL", "6") .add("METHOD_WITH_OBJECT_RETURN_TYPE", "bar") .add("INT_IN_SUB_INTERFACE", "37") .add("INT_IN_SUB_SUB_INTERFACE", "98") .add("ANOTHER_STRING", "baz"); valueParserFactory = new ValueParserFactory(new StringValueParser(), new IntegerValueParser(), new ObjectAsStringValueParser()); configExtractor = new ConfigExtractor(valueParserFactory, configSource); } @Test public void retrievesStringProperty() {
// Path: src/test/java/com/statemachinesystems/envy/common/StubConfigSource.java // public class StubConfigSource implements ConfigSource { // // private final Map<Parameter, String> params; // // public StubConfigSource() { // this.params = new HashMap<Parameter, String>(); // } // // public StubConfigSource add(String parameter, String value) { // params.put(new Parameter(parameter), value); // return this; // } // // @Override // public String getValue(Parameter parameter) { // return params.get(parameter); // } // } // // Path: src/main/java/com/statemachinesystems/envy/parsers/IntegerValueParser.java // public class IntegerValueParser implements ValueParser<Integer> { // // @Override // public Integer parseValue(String value) { // return Integer.parseInt(value); // } // // @Override // public Class<Integer> getValueClass() { // return Integer.class; // } // // } // // Path: src/main/java/com/statemachinesystems/envy/parsers/ObjectAsStringValueParser.java // public class ObjectAsStringValueParser implements ValueParser<Object> { // // private final StringValueParser valueParser = new StringValueParser(); // // @Override // public Object parseValue(String value) { // return valueParser.parseValue(value); // } // // @Override // public Class<Object> getValueClass() { // return Object.class; // } // } // // Path: src/main/java/com/statemachinesystems/envy/parsers/StringValueParser.java // public class StringValueParser implements ValueParser<String> { // // @Override // public String parseValue(String value) { // return value; // } // // @Override // public Class<String> getValueClass() { // return String.class; // } // } // // Path: src/main/java/com/statemachinesystems/envy/values/ConfigValue.java // public interface ConfigValue<T> extends Serializable { // // static <T> ConfigValue<T> of(T value, ConfigValue.Status status, Method method) { // return method.getAnnotation(Sensitive.class) != null // ? new SensitiveValue<>(value, status) // : new ResolvedValue<>(value, status); // } // // enum Status { // CONFIGURED, // MISSING, // DEFAULTED // } // // /** // * Returns the fully extracted and parsed value, or a default. // * // * @param proxy the proxy this value belongs to // */ // T getValue(Object proxy); // // /** // * Returns the value formatted as a String. // * // * @param proxy the proxy this value belongs to // * @return the value formatted as a String // */ // String format(Object proxy); // // /** // * Indicates whether the value was found in the underlying {@link ConfigSource}, // * missing, or replaced by a default value. // */ // Status getStatus(); // } // // Path: src/main/java/com/statemachinesystems/envy/values/ConfigValue.java // enum Status { // CONFIGURED, // MISSING, // DEFAULTED // } // Path: src/test/java/com/statemachinesystems/envy/ConfigExtractorTest.java import com.statemachinesystems.envy.common.StubConfigSource; import com.statemachinesystems.envy.parsers.IntegerValueParser; import com.statemachinesystems.envy.parsers.ObjectAsStringValueParser; import com.statemachinesystems.envy.parsers.StringValueParser; import com.statemachinesystems.envy.values.ConfigValue; import com.statemachinesystems.envy.values.ConfigValue.Status; import org.junit.Before; import org.junit.Test; import static org.junit.Assert.*; } private StubConfigSource configSource; private ValueParserFactory valueParserFactory; private ConfigExtractor configExtractor; @Before public void setUp() { configSource = new StubConfigSource() .add("A_STRING", "foo") .add("A_BOXED_INTEGER", "10") .add("A_PRIMITIVE_INTEGER", "15") .add("AN_ARRAY_OF_BOXED_INTEGERS", "7") .add("AN_ARRAY_OF_PRIMITIVE_INTEGERS", "1,2,3") .add("CUSTOM_PARAMETER_NAME", "bar") .add("NULLABLE", "5") .add("OPTIONAL_NON_NULL", "6") .add("METHOD_WITH_OBJECT_RETURN_TYPE", "bar") .add("INT_IN_SUB_INTERFACE", "37") .add("INT_IN_SUB_SUB_INTERFACE", "98") .add("ANOTHER_STRING", "baz"); valueParserFactory = new ValueParserFactory(new StringValueParser(), new IntegerValueParser(), new ObjectAsStringValueParser()); configExtractor = new ConfigExtractor(valueParserFactory, configSource); } @Test public void retrievesStringProperty() {
assertEquals("foo", getValue("getAString", Status.CONFIGURED));
state-machine-systems/envy
src/test/java/com/statemachinesystems/envy/ConfigExtractorTest.java
// Path: src/test/java/com/statemachinesystems/envy/common/StubConfigSource.java // public class StubConfigSource implements ConfigSource { // // private final Map<Parameter, String> params; // // public StubConfigSource() { // this.params = new HashMap<Parameter, String>(); // } // // public StubConfigSource add(String parameter, String value) { // params.put(new Parameter(parameter), value); // return this; // } // // @Override // public String getValue(Parameter parameter) { // return params.get(parameter); // } // } // // Path: src/main/java/com/statemachinesystems/envy/parsers/IntegerValueParser.java // public class IntegerValueParser implements ValueParser<Integer> { // // @Override // public Integer parseValue(String value) { // return Integer.parseInt(value); // } // // @Override // public Class<Integer> getValueClass() { // return Integer.class; // } // // } // // Path: src/main/java/com/statemachinesystems/envy/parsers/ObjectAsStringValueParser.java // public class ObjectAsStringValueParser implements ValueParser<Object> { // // private final StringValueParser valueParser = new StringValueParser(); // // @Override // public Object parseValue(String value) { // return valueParser.parseValue(value); // } // // @Override // public Class<Object> getValueClass() { // return Object.class; // } // } // // Path: src/main/java/com/statemachinesystems/envy/parsers/StringValueParser.java // public class StringValueParser implements ValueParser<String> { // // @Override // public String parseValue(String value) { // return value; // } // // @Override // public Class<String> getValueClass() { // return String.class; // } // } // // Path: src/main/java/com/statemachinesystems/envy/values/ConfigValue.java // public interface ConfigValue<T> extends Serializable { // // static <T> ConfigValue<T> of(T value, ConfigValue.Status status, Method method) { // return method.getAnnotation(Sensitive.class) != null // ? new SensitiveValue<>(value, status) // : new ResolvedValue<>(value, status); // } // // enum Status { // CONFIGURED, // MISSING, // DEFAULTED // } // // /** // * Returns the fully extracted and parsed value, or a default. // * // * @param proxy the proxy this value belongs to // */ // T getValue(Object proxy); // // /** // * Returns the value formatted as a String. // * // * @param proxy the proxy this value belongs to // * @return the value formatted as a String // */ // String format(Object proxy); // // /** // * Indicates whether the value was found in the underlying {@link ConfigSource}, // * missing, or replaced by a default value. // */ // Status getStatus(); // } // // Path: src/main/java/com/statemachinesystems/envy/values/ConfigValue.java // enum Status { // CONFIGURED, // MISSING, // DEFAULTED // }
import com.statemachinesystems.envy.common.StubConfigSource; import com.statemachinesystems.envy.parsers.IntegerValueParser; import com.statemachinesystems.envy.parsers.ObjectAsStringValueParser; import com.statemachinesystems.envy.parsers.StringValueParser; import com.statemachinesystems.envy.values.ConfigValue; import com.statemachinesystems.envy.values.ConfigValue.Status; import org.junit.Before; import org.junit.Test; import static org.junit.Assert.*;
} @Test(expected = IllegalArgumentException.class) public void voidReturnTypesAreRejected() { StubConfigSource configSource = new StubConfigSource().add("method.with.void.return.type", "bad"); ValueParserFactory valueParserFactory = new ValueParserFactory(new ValueParser<Void>() { @Override public Void parseValue(String value) { return null; } @Override public Class<Void> getValueClass() { return Void.class; } }); ConfigExtractor configExtractor = new ConfigExtractor(valueParserFactory, configSource); configExtractor.extractConfigMap(BadConfigWithVoidReturnType.class); } @Test public void mapKeysAreOrderedAlphabetically() { String previousKey = ""; for (String methodName : configExtractor.extractConfigMap(ExampleConfig.class).getMethodNames()) { assertTrue(previousKey.compareTo(methodName) <= 0); previousKey = methodName; } } private Object getValue(String methodName, Status expectedStatus) {
// Path: src/test/java/com/statemachinesystems/envy/common/StubConfigSource.java // public class StubConfigSource implements ConfigSource { // // private final Map<Parameter, String> params; // // public StubConfigSource() { // this.params = new HashMap<Parameter, String>(); // } // // public StubConfigSource add(String parameter, String value) { // params.put(new Parameter(parameter), value); // return this; // } // // @Override // public String getValue(Parameter parameter) { // return params.get(parameter); // } // } // // Path: src/main/java/com/statemachinesystems/envy/parsers/IntegerValueParser.java // public class IntegerValueParser implements ValueParser<Integer> { // // @Override // public Integer parseValue(String value) { // return Integer.parseInt(value); // } // // @Override // public Class<Integer> getValueClass() { // return Integer.class; // } // // } // // Path: src/main/java/com/statemachinesystems/envy/parsers/ObjectAsStringValueParser.java // public class ObjectAsStringValueParser implements ValueParser<Object> { // // private final StringValueParser valueParser = new StringValueParser(); // // @Override // public Object parseValue(String value) { // return valueParser.parseValue(value); // } // // @Override // public Class<Object> getValueClass() { // return Object.class; // } // } // // Path: src/main/java/com/statemachinesystems/envy/parsers/StringValueParser.java // public class StringValueParser implements ValueParser<String> { // // @Override // public String parseValue(String value) { // return value; // } // // @Override // public Class<String> getValueClass() { // return String.class; // } // } // // Path: src/main/java/com/statemachinesystems/envy/values/ConfigValue.java // public interface ConfigValue<T> extends Serializable { // // static <T> ConfigValue<T> of(T value, ConfigValue.Status status, Method method) { // return method.getAnnotation(Sensitive.class) != null // ? new SensitiveValue<>(value, status) // : new ResolvedValue<>(value, status); // } // // enum Status { // CONFIGURED, // MISSING, // DEFAULTED // } // // /** // * Returns the fully extracted and parsed value, or a default. // * // * @param proxy the proxy this value belongs to // */ // T getValue(Object proxy); // // /** // * Returns the value formatted as a String. // * // * @param proxy the proxy this value belongs to // * @return the value formatted as a String // */ // String format(Object proxy); // // /** // * Indicates whether the value was found in the underlying {@link ConfigSource}, // * missing, or replaced by a default value. // */ // Status getStatus(); // } // // Path: src/main/java/com/statemachinesystems/envy/values/ConfigValue.java // enum Status { // CONFIGURED, // MISSING, // DEFAULTED // } // Path: src/test/java/com/statemachinesystems/envy/ConfigExtractorTest.java import com.statemachinesystems.envy.common.StubConfigSource; import com.statemachinesystems.envy.parsers.IntegerValueParser; import com.statemachinesystems.envy.parsers.ObjectAsStringValueParser; import com.statemachinesystems.envy.parsers.StringValueParser; import com.statemachinesystems.envy.values.ConfigValue; import com.statemachinesystems.envy.values.ConfigValue.Status; import org.junit.Before; import org.junit.Test; import static org.junit.Assert.*; } @Test(expected = IllegalArgumentException.class) public void voidReturnTypesAreRejected() { StubConfigSource configSource = new StubConfigSource().add("method.with.void.return.type", "bad"); ValueParserFactory valueParserFactory = new ValueParserFactory(new ValueParser<Void>() { @Override public Void parseValue(String value) { return null; } @Override public Class<Void> getValueClass() { return Void.class; } }); ConfigExtractor configExtractor = new ConfigExtractor(valueParserFactory, configSource); configExtractor.extractConfigMap(BadConfigWithVoidReturnType.class); } @Test public void mapKeysAreOrderedAlphabetically() { String previousKey = ""; for (String methodName : configExtractor.extractConfigMap(ExampleConfig.class).getMethodNames()) { assertTrue(previousKey.compareTo(methodName) <= 0); previousKey = methodName; } } private Object getValue(String methodName, Status expectedStatus) {
ConfigValue configValue = configExtractor.extractConfigMap(ExampleConfig.class).getValue(methodName);
state-machine-systems/envy
src/test/java/com/statemachinesystems/envy/ValueParserFactoryTest.java
// Path: src/test/java/com/statemachinesystems/envy/common/MyClass.java // public class MyClass { // private final String value; // // public MyClass(String value) { // this.value = value; // } // // @Override // public boolean equals(Object o) { // if (this == o) return true; // if (o == null || getClass() != o.getClass()) return false; // // MyClass myClass = (MyClass) o; // // if (!value.equals(myClass.value)) return false; // // return true; // } // // @Override // public int hashCode() { // return value.hashCode(); // } // // @Override // public String toString() { // return "MyClass{" + // "value='" + value + '\'' + // '}'; // } // } // // Path: src/test/java/com/statemachinesystems/envy/common/MyEnum.java // public enum MyEnum { // FOO, BAR, BAZ // } // // Path: src/main/java/com/statemachinesystems/envy/parsers/BooleanValueParser.java // public class BooleanValueParser implements ValueParser<Boolean> { // // public static BooleanValueParser createParser(Map<String, Boolean> acceptedValues) { // Map<String, Boolean> lowerCasedValues = new HashMap<String, Boolean>(); // for (Map.Entry<String, Boolean> entry : acceptedValues.entrySet()) { // lowerCasedValues.put(entry.getKey().toLowerCase(), entry.getValue()); // } // return new BooleanValueParser(lowerCasedValues); // } // // private static Map<String, Boolean> defaultAcceptedValues() { // Map<String, Boolean> acceptedValues = new HashMap<String, Boolean>(); // // acceptedValues.put("true", Boolean.TRUE); // acceptedValues.put("false", Boolean.FALSE); // acceptedValues.put("yes", Boolean.TRUE); // acceptedValues.put("no", Boolean.FALSE); // acceptedValues.put("y", Boolean.TRUE); // acceptedValues.put("n", Boolean.FALSE); // acceptedValues.put("on", Boolean.TRUE); // acceptedValues.put("off", Boolean.FALSE); // // return acceptedValues; // } // // private final Map<String, Boolean> acceptedValues; // // public BooleanValueParser() { // this(defaultAcceptedValues()); // } // // private BooleanValueParser(Map<String, Boolean> acceptedValues) { // this.acceptedValues = acceptedValues; // } // // @Override // public Boolean parseValue(String value) { // String key = value.toLowerCase(); // if (! acceptedValues.containsKey(key)) { // throw new IllegalArgumentException( // String.format("No registered Boolean value for '%s'", value)); // } // return acceptedValues.get(key); // } // // @Override // public Class<Boolean> getValueClass() { // return Boolean.class; // } // }
import com.statemachinesystems.envy.common.MyClass; import com.statemachinesystems.envy.common.MyEnum; import com.statemachinesystems.envy.parsers.BooleanValueParser; import org.junit.Test; import java.util.Random; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertArrayEquals; import static org.junit.Assert.assertNull;
package com.statemachinesystems.envy; public class ValueParserFactoryTest { private final ValueParserFactory valueParserFactory =
// Path: src/test/java/com/statemachinesystems/envy/common/MyClass.java // public class MyClass { // private final String value; // // public MyClass(String value) { // this.value = value; // } // // @Override // public boolean equals(Object o) { // if (this == o) return true; // if (o == null || getClass() != o.getClass()) return false; // // MyClass myClass = (MyClass) o; // // if (!value.equals(myClass.value)) return false; // // return true; // } // // @Override // public int hashCode() { // return value.hashCode(); // } // // @Override // public String toString() { // return "MyClass{" + // "value='" + value + '\'' + // '}'; // } // } // // Path: src/test/java/com/statemachinesystems/envy/common/MyEnum.java // public enum MyEnum { // FOO, BAR, BAZ // } // // Path: src/main/java/com/statemachinesystems/envy/parsers/BooleanValueParser.java // public class BooleanValueParser implements ValueParser<Boolean> { // // public static BooleanValueParser createParser(Map<String, Boolean> acceptedValues) { // Map<String, Boolean> lowerCasedValues = new HashMap<String, Boolean>(); // for (Map.Entry<String, Boolean> entry : acceptedValues.entrySet()) { // lowerCasedValues.put(entry.getKey().toLowerCase(), entry.getValue()); // } // return new BooleanValueParser(lowerCasedValues); // } // // private static Map<String, Boolean> defaultAcceptedValues() { // Map<String, Boolean> acceptedValues = new HashMap<String, Boolean>(); // // acceptedValues.put("true", Boolean.TRUE); // acceptedValues.put("false", Boolean.FALSE); // acceptedValues.put("yes", Boolean.TRUE); // acceptedValues.put("no", Boolean.FALSE); // acceptedValues.put("y", Boolean.TRUE); // acceptedValues.put("n", Boolean.FALSE); // acceptedValues.put("on", Boolean.TRUE); // acceptedValues.put("off", Boolean.FALSE); // // return acceptedValues; // } // // private final Map<String, Boolean> acceptedValues; // // public BooleanValueParser() { // this(defaultAcceptedValues()); // } // // private BooleanValueParser(Map<String, Boolean> acceptedValues) { // this.acceptedValues = acceptedValues; // } // // @Override // public Boolean parseValue(String value) { // String key = value.toLowerCase(); // if (! acceptedValues.containsKey(key)) { // throw new IllegalArgumentException( // String.format("No registered Boolean value for '%s'", value)); // } // return acceptedValues.get(key); // } // // @Override // public Class<Boolean> getValueClass() { // return Boolean.class; // } // } // Path: src/test/java/com/statemachinesystems/envy/ValueParserFactoryTest.java import com.statemachinesystems.envy.common.MyClass; import com.statemachinesystems.envy.common.MyEnum; import com.statemachinesystems.envy.parsers.BooleanValueParser; import org.junit.Test; import java.util.Random; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertArrayEquals; import static org.junit.Assert.assertNull; package com.statemachinesystems.envy; public class ValueParserFactoryTest { private final ValueParserFactory valueParserFactory =
new ValueParserFactory(new BooleanValueParser());
state-machine-systems/envy
src/test/java/com/statemachinesystems/envy/ValueParserFactoryTest.java
// Path: src/test/java/com/statemachinesystems/envy/common/MyClass.java // public class MyClass { // private final String value; // // public MyClass(String value) { // this.value = value; // } // // @Override // public boolean equals(Object o) { // if (this == o) return true; // if (o == null || getClass() != o.getClass()) return false; // // MyClass myClass = (MyClass) o; // // if (!value.equals(myClass.value)) return false; // // return true; // } // // @Override // public int hashCode() { // return value.hashCode(); // } // // @Override // public String toString() { // return "MyClass{" + // "value='" + value + '\'' + // '}'; // } // } // // Path: src/test/java/com/statemachinesystems/envy/common/MyEnum.java // public enum MyEnum { // FOO, BAR, BAZ // } // // Path: src/main/java/com/statemachinesystems/envy/parsers/BooleanValueParser.java // public class BooleanValueParser implements ValueParser<Boolean> { // // public static BooleanValueParser createParser(Map<String, Boolean> acceptedValues) { // Map<String, Boolean> lowerCasedValues = new HashMap<String, Boolean>(); // for (Map.Entry<String, Boolean> entry : acceptedValues.entrySet()) { // lowerCasedValues.put(entry.getKey().toLowerCase(), entry.getValue()); // } // return new BooleanValueParser(lowerCasedValues); // } // // private static Map<String, Boolean> defaultAcceptedValues() { // Map<String, Boolean> acceptedValues = new HashMap<String, Boolean>(); // // acceptedValues.put("true", Boolean.TRUE); // acceptedValues.put("false", Boolean.FALSE); // acceptedValues.put("yes", Boolean.TRUE); // acceptedValues.put("no", Boolean.FALSE); // acceptedValues.put("y", Boolean.TRUE); // acceptedValues.put("n", Boolean.FALSE); // acceptedValues.put("on", Boolean.TRUE); // acceptedValues.put("off", Boolean.FALSE); // // return acceptedValues; // } // // private final Map<String, Boolean> acceptedValues; // // public BooleanValueParser() { // this(defaultAcceptedValues()); // } // // private BooleanValueParser(Map<String, Boolean> acceptedValues) { // this.acceptedValues = acceptedValues; // } // // @Override // public Boolean parseValue(String value) { // String key = value.toLowerCase(); // if (! acceptedValues.containsKey(key)) { // throw new IllegalArgumentException( // String.format("No registered Boolean value for '%s'", value)); // } // return acceptedValues.get(key); // } // // @Override // public Class<Boolean> getValueClass() { // return Boolean.class; // } // }
import com.statemachinesystems.envy.common.MyClass; import com.statemachinesystems.envy.common.MyEnum; import com.statemachinesystems.envy.parsers.BooleanValueParser; import org.junit.Test; import java.util.Random; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertArrayEquals; import static org.junit.Assert.assertNull;
package com.statemachinesystems.envy; public class ValueParserFactoryTest { private final ValueParserFactory valueParserFactory = new ValueParserFactory(new BooleanValueParser()); @Test public void createsParserForRegisteredType() { ValueParser<?> parser = valueParserFactory.getValueParser(Boolean.class); assertEquals(Boolean.TRUE, parser.parseValue("true")); } @Test public void createsParserForBoxedRegisteredType() { ValueParser<?> parser = valueParserFactory.getValueParser(boolean.class); assertEquals(Boolean.FALSE, parser.parseValue("false")); } @Test public void createsParserForEnumType() {
// Path: src/test/java/com/statemachinesystems/envy/common/MyClass.java // public class MyClass { // private final String value; // // public MyClass(String value) { // this.value = value; // } // // @Override // public boolean equals(Object o) { // if (this == o) return true; // if (o == null || getClass() != o.getClass()) return false; // // MyClass myClass = (MyClass) o; // // if (!value.equals(myClass.value)) return false; // // return true; // } // // @Override // public int hashCode() { // return value.hashCode(); // } // // @Override // public String toString() { // return "MyClass{" + // "value='" + value + '\'' + // '}'; // } // } // // Path: src/test/java/com/statemachinesystems/envy/common/MyEnum.java // public enum MyEnum { // FOO, BAR, BAZ // } // // Path: src/main/java/com/statemachinesystems/envy/parsers/BooleanValueParser.java // public class BooleanValueParser implements ValueParser<Boolean> { // // public static BooleanValueParser createParser(Map<String, Boolean> acceptedValues) { // Map<String, Boolean> lowerCasedValues = new HashMap<String, Boolean>(); // for (Map.Entry<String, Boolean> entry : acceptedValues.entrySet()) { // lowerCasedValues.put(entry.getKey().toLowerCase(), entry.getValue()); // } // return new BooleanValueParser(lowerCasedValues); // } // // private static Map<String, Boolean> defaultAcceptedValues() { // Map<String, Boolean> acceptedValues = new HashMap<String, Boolean>(); // // acceptedValues.put("true", Boolean.TRUE); // acceptedValues.put("false", Boolean.FALSE); // acceptedValues.put("yes", Boolean.TRUE); // acceptedValues.put("no", Boolean.FALSE); // acceptedValues.put("y", Boolean.TRUE); // acceptedValues.put("n", Boolean.FALSE); // acceptedValues.put("on", Boolean.TRUE); // acceptedValues.put("off", Boolean.FALSE); // // return acceptedValues; // } // // private final Map<String, Boolean> acceptedValues; // // public BooleanValueParser() { // this(defaultAcceptedValues()); // } // // private BooleanValueParser(Map<String, Boolean> acceptedValues) { // this.acceptedValues = acceptedValues; // } // // @Override // public Boolean parseValue(String value) { // String key = value.toLowerCase(); // if (! acceptedValues.containsKey(key)) { // throw new IllegalArgumentException( // String.format("No registered Boolean value for '%s'", value)); // } // return acceptedValues.get(key); // } // // @Override // public Class<Boolean> getValueClass() { // return Boolean.class; // } // } // Path: src/test/java/com/statemachinesystems/envy/ValueParserFactoryTest.java import com.statemachinesystems.envy.common.MyClass; import com.statemachinesystems.envy.common.MyEnum; import com.statemachinesystems.envy.parsers.BooleanValueParser; import org.junit.Test; import java.util.Random; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertArrayEquals; import static org.junit.Assert.assertNull; package com.statemachinesystems.envy; public class ValueParserFactoryTest { private final ValueParserFactory valueParserFactory = new ValueParserFactory(new BooleanValueParser()); @Test public void createsParserForRegisteredType() { ValueParser<?> parser = valueParserFactory.getValueParser(Boolean.class); assertEquals(Boolean.TRUE, parser.parseValue("true")); } @Test public void createsParserForBoxedRegisteredType() { ValueParser<?> parser = valueParserFactory.getValueParser(boolean.class); assertEquals(Boolean.FALSE, parser.parseValue("false")); } @Test public void createsParserForEnumType() {
ValueParser<?> parser = valueParserFactory.getValueParser(MyEnum.class);
state-machine-systems/envy
src/test/java/com/statemachinesystems/envy/ValueParserFactoryTest.java
// Path: src/test/java/com/statemachinesystems/envy/common/MyClass.java // public class MyClass { // private final String value; // // public MyClass(String value) { // this.value = value; // } // // @Override // public boolean equals(Object o) { // if (this == o) return true; // if (o == null || getClass() != o.getClass()) return false; // // MyClass myClass = (MyClass) o; // // if (!value.equals(myClass.value)) return false; // // return true; // } // // @Override // public int hashCode() { // return value.hashCode(); // } // // @Override // public String toString() { // return "MyClass{" + // "value='" + value + '\'' + // '}'; // } // } // // Path: src/test/java/com/statemachinesystems/envy/common/MyEnum.java // public enum MyEnum { // FOO, BAR, BAZ // } // // Path: src/main/java/com/statemachinesystems/envy/parsers/BooleanValueParser.java // public class BooleanValueParser implements ValueParser<Boolean> { // // public static BooleanValueParser createParser(Map<String, Boolean> acceptedValues) { // Map<String, Boolean> lowerCasedValues = new HashMap<String, Boolean>(); // for (Map.Entry<String, Boolean> entry : acceptedValues.entrySet()) { // lowerCasedValues.put(entry.getKey().toLowerCase(), entry.getValue()); // } // return new BooleanValueParser(lowerCasedValues); // } // // private static Map<String, Boolean> defaultAcceptedValues() { // Map<String, Boolean> acceptedValues = new HashMap<String, Boolean>(); // // acceptedValues.put("true", Boolean.TRUE); // acceptedValues.put("false", Boolean.FALSE); // acceptedValues.put("yes", Boolean.TRUE); // acceptedValues.put("no", Boolean.FALSE); // acceptedValues.put("y", Boolean.TRUE); // acceptedValues.put("n", Boolean.FALSE); // acceptedValues.put("on", Boolean.TRUE); // acceptedValues.put("off", Boolean.FALSE); // // return acceptedValues; // } // // private final Map<String, Boolean> acceptedValues; // // public BooleanValueParser() { // this(defaultAcceptedValues()); // } // // private BooleanValueParser(Map<String, Boolean> acceptedValues) { // this.acceptedValues = acceptedValues; // } // // @Override // public Boolean parseValue(String value) { // String key = value.toLowerCase(); // if (! acceptedValues.containsKey(key)) { // throw new IllegalArgumentException( // String.format("No registered Boolean value for '%s'", value)); // } // return acceptedValues.get(key); // } // // @Override // public Class<Boolean> getValueClass() { // return Boolean.class; // } // }
import com.statemachinesystems.envy.common.MyClass; import com.statemachinesystems.envy.common.MyEnum; import com.statemachinesystems.envy.parsers.BooleanValueParser; import org.junit.Test; import java.util.Random; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertArrayEquals; import static org.junit.Assert.assertNull;
package com.statemachinesystems.envy; public class ValueParserFactoryTest { private final ValueParserFactory valueParserFactory = new ValueParserFactory(new BooleanValueParser()); @Test public void createsParserForRegisteredType() { ValueParser<?> parser = valueParserFactory.getValueParser(Boolean.class); assertEquals(Boolean.TRUE, parser.parseValue("true")); } @Test public void createsParserForBoxedRegisteredType() { ValueParser<?> parser = valueParserFactory.getValueParser(boolean.class); assertEquals(Boolean.FALSE, parser.parseValue("false")); } @Test public void createsParserForEnumType() { ValueParser<?> parser = valueParserFactory.getValueParser(MyEnum.class); assertEquals(MyEnum.FOO, parser.parseValue("FOO")); } @Test public void createsParserForTypeWithStringConstructor() {
// Path: src/test/java/com/statemachinesystems/envy/common/MyClass.java // public class MyClass { // private final String value; // // public MyClass(String value) { // this.value = value; // } // // @Override // public boolean equals(Object o) { // if (this == o) return true; // if (o == null || getClass() != o.getClass()) return false; // // MyClass myClass = (MyClass) o; // // if (!value.equals(myClass.value)) return false; // // return true; // } // // @Override // public int hashCode() { // return value.hashCode(); // } // // @Override // public String toString() { // return "MyClass{" + // "value='" + value + '\'' + // '}'; // } // } // // Path: src/test/java/com/statemachinesystems/envy/common/MyEnum.java // public enum MyEnum { // FOO, BAR, BAZ // } // // Path: src/main/java/com/statemachinesystems/envy/parsers/BooleanValueParser.java // public class BooleanValueParser implements ValueParser<Boolean> { // // public static BooleanValueParser createParser(Map<String, Boolean> acceptedValues) { // Map<String, Boolean> lowerCasedValues = new HashMap<String, Boolean>(); // for (Map.Entry<String, Boolean> entry : acceptedValues.entrySet()) { // lowerCasedValues.put(entry.getKey().toLowerCase(), entry.getValue()); // } // return new BooleanValueParser(lowerCasedValues); // } // // private static Map<String, Boolean> defaultAcceptedValues() { // Map<String, Boolean> acceptedValues = new HashMap<String, Boolean>(); // // acceptedValues.put("true", Boolean.TRUE); // acceptedValues.put("false", Boolean.FALSE); // acceptedValues.put("yes", Boolean.TRUE); // acceptedValues.put("no", Boolean.FALSE); // acceptedValues.put("y", Boolean.TRUE); // acceptedValues.put("n", Boolean.FALSE); // acceptedValues.put("on", Boolean.TRUE); // acceptedValues.put("off", Boolean.FALSE); // // return acceptedValues; // } // // private final Map<String, Boolean> acceptedValues; // // public BooleanValueParser() { // this(defaultAcceptedValues()); // } // // private BooleanValueParser(Map<String, Boolean> acceptedValues) { // this.acceptedValues = acceptedValues; // } // // @Override // public Boolean parseValue(String value) { // String key = value.toLowerCase(); // if (! acceptedValues.containsKey(key)) { // throw new IllegalArgumentException( // String.format("No registered Boolean value for '%s'", value)); // } // return acceptedValues.get(key); // } // // @Override // public Class<Boolean> getValueClass() { // return Boolean.class; // } // } // Path: src/test/java/com/statemachinesystems/envy/ValueParserFactoryTest.java import com.statemachinesystems.envy.common.MyClass; import com.statemachinesystems.envy.common.MyEnum; import com.statemachinesystems.envy.parsers.BooleanValueParser; import org.junit.Test; import java.util.Random; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertArrayEquals; import static org.junit.Assert.assertNull; package com.statemachinesystems.envy; public class ValueParserFactoryTest { private final ValueParserFactory valueParserFactory = new ValueParserFactory(new BooleanValueParser()); @Test public void createsParserForRegisteredType() { ValueParser<?> parser = valueParserFactory.getValueParser(Boolean.class); assertEquals(Boolean.TRUE, parser.parseValue("true")); } @Test public void createsParserForBoxedRegisteredType() { ValueParser<?> parser = valueParserFactory.getValueParser(boolean.class); assertEquals(Boolean.FALSE, parser.parseValue("false")); } @Test public void createsParserForEnumType() { ValueParser<?> parser = valueParserFactory.getValueParser(MyEnum.class); assertEquals(MyEnum.FOO, parser.parseValue("FOO")); } @Test public void createsParserForTypeWithStringConstructor() {
ValueParser<?> parser = valueParserFactory.getValueParser(MyClass.class);
state-machine-systems/envy
src/main/java/com/statemachinesystems/envy/Envy.java
// Path: src/main/java/com/statemachinesystems/envy/sources/DelegatingConfigSource.java // public class DelegatingConfigSource implements ConfigSource { // // private final ConfigSource[] sources; // // /** // * Creates a {@link com.statemachinesystems.envy.sources.DelegatingConfigSource} using // * the given component sources in preference order. // * // * @param sources component {@link com.statemachinesystems.envy.ConfigSource}s in preference order // */ // public DelegatingConfigSource(ConfigSource... sources) { // this.sources = sources; // } // // @Override // public String getValue(Parameter parameter) { // for (ConfigSource source : sources) { // String value = source.getValue(parameter); // if (value != null) { // return value; // } // } // return null; // } // } // // Path: src/main/java/com/statemachinesystems/envy/sources/EnvironmentVariableConfigSource.java // public class EnvironmentVariableConfigSource implements ConfigSource { // // @Override // public String getValue(Parameter parameter) { // return System.getenv(parameter.asEnvironmentVariableName()); // } // } // // Path: src/main/java/com/statemachinesystems/envy/sources/SystemPropertyConfigSource.java // public class SystemPropertyConfigSource implements ConfigSource { // // @Override // public String getValue(Parameter parameter) { // return System.getProperty(parameter.asSystemPropertyName()); // } // } // // Path: src/main/java/com/statemachinesystems/envy/values/ConfigMap.java // public class ConfigMap implements Serializable { // // private final Map<String, ConfigValue> values; // // public ConfigMap(Map<String, ConfigValue> values) { // this.values = values; // } // // public ConfigValue getValue(String methodName) { // return values.get(methodName); // } // // public Set<String> getMethodNames() { // return values.keySet(); // } // // @Override // public boolean equals(Object o) { // if (this == o) return true; // if (o == null || getClass() != o.getClass()) return false; // ConfigMap configMap = (ConfigMap) o; // return Objects.equals(values, configMap.values); // } // // @Override // public int hashCode() { // return Objects.hash(values); // } // }
import com.statemachinesystems.envy.parsers.*; import com.statemachinesystems.envy.sources.DelegatingConfigSource; import com.statemachinesystems.envy.sources.EnvironmentVariableConfigSource; import com.statemachinesystems.envy.sources.SystemPropertyConfigSource; import com.statemachinesystems.envy.values.ConfigMap; import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; import java.util.List;
valueParsers.add(new InetSocketAddressValueParser()); valueParsers.add(new IntegerValueParser()); valueParsers.add(new LongValueParser()); valueParsers.add(new ObjectAsStringValueParser()); valueParsers.add(new PatternValueParser()); valueParsers.add(new PeriodValueParser()); valueParsers.add(new ShortValueParser()); valueParsers.add(new StringValueParser()); valueParsers.add(new UuidValueParser()); valueParsers.add(new UriValueParser()); valueParsers.add(new UrlValueParser()); return Collections.unmodifiableList(valueParsers); } /** * Provides a default {@link com.statemachinesystems.envy.ConfigSource} implementation * that retrieves configuration values from either JVM system properties or * environment variables. * * System properties override environment variables with * equivalent names. * * @return a default {@link com.statemachinesystems.envy.ConfigSource} implementation */ public static ConfigSource defaultConfigSource() { return DEFAULT_CONFIG_SOURCE; } private static final ConfigSource DEFAULT_CONFIG_SOURCE =
// Path: src/main/java/com/statemachinesystems/envy/sources/DelegatingConfigSource.java // public class DelegatingConfigSource implements ConfigSource { // // private final ConfigSource[] sources; // // /** // * Creates a {@link com.statemachinesystems.envy.sources.DelegatingConfigSource} using // * the given component sources in preference order. // * // * @param sources component {@link com.statemachinesystems.envy.ConfigSource}s in preference order // */ // public DelegatingConfigSource(ConfigSource... sources) { // this.sources = sources; // } // // @Override // public String getValue(Parameter parameter) { // for (ConfigSource source : sources) { // String value = source.getValue(parameter); // if (value != null) { // return value; // } // } // return null; // } // } // // Path: src/main/java/com/statemachinesystems/envy/sources/EnvironmentVariableConfigSource.java // public class EnvironmentVariableConfigSource implements ConfigSource { // // @Override // public String getValue(Parameter parameter) { // return System.getenv(parameter.asEnvironmentVariableName()); // } // } // // Path: src/main/java/com/statemachinesystems/envy/sources/SystemPropertyConfigSource.java // public class SystemPropertyConfigSource implements ConfigSource { // // @Override // public String getValue(Parameter parameter) { // return System.getProperty(parameter.asSystemPropertyName()); // } // } // // Path: src/main/java/com/statemachinesystems/envy/values/ConfigMap.java // public class ConfigMap implements Serializable { // // private final Map<String, ConfigValue> values; // // public ConfigMap(Map<String, ConfigValue> values) { // this.values = values; // } // // public ConfigValue getValue(String methodName) { // return values.get(methodName); // } // // public Set<String> getMethodNames() { // return values.keySet(); // } // // @Override // public boolean equals(Object o) { // if (this == o) return true; // if (o == null || getClass() != o.getClass()) return false; // ConfigMap configMap = (ConfigMap) o; // return Objects.equals(values, configMap.values); // } // // @Override // public int hashCode() { // return Objects.hash(values); // } // } // Path: src/main/java/com/statemachinesystems/envy/Envy.java import com.statemachinesystems.envy.parsers.*; import com.statemachinesystems.envy.sources.DelegatingConfigSource; import com.statemachinesystems.envy.sources.EnvironmentVariableConfigSource; import com.statemachinesystems.envy.sources.SystemPropertyConfigSource; import com.statemachinesystems.envy.values.ConfigMap; import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; import java.util.List; valueParsers.add(new InetSocketAddressValueParser()); valueParsers.add(new IntegerValueParser()); valueParsers.add(new LongValueParser()); valueParsers.add(new ObjectAsStringValueParser()); valueParsers.add(new PatternValueParser()); valueParsers.add(new PeriodValueParser()); valueParsers.add(new ShortValueParser()); valueParsers.add(new StringValueParser()); valueParsers.add(new UuidValueParser()); valueParsers.add(new UriValueParser()); valueParsers.add(new UrlValueParser()); return Collections.unmodifiableList(valueParsers); } /** * Provides a default {@link com.statemachinesystems.envy.ConfigSource} implementation * that retrieves configuration values from either JVM system properties or * environment variables. * * System properties override environment variables with * equivalent names. * * @return a default {@link com.statemachinesystems.envy.ConfigSource} implementation */ public static ConfigSource defaultConfigSource() { return DEFAULT_CONFIG_SOURCE; } private static final ConfigSource DEFAULT_CONFIG_SOURCE =
new DelegatingConfigSource(new SystemPropertyConfigSource(), new EnvironmentVariableConfigSource());