Commit fa9d703d authored by BaiSugar's avatar BaiSugar Committed by GitHub
Browse files

Merge branch 'Grasscutters:development' into development

parents 6a5d97a3 d1fc8c1f
package emu.grasscutter.data.def; package emu.grasscutter.data.def;
import emu.grasscutter.data.GenshinResource; import emu.grasscutter.data.GameResource;
import emu.grasscutter.data.ResourceType; import emu.grasscutter.data.ResourceType;
import emu.grasscutter.game.props.FightProperty; import emu.grasscutter.game.props.FightProperty;
@ResourceType(name = "ReliquaryAffixExcelConfigData.json") @ResourceType(name = "ReliquaryAffixExcelConfigData.json")
public class ReliquaryAffixData extends GenshinResource { public class ReliquaryAffixData extends GameResource {
private int Id; private int Id;
private int DepotId; private int DepotId;
......
...@@ -2,14 +2,14 @@ package emu.grasscutter.data.def; ...@@ -2,14 +2,14 @@ package emu.grasscutter.data.def;
import java.util.List; import java.util.List;
import emu.grasscutter.data.GenshinResource; import emu.grasscutter.data.GameResource;
import emu.grasscutter.data.ResourceType; import emu.grasscutter.data.ResourceType;
import emu.grasscutter.game.props.FightProperty; import emu.grasscutter.game.props.FightProperty;
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;
@ResourceType(name = "ReliquaryLevelExcelConfigData.json") @ResourceType(name = "ReliquaryLevelExcelConfigData.json")
public class ReliquaryLevelData extends GenshinResource { public class ReliquaryLevelData extends GameResource {
private int id; private int id;
private Int2ObjectMap<Float> propMap; private Int2ObjectMap<Float> propMap;
......
package emu.grasscutter.data.def; package emu.grasscutter.data.def;
import emu.grasscutter.data.GenshinResource; import emu.grasscutter.data.GameResource;
import emu.grasscutter.data.ResourceType; import emu.grasscutter.data.ResourceType;
import emu.grasscutter.game.props.FightProperty; import emu.grasscutter.game.props.FightProperty;
@ResourceType(name = "ReliquaryMainPropExcelConfigData.json") @ResourceType(name = "ReliquaryMainPropExcelConfigData.json")
public class ReliquaryMainPropData extends GenshinResource { public class ReliquaryMainPropData extends GameResource {
private int Id; private int Id;
private int PropDepotId; private int PropDepotId;
......
package emu.grasscutter.data.def; package emu.grasscutter.data.def;
import emu.grasscutter.data.GenshinResource; import emu.grasscutter.data.GameResource;
import emu.grasscutter.data.ResourceType; import emu.grasscutter.data.ResourceType;
@ResourceType(name = "ReliquarySetExcelConfigData.json") @ResourceType(name = "ReliquarySetExcelConfigData.json")
public class ReliquarySetData extends GenshinResource { public class ReliquarySetData extends GameResource {
private int SetId; private int SetId;
private int[] SetNeedNum; private int[] SetNeedNum;
private int EquipAffixId; private int EquipAffixId;
......
...@@ -2,12 +2,12 @@ package emu.grasscutter.data.def; ...@@ -2,12 +2,12 @@ package emu.grasscutter.data.def;
import java.util.List; import java.util.List;
import emu.grasscutter.data.GenshinResource; import emu.grasscutter.data.GameResource;
import emu.grasscutter.data.ResourceType; import emu.grasscutter.data.ResourceType;
import emu.grasscutter.data.common.RewardItemData; import emu.grasscutter.data.common.RewardItemData;
@ResourceType(name = "RewardExcelConfigData.json") @ResourceType(name = "RewardExcelConfigData.json")
public class RewardData extends GenshinResource { public class RewardData extends GameResource {
public int RewardId; public int RewardId;
public List<RewardItemData> RewardItemList; public List<RewardItemData> RewardItemList;
......
package emu.grasscutter.data.def; package emu.grasscutter.data.def;
import emu.grasscutter.data.GenshinData; import emu.grasscutter.data.GameData;
import emu.grasscutter.data.GenshinResource; import emu.grasscutter.data.GameResource;
import emu.grasscutter.data.ResourceType; import emu.grasscutter.data.ResourceType;
import emu.grasscutter.game.props.SceneType; import emu.grasscutter.game.props.SceneType;
@ResourceType(name = "SceneExcelConfigData.json") @ResourceType(name = "SceneExcelConfigData.json")
public class SceneData extends GenshinResource { public class SceneData extends GameResource {
private int Id; private int Id;
private SceneType SceneType; private SceneType SceneType;
private String ScriptData; private String ScriptData;
......
...@@ -4,12 +4,12 @@ import java.util.HashMap; ...@@ -4,12 +4,12 @@ import java.util.HashMap;
import java.util.Map; import java.util.Map;
import java.util.stream.Stream; import java.util.stream.Stream;
import emu.grasscutter.data.GenshinResource; import emu.grasscutter.data.GameResource;
import emu.grasscutter.data.ResourceType; import emu.grasscutter.data.ResourceType;
import emu.grasscutter.data.common.CurveInfo; import emu.grasscutter.data.common.CurveInfo;
@ResourceType(name = "WeaponCurveExcelConfigData.json") @ResourceType(name = "WeaponCurveExcelConfigData.json")
public class WeaponCurveData extends GenshinResource { public class WeaponCurveData extends GameResource {
private int Level; private int Level;
private CurveInfo[] CurveInfos; private CurveInfo[] CurveInfos;
......
package emu.grasscutter.data.def; package emu.grasscutter.data.def;
import emu.grasscutter.data.GenshinResource; import emu.grasscutter.data.GameResource;
import emu.grasscutter.data.ResourceType; import emu.grasscutter.data.ResourceType;
@ResourceType(name = "WeaponLevelExcelConfigData.json") @ResourceType(name = "WeaponLevelExcelConfigData.json")
public class WeaponLevelData extends GenshinResource { public class WeaponLevelData extends GameResource {
private int Level; private int Level;
private int[] RequiredExps; private int[] RequiredExps;
......
package emu.grasscutter.data.def; package emu.grasscutter.data.def;
import java.util.ArrayList; import java.util.ArrayList;
import emu.grasscutter.data.GenshinResource; import emu.grasscutter.data.GameResource;
import emu.grasscutter.data.ResourceType; import emu.grasscutter.data.ResourceType;
import emu.grasscutter.data.common.FightPropData; import emu.grasscutter.data.common.FightPropData;
import emu.grasscutter.data.common.ItemParamData; import emu.grasscutter.data.common.ItemParamData;
@ResourceType(name = "WeaponPromoteExcelConfigData.json") @ResourceType(name = "WeaponPromoteExcelConfigData.json")
public class WeaponPromoteData extends GenshinResource { public class WeaponPromoteData extends GameResource {
private int WeaponPromoteId; private int WeaponPromoteId;
private int PromoteLevel; private int PromoteLevel;
......
package emu.grasscutter.data.def; package emu.grasscutter.data.def;
import emu.grasscutter.data.GenshinResource; import emu.grasscutter.data.GameResource;
import emu.grasscutter.data.ResourceType; import emu.grasscutter.data.ResourceType;
@ResourceType(name = "WorldLevelExcelConfigData.json") @ResourceType(name = "WorldLevelExcelConfigData.json")
public class WorldLevelData extends GenshinResource { public class WorldLevelData extends GameResource {
private int Level; private int Level;
private int MonsterLevel; private int MonsterLevel;
......
...@@ -4,12 +4,12 @@ import java.util.List; ...@@ -4,12 +4,12 @@ import java.util.List;
import com.mongodb.client.result.DeleteResult; import com.mongodb.client.result.DeleteResult;
import dev.morphia.query.experimental.filters.Filters; import dev.morphia.query.experimental.filters.Filters;
import emu.grasscutter.GenshinConstants; import emu.grasscutter.GameConstants;
import emu.grasscutter.game.Account; import emu.grasscutter.game.Account;
import emu.grasscutter.game.GenshinPlayer; import emu.grasscutter.game.avatar.Avatar;
import emu.grasscutter.game.avatar.GenshinAvatar;
import emu.grasscutter.game.friends.Friendship; import emu.grasscutter.game.friends.Friendship;
import emu.grasscutter.game.inventory.GenshinItem; import emu.grasscutter.game.inventory.GameItem;
import emu.grasscutter.game.player.Player;
public final class DatabaseHelper { public final class DatabaseHelper {
public static Account createAccount(String username) { public static Account createAccount(String username) {
...@@ -26,7 +26,7 @@ public final class DatabaseHelper { ...@@ -26,7 +26,7 @@ public final class DatabaseHelper {
// Make sure there are no id collisions // Make sure there are no id collisions
if (reservedId > 0) { if (reservedId > 0) {
// Cannot make account with the same uid as the server console // Cannot make account with the same uid as the server console
if (reservedId == GenshinConstants.SERVER_CONSOLE_UID) { if (reservedId == GameConstants.SERVER_CONSOLE_UID) {
return null; return null;
} }
exists = DatabaseHelper.getAccountByPlayerId(reservedId); exists = DatabaseHelper.getAccountByPlayerId(reservedId);
...@@ -90,15 +90,19 @@ public final class DatabaseHelper { ...@@ -90,15 +90,19 @@ public final class DatabaseHelper {
return DatabaseManager.getDatastore().find(Account.class).filter(Filters.eq("username", username)).delete().getDeletedCount() > 0; return DatabaseManager.getDatastore().find(Account.class).filter(Filters.eq("username", username)).delete().getDeletedCount() > 0;
} }
public static GenshinPlayer getPlayerById(int id) { public static List<Player> getAllPlayers() {
return DatabaseManager.getDatastore().find(GenshinPlayer.class).filter(Filters.eq("_id", id)).first(); return DatabaseManager.getDatastore().find(Player.class).stream().toList();
}
public static Player getPlayerById(int id) {
return DatabaseManager.getDatastore().find(Player.class).filter(Filters.eq("_id", id)).first();
} }
public static boolean checkPlayerExists(int id) { public static boolean checkPlayerExists(int id) {
return DatabaseManager.getDatastore().find(GenshinPlayer.class).filter(Filters.eq("_id", id)).first() != null; return DatabaseManager.getDatastore().find(Player.class).filter(Filters.eq("_id", id)).first() != null;
} }
public static synchronized GenshinPlayer createPlayer(GenshinPlayer character, int reservedId) { public static synchronized Player createPlayer(Player character, int reservedId) {
// Check if reserved id // Check if reserved id
int id; int id;
if (reservedId > 0 && !checkPlayerExists(reservedId)) { if (reservedId > 0 && !checkPlayerExists(reservedId)) {
...@@ -123,42 +127,42 @@ public final class DatabaseHelper { ...@@ -123,42 +127,42 @@ public final class DatabaseHelper {
id = reservedId; id = reservedId;
} else { } else {
do { do {
id = DatabaseManager.getNextId(GenshinPlayer.class); id = DatabaseManager.getNextId(Player.class);
} }
while (checkPlayerExists(id)); while (checkPlayerExists(id));
} }
return id; return id;
} }
public static void savePlayer(GenshinPlayer character) { public static void savePlayer(Player character) {
DatabaseManager.getDatastore().save(character); DatabaseManager.getDatastore().save(character);
} }
public static void saveAvatar(GenshinAvatar avatar) { public static void saveAvatar(Avatar avatar) {
DatabaseManager.getDatastore().save(avatar); DatabaseManager.getDatastore().save(avatar);
} }
public static List<GenshinAvatar> getAvatars(GenshinPlayer player) { public static List<Avatar> getAvatars(Player player) {
return DatabaseManager.getDatastore().find(GenshinAvatar.class).filter(Filters.eq("ownerId", player.getUid())).stream().toList(); return DatabaseManager.getDatastore().find(Avatar.class).filter(Filters.eq("ownerId", player.getUid())).stream().toList();
} }
public static void saveItem(GenshinItem item) { public static void saveItem(GameItem item) {
DatabaseManager.getDatastore().save(item); DatabaseManager.getDatastore().save(item);
} }
public static boolean deleteItem(GenshinItem item) { public static boolean deleteItem(GameItem item) {
DeleteResult result = DatabaseManager.getDatastore().delete(item); DeleteResult result = DatabaseManager.getDatastore().delete(item);
return result.wasAcknowledged(); return result.wasAcknowledged();
} }
public static List<GenshinItem> getInventoryItems(GenshinPlayer player) { public static List<GameItem> getInventoryItems(Player player) {
return DatabaseManager.getDatastore().find(GenshinItem.class).filter(Filters.eq("ownerId", player.getUid())).stream().toList(); return DatabaseManager.getDatastore().find(GameItem.class).filter(Filters.eq("ownerId", player.getUid())).stream().toList();
} }
public static List<Friendship> getFriends(GenshinPlayer player) { public static List<Friendship> getFriends(Player player) {
return DatabaseManager.getDatastore().find(Friendship.class).filter(Filters.eq("ownerId", player.getUid())).stream().toList(); return DatabaseManager.getDatastore().find(Friendship.class).filter(Filters.eq("ownerId", player.getUid())).stream().toList();
} }
public static List<Friendship> getReverseFriends(GenshinPlayer player) { public static List<Friendship> getReverseFriends(Player player) {
return DatabaseManager.getDatastore().find(Friendship.class).filter(Filters.eq("friendId", player.getUid())).stream().toList(); return DatabaseManager.getDatastore().find(Friendship.class).filter(Filters.eq("friendId", player.getUid())).stream().toList();
} }
......
...@@ -13,10 +13,10 @@ import dev.morphia.mapping.MapperOptions; ...@@ -13,10 +13,10 @@ import dev.morphia.mapping.MapperOptions;
import dev.morphia.query.experimental.filters.Filters; import dev.morphia.query.experimental.filters.Filters;
import emu.grasscutter.Grasscutter; import emu.grasscutter.Grasscutter;
import emu.grasscutter.game.Account; import emu.grasscutter.game.Account;
import emu.grasscutter.game.GenshinPlayer; import emu.grasscutter.game.avatar.Avatar;
import emu.grasscutter.game.avatar.GenshinAvatar;
import emu.grasscutter.game.friends.Friendship; import emu.grasscutter.game.friends.Friendship;
import emu.grasscutter.game.inventory.GenshinItem; import emu.grasscutter.game.inventory.GameItem;
import emu.grasscutter.game.player.Player;
public final class DatabaseManager { public final class DatabaseManager {
...@@ -27,7 +27,7 @@ public final class DatabaseManager { ...@@ -27,7 +27,7 @@ public final class DatabaseManager {
private static Datastore dispatchDatastore; private static Datastore dispatchDatastore;
private static final Class<?>[] mappedClasses = new Class<?>[] { private static final Class<?>[] mappedClasses = new Class<?>[] {
DatabaseCounter.class, Account.class, GenshinPlayer.class, GenshinAvatar.class, GenshinItem.class, Friendship.class DatabaseCounter.class, Account.class, Player.class, Avatar.class, GameItem.class, Friendship.class
}; };
public static Datastore getDatastore() { public static Datastore getDatastore() {
......
package emu.grasscutter.game; package emu.grasscutter.game;
import emu.grasscutter.game.player.Player;
public class CoopRequest { public class CoopRequest {
private final GenshinPlayer requester; private final Player requester;
private final long requestTime; private final long requestTime;
private final long expireTime; private final long expireTime;
public CoopRequest(GenshinPlayer requester) { public CoopRequest(Player requester) {
this.requester = requester; this.requester = requester;
this.requestTime = System.currentTimeMillis(); this.requestTime = System.currentTimeMillis();
this.expireTime = this.requestTime + 10000; this.expireTime = this.requestTime + 10000;
} }
public GenshinPlayer getRequester() { public Player getRequester() {
return requester; return requester;
} }
......
...@@ -16,7 +16,7 @@ import dev.morphia.annotations.PostLoad; ...@@ -16,7 +16,7 @@ import dev.morphia.annotations.PostLoad;
import dev.morphia.annotations.PrePersist; import dev.morphia.annotations.PrePersist;
import dev.morphia.annotations.Transient; import dev.morphia.annotations.Transient;
import emu.grasscutter.Grasscutter; import emu.grasscutter.Grasscutter;
import emu.grasscutter.data.GenshinData; import emu.grasscutter.data.GameData;
import emu.grasscutter.data.common.FightPropData; import emu.grasscutter.data.common.FightPropData;
import emu.grasscutter.data.custom.OpenConfigEntry; import emu.grasscutter.data.custom.OpenConfigEntry;
import emu.grasscutter.data.def.AvatarData; import emu.grasscutter.data.def.AvatarData;
...@@ -35,10 +35,10 @@ import emu.grasscutter.data.def.WeaponPromoteData; ...@@ -35,10 +35,10 @@ import emu.grasscutter.data.def.WeaponPromoteData;
import emu.grasscutter.data.def.ItemData.WeaponProperty; import emu.grasscutter.data.def.ItemData.WeaponProperty;
import emu.grasscutter.data.def.ProudSkillData; import emu.grasscutter.data.def.ProudSkillData;
import emu.grasscutter.database.DatabaseHelper; import emu.grasscutter.database.DatabaseHelper;
import emu.grasscutter.game.GenshinPlayer;
import emu.grasscutter.game.entity.EntityAvatar; import emu.grasscutter.game.entity.EntityAvatar;
import emu.grasscutter.game.inventory.EquipType; import emu.grasscutter.game.inventory.EquipType;
import emu.grasscutter.game.inventory.GenshinItem; import emu.grasscutter.game.inventory.GameItem;
import emu.grasscutter.game.player.Player;
import emu.grasscutter.game.props.ElementType; import emu.grasscutter.game.props.ElementType;
import emu.grasscutter.game.props.EntityIdType; import emu.grasscutter.game.props.EntityIdType;
import emu.grasscutter.game.props.FetterState; import emu.grasscutter.game.props.FetterState;
...@@ -57,11 +57,11 @@ import it.unimi.dsi.fastutil.ints.Int2ObjectMap; ...@@ -57,11 +57,11 @@ import it.unimi.dsi.fastutil.ints.Int2ObjectMap;
import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap; import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap;
@Entity(value = "avatars", useDiscriminator = false) @Entity(value = "avatars", useDiscriminator = false)
public class GenshinAvatar { public class Avatar {
@Id private ObjectId id; @Id private ObjectId id;
@Indexed private int ownerId; // Id of player that this avatar belongs to @Indexed private int ownerId; // Id of player that this avatar belongs to
@Transient private GenshinPlayer owner; @Transient private Player owner;
@Transient private AvatarData data; @Transient private AvatarData data;
@Transient private long guid; // Player unique id @Transient private long guid; // Player unique id
private int avatarId; // Id of avatar private int avatarId; // Id of avatar
...@@ -73,7 +73,7 @@ public class GenshinAvatar { ...@@ -73,7 +73,7 @@ public class GenshinAvatar {
private int satiationPenalty; // ? private int satiationPenalty; // ?
private float currentHp; private float currentHp;
@Transient private final Int2ObjectMap<GenshinItem> equips; @Transient private final Int2ObjectMap<GameItem> equips;
@Transient private final Int2FloatOpenHashMap fightProp; @Transient private final Int2FloatOpenHashMap fightProp;
@Transient private Set<String> extraAbilityEmbryos; @Transient private Set<String> extraAbilityEmbryos;
...@@ -96,21 +96,21 @@ public class GenshinAvatar { ...@@ -96,21 +96,21 @@ public class GenshinAvatar {
private int nameCardRewardId; private int nameCardRewardId;
private int nameCardId; private int nameCardId;
public GenshinAvatar() { public Avatar() {
// Morhpia only! // Morhpia only!
this.equips = new Int2ObjectOpenHashMap<>(); this.equips = new Int2ObjectOpenHashMap<>();
this.fightProp = new Int2FloatOpenHashMap(); this.fightProp = new Int2FloatOpenHashMap();
this.extraAbilityEmbryos = new HashSet<>(); this.extraAbilityEmbryos = new HashSet<>();
this.proudSkillBonusMap = new HashMap<>(); this.proudSkillBonusMap = new HashMap<>();
this.fetters = new ArrayList<>(); // TODO Move to genshin avatar this.fetters = new ArrayList<>(); // TODO Move to avatar
} }
// On creation // On creation
public GenshinAvatar(int avatarId) { public Avatar(int avatarId) {
this(GenshinData.getAvatarDataMap().get(avatarId)); this(GameData.getAvatarDataMap().get(avatarId));
} }
public GenshinAvatar(AvatarData data) { public Avatar(AvatarData data) {
this(); this();
this.avatarId = data.getId(); this.avatarId = data.getId();
this.nameCardRewardId = data.getNameCardRewardId(); this.nameCardRewardId = data.getNameCardRewardId();
...@@ -143,7 +143,7 @@ public class GenshinAvatar { ...@@ -143,7 +143,7 @@ public class GenshinAvatar {
this.onLoad(); this.onLoad();
} }
public GenshinPlayer getPlayer() { public Player getPlayer() {
return this.owner; return this.owner;
} }
...@@ -163,10 +163,10 @@ public class GenshinAvatar { ...@@ -163,10 +163,10 @@ public class GenshinAvatar {
return ownerId; return ownerId;
} }
public void setOwner(GenshinPlayer player) { public void setOwner(Player player) {
this.owner = player; this.owner = player;
this.ownerId = player.getUid(); this.ownerId = player.getUid();
this.guid = player.getNextGenshinGuid(); this.guid = player.getNextGameGuid();
} }
public int getSatiation() { public int getSatiation() {
...@@ -229,19 +229,19 @@ public class GenshinAvatar { ...@@ -229,19 +229,19 @@ public class GenshinAvatar {
this.promoteLevel = promoteLevel; this.promoteLevel = promoteLevel;
} }
public Int2ObjectMap<GenshinItem> getEquips() { public Int2ObjectMap<GameItem> getEquips() {
return equips; return equips;
} }
public GenshinItem getEquipBySlot(EquipType slot) { public GameItem getEquipBySlot(EquipType slot) {
return this.getEquips().get(slot.getValue()); return this.getEquips().get(slot.getValue());
} }
private GenshinItem getEquipBySlot(int slotId) { private GameItem getEquipBySlot(int slotId) {
return this.getEquips().get(slotId); return this.getEquips().get(slotId);
} }
public GenshinItem getWeapon() { public GameItem getWeapon() {
return this.getEquipBySlot(EquipType.EQUIP_WEAPON); return this.getEquipBySlot(EquipType.EQUIP_WEAPON);
} }
...@@ -270,7 +270,7 @@ public class GenshinAvatar { ...@@ -270,7 +270,7 @@ public class GenshinAvatar {
} }
if (openData.getNeedAvatarPromoteLevel() <= this.getPromoteLevel()) { if (openData.getNeedAvatarPromoteLevel() <= this.getPromoteLevel()) {
int proudSkillId = (openData.getProudSkillGroupId() * 100) + 1; int proudSkillId = (openData.getProudSkillGroupId() * 100) + 1;
if (GenshinData.getProudSkillDataMap().containsKey(proudSkillId)) { if (GameData.getProudSkillDataMap().containsKey(proudSkillId)) {
this.getProudSkillList().add(proudSkillId); this.getProudSkillList().add(proudSkillId);
} }
} }
...@@ -385,7 +385,7 @@ public class GenshinAvatar { ...@@ -385,7 +385,7 @@ public class GenshinAvatar {
return bornTime; return bornTime;
} }
public boolean equipItem(GenshinItem item, boolean shouldRecalc) { public boolean equipItem(GameItem item, boolean shouldRecalc) {
EquipType itemEquipType = item.getItemData().getEquipType(); EquipType itemEquipType = item.getItemData().getEquipType();
if (itemEquipType == EquipType.EQUIP_NONE) { if (itemEquipType == EquipType.EQUIP_NONE) {
return false; return false;
...@@ -416,7 +416,7 @@ public class GenshinAvatar { ...@@ -416,7 +416,7 @@ public class GenshinAvatar {
} }
public boolean unequipItem(EquipType slot) { public boolean unequipItem(EquipType slot) {
GenshinItem item = getEquips().remove(slot.getValue()); GameItem item = getEquips().remove(slot.getValue());
if (item != null) { if (item != null) {
item.setEquipCharacter(0); item.setEquipCharacter(0);
...@@ -434,7 +434,7 @@ public class GenshinAvatar { ...@@ -434,7 +434,7 @@ public class GenshinAvatar {
public void recalcStats(boolean forceSendAbilityChange) { public void recalcStats(boolean forceSendAbilityChange) {
// Setup // Setup
AvatarData data = this.getAvatarData(); AvatarData data = this.getAvatarData();
AvatarPromoteData promoteData = GenshinData.getAvatarPromoteData(data.getAvatarPromoteId(), this.getPromoteLevel()); AvatarPromoteData promoteData = GameData.getAvatarPromoteData(data.getAvatarPromoteId(), this.getPromoteLevel());
Int2IntOpenHashMap setMap = new Int2IntOpenHashMap(); Int2IntOpenHashMap setMap = new Int2IntOpenHashMap();
// Extra ability embryos // Extra ability embryos
...@@ -476,21 +476,21 @@ public class GenshinAvatar { ...@@ -476,21 +476,21 @@ public class GenshinAvatar {
// Artifacts // Artifacts
for (int slotId = 1; slotId <= 5; slotId++) { for (int slotId = 1; slotId <= 5; slotId++) {
// Get artifact // Get artifact
GenshinItem equip = this.getEquipBySlot(slotId); GameItem equip = this.getEquipBySlot(slotId);
if (equip == null) { if (equip == null) {
continue; continue;
} }
// Artifact main stat // Artifact main stat
ReliquaryMainPropData mainPropData = GenshinData.getReliquaryMainPropDataMap().get(equip.getMainPropId()); ReliquaryMainPropData mainPropData = GameData.getReliquaryMainPropDataMap().get(equip.getMainPropId());
if (mainPropData != null) { if (mainPropData != null) {
ReliquaryLevelData levelData = GenshinData.getRelicLevelData(equip.getItemData().getRankLevel(), equip.getLevel()); ReliquaryLevelData levelData = GameData.getRelicLevelData(equip.getItemData().getRankLevel(), equip.getLevel());
if (levelData != null) { if (levelData != null) {
this.addFightProperty(mainPropData.getFightProp(), levelData.getPropValue(mainPropData.getFightProp())); this.addFightProperty(mainPropData.getFightProp(), levelData.getPropValue(mainPropData.getFightProp()));
} }
} }
// Artifact sub stats // Artifact sub stats
for (int appendPropId : equip.getAppendPropIdList()) { for (int appendPropId : equip.getAppendPropIdList()) {
ReliquaryAffixData affixData = GenshinData.getReliquaryAffixDataMap().get(appendPropId); ReliquaryAffixData affixData = GameData.getReliquaryAffixDataMap().get(appendPropId);
if (affixData != null) { if (affixData != null) {
this.addFightProperty(affixData.getFightProp(), affixData.getPropValue()); this.addFightProperty(affixData.getFightProp(), affixData.getPropValue());
} }
...@@ -503,7 +503,7 @@ public class GenshinAvatar { ...@@ -503,7 +503,7 @@ public class GenshinAvatar {
// Set stuff // Set stuff
for (Int2IntOpenHashMap.Entry e : setMap.int2IntEntrySet()) { for (Int2IntOpenHashMap.Entry e : setMap.int2IntEntrySet()) {
ReliquarySetData setData = GenshinData.getReliquarySetDataMap().get(e.getIntKey()); ReliquarySetData setData = GameData.getReliquarySetDataMap().get(e.getIntKey());
if (setData == null) { if (setData == null) {
continue; continue;
} }
...@@ -516,7 +516,7 @@ public class GenshinAvatar { ...@@ -516,7 +516,7 @@ public class GenshinAvatar {
if (amount >= setData.getSetNeedNum()[setIndex]) { if (amount >= setData.getSetNeedNum()[setIndex]) {
int affixId = (setData.getEquipAffixId() * 10) + setIndex; int affixId = (setData.getEquipAffixId() * 10) + setIndex;
EquipAffixData affix = GenshinData.getEquipAffixDataMap().get(affixId); EquipAffixData affix = GameData.getEquipAffixDataMap().get(affixId);
if (affix == null) { if (affix == null) {
continue; continue;
} }
...@@ -535,17 +535,17 @@ public class GenshinAvatar { ...@@ -535,17 +535,17 @@ public class GenshinAvatar {
} }
// Weapon // Weapon
GenshinItem weapon = this.getWeapon(); GameItem weapon = this.getWeapon();
if (weapon != null) { if (weapon != null) {
// Add stats // Add stats
WeaponCurveData curveData = GenshinData.getWeaponCurveDataMap().get(weapon.getLevel()); WeaponCurveData curveData = GameData.getWeaponCurveDataMap().get(weapon.getLevel());
if (curveData != null) { if (curveData != null) {
for (WeaponProperty weaponProperty : weapon.getItemData().getWeaponProperties()) { for (WeaponProperty weaponProperty : weapon.getItemData().getWeaponProperties()) {
this.addFightProperty(weaponProperty.getFightProp(), weaponProperty.getInitValue() * curveData.getMultByProp(weaponProperty.getType())); this.addFightProperty(weaponProperty.getFightProp(), weaponProperty.getInitValue() * curveData.getMultByProp(weaponProperty.getType()));
} }
} }
// Weapon promotion stats // Weapon promotion stats
WeaponPromoteData wepPromoteData = GenshinData.getWeaponPromoteData(weapon.getItemData().getWeaponPromoteId(), weapon.getPromoteLevel()); WeaponPromoteData wepPromoteData = GameData.getWeaponPromoteData(weapon.getItemData().getWeaponPromoteId(), weapon.getPromoteLevel());
if (wepPromoteData != null) { if (wepPromoteData != null) {
for (FightPropData prop : wepPromoteData.getAddProps()) { for (FightPropData prop : wepPromoteData.getAddProps()) {
if (prop.getValue() == 0f || prop.getProp() == null) { if (prop.getValue() == 0f || prop.getProp() == null) {
...@@ -563,7 +563,7 @@ public class GenshinAvatar { ...@@ -563,7 +563,7 @@ public class GenshinAvatar {
} }
// Calculate affix id // Calculate affix id
int affixId = (af * 10) + weapon.getRefinement(); int affixId = (af * 10) + weapon.getRefinement();
EquipAffixData affix = GenshinData.getEquipAffixDataMap().get(affixId); EquipAffixData affix = GameData.getEquipAffixDataMap().get(affixId);
if (affix == null) { if (affix == null) {
continue; continue;
} }
...@@ -580,7 +580,7 @@ public class GenshinAvatar { ...@@ -580,7 +580,7 @@ public class GenshinAvatar {
} }
// Add proud skills and unlock them if needed // Add proud skills and unlock them if needed
AvatarSkillDepotData skillDepot = GenshinData.getAvatarSkillDepotDataMap().get(this.getSkillDepotId()); AvatarSkillDepotData skillDepot = GameData.getAvatarSkillDepotDataMap().get(this.getSkillDepotId());
this.getProudSkillList().clear(); this.getProudSkillList().clear();
for (InherentProudSkillOpens openData : skillDepot.getInherentProudSkillOpens()) { for (InherentProudSkillOpens openData : skillDepot.getInherentProudSkillOpens()) {
if (openData.getProudSkillGroupId() == 0) { if (openData.getProudSkillGroupId() == 0) {
...@@ -588,7 +588,7 @@ public class GenshinAvatar { ...@@ -588,7 +588,7 @@ public class GenshinAvatar {
} }
if (openData.getNeedAvatarPromoteLevel() <= this.getPromoteLevel()) { if (openData.getNeedAvatarPromoteLevel() <= this.getPromoteLevel()) {
int proudSkillId = (openData.getProudSkillGroupId() * 100) + 1; int proudSkillId = (openData.getProudSkillGroupId() * 100) + 1;
if (GenshinData.getProudSkillDataMap().containsKey(proudSkillId)) { if (GameData.getProudSkillDataMap().containsKey(proudSkillId)) {
this.getProudSkillList().add(proudSkillId); this.getProudSkillList().add(proudSkillId);
} }
} }
...@@ -596,7 +596,7 @@ public class GenshinAvatar { ...@@ -596,7 +596,7 @@ public class GenshinAvatar {
// Proud skills // Proud skills
for (int proudSkillId : this.getProudSkillList()) { for (int proudSkillId : this.getProudSkillList()) {
ProudSkillData proudSkillData = GenshinData.getProudSkillDataMap().get(proudSkillId); ProudSkillData proudSkillData = GameData.getProudSkillDataMap().get(proudSkillId);
if (proudSkillData == null) { if (proudSkillData == null) {
continue; continue;
} }
...@@ -613,7 +613,7 @@ public class GenshinAvatar { ...@@ -613,7 +613,7 @@ public class GenshinAvatar {
// Constellations // Constellations
if (this.getTalentIdList().size() > 0) { if (this.getTalentIdList().size() > 0) {
for (int talentId : this.getTalentIdList()) { for (int talentId : this.getTalentIdList()) {
AvatarTalentData avatarTalentData = GenshinData.getAvatarTalentDataMap().get(talentId); AvatarTalentData avatarTalentData = GameData.getAvatarTalentDataMap().get(talentId);
if (avatarTalentData == null) { if (avatarTalentData == null) {
return; return;
} }
...@@ -657,7 +657,7 @@ public class GenshinAvatar { ...@@ -657,7 +657,7 @@ public class GenshinAvatar {
return; return;
} }
OpenConfigEntry entry = GenshinData.getOpenConfigEntries().get(openConfig); OpenConfigEntry entry = GameData.getOpenConfigEntries().get(openConfig);
if (entry == null) { if (entry == null) {
if (forceAdd) { if (forceAdd) {
// Add config string to ability skill list anyways // Add config string to ability skill list anyways
...@@ -684,14 +684,14 @@ public class GenshinAvatar { ...@@ -684,14 +684,14 @@ public class GenshinAvatar {
if (this.getTalentIdList().size() > 0) { if (this.getTalentIdList().size() > 0) {
for (int talentId : this.getTalentIdList()) { for (int talentId : this.getTalentIdList()) {
AvatarTalentData avatarTalentData = GenshinData.getAvatarTalentDataMap().get(talentId); AvatarTalentData avatarTalentData = GameData.getAvatarTalentDataMap().get(talentId);
if (avatarTalentData == null || avatarTalentData.getOpenConfig() == null || avatarTalentData.getOpenConfig().length() == 0) { if (avatarTalentData == null || avatarTalentData.getOpenConfig() == null || avatarTalentData.getOpenConfig().length() == 0) {
continue; continue;
} }
// Get open config to find which skill should be boosted // Get open config to find which skill should be boosted
OpenConfigEntry entry = GenshinData.getOpenConfigEntries().get(avatarTalentData.getOpenConfig()); OpenConfigEntry entry = GameData.getOpenConfigEntries().get(avatarTalentData.getOpenConfig());
if (entry == null) { if (entry == null) {
continue; continue;
} }
...@@ -712,7 +712,7 @@ public class GenshinAvatar { ...@@ -712,7 +712,7 @@ public class GenshinAvatar {
} }
// Get proud skill group id // Get proud skill group id
AvatarSkillData skillData = GenshinData.getAvatarSkillDataMap().get(skillId); AvatarSkillData skillData = GameData.getAvatarSkillDataMap().get(skillId);
if (skillData == null) { if (skillData == null) {
continue; continue;
...@@ -785,7 +785,7 @@ public class GenshinAvatar { ...@@ -785,7 +785,7 @@ public class GenshinAvatar {
.setWearingFlycloakId(this.getFlyCloak()) .setWearingFlycloakId(this.getFlyCloak())
.setCostumeId(this.getCostume()); .setCostumeId(this.getCostume());
for (GenshinItem item : this.getEquips().values()) { for (GameItem item : this.getEquips().values()) {
avatarInfo.addEquipGuidList(item.getGuid()); avatarInfo.addEquipGuidList(item.getGuid());
} }
......
...@@ -7,7 +7,7 @@ public class AvatarProfileData { ...@@ -7,7 +7,7 @@ public class AvatarProfileData {
private int avatarId; private int avatarId;
private int level; private int level;
public AvatarProfileData(GenshinAvatar avatar) { public AvatarProfileData(Avatar avatar) {
this.update(avatar); this.update(avatar);
} }
...@@ -19,7 +19,7 @@ public class AvatarProfileData { ...@@ -19,7 +19,7 @@ public class AvatarProfileData {
return level; return level;
} }
public void update(GenshinAvatar avatar) { public void update(Avatar avatar) {
this.avatarId = avatar.getAvatarId(); this.avatarId = avatar.getAvatarId();
this.level = avatar.getLevel(); this.level = avatar.getLevel();
} }
......
...@@ -3,12 +3,12 @@ package emu.grasscutter.game.avatar; ...@@ -3,12 +3,12 @@ package emu.grasscutter.game.avatar;
import java.util.Iterator; import java.util.Iterator;
import java.util.List; import java.util.List;
import emu.grasscutter.data.GenshinData; import emu.grasscutter.data.GameData;
import emu.grasscutter.data.def.AvatarData; import emu.grasscutter.data.def.AvatarData;
import emu.grasscutter.database.DatabaseHelper; import emu.grasscutter.database.DatabaseHelper;
import emu.grasscutter.game.GenshinPlayer;
import emu.grasscutter.game.entity.EntityAvatar; import emu.grasscutter.game.entity.EntityAvatar;
import emu.grasscutter.game.inventory.GenshinItem; import emu.grasscutter.game.inventory.GameItem;
import emu.grasscutter.game.player.Player;
import emu.grasscutter.server.packet.send.PacketAvatarChangeCostumeNotify; import emu.grasscutter.server.packet.send.PacketAvatarChangeCostumeNotify;
import emu.grasscutter.server.packet.send.PacketAvatarFlycloakChangeNotify; import emu.grasscutter.server.packet.send.PacketAvatarFlycloakChangeNotify;
import it.unimi.dsi.fastutil.ints.Int2ObjectMap; import it.unimi.dsi.fastutil.ints.Int2ObjectMap;
...@@ -16,22 +16,22 @@ import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap; ...@@ -16,22 +16,22 @@ import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap;
import it.unimi.dsi.fastutil.longs.Long2ObjectMap; import it.unimi.dsi.fastutil.longs.Long2ObjectMap;
import it.unimi.dsi.fastutil.longs.Long2ObjectOpenHashMap; import it.unimi.dsi.fastutil.longs.Long2ObjectOpenHashMap;
public class AvatarStorage implements Iterable<GenshinAvatar> { public class AvatarStorage implements Iterable<Avatar> {
private final GenshinPlayer player; private final Player player;
private final Int2ObjectMap<GenshinAvatar> avatars; private final Int2ObjectMap<Avatar> avatars;
private final Long2ObjectMap<GenshinAvatar> avatarsGuid; private final Long2ObjectMap<Avatar> avatarsGuid;
public AvatarStorage(GenshinPlayer player) { public AvatarStorage(Player player) {
this.player = player; this.player = player;
this.avatars = new Int2ObjectOpenHashMap<>(); this.avatars = new Int2ObjectOpenHashMap<>();
this.avatarsGuid = new Long2ObjectOpenHashMap<>(); this.avatarsGuid = new Long2ObjectOpenHashMap<>();
} }
public GenshinPlayer getPlayer() { public Player getPlayer() {
return player; return player;
} }
public Int2ObjectMap<GenshinAvatar> getAvatars() { public Int2ObjectMap<Avatar> getAvatars() {
return avatars; return avatars;
} }
...@@ -39,11 +39,11 @@ public class AvatarStorage implements Iterable<GenshinAvatar> { ...@@ -39,11 +39,11 @@ public class AvatarStorage implements Iterable<GenshinAvatar> {
return this.avatars.size(); return this.avatars.size();
} }
public GenshinAvatar getAvatarById(int id) { public Avatar getAvatarById(int id) {
return getAvatars().get(id); return getAvatars().get(id);
} }
public GenshinAvatar getAvatarByGuid(long id) { public Avatar getAvatarByGuid(long id) {
return avatarsGuid.get(id); return avatarsGuid.get(id);
} }
...@@ -51,7 +51,7 @@ public class AvatarStorage implements Iterable<GenshinAvatar> { ...@@ -51,7 +51,7 @@ public class AvatarStorage implements Iterable<GenshinAvatar> {
return getAvatars().containsKey(id); return getAvatars().containsKey(id);
} }
public boolean addAvatar(GenshinAvatar avatar) { public boolean addAvatar(Avatar avatar) {
if (avatar.getAvatarData() == null || this.hasAvatar(avatar.getAvatarId())) { if (avatar.getAvatarData() == null || this.hasAvatar(avatar.getAvatarId())) {
return false; return false;
} }
...@@ -68,14 +68,14 @@ public class AvatarStorage implements Iterable<GenshinAvatar> { ...@@ -68,14 +68,14 @@ public class AvatarStorage implements Iterable<GenshinAvatar> {
return true; return true;
} }
public void addStartingWeapon(GenshinAvatar avatar) { public void addStartingWeapon(Avatar avatar) {
// Make sure avatar owner is this player // Make sure avatar owner is this player
if (avatar.getPlayer() != this.getPlayer()) { if (avatar.getPlayer() != this.getPlayer()) {
return; return;
} }
// Create weapon // Create weapon
GenshinItem weapon = new GenshinItem(avatar.getAvatarData().getInitialWeapon()); GameItem weapon = new GameItem(avatar.getAvatarData().getInitialWeapon());
if (weapon.getItemData() != null) { if (weapon.getItemData() != null) {
this.getPlayer().getInventory().addItem(weapon); this.getPlayer().getInventory().addItem(weapon);
...@@ -85,7 +85,7 @@ public class AvatarStorage implements Iterable<GenshinAvatar> { ...@@ -85,7 +85,7 @@ public class AvatarStorage implements Iterable<GenshinAvatar> {
} }
public boolean wearFlycloak(long avatarGuid, int flycloakId) { public boolean wearFlycloak(long avatarGuid, int flycloakId) {
GenshinAvatar avatar = this.getAvatarByGuid(avatarGuid); Avatar avatar = this.getAvatarByGuid(avatarGuid);
if (avatar == null || !getPlayer().getFlyCloakList().contains(flycloakId)) { if (avatar == null || !getPlayer().getFlyCloakList().contains(flycloakId)) {
return false; return false;
...@@ -101,7 +101,7 @@ public class AvatarStorage implements Iterable<GenshinAvatar> { ...@@ -101,7 +101,7 @@ public class AvatarStorage implements Iterable<GenshinAvatar> {
} }
public boolean changeCostume(long avatarGuid, int costumeId) { public boolean changeCostume(long avatarGuid, int costumeId) {
GenshinAvatar avatar = this.getAvatarByGuid(avatarGuid); Avatar avatar = this.getAvatarByGuid(avatarGuid);
if (avatar == null) { if (avatar == null) {
return false; return false;
...@@ -130,15 +130,15 @@ public class AvatarStorage implements Iterable<GenshinAvatar> { ...@@ -130,15 +130,15 @@ public class AvatarStorage implements Iterable<GenshinAvatar> {
} }
public void loadFromDatabase() { public void loadFromDatabase() {
List<GenshinAvatar> avatars = DatabaseHelper.getAvatars(getPlayer()); List<Avatar> avatars = DatabaseHelper.getAvatars(getPlayer());
for (GenshinAvatar avatar : avatars) { for (Avatar avatar : avatars) {
// Should never happen // Should never happen
if (avatar.getObjectId() == null) { if (avatar.getObjectId() == null) {
continue; continue;
} }
AvatarData avatarData = GenshinData.getAvatarDataMap().get(avatar.getAvatarId()); AvatarData avatarData = GameData.getAvatarDataMap().get(avatar.getAvatarId());
if (avatarData == null) { if (avatarData == null) {
continue; continue;
} }
...@@ -157,7 +157,7 @@ public class AvatarStorage implements Iterable<GenshinAvatar> { ...@@ -157,7 +157,7 @@ public class AvatarStorage implements Iterable<GenshinAvatar> {
} }
public void postLoad() { public void postLoad() {
for (GenshinAvatar avatar : this) { for (Avatar avatar : this) {
// Weapon check // Weapon check
if (avatar.getWeapon() == null) { if (avatar.getWeapon() == null) {
this.addStartingWeapon(avatar); this.addStartingWeapon(avatar);
...@@ -168,7 +168,7 @@ public class AvatarStorage implements Iterable<GenshinAvatar> { ...@@ -168,7 +168,7 @@ public class AvatarStorage implements Iterable<GenshinAvatar> {
} }
@Override @Override
public Iterator<GenshinAvatar> iterator() { public Iterator<Avatar> iterator() {
return getAvatars().values().iterator(); return getAvatars().values().iterator();
} }
} }
package emu.grasscutter.game.entity; package emu.grasscutter.game.entity;
import emu.grasscutter.GenshinConstants; import emu.grasscutter.GameConstants;
import emu.grasscutter.data.GenshinData; import emu.grasscutter.data.GameData;
import emu.grasscutter.data.def.AvatarData; import emu.grasscutter.data.def.AvatarData;
import emu.grasscutter.data.def.AvatarSkillDepotData; import emu.grasscutter.data.def.AvatarSkillDepotData;
import emu.grasscutter.game.GenshinPlayer; import emu.grasscutter.game.avatar.Avatar;
import emu.grasscutter.game.GenshinScene;
import emu.grasscutter.game.World;
import emu.grasscutter.game.avatar.GenshinAvatar;
import emu.grasscutter.game.inventory.EquipType; import emu.grasscutter.game.inventory.EquipType;
import emu.grasscutter.game.inventory.GenshinItem; import emu.grasscutter.game.inventory.GameItem;
import emu.grasscutter.game.player.Player;
import emu.grasscutter.game.props.EntityIdType; import emu.grasscutter.game.props.EntityIdType;
import emu.grasscutter.game.props.FightProperty; import emu.grasscutter.game.props.FightProperty;
import emu.grasscutter.game.props.PlayerProperty; import emu.grasscutter.game.props.PlayerProperty;
import emu.grasscutter.game.world.Scene;
import emu.grasscutter.game.world.World;
import emu.grasscutter.net.proto.AbilityControlBlockOuterClass.AbilityControlBlock; import emu.grasscutter.net.proto.AbilityControlBlockOuterClass.AbilityControlBlock;
import emu.grasscutter.net.proto.AbilityEmbryoOuterClass.AbilityEmbryo; import emu.grasscutter.net.proto.AbilityEmbryoOuterClass.AbilityEmbryo;
import emu.grasscutter.net.proto.AbilitySyncStateInfoOuterClass.AbilitySyncStateInfo; import emu.grasscutter.net.proto.AbilitySyncStateInfoOuterClass.AbilitySyncStateInfo;
...@@ -34,29 +34,29 @@ import emu.grasscutter.utils.Utils; ...@@ -34,29 +34,29 @@ import emu.grasscutter.utils.Utils;
import it.unimi.dsi.fastutil.ints.Int2FloatMap; import it.unimi.dsi.fastutil.ints.Int2FloatMap;
import it.unimi.dsi.fastutil.ints.Int2FloatOpenHashMap; import it.unimi.dsi.fastutil.ints.Int2FloatOpenHashMap;
public class EntityAvatar extends GenshinEntity { public class EntityAvatar extends GameEntity {
private final GenshinAvatar avatar; private final Avatar avatar;
private PlayerDieType killedType; private PlayerDieType killedType;
private int killedBy; private int killedBy;
public EntityAvatar(GenshinScene scene, GenshinAvatar avatar) { public EntityAvatar(Scene scene, Avatar avatar) {
super(scene); super(scene);
this.avatar = avatar; this.avatar = avatar;
this.id = getScene().getWorld().getNextEntityId(EntityIdType.AVATAR); this.id = getScene().getWorld().getNextEntityId(EntityIdType.AVATAR);
GenshinItem weapon = this.getAvatar().getWeapon(); GameItem weapon = this.getAvatar().getWeapon();
if (weapon != null) { if (weapon != null) {
weapon.setWeaponEntityId(getScene().getWorld().getNextEntityId(EntityIdType.WEAPON)); weapon.setWeaponEntityId(getScene().getWorld().getNextEntityId(EntityIdType.WEAPON));
} }
} }
public EntityAvatar(GenshinAvatar avatar) { public EntityAvatar(Avatar avatar) {
super(null); super(null);
this.avatar = avatar; this.avatar = avatar;
} }
public GenshinPlayer getPlayer() { public Player getPlayer() {
return avatar.getPlayer(); return avatar.getPlayer();
} }
...@@ -70,7 +70,7 @@ public class EntityAvatar extends GenshinEntity { ...@@ -70,7 +70,7 @@ public class EntityAvatar extends GenshinEntity {
return getPlayer().getRotation(); return getPlayer().getRotation();
} }
public GenshinAvatar getAvatar() { public Avatar getAvatar() {
return avatar; return avatar;
} }
...@@ -122,7 +122,7 @@ public class EntityAvatar extends GenshinEntity { ...@@ -122,7 +122,7 @@ public class EntityAvatar extends GenshinEntity {
.setCostumeId(this.getAvatar().getCostume()) .setCostumeId(this.getAvatar().getCostume())
.setBornTime(this.getAvatar().getBornTime()); .setBornTime(this.getAvatar().getBornTime());
for (GenshinItem item : avatar.getEquips().values()) { for (GameItem item : avatar.getEquips().values()) {
if (item.getItemData().getEquipType() == EquipType.EQUIP_WEAPON) { if (item.getItemData().getEquipType() == EquipType.EQUIP_WEAPON) {
avatarInfo.setWeapon(item.createSceneWeaponInfo()); avatarInfo.setWeapon(item.createSceneWeaponInfo());
} else { } else {
...@@ -187,17 +187,17 @@ public class EntityAvatar extends GenshinEntity { ...@@ -187,17 +187,17 @@ public class EntityAvatar extends GenshinEntity {
AbilityEmbryo emb = AbilityEmbryo.newBuilder() AbilityEmbryo emb = AbilityEmbryo.newBuilder()
.setAbilityId(++embryoId) .setAbilityId(++embryoId)
.setAbilityNameHash(id) .setAbilityNameHash(id)
.setAbilityOverrideNameHash(GenshinConstants.DEFAULT_ABILITY_NAME) .setAbilityOverrideNameHash(GameConstants.DEFAULT_ABILITY_NAME)
.build(); .build();
abilityControlBlock.addAbilityEmbryoList(emb); abilityControlBlock.addAbilityEmbryoList(emb);
} }
} }
// Add default abilities // Add default abilities
for (int id : GenshinConstants.DEFAULT_ABILITY_HASHES) { for (int id : GameConstants.DEFAULT_ABILITY_HASHES) {
AbilityEmbryo emb = AbilityEmbryo.newBuilder() AbilityEmbryo emb = AbilityEmbryo.newBuilder()
.setAbilityId(++embryoId) .setAbilityId(++embryoId)
.setAbilityNameHash(id) .setAbilityNameHash(id)
.setAbilityOverrideNameHash(GenshinConstants.DEFAULT_ABILITY_NAME) .setAbilityOverrideNameHash(GameConstants.DEFAULT_ABILITY_NAME)
.build(); .build();
abilityControlBlock.addAbilityEmbryoList(emb); abilityControlBlock.addAbilityEmbryoList(emb);
} }
...@@ -206,18 +206,18 @@ public class EntityAvatar extends GenshinEntity { ...@@ -206,18 +206,18 @@ public class EntityAvatar extends GenshinEntity {
AbilityEmbryo emb = AbilityEmbryo.newBuilder() AbilityEmbryo emb = AbilityEmbryo.newBuilder()
.setAbilityId(++embryoId) .setAbilityId(++embryoId)
.setAbilityNameHash(id) .setAbilityNameHash(id)
.setAbilityOverrideNameHash(GenshinConstants.DEFAULT_ABILITY_NAME) .setAbilityOverrideNameHash(GameConstants.DEFAULT_ABILITY_NAME)
.build(); .build();
abilityControlBlock.addAbilityEmbryoList(emb); abilityControlBlock.addAbilityEmbryoList(emb);
} }
// Add skill depot abilities // Add skill depot abilities
AvatarSkillDepotData skillDepot = GenshinData.getAvatarSkillDepotDataMap().get(this.getAvatar().getSkillDepotId()); AvatarSkillDepotData skillDepot = GameData.getAvatarSkillDepotDataMap().get(this.getAvatar().getSkillDepotId());
if (skillDepot != null && skillDepot.getAbilities() != null) { if (skillDepot != null && skillDepot.getAbilities() != null) {
for (int id : skillDepot.getAbilities()) { for (int id : skillDepot.getAbilities()) {
AbilityEmbryo emb = AbilityEmbryo.newBuilder() AbilityEmbryo emb = AbilityEmbryo.newBuilder()
.setAbilityId(++embryoId) .setAbilityId(++embryoId)
.setAbilityNameHash(id) .setAbilityNameHash(id)
.setAbilityOverrideNameHash(GenshinConstants.DEFAULT_ABILITY_NAME) .setAbilityOverrideNameHash(GameConstants.DEFAULT_ABILITY_NAME)
.build(); .build();
abilityControlBlock.addAbilityEmbryoList(emb); abilityControlBlock.addAbilityEmbryoList(emb);
} }
...@@ -228,7 +228,7 @@ public class EntityAvatar extends GenshinEntity { ...@@ -228,7 +228,7 @@ public class EntityAvatar extends GenshinEntity {
AbilityEmbryo emb = AbilityEmbryo.newBuilder() AbilityEmbryo emb = AbilityEmbryo.newBuilder()
.setAbilityId(++embryoId) .setAbilityId(++embryoId)
.setAbilityNameHash(Utils.abilityHash(skill)) .setAbilityNameHash(Utils.abilityHash(skill))
.setAbilityOverrideNameHash(GenshinConstants.DEFAULT_ABILITY_NAME) .setAbilityOverrideNameHash(GameConstants.DEFAULT_ABILITY_NAME)
.build(); .build();
abilityControlBlock.addAbilityEmbryoList(emb); abilityControlBlock.addAbilityEmbryoList(emb);
} }
......
package emu.grasscutter.game.entity; package emu.grasscutter.game.entity;
import emu.grasscutter.game.GenshinPlayer; import emu.grasscutter.game.player.Player;
import emu.grasscutter.game.GenshinScene;
import emu.grasscutter.game.World;
import emu.grasscutter.game.props.PlayerProperty; import emu.grasscutter.game.props.PlayerProperty;
import emu.grasscutter.game.world.Scene;
import emu.grasscutter.game.world.World;
import emu.grasscutter.net.proto.AbilitySyncStateInfoOuterClass.AbilitySyncStateInfo; import emu.grasscutter.net.proto.AbilitySyncStateInfoOuterClass.AbilitySyncStateInfo;
import emu.grasscutter.net.proto.AnimatorParameterValueInfoPairOuterClass.AnimatorParameterValueInfoPair; import emu.grasscutter.net.proto.AnimatorParameterValueInfoPairOuterClass.AnimatorParameterValueInfoPair;
import emu.grasscutter.net.proto.ClientGadgetInfoOuterClass; import emu.grasscutter.net.proto.ClientGadgetInfoOuterClass;
...@@ -24,7 +24,7 @@ import emu.grasscutter.utils.ProtoHelper; ...@@ -24,7 +24,7 @@ import emu.grasscutter.utils.ProtoHelper;
import it.unimi.dsi.fastutil.ints.Int2FloatOpenHashMap; import it.unimi.dsi.fastutil.ints.Int2FloatOpenHashMap;
public class EntityClientGadget extends EntityGadget { public class EntityClientGadget extends EntityGadget {
private final GenshinPlayer owner; private final Player owner;
private final Position pos; private final Position pos;
private final Position rot; private final Position rot;
...@@ -36,7 +36,7 @@ public class EntityClientGadget extends EntityGadget { ...@@ -36,7 +36,7 @@ public class EntityClientGadget extends EntityGadget {
private int targetEntityId; private int targetEntityId;
private boolean asyncLoad; private boolean asyncLoad;
public EntityClientGadget(GenshinScene scene, GenshinPlayer player, EvtCreateGadgetNotify notify) { public EntityClientGadget(Scene scene, Player player, EvtCreateGadgetNotify notify) {
super(scene); super(scene);
this.owner = player; this.owner = player;
this.id = notify.getEntityId(); this.id = notify.getEntityId();
...@@ -55,7 +55,7 @@ public class EntityClientGadget extends EntityGadget { ...@@ -55,7 +55,7 @@ public class EntityClientGadget extends EntityGadget {
return configId; return configId;
} }
public GenshinPlayer getOwner() { public Player getOwner() {
return owner; return owner;
} }
......
package emu.grasscutter.game.entity; package emu.grasscutter.game.entity;
import emu.grasscutter.game.GenshinScene; import emu.grasscutter.game.world.Scene;
import emu.grasscutter.game.World; import emu.grasscutter.game.world.World;
public abstract class EntityGadget extends GenshinEntity { public abstract class EntityGadget extends GameEntity {
public EntityGadget(GenshinScene scene) { public EntityGadget(Scene scene) {
super(scene); super(scene);
} }
......
package emu.grasscutter.game.entity; package emu.grasscutter.game.entity;
import emu.grasscutter.data.def.ItemData; import emu.grasscutter.data.def.ItemData;
import emu.grasscutter.game.GenshinPlayer; import emu.grasscutter.game.inventory.GameItem;
import emu.grasscutter.game.GenshinScene; import emu.grasscutter.game.player.Player;
import emu.grasscutter.game.World;
import emu.grasscutter.game.inventory.GenshinItem;
import emu.grasscutter.game.props.EntityIdType; import emu.grasscutter.game.props.EntityIdType;
import emu.grasscutter.game.props.PlayerProperty; import emu.grasscutter.game.props.PlayerProperty;
import emu.grasscutter.game.world.Scene;
import emu.grasscutter.game.world.World;
import emu.grasscutter.net.proto.AbilitySyncStateInfoOuterClass.AbilitySyncStateInfo; import emu.grasscutter.net.proto.AbilitySyncStateInfoOuterClass.AbilitySyncStateInfo;
import emu.grasscutter.net.proto.AnimatorParameterValueInfoPairOuterClass.AnimatorParameterValueInfoPair; import emu.grasscutter.net.proto.AnimatorParameterValueInfoPairOuterClass.AnimatorParameterValueInfoPair;
import emu.grasscutter.net.proto.EntityAuthorityInfoOuterClass.EntityAuthorityInfo; import emu.grasscutter.net.proto.EntityAuthorityInfoOuterClass.EntityAuthorityInfo;
...@@ -28,16 +28,16 @@ public class EntityItem extends EntityGadget { ...@@ -28,16 +28,16 @@ public class EntityItem extends EntityGadget {
private final Position pos; private final Position pos;
private final Position rot; private final Position rot;
private final GenshinItem item; private final GameItem item;
private final long guid; private final long guid;
public EntityItem(GenshinScene scene, GenshinPlayer player, ItemData itemData, Position pos, int count) { public EntityItem(Scene scene, Player player, ItemData itemData, Position pos, int count) {
super(scene); super(scene);
this.id = getScene().getWorld().getNextEntityId(EntityIdType.GADGET); this.id = getScene().getWorld().getNextEntityId(EntityIdType.GADGET);
this.pos = new Position(pos); this.pos = new Position(pos);
this.rot = new Position(); this.rot = new Position();
this.guid = player.getNextGenshinGuid(); this.guid = player.getNextGameGuid();
this.item = new GenshinItem(itemData, count); this.item = new GameItem(itemData, count);
} }
@Override @Override
...@@ -45,7 +45,7 @@ public class EntityItem extends EntityGadget { ...@@ -45,7 +45,7 @@ public class EntityItem extends EntityGadget {
return this.id; return this.id;
} }
private GenshinItem getItem() { private GameItem getItem() {
return this.item; return this.item;
} }
......
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