Fix boss names in boss bar (#2169)

* Boss bar fix

* Update src/main/java/emu/grasscutter/data/excels/MonsterData.java

Co-authored-by: Magix <27646710+KingRainbow44@users.noreply.github.com>

* Update src/main/java/emu/grasscutter/data/excels/MonsterData.java

Co-authored-by: Magix <27646710+KingRainbow44@users.noreply.github.com>

* Update src/main/java/emu/grasscutter/data/excels/MonsterData.java

---------

Co-authored-by: Magix <27646710+KingRainbow44@users.noreply.github.com>
This commit is contained in:
Moistcrafter 2023-05-27 13:23:52 -07:00 committed by GitHub
parent 71f6198361
commit 7f4fb20773
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 50 additions and 10 deletions

View File

@ -88,6 +88,7 @@ public class GameData {
@Getter private static final Int2ObjectMap<MonsterCurveData> monsterCurveDataMap = new Int2ObjectOpenHashMap<>();
@Getter private static final Int2ObjectMap<MonsterData> monsterDataMap = new Int2ObjectOpenHashMap<>();
@Getter private static final Int2ObjectMap<MonsterDescribeData> monsterDescribeDataMap = new Int2ObjectOpenHashMap<>();
@Getter private static final Int2ObjectMap<MonsterSpecialNameData> monsterSpecialNameDataMap = new Int2ObjectOpenHashMap<>();
@Getter private static final Int2ObjectMap<MusicGameBasicData> musicGameBasicDataMap = new Int2ObjectOpenHashMap<>();
@Getter private static final Int2ObjectMap<NpcData> npcDataMap = new Int2ObjectOpenHashMap<>();
@Getter private static final Int2ObjectMap<OpenStateData> openStateDataMap = new Int2ObjectOpenHashMap<>();

View File

@ -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

View File

@ -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;
}

View File

@ -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;
}
}

View File

@ -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();
}
}
}