Commit a23b29b6 authored by Melledy's avatar Melledy
Browse files

Rename excel classes

parent f1398182
...@@ -4,7 +4,7 @@ import emu.grasscutter.Grasscutter; ...@@ -4,7 +4,7 @@ import emu.grasscutter.Grasscutter;
import emu.grasscutter.command.Command; import emu.grasscutter.command.Command;
import emu.grasscutter.command.CommandHandler; import emu.grasscutter.command.CommandHandler;
import emu.grasscutter.data.GameData; import emu.grasscutter.data.GameData;
import emu.grasscutter.data.def.ItemData; import emu.grasscutter.data.excels.ItemData;
import emu.grasscutter.game.entity.EntityItem; import emu.grasscutter.game.entity.EntityItem;
import emu.grasscutter.game.player.Player; import emu.grasscutter.game.player.Player;
import emu.grasscutter.utils.Position; import emu.grasscutter.utils.Position;
......
...@@ -4,8 +4,8 @@ import emu.grasscutter.Grasscutter; ...@@ -4,8 +4,8 @@ import emu.grasscutter.Grasscutter;
import emu.grasscutter.command.Command; import emu.grasscutter.command.Command;
import emu.grasscutter.command.CommandHandler; import emu.grasscutter.command.CommandHandler;
import emu.grasscutter.data.GameData; import emu.grasscutter.data.GameData;
import emu.grasscutter.data.def.AvatarData; import emu.grasscutter.data.excels.AvatarData;
import emu.grasscutter.data.def.ItemData; import emu.grasscutter.data.excels.ItemData;
import emu.grasscutter.game.avatar.Avatar; import emu.grasscutter.game.avatar.Avatar;
import emu.grasscutter.game.inventory.GameItem; import emu.grasscutter.game.inventory.GameItem;
import emu.grasscutter.game.inventory.ItemType; import emu.grasscutter.game.inventory.ItemType;
......
...@@ -4,7 +4,7 @@ import emu.grasscutter.Grasscutter; ...@@ -4,7 +4,7 @@ import emu.grasscutter.Grasscutter;
import emu.grasscutter.command.Command; import emu.grasscutter.command.Command;
import emu.grasscutter.command.CommandHandler; import emu.grasscutter.command.CommandHandler;
import emu.grasscutter.data.GameData; import emu.grasscutter.data.GameData;
import emu.grasscutter.data.def.ItemData; import emu.grasscutter.data.excels.ItemData;
import emu.grasscutter.game.inventory.GameItem; import emu.grasscutter.game.inventory.GameItem;
import emu.grasscutter.game.inventory.ItemType; import emu.grasscutter.game.inventory.ItemType;
import emu.grasscutter.game.player.Player; import emu.grasscutter.game.player.Player;
......
...@@ -4,7 +4,7 @@ import emu.grasscutter.Grasscutter; ...@@ -4,7 +4,7 @@ import emu.grasscutter.Grasscutter;
import emu.grasscutter.command.Command; import emu.grasscutter.command.Command;
import emu.grasscutter.command.CommandHandler; import emu.grasscutter.command.CommandHandler;
import emu.grasscutter.data.GameData; import emu.grasscutter.data.GameData;
import emu.grasscutter.data.def.AvatarData; import emu.grasscutter.data.excels.AvatarData;
import emu.grasscutter.game.avatar.Avatar; import emu.grasscutter.game.avatar.Avatar;
import emu.grasscutter.game.player.Player; import emu.grasscutter.game.player.Player;
......
...@@ -3,7 +3,7 @@ package emu.grasscutter.command.commands; ...@@ -3,7 +3,7 @@ package emu.grasscutter.command.commands;
import emu.grasscutter.command.Command; import emu.grasscutter.command.Command;
import emu.grasscutter.command.CommandHandler; import emu.grasscutter.command.CommandHandler;
import emu.grasscutter.data.GameData; import emu.grasscutter.data.GameData;
import emu.grasscutter.data.def.ItemData; import emu.grasscutter.data.excels.ItemData;
import emu.grasscutter.game.inventory.GameItem; import emu.grasscutter.game.inventory.GameItem;
import emu.grasscutter.game.inventory.ItemType; import emu.grasscutter.game.inventory.ItemType;
import emu.grasscutter.game.player.Player; import emu.grasscutter.game.player.Player;
......
...@@ -4,10 +4,10 @@ import emu.grasscutter.Grasscutter; ...@@ -4,10 +4,10 @@ import emu.grasscutter.Grasscutter;
import emu.grasscutter.command.Command; import emu.grasscutter.command.Command;
import emu.grasscutter.command.CommandHandler; import emu.grasscutter.command.CommandHandler;
import emu.grasscutter.data.GameData; import emu.grasscutter.data.GameData;
import emu.grasscutter.data.def.AvatarData; import emu.grasscutter.data.excels.AvatarData;
import emu.grasscutter.data.def.GadgetData; import emu.grasscutter.data.excels.GadgetData;
import emu.grasscutter.data.def.ItemData; import emu.grasscutter.data.excels.ItemData;
import emu.grasscutter.data.def.MonsterData; import emu.grasscutter.data.excels.MonsterData;
import emu.grasscutter.game.avatar.Avatar; import emu.grasscutter.game.avatar.Avatar;
import emu.grasscutter.game.entity.*; import emu.grasscutter.game.entity.*;
import emu.grasscutter.game.player.Player; import emu.grasscutter.game.player.Player;
......
...@@ -3,7 +3,7 @@ package emu.grasscutter.command.commands; ...@@ -3,7 +3,7 @@ package emu.grasscutter.command.commands;
import emu.grasscutter.Grasscutter; import emu.grasscutter.Grasscutter;
import emu.grasscutter.command.Command; import emu.grasscutter.command.Command;
import emu.grasscutter.command.CommandHandler; import emu.grasscutter.command.CommandHandler;
import emu.grasscutter.data.def.AvatarSkillDepotData; import emu.grasscutter.data.excels.AvatarSkillDepotData;
import emu.grasscutter.game.avatar.Avatar; import emu.grasscutter.game.avatar.Avatar;
import emu.grasscutter.game.entity.EntityAvatar; import emu.grasscutter.game.entity.EntityAvatar;
import emu.grasscutter.game.player.Player; import emu.grasscutter.game.player.Player;
......
...@@ -8,12 +8,12 @@ import java.util.Map; ...@@ -8,12 +8,12 @@ import java.util.Map;
import emu.grasscutter.Grasscutter; import emu.grasscutter.Grasscutter;
import emu.grasscutter.utils.Utils; import emu.grasscutter.utils.Utils;
import emu.grasscutter.data.custom.AbilityEmbryoEntry; import emu.grasscutter.data.binout.AbilityEmbryoEntry;
import emu.grasscutter.data.custom.AbilityModifierEntry; import emu.grasscutter.data.binout.AbilityModifierEntry;
import emu.grasscutter.data.custom.OpenConfigEntry; import emu.grasscutter.data.binout.MainQuestData;
import emu.grasscutter.data.custom.MainQuestData; import emu.grasscutter.data.binout.OpenConfigEntry;
import emu.grasscutter.data.custom.ScenePointEntry; import emu.grasscutter.data.binout.ScenePointEntry;
import emu.grasscutter.data.def.*; import emu.grasscutter.data.excels.*;
import it.unimi.dsi.fastutil.ints.Int2ObjectLinkedOpenHashMap; import it.unimi.dsi.fastutil.ints.Int2ObjectLinkedOpenHashMap;
import it.unimi.dsi.fastutil.ints.Int2ObjectMap; import it.unimi.dsi.fastutil.ints.Int2ObjectMap;
import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap; import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap;
......
...@@ -7,8 +7,8 @@ import org.danilopianini.util.FlexibleQuadTree; ...@@ -7,8 +7,8 @@ import org.danilopianini.util.FlexibleQuadTree;
import org.danilopianini.util.SpatialIndex; import org.danilopianini.util.SpatialIndex;
import emu.grasscutter.Grasscutter; import emu.grasscutter.Grasscutter;
import emu.grasscutter.data.def.ReliquaryAffixData; import emu.grasscutter.data.excels.ReliquaryAffixData;
import emu.grasscutter.data.def.ReliquaryMainPropData; import emu.grasscutter.data.excels.ReliquaryMainPropData;
import emu.grasscutter.game.world.SpawnDataEntry; import emu.grasscutter.game.world.SpawnDataEntry;
import emu.grasscutter.game.world.SpawnDataEntry.SpawnGroupEntry; import emu.grasscutter.game.world.SpawnDataEntry.SpawnGroupEntry;
import emu.grasscutter.utils.WeightedList; import emu.grasscutter.utils.WeightedList;
......
...@@ -14,17 +14,17 @@ import com.google.gson.JsonElement; ...@@ -14,17 +14,17 @@ import com.google.gson.JsonElement;
import com.google.gson.reflect.TypeToken; import com.google.gson.reflect.TypeToken;
import emu.grasscutter.Grasscutter; import emu.grasscutter.Grasscutter;
import emu.grasscutter.data.binout.AbilityEmbryoEntry;
import emu.grasscutter.data.binout.AbilityModifier;
import emu.grasscutter.data.binout.AbilityModifierEntry;
import emu.grasscutter.data.binout.MainQuestData;
import emu.grasscutter.data.binout.OpenConfigEntry;
import emu.grasscutter.data.binout.ScenePointEntry;
import emu.grasscutter.data.binout.AbilityModifier.AbilityConfigData;
import emu.grasscutter.data.binout.AbilityModifier.AbilityModifierAction;
import emu.grasscutter.data.binout.AbilityModifier.AbilityModifierActionType;
import emu.grasscutter.data.common.PointData; import emu.grasscutter.data.common.PointData;
import emu.grasscutter.data.common.ScenePointConfig; import emu.grasscutter.data.common.ScenePointConfig;
import emu.grasscutter.data.custom.AbilityEmbryoEntry;
import emu.grasscutter.data.custom.AbilityModifier;
import emu.grasscutter.data.custom.AbilityModifier.AbilityConfigData;
import emu.grasscutter.data.custom.AbilityModifier.AbilityModifierAction;
import emu.grasscutter.data.custom.AbilityModifier.AbilityModifierActionType;
import emu.grasscutter.data.custom.AbilityModifierEntry;
import emu.grasscutter.data.custom.OpenConfigEntry;
import emu.grasscutter.data.custom.MainQuestData;
import emu.grasscutter.data.custom.ScenePointEntry;
import emu.grasscutter.game.world.SpawnDataEntry.*; import emu.grasscutter.game.world.SpawnDataEntry.*;
import it.unimi.dsi.fastutil.ints.Int2ObjectMap; import it.unimi.dsi.fastutil.ints.Int2ObjectMap;
...@@ -138,18 +138,14 @@ public class ResourceLoader { ...@@ -138,18 +138,14 @@ public class ResourceLoader {
@SuppressWarnings({"rawtypes", "unchecked"}) @SuppressWarnings({"rawtypes", "unchecked"})
protected static void loadFromResource(Class<?> c, String fileName, Int2ObjectMap map) throws Exception { protected static void loadFromResource(Class<?> c, String fileName, Int2ObjectMap map) throws Exception {
FileReader fileReader = new FileReader(RESOURCE("ExcelBinOutput/" + fileName)); try (FileReader fileReader = new FileReader(RESOURCE("ExcelBinOutput/" + fileName))) {
Gson gson = Grasscutter.getGsonFactory(); List list = Grasscutter.getGsonFactory().fromJson(fileReader, TypeToken.getParameterized(Collection.class, c).getType());
List list = gson.fromJson(fileReader, List.class);
for (Object o : list) {
for (Object o : list) { GameResource res = (GameResource) o;
Map<String, Object> tempMap = Utils.switchPropertiesUpperLowerCase((Map<String, Object>) o, c); res.onLoad();
GameResource res = gson.fromJson(gson.toJson(tempMap), TypeToken.get(c).getType()); map.put(res.getId(), res);
res.onLoad();
if(map.containsKey(res.getId())) {
map.remove(res.getId());
} }
map.put(res.getId(), res);
} }
} }
......
package emu.grasscutter.data.custom; package emu.grasscutter.data.binout;
public class AbilityEmbryoEntry { public class AbilityEmbryoEntry {
private String name; private String name;
......
package emu.grasscutter.data.custom; package emu.grasscutter.data.binout;
import java.util.Map; import java.util.Map;
......
package emu.grasscutter.data.custom; package emu.grasscutter.data.binout;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import emu.grasscutter.data.custom.AbilityModifier.AbilityModifierAction; import emu.grasscutter.data.binout.AbilityModifier.AbilityModifierAction;
public class AbilityModifierEntry { public class AbilityModifierEntry {
private String name; // Custom value private String name; // Custom value
......
package emu.grasscutter.data.custom; package emu.grasscutter.data.binout;
import emu.grasscutter.game.quest.enums.LogicType; import emu.grasscutter.game.quest.enums.LogicType;
import emu.grasscutter.game.quest.enums.QuestTrigger; import emu.grasscutter.game.quest.enums.QuestTrigger;
......
package emu.grasscutter.data.custom; package emu.grasscutter.data.binout;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
......
package emu.grasscutter.data.custom; package emu.grasscutter.data.binout;
import emu.grasscutter.data.common.PointData; import emu.grasscutter.data.common.PointData;
public class ScenePointEntry { public class ScenePointEntry {
private String name; private String name;
private PointData pointData; private PointData pointData;
public ScenePointEntry(String name, PointData pointData) { public ScenePointEntry(String name, PointData pointData) {
this.name = name; this.name = name;
this.pointData = pointData; this.pointData = pointData;
} }
public String getName() { public String getName() {
return name; return name;
} }
public PointData getPointData() { public PointData getPointData() {
return pointData; return pointData;
} }
} }
package emu.grasscutter.data.common; package emu.grasscutter.data.common;
public class CurveInfo { public class CurveInfo {
private String Type; private String type;
private String Arith; private String arith;
private float Value; private float value;
public String getType() { public String getType() {
return Type; return type;
} }
public String getArith() { public String getArith() {
return Arith; return arith;
} }
public float getValue() { public float getValue() {
return Value; return value;
} }
} }
...@@ -3,16 +3,16 @@ package emu.grasscutter.data.common; ...@@ -3,16 +3,16 @@ package emu.grasscutter.data.common;
import emu.grasscutter.game.props.FightProperty; import emu.grasscutter.game.props.FightProperty;
public class FightPropData { public class FightPropData {
private String PropType; private String propType;
private FightProperty prop; private FightProperty prop;
private float Value; private float value;
public String getPropType() { public String getPropType() {
return PropType; return propType;
} }
public float getValue() { public float getValue() {
return Value; return value;
} }
public FightProperty getProp() { public FightProperty getProp() {
...@@ -20,6 +20,6 @@ public class FightPropData { ...@@ -20,6 +20,6 @@ public class FightPropData {
} }
public void onLoad() { public void onLoad() {
this.prop = FightProperty.getPropByName(PropType); this.prop = FightProperty.getPropByName(propType);
} }
} }
\ No newline at end of file
...@@ -3,31 +3,31 @@ package emu.grasscutter.data.common; ...@@ -3,31 +3,31 @@ package emu.grasscutter.data.common;
import com.google.gson.annotations.SerializedName; import com.google.gson.annotations.SerializedName;
public class ItemParamData { public class ItemParamData {
@SerializedName(value="Id", alternate={"ItemId"}) @SerializedName(value="Id", alternate={"itemId"})
private int Id; private int id;
@SerializedName(value="Count", alternate={"ItemCount"}) @SerializedName(value="Count", alternate={"itemCount"})
private int Count; private int count;
public ItemParamData() {} public ItemParamData() {}
public ItemParamData(int id, int count) { public ItemParamData(int id, int count) {
this.Id = id; this.id = id;
this.Count = count; this.count = count;
} }
public int getId() { public int getId() {
return Id; return id;
} }
public int getItemId() { public int getItemId() {
return Id; return id;
} }
public int getCount() { public int getCount() {
return Count; return count;
} }
public int getItemCount() { public int getItemCount() {
return Count; return count;
} }
} }
package emu.grasscutter.data.common; package emu.grasscutter.data.common;
public class ItemParamStringData { public class ItemParamStringData {
private int Id; private int id;
private String Count; private String count;
public ItemParamStringData() {} public ItemParamStringData() {}
public int getId() { public int getId() {
return Id; return id;
} }
public String getCount() { public String getCount() {
return Count; return count;
} }
public ItemParamData toItemParamData() { public ItemParamData toItemParamData() {
if (Count.contains(";")) { if (count.contains(";")) {
String[] split = Count.split(";"); String[] split = count.split(";");
Count = Count.split(";")[split.length - 1]; count = count.split(";")[split.length - 1];
} else if (Count.contains(".")) { } else if (count.contains(".")) {
return new ItemParamData(Id, (int) Math.ceil(Double.parseDouble(Count))); return new ItemParamData(id, (int) Math.ceil(Double.parseDouble(count)));
} }
return new ItemParamData(Id, Integer.parseInt(Count)); return new ItemParamData(id, Integer.parseInt(count));
} }
} }
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment