diff --git a/src/main/java/emu/grasscutter/data/GameData.java b/src/main/java/emu/grasscutter/data/GameData.java index ac304916e..9fefa4890 100644 --- a/src/main/java/emu/grasscutter/data/GameData.java +++ b/src/main/java/emu/grasscutter/data/GameData.java @@ -88,6 +88,7 @@ public class GameData { @Getter private static final Int2ObjectMap monsterCurveDataMap = new Int2ObjectOpenHashMap<>(); @Getter private static final Int2ObjectMap monsterDataMap = new Int2ObjectOpenHashMap<>(); @Getter private static final Int2ObjectMap monsterDescribeDataMap = new Int2ObjectOpenHashMap<>(); + @Getter private static final Int2ObjectMap monsterSpecialNameDataMap = new Int2ObjectOpenHashMap<>(); @Getter private static final Int2ObjectMap musicGameBasicDataMap = new Int2ObjectOpenHashMap<>(); @Getter private static final Int2ObjectMap npcDataMap = new Int2ObjectOpenHashMap<>(); @Getter private static final Int2ObjectMap openStateDataMap = new Int2ObjectOpenHashMap<>(); diff --git a/src/main/java/emu/grasscutter/data/excels/MonsterData.java b/src/main/java/emu/grasscutter/data/excels/MonsterData.java index b77a1b963..646d7b9e8 100644 --- a/src/main/java/emu/grasscutter/data/excels/MonsterData.java +++ b/src/main/java/emu/grasscutter/data/excels/MonsterData.java @@ -1,6 +1,7 @@ package emu.grasscutter.data.excels; import java.util.List; +import java.util.Map.Entry; import java.util.Set; import com.google.gson.annotations.SerializedName; @@ -60,6 +61,7 @@ public class MonsterData extends GameResource { // Transient private int weaponId; private MonsterDescribeData describeData; + private int specialNameId; public float getFightProperty(FightProperty prop) { return switch (prop) { @@ -80,8 +82,6 @@ public class MonsterData extends GameResource { @Override public void onLoad() { - this.describeData = GameData.getMonsterDescribeDataMap().get(this.getDescribeId()); - for (int id : this.equips) { if (id == 0) { continue; @@ -94,6 +94,16 @@ public class MonsterData extends GameResource { this.weaponId = id; } } + + this.describeData = GameData.getMonsterDescribeDataMap().get(this.getDescribeId()); + + if (this.describeData == null) return; + for (var entry : GameData.getMonsterSpecialNameDataMap().entrySet()) { + if (entry.getValue().getSpecialNameLabId() == this.getDescribeData().getSpecialNameLabId()) { + this.specialNameId = entry.getKey(); + break; + } + } } @Getter diff --git a/src/main/java/emu/grasscutter/data/excels/MonsterDescribeData.java b/src/main/java/emu/grasscutter/data/excels/MonsterDescribeData.java index c667e3a2d..8c65f3c77 100644 --- a/src/main/java/emu/grasscutter/data/excels/MonsterDescribeData.java +++ b/src/main/java/emu/grasscutter/data/excels/MonsterDescribeData.java @@ -1,5 +1,6 @@ package emu.grasscutter.data.excels; +import com.google.gson.annotations.SerializedName; import emu.grasscutter.data.GameResource; import emu.grasscutter.data.ResourceType; import emu.grasscutter.data.ResourceType.LoadPriority; @@ -11,6 +12,9 @@ public class MonsterDescribeData extends GameResource { @Getter(onMethod_ = @Override) private int id; private long nameTextMapHash; - private int titleID; - private int specialNameLabID; -} + @SerializedName(value = "titleId", alternate={"titleID"}) + private int titleId; + @SerializedName(value = "specialNameLabId", alternate={"specialNameLabID"}) + private int specialNameLabId; + private MonsterSpecialNameData specialNameData; +} \ No newline at end of file diff --git a/src/main/java/emu/grasscutter/data/excels/MonsterSpecialNameData.java b/src/main/java/emu/grasscutter/data/excels/MonsterSpecialNameData.java new file mode 100644 index 000000000..6ec5bf9ab --- /dev/null +++ b/src/main/java/emu/grasscutter/data/excels/MonsterSpecialNameData.java @@ -0,0 +1,24 @@ +package emu.grasscutter.data.excels; + +import com.google.gson.annotations.SerializedName; +import emu.grasscutter.data.GameResource; +import emu.grasscutter.data.ResourceType; +import emu.grasscutter.data.ResourceType.LoadPriority; +import lombok.Data; +import lombok.EqualsAndHashCode; + +@ResourceType(name = "MonsterSpecialNameExcelConfigData.json", loadPriority = LoadPriority.HIGH) +@EqualsAndHashCode(callSuper=false) +@Data +public class MonsterSpecialNameData extends GameResource { + @SerializedName(value = "specialNameId", alternate={"specialNameID"}) + private int specialNameId; + @SerializedName(value = "specialNameLabId", alternate={"specialNameLabID"}) + private int specialNameLabId; + private long specialNameTextMapHash; + + @Override + public int getId() { + return specialNameId; + } +} \ No newline at end of file diff --git a/src/main/java/emu/grasscutter/game/entity/EntityMonster.java b/src/main/java/emu/grasscutter/game/entity/EntityMonster.java index 99a5e0902..3a599cd01 100644 --- a/src/main/java/emu/grasscutter/game/entity/EntityMonster.java +++ b/src/main/java/emu/grasscutter/game/entity/EntityMonster.java @@ -14,6 +14,7 @@ import emu.grasscutter.game.props.FightProperty; import emu.grasscutter.game.props.PlayerProperty; import emu.grasscutter.game.props.WatcherTriggerType; import emu.grasscutter.game.world.Scene; +import emu.grasscutter.data.excels.MonsterSpecialNameData; import emu.grasscutter.net.proto.AbilitySyncStateInfoOuterClass.AbilitySyncStateInfo; import emu.grasscutter.net.proto.AnimatorParameterValueInfoPairOuterClass.AnimatorParameterValueInfoPair; import emu.grasscutter.net.proto.EntityAuthorityInfoOuterClass.EntityAuthorityInfo; @@ -202,12 +203,12 @@ public class EntityMonster extends GameEntity { .addAllAffixList(getMonsterData().getAffix()) .setAuthorityPeerId(getWorld().getHostPeerId()) .setPoseId(this.getPoseId()) - .setBlockId(3001) - .setBornType(MonsterBornType.MONSTER_BORN_TYPE_DEFAULT) - .setSpecialNameId(40); + .setBlockId(getScene().getId()) + .setBornType(MonsterBornType.MONSTER_BORN_TYPE_DEFAULT); if (getMonsterData().getDescribeData() != null) { - monsterInfo.setTitleId(getMonsterData().getDescribeData().getTitleID()); + monsterInfo.setTitleId(getMonsterData().getDescribeData().getTitleId()) + .setSpecialNameId(getMonsterData().getSpecialNameId()); } if (this.getMonsterWeaponId() > 0) { @@ -227,4 +228,4 @@ public class EntityMonster extends GameEntity { return entityInfo.build(); } -} +} \ No newline at end of file