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

Renamed all references to a certain game

parent 6b8902be
package emu.grasscutter.data.def;
import emu.grasscutter.data.GenshinResource;
import emu.grasscutter.data.GameResource;
import emu.grasscutter.data.ResourceType;
import emu.grasscutter.game.props.FightProperty;
@ResourceType(name = "ReliquaryMainPropExcelConfigData.json")
public class ReliquaryMainPropData extends GenshinResource {
public class ReliquaryMainPropData extends GameResource {
private int Id;
private int PropDepotId;
......
package emu.grasscutter.data.def;
import emu.grasscutter.data.GenshinResource;
import emu.grasscutter.data.GameResource;
import emu.grasscutter.data.ResourceType;
@ResourceType(name = "ReliquarySetExcelConfigData.json")
public class ReliquarySetData extends GenshinResource {
public class ReliquarySetData extends GameResource {
private int SetId;
private int[] SetNeedNum;
private int EquipAffixId;
......
......@@ -2,12 +2,12 @@ package emu.grasscutter.data.def;
import java.util.List;
import emu.grasscutter.data.GenshinResource;
import emu.grasscutter.data.GameResource;
import emu.grasscutter.data.ResourceType;
import emu.grasscutter.data.common.RewardItemData;
@ResourceType(name = "RewardExcelConfigData.json")
public class RewardData extends GenshinResource {
public class RewardData extends GameResource {
public int RewardId;
public List<RewardItemData> RewardItemList;
......
package emu.grasscutter.data.def;
import emu.grasscutter.data.GenshinData;
import emu.grasscutter.data.GenshinResource;
import emu.grasscutter.data.GameData;
import emu.grasscutter.data.GameResource;
import emu.grasscutter.data.ResourceType;
import emu.grasscutter.game.props.SceneType;
@ResourceType(name = "SceneExcelConfigData.json")
public class SceneData extends GenshinResource {
public class SceneData extends GameResource {
private int Id;
private SceneType SceneType;
private String ScriptData;
......
......@@ -4,12 +4,12 @@ import java.util.HashMap;
import java.util.Map;
import java.util.stream.Stream;
import emu.grasscutter.data.GenshinResource;
import emu.grasscutter.data.GameResource;
import emu.grasscutter.data.ResourceType;
import emu.grasscutter.data.common.CurveInfo;
@ResourceType(name = "WeaponCurveExcelConfigData.json")
public class WeaponCurveData extends GenshinResource {
public class WeaponCurveData extends GameResource {
private int Level;
private CurveInfo[] CurveInfos;
......
package emu.grasscutter.data.def;
import emu.grasscutter.data.GenshinResource;
import emu.grasscutter.data.GameResource;
import emu.grasscutter.data.ResourceType;
@ResourceType(name = "WeaponLevelExcelConfigData.json")
public class WeaponLevelData extends GenshinResource {
public class WeaponLevelData extends GameResource {
private int Level;
private int[] RequiredExps;
......
package emu.grasscutter.data.def;
import java.util.ArrayList;
import emu.grasscutter.data.GenshinResource;
import emu.grasscutter.data.GameResource;
import emu.grasscutter.data.ResourceType;
import emu.grasscutter.data.common.FightPropData;
import emu.grasscutter.data.common.ItemParamData;
@ResourceType(name = "WeaponPromoteExcelConfigData.json")
public class WeaponPromoteData extends GenshinResource {
public class WeaponPromoteData extends GameResource {
private int WeaponPromoteId;
private int PromoteLevel;
......
package emu.grasscutter.data.def;
import emu.grasscutter.data.GenshinResource;
import emu.grasscutter.data.GameResource;
import emu.grasscutter.data.ResourceType;
@ResourceType(name = "WorldLevelExcelConfigData.json")
public class WorldLevelData extends GenshinResource {
public class WorldLevelData extends GameResource {
private int Level;
private int MonsterLevel;
......
......@@ -4,12 +4,12 @@ import java.util.List;
import com.mongodb.client.result.DeleteResult;
import dev.morphia.query.experimental.filters.Filters;
import emu.grasscutter.GenshinConstants;
import emu.grasscutter.GameConstants;
import emu.grasscutter.game.Account;
import emu.grasscutter.game.GenshinPlayer;
import emu.grasscutter.game.avatar.GenshinAvatar;
import emu.grasscutter.game.Player;
import emu.grasscutter.game.avatar.Avatar;
import emu.grasscutter.game.friends.Friendship;
import emu.grasscutter.game.inventory.GenshinItem;
import emu.grasscutter.game.inventory.GameItem;
public final class DatabaseHelper {
public static Account createAccount(String username) {
......@@ -26,7 +26,7 @@ public final class DatabaseHelper {
// Make sure there are no id collisions
if (reservedId > 0) {
// 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;
}
exists = DatabaseHelper.getAccountByPlayerId(reservedId);
......@@ -90,19 +90,19 @@ public final class DatabaseHelper {
return DatabaseManager.getDatastore().find(Account.class).filter(Filters.eq("username", username)).delete().getDeletedCount() > 0;
}
public static List<GenshinPlayer> getAllPlayers() {
return DatabaseManager.getDatastore().find(GenshinPlayer.class).stream().toList();
public static List<Player> getAllPlayers() {
return DatabaseManager.getDatastore().find(Player.class).stream().toList();
}
public static GenshinPlayer getPlayerById(int id) {
return DatabaseManager.getDatastore().find(GenshinPlayer.class).filter(Filters.eq("_id", id)).first();
public static Player getPlayerById(int id) {
return DatabaseManager.getDatastore().find(Player.class).filter(Filters.eq("_id", id)).first();
}
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
int id;
if (reservedId > 0 && !checkPlayerExists(reservedId)) {
......@@ -127,42 +127,42 @@ public final class DatabaseHelper {
id = reservedId;
} else {
do {
id = DatabaseManager.getNextId(GenshinPlayer.class);
id = DatabaseManager.getNextId(Player.class);
}
while (checkPlayerExists(id));
}
return id;
}
public static void savePlayer(GenshinPlayer character) {
public static void savePlayer(Player character) {
DatabaseManager.getDatastore().save(character);
}
public static void saveAvatar(GenshinAvatar avatar) {
public static void saveAvatar(Avatar avatar) {
DatabaseManager.getDatastore().save(avatar);
}
public static List<GenshinAvatar> getAvatars(GenshinPlayer player) {
return DatabaseManager.getDatastore().find(GenshinAvatar.class).filter(Filters.eq("ownerId", player.getUid())).stream().toList();
public static List<Avatar> getAvatars(Player player) {
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);
}
public static boolean deleteItem(GenshinItem item) {
public static boolean deleteItem(GameItem item) {
DeleteResult result = DatabaseManager.getDatastore().delete(item);
return result.wasAcknowledged();
}
public static List<GenshinItem> getInventoryItems(GenshinPlayer player) {
return DatabaseManager.getDatastore().find(GenshinItem.class).filter(Filters.eq("ownerId", player.getUid())).stream().toList();
public static List<GameItem> getInventoryItems(Player player) {
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();
}
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();
}
......
......@@ -13,10 +13,10 @@ import dev.morphia.mapping.MapperOptions;
import dev.morphia.query.experimental.filters.Filters;
import emu.grasscutter.Grasscutter;
import emu.grasscutter.game.Account;
import emu.grasscutter.game.GenshinPlayer;
import emu.grasscutter.game.avatar.GenshinAvatar;
import emu.grasscutter.game.Player;
import emu.grasscutter.game.avatar.Avatar;
import emu.grasscutter.game.friends.Friendship;
import emu.grasscutter.game.inventory.GenshinItem;
import emu.grasscutter.game.inventory.GameItem;
public final class DatabaseManager {
......@@ -27,7 +27,7 @@ public final class DatabaseManager {
private static Datastore dispatchDatastore;
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() {
......
package emu.grasscutter.game;
public class CoopRequest {
private final GenshinPlayer requester;
private final Player requester;
private final long requestTime;
private final long expireTime;
public CoopRequest(GenshinPlayer requester) {
public CoopRequest(Player requester) {
this.requester = requester;
this.requestTime = System.currentTimeMillis();
this.expireTime = this.requestTime + 10000;
}
public GenshinPlayer getRequester() {
public Player getRequester() {
return requester;
}
......
......@@ -2,16 +2,16 @@ package emu.grasscutter.game;
import java.util.ArrayList;
import java.util.List;
import emu.grasscutter.net.packet.GenshinPacket;
import emu.grasscutter.net.packet.BasePacket;
import emu.grasscutter.net.proto.ForwardTypeOuterClass.ForwardType;
public class InvokeHandler<T> {
private final List<T> entryListForwardAll;
private final List<T> entryListForwardAllExceptCur;
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.entryListForwardAllExceptCur = new ArrayList<>();
this.entryListForwardHost = new ArrayList<>();
......@@ -28,7 +28,7 @@ public class InvokeHandler<T> {
}
}
public synchronized void update(GenshinPlayer player) {
public synchronized void update(Player player) {
if (player.getWorld() == null) {
this.entryListForwardAll.clear();
this.entryListForwardAllExceptCur.clear();
......@@ -38,17 +38,17 @@ public class InvokeHandler<T> {
try {
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);
this.entryListForwardAll.clear();
}
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);
this.entryListForwardAllExceptCur.clear();
}
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);
this.entryListForwardHost.clear();
}
......
......@@ -57,7 +57,7 @@ public class Mail {
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());
}
......
......@@ -4,26 +4,26 @@ import java.time.Instant;
import java.util.*;
import dev.morphia.annotations.*;
import emu.grasscutter.GenshinConstants;
import emu.grasscutter.GameConstants;
import emu.grasscutter.Grasscutter;
import emu.grasscutter.command.CommandHandler;
import emu.grasscutter.data.GenshinData;
import emu.grasscutter.data.GameData;
import emu.grasscutter.data.def.PlayerLevelData;
import emu.grasscutter.database.DatabaseHelper;
import emu.grasscutter.game.avatar.AvatarProfileData;
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.GenshinEntity;
import emu.grasscutter.game.entity.GameEntity;
import emu.grasscutter.game.friends.FriendsList;
import emu.grasscutter.game.friends.PlayerProfile;
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.player.PlayerBirthday;
import emu.grasscutter.game.props.ActionReason;
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.CombatInvokeEntryOuterClass.CombatInvokeEntry;
import emu.grasscutter.net.proto.HeadImageOuterClass.HeadImage;
......@@ -46,7 +46,7 @@ import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap;
import java.util.*;
@Entity(value = "players", useDiscriminator = false)
public class GenshinPlayer {
public class Player {
@Id private int id;
@Indexed(options = @IndexOptions(unique = true)) private String accountId;
......@@ -67,7 +67,7 @@ public class GenshinPlayer {
@Transient private long nextGuid = 0;
@Transient private int peerId;
@Transient private World world;
@Transient private GenshinScene scene;
@Transient private Scene scene;
@Transient private GameSession session;
@Transient private AvatarStorage avatars;
@Transient private Inventory inventory;
......@@ -104,7 +104,7 @@ public class GenshinPlayer {
@Deprecated
@SuppressWarnings({"rawtypes", "unchecked"}) // Morphia only!
public GenshinPlayer() {
public Player() {
this.inventory = new Inventory(this);
this.avatars = new AvatarStorage(this);
this.friendsList = new FriendsList(this);
......@@ -140,7 +140,7 @@ public class GenshinPlayer {
}
// On player creation
public GenshinPlayer(GameSession session) {
public Player(GameSession session) {
this();
this.account = session.getAccount();
this.accountId = this.getAccount().getId();
......@@ -159,7 +159,7 @@ public class GenshinPlayer {
this.setProperty(PlayerProperty.PROP_PLAYER_RESIN, 160);
this.getFlyCloakList().add(140001);
this.getNameCardList().add(210001);
this.getPos().set(GenshinConstants.START_POSITION);
this.getPos().set(GameConstants.START_POSITION);
this.getRotation().set(0, 307, 0);
}
......@@ -171,7 +171,7 @@ public class GenshinPlayer {
this.id = id;
}
public long getNextGenshinGuid() {
public long getNextGameGuid() {
long nextId = ++this.nextGuid;
return ((long) this.getUid() << 32) + nextId;
}
......@@ -209,11 +209,11 @@ public class GenshinPlayer {
this.world = world;
}
public synchronized GenshinScene getScene() {
public synchronized Scene getScene() {
return scene;
}
public synchronized void setScene(GenshinScene scene) {
public synchronized void setScene(Scene scene) {
this.scene = scene;
}
......@@ -292,7 +292,7 @@ public class GenshinPlayer {
}
private int getExpRequired(int level) {
PlayerLevelData levelData = GenshinData.getPlayerLevelDataMap().get(level);
PlayerLevelData levelData = GameData.getPlayerLevelDataMap().get(level);
return levelData != null ? levelData.getExp() : 0;
}
......@@ -546,9 +546,9 @@ public class GenshinPlayer {
}
public void rechargeMoonCard() {
LinkedList<GenshinItem> items = new LinkedList<GenshinItem>();
LinkedList<GameItem> items = new LinkedList<GameItem>();
for (int i = 0; i < 300; i++) {
items.add(new GenshinItem(203));
items.add(new GameItem(203));
}
inventory.addItems(items);
if (!moonCard) {
......@@ -583,8 +583,8 @@ public class GenshinPlayer {
}
moonCardGetTimes.add(now);
addMoonCardDays(1);
GenshinItem genshinItem = new GenshinItem(201, 90);
getInventory().addItem(genshinItem, ActionReason.BlessingRedeemReward);
GameItem item = new GameItem(201, 90);
getInventory().addItem(item, ActionReason.BlessingRedeemReward);
session.send(new PacketCardProductRewardNotify(getMoonCardRemainDays()));
}
......@@ -604,29 +604,19 @@ public class GenshinPlayer {
this.hasSentAvatarDataNotify = hasSentAvatarDataNotify;
}
public void addAvatar(GenshinAvatar avatar) {
public void addAvatar(Avatar avatar) {
boolean result = getAvatars().addAvatar(avatar);
if (result) {
// Add starting weapon
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
if (hasSentAvatarDataNotify()) {
// Recalc stats
avatar.recalcStats();
// Packet
sendPacket(new PacketAvatarAddNotify(avatar, addedToTeam));
sendPacket(new PacketAvatarAddNotify(avatar, false));
}
} else {
// Failed adding avatar
......@@ -659,7 +649,7 @@ public class GenshinPlayer {
}
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 {
* @param sender The sender of the message.
* @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()));
}
......@@ -714,7 +704,7 @@ public class GenshinPlayer {
}
public void interactWith(int gadgetEntityId) {
GenshinEntity entity = getScene().getEntityById(gadgetEntityId);
GameEntity entity = getScene().getEntityById(gadgetEntityId);
if (entity == null) {
return;
......@@ -727,7 +717,7 @@ public class GenshinPlayer {
if (entity instanceof EntityItem) {
// Pick item
EntityItem drop = (EntityItem) entity;
GenshinItem item = new GenshinItem(drop.getItemData(), drop.getCount());
GameItem item = new GameItem(drop.getItemData(), drop.getCount());
// Add to inventory
boolean success = getInventory().addItem(item, ActionReason.SubfieldDrop);
if (success) {
......@@ -746,7 +736,7 @@ public class GenshinPlayer {
}
public void sendPacket(GenshinPacket packet) {
public void sendPacket(BasePacket packet) {
if (this.hasSentAvatarDataNotify) {
this.getSession().send(packet);
}
......@@ -875,7 +865,7 @@ public class GenshinPlayer {
// Check if player object exists in server
// TODO - optimize
GenshinPlayer exists = this.getServer().getPlayerByUid(getUid());
Player exists = this.getServer().getPlayerByUid(getUid());
if (exists != null) {
exists.getSession().close();
}
......
......@@ -12,9 +12,9 @@ import java.util.Set;
import org.danilopianini.util.SpatialIndex;
import emu.grasscutter.Grasscutter;
import emu.grasscutter.data.GenshinData;
import emu.grasscutter.data.GenshinDepot;
import emu.grasscutter.data.GenshinResource;
import emu.grasscutter.data.GameData;
import emu.grasscutter.data.GameDepot;
import emu.grasscutter.data.GameResource;
import emu.grasscutter.data.def.MonsterData;
import emu.grasscutter.data.def.SceneData;
import emu.grasscutter.data.def.WorldLevelData;
......@@ -22,14 +22,14 @@ import emu.grasscutter.game.entity.EntityAvatar;
import emu.grasscutter.game.entity.EntityClientGadget;
import emu.grasscutter.game.entity.EntityGadget;
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.FightProperty;
import emu.grasscutter.game.props.LifeState;
import emu.grasscutter.game.props.SceneType;
import emu.grasscutter.game.world.SpawnDataEntry;
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.VisionTypeOuterClass.VisionType;
import emu.grasscutter.server.packet.send.PacketEntityFightPropUpdateNotify;
......@@ -41,11 +41,11 @@ import it.unimi.dsi.fastutil.ints.Int2ObjectMap;
import it.unimi.dsi.fastutil.ints.Int2ObjectMaps;
import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap;
public class GenshinScene {
public class Scene {
private final World world;
private final SceneData sceneData;
private final List<GenshinPlayer> players;
private final Int2ObjectMap<GenshinEntity> entities;
private final List<Player> players;
private final Int2ObjectMap<GameEntity> entities;
private final Set<SpawnDataEntry> spawnedEntities;
private final Set<SpawnDataEntry> deadSpawnedEntities;
......@@ -55,7 +55,7 @@ public class GenshinScene {
private ClimateType climate;
private int weather;
public GenshinScene(World world, SceneData sceneData) {
public Scene(World world, SceneData sceneData) {
this.world = world;
this.sceneData = sceneData;
this.players = Collections.synchronizedList(new ArrayList<>());
......@@ -84,7 +84,7 @@ public class GenshinScene {
return getSceneData().getSceneType();
}
public List<GenshinPlayer> getPlayers() {
public List<Player> getPlayers() {
return players;
}
......@@ -92,11 +92,11 @@ public class GenshinScene {
return this.getPlayers().size();
}
public Int2ObjectMap<GenshinEntity> getEntities() {
public Int2ObjectMap<GameEntity> getEntities() {
return entities;
}
public GenshinEntity getEntityById(int id) {
public GameEntity getEntityById(int id) {
return this.entities.get(id);
}
......@@ -140,11 +140,11 @@ public class GenshinScene {
return deadSpawnedEntities;
}
public boolean isInScene(GenshinEntity entity) {
public boolean isInScene(GameEntity entity) {
return this.entities.containsKey(entity.getId());
}
public synchronized void addPlayer(GenshinPlayer player) {
public synchronized void addPlayer(Player player) {
// Check if player already in
if (getPlayers().contains(player)) {
return;
......@@ -163,7 +163,7 @@ public class GenshinScene {
this.setupPlayerAvatars(player);
}
public synchronized void removePlayer(GenshinPlayer player) {
public synchronized void removePlayer(Player player) {
// Remove player from scene
getPlayers().remove(player);
player.setScene(null);
......@@ -182,7 +182,7 @@ public class GenshinScene {
}
}
private void setupPlayerAvatars(GenshinPlayer player) {
private void setupPlayerAvatars(Player player) {
// Clear entities from old team
player.getTeamManager().getActiveTeam().clear();
......@@ -199,7 +199,7 @@ public class GenshinScene {
}
}
private void removePlayerAvatars(GenshinPlayer player) {
private void removePlayerAvatars(Player player) {
Iterator<EntityAvatar> it = player.getTeamManager().getActiveTeam().iterator();
while (it.hasNext()) {
this.removeEntity(it.next(), VisionType.VISION_REMOVE);
......@@ -207,7 +207,7 @@ public class GenshinScene {
}
}
public void spawnPlayer(GenshinPlayer player) {
public void spawnPlayer(Player player) {
if (this.isInScene(player.getTeamManager().getCurrentAvatarEntity())) {
return;
}
......@@ -219,33 +219,33 @@ public class GenshinScene {
this.addEntity(player.getTeamManager().getCurrentAvatarEntity());
}
private void addEntityDirectly(GenshinEntity entity) {
private void addEntityDirectly(GameEntity entity) {
getEntities().put(entity.getId(), entity);
}
public synchronized void addEntity(GenshinEntity entity) {
public synchronized void addEntity(GameEntity entity) {
this.addEntityDirectly(entity);
this.broadcastPacket(new PacketSceneEntityAppearNotify(entity));
}
public synchronized void addEntities(Collection<GenshinEntity> entities) {
for (GenshinEntity entity : entities) {
public synchronized void addEntities(Collection<GameEntity> entities) {
for (GameEntity entity : entities) {
this.addEntityDirectly(entity);
}
this.broadcastPacket(new PacketSceneEntityAppearNotify(entities, VisionType.VISION_BORN));
}
private GenshinEntity removeEntityDirectly(GenshinEntity entity) {
private GameEntity removeEntityDirectly(GameEntity entity) {
return getEntities().remove(entity.getId());
}
public void removeEntity(GenshinEntity entity) {
public void removeEntity(GameEntity entity) {
this.removeEntity(entity, VisionType.VISION_DIE);
}
public synchronized void removeEntity(GenshinEntity entity, VisionType visionType) {
GenshinEntity removed = this.removeEntityDirectly(entity);
public synchronized void removeEntity(GameEntity entity, VisionType visionType) {
GameEntity removed = this.removeEntityDirectly(entity);
if (removed != null) {
this.broadcastPacket(new PacketSceneEntityDisappearNotify(removed, visionType));
}
......@@ -258,11 +258,11 @@ public class GenshinScene {
this.broadcastPacket(new PacketSceneEntityAppearNotify(newEntity, VisionType.VISION_REPLACE, oldEntity.getId()));
}
public void showOtherEntities(GenshinPlayer player) {
List<GenshinEntity> entities = new LinkedList<>();
GenshinEntity currentEntity = player.getTeamManager().getCurrentAvatarEntity();
public void showOtherEntities(Player player) {
List<GameEntity> entities = new LinkedList<>();
GameEntity currentEntity = player.getTeamManager().getCurrentAvatarEntity();
for (GenshinEntity entity : this.getEntities().values()) {
for (GameEntity entity : this.getEntities().values()) {
if (entity == currentEntity) {
continue;
}
......@@ -273,8 +273,8 @@ public class GenshinScene {
}
public void handleAttack(AttackResult result) {
//GenshinEntity attacker = getEntityById(result.getAttackerId());
GenshinEntity target = getEntityById(result.getDefenseId());
//GameEntity attacker = getEntityById(result.getAttackerId());
GameEntity target = getEntityById(result.getDefenseId());
if (target == null) {
return;
......@@ -306,7 +306,7 @@ public class GenshinScene {
}
}
public void killEntity(GenshinEntity target, int attackerId) {
public void killEntity(GameEntity target, int attackerId) {
// Packet
this.broadcastPacket(new PacketLifeStateChangeNotify(attackerId, target, LifeState.LIFE_DEAD));
this.removeEntity(target);
......@@ -321,10 +321,10 @@ public class GenshinScene {
// TODO - Test
public void checkSpawns() {
SpatialIndex<SpawnGroupEntry> list = GenshinDepot.getSpawnListById(this.getId());
SpatialIndex<SpawnGroupEntry> list = GameDepot.getSpawnListById(this.getId());
Set<SpawnDataEntry> visible = new HashSet<>();
for (GenshinPlayer player : this.getPlayers()) {
for (Player player : this.getPlayers()) {
int RANGE = 100;
Collection<SpawnGroupEntry> entries = list.query(
new double[] {player.getPos().getX() - RANGE, player.getPos().getZ() - RANGE},
......@@ -339,7 +339,7 @@ public class GenshinScene {
}
// World level
WorldLevelData worldLevelData = GenshinData.getWorldLevelDataMap().get(getWorld().getWorldLevel());
WorldLevelData worldLevelData = GameData.getWorldLevelDataMap().get(getWorld().getWorldLevel());
int worldLevelOverride = 0;
if (worldLevelData != null) {
......@@ -347,13 +347,13 @@ public class GenshinScene {
}
// Todo
List<GenshinEntity> toAdd = new LinkedList<>();
List<GenshinEntity> toRemove = new LinkedList<>();
List<GameEntity> toAdd = new LinkedList<>();
List<GameEntity> toRemove = new LinkedList<>();
for (SpawnDataEntry entry : visible) {
if (!this.getSpawnedEntities().contains(entry) && !this.getDeadSpawnedEntities().contains(entry)) {
// Spawn entity
MonsterData data = GenshinData.getMonsterDataMap().get(entry.getMonsterId());
MonsterData data = GameData.getMonsterDataMap().get(entry.getMonsterId());
if (data == null) {
continue;
......@@ -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())) {
toRemove.add(entity);
}
......@@ -407,7 +407,7 @@ public class GenshinScene {
}
public void onPlayerDestroyGadget(int entityId) {
GenshinEntity entity = getEntities().get(entityId);
GameEntity entity = getEntities().get(entityId);
if (entity == null || !(entity instanceof EntityClientGadget)) {
return;
......@@ -430,20 +430,20 @@ public class GenshinScene {
// 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
for (GenshinPlayer player : this.getPlayers()) {
for (Player player : this.getPlayers()) {
player.getSession().send(packet);
}
}
public void broadcastPacketToOthers(GenshinPlayer excludedPlayer, GenshinPacket packet) {
public void broadcastPacketToOthers(Player excludedPlayer, BasePacket packet) {
// Optimization
if (this.getPlayerCount() == 1 && this.getPlayers().get(0) == excludedPlayer) {
return;
}
// 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) {
continue;
}
......
......@@ -4,9 +4,9 @@ import java.util.ArrayList;
import java.util.List;
import dev.morphia.annotations.Entity;
import emu.grasscutter.GenshinConstants;
import emu.grasscutter.GameConstants;
import emu.grasscutter.Grasscutter;
import emu.grasscutter.game.avatar.GenshinAvatar;
import emu.grasscutter.game.avatar.Avatar;
@Entity
public class TeamInfo {
......@@ -34,11 +34,11 @@ public class TeamInfo {
return avatars.size();
}
public boolean contains(GenshinAvatar avatar) {
public boolean contains(Avatar avatar) {
return getAvatars().contains(avatar.getAvatarId());
}
public boolean addAvatar(GenshinAvatar avatar) {
public boolean addAvatar(Avatar avatar) {
if (size() >= Grasscutter.getConfig().getGameServerOptions().MaxAvatarsInTeam || contains(avatar)) {
return false;
}
......
......@@ -10,16 +10,16 @@ import java.util.Set;
import dev.morphia.annotations.Entity;
import dev.morphia.annotations.Transient;
import emu.grasscutter.GenshinConstants;
import emu.grasscutter.GameConstants;
import emu.grasscutter.Grasscutter;
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.EntityGadget;
import emu.grasscutter.game.props.ElementType;
import emu.grasscutter.game.props.EnterReason;
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.proto.EnterTypeOuterClass.EnterType;
import emu.grasscutter.net.proto.MotionStateOuterClass.MotionState;
......@@ -44,7 +44,7 @@ import it.unimi.dsi.fastutil.ints.IntSet;
@Entity
public class TeamManager {
@Transient private GenshinPlayer player;
@Transient private Player player;
private Map<Integer, TeamInfo> teams;
private int currentTeamIndex;
......@@ -65,18 +65,18 @@ public class TeamManager {
this.teamResonancesConfig = new IntOpenHashSet();
}
public TeamManager(GenshinPlayer player) {
public TeamManager(Player player) {
this();
this.player = player;
this.teams = new HashMap<>();
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());
}
}
public GenshinPlayer getPlayer() {
public Player getPlayer() {
return player;
}
......@@ -84,7 +84,7 @@ public class TeamManager {
return player.getWorld();
}
public void setPlayer(GenshinPlayer player) {
public void setPlayer(Player player) {
this.player = player;
}
......@@ -207,7 +207,7 @@ public class TeamManager {
}
}
public void updateTeamEntities(GenshinPacket responsePacket) {
public void updateTeamEntities(BasePacket responsePacket) {
// Sanity check - Should never happen
if (this.getCurrentTeamInfo().getAvatars().size() <= 0) {
return;
......@@ -287,9 +287,9 @@ public class TeamManager {
}
// Set team data
LinkedHashSet<GenshinAvatar> newTeam = new LinkedHashSet<>();
LinkedHashSet<Avatar> newTeam = new LinkedHashSet<>();
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)) {
// Should never happen
return;
......@@ -299,7 +299,7 @@ public class TeamManager {
// Clear current team info and add avatars from our new team
teamInfo.getAvatars().clear();
for (GenshinAvatar avatar : newTeam) {
for (Avatar avatar : newTeam) {
teamInfo.addAvatar(avatar);
}
......@@ -323,9 +323,9 @@ public class TeamManager {
TeamInfo teamInfo = this.getMpTeam();
// Set team data
LinkedHashSet<GenshinAvatar> newTeam = new LinkedHashSet<>();
LinkedHashSet<Avatar> newTeam = new LinkedHashSet<>();
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)) {
// Should never happen
return;
......@@ -335,7 +335,7 @@ public class TeamManager {
// Clear current team info and add avatars from our new team
teamInfo.getAvatars().clear();
for (GenshinAvatar avatar : newTeam) {
for (Avatar avatar : newTeam) {
teamInfo.addAvatar(avatar);
}
......@@ -437,7 +437,7 @@ public class TeamManager {
getPlayer().sendPacket(new PacketAvatarDieAnimationEndRsp(deadAvatar.getId(), 0));
}
public boolean reviveAvatar(GenshinAvatar avatar) {
public boolean reviveAvatar(Avatar avatar) {
for (EntityAvatar entity : getActiveTeam()) {
if (entity.getAvatar() == avatar) {
if (entity.isAlive()) {
......@@ -476,14 +476,14 @@ public class TeamManager {
}
// 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
player.setSceneId(3);
player.getPos().set(GenshinConstants.START_POSITION);
player.getPos().set(GameConstants.START_POSITION);
// Packets
getPlayer().sendPacket(new GenshinPacket(PacketOpcodes.WorldPlayerReviveRsp));
getPlayer().sendPacket(new BasePacket(PacketOpcodes.WorldPlayerReviveRsp));
}
public void saveAvatars() {
......
......@@ -8,19 +8,19 @@ import java.util.LinkedList;
import java.util.List;
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.EnterReason;
import emu.grasscutter.game.props.EntityIdType;
import emu.grasscutter.game.props.FightProperty;
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.game.GenshinPlayer.SceneLoadState;
import emu.grasscutter.game.Player.SceneLoadState;
import emu.grasscutter.game.entity.EntityAvatar;
import emu.grasscutter.game.entity.EntityClientGadget;
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.EnterTypeOuterClass.EnterType;
import emu.grasscutter.net.proto.VisionTypeOuterClass.VisionType;
......@@ -40,10 +40,10 @@ import it.unimi.dsi.fastutil.ints.Int2ObjectMap;
import it.unimi.dsi.fastutil.ints.Int2ObjectMaps;
import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap;
public class World implements Iterable<GenshinPlayer> {
private final GenshinPlayer owner;
private final List<GenshinPlayer> players;
private final Int2ObjectMap<GenshinScene> scenes;
public class World implements Iterable<Player> {
private final Player owner;
private final List<Player> players;
private final Int2ObjectMap<Scene> scenes;
private int levelEntityId;
private int nextEntityId = 0;
......@@ -52,11 +52,11 @@ public class World implements Iterable<GenshinPlayer> {
private boolean isMultiplayer;
public World(GenshinPlayer player) {
public World(Player player) {
this(player, false);
}
public World(GenshinPlayer player, boolean isMultiplayer) {
public World(Player player, boolean isMultiplayer) {
this.owner = player;
this.players = Collections.synchronizedList(new ArrayList<>());
this.scenes = Int2ObjectMaps.synchronize(new Int2ObjectOpenHashMap<>());
......@@ -68,7 +68,7 @@ public class World implements Iterable<GenshinPlayer> {
this.owner.getServer().registerWorld(this);
}
public GenshinPlayer getHost() {
public Player getHost() {
return owner;
}
......@@ -95,25 +95,25 @@ public class World implements Iterable<GenshinPlayer> {
this.worldLevel = worldLevel;
}
public List<GenshinPlayer> getPlayers() {
public List<Player> getPlayers() {
return players;
}
public Int2ObjectMap<GenshinScene> getScenes() {
public Int2ObjectMap<Scene> getScenes() {
return this.scenes;
}
public GenshinScene getSceneById(int sceneId) {
public Scene getSceneById(int sceneId) {
// Get scene normally
GenshinScene scene = getScenes().get(sceneId);
Scene scene = getScenes().get(sceneId);
if (scene != null) {
return scene;
}
// Create scene from scene data if it doesnt exist
SceneData sceneData = GenshinData.getSceneDataMap().get(sceneId);
SceneData sceneData = GameData.getSceneDataMap().get(sceneId);
if (sceneData != null) {
scene = new GenshinScene(this, sceneData);
scene = new Scene(this, sceneData);
this.registerScene(scene);
return scene;
}
......@@ -133,7 +133,7 @@ public class World implements Iterable<GenshinPlayer> {
return (idType.getId() << 24) + ++this.nextEntityId;
}
public synchronized void addPlayer(GenshinPlayer player) {
public synchronized void addPlayer(Player player) {
// Check if player already in
if (getPlayers().contains(player)) {
return;
......@@ -159,7 +159,7 @@ public class World implements Iterable<GenshinPlayer> {
}
// Add to scene
GenshinScene scene = this.getSceneById(player.getSceneId());
Scene scene = this.getSceneById(player.getSceneId());
scene.addPlayer(player);
// Info packet for other players
......@@ -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
player.sendPacket(
new PacketDelTeamEntityNotify(
......@@ -182,7 +182,7 @@ public class World implements Iterable<GenshinPlayer> {
player.setWorld(null);
// Remove from scene
GenshinScene scene = this.getSceneById(player.getSceneId());
Scene scene = this.getSceneById(player.getSceneId());
scene.removePlayer(player);
// Info packet for other players
......@@ -192,8 +192,8 @@ public class World implements Iterable<GenshinPlayer> {
// Disband world if host leaves
if (getHost() == player) {
List<GenshinPlayer> kicked = new ArrayList<>(this.getPlayers());
for (GenshinPlayer victim : kicked) {
List<Player> kicked = new ArrayList<>(this.getPlayers());
for (Player victim : kicked) {
World world = new World(victim);
world.addPlayer(victim);
......@@ -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);
}
public void deregisterScene(GenshinScene scene) {
public void deregisterScene(Scene scene) {
this.getScenes().remove(scene.getId());
}
public boolean transferPlayerToScene(GenshinPlayer player, int sceneId, Position pos) {
if (GenshinData.getSceneDataMap().get(sceneId) == null) {
public boolean transferPlayerToScene(Player player, int sceneId, Position pos) {
if (GameData.getSceneDataMap().get(sceneId) == null) {
return false;
}
GenshinScene oldScene = null;
Scene oldScene = null;
if (player.getScene() != null) {
oldScene = player.getScene();
......@@ -228,7 +228,7 @@ public class World implements Iterable<GenshinPlayer> {
oldScene.removePlayer(player);
}
GenshinScene newScene = this.getSceneById(sceneId);
Scene newScene = this.getSceneById(sceneId);
newScene.addPlayer(player);
player.getPos().set(pos);
......@@ -245,8 +245,8 @@ public class World implements Iterable<GenshinPlayer> {
return true;
}
private void updatePlayerInfos(GenshinPlayer paramPlayer) {
for (GenshinPlayer player : getPlayers()) {
private void updatePlayerInfos(Player paramPlayer) {
for (Player player : getPlayers()) {
// Dont send packets if player is loading in and filter out joining player
if (!player.hasSentAvatarDataNotify() || player.getSceneLoadState().getValue() < SceneLoadState.INIT.getValue() || player == paramPlayer) {
continue;
......@@ -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
for (GenshinPlayer player : this.getPlayers()) {
for (Player player : this.getPlayers()) {
player.getSession().send(packet);
}
}
public void onTick() {
for (GenshinScene scene : this.getScenes().values()) {
for (Scene scene : this.getScenes().values()) {
scene.onTick();
}
}
......@@ -287,7 +287,7 @@ public class World implements Iterable<GenshinPlayer> {
}
@Override
public Iterator<GenshinPlayer> iterator() {
public Iterator<Player> iterator() {
return getPlayers().iterator();
}
}
......@@ -16,7 +16,7 @@ import dev.morphia.annotations.PostLoad;
import dev.morphia.annotations.PrePersist;
import dev.morphia.annotations.Transient;
import emu.grasscutter.Grasscutter;
import emu.grasscutter.data.GenshinData;
import emu.grasscutter.data.GameData;
import emu.grasscutter.data.common.FightPropData;
import emu.grasscutter.data.custom.OpenConfigEntry;
import emu.grasscutter.data.def.AvatarData;
......@@ -35,10 +35,10 @@ import emu.grasscutter.data.def.WeaponPromoteData;
import emu.grasscutter.data.def.ItemData.WeaponProperty;
import emu.grasscutter.data.def.ProudSkillData;
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.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.EntityIdType;
import emu.grasscutter.game.props.FetterState;
......@@ -57,11 +57,11 @@ import it.unimi.dsi.fastutil.ints.Int2ObjectMap;
import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap;
@Entity(value = "avatars", useDiscriminator = false)
public class GenshinAvatar {
public class Avatar {
@Id private ObjectId id;
@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 long guid; // Player unique id
private int avatarId; // Id of avatar
......@@ -73,7 +73,7 @@ public class GenshinAvatar {
private int satiationPenalty; // ?
private float currentHp;
@Transient private final Int2ObjectMap<GenshinItem> equips;
@Transient private final Int2ObjectMap<GameItem> equips;
@Transient private final Int2FloatOpenHashMap fightProp;
@Transient private Set<String> extraAbilityEmbryos;
......@@ -96,21 +96,21 @@ public class GenshinAvatar {
private int nameCardRewardId;
private int nameCardId;
public GenshinAvatar() {
public Avatar() {
// Morhpia only!
this.equips = new Int2ObjectOpenHashMap<>();
this.fightProp = new Int2FloatOpenHashMap();
this.extraAbilityEmbryos = new HashSet<>();
this.proudSkillBonusMap = new HashMap<>();
this.fetters = new ArrayList<>(); // TODO Move to genshin avatar
this.fetters = new ArrayList<>(); // TODO Move to avatar
}
// On creation
public GenshinAvatar(int avatarId) {
this(GenshinData.getAvatarDataMap().get(avatarId));
public Avatar(int avatarId) {
this(GameData.getAvatarDataMap().get(avatarId));
}
public GenshinAvatar(AvatarData data) {
public Avatar(AvatarData data) {
this();
this.avatarId = data.getId();
this.nameCardRewardId = data.getNameCardRewardId();
......@@ -143,7 +143,7 @@ public class GenshinAvatar {
this.onLoad();
}
public GenshinPlayer getPlayer() {
public Player getPlayer() {
return this.owner;
}
......@@ -163,10 +163,10 @@ public class GenshinAvatar {
return ownerId;
}
public void setOwner(GenshinPlayer player) {
public void setOwner(Player player) {
this.owner = player;
this.ownerId = player.getUid();
this.guid = player.getNextGenshinGuid();
this.guid = player.getNextGameGuid();
}
public int getSatiation() {
......@@ -229,19 +229,19 @@ public class GenshinAvatar {
this.promoteLevel = promoteLevel;
}
public Int2ObjectMap<GenshinItem> getEquips() {
public Int2ObjectMap<GameItem> getEquips() {
return equips;
}
public GenshinItem getEquipBySlot(EquipType slot) {
public GameItem getEquipBySlot(EquipType slot) {
return this.getEquips().get(slot.getValue());
}
private GenshinItem getEquipBySlot(int slotId) {
private GameItem getEquipBySlot(int slotId) {
return this.getEquips().get(slotId);
}
public GenshinItem getWeapon() {
public GameItem getWeapon() {
return this.getEquipBySlot(EquipType.EQUIP_WEAPON);
}
......@@ -270,7 +270,7 @@ public class GenshinAvatar {
}
if (openData.getNeedAvatarPromoteLevel() <= this.getPromoteLevel()) {
int proudSkillId = (openData.getProudSkillGroupId() * 100) + 1;
if (GenshinData.getProudSkillDataMap().containsKey(proudSkillId)) {
if (GameData.getProudSkillDataMap().containsKey(proudSkillId)) {
this.getProudSkillList().add(proudSkillId);
}
}
......@@ -385,7 +385,7 @@ public class GenshinAvatar {
return bornTime;
}
public boolean equipItem(GenshinItem item, boolean shouldRecalc) {
public boolean equipItem(GameItem item, boolean shouldRecalc) {
EquipType itemEquipType = item.getItemData().getEquipType();
if (itemEquipType == EquipType.EQUIP_NONE) {
return false;
......@@ -416,7 +416,7 @@ public class GenshinAvatar {
}
public boolean unequipItem(EquipType slot) {
GenshinItem item = getEquips().remove(slot.getValue());
GameItem item = getEquips().remove(slot.getValue());
if (item != null) {
item.setEquipCharacter(0);
......@@ -434,7 +434,7 @@ public class GenshinAvatar {
public void recalcStats(boolean forceSendAbilityChange) {
// Setup
AvatarData data = this.getAvatarData();
AvatarPromoteData promoteData = GenshinData.getAvatarPromoteData(data.getAvatarPromoteId(), this.getPromoteLevel());
AvatarPromoteData promoteData = GameData.getAvatarPromoteData(data.getAvatarPromoteId(), this.getPromoteLevel());
Int2IntOpenHashMap setMap = new Int2IntOpenHashMap();
// Extra ability embryos
......@@ -476,21 +476,21 @@ public class GenshinAvatar {
// Artifacts
for (int slotId = 1; slotId <= 5; slotId++) {
// Get artifact
GenshinItem equip = this.getEquipBySlot(slotId);
GameItem equip = this.getEquipBySlot(slotId);
if (equip == null) {
continue;
}
// Artifact main stat
ReliquaryMainPropData mainPropData = GenshinData.getReliquaryMainPropDataMap().get(equip.getMainPropId());
ReliquaryMainPropData mainPropData = GameData.getReliquaryMainPropDataMap().get(equip.getMainPropId());
if (mainPropData != null) {
ReliquaryLevelData levelData = GenshinData.getRelicLevelData(equip.getItemData().getRankLevel(), equip.getLevel());
ReliquaryLevelData levelData = GameData.getRelicLevelData(equip.getItemData().getRankLevel(), equip.getLevel());
if (levelData != null) {
this.addFightProperty(mainPropData.getFightProp(), levelData.getPropValue(mainPropData.getFightProp()));
}
}
// Artifact sub stats
for (int appendPropId : equip.getAppendPropIdList()) {
ReliquaryAffixData affixData = GenshinData.getReliquaryAffixDataMap().get(appendPropId);
ReliquaryAffixData affixData = GameData.getReliquaryAffixDataMap().get(appendPropId);
if (affixData != null) {
this.addFightProperty(affixData.getFightProp(), affixData.getPropValue());
}
......@@ -503,7 +503,7 @@ public class GenshinAvatar {
// Set stuff
for (Int2IntOpenHashMap.Entry e : setMap.int2IntEntrySet()) {
ReliquarySetData setData = GenshinData.getReliquarySetDataMap().get(e.getIntKey());
ReliquarySetData setData = GameData.getReliquarySetDataMap().get(e.getIntKey());
if (setData == null) {
continue;
}
......@@ -516,7 +516,7 @@ public class GenshinAvatar {
if (amount >= setData.getSetNeedNum()[setIndex]) {
int affixId = (setData.getEquipAffixId() * 10) + setIndex;
EquipAffixData affix = GenshinData.getEquipAffixDataMap().get(affixId);
EquipAffixData affix = GameData.getEquipAffixDataMap().get(affixId);
if (affix == null) {
continue;
}
......@@ -535,17 +535,17 @@ public class GenshinAvatar {
}
// Weapon
GenshinItem weapon = this.getWeapon();
GameItem weapon = this.getWeapon();
if (weapon != null) {
// Add stats
WeaponCurveData curveData = GenshinData.getWeaponCurveDataMap().get(weapon.getLevel());
WeaponCurveData curveData = GameData.getWeaponCurveDataMap().get(weapon.getLevel());
if (curveData != null) {
for (WeaponProperty weaponProperty : weapon.getItemData().getWeaponProperties()) {
this.addFightProperty(weaponProperty.getFightProp(), weaponProperty.getInitValue() * curveData.getMultByProp(weaponProperty.getType()));
}
}
// Weapon promotion stats
WeaponPromoteData wepPromoteData = GenshinData.getWeaponPromoteData(weapon.getItemData().getWeaponPromoteId(), weapon.getPromoteLevel());
WeaponPromoteData wepPromoteData = GameData.getWeaponPromoteData(weapon.getItemData().getWeaponPromoteId(), weapon.getPromoteLevel());
if (wepPromoteData != null) {
for (FightPropData prop : wepPromoteData.getAddProps()) {
if (prop.getValue() == 0f || prop.getProp() == null) {
......@@ -563,7 +563,7 @@ public class GenshinAvatar {
}
// Calculate affix id
int affixId = (af * 10) + weapon.getRefinement();
EquipAffixData affix = GenshinData.getEquipAffixDataMap().get(affixId);
EquipAffixData affix = GameData.getEquipAffixDataMap().get(affixId);
if (affix == null) {
continue;
}
......@@ -580,7 +580,7 @@ public class GenshinAvatar {
}
// 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();
for (InherentProudSkillOpens openData : skillDepot.getInherentProudSkillOpens()) {
if (openData.getProudSkillGroupId() == 0) {
......@@ -588,7 +588,7 @@ public class GenshinAvatar {
}
if (openData.getNeedAvatarPromoteLevel() <= this.getPromoteLevel()) {
int proudSkillId = (openData.getProudSkillGroupId() * 100) + 1;
if (GenshinData.getProudSkillDataMap().containsKey(proudSkillId)) {
if (GameData.getProudSkillDataMap().containsKey(proudSkillId)) {
this.getProudSkillList().add(proudSkillId);
}
}
......@@ -596,7 +596,7 @@ public class GenshinAvatar {
// Proud skills
for (int proudSkillId : this.getProudSkillList()) {
ProudSkillData proudSkillData = GenshinData.getProudSkillDataMap().get(proudSkillId);
ProudSkillData proudSkillData = GameData.getProudSkillDataMap().get(proudSkillId);
if (proudSkillData == null) {
continue;
}
......@@ -613,7 +613,7 @@ public class GenshinAvatar {
// Constellations
if (this.getTalentIdList().size() > 0) {
for (int talentId : this.getTalentIdList()) {
AvatarTalentData avatarTalentData = GenshinData.getAvatarTalentDataMap().get(talentId);
AvatarTalentData avatarTalentData = GameData.getAvatarTalentDataMap().get(talentId);
if (avatarTalentData == null) {
return;
}
......@@ -657,7 +657,7 @@ public class GenshinAvatar {
return;
}
OpenConfigEntry entry = GenshinData.getOpenConfigEntries().get(openConfig);
OpenConfigEntry entry = GameData.getOpenConfigEntries().get(openConfig);
if (entry == null) {
if (forceAdd) {
// Add config string to ability skill list anyways
......@@ -684,14 +684,14 @@ public class GenshinAvatar {
if (this.getTalentIdList().size() > 0) {
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) {
continue;
}
// 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) {
continue;
}
......@@ -712,7 +712,7 @@ public class GenshinAvatar {
}
// Get proud skill group id
AvatarSkillData skillData = GenshinData.getAvatarSkillDataMap().get(skillId);
AvatarSkillData skillData = GameData.getAvatarSkillDataMap().get(skillId);
if (skillData == null) {
continue;
......@@ -785,7 +785,7 @@ public class GenshinAvatar {
.setWearingFlycloakId(this.getFlyCloak())
.setCostumeId(this.getCostume());
for (GenshinItem item : this.getEquips().values()) {
for (GameItem item : this.getEquips().values()) {
avatarInfo.addEquipGuidList(item.getGuid());
}
......
......@@ -7,7 +7,7 @@ public class AvatarProfileData {
private int avatarId;
private int level;
public AvatarProfileData(GenshinAvatar avatar) {
public AvatarProfileData(Avatar avatar) {
this.update(avatar);
}
......@@ -19,7 +19,7 @@ public class AvatarProfileData {
return level;
}
public void update(GenshinAvatar avatar) {
public void update(Avatar avatar) {
this.avatarId = avatar.getAvatarId();
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