mirror of
https://github.com/Grasscutters/Grasscutter.git
synced 2026-02-07 18:46:49 +01:00
Continue updating/refactoring classes
Most code is matched from `Grasscutter-Quests`.
This commit is contained in:
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -1,61 +1,58 @@
|
||||
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.dungeon.DailyDungeonData;
|
||||
import emu.grasscutter.utils.Position;
|
||||
import it.unimi.dsi.fastutil.ints.IntArrayList;
|
||||
import it.unimi.dsi.fastutil.ints.IntList;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
public class PointData {
|
||||
@Getter @Setter private int id;
|
||||
private String $type;
|
||||
@Getter private Position tranPos;
|
||||
|
||||
@SerializedName(
|
||||
value = "dungeonIds",
|
||||
alternate = {"JHHFPGJNMIN"})
|
||||
@Getter
|
||||
private int[] dungeonIds;
|
||||
|
||||
@SerializedName(
|
||||
value = "dungeonRandomList",
|
||||
alternate = {"OIBKFJNBLHO"})
|
||||
@Getter
|
||||
private int[] dungeonRandomList;
|
||||
|
||||
@SerializedName(
|
||||
value = "tranSceneId",
|
||||
alternate = {"JHBICGBAPIH"})
|
||||
@Getter
|
||||
@Setter
|
||||
private int tranSceneId;
|
||||
|
||||
public String getType() {
|
||||
return $type;
|
||||
}
|
||||
|
||||
public void updateDailyDungeon() {
|
||||
if (this.dungeonRandomList == null || this.dungeonRandomList.length == 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
IntList newDungeons = new IntArrayList();
|
||||
int day = Grasscutter.getCurrentDayOfWeek();
|
||||
|
||||
for (int randomId : this.dungeonRandomList) {
|
||||
DailyDungeonData data = GameData.getDailyDungeonDataMap().get(randomId);
|
||||
|
||||
if (data != null) {
|
||||
for (int d : data.getDungeonsByDay(day)) {
|
||||
newDungeons.add(d);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
this.dungeonIds = newDungeons.toIntArray();
|
||||
}
|
||||
}
|
||||
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.dungeon.DailyDungeonData;
|
||||
import emu.grasscutter.utils.Position;
|
||||
import it.unimi.dsi.fastutil.ints.IntArrayList;
|
||||
import it.unimi.dsi.fastutil.ints.IntList;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
public final class PointData {
|
||||
@Getter @Setter private int id;
|
||||
private String $type;
|
||||
@Getter private Position tranPos;
|
||||
@Getter private Position pos;
|
||||
@Getter private Position rot;
|
||||
@Getter private Position size;
|
||||
|
||||
@SerializedName(value="dungeonIds", alternate={"JHHFPGJNMIN"})
|
||||
@Getter private int[] dungeonIds;
|
||||
|
||||
@SerializedName(value="dungeonRandomList", alternate={"OIBKFJNBLHO"})
|
||||
@Getter private int[] dungeonRandomList;
|
||||
|
||||
@SerializedName(value="groupIDs", alternate={"HFOBOOHKBGF"})
|
||||
@Getter private int[] groupIDs;
|
||||
|
||||
@SerializedName(value="tranSceneId", alternate={"JHBICGBAPIH"})
|
||||
@Getter @Setter private int tranSceneId;
|
||||
|
||||
public String getType() {
|
||||
return $type;
|
||||
}
|
||||
|
||||
public void updateDailyDungeon() {
|
||||
if (this.dungeonRandomList == null || this.dungeonRandomList.length == 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
IntList newDungeons = new IntArrayList();
|
||||
int day = Grasscutter.getCurrentDayOfWeek();
|
||||
|
||||
for (int randomId : this.dungeonRandomList) {
|
||||
DailyDungeonData data = GameData.getDailyDungeonDataMap().get(randomId);
|
||||
|
||||
if (data != null) {
|
||||
for (int d : data.getDungeonsByDay(day)) {
|
||||
newDungeons.add(d);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
this.dungeonIds = newDungeons.toIntArray();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,7 +7,7 @@ import lombok.Getter;
|
||||
|
||||
@ResourceType(name = "GadgetExcelConfigData.json")
|
||||
@Getter
|
||||
public class GadgetData extends GameResource {
|
||||
public final class GadgetData extends GameResource {
|
||||
@Getter(onMethod_ = @Override)
|
||||
private int id;
|
||||
|
||||
@@ -17,5 +17,6 @@ public class GadgetData extends GameResource {
|
||||
private String[] tags;
|
||||
private String itemJsonName;
|
||||
private long nameTextMapHash;
|
||||
private int campID;
|
||||
private int campId;
|
||||
private String visionLevel;
|
||||
}
|
||||
|
||||
@@ -41,7 +41,7 @@ public class AvatarData extends GameResource {
|
||||
@Getter
|
||||
private int staminaRecoverSpeed;
|
||||
@Getter
|
||||
private List<String> candSkillDepotIds;
|
||||
private List<Integer> candSkillDepotIds;
|
||||
@Getter
|
||||
private String avatarIdentityType;
|
||||
@Getter
|
||||
|
||||
@@ -1,117 +1,120 @@
|
||||
package emu.grasscutter.data.excels.monster;
|
||||
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
import emu.grasscutter.data.GameData;
|
||||
import emu.grasscutter.data.GameResource;
|
||||
import emu.grasscutter.data.ResourceType;
|
||||
import emu.grasscutter.data.ResourceType.LoadPriority;
|
||||
import emu.grasscutter.data.common.PropGrowCurve;
|
||||
import emu.grasscutter.data.excels.GadgetData;
|
||||
import emu.grasscutter.game.props.FightProperty;
|
||||
import emu.grasscutter.game.props.MonsterType;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import lombok.Getter;
|
||||
|
||||
@ResourceType(name = "MonsterExcelConfigData.json", loadPriority = LoadPriority.LOW)
|
||||
@Getter
|
||||
public class MonsterData extends GameResource {
|
||||
public static Set<FightProperty> definedFightProperties =
|
||||
Set.of(
|
||||
FightProperty.FIGHT_PROP_BASE_HP,
|
||||
FightProperty.FIGHT_PROP_BASE_ATTACK,
|
||||
FightProperty.FIGHT_PROP_BASE_DEFENSE,
|
||||
FightProperty.FIGHT_PROP_PHYSICAL_SUB_HURT,
|
||||
FightProperty.FIGHT_PROP_FIRE_SUB_HURT,
|
||||
FightProperty.FIGHT_PROP_ELEC_SUB_HURT,
|
||||
FightProperty.FIGHT_PROP_WATER_SUB_HURT,
|
||||
FightProperty.FIGHT_PROP_GRASS_SUB_HURT,
|
||||
FightProperty.FIGHT_PROP_WIND_SUB_HURT,
|
||||
FightProperty.FIGHT_PROP_ROCK_SUB_HURT,
|
||||
FightProperty.FIGHT_PROP_ICE_SUB_HURT);
|
||||
|
||||
@Getter(onMethod_ = @Override)
|
||||
private int id;
|
||||
|
||||
private String monsterName;
|
||||
private MonsterType type;
|
||||
private String serverScript;
|
||||
private List<Integer> affix;
|
||||
private String ai;
|
||||
private int[] equips;
|
||||
private List<HpDrops> hpDrops;
|
||||
private int killDropId;
|
||||
private String excludeWeathers;
|
||||
private int featureTagGroupID;
|
||||
private int mpPropID;
|
||||
private String skin;
|
||||
private int describeId;
|
||||
private int combatBGMLevel;
|
||||
private int entityBudgetLevel;
|
||||
|
||||
@SerializedName("hpBase")
|
||||
private float baseHp;
|
||||
|
||||
@SerializedName("attackBase")
|
||||
private float baseAttack;
|
||||
|
||||
@SerializedName("defenseBase")
|
||||
private float baseDefense;
|
||||
|
||||
private float fireSubHurt;
|
||||
private float elecSubHurt;
|
||||
private float grassSubHurt;
|
||||
private float waterSubHurt;
|
||||
private float windSubHurt;
|
||||
private float rockSubHurt;
|
||||
private float iceSubHurt;
|
||||
private float physicalSubHurt;
|
||||
private List<PropGrowCurve> propGrowCurves;
|
||||
private long nameTextMapHash;
|
||||
private int campID;
|
||||
|
||||
// Transient
|
||||
private int weaponId;
|
||||
private MonsterDescribeData describeData;
|
||||
|
||||
public float getFightProperty(FightProperty prop) {
|
||||
return switch (prop) {
|
||||
case FIGHT_PROP_BASE_HP -> this.baseHp;
|
||||
case FIGHT_PROP_BASE_ATTACK -> this.baseAttack;
|
||||
case FIGHT_PROP_BASE_DEFENSE -> this.baseDefense;
|
||||
case FIGHT_PROP_PHYSICAL_SUB_HURT -> this.physicalSubHurt;
|
||||
case FIGHT_PROP_FIRE_SUB_HURT -> this.fireSubHurt;
|
||||
case FIGHT_PROP_ELEC_SUB_HURT -> this.elecSubHurt;
|
||||
case FIGHT_PROP_WATER_SUB_HURT -> this.waterSubHurt;
|
||||
case FIGHT_PROP_GRASS_SUB_HURT -> this.grassSubHurt;
|
||||
case FIGHT_PROP_WIND_SUB_HURT -> this.windSubHurt;
|
||||
case FIGHT_PROP_ROCK_SUB_HURT -> this.rockSubHurt;
|
||||
case FIGHT_PROP_ICE_SUB_HURT -> this.iceSubHurt;
|
||||
default -> 0f;
|
||||
};
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onLoad() {
|
||||
this.describeData = GameData.getMonsterDescribeDataMap().get(this.getDescribeId());
|
||||
|
||||
for (int id : this.equips) {
|
||||
if (id == 0) {
|
||||
continue;
|
||||
}
|
||||
GadgetData gadget = GameData.getGadgetDataMap().get(id);
|
||||
if (gadget == null) {
|
||||
continue;
|
||||
}
|
||||
if (gadget.getItemJsonName().equals("Default_MonsterWeapon")) {
|
||||
this.weaponId = id;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Getter
|
||||
public class HpDrops {
|
||||
private int DropId;
|
||||
private int HpPercent;
|
||||
}
|
||||
}
|
||||
package emu.grasscutter.data.excels.monster;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.Set;
|
||||
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
|
||||
import emu.grasscutter.data.GameData;
|
||||
import emu.grasscutter.data.GameResource;
|
||||
import emu.grasscutter.data.ResourceType;
|
||||
import emu.grasscutter.data.ResourceType.LoadPriority;
|
||||
import emu.grasscutter.data.common.PropGrowCurve;
|
||||
import emu.grasscutter.data.excels.GadgetData;
|
||||
import emu.grasscutter.game.props.FightProperty;
|
||||
import emu.grasscutter.game.props.MonsterType;
|
||||
import lombok.Getter;
|
||||
|
||||
@ResourceType(name = "MonsterExcelConfigData.json", loadPriority = LoadPriority.LOW)
|
||||
@Getter
|
||||
public class MonsterData extends GameResource {
|
||||
static public Set<FightProperty> definedFightProperties = Set.of(FightProperty.FIGHT_PROP_BASE_HP, FightProperty.FIGHT_PROP_BASE_ATTACK, FightProperty.FIGHT_PROP_BASE_DEFENSE, FightProperty.FIGHT_PROP_PHYSICAL_SUB_HURT, FightProperty.FIGHT_PROP_FIRE_SUB_HURT, FightProperty.FIGHT_PROP_ELEC_SUB_HURT, FightProperty.FIGHT_PROP_WATER_SUB_HURT, FightProperty.FIGHT_PROP_GRASS_SUB_HURT, FightProperty.FIGHT_PROP_WIND_SUB_HURT, FightProperty.FIGHT_PROP_ROCK_SUB_HURT, FightProperty.FIGHT_PROP_ICE_SUB_HURT);
|
||||
|
||||
@Getter(onMethod_ = @Override)
|
||||
private int id;
|
||||
|
||||
private String monsterName;
|
||||
private MonsterType type;
|
||||
private String serverScript;
|
||||
private List<Integer> affix;
|
||||
private String ai;
|
||||
private int[] equips;
|
||||
private List<HpDrops> hpDrops;
|
||||
private int killDropId;
|
||||
private String excludeWeathers;
|
||||
private int featureTagGroupID;
|
||||
private int mpPropID;
|
||||
private String skin;
|
||||
private int describeId;
|
||||
private int combatBGMLevel;
|
||||
private int entityBudgetLevel;
|
||||
|
||||
@SerializedName("hpBase")
|
||||
private float baseHp;
|
||||
@SerializedName("attackBase")
|
||||
private float baseAttack;
|
||||
@SerializedName("defenseBase")
|
||||
private float baseDefense;
|
||||
|
||||
private float fireSubHurt;
|
||||
private float elecSubHurt;
|
||||
private float grassSubHurt;
|
||||
private float waterSubHurt;
|
||||
private float windSubHurt;
|
||||
private float rockSubHurt;
|
||||
private float iceSubHurt;
|
||||
private float physicalSubHurt;
|
||||
private List<PropGrowCurve> propGrowCurves;
|
||||
private long nameTextMapHash;
|
||||
private int campID;
|
||||
|
||||
// Transient
|
||||
private int weaponId;
|
||||
private MonsterDescribeData describeData;
|
||||
|
||||
private int specialNameId; // will only be set if describe data is available
|
||||
|
||||
@Override
|
||||
public void onLoad() {
|
||||
for (int id : this.equips) {
|
||||
if (id == 0) {
|
||||
continue;
|
||||
}
|
||||
|
||||
GadgetData gadget = GameData.getGadgetDataMap().get(id);
|
||||
if (gadget == null) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (gadget.getItemJsonName().equals("Default_MonsterWeapon")) {
|
||||
this.weaponId = id;
|
||||
}
|
||||
}
|
||||
|
||||
this.describeData = GameData.getMonsterDescribeDataMap().get(this.getDescribeId());
|
||||
|
||||
if (this.describeData == null){
|
||||
return;
|
||||
}
|
||||
for(Entry<Integer, MonsterSpecialNameData> entry: GameData.getMonsterSpecialNameDataMap().entrySet()) {
|
||||
if (entry.getValue().getSpecialNameLabId() == this.getDescribeData().getSpecialNameLabId()){
|
||||
this.specialNameId = entry.getKey();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public float getFightProperty(FightProperty prop) {
|
||||
return switch (prop) {
|
||||
case FIGHT_PROP_BASE_HP -> this.baseHp;
|
||||
case FIGHT_PROP_BASE_ATTACK -> this.baseAttack;
|
||||
case FIGHT_PROP_BASE_DEFENSE -> this.baseDefense;
|
||||
case FIGHT_PROP_PHYSICAL_SUB_HURT -> this.physicalSubHurt;
|
||||
case FIGHT_PROP_FIRE_SUB_HURT -> this.fireSubHurt;
|
||||
case FIGHT_PROP_ELEC_SUB_HURT -> this.elecSubHurt;
|
||||
case FIGHT_PROP_WATER_SUB_HURT -> this.waterSubHurt;
|
||||
case FIGHT_PROP_GRASS_SUB_HURT -> this.grassSubHurt;
|
||||
case FIGHT_PROP_WIND_SUB_HURT -> this.windSubHurt;
|
||||
case FIGHT_PROP_ROCK_SUB_HURT -> this.rockSubHurt;
|
||||
case FIGHT_PROP_ICE_SUB_HURT -> this.iceSubHurt;
|
||||
default -> 0f;
|
||||
};
|
||||
}
|
||||
|
||||
@Getter
|
||||
public class HpDrops {
|
||||
private int DropId;
|
||||
private int HpPercent;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,17 +1,21 @@
|
||||
package emu.grasscutter.data.excels.monster;
|
||||
|
||||
import emu.grasscutter.data.GameResource;
|
||||
import emu.grasscutter.data.ResourceType;
|
||||
import emu.grasscutter.data.ResourceType.LoadPriority;
|
||||
import lombok.Getter;
|
||||
|
||||
@ResourceType(name = "MonsterDescribeExcelConfigData.json", loadPriority = LoadPriority.HIGH)
|
||||
@Getter
|
||||
public class MonsterDescribeData extends GameResource {
|
||||
@Getter(onMethod_ = @Override)
|
||||
private int id;
|
||||
|
||||
private long nameTextMapHash;
|
||||
private int titleID;
|
||||
private int specialNameLabID;
|
||||
}
|
||||
package emu.grasscutter.data.excels.monster;
|
||||
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
import emu.grasscutter.data.GameResource;
|
||||
import emu.grasscutter.data.ResourceType;
|
||||
import emu.grasscutter.data.ResourceType.LoadPriority;
|
||||
import lombok.Getter;
|
||||
|
||||
@ResourceType(name = "MonsterDescribeExcelConfigData.json", loadPriority = LoadPriority.HIGH)
|
||||
@Getter
|
||||
public class MonsterDescribeData extends GameResource {
|
||||
@Getter(onMethod_ = @Override)
|
||||
private int id;
|
||||
|
||||
private long nameTextMapHash;
|
||||
@SerializedName(value = "titleId", alternate={"titleID"})
|
||||
private int titleId;
|
||||
@SerializedName(value = "specialNameLabId", alternate={"specialNameLabID"})
|
||||
private int specialNameLabId;
|
||||
private MonsterSpecialNameData specialNameData;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user