Commit 1c36f078 authored by Melledy's avatar Melledy
Browse files

Renamed all references to a certain game

parent 6b8902be
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.Player;
import emu.grasscutter.game.avatar.GenshinAvatar; import emu.grasscutter.game.avatar.Avatar;
import emu.grasscutter.game.friends.Friendship; import emu.grasscutter.game.friends.Friendship;
import emu.grasscutter.game.inventory.GenshinItem; import emu.grasscutter.game.inventory.GameItem;
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,19 +90,19 @@ public final class DatabaseHelper { ...@@ -90,19 +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 List<GenshinPlayer> getAllPlayers() { public static List<Player> getAllPlayers() {
return DatabaseManager.getDatastore().find(GenshinPlayer.class).stream().toList(); return DatabaseManager.getDatastore().find(Player.class).stream().toList();
} }
public static GenshinPlayer getPlayerById(int id) { public static Player getPlayerById(int id) {
return DatabaseManager.getDatastore().find(GenshinPlayer.class).filter(Filters.eq("_id", id)).first(); 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)) {
...@@ -127,42 +127,42 @@ public final class DatabaseHelper { ...@@ -127,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.Player;
import emu.grasscutter.game.avatar.GenshinAvatar; import emu.grasscutter.game.avatar.Avatar;
import emu.grasscutter.game.friends.Friendship; import emu.grasscutter.game.friends.Friendship;
import emu.grasscutter.game.inventory.GenshinItem; import emu.grasscutter.game.inventory.GameItem;
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;
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;
} }
......
...@@ -2,16 +2,16 @@ package emu.grasscutter.game; ...@@ -2,16 +2,16 @@ package emu.grasscutter.game;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import emu.grasscutter.net.packet.GenshinPacket; import emu.grasscutter.net.packet.BasePacket;
import emu.grasscutter.net.proto.ForwardTypeOuterClass.ForwardType; import emu.grasscutter.net.proto.ForwardTypeOuterClass.ForwardType;
public class InvokeHandler<T> { public class InvokeHandler<T> {
private final List<T> entryListForwardAll; private final List<T> entryListForwardAll;
private final List<T> entryListForwardAllExceptCur; private final List<T> entryListForwardAllExceptCur;
private final List<T> entryListForwardHost; private final List<T> entryListForwardHost;
private final Class<? extends GenshinPacket> packetClass; private final Class<? extends BasePacket> packetClass;
public InvokeHandler(Class<? extends GenshinPacket> packetClass) { public InvokeHandler(Class<? extends BasePacket> packetClass) {
this.entryListForwardAll = new ArrayList<>(); this.entryListForwardAll = new ArrayList<>();
this.entryListForwardAllExceptCur = new ArrayList<>(); this.entryListForwardAllExceptCur = new ArrayList<>();
this.entryListForwardHost = new ArrayList<>(); this.entryListForwardHost = new ArrayList<>();
...@@ -28,7 +28,7 @@ public class InvokeHandler<T> { ...@@ -28,7 +28,7 @@ public class InvokeHandler<T> {
} }
} }
public synchronized void update(GenshinPlayer player) { public synchronized void update(Player player) {
if (player.getWorld() == null) { if (player.getWorld() == null) {
this.entryListForwardAll.clear(); this.entryListForwardAll.clear();
this.entryListForwardAllExceptCur.clear(); this.entryListForwardAllExceptCur.clear();
...@@ -38,17 +38,17 @@ public class InvokeHandler<T> { ...@@ -38,17 +38,17 @@ public class InvokeHandler<T> {
try { try {
if (entryListForwardAll.size() > 0) { if (entryListForwardAll.size() > 0) {
GenshinPacket packet = packetClass.getDeclaredConstructor(List.class).newInstance(this.entryListForwardAll); BasePacket packet = packetClass.getDeclaredConstructor(List.class).newInstance(this.entryListForwardAll);
player.getScene().broadcastPacket(packet); player.getScene().broadcastPacket(packet);
this.entryListForwardAll.clear(); this.entryListForwardAll.clear();
} }
if (entryListForwardAllExceptCur.size() > 0) { if (entryListForwardAllExceptCur.size() > 0) {
GenshinPacket packet = packetClass.getDeclaredConstructor(List.class).newInstance(this.entryListForwardAllExceptCur); BasePacket packet = packetClass.getDeclaredConstructor(List.class).newInstance(this.entryListForwardAllExceptCur);
player.getScene().broadcastPacketToOthers(player, packet); player.getScene().broadcastPacketToOthers(player, packet);
this.entryListForwardAllExceptCur.clear(); this.entryListForwardAllExceptCur.clear();
} }
if (entryListForwardHost.size() > 0) { if (entryListForwardHost.size() > 0) {
GenshinPacket packet = packetClass.getDeclaredConstructor(List.class).newInstance(this.entryListForwardHost); BasePacket packet = packetClass.getDeclaredConstructor(List.class).newInstance(this.entryListForwardHost);
player.getWorld().getHost().sendPacket(packet); player.getWorld().getHost().sendPacket(packet);
this.entryListForwardHost.clear(); this.entryListForwardHost.clear();
} }
......
...@@ -57,7 +57,7 @@ public class Mail { ...@@ -57,7 +57,7 @@ public class Mail {
this(title, content, "Server"); this(title, content, "Server");
} }
public MailContent(String title, String content, GenshinPlayer sender) { public MailContent(String title, String content, Player sender) {
this(title, content, sender.getNickname()); this(title, content, sender.getNickname());
} }
......
...@@ -4,26 +4,26 @@ import java.time.Instant; ...@@ -4,26 +4,26 @@ import java.time.Instant;
import java.util.*; import java.util.*;
import dev.morphia.annotations.*; import dev.morphia.annotations.*;
import emu.grasscutter.GenshinConstants; import emu.grasscutter.GameConstants;
import emu.grasscutter.Grasscutter; import emu.grasscutter.Grasscutter;
import emu.grasscutter.command.CommandHandler; import emu.grasscutter.command.CommandHandler;
import emu.grasscutter.data.GenshinData; import emu.grasscutter.data.GameData;
import emu.grasscutter.data.def.PlayerLevelData; import emu.grasscutter.data.def.PlayerLevelData;
import emu.grasscutter.database.DatabaseHelper; import emu.grasscutter.database.DatabaseHelper;
import emu.grasscutter.game.avatar.AvatarProfileData; import emu.grasscutter.game.avatar.AvatarProfileData;
import emu.grasscutter.game.avatar.AvatarStorage; import emu.grasscutter.game.avatar.AvatarStorage;
import emu.grasscutter.game.avatar.GenshinAvatar; import emu.grasscutter.game.avatar.Avatar;
import emu.grasscutter.game.entity.EntityItem; import emu.grasscutter.game.entity.EntityItem;
import emu.grasscutter.game.entity.GenshinEntity; import emu.grasscutter.game.entity.GameEntity;
import emu.grasscutter.game.friends.FriendsList; import emu.grasscutter.game.friends.FriendsList;
import emu.grasscutter.game.friends.PlayerProfile; import emu.grasscutter.game.friends.PlayerProfile;
import emu.grasscutter.game.gacha.PlayerGachaInfo; import emu.grasscutter.game.gacha.PlayerGachaInfo;
import emu.grasscutter.game.inventory.GenshinItem; import emu.grasscutter.game.inventory.GameItem;
import emu.grasscutter.game.inventory.Inventory; import emu.grasscutter.game.inventory.Inventory;
import emu.grasscutter.game.player.PlayerBirthday; import emu.grasscutter.game.player.PlayerBirthday;
import emu.grasscutter.game.props.ActionReason; import emu.grasscutter.game.props.ActionReason;
import emu.grasscutter.game.props.PlayerProperty; import emu.grasscutter.game.props.PlayerProperty;
import emu.grasscutter.net.packet.GenshinPacket; import emu.grasscutter.net.packet.BasePacket;
import emu.grasscutter.net.proto.AbilityInvokeEntryOuterClass.AbilityInvokeEntry; import emu.grasscutter.net.proto.AbilityInvokeEntryOuterClass.AbilityInvokeEntry;
import emu.grasscutter.net.proto.CombatInvokeEntryOuterClass.CombatInvokeEntry; import emu.grasscutter.net.proto.CombatInvokeEntryOuterClass.CombatInvokeEntry;
import emu.grasscutter.net.proto.HeadImageOuterClass.HeadImage; import emu.grasscutter.net.proto.HeadImageOuterClass.HeadImage;
...@@ -46,7 +46,7 @@ import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap; ...@@ -46,7 +46,7 @@ import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap;
import java.util.*; import java.util.*;
@Entity(value = "players", useDiscriminator = false) @Entity(value = "players", useDiscriminator = false)
public class GenshinPlayer { public class Player {
@Id private int id; @Id private int id;
@Indexed(options = @IndexOptions(unique = true)) private String accountId; @Indexed(options = @IndexOptions(unique = true)) private String accountId;
...@@ -67,7 +67,7 @@ public class GenshinPlayer { ...@@ -67,7 +67,7 @@ public class GenshinPlayer {
@Transient private long nextGuid = 0; @Transient private long nextGuid = 0;
@Transient private int peerId; @Transient private int peerId;
@Transient private World world; @Transient private World world;
@Transient private GenshinScene scene; @Transient private Scene scene;
@Transient private GameSession session; @Transient private GameSession session;
@Transient private AvatarStorage avatars; @Transient private AvatarStorage avatars;
@Transient private Inventory inventory; @Transient private Inventory inventory;
...@@ -104,7 +104,7 @@ public class GenshinPlayer { ...@@ -104,7 +104,7 @@ public class GenshinPlayer {
@Deprecated @Deprecated
@SuppressWarnings({"rawtypes", "unchecked"}) // Morphia only! @SuppressWarnings({"rawtypes", "unchecked"}) // Morphia only!
public GenshinPlayer() { public Player() {
this.inventory = new Inventory(this); this.inventory = new Inventory(this);
this.avatars = new AvatarStorage(this); this.avatars = new AvatarStorage(this);
this.friendsList = new FriendsList(this); this.friendsList = new FriendsList(this);
...@@ -140,7 +140,7 @@ public class GenshinPlayer { ...@@ -140,7 +140,7 @@ public class GenshinPlayer {
} }
// On player creation // On player creation
public GenshinPlayer(GameSession session) { public Player(GameSession session) {
this(); this();
this.account = session.getAccount(); this.account = session.getAccount();
this.accountId = this.getAccount().getId(); this.accountId = this.getAccount().getId();
...@@ -159,7 +159,7 @@ public class GenshinPlayer { ...@@ -159,7 +159,7 @@ public class GenshinPlayer {
this.setProperty(PlayerProperty.PROP_PLAYER_RESIN, 160); this.setProperty(PlayerProperty.PROP_PLAYER_RESIN, 160);
this.getFlyCloakList().add(140001); this.getFlyCloakList().add(140001);
this.getNameCardList().add(210001); this.getNameCardList().add(210001);
this.getPos().set(GenshinConstants.START_POSITION); this.getPos().set(GameConstants.START_POSITION);
this.getRotation().set(0, 307, 0); this.getRotation().set(0, 307, 0);
} }
...@@ -171,7 +171,7 @@ public class GenshinPlayer { ...@@ -171,7 +171,7 @@ public class GenshinPlayer {
this.id = id; this.id = id;
} }
public long getNextGenshinGuid() { public long getNextGameGuid() {
long nextId = ++this.nextGuid; long nextId = ++this.nextGuid;
return ((long) this.getUid() << 32) + nextId; return ((long) this.getUid() << 32) + nextId;
} }
...@@ -209,11 +209,11 @@ public class GenshinPlayer { ...@@ -209,11 +209,11 @@ public class GenshinPlayer {
this.world = world; this.world = world;
} }
public synchronized GenshinScene getScene() { public synchronized Scene getScene() {
return scene; return scene;
} }
public synchronized void setScene(GenshinScene scene) { public synchronized void setScene(Scene scene) {
this.scene = scene; this.scene = scene;
} }
...@@ -292,7 +292,7 @@ public class GenshinPlayer { ...@@ -292,7 +292,7 @@ public class GenshinPlayer {
} }
private int getExpRequired(int level) { private int getExpRequired(int level) {
PlayerLevelData levelData = GenshinData.getPlayerLevelDataMap().get(level); PlayerLevelData levelData = GameData.getPlayerLevelDataMap().get(level);
return levelData != null ? levelData.getExp() : 0; return levelData != null ? levelData.getExp() : 0;
} }
...@@ -546,9 +546,9 @@ public class GenshinPlayer { ...@@ -546,9 +546,9 @@ public class GenshinPlayer {
} }
public void rechargeMoonCard() { public void rechargeMoonCard() {
LinkedList<GenshinItem> items = new LinkedList<GenshinItem>(); LinkedList<GameItem> items = new LinkedList<GameItem>();
for (int i = 0; i < 300; i++) { for (int i = 0; i < 300; i++) {
items.add(new GenshinItem(203)); items.add(new GameItem(203));
} }
inventory.addItems(items); inventory.addItems(items);
if (!moonCard) { if (!moonCard) {
...@@ -583,8 +583,8 @@ public class GenshinPlayer { ...@@ -583,8 +583,8 @@ public class GenshinPlayer {
} }
moonCardGetTimes.add(now); moonCardGetTimes.add(now);
addMoonCardDays(1); addMoonCardDays(1);
GenshinItem genshinItem = new GenshinItem(201, 90); GameItem item = new GameItem(201, 90);
getInventory().addItem(genshinItem, ActionReason.BlessingRedeemReward); getInventory().addItem(item, ActionReason.BlessingRedeemReward);
session.send(new PacketCardProductRewardNotify(getMoonCardRemainDays())); session.send(new PacketCardProductRewardNotify(getMoonCardRemainDays()));
} }
...@@ -604,29 +604,19 @@ public class GenshinPlayer { ...@@ -604,29 +604,19 @@ public class GenshinPlayer {
this.hasSentAvatarDataNotify = hasSentAvatarDataNotify; this.hasSentAvatarDataNotify = hasSentAvatarDataNotify;
} }
public void addAvatar(GenshinAvatar avatar) { public void addAvatar(Avatar avatar) {
boolean result = getAvatars().addAvatar(avatar); boolean result = getAvatars().addAvatar(avatar);
if (result) { if (result) {
// Add starting weapon // Add starting weapon
getAvatars().addStartingWeapon(avatar); getAvatars().addStartingWeapon(avatar);
// Try adding to team if possible
//List<EntityAvatar> currentTeam = this.getTeamManager().getCurrentTeam();
boolean addedToTeam = false;
/*
if (currentTeam.size() <= GenshinConstants.MAX_AVATARS_IN_TEAM) {
addedToTeam = currentTeam
}
*/
// Done // Done
if (hasSentAvatarDataNotify()) { if (hasSentAvatarDataNotify()) {
// Recalc stats // Recalc stats
avatar.recalcStats(); avatar.recalcStats();
// Packet // Packet
sendPacket(new PacketAvatarAddNotify(avatar, addedToTeam)); sendPacket(new PacketAvatarAddNotify(avatar, false));
} }
} else { } else {
// Failed adding avatar // Failed adding avatar
...@@ -659,7 +649,7 @@ public class GenshinPlayer { ...@@ -659,7 +649,7 @@ public class GenshinPlayer {
} }
public void dropMessage(Object message) { public void dropMessage(Object message) {
this.sendPacket(new PacketPrivateChatNotify(GenshinConstants.SERVER_CONSOLE_UID, getUid(), message.toString())); this.sendPacket(new PacketPrivateChatNotify(GameConstants.SERVER_CONSOLE_UID, getUid(), message.toString()));
} }
/** /**
...@@ -668,7 +658,7 @@ public class GenshinPlayer { ...@@ -668,7 +658,7 @@ public class GenshinPlayer {
* @param sender The sender of the message. * @param sender The sender of the message.
* @param message The message to send. * @param message The message to send.
*/ */
public void sendMessage(GenshinPlayer sender, Object message) { public void sendMessage(Player sender, Object message) {
this.sendPacket(new PacketPrivateChatNotify(sender.getUid(), this.getUid(), message.toString())); this.sendPacket(new PacketPrivateChatNotify(sender.getUid(), this.getUid(), message.toString()));
} }
...@@ -714,7 +704,7 @@ public class GenshinPlayer { ...@@ -714,7 +704,7 @@ public class GenshinPlayer {
} }
public void interactWith(int gadgetEntityId) { public void interactWith(int gadgetEntityId) {
GenshinEntity entity = getScene().getEntityById(gadgetEntityId); GameEntity entity = getScene().getEntityById(gadgetEntityId);
if (entity == null) { if (entity == null) {
return; return;
...@@ -727,7 +717,7 @@ public class GenshinPlayer { ...@@ -727,7 +717,7 @@ public class GenshinPlayer {
if (entity instanceof EntityItem) { if (entity instanceof EntityItem) {
// Pick item // Pick item
EntityItem drop = (EntityItem) entity; EntityItem drop = (EntityItem) entity;
GenshinItem item = new GenshinItem(drop.getItemData(), drop.getCount()); GameItem item = new GameItem(drop.getItemData(), drop.getCount());
// Add to inventory // Add to inventory
boolean success = getInventory().addItem(item, ActionReason.SubfieldDrop); boolean success = getInventory().addItem(item, ActionReason.SubfieldDrop);
if (success) { if (success) {
...@@ -746,7 +736,7 @@ public class GenshinPlayer { ...@@ -746,7 +736,7 @@ public class GenshinPlayer {
} }
public void sendPacket(GenshinPacket packet) { public void sendPacket(BasePacket packet) {
if (this.hasSentAvatarDataNotify) { if (this.hasSentAvatarDataNotify) {
this.getSession().send(packet); this.getSession().send(packet);
} }
...@@ -875,7 +865,7 @@ public class GenshinPlayer { ...@@ -875,7 +865,7 @@ public class GenshinPlayer {
// Check if player object exists in server // Check if player object exists in server
// TODO - optimize // TODO - optimize
GenshinPlayer exists = this.getServer().getPlayerByUid(getUid()); Player exists = this.getServer().getPlayerByUid(getUid());
if (exists != null) { if (exists != null) {
exists.getSession().close(); exists.getSession().close();
} }
......
...@@ -12,9 +12,9 @@ import java.util.Set; ...@@ -12,9 +12,9 @@ import java.util.Set;
import org.danilopianini.util.SpatialIndex; import org.danilopianini.util.SpatialIndex;
import emu.grasscutter.Grasscutter; import emu.grasscutter.Grasscutter;
import emu.grasscutter.data.GenshinData; import emu.grasscutter.data.GameData;
import emu.grasscutter.data.GenshinDepot; import emu.grasscutter.data.GameDepot;
import emu.grasscutter.data.GenshinResource; import emu.grasscutter.data.GameResource;
import emu.grasscutter.data.def.MonsterData; import emu.grasscutter.data.def.MonsterData;
import emu.grasscutter.data.def.SceneData; import emu.grasscutter.data.def.SceneData;
import emu.grasscutter.data.def.WorldLevelData; import emu.grasscutter.data.def.WorldLevelData;
...@@ -22,14 +22,14 @@ import emu.grasscutter.game.entity.EntityAvatar; ...@@ -22,14 +22,14 @@ import emu.grasscutter.game.entity.EntityAvatar;
import emu.grasscutter.game.entity.EntityClientGadget; import emu.grasscutter.game.entity.EntityClientGadget;
import emu.grasscutter.game.entity.EntityGadget; import emu.grasscutter.game.entity.EntityGadget;
import emu.grasscutter.game.entity.EntityMonster; import emu.grasscutter.game.entity.EntityMonster;
import emu.grasscutter.game.entity.GenshinEntity; import emu.grasscutter.game.entity.GameEntity;
import emu.grasscutter.game.props.ClimateType; import emu.grasscutter.game.props.ClimateType;
import emu.grasscutter.game.props.FightProperty; import emu.grasscutter.game.props.FightProperty;
import emu.grasscutter.game.props.LifeState; import emu.grasscutter.game.props.LifeState;
import emu.grasscutter.game.props.SceneType; import emu.grasscutter.game.props.SceneType;
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.net.packet.GenshinPacket; import emu.grasscutter.net.packet.BasePacket;
import emu.grasscutter.net.proto.AttackResultOuterClass.AttackResult; import emu.grasscutter.net.proto.AttackResultOuterClass.AttackResult;
import emu.grasscutter.net.proto.VisionTypeOuterClass.VisionType; import emu.grasscutter.net.proto.VisionTypeOuterClass.VisionType;
import emu.grasscutter.server.packet.send.PacketEntityFightPropUpdateNotify; import emu.grasscutter.server.packet.send.PacketEntityFightPropUpdateNotify;
...@@ -41,11 +41,11 @@ import it.unimi.dsi.fastutil.ints.Int2ObjectMap; ...@@ -41,11 +41,11 @@ import it.unimi.dsi.fastutil.ints.Int2ObjectMap;
import it.unimi.dsi.fastutil.ints.Int2ObjectMaps; import it.unimi.dsi.fastutil.ints.Int2ObjectMaps;
import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap; import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap;
public class GenshinScene { public class Scene {
private final World world; private final World world;
private final SceneData sceneData; private final SceneData sceneData;
private final List<GenshinPlayer> players; private final List<Player> players;
private final Int2ObjectMap<GenshinEntity> entities; private final Int2ObjectMap<GameEntity> entities;
private final Set<SpawnDataEntry> spawnedEntities; private final Set<SpawnDataEntry> spawnedEntities;
private final Set<SpawnDataEntry> deadSpawnedEntities; private final Set<SpawnDataEntry> deadSpawnedEntities;
...@@ -55,7 +55,7 @@ public class GenshinScene { ...@@ -55,7 +55,7 @@ public class GenshinScene {
private ClimateType climate; private ClimateType climate;
private int weather; private int weather;
public GenshinScene(World world, SceneData sceneData) { public Scene(World world, SceneData sceneData) {
this.world = world; this.world = world;
this.sceneData = sceneData; this.sceneData = sceneData;
this.players = Collections.synchronizedList(new ArrayList<>()); this.players = Collections.synchronizedList(new ArrayList<>());
...@@ -84,7 +84,7 @@ public class GenshinScene { ...@@ -84,7 +84,7 @@ public class GenshinScene {
return getSceneData().getSceneType(); return getSceneData().getSceneType();
} }
public List<GenshinPlayer> getPlayers() { public List<Player> getPlayers() {
return players; return players;
} }
...@@ -92,11 +92,11 @@ public class GenshinScene { ...@@ -92,11 +92,11 @@ public class GenshinScene {
return this.getPlayers().size(); return this.getPlayers().size();
} }
public Int2ObjectMap<GenshinEntity> getEntities() { public Int2ObjectMap<GameEntity> getEntities() {
return entities; return entities;
} }
public GenshinEntity getEntityById(int id) { public GameEntity getEntityById(int id) {
return this.entities.get(id); return this.entities.get(id);
} }
...@@ -140,11 +140,11 @@ public class GenshinScene { ...@@ -140,11 +140,11 @@ public class GenshinScene {
return deadSpawnedEntities; return deadSpawnedEntities;
} }
public boolean isInScene(GenshinEntity entity) { public boolean isInScene(GameEntity entity) {
return this.entities.containsKey(entity.getId()); return this.entities.containsKey(entity.getId());
} }
public synchronized void addPlayer(GenshinPlayer player) { public synchronized void addPlayer(Player player) {
// Check if player already in // Check if player already in
if (getPlayers().contains(player)) { if (getPlayers().contains(player)) {
return; return;
...@@ -163,7 +163,7 @@ public class GenshinScene { ...@@ -163,7 +163,7 @@ public class GenshinScene {
this.setupPlayerAvatars(player); this.setupPlayerAvatars(player);
} }
public synchronized void removePlayer(GenshinPlayer player) { public synchronized void removePlayer(Player player) {
// Remove player from scene // Remove player from scene
getPlayers().remove(player); getPlayers().remove(player);
player.setScene(null); player.setScene(null);
...@@ -182,7 +182,7 @@ public class GenshinScene { ...@@ -182,7 +182,7 @@ public class GenshinScene {
} }
} }
private void setupPlayerAvatars(GenshinPlayer player) { private void setupPlayerAvatars(Player player) {
// Clear entities from old team // Clear entities from old team
player.getTeamManager().getActiveTeam().clear(); player.getTeamManager().getActiveTeam().clear();
...@@ -199,7 +199,7 @@ public class GenshinScene { ...@@ -199,7 +199,7 @@ public class GenshinScene {
} }
} }
private void removePlayerAvatars(GenshinPlayer player) { private void removePlayerAvatars(Player player) {
Iterator<EntityAvatar> it = player.getTeamManager().getActiveTeam().iterator(); Iterator<EntityAvatar> it = player.getTeamManager().getActiveTeam().iterator();
while (it.hasNext()) { while (it.hasNext()) {
this.removeEntity(it.next(), VisionType.VISION_REMOVE); this.removeEntity(it.next(), VisionType.VISION_REMOVE);
...@@ -207,7 +207,7 @@ public class GenshinScene { ...@@ -207,7 +207,7 @@ public class GenshinScene {
} }
} }
public void spawnPlayer(GenshinPlayer player) { public void spawnPlayer(Player player) {
if (this.isInScene(player.getTeamManager().getCurrentAvatarEntity())) { if (this.isInScene(player.getTeamManager().getCurrentAvatarEntity())) {
return; return;
} }
...@@ -219,33 +219,33 @@ public class GenshinScene { ...@@ -219,33 +219,33 @@ public class GenshinScene {
this.addEntity(player.getTeamManager().getCurrentAvatarEntity()); this.addEntity(player.getTeamManager().getCurrentAvatarEntity());
} }
private void addEntityDirectly(GenshinEntity entity) { private void addEntityDirectly(GameEntity entity) {
getEntities().put(entity.getId(), entity); getEntities().put(entity.getId(), entity);
} }
public synchronized void addEntity(GenshinEntity entity) { public synchronized void addEntity(GameEntity entity) {
this.addEntityDirectly(entity); this.addEntityDirectly(entity);
this.broadcastPacket(new PacketSceneEntityAppearNotify(entity)); this.broadcastPacket(new PacketSceneEntityAppearNotify(entity));
} }
public synchronized void addEntities(Collection<GenshinEntity> entities) { public synchronized void addEntities(Collection<GameEntity> entities) {
for (GenshinEntity entity : entities) { for (GameEntity entity : entities) {
this.addEntityDirectly(entity); this.addEntityDirectly(entity);
} }
this.broadcastPacket(new PacketSceneEntityAppearNotify(entities, VisionType.VISION_BORN)); this.broadcastPacket(new PacketSceneEntityAppearNotify(entities, VisionType.VISION_BORN));
} }
private GenshinEntity removeEntityDirectly(GenshinEntity entity) { private GameEntity removeEntityDirectly(GameEntity entity) {
return getEntities().remove(entity.getId()); return getEntities().remove(entity.getId());
} }
public void removeEntity(GenshinEntity entity) { public void removeEntity(GameEntity entity) {
this.removeEntity(entity, VisionType.VISION_DIE); this.removeEntity(entity, VisionType.VISION_DIE);
} }
public synchronized void removeEntity(GenshinEntity entity, VisionType visionType) { public synchronized void removeEntity(GameEntity entity, VisionType visionType) {
GenshinEntity removed = this.removeEntityDirectly(entity); GameEntity removed = this.removeEntityDirectly(entity);
if (removed != null) { if (removed != null) {
this.broadcastPacket(new PacketSceneEntityDisappearNotify(removed, visionType)); this.broadcastPacket(new PacketSceneEntityDisappearNotify(removed, visionType));
} }
...@@ -258,11 +258,11 @@ public class GenshinScene { ...@@ -258,11 +258,11 @@ public class GenshinScene {
this.broadcastPacket(new PacketSceneEntityAppearNotify(newEntity, VisionType.VISION_REPLACE, oldEntity.getId())); this.broadcastPacket(new PacketSceneEntityAppearNotify(newEntity, VisionType.VISION_REPLACE, oldEntity.getId()));
} }
public void showOtherEntities(GenshinPlayer player) { public void showOtherEntities(Player player) {
List<GenshinEntity> entities = new LinkedList<>(); List<GameEntity> entities = new LinkedList<>();
GenshinEntity currentEntity = player.getTeamManager().getCurrentAvatarEntity(); GameEntity currentEntity = player.getTeamManager().getCurrentAvatarEntity();
for (GenshinEntity entity : this.getEntities().values()) { for (GameEntity entity : this.getEntities().values()) {
if (entity == currentEntity) { if (entity == currentEntity) {
continue; continue;
} }
...@@ -273,8 +273,8 @@ public class GenshinScene { ...@@ -273,8 +273,8 @@ public class GenshinScene {
} }
public void handleAttack(AttackResult result) { public void handleAttack(AttackResult result) {
//GenshinEntity attacker = getEntityById(result.getAttackerId()); //GameEntity attacker = getEntityById(result.getAttackerId());
GenshinEntity target = getEntityById(result.getDefenseId()); GameEntity target = getEntityById(result.getDefenseId());
if (target == null) { if (target == null) {
return; return;
...@@ -306,7 +306,7 @@ public class GenshinScene { ...@@ -306,7 +306,7 @@ public class GenshinScene {
} }
} }
public void killEntity(GenshinEntity target, int attackerId) { public void killEntity(GameEntity target, int attackerId) {
// Packet // Packet
this.broadcastPacket(new PacketLifeStateChangeNotify(attackerId, target, LifeState.LIFE_DEAD)); this.broadcastPacket(new PacketLifeStateChangeNotify(attackerId, target, LifeState.LIFE_DEAD));
this.removeEntity(target); this.removeEntity(target);
...@@ -321,10 +321,10 @@ public class GenshinScene { ...@@ -321,10 +321,10 @@ public class GenshinScene {
// TODO - Test // TODO - Test
public void checkSpawns() { public void checkSpawns() {
SpatialIndex<SpawnGroupEntry> list = GenshinDepot.getSpawnListById(this.getId()); SpatialIndex<SpawnGroupEntry> list = GameDepot.getSpawnListById(this.getId());
Set<SpawnDataEntry> visible = new HashSet<>(); Set<SpawnDataEntry> visible = new HashSet<>();
for (GenshinPlayer player : this.getPlayers()) { for (Player player : this.getPlayers()) {
int RANGE = 100; int RANGE = 100;
Collection<SpawnGroupEntry> entries = list.query( Collection<SpawnGroupEntry> entries = list.query(
new double[] {player.getPos().getX() - RANGE, player.getPos().getZ() - RANGE}, new double[] {player.getPos().getX() - RANGE, player.getPos().getZ() - RANGE},
...@@ -339,7 +339,7 @@ public class GenshinScene { ...@@ -339,7 +339,7 @@ public class GenshinScene {
} }
// World level // World level
WorldLevelData worldLevelData = GenshinData.getWorldLevelDataMap().get(getWorld().getWorldLevel()); WorldLevelData worldLevelData = GameData.getWorldLevelDataMap().get(getWorld().getWorldLevel());
int worldLevelOverride = 0; int worldLevelOverride = 0;
if (worldLevelData != null) { if (worldLevelData != null) {
...@@ -347,13 +347,13 @@ public class GenshinScene { ...@@ -347,13 +347,13 @@ public class GenshinScene {
} }
// Todo // Todo
List<GenshinEntity> toAdd = new LinkedList<>(); List<GameEntity> toAdd = new LinkedList<>();
List<GenshinEntity> toRemove = new LinkedList<>(); List<GameEntity> toRemove = new LinkedList<>();
for (SpawnDataEntry entry : visible) { for (SpawnDataEntry entry : visible) {
if (!this.getSpawnedEntities().contains(entry) && !this.getDeadSpawnedEntities().contains(entry)) { if (!this.getSpawnedEntities().contains(entry) && !this.getDeadSpawnedEntities().contains(entry)) {
// Spawn entity // Spawn entity
MonsterData data = GenshinData.getMonsterDataMap().get(entry.getMonsterId()); MonsterData data = GameData.getMonsterDataMap().get(entry.getMonsterId());
if (data == null) { if (data == null) {
continue; continue;
...@@ -373,7 +373,7 @@ public class GenshinScene { ...@@ -373,7 +373,7 @@ public class GenshinScene {
} }
} }
for (GenshinEntity entity : this.getEntities().values()) { for (GameEntity entity : this.getEntities().values()) {
if (entity.getSpawnEntry() != null && !visible.contains(entity.getSpawnEntry())) { if (entity.getSpawnEntry() != null && !visible.contains(entity.getSpawnEntry())) {
toRemove.add(entity); toRemove.add(entity);
} }
...@@ -407,7 +407,7 @@ public class GenshinScene { ...@@ -407,7 +407,7 @@ public class GenshinScene {
} }
public void onPlayerDestroyGadget(int entityId) { public void onPlayerDestroyGadget(int entityId) {
GenshinEntity entity = getEntities().get(entityId); GameEntity entity = getEntities().get(entityId);
if (entity == null || !(entity instanceof EntityClientGadget)) { if (entity == null || !(entity instanceof EntityClientGadget)) {
return; return;
...@@ -430,20 +430,20 @@ public class GenshinScene { ...@@ -430,20 +430,20 @@ public class GenshinScene {
// Broadcasting // Broadcasting
public void broadcastPacket(GenshinPacket packet) { public void broadcastPacket(BasePacket packet) {
// Send to all players - might have to check if player has been sent data packets // Send to all players - might have to check if player has been sent data packets
for (GenshinPlayer player : this.getPlayers()) { for (Player player : this.getPlayers()) {
player.getSession().send(packet); player.getSession().send(packet);
} }
} }
public void broadcastPacketToOthers(GenshinPlayer excludedPlayer, GenshinPacket packet) { public void broadcastPacketToOthers(Player excludedPlayer, BasePacket packet) {
// Optimization // Optimization
if (this.getPlayerCount() == 1 && this.getPlayers().get(0) == excludedPlayer) { if (this.getPlayerCount() == 1 && this.getPlayers().get(0) == excludedPlayer) {
return; return;
} }
// Send to all players - might have to check if player has been sent data packets // Send to all players - might have to check if player has been sent data packets
for (GenshinPlayer player : this.getPlayers()) { for (Player player : this.getPlayers()) {
if (player == excludedPlayer) { if (player == excludedPlayer) {
continue; continue;
} }
......
...@@ -4,9 +4,9 @@ import java.util.ArrayList; ...@@ -4,9 +4,9 @@ import java.util.ArrayList;
import java.util.List; import java.util.List;
import dev.morphia.annotations.Entity; import dev.morphia.annotations.Entity;
import emu.grasscutter.GenshinConstants; import emu.grasscutter.GameConstants;
import emu.grasscutter.Grasscutter; import emu.grasscutter.Grasscutter;
import emu.grasscutter.game.avatar.GenshinAvatar; import emu.grasscutter.game.avatar.Avatar;
@Entity @Entity
public class TeamInfo { public class TeamInfo {
...@@ -34,11 +34,11 @@ public class TeamInfo { ...@@ -34,11 +34,11 @@ public class TeamInfo {
return avatars.size(); return avatars.size();
} }
public boolean contains(GenshinAvatar avatar) { public boolean contains(Avatar avatar) {
return getAvatars().contains(avatar.getAvatarId()); return getAvatars().contains(avatar.getAvatarId());
} }
public boolean addAvatar(GenshinAvatar avatar) { public boolean addAvatar(Avatar avatar) {
if (size() >= Grasscutter.getConfig().getGameServerOptions().MaxAvatarsInTeam || contains(avatar)) { if (size() >= Grasscutter.getConfig().getGameServerOptions().MaxAvatarsInTeam || contains(avatar)) {
return false; return false;
} }
......
...@@ -10,16 +10,16 @@ import java.util.Set; ...@@ -10,16 +10,16 @@ import java.util.Set;
import dev.morphia.annotations.Entity; import dev.morphia.annotations.Entity;
import dev.morphia.annotations.Transient; import dev.morphia.annotations.Transient;
import emu.grasscutter.GenshinConstants; import emu.grasscutter.GameConstants;
import emu.grasscutter.Grasscutter; import emu.grasscutter.Grasscutter;
import emu.grasscutter.data.def.AvatarSkillDepotData; import emu.grasscutter.data.def.AvatarSkillDepotData;
import emu.grasscutter.game.avatar.GenshinAvatar; import emu.grasscutter.game.avatar.Avatar;
import emu.grasscutter.game.entity.EntityAvatar; import emu.grasscutter.game.entity.EntityAvatar;
import emu.grasscutter.game.entity.EntityGadget; import emu.grasscutter.game.entity.EntityGadget;
import emu.grasscutter.game.props.ElementType; import emu.grasscutter.game.props.ElementType;
import emu.grasscutter.game.props.EnterReason; import emu.grasscutter.game.props.EnterReason;
import emu.grasscutter.game.props.FightProperty; import emu.grasscutter.game.props.FightProperty;
import emu.grasscutter.net.packet.GenshinPacket; import emu.grasscutter.net.packet.BasePacket;
import emu.grasscutter.net.packet.PacketOpcodes; import emu.grasscutter.net.packet.PacketOpcodes;
import emu.grasscutter.net.proto.EnterTypeOuterClass.EnterType; import emu.grasscutter.net.proto.EnterTypeOuterClass.EnterType;
import emu.grasscutter.net.proto.MotionStateOuterClass.MotionState; import emu.grasscutter.net.proto.MotionStateOuterClass.MotionState;
...@@ -44,7 +44,7 @@ import it.unimi.dsi.fastutil.ints.IntSet; ...@@ -44,7 +44,7 @@ import it.unimi.dsi.fastutil.ints.IntSet;
@Entity @Entity
public class TeamManager { public class TeamManager {
@Transient private GenshinPlayer player; @Transient private Player player;
private Map<Integer, TeamInfo> teams; private Map<Integer, TeamInfo> teams;
private int currentTeamIndex; private int currentTeamIndex;
...@@ -65,18 +65,18 @@ public class TeamManager { ...@@ -65,18 +65,18 @@ public class TeamManager {
this.teamResonancesConfig = new IntOpenHashSet(); this.teamResonancesConfig = new IntOpenHashSet();
} }
public TeamManager(GenshinPlayer player) { public TeamManager(Player player) {
this(); this();
this.player = player; this.player = player;
this.teams = new HashMap<>(); this.teams = new HashMap<>();
this.currentTeamIndex = 1; this.currentTeamIndex = 1;
for (int i = 1; i <= GenshinConstants.MAX_TEAMS; i++) { for (int i = 1; i <= GameConstants.MAX_TEAMS; i++) {
this.teams.put(i, new TeamInfo()); this.teams.put(i, new TeamInfo());
} }
} }
public GenshinPlayer getPlayer() { public Player getPlayer() {
return player; return player;
} }
...@@ -84,7 +84,7 @@ public class TeamManager { ...@@ -84,7 +84,7 @@ public class TeamManager {
return player.getWorld(); return player.getWorld();
} }
public void setPlayer(GenshinPlayer player) { public void setPlayer(Player player) {
this.player = player; this.player = player;
} }
...@@ -207,7 +207,7 @@ public class TeamManager { ...@@ -207,7 +207,7 @@ public class TeamManager {
} }
} }
public void updateTeamEntities(GenshinPacket responsePacket) { public void updateTeamEntities(BasePacket responsePacket) {
// Sanity check - Should never happen // Sanity check - Should never happen
if (this.getCurrentTeamInfo().getAvatars().size() <= 0) { if (this.getCurrentTeamInfo().getAvatars().size() <= 0) {
return; return;
...@@ -287,9 +287,9 @@ public class TeamManager { ...@@ -287,9 +287,9 @@ public class TeamManager {
} }
// Set team data // Set team data
LinkedHashSet<GenshinAvatar> newTeam = new LinkedHashSet<>(); LinkedHashSet<Avatar> newTeam = new LinkedHashSet<>();
for (int i = 0; i < list.size(); i++) { for (int i = 0; i < list.size(); i++) {
GenshinAvatar avatar = getPlayer().getAvatars().getAvatarByGuid(list.get(i)); Avatar avatar = getPlayer().getAvatars().getAvatarByGuid(list.get(i));
if (avatar == null || newTeam.contains(avatar)) { if (avatar == null || newTeam.contains(avatar)) {
// Should never happen // Should never happen
return; return;
...@@ -299,7 +299,7 @@ public class TeamManager { ...@@ -299,7 +299,7 @@ public class TeamManager {
// Clear current team info and add avatars from our new team // Clear current team info and add avatars from our new team
teamInfo.getAvatars().clear(); teamInfo.getAvatars().clear();
for (GenshinAvatar avatar : newTeam) { for (Avatar avatar : newTeam) {
teamInfo.addAvatar(avatar); teamInfo.addAvatar(avatar);
} }
...@@ -323,9 +323,9 @@ public class TeamManager { ...@@ -323,9 +323,9 @@ public class TeamManager {
TeamInfo teamInfo = this.getMpTeam(); TeamInfo teamInfo = this.getMpTeam();
// Set team data // Set team data
LinkedHashSet<GenshinAvatar> newTeam = new LinkedHashSet<>(); LinkedHashSet<Avatar> newTeam = new LinkedHashSet<>();
for (int i = 0; i < list.size(); i++) { for (int i = 0; i < list.size(); i++) {
GenshinAvatar avatar = getPlayer().getAvatars().getAvatarByGuid(list.get(i)); Avatar avatar = getPlayer().getAvatars().getAvatarByGuid(list.get(i));
if (avatar == null || newTeam.contains(avatar)) { if (avatar == null || newTeam.contains(avatar)) {
// Should never happen // Should never happen
return; return;
...@@ -335,7 +335,7 @@ public class TeamManager { ...@@ -335,7 +335,7 @@ public class TeamManager {
// Clear current team info and add avatars from our new team // Clear current team info and add avatars from our new team
teamInfo.getAvatars().clear(); teamInfo.getAvatars().clear();
for (GenshinAvatar avatar : newTeam) { for (Avatar avatar : newTeam) {
teamInfo.addAvatar(avatar); teamInfo.addAvatar(avatar);
} }
...@@ -437,7 +437,7 @@ public class TeamManager { ...@@ -437,7 +437,7 @@ public class TeamManager {
getPlayer().sendPacket(new PacketAvatarDieAnimationEndRsp(deadAvatar.getId(), 0)); getPlayer().sendPacket(new PacketAvatarDieAnimationEndRsp(deadAvatar.getId(), 0));
} }
public boolean reviveAvatar(GenshinAvatar avatar) { public boolean reviveAvatar(Avatar avatar) {
for (EntityAvatar entity : getActiveTeam()) { for (EntityAvatar entity : getActiveTeam()) {
if (entity.getAvatar() == avatar) { if (entity.getAvatar() == avatar) {
if (entity.isAlive()) { if (entity.isAlive()) {
...@@ -476,14 +476,14 @@ public class TeamManager { ...@@ -476,14 +476,14 @@ public class TeamManager {
} }
// Teleport player // Teleport player
getPlayer().sendPacket(new PacketPlayerEnterSceneNotify(getPlayer(), EnterType.ENTER_SELF, EnterReason.Revival, 3, GenshinConstants.START_POSITION)); getPlayer().sendPacket(new PacketPlayerEnterSceneNotify(getPlayer(), EnterType.ENTER_SELF, EnterReason.Revival, 3, GameConstants.START_POSITION));
// Set player position // Set player position
player.setSceneId(3); player.setSceneId(3);
player.getPos().set(GenshinConstants.START_POSITION); player.getPos().set(GameConstants.START_POSITION);
// Packets // Packets
getPlayer().sendPacket(new GenshinPacket(PacketOpcodes.WorldPlayerReviveRsp)); getPlayer().sendPacket(new BasePacket(PacketOpcodes.WorldPlayerReviveRsp));
} }
public void saveAvatars() { public void saveAvatars() {
......
...@@ -8,19 +8,19 @@ import java.util.LinkedList; ...@@ -8,19 +8,19 @@ import java.util.LinkedList;
import java.util.List; import java.util.List;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import emu.grasscutter.game.entity.GenshinEntity; import emu.grasscutter.game.entity.GameEntity;
import emu.grasscutter.game.props.ClimateType; import emu.grasscutter.game.props.ClimateType;
import emu.grasscutter.game.props.EnterReason; import emu.grasscutter.game.props.EnterReason;
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.LifeState; import emu.grasscutter.game.props.LifeState;
import emu.grasscutter.data.GenshinData; import emu.grasscutter.data.GameData;
import emu.grasscutter.data.def.SceneData; import emu.grasscutter.data.def.SceneData;
import emu.grasscutter.game.GenshinPlayer.SceneLoadState; import emu.grasscutter.game.Player.SceneLoadState;
import emu.grasscutter.game.entity.EntityAvatar; import emu.grasscutter.game.entity.EntityAvatar;
import emu.grasscutter.game.entity.EntityClientGadget; import emu.grasscutter.game.entity.EntityClientGadget;
import emu.grasscutter.game.entity.EntityGadget; import emu.grasscutter.game.entity.EntityGadget;
import emu.grasscutter.net.packet.GenshinPacket; import emu.grasscutter.net.packet.BasePacket;
import emu.grasscutter.net.proto.AttackResultOuterClass.AttackResult; import emu.grasscutter.net.proto.AttackResultOuterClass.AttackResult;
import emu.grasscutter.net.proto.EnterTypeOuterClass.EnterType; import emu.grasscutter.net.proto.EnterTypeOuterClass.EnterType;
import emu.grasscutter.net.proto.VisionTypeOuterClass.VisionType; import emu.grasscutter.net.proto.VisionTypeOuterClass.VisionType;
...@@ -40,10 +40,10 @@ import it.unimi.dsi.fastutil.ints.Int2ObjectMap; ...@@ -40,10 +40,10 @@ import it.unimi.dsi.fastutil.ints.Int2ObjectMap;
import it.unimi.dsi.fastutil.ints.Int2ObjectMaps; import it.unimi.dsi.fastutil.ints.Int2ObjectMaps;
import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap; import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap;
public class World implements Iterable<GenshinPlayer> { public class World implements Iterable<Player> {
private final GenshinPlayer owner; private final Player owner;
private final List<GenshinPlayer> players; private final List<Player> players;
private final Int2ObjectMap<GenshinScene> scenes; private final Int2ObjectMap<Scene> scenes;
private int levelEntityId; private int levelEntityId;
private int nextEntityId = 0; private int nextEntityId = 0;
...@@ -52,11 +52,11 @@ public class World implements Iterable<GenshinPlayer> { ...@@ -52,11 +52,11 @@ public class World implements Iterable<GenshinPlayer> {
private boolean isMultiplayer; private boolean isMultiplayer;
public World(GenshinPlayer player) { public World(Player player) {
this(player, false); this(player, false);
} }
public World(GenshinPlayer player, boolean isMultiplayer) { public World(Player player, boolean isMultiplayer) {
this.owner = player; this.owner = player;
this.players = Collections.synchronizedList(new ArrayList<>()); this.players = Collections.synchronizedList(new ArrayList<>());
this.scenes = Int2ObjectMaps.synchronize(new Int2ObjectOpenHashMap<>()); this.scenes = Int2ObjectMaps.synchronize(new Int2ObjectOpenHashMap<>());
...@@ -68,7 +68,7 @@ public class World implements Iterable<GenshinPlayer> { ...@@ -68,7 +68,7 @@ public class World implements Iterable<GenshinPlayer> {
this.owner.getServer().registerWorld(this); this.owner.getServer().registerWorld(this);
} }
public GenshinPlayer getHost() { public Player getHost() {
return owner; return owner;
} }
...@@ -95,25 +95,25 @@ public class World implements Iterable<GenshinPlayer> { ...@@ -95,25 +95,25 @@ public class World implements Iterable<GenshinPlayer> {
this.worldLevel = worldLevel; this.worldLevel = worldLevel;
} }
public List<GenshinPlayer> getPlayers() { public List<Player> getPlayers() {
return players; return players;
} }
public Int2ObjectMap<GenshinScene> getScenes() { public Int2ObjectMap<Scene> getScenes() {
return this.scenes; return this.scenes;
} }
public GenshinScene getSceneById(int sceneId) { public Scene getSceneById(int sceneId) {
// Get scene normally // Get scene normally
GenshinScene scene = getScenes().get(sceneId); Scene scene = getScenes().get(sceneId);
if (scene != null) { if (scene != null) {
return scene; return scene;
} }
// Create scene from scene data if it doesnt exist // Create scene from scene data if it doesnt exist
SceneData sceneData = GenshinData.getSceneDataMap().get(sceneId); SceneData sceneData = GameData.getSceneDataMap().get(sceneId);
if (sceneData != null) { if (sceneData != null) {
scene = new GenshinScene(this, sceneData); scene = new Scene(this, sceneData);
this.registerScene(scene); this.registerScene(scene);
return scene; return scene;
} }
...@@ -133,7 +133,7 @@ public class World implements Iterable<GenshinPlayer> { ...@@ -133,7 +133,7 @@ public class World implements Iterable<GenshinPlayer> {
return (idType.getId() << 24) + ++this.nextEntityId; return (idType.getId() << 24) + ++this.nextEntityId;
} }
public synchronized void addPlayer(GenshinPlayer player) { public synchronized void addPlayer(Player player) {
// Check if player already in // Check if player already in
if (getPlayers().contains(player)) { if (getPlayers().contains(player)) {
return; return;
...@@ -159,7 +159,7 @@ public class World implements Iterable<GenshinPlayer> { ...@@ -159,7 +159,7 @@ public class World implements Iterable<GenshinPlayer> {
} }
// Add to scene // Add to scene
GenshinScene scene = this.getSceneById(player.getSceneId()); Scene scene = this.getSceneById(player.getSceneId());
scene.addPlayer(player); scene.addPlayer(player);
// Info packet for other players // Info packet for other players
...@@ -168,7 +168,7 @@ public class World implements Iterable<GenshinPlayer> { ...@@ -168,7 +168,7 @@ public class World implements Iterable<GenshinPlayer> {
} }
} }
public synchronized void removePlayer(GenshinPlayer player) { public synchronized void removePlayer(Player player) {
// Remove team entities // Remove team entities
player.sendPacket( player.sendPacket(
new PacketDelTeamEntityNotify( new PacketDelTeamEntityNotify(
...@@ -182,7 +182,7 @@ public class World implements Iterable<GenshinPlayer> { ...@@ -182,7 +182,7 @@ public class World implements Iterable<GenshinPlayer> {
player.setWorld(null); player.setWorld(null);
// Remove from scene // Remove from scene
GenshinScene scene = this.getSceneById(player.getSceneId()); Scene scene = this.getSceneById(player.getSceneId());
scene.removePlayer(player); scene.removePlayer(player);
// Info packet for other players // Info packet for other players
...@@ -192,8 +192,8 @@ public class World implements Iterable<GenshinPlayer> { ...@@ -192,8 +192,8 @@ public class World implements Iterable<GenshinPlayer> {
// Disband world if host leaves // Disband world if host leaves
if (getHost() == player) { if (getHost() == player) {
List<GenshinPlayer> kicked = new ArrayList<>(this.getPlayers()); List<Player> kicked = new ArrayList<>(this.getPlayers());
for (GenshinPlayer victim : kicked) { for (Player victim : kicked) {
World world = new World(victim); World world = new World(victim);
world.addPlayer(victim); world.addPlayer(victim);
...@@ -202,20 +202,20 @@ public class World implements Iterable<GenshinPlayer> { ...@@ -202,20 +202,20 @@ public class World implements Iterable<GenshinPlayer> {
} }
} }
public void registerScene(GenshinScene scene) { public void registerScene(Scene scene) {
this.getScenes().put(scene.getId(), scene); this.getScenes().put(scene.getId(), scene);
} }
public void deregisterScene(GenshinScene scene) { public void deregisterScene(Scene scene) {
this.getScenes().remove(scene.getId()); this.getScenes().remove(scene.getId());
} }
public boolean transferPlayerToScene(GenshinPlayer player, int sceneId, Position pos) { public boolean transferPlayerToScene(Player player, int sceneId, Position pos) {
if (GenshinData.getSceneDataMap().get(sceneId) == null) { if (GameData.getSceneDataMap().get(sceneId) == null) {
return false; return false;
} }
GenshinScene oldScene = null; Scene oldScene = null;
if (player.getScene() != null) { if (player.getScene() != null) {
oldScene = player.getScene(); oldScene = player.getScene();
...@@ -228,7 +228,7 @@ public class World implements Iterable<GenshinPlayer> { ...@@ -228,7 +228,7 @@ public class World implements Iterable<GenshinPlayer> {
oldScene.removePlayer(player); oldScene.removePlayer(player);
} }
GenshinScene newScene = this.getSceneById(sceneId); Scene newScene = this.getSceneById(sceneId);
newScene.addPlayer(player); newScene.addPlayer(player);
player.getPos().set(pos); player.getPos().set(pos);
...@@ -245,8 +245,8 @@ public class World implements Iterable<GenshinPlayer> { ...@@ -245,8 +245,8 @@ public class World implements Iterable<GenshinPlayer> {
return true; return true;
} }
private void updatePlayerInfos(GenshinPlayer paramPlayer) { private void updatePlayerInfos(Player paramPlayer) {
for (GenshinPlayer player : getPlayers()) { for (Player player : getPlayers()) {
// Dont send packets if player is loading in and filter out joining player // Dont send packets if player is loading in and filter out joining player
if (!player.hasSentAvatarDataNotify() || player.getSceneLoadState().getValue() < SceneLoadState.INIT.getValue() || player == paramPlayer) { if (!player.hasSentAvatarDataNotify() || player.getSceneLoadState().getValue() < SceneLoadState.INIT.getValue() || player == paramPlayer) {
continue; continue;
...@@ -269,15 +269,15 @@ public class World implements Iterable<GenshinPlayer> { ...@@ -269,15 +269,15 @@ public class World implements Iterable<GenshinPlayer> {
} }
} }
public void broadcastPacket(GenshinPacket packet) { public void broadcastPacket(BasePacket packet) {
// Send to all players - might have to check if player has been sent data packets // Send to all players - might have to check if player has been sent data packets
for (GenshinPlayer player : this.getPlayers()) { for (Player player : this.getPlayers()) {
player.getSession().send(packet); player.getSession().send(packet);
} }
} }
public void onTick() { public void onTick() {
for (GenshinScene scene : this.getScenes().values()) { for (Scene scene : this.getScenes().values()) {
scene.onTick(); scene.onTick();
} }
} }
...@@ -287,7 +287,7 @@ public class World implements Iterable<GenshinPlayer> { ...@@ -287,7 +287,7 @@ public class World implements Iterable<GenshinPlayer> {
} }
@Override @Override
public Iterator<GenshinPlayer> iterator() { public Iterator<Player> iterator() {
return getPlayers().iterator(); return getPlayers().iterator();
} }
} }
...@@ -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.Player;
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.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();
} }
......
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