Run IntelliJ IDEA code formatter

This commit is contained in:
KingRainbow44
2023-03-31 17:19:26 -04:00
parent 5bf5fb07a2
commit 15e2f3ca34
917 changed files with 30030 additions and 22446 deletions

View File

@@ -1,17 +1,19 @@
package emu.grasscutter.data.common;
public class CurveInfo {
private String type;
private String type;
private String arith;
private float value;
public String getType() {
return type;
}
public String getArith() {
return arith;
}
public float getValue() {
return value;
}
public String getType() {
return type;
}
public String getArith() {
return arith;
}
public float getValue() {
return value;
}
}

View File

@@ -1,63 +1,22 @@
package emu.grasscutter.data.common;
import java.util.List;
import java.util.Optional;
import it.unimi.dsi.fastutil.floats.FloatArrayList;
import it.unimi.dsi.fastutil.objects.Object2FloatArrayMap;
import it.unimi.dsi.fastutil.objects.Object2FloatMap;
import lombok.val;
import org.jetbrains.annotations.Contract;
import org.jetbrains.annotations.NotNull;
import org.luaj.vm2.ast.Str;
import java.util.List;
import java.util.Optional;
public class DynamicFloat {
public static DynamicFloat ZERO = new DynamicFloat(0f);
public static class StackOp {
enum Op { CONSTANT, KEY, ADD, SUB, MUL, DIV, NEXBOOLEAN };
public Op op;
public float fValue;
public String sValue;
public boolean bValue;
public StackOp(String s) {
switch (s.toUpperCase()) {
case "ADD" -> this.op = Op.ADD;
case "SUB" -> this.op = Op.SUB;
case "MUL" -> this.op = Op.MUL;
case "DIV" -> this.op = Op.DIV;
default -> {
this.op = Op.KEY;
this.sValue = s;
}
}
}
public StackOp(boolean b) {
this.op = Op.NEXBOOLEAN;
this.bValue = Boolean.parseBoolean(String.valueOf(b));
}
public StackOp(float f) {
this.op = Op.CONSTANT;
this.fValue = f;
}
}
private List<StackOp> ops;
private boolean dynamic = false;
private float constant = 0f;
public DynamicFloat(float constant) {
this.constant = constant;
}
public String toString(boolean nextBoolean) {
String key = String.valueOf(nextBoolean);
this.ops = List.of(new StackOp(key));
return ops.toString();
}
public DynamicFloat(String key) {
this.dynamic = true;
this.ops = List.of(new StackOp(key));
@@ -73,6 +32,12 @@ public class DynamicFloat {
this.ops = ops;
}
public String toString(boolean nextBoolean) {
String key = String.valueOf(nextBoolean);
this.ops = List.of(new StackOp(key));
return ops.toString();
}
public float get() {
return this.get(new Object2FloatArrayMap<String>());
}
@@ -87,13 +52,46 @@ public class DynamicFloat {
case CONSTANT -> fl.push(op.fValue);
case KEY -> fl.push(props.getOrDefault(op.sValue, 0f));
case ADD -> fl.push(fl.popFloat() + fl.popFloat());
case SUB -> fl.push(-fl.popFloat() + fl.popFloat()); // [f0, f1, f2] -> [f0, f1-f2] (opposite of RPN order)
case SUB ->
fl.push(-fl.popFloat() + fl.popFloat()); // [f0, f1, f2] -> [f0, f1-f2] (opposite of RPN order)
case MUL -> fl.push(fl.popFloat() * fl.popFloat());
case DIV -> fl.push((1f/fl.popFloat()) * fl.popFloat()); // [f0, f1, f2] -> [f0, f1/f2]
case NEXBOOLEAN -> fl.push(props.getOrDefault(Optional.of(op.bValue), 0f));
case DIV -> fl.push((1f / fl.popFloat()) * fl.popFloat()); // [f0, f1, f2] -> [f0, f1/f2]
case NEXBOOLEAN -> fl.push(props.getOrDefault(Optional.of(op.bValue), 0f));
}
}
return fl.popFloat(); // well-formed data will always have only one value left at this point
}
public static class StackOp {
public Op op;
public float fValue;
public String sValue;
public boolean bValue;
public StackOp(String s) {
switch (s.toUpperCase()) {
case "ADD" -> this.op = Op.ADD;
case "SUB" -> this.op = Op.SUB;
case "MUL" -> this.op = Op.MUL;
case "DIV" -> this.op = Op.DIV;
default -> {
this.op = Op.KEY;
this.sValue = s;
}
}
}
public StackOp(boolean b) {
this.op = Op.NEXBOOLEAN;
this.bValue = Boolean.parseBoolean(String.valueOf(b));
}
public StackOp(float f) {
this.op = Op.CONSTANT;
this.fValue = f;
}
enum Op {CONSTANT, KEY, ADD, SUB, MUL, DIV, NEXBOOLEAN}
}
}

View File

@@ -3,23 +3,23 @@ package emu.grasscutter.data.common;
import emu.grasscutter.game.props.FightProperty;
public class FightPropData {
private String propType;
private FightProperty prop;
private String propType;
private FightProperty prop;
private float value;
public String getPropType() {
return propType;
}
public float getValue() {
return value;
}
public FightProperty getProp() {
return prop;
}
public String getPropType() {
return propType;
}
public void onLoad() {
this.prop = FightProperty.getPropByName(propType);
}
}
public float getValue() {
return value;
}
public FightProperty getProp() {
return prop;
}
public void onLoad() {
this.prop = FightProperty.getPropByName(propType);
}
}

View File

@@ -4,13 +4,14 @@ import com.google.gson.annotations.SerializedName;
// Used in excels
public class ItemParamData {
@SerializedName(value="id", alternate={"itemId"})
@SerializedName(value = "id", alternate = {"itemId"})
private int id;
@SerializedName(value="count", alternate={"itemCount"})
@SerializedName(value = "count", alternate = {"itemCount"})
private int count;
public ItemParamData() {}
public ItemParamData() {
}
public ItemParamData(int id, int count) {
this.id = id;

View File

@@ -1,26 +1,27 @@
package emu.grasscutter.data.common;
public class ItemParamStringData {
private int id;
private int id;
private String count;
public ItemParamStringData() {}
public ItemParamStringData() {
}
public int getId() {
return id;
}
public int getId() {
return id;
}
public String getCount() {
return count;
}
public ItemParamData toItemParamData() {
if (count.contains(";")) {
String[] split = count.split(";");
count = count.split(";")[split.length - 1];
} else if (count.contains(".")) {
return new ItemParamData(id, (int) Math.ceil(Double.parseDouble(count)));
}
return new ItemParamData(id, Integer.parseInt(count));
}
public String getCount() {
return count;
}
public ItemParamData toItemParamData() {
if (count.contains(";")) {
String[] split = count.split(";");
count = count.split(";")[split.length - 1];
} else if (count.contains(".")) {
return new ItemParamData(id, (int) Math.ceil(Double.parseDouble(count)));
}
return new ItemParamData(id, Integer.parseInt(count));
}
}

View File

@@ -1,7 +1,6 @@
package emu.grasscutter.data.common;
import com.google.gson.annotations.SerializedName;
import emu.grasscutter.Grasscutter;
import emu.grasscutter.data.GameData;
import emu.grasscutter.data.excels.DailyDungeonData;
@@ -12,18 +11,25 @@ import lombok.Getter;
import lombok.Setter;
public class PointData {
@Getter @Setter private int id;
@Getter
@Setter
private int id;
private String $type;
@Getter private Position tranPos;
@Getter
private Position tranPos;
@SerializedName(value="dungeonIds", alternate={"JHHFPGJNMIN"})
@Getter private int[] dungeonIds;
@SerializedName(value = "dungeonIds", alternate = {"JHHFPGJNMIN"})
@Getter
private int[] dungeonIds;
@SerializedName(value="dungeonRandomList", alternate={"OIBKFJNBLHO"})
@Getter private int[] dungeonRandomList;
@SerializedName(value = "dungeonRandomList", alternate = {"OIBKFJNBLHO"})
@Getter
private int[] dungeonRandomList;
@SerializedName(value="tranSceneId", alternate={"JHBICGBAPIH"})
@Getter @Setter private int tranSceneId;
@SerializedName(value = "tranSceneId", alternate = {"JHBICGBAPIH"})
@Getter
@Setter
private int tranSceneId;
public String getType() {
return $type;

View File

@@ -4,12 +4,12 @@ public class PropGrowCurve {
private String type;
private String growCurve;
public String getType(){
public String getType() {
return this.type;
}
public String getGrowCurve(){
public String getGrowCurve() {
return this.growCurve;
}
}