diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 8d6d6aaf0..b61ac08c8 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -3,6 +3,7 @@ on: push: branches: - "stable" + - "development" pull_request: types: - opened @@ -25,4 +26,4 @@ jobs: uses: actions/upload-artifact@v3 with: name: Grasscutter - path: grasscutter.jar + path: grasscutter-*-dev.jar diff --git a/build.gradle b/build.gradle index 70f6a9358..1ac88d0fa 100644 --- a/build.gradle +++ b/build.gradle @@ -23,6 +23,8 @@ plugins { id 'com.google.protobuf' version "0.8.18" id 'idea' + id 'eclipse' + // Apply the application plugin to add support for building a CLI application id 'application' @@ -189,6 +191,14 @@ idea { } } +eclipse { + classpath { + file.whenMerged { cp -> + cp.entries.add( new org.gradle.plugins.ide.eclipse.model.SourceFolder('src/generated/main/java', null) ) + } + } +} + signing { sign publishing.publications.mavenJava } @@ -197,4 +207,8 @@ javadoc { if(JavaVersion.current().isJava9Compatible()) { options.addBooleanOption('html5', true) } +} + +processResources { + dependsOn "generateProto" } \ No newline at end of file diff --git a/proto/AvatarDataNotify.proto b/proto/AvatarDataNotify.proto index 8f0a51426..dd93c8c35 100755 --- a/proto/AvatarDataNotify.proto +++ b/proto/AvatarDataNotify.proto @@ -17,7 +17,7 @@ message AvatarDataNotify { repeated AvatarInfo avatar_list = 1; map avatar_team_map = 2; uint32 cur_avatar_team_id = 3; - uint64 choose_avatar_guid = 4; + fixed64 choose_avatar_guid = 4; repeated uint64 temp_avatar_guid_list = 5; repeated uint32 owned_flycloak_list = 6; repeated uint32 owned_costume_list = 7; diff --git a/proto/ChangeMailStarNotify.proto b/proto/ChangeMailStarNotify.proto new file mode 100644 index 000000000..e5347c86b --- /dev/null +++ b/proto/ChangeMailStarNotify.proto @@ -0,0 +1,8 @@ +syntax = "proto3"; + +option java_package = "emu.grasscutter.net.proto"; + +message ChangeMailStarNotify { + repeated uint32 mail_id_list = 1; + bool is_star = 2; +} diff --git a/proto/DelMailReq.proto b/proto/DelMailReq.proto new file mode 100644 index 000000000..ac72fce2b --- /dev/null +++ b/proto/DelMailReq.proto @@ -0,0 +1,7 @@ +syntax = "proto3"; + +option java_package = "emu.grasscutter.net.proto"; + +message DelMailReq { + repeated uint32 mail_id_list = 1; +} diff --git a/proto/DelMailRsp.proto b/proto/DelMailRsp.proto new file mode 100644 index 000000000..cd20e6fa9 --- /dev/null +++ b/proto/DelMailRsp.proto @@ -0,0 +1,8 @@ +syntax = "proto3"; + +option java_package = "emu.grasscutter.net.proto"; + +message DelMailRsp { + int32 retcode = 1; + repeated uint32 mail_id_list = 2; +} diff --git a/proto/EquipParam.proto b/proto/EquipParam.proto new file mode 100644 index 000000000..52d24943e --- /dev/null +++ b/proto/EquipParam.proto @@ -0,0 +1,10 @@ +syntax = "proto3"; + +option java_package = "emu.grasscutter.net.proto"; + +message EquipParam { + uint32 item_id = 1; + uint32 item_num = 2; + uint32 item_level = 3; + uint32 promote_level = 4; +} diff --git a/proto/GetAllMailReq.proto b/proto/GetAllMailReq.proto new file mode 100644 index 000000000..8c6bce100 --- /dev/null +++ b/proto/GetAllMailReq.proto @@ -0,0 +1,7 @@ +syntax = "proto3"; + +option java_package = "emu.grasscutter.net.proto"; + +message GetAllMailReq { + bool is_gift_mail = 1; +} diff --git a/proto/GetAllMailRsp.proto b/proto/GetAllMailRsp.proto new file mode 100644 index 000000000..0613899cb --- /dev/null +++ b/proto/GetAllMailRsp.proto @@ -0,0 +1,11 @@ +syntax = "proto3"; + +option java_package = "emu.grasscutter.net.proto"; + +import "MailData.proto"; + +message GetAllMailRsp { + int32 retcode = 1; + repeated MailData mail_list = 2; + bool is_truncated = 3; +} diff --git a/proto/GetMailItemReq.proto b/proto/GetMailItemReq.proto new file mode 100644 index 000000000..259c8ba5c --- /dev/null +++ b/proto/GetMailItemReq.proto @@ -0,0 +1,7 @@ +syntax = "proto3"; + +option java_package = "emu.grasscutter.net.proto"; + +message GetMailItemReq { + repeated uint32 mail_id_list = 1; +} diff --git a/proto/GetMailItemRsp.proto b/proto/GetMailItemRsp.proto new file mode 100644 index 000000000..e14bd54c8 --- /dev/null +++ b/proto/GetMailItemRsp.proto @@ -0,0 +1,11 @@ +syntax = "proto3"; + +option java_package = "emu.grasscutter.net.proto"; + +import "EquipParam.proto"; + +message GetMailItemRsp { + int32 retcode = 1; + repeated uint32 mail_id_list = 2; + repeated EquipParam item_list = 3; +} diff --git a/proto/MailChangeNotify.proto b/proto/MailChangeNotify.proto new file mode 100644 index 000000000..1e362f6ff --- /dev/null +++ b/proto/MailChangeNotify.proto @@ -0,0 +1,10 @@ +syntax = "proto3"; + +option java_package = "emu.grasscutter.net.proto"; + +import "MailData.proto"; + +message MailChangeNotify { + repeated MailData mail_list = 1; + repeated uint32 del_mail_id_list = 2; +} diff --git a/proto/MailData.proto b/proto/MailData.proto new file mode 100644 index 000000000..ba606c2e6 --- /dev/null +++ b/proto/MailData.proto @@ -0,0 +1,20 @@ +syntax = "proto3"; + +option java_package = "emu.grasscutter.net.proto"; + +import "MailTextContent.proto"; +import "MailItem.proto"; + +message MailData { + uint32 mail_id = 1; + MailTextContent mail_text_content = 4; + repeated MailItem item_list = 7; + uint32 send_time = 8; + uint32 expire_time = 9; + uint32 importance = 10; + bool is_read = 11; + bool is_attachment_got = 12; + uint32 config_id = 13; + repeated string argument_list = 14; + uint32 state_value = 15; +} diff --git a/proto/MailItem.proto b/proto/MailItem.proto new file mode 100644 index 000000000..da657815e --- /dev/null +++ b/proto/MailItem.proto @@ -0,0 +1,11 @@ +syntax = "proto3"; + +option java_package = "emu.grasscutter.net.proto"; + +import "ItemParam.proto"; +import "MaterialDeleteInfo.proto"; + +message MailItem { + ItemParam item_param = 1; + MaterialDeleteInfo delete_info = 2; +} diff --git a/proto/MailTextContent.proto b/proto/MailTextContent.proto new file mode 100644 index 000000000..097710f87 --- /dev/null +++ b/proto/MailTextContent.proto @@ -0,0 +1,9 @@ +syntax = "proto3"; + +option java_package = "emu.grasscutter.net.proto"; + +message MailTextContent { + string title = 1; + string content = 2; + string sender = 3; +} diff --git a/proto/ReadMailNotify.proto b/proto/ReadMailNotify.proto new file mode 100644 index 000000000..f485c8a6c --- /dev/null +++ b/proto/ReadMailNotify.proto @@ -0,0 +1,7 @@ +syntax = "proto3"; + +option java_package = "emu.grasscutter.net.proto"; + +message ReadMailNotify { + repeated uint32 mail_id_list = 1; +} diff --git a/src/main/java/emu/grasscutter/GenshinConstants.java b/src/main/java/emu/grasscutter/GameConstants.java similarity index 96% rename from src/main/java/emu/grasscutter/GenshinConstants.java rename to src/main/java/emu/grasscutter/GameConstants.java index 0f9eaa0b0..dc07c32e1 100644 --- a/src/main/java/emu/grasscutter/GenshinConstants.java +++ b/src/main/java/emu/grasscutter/GameConstants.java @@ -5,7 +5,7 @@ import java.util.Arrays; import emu.grasscutter.utils.Position; import emu.grasscutter.utils.Utils; -public final class GenshinConstants { +public final class GameConstants { public static String VERSION = "2.6.0"; public static final int MAX_TEAMS = 4; diff --git a/src/main/java/emu/grasscutter/command/CommandHandler.java b/src/main/java/emu/grasscutter/command/CommandHandler.java index 037e1ed9d..9fc7d20c1 100644 --- a/src/main/java/emu/grasscutter/command/CommandHandler.java +++ b/src/main/java/emu/grasscutter/command/CommandHandler.java @@ -1,7 +1,7 @@ package emu.grasscutter.command; import emu.grasscutter.Grasscutter; -import emu.grasscutter.game.GenshinPlayer; +import emu.grasscutter.game.player.Player; import java.util.List; @@ -12,7 +12,7 @@ public interface CommandHandler { * @param player The player to send the message to, or null for the server console. * @param message The message to send. */ - static void sendMessage(GenshinPlayer player, String message) { + static void sendMessage(Player player, String message) { if (player == null) { Grasscutter.getLogger().info(message); } else { @@ -25,6 +25,6 @@ public interface CommandHandler { * @param sender The player/console that invoked the command. * @param args The arguments to the command. */ - default void execute(GenshinPlayer sender, List args) { + default void execute(Player sender, List args) { } } diff --git a/src/main/java/emu/grasscutter/command/CommandMap.java b/src/main/java/emu/grasscutter/command/CommandMap.java index 19ab687ad..c46164adc 100644 --- a/src/main/java/emu/grasscutter/command/CommandMap.java +++ b/src/main/java/emu/grasscutter/command/CommandMap.java @@ -2,7 +2,8 @@ package emu.grasscutter.command; import emu.grasscutter.Grasscutter; import emu.grasscutter.game.Account; -import emu.grasscutter.game.GenshinPlayer; +import emu.grasscutter.game.player.Player; + import org.reflections.Reflections; import java.util.*; @@ -103,7 +104,7 @@ public final class CommandMap { * @param player The player invoking the command or null for the server console. * @param rawMessage The messaged used to invoke the command. */ - public void invoke(GenshinPlayer player, String rawMessage) { + public void invoke(Player player, String rawMessage) { rawMessage = rawMessage.trim(); if (rawMessage.length() == 0) { CommandHandler.sendMessage(player, "No command specified."); diff --git a/src/main/java/emu/grasscutter/command/commands/AccountCommand.java b/src/main/java/emu/grasscutter/command/commands/AccountCommand.java index 26570e0e8..68da1569a 100644 --- a/src/main/java/emu/grasscutter/command/commands/AccountCommand.java +++ b/src/main/java/emu/grasscutter/command/commands/AccountCommand.java @@ -3,7 +3,7 @@ package emu.grasscutter.command.commands; import emu.grasscutter.command.Command; import emu.grasscutter.command.CommandHandler; import emu.grasscutter.database.DatabaseHelper; -import emu.grasscutter.game.GenshinPlayer; +import emu.grasscutter.game.player.Player; import java.util.List; @@ -12,7 +12,7 @@ import java.util.List; public final class AccountCommand implements CommandHandler { @Override - public void execute(GenshinPlayer sender, List args) { + public void execute(Player sender, List args) { if (sender != null) { CommandHandler.sendMessage(sender, "This command can only be run from the console."); return; diff --git a/src/main/java/emu/grasscutter/command/commands/BroadcastCommand.java b/src/main/java/emu/grasscutter/command/commands/BroadcastCommand.java index 4922f16f8..9ef0b49a5 100644 --- a/src/main/java/emu/grasscutter/command/commands/BroadcastCommand.java +++ b/src/main/java/emu/grasscutter/command/commands/BroadcastCommand.java @@ -3,7 +3,7 @@ package emu.grasscutter.command.commands; import emu.grasscutter.Grasscutter; import emu.grasscutter.command.Command; import emu.grasscutter.command.CommandHandler; -import emu.grasscutter.game.GenshinPlayer; +import emu.grasscutter.game.player.Player; import java.util.List; @@ -12,7 +12,7 @@ import java.util.List; public final class BroadcastCommand implements CommandHandler { @Override - public void execute(GenshinPlayer sender, List args) { + public void execute(Player sender, List args) { if (args.size() < 1) { CommandHandler.sendMessage(sender, "Usage: broadcast "); return; @@ -20,7 +20,7 @@ public final class BroadcastCommand implements CommandHandler { String message = String.join(" ", args.subList(0, args.size())); - for (GenshinPlayer p : Grasscutter.getGameServer().getPlayers().values()) { + for (Player p : Grasscutter.getGameServer().getPlayers().values()) { CommandHandler.sendMessage(p, message); } diff --git a/src/main/java/emu/grasscutter/command/commands/ChangeSceneCommand.java b/src/main/java/emu/grasscutter/command/commands/ChangeSceneCommand.java index eb2e998f2..30ef090d5 100644 --- a/src/main/java/emu/grasscutter/command/commands/ChangeSceneCommand.java +++ b/src/main/java/emu/grasscutter/command/commands/ChangeSceneCommand.java @@ -2,7 +2,7 @@ package emu.grasscutter.command.commands; import emu.grasscutter.command.Command; import emu.grasscutter.command.CommandHandler; -import emu.grasscutter.game.GenshinPlayer; +import emu.grasscutter.game.player.Player; import java.util.List; @@ -10,7 +10,7 @@ import java.util.List; description = "Changes your scene", aliases = {"scene"}, permission = "player.changescene") public final class ChangeSceneCommand implements CommandHandler { @Override - public void execute(GenshinPlayer sender, List args) { + public void execute(Player sender, List args) { if (sender == null) { CommandHandler.sendMessage(null, "Run this command in-game."); return; diff --git a/src/main/java/emu/grasscutter/command/commands/ClearCommand.java b/src/main/java/emu/grasscutter/command/commands/ClearCommand.java index fc6295253..8aa7d7333 100644 --- a/src/main/java/emu/grasscutter/command/commands/ClearCommand.java +++ b/src/main/java/emu/grasscutter/command/commands/ClearCommand.java @@ -3,9 +3,9 @@ package emu.grasscutter.command.commands; import emu.grasscutter.Grasscutter; import emu.grasscutter.command.Command; import emu.grasscutter.command.CommandHandler; -import emu.grasscutter.game.GenshinPlayer; import emu.grasscutter.game.inventory.Inventory; import emu.grasscutter.game.inventory.ItemType; +import emu.grasscutter.game.player.Player; import java.util.List; @@ -16,7 +16,7 @@ import java.util.List; public final class ClearCommand implements CommandHandler { @Override - public void execute(GenshinPlayer sender, List args) { + public void execute(Player sender, List args) { int target; if (sender == null) { CommandHandler.sendMessage(null, "Run this command in-game."); @@ -27,7 +27,7 @@ public final class ClearCommand implements CommandHandler { Inventory playerInventory = sender.getInventory(); try { target = Integer.parseInt(args.get(0)); - GenshinPlayer targetPlayer = Grasscutter.getGameServer().getPlayerByUid(target); + Player targetPlayer = Grasscutter.getGameServer().getPlayerByUid(target); if (targetPlayer == null) { target = sender.getUid(); } else { @@ -92,7 +92,7 @@ public final class ClearCommand implements CommandHandler { return; } - GenshinPlayer targetPlayer = Grasscutter.getGameServer().getPlayerByUid(target); + Player targetPlayer = Grasscutter.getGameServer().getPlayerByUid(target); if (targetPlayer == null) { CommandHandler.sendMessage(sender, "Player not found."); return; diff --git a/src/main/java/emu/grasscutter/command/commands/DropCommand.java b/src/main/java/emu/grasscutter/command/commands/DropCommand.java index e2d7644a0..38a5fba4a 100644 --- a/src/main/java/emu/grasscutter/command/commands/DropCommand.java +++ b/src/main/java/emu/grasscutter/command/commands/DropCommand.java @@ -2,10 +2,10 @@ package emu.grasscutter.command.commands; import emu.grasscutter.command.Command; import emu.grasscutter.command.CommandHandler; -import emu.grasscutter.data.GenshinData; +import emu.grasscutter.data.GameData; import emu.grasscutter.data.def.ItemData; -import emu.grasscutter.game.GenshinPlayer; import emu.grasscutter.game.entity.EntityItem; +import emu.grasscutter.game.player.Player; import emu.grasscutter.utils.Position; import java.util.List; @@ -15,7 +15,7 @@ import java.util.List; public final class DropCommand implements CommandHandler { @Override - public void execute(GenshinPlayer sender, List args) { + public void execute(Player sender, List args) { if (sender == null) { CommandHandler.sendMessage(null, "Run this command in-game."); return; @@ -31,7 +31,7 @@ public final class DropCommand implements CommandHandler { int amount = 1; if (args.size() > 1) amount = Integer.parseInt(args.get(1)); - ItemData itemData = GenshinData.getItemDataMap().get(item); + ItemData itemData = GameData.getItemDataMap().get(item); if (itemData == null) { CommandHandler.sendMessage(sender, "Invalid item id."); return; diff --git a/src/main/java/emu/grasscutter/command/commands/GiveAllCommand.java b/src/main/java/emu/grasscutter/command/commands/GiveAllCommand.java index def5c9fe0..648828643 100644 --- a/src/main/java/emu/grasscutter/command/commands/GiveAllCommand.java +++ b/src/main/java/emu/grasscutter/command/commands/GiveAllCommand.java @@ -3,13 +3,13 @@ package emu.grasscutter.command.commands; import emu.grasscutter.Grasscutter; import emu.grasscutter.command.Command; import emu.grasscutter.command.CommandHandler; -import emu.grasscutter.data.GenshinData; +import emu.grasscutter.data.GameData; import emu.grasscutter.data.def.AvatarData; import emu.grasscutter.data.def.ItemData; -import emu.grasscutter.game.GenshinPlayer; -import emu.grasscutter.game.avatar.GenshinAvatar; -import emu.grasscutter.game.inventory.GenshinItem; +import emu.grasscutter.game.avatar.Avatar; +import emu.grasscutter.game.inventory.GameItem; import emu.grasscutter.game.inventory.ItemType; +import emu.grasscutter.game.player.Player; import java.util.*; @@ -18,7 +18,7 @@ import java.util.*; public class GiveAllCommand implements CommandHandler { @Override - public void execute(GenshinPlayer sender, List args) { + public void execute(Player sender, List args) { int target, amount = 99999; switch (args.size()) { @@ -63,7 +63,7 @@ public class GiveAllCommand implements CommandHandler { return; } - GenshinPlayer targetPlayer = Grasscutter.getGameServer().getPlayerByUid(target); + Player targetPlayer = Grasscutter.getGameServer().getPlayerByUid(target); if (targetPlayer == null) { CommandHandler.sendMessage(sender, "Player not found."); return; @@ -73,14 +73,14 @@ public class GiveAllCommand implements CommandHandler { CommandHandler.sendMessage(sender, "Giving all items done"); } - public void giveAllItems(GenshinPlayer player, int amount) { + public void giveAllItems(Player player, int amount) { CommandHandler.sendMessage(player, "Giving all items..."); - for (AvatarData avatarData: GenshinData.getAvatarDataMap().values()) { + for (AvatarData avatarData: GameData.getAvatarDataMap().values()) { //Exclude test avatar if (isTestAvatar(avatarData.getId())) continue; - GenshinAvatar avatar = new GenshinAvatar(avatarData); + Avatar avatar = new Avatar(avatarData); avatar.setLevel(90); avatar.setPromoteLevel(6); for (int i = 1; i <= 6; ++i) { @@ -92,41 +92,41 @@ public class GiveAllCommand implements CommandHandler { } //some test items - List genshinItemList = new ArrayList<>(); - for (ItemData itemdata: GenshinData.getItemDataMap().values()) { + List itemList = new ArrayList<>(); + for (ItemData itemdata: GameData.getItemDataMap().values()) { //Exclude test item if (isTestItem(itemdata.getId())) continue; if (itemdata.isEquip()) { for (int i = 0; i < 10; ++i) { - GenshinItem genshinItem = new GenshinItem(itemdata); + GameItem item = new GameItem(itemdata); if (itemdata.getItemType() == ItemType.ITEM_WEAPON) { - genshinItem.setLevel(90); - genshinItem.setPromoteLevel(6); - genshinItem.setRefinement(4); + item.setLevel(90); + item.setPromoteLevel(6); + item.setRefinement(4); } - genshinItemList.add(genshinItem); + itemList.add(item); } } else { - GenshinItem genshinItem = new GenshinItem(itemdata); - genshinItem.setCount(amount); - genshinItemList.add(genshinItem); + GameItem item = new GameItem(itemdata); + item.setCount(amount); + itemList.add(item); } } int packetNum = 20; - int itemLength = genshinItemList.size(); + int itemLength = itemList.size(); int number = itemLength / packetNum; int remainder = itemLength % packetNum; int offset = 0; for (int i = 0; i < packetNum; ++i) { if (remainder > 0) { - player.getInventory().addItems(genshinItemList.subList(i * number + offset, (i + 1) * number + offset + 1)); + player.getInventory().addItems(itemList.subList(i * number + offset, (i + 1) * number + offset + 1)); --remainder; ++offset; } else { - player.getInventory().addItems(genshinItemList.subList(i * number + offset, (i + 1) * number + offset)); + player.getInventory().addItems(itemList.subList(i * number + offset, (i + 1) * number + offset)); } } } diff --git a/src/main/java/emu/grasscutter/command/commands/GiveCharCommand.java b/src/main/java/emu/grasscutter/command/commands/GiveCharCommand.java index bfe0f51c0..a15a9b95c 100644 --- a/src/main/java/emu/grasscutter/command/commands/GiveCharCommand.java +++ b/src/main/java/emu/grasscutter/command/commands/GiveCharCommand.java @@ -3,10 +3,10 @@ package emu.grasscutter.command.commands; import emu.grasscutter.Grasscutter; import emu.grasscutter.command.Command; import emu.grasscutter.command.CommandHandler; -import emu.grasscutter.data.GenshinData; +import emu.grasscutter.data.GameData; import emu.grasscutter.data.def.AvatarData; -import emu.grasscutter.game.GenshinPlayer; -import emu.grasscutter.game.avatar.GenshinAvatar; +import emu.grasscutter.game.avatar.Avatar; +import emu.grasscutter.game.player.Player; import java.util.List; @@ -15,7 +15,7 @@ import java.util.List; public final class GiveCharCommand implements CommandHandler { @Override - public void execute(GenshinPlayer sender, List args) { + public void execute(Player sender, List args) { int target, avatarId, level = 1, ascension; if (sender == null && args.size() < 2) { @@ -61,13 +61,13 @@ public final class GiveCharCommand implements CommandHandler { break; } - GenshinPlayer targetPlayer = Grasscutter.getGameServer().getPlayerByUid(target); + Player targetPlayer = Grasscutter.getGameServer().getPlayerByUid(target); if (targetPlayer == null) { CommandHandler.sendMessage(sender, "Player not found."); return; } - AvatarData avatarData = GenshinData.getAvatarDataMap().get(avatarId); + AvatarData avatarData = GameData.getAvatarDataMap().get(avatarId); if (avatarData == null) { CommandHandler.sendMessage(sender, "Invalid avatar id."); return; @@ -80,7 +80,7 @@ public final class GiveCharCommand implements CommandHandler { ascension = (int) Math.ceil(level / 10f) - 3; } - GenshinAvatar avatar = new GenshinAvatar(avatarId); + Avatar avatar = new Avatar(avatarId); avatar.setLevel(level); avatar.setPromoteLevel(ascension); diff --git a/src/main/java/emu/grasscutter/command/commands/GiveCommand.java b/src/main/java/emu/grasscutter/command/commands/GiveCommand.java index 2ecdac1f5..4c9052a3e 100644 --- a/src/main/java/emu/grasscutter/command/commands/GiveCommand.java +++ b/src/main/java/emu/grasscutter/command/commands/GiveCommand.java @@ -3,10 +3,10 @@ package emu.grasscutter.command.commands; import emu.grasscutter.Grasscutter; import emu.grasscutter.command.Command; import emu.grasscutter.command.CommandHandler; -import emu.grasscutter.data.GenshinData; +import emu.grasscutter.data.GameData; import emu.grasscutter.data.def.ItemData; -import emu.grasscutter.game.GenshinPlayer; -import emu.grasscutter.game.inventory.GenshinItem; +import emu.grasscutter.game.inventory.GameItem; +import emu.grasscutter.game.player.Player; import emu.grasscutter.game.props.ActionReason; import emu.grasscutter.server.packet.send.PacketItemAddHintNotify; @@ -18,7 +18,7 @@ import java.util.List; public final class GiveCommand implements CommandHandler { @Override - public void execute(GenshinPlayer sender, List args) { + public void execute(Player sender, List args) { int target, item, lvl, amount = 1; if (sender == null && args.size() < 2) { CommandHandler.sendMessage(null, "Usage: give [amount] [level]"); @@ -99,14 +99,14 @@ public final class GiveCommand implements CommandHandler { break; } - GenshinPlayer targetPlayer = Grasscutter.getGameServer().getPlayerByUid(target); + Player targetPlayer = Grasscutter.getGameServer().getPlayerByUid(target); if (targetPlayer == null) { CommandHandler.sendMessage(sender, "Player not found."); return; } - ItemData itemData = GenshinData.getItemDataMap().get(item); + ItemData itemData = GameData.getItemDataMap().get(item); if (itemData == null) { CommandHandler.sendMessage(sender, "Invalid item id."); return; @@ -121,11 +121,11 @@ public final class GiveCommand implements CommandHandler { String.format("Given %s with level %s %s times to %s", item, lvl, amount, target)); } - private void item(GenshinPlayer player, ItemData itemData, int amount, int lvl) { + private void item(Player player, ItemData itemData, int amount, int lvl) { if (itemData.isEquip()) { - List items = new LinkedList<>(); + List items = new LinkedList<>(); for (int i = 0; i < amount; i++) { - GenshinItem item = new GenshinItem(itemData); + GameItem item = new GameItem(itemData); item.setCount(amount); item.setLevel(lvl); item.setPromoteLevel(0); @@ -144,13 +144,11 @@ public final class GiveCommand implements CommandHandler { } items.add(item); } - player.getInventory().addItems(items); - player.sendPacket(new PacketItemAddHintNotify(items, ActionReason.SubfieldDrop)); + player.getInventory().addItems(items, ActionReason.SubfieldDrop); } else { - GenshinItem genshinItem = new GenshinItem(itemData); - genshinItem.setCount(amount); - player.getInventory().addItem(genshinItem); - player.sendPacket(new PacketItemAddHintNotify(genshinItem, ActionReason.SubfieldDrop)); + GameItem item = new GameItem(itemData); + item.setCount(amount); + player.getInventory().addItem(item, ActionReason.SubfieldDrop); } } } diff --git a/src/main/java/emu/grasscutter/command/commands/GodModeCommand.java b/src/main/java/emu/grasscutter/command/commands/GodModeCommand.java index 0b4139ac1..9229b5845 100644 --- a/src/main/java/emu/grasscutter/command/commands/GodModeCommand.java +++ b/src/main/java/emu/grasscutter/command/commands/GodModeCommand.java @@ -3,7 +3,7 @@ package emu.grasscutter.command.commands; import emu.grasscutter.Grasscutter; import emu.grasscutter.command.Command; import emu.grasscutter.command.CommandHandler; -import emu.grasscutter.game.GenshinPlayer; +import emu.grasscutter.game.player.Player; import java.util.List; @@ -12,7 +12,7 @@ import java.util.List; public final class GodModeCommand implements CommandHandler { @Override - public void execute(GenshinPlayer sender, List args) { + public void execute(Player sender, List args) { if (sender == null) { CommandHandler.sendMessage(null, "Run this command in-game."); return; // TODO: toggle player's godmode statue from console or other players @@ -32,7 +32,7 @@ public final class GodModeCommand implements CommandHandler { } else { target = sender.getUid(); } - GenshinPlayer targetPlayer = Grasscutter.getGameServer().getPlayerByUid(target); + Player targetPlayer = Grasscutter.getGameServer().getPlayerByUid(target); if (targetPlayer == null) { CommandHandler.sendMessage(sender, "Player not found."); return; diff --git a/src/main/java/emu/grasscutter/command/commands/HealCommand.java b/src/main/java/emu/grasscutter/command/commands/HealCommand.java index 27511e527..6c58fa5c3 100644 --- a/src/main/java/emu/grasscutter/command/commands/HealCommand.java +++ b/src/main/java/emu/grasscutter/command/commands/HealCommand.java @@ -2,7 +2,7 @@ package emu.grasscutter.command.commands; import emu.grasscutter.command.Command; import emu.grasscutter.command.CommandHandler; -import emu.grasscutter.game.GenshinPlayer; +import emu.grasscutter.game.player.Player; import emu.grasscutter.game.props.FightProperty; import emu.grasscutter.server.packet.send.PacketAvatarFightPropUpdateNotify; import emu.grasscutter.server.packet.send.PacketAvatarLifeStateChangeNotify; @@ -13,7 +13,7 @@ import java.util.List; description = "Heal all characters in your current team.", permission = "player.heal") public final class HealCommand implements CommandHandler { @Override - public void execute(GenshinPlayer sender, List args) { + public void execute(Player sender, List args) { if (sender == null) { CommandHandler.sendMessage(null, "Run this command in-game."); return; diff --git a/src/main/java/emu/grasscutter/command/commands/HelpCommand.java b/src/main/java/emu/grasscutter/command/commands/HelpCommand.java index abe78e7d3..d8c5b610e 100644 --- a/src/main/java/emu/grasscutter/command/commands/HelpCommand.java +++ b/src/main/java/emu/grasscutter/command/commands/HelpCommand.java @@ -3,7 +3,7 @@ package emu.grasscutter.command.commands; import emu.grasscutter.command.Command; import emu.grasscutter.command.CommandHandler; import emu.grasscutter.command.CommandMap; -import emu.grasscutter.game.GenshinPlayer; +import emu.grasscutter.game.player.Player; import java.util.*; @@ -12,7 +12,7 @@ import java.util.*; public final class HelpCommand implements CommandHandler { @Override - public void execute(GenshinPlayer player, List args) { + public void execute(Player player, List args) { if (args.size() < 1) { HashMap handlers = CommandMap.getInstance().getHandlers(); List annotations = new ArrayList<>(); @@ -53,7 +53,7 @@ public final class HelpCommand implements CommandHandler { } } - void SendAllHelpMessage(GenshinPlayer player, List annotations) { + void SendAllHelpMessage(Player player, List annotations) { if (player == null) { StringBuilder builder = new StringBuilder("\nAvailable commands:\n"); annotations.forEach(annotation -> { diff --git a/src/main/java/emu/grasscutter/command/commands/KickCommand.java b/src/main/java/emu/grasscutter/command/commands/KickCommand.java index 61e9d759b..60fb02b5f 100644 --- a/src/main/java/emu/grasscutter/command/commands/KickCommand.java +++ b/src/main/java/emu/grasscutter/command/commands/KickCommand.java @@ -3,7 +3,7 @@ package emu.grasscutter.command.commands; import emu.grasscutter.Grasscutter; import emu.grasscutter.command.Command; import emu.grasscutter.command.CommandHandler; -import emu.grasscutter.game.GenshinPlayer; +import emu.grasscutter.game.player.Player; import java.util.List; @@ -12,10 +12,10 @@ import java.util.List; public final class KickCommand implements CommandHandler { @Override - public void execute(GenshinPlayer sender, List args) { + public void execute(Player sender, List args) { int target = Integer.parseInt(args.get(0)); - GenshinPlayer targetPlayer = Grasscutter.getGameServer().getPlayerByUid(target); + Player targetPlayer = Grasscutter.getGameServer().getPlayerByUid(target); if (targetPlayer == null) { CommandHandler.sendMessage(sender, "Player not found."); return; diff --git a/src/main/java/emu/grasscutter/command/commands/KillAllCommand.java b/src/main/java/emu/grasscutter/command/commands/KillAllCommand.java index 436691b57..3e2466686 100644 --- a/src/main/java/emu/grasscutter/command/commands/KillAllCommand.java +++ b/src/main/java/emu/grasscutter/command/commands/KillAllCommand.java @@ -3,9 +3,9 @@ package emu.grasscutter.command.commands; import emu.grasscutter.Grasscutter; import emu.grasscutter.command.Command; import emu.grasscutter.command.CommandHandler; -import emu.grasscutter.game.GenshinPlayer; -import emu.grasscutter.game.GenshinScene; import emu.grasscutter.game.entity.EntityMonster; +import emu.grasscutter.game.player.Player; +import emu.grasscutter.game.world.Scene; import java.util.List; @@ -14,9 +14,9 @@ import java.util.List; public final class KillAllCommand implements CommandHandler { @Override - public void execute(GenshinPlayer sender, List args) { - GenshinScene scene; - GenshinPlayer genshinPlayer; + public void execute(Player sender, List args) { + Scene mainScene; + Player targetPlayer; try { switch (args.size()) { @@ -25,38 +25,38 @@ public final class KillAllCommand implements CommandHandler { CommandHandler.sendMessage(null, "Usage: killall [playerUid] [sceneId]"); return; } - scene = sender.getScene(); + mainScene = sender.getScene(); break; case 1: // [playerUid] - genshinPlayer = Grasscutter.getGameServer().getPlayerByUid(Integer.parseInt(args.get(0))); - if (genshinPlayer == null) { + targetPlayer = Grasscutter.getGameServer().getPlayerByUid(Integer.parseInt(args.get(0))); + if (targetPlayer == null) { CommandHandler.sendMessage(sender, "Player not found or offline."); return; } - scene = genshinPlayer.getScene(); + mainScene = targetPlayer.getScene(); break; case 2: // [playerUid] [sceneId] - genshinPlayer = Grasscutter.getGameServer().getPlayerByUid(Integer.parseInt(args.get(0))); - if (genshinPlayer == null) { + targetPlayer = Grasscutter.getGameServer().getPlayerByUid(Integer.parseInt(args.get(0))); + if (targetPlayer == null) { CommandHandler.sendMessage(sender, "Player not found or offline."); return; } - GenshinScene genshinScene = sender.getWorld().getSceneById(Integer.parseInt(args.get(1))); - if (genshinScene == null) { + Scene scene = sender.getWorld().getSceneById(Integer.parseInt(args.get(1))); + if (scene == null) { CommandHandler.sendMessage(sender, "Scene not found in player world"); return; } - scene = genshinScene; + mainScene = scene; break; default: CommandHandler.sendMessage(sender, "Usage: killall [playerUid] [sceneId]"); return; } - scene.getEntities().values().stream() + mainScene.getEntities().values().stream() .filter(entity -> entity instanceof EntityMonster) - .forEach(entity -> scene.killEntity(entity, 0)); - CommandHandler.sendMessage(sender, "Killing all monsters in scene " + scene.getId()); + .forEach(entity -> mainScene.killEntity(entity, 0)); + CommandHandler.sendMessage(sender, "Killing all monsters in scene " + mainScene.getId()); } catch (NumberFormatException ignored) { CommandHandler.sendMessage(sender, "Invalid arguments."); } diff --git a/src/main/java/emu/grasscutter/command/commands/KillCharacterCommand.java b/src/main/java/emu/grasscutter/command/commands/KillCharacterCommand.java index beaa4f959..2d95683bb 100644 --- a/src/main/java/emu/grasscutter/command/commands/KillCharacterCommand.java +++ b/src/main/java/emu/grasscutter/command/commands/KillCharacterCommand.java @@ -3,8 +3,8 @@ package emu.grasscutter.command.commands; import emu.grasscutter.Grasscutter; import emu.grasscutter.command.Command; import emu.grasscutter.command.CommandHandler; -import emu.grasscutter.game.GenshinPlayer; import emu.grasscutter.game.entity.EntityAvatar; +import emu.grasscutter.game.player.Player; import emu.grasscutter.game.props.FightProperty; import emu.grasscutter.game.props.LifeState; import emu.grasscutter.server.packet.send.PacketEntityFightPropUpdateNotify; @@ -17,7 +17,7 @@ import java.util.List; public final class KillCharacterCommand implements CommandHandler { @Override - public void execute(GenshinPlayer sender, List args) { + public void execute(Player sender, List args) { int target; if (sender == null) { // from console @@ -48,7 +48,7 @@ public final class KillCharacterCommand implements CommandHandler { } } - GenshinPlayer targetPlayer = Grasscutter.getGameServer().getPlayerByUid(target); + Player targetPlayer = Grasscutter.getGameServer().getPlayerByUid(target); if (targetPlayer == null) { CommandHandler.sendMessage(sender, "Player not found or offline."); return; diff --git a/src/main/java/emu/grasscutter/command/commands/ListCommand.java b/src/main/java/emu/grasscutter/command/commands/ListCommand.java index 1fb7f0eed..99abd7ac7 100644 --- a/src/main/java/emu/grasscutter/command/commands/ListCommand.java +++ b/src/main/java/emu/grasscutter/command/commands/ListCommand.java @@ -3,7 +3,7 @@ package emu.grasscutter.command.commands; import emu.grasscutter.Grasscutter; import emu.grasscutter.command.Command; import emu.grasscutter.command.CommandHandler; -import emu.grasscutter.game.GenshinPlayer; +import emu.grasscutter.game.player.Player; import java.util.List; import java.util.Map; @@ -12,8 +12,8 @@ import java.util.Map; public final class ListCommand implements CommandHandler { @Override - public void execute(GenshinPlayer sender, List args) { - Map playersMap = Grasscutter.getGameServer().getPlayers(); + public void execute(Player sender, List args) { + Map playersMap = Grasscutter.getGameServer().getPlayers(); CommandHandler.sendMessage(sender, String.format("There are %s player(s) online:", playersMap.size())); diff --git a/src/main/java/emu/grasscutter/command/commands/PermissionCommand.java b/src/main/java/emu/grasscutter/command/commands/PermissionCommand.java index 7218bf2cd..d048041de 100644 --- a/src/main/java/emu/grasscutter/command/commands/PermissionCommand.java +++ b/src/main/java/emu/grasscutter/command/commands/PermissionCommand.java @@ -4,7 +4,7 @@ import emu.grasscutter.Grasscutter; import emu.grasscutter.command.Command; import emu.grasscutter.command.CommandHandler; import emu.grasscutter.game.Account; -import emu.grasscutter.game.GenshinPlayer; +import emu.grasscutter.game.player.Player; import java.util.List; @@ -13,7 +13,7 @@ import java.util.List; public final class PermissionCommand implements CommandHandler { @Override - public void execute(GenshinPlayer sender, List args) { + public void execute(Player sender, List args) { if (args.size() < 3) { CommandHandler.sendMessage(sender, "Usage: permission "); return; diff --git a/src/main/java/emu/grasscutter/command/commands/PositionCommand.java b/src/main/java/emu/grasscutter/command/commands/PositionCommand.java index 8bdf3c754..434250171 100644 --- a/src/main/java/emu/grasscutter/command/commands/PositionCommand.java +++ b/src/main/java/emu/grasscutter/command/commands/PositionCommand.java @@ -2,7 +2,7 @@ package emu.grasscutter.command.commands; import emu.grasscutter.command.Command; import emu.grasscutter.command.CommandHandler; -import emu.grasscutter.game.GenshinPlayer; +import emu.grasscutter.game.player.Player; import java.util.List; @@ -11,7 +11,7 @@ import java.util.List; public final class PositionCommand implements CommandHandler { @Override - public void execute(GenshinPlayer sender, List args) { + public void execute(Player sender, List args) { if (sender == null) { CommandHandler.sendMessage(null, "Run this command in-game."); return; diff --git a/src/main/java/emu/grasscutter/command/commands/ReloadCommand.java b/src/main/java/emu/grasscutter/command/commands/ReloadCommand.java index b145aaf94..26dbb903b 100644 --- a/src/main/java/emu/grasscutter/command/commands/ReloadCommand.java +++ b/src/main/java/emu/grasscutter/command/commands/ReloadCommand.java @@ -3,7 +3,7 @@ package emu.grasscutter.command.commands; import emu.grasscutter.Grasscutter; import emu.grasscutter.command.Command; import emu.grasscutter.command.CommandHandler; -import emu.grasscutter.game.GenshinPlayer; +import emu.grasscutter.game.player.Player; import java.util.List; @@ -12,7 +12,7 @@ import java.util.List; public final class ReloadCommand implements CommandHandler { @Override - public void execute(GenshinPlayer sender, List args) { + public void execute(Player sender, List args) { CommandHandler.sendMessage(sender, "Reloading config."); Grasscutter.loadConfig(); Grasscutter.getGameServer().getGachaManager().load(); diff --git a/src/main/java/emu/grasscutter/command/commands/ResetConstCommand.java b/src/main/java/emu/grasscutter/command/commands/ResetConstCommand.java index 77f16f9b8..657d76718 100644 --- a/src/main/java/emu/grasscutter/command/commands/ResetConstCommand.java +++ b/src/main/java/emu/grasscutter/command/commands/ResetConstCommand.java @@ -2,9 +2,9 @@ package emu.grasscutter.command.commands; import emu.grasscutter.command.Command; import emu.grasscutter.command.CommandHandler; -import emu.grasscutter.game.GenshinPlayer; -import emu.grasscutter.game.avatar.GenshinAvatar; +import emu.grasscutter.game.avatar.Avatar; import emu.grasscutter.game.entity.EntityAvatar; +import emu.grasscutter.game.player.Player; import java.util.List; @@ -14,7 +14,7 @@ import java.util.List; public final class ResetConstCommand implements CommandHandler { @Override - public void execute(GenshinPlayer sender, List args) { + public void execute(Player sender, List args) { if (sender == null) { CommandHandler.sendMessage(null, "Run this command in-game."); return; @@ -29,14 +29,14 @@ public final class ResetConstCommand implements CommandHandler { return; } - GenshinAvatar avatar = entity.getAvatar(); + Avatar avatar = entity.getAvatar(); this.resetConstellation(avatar); sender.dropMessage("Constellations for " + avatar.getAvatarData().getName() + " have been reset. Please relog to see changes."); } } - private void resetConstellation(GenshinAvatar avatar) { + private void resetConstellation(Avatar avatar) { avatar.getTalentIdList().clear(); avatar.setCoreProudSkillLevel(0); avatar.recalcStats(); diff --git a/src/main/java/emu/grasscutter/command/commands/RestartCommand.java b/src/main/java/emu/grasscutter/command/commands/RestartCommand.java index cf40fa9bd..0b73ba861 100644 --- a/src/main/java/emu/grasscutter/command/commands/RestartCommand.java +++ b/src/main/java/emu/grasscutter/command/commands/RestartCommand.java @@ -2,7 +2,7 @@ package emu.grasscutter.command.commands; import emu.grasscutter.command.Command; import emu.grasscutter.command.CommandHandler; -import emu.grasscutter.game.GenshinPlayer; +import emu.grasscutter.game.player.Player; import java.util.List; @@ -10,7 +10,7 @@ import java.util.List; public final class RestartCommand implements CommandHandler { @Override - public void execute(GenshinPlayer sender, List args) { + public void execute(Player sender, List args) { sender.getSession().close(); } } diff --git a/src/main/java/emu/grasscutter/command/commands/SendMailCommand.java b/src/main/java/emu/grasscutter/command/commands/SendMailCommand.java new file mode 100644 index 000000000..35cedab9a --- /dev/null +++ b/src/main/java/emu/grasscutter/command/commands/SendMailCommand.java @@ -0,0 +1,210 @@ +package emu.grasscutter.command.commands; + +import emu.grasscutter.Grasscutter; +import emu.grasscutter.command.Command; +import emu.grasscutter.command.CommandHandler; +import emu.grasscutter.database.DatabaseHelper; +import emu.grasscutter.game.mail.Mail; +import emu.grasscutter.game.player.Player; +import emu.grasscutter.server.packet.send.PacketMailChangeNotify; + +import java.time.Instant; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Locale; + +@Command(label = "sendmail", usage = "sendmail [templateId]", + description = "Sends mail to the specified user. The usage of this command changes based on it's composition state.", permission = "server.sendmail") +public class SendMailCommand implements CommandHandler { + + // TODO: You should be able to do /sendmail and then just send subsequent messages until you finish + // However, due to the current nature of the command system, I don't think this is possible without rewriting + // the command system (again). For now this will do + + // Key = User that is constructing the mail. + private static HashMap mailBeingConstructed = new HashMap(); + + // Yes this is awful and I hate it. + @Override + public void execute(Player sender, List args) { + int senderId; + if(sender != null) { + senderId = sender.getUid(); + } else { + senderId = -1; + } + + if (!mailBeingConstructed.containsKey(senderId)) { + switch (args.size()) { + case 1 -> { + MailBuilder mailBuilder; + switch (args.get(0).toLowerCase()) { + case "help" -> { + CommandHandler.sendMessage(sender, this.getClass().getAnnotation(Command.class).description() + "\nUsage: " + this.getClass().getAnnotation(Command.class).usage()); + return; + } + case "all" -> mailBuilder = new MailBuilder(true, new Mail()); + default -> { + if (DatabaseHelper.getPlayerById(Integer.parseInt(args.get(0))) != null) { + mailBuilder = new MailBuilder(Integer.parseInt(args.get(0)), new Mail()); + break; + } else { + CommandHandler.sendMessage(sender, "The user with an id of '" + args.get(0) + "' does not exist"); + return; + } + } + } + mailBeingConstructed.put(senderId, mailBuilder); + CommandHandler.sendMessage(sender, "Starting composition of message.\nPlease use `/sendmail ` to continue.\nYou can use `/sendmail stop` at any time"); + } + case 2 -> CommandHandler.sendMessage(sender, "Mail templates coming soon implemented..."); + default -> CommandHandler.sendMessage(sender, "Invalid arguments.\nUsage `/sendmail <userId|all|help> [templateId]`"); + } + } else { + MailBuilder mailBuilder = mailBeingConstructed.get(senderId); + + if (args.size() >= 1) { + switch (args.get(0).toLowerCase()) { + case "stop" -> { + mailBeingConstructed.remove(senderId); + CommandHandler.sendMessage(sender, "Message sending cancelled"); + return; + } + case "finish" -> { + if (mailBuilder.constructionStage == 3) { + if (mailBuilder.sendToAll == false) { + Grasscutter.getGameServer().getPlayerByUid(mailBuilder.recipient, true).sendMail(mailBuilder.mail); + CommandHandler.sendMessage(sender, "Message sent to user " + mailBuilder.recipient + "!"); + } else { + for (Player player : DatabaseHelper.getAllPlayers()) { + Grasscutter.getGameServer().getPlayerByUid(player.getUid(), true).sendMail(mailBuilder.mail); + } + CommandHandler.sendMessage(sender, "Message sent to all users!"); + } + mailBeingConstructed.remove(senderId); + } else { + CommandHandler.sendMessage(sender, "Message composition not at final stage.\nPlease use `/sendmail " + getConstructionArgs(mailBuilder.constructionStage) + "` or `/sendmail stop` to cancel"); + } + return; + } + case "help" -> { + CommandHandler.sendMessage(sender, "Please use `/sendmail " + getConstructionArgs(mailBuilder.constructionStage) + "`"); + return; + } + default -> { + switch (mailBuilder.constructionStage) { + case 0 -> { + String title = String.join(" ", args.subList(0, args.size())); + mailBuilder.mail.mailContent.title = title; + CommandHandler.sendMessage(sender, "Message title set as '" + title + "'.\nUse '/sendmail <content>' to continue."); + mailBuilder.constructionStage++; + } + case 1 -> { + String contents = String.join(" ", args.subList(0, args.size())); + mailBuilder.mail.mailContent.content = contents; + CommandHandler.sendMessage(sender, "Message contents set as '" + contents + "'.\nUse '/sendmail <sender>' to continue."); + mailBuilder.constructionStage++; + } + case 2 -> { + String msgSender = String.join(" ", args.subList(0, args.size())); + mailBuilder.mail.mailContent.sender = msgSender; + CommandHandler.sendMessage(sender, "Message sender set as '" + msgSender + "'.\nUse '/sendmail <itemId|itemName|finish> [amount] [level]' to continue."); + mailBuilder.constructionStage++; + } + case 3 -> { + // Literally just copy-pasted from the give command lol. + int item, lvl, amount = 1; + switch (args.size()) { + default -> { // *No args* + CommandHandler.sendMessage(sender, "Usage: give [player] <itemId|itemName> [amount]"); + return; + } + case 1 -> { // <itemId|itemName> + try { + item = Integer.parseInt(args.get(0)); + lvl = 1; + } catch (NumberFormatException ignored) { + // TODO: Parse from item name using GM Handbook. + CommandHandler.sendMessage(sender, "Invalid item id."); + return; + } + } + case 2 -> { // <itemId|itemName> [amount] + lvl = 1; + item = Integer.parseInt(args.get(0)); + amount = Integer.parseInt(args.get(1)); + } + case 3 -> { // <itemId|itemName> [amount] [level] + try { + item = Integer.parseInt(args.get(0)); + amount = Integer.parseInt(args.get(1)); + lvl = Integer.parseInt(args.get(2)); + + } catch (NumberFormatException ignored) { + // TODO: Parse from item name using GM Handbook. + CommandHandler.sendMessage(sender, "Invalid item or player ID."); + return; + } + } + } + mailBuilder.mail.itemList.add(new Mail.MailItem(item, amount, lvl)); + CommandHandler.sendMessage(sender, String.format("Attached %s of %s (level %s) to the message.\nContinue adding more items or use `/sendmail finish` to send the message.", amount, item, lvl)); + } + } + } + } + } else { + CommandHandler.sendMessage(sender, "Invalid arguments \n Please use `/sendmail " + getConstructionArgs(mailBuilder.constructionStage)); + } + } + } + + private String getConstructionArgs(int stage) { + switch (stage) { + case 0 -> { + return "<title>"; + } + case 1 -> { + return "<message>"; + } + case 2 -> { + return "<sender>"; + + } + case 3 -> { + return "<itemId|itemName|finish> [amount] [level]"; + } + default -> { + Thread.dumpStack(); + return "ERROR: invalid construction stage " + stage + ". Check console for stacktrace."; + } + } + } + + public static class MailBuilder { + public int recipient; + public boolean sendToAll; + public int constructionStage; + public Mail mail; + + public MailBuilder(int recipient, Mail mail) { + this.recipient = recipient; + this.sendToAll = false; + this.constructionStage = 0; + this.mail = mail; + } + + public MailBuilder(boolean sendToAll, Mail mail) { + if (sendToAll) { + this.recipient = 0; + this.sendToAll = true; + this.constructionStage = 0; + this.mail = mail; + } else { + Grasscutter.getLogger().error("Please use MailBuilder(int, mail) when not sending to all"); + Thread.dumpStack(); + } + } + } +} diff --git a/src/main/java/emu/grasscutter/command/commands/SendMessageCommand.java b/src/main/java/emu/grasscutter/command/commands/SendMessageCommand.java index 061009c19..a86e1a218 100644 --- a/src/main/java/emu/grasscutter/command/commands/SendMessageCommand.java +++ b/src/main/java/emu/grasscutter/command/commands/SendMessageCommand.java @@ -3,7 +3,7 @@ package emu.grasscutter.command.commands; import emu.grasscutter.Grasscutter; import emu.grasscutter.command.Command; import emu.grasscutter.command.CommandHandler; -import emu.grasscutter.game.GenshinPlayer; +import emu.grasscutter.game.player.Player; import java.util.List; @@ -12,7 +12,7 @@ import java.util.List; public final class SendMessageCommand implements CommandHandler { @Override - public void execute(GenshinPlayer sender, List<String> args) { + public void execute(Player sender, List<String> args) { if (args.size() < 2) { CommandHandler.sendMessage(null, "Usage: sendmessage <player> <message>"); return; @@ -22,7 +22,7 @@ public final class SendMessageCommand implements CommandHandler { int target = Integer.parseInt(args.get(0)); String message = String.join(" ", args.subList(1, args.size())); - GenshinPlayer targetPlayer = Grasscutter.getGameServer().getPlayerByUid(target); + Player targetPlayer = Grasscutter.getGameServer().getPlayerByUid(target); if (targetPlayer == null) { CommandHandler.sendMessage(sender, "Player not found."); return; diff --git a/src/main/java/emu/grasscutter/command/commands/SetFetterLevelCommand.java b/src/main/java/emu/grasscutter/command/commands/SetFetterLevelCommand.java index 565a480dc..1d7eefc10 100644 --- a/src/main/java/emu/grasscutter/command/commands/SetFetterLevelCommand.java +++ b/src/main/java/emu/grasscutter/command/commands/SetFetterLevelCommand.java @@ -4,9 +4,9 @@ import java.util.List; import emu.grasscutter.command.Command; import emu.grasscutter.command.CommandHandler; -import emu.grasscutter.data.GenshinData; -import emu.grasscutter.game.GenshinPlayer; -import emu.grasscutter.game.avatar.GenshinAvatar; +import emu.grasscutter.data.GameData; +import emu.grasscutter.game.avatar.Avatar; +import emu.grasscutter.game.player.Player; import emu.grasscutter.server.packet.send.PacketAvatarFetterDataNotify; @Command(label = "setfetterlevel", usage = "setfetterlevel <level>", @@ -15,7 +15,7 @@ import emu.grasscutter.server.packet.send.PacketAvatarFetterDataNotify; public final class SetFetterLevelCommand implements CommandHandler { @Override - public void execute(GenshinPlayer sender, List<String> args) { + public void execute(Player sender, List<String> args) { if (sender == null) { CommandHandler.sendMessage(null, "Run this command in-game."); return; @@ -32,11 +32,11 @@ public final class SetFetterLevelCommand implements CommandHandler { CommandHandler.sendMessage(sender, "Fetter level must be between 0 and 10."); return; } - GenshinAvatar avatar = sender.getTeamManager().getCurrentAvatarEntity().getAvatar(); + Avatar avatar = sender.getTeamManager().getCurrentAvatarEntity().getAvatar(); avatar.setFetterLevel(fetterLevel); if (fetterLevel != 10) { - avatar.setFetterExp(GenshinData.getAvatarFetterLevelDataMap().get(fetterLevel).getExp()); + avatar.setFetterExp(GameData.getAvatarFetterLevelDataMap().get(fetterLevel).getExp()); } avatar.save(); diff --git a/src/main/java/emu/grasscutter/command/commands/SetStatsCommand.java b/src/main/java/emu/grasscutter/command/commands/SetStatsCommand.java index d7d27a24a..6e18573bb 100644 --- a/src/main/java/emu/grasscutter/command/commands/SetStatsCommand.java +++ b/src/main/java/emu/grasscutter/command/commands/SetStatsCommand.java @@ -2,8 +2,8 @@ package emu.grasscutter.command.commands; import emu.grasscutter.command.Command; import emu.grasscutter.command.CommandHandler; -import emu.grasscutter.game.GenshinPlayer; import emu.grasscutter.game.entity.EntityAvatar; +import emu.grasscutter.game.player.Player; import emu.grasscutter.game.props.FightProperty; import emu.grasscutter.server.packet.send.PacketEntityFightPropUpdateNotify; @@ -14,7 +14,7 @@ import java.util.List; public final class SetStatsCommand implements CommandHandler { @Override - public void execute(GenshinPlayer sender, List<String> args) { + public void execute(Player sender, List<String> args) { if (sender == null) { CommandHandler.sendMessage(null, "Run this command in-game."); return; diff --git a/src/main/java/emu/grasscutter/command/commands/SetWorldLevelCommand.java b/src/main/java/emu/grasscutter/command/commands/SetWorldLevelCommand.java index 146837523..0ffd015f8 100644 --- a/src/main/java/emu/grasscutter/command/commands/SetWorldLevelCommand.java +++ b/src/main/java/emu/grasscutter/command/commands/SetWorldLevelCommand.java @@ -2,7 +2,7 @@ package emu.grasscutter.command.commands; import emu.grasscutter.command.Command; import emu.grasscutter.command.CommandHandler; -import emu.grasscutter.game.GenshinPlayer; +import emu.grasscutter.game.player.Player; import emu.grasscutter.game.props.PlayerProperty; import java.util.List; @@ -13,7 +13,7 @@ import java.util.List; public final class SetWorldLevelCommand implements CommandHandler { @Override - public void execute(GenshinPlayer sender, List<String> args) { + public void execute(Player sender, List<String> args) { if (sender == null) { CommandHandler.sendMessage(null, "Run this command in-game."); return; // TODO: set player's world level from console or other players @@ -29,7 +29,7 @@ public final class SetWorldLevelCommand implements CommandHandler { // Set in both world and player props sender.getWorld().setWorldLevel(level); - sender.setProperty(PlayerProperty.PROP_PLAYER_WORLD_LEVEL, level); + sender.setWorldLevel(level); sender.dropMessage("World level set to " + level + "."); } catch (NumberFormatException ignored) { diff --git a/src/main/java/emu/grasscutter/command/commands/SpawnCommand.java b/src/main/java/emu/grasscutter/command/commands/SpawnCommand.java index 969872119..efb4b231b 100644 --- a/src/main/java/emu/grasscutter/command/commands/SpawnCommand.java +++ b/src/main/java/emu/grasscutter/command/commands/SpawnCommand.java @@ -2,10 +2,10 @@ package emu.grasscutter.command.commands; import emu.grasscutter.command.Command; import emu.grasscutter.command.CommandHandler; -import emu.grasscutter.data.GenshinData; +import emu.grasscutter.data.GameData; import emu.grasscutter.data.def.MonsterData; -import emu.grasscutter.game.GenshinPlayer; import emu.grasscutter.game.entity.EntityMonster; +import emu.grasscutter.game.player.Player; import emu.grasscutter.utils.Position; import java.util.List; @@ -15,7 +15,7 @@ import java.util.List; public final class SpawnCommand implements CommandHandler { @Override - public void execute(GenshinPlayer sender, List<String> args) { + public void execute(Player sender, List<String> args) { if (sender == null) { CommandHandler.sendMessage(null, "Run this command in-game."); return; @@ -31,7 +31,7 @@ public final class SpawnCommand implements CommandHandler { int level = args.size() > 1 ? Integer.parseInt(args.get(1)) : 1; int amount = args.size() > 2 ? Integer.parseInt(args.get(2)) : 1; - MonsterData entityData = GenshinData.getMonsterDataMap().get(entity); + MonsterData entityData = GameData.getMonsterDataMap().get(entity); if (entityData == null) { CommandHandler.sendMessage(sender, "Invalid entity id."); return; diff --git a/src/main/java/emu/grasscutter/command/commands/StopCommand.java b/src/main/java/emu/grasscutter/command/commands/StopCommand.java index 4b63cd44e..96a81207d 100644 --- a/src/main/java/emu/grasscutter/command/commands/StopCommand.java +++ b/src/main/java/emu/grasscutter/command/commands/StopCommand.java @@ -3,7 +3,7 @@ package emu.grasscutter.command.commands; import emu.grasscutter.Grasscutter; import emu.grasscutter.command.Command; import emu.grasscutter.command.CommandHandler; -import emu.grasscutter.game.GenshinPlayer; +import emu.grasscutter.game.player.Player; import java.util.List; @@ -12,9 +12,9 @@ import java.util.List; public final class StopCommand implements CommandHandler { @Override - public void execute(GenshinPlayer sender, List<String> args) { + public void execute(Player sender, List<String> args) { CommandHandler.sendMessage(null, "Server shutting down..."); - for (GenshinPlayer p : Grasscutter.getGameServer().getPlayers().values()) { + for (Player p : Grasscutter.getGameServer().getPlayers().values()) { CommandHandler.sendMessage(p, "Server shutting down..."); } diff --git a/src/main/java/emu/grasscutter/command/commands/TalentCommand.java b/src/main/java/emu/grasscutter/command/commands/TalentCommand.java index 59fc83226..f0e779700 100644 --- a/src/main/java/emu/grasscutter/command/commands/TalentCommand.java +++ b/src/main/java/emu/grasscutter/command/commands/TalentCommand.java @@ -3,9 +3,9 @@ package emu.grasscutter.command.commands; import emu.grasscutter.command.Command; import emu.grasscutter.command.CommandHandler; import emu.grasscutter.data.def.AvatarSkillDepotData; -import emu.grasscutter.game.GenshinPlayer; -import emu.grasscutter.game.avatar.GenshinAvatar; +import emu.grasscutter.game.avatar.Avatar; import emu.grasscutter.game.entity.EntityAvatar; +import emu.grasscutter.game.player.Player; import emu.grasscutter.server.packet.send.PacketAvatarSkillChangeNotify; import emu.grasscutter.server.packet.send.PacketAvatarSkillUpgradeRsp; @@ -16,7 +16,7 @@ import java.util.List; public final class TalentCommand implements CommandHandler { @Override - public void execute(GenshinPlayer sender, List<String> args) { + public void execute(Player sender, List<String> args) { if (sender == null) { CommandHandler.sendMessage(null, "Run this command in-game."); return; @@ -41,7 +41,7 @@ public final class TalentCommand implements CommandHandler { int skillId = Integer.parseInt(args.get(1)); int nextLevel = Integer.parseInt(args.get(2)); EntityAvatar entity = sender.getTeamManager().getCurrentAvatarEntity(); - GenshinAvatar avatar = entity.getAvatar(); + Avatar avatar = entity.getAvatar(); int skillIdNorAtk = avatar.getData().getSkillDepot().getSkills().get(0); int skillIdE = avatar.getData().getSkillDepot().getSkills().get(1); int skillIdQ = avatar.getData().getSkillDepot().getEnergySkill(); @@ -97,7 +97,7 @@ public final class TalentCommand implements CommandHandler { case "n": case "e": case "q": try { EntityAvatar entity = sender.getTeamManager().getCurrentAvatarEntity(); - GenshinAvatar avatar = entity.getAvatar(); + Avatar avatar = entity.getAvatar(); AvatarSkillDepotData SkillDepot = avatar.getData().getSkillDepot(); int skillId; switch (cmdSwitch) { @@ -135,7 +135,7 @@ public final class TalentCommand implements CommandHandler { break; case "getid": EntityAvatar entity = sender.getTeamManager().getCurrentAvatarEntity(); - GenshinAvatar avatar = entity.getAvatar(); + Avatar avatar = entity.getAvatar(); int skillIdNorAtk = avatar.getData().getSkillDepot().getSkills().get(0); int skillIdE = avatar.getData().getSkillDepot().getSkills().get(1); int skillIdQ = avatar.getData().getSkillDepot().getEnergySkill(); diff --git a/src/main/java/emu/grasscutter/command/commands/TeleportCommand.java b/src/main/java/emu/grasscutter/command/commands/TeleportCommand.java index 6b08fb333..c478118e3 100644 --- a/src/main/java/emu/grasscutter/command/commands/TeleportCommand.java +++ b/src/main/java/emu/grasscutter/command/commands/TeleportCommand.java @@ -2,7 +2,7 @@ package emu.grasscutter.command.commands; import emu.grasscutter.command.Command; import emu.grasscutter.command.CommandHandler; -import emu.grasscutter.game.GenshinPlayer; +import emu.grasscutter.game.player.Player; import emu.grasscutter.utils.Position; import java.util.List; @@ -12,7 +12,7 @@ import java.util.List; public final class TeleportCommand implements CommandHandler { @Override - public void execute(GenshinPlayer sender, List<String> args) { + public void execute(Player sender, List<String> args) { if (sender == null) { CommandHandler.sendMessage(null, "Run this command in-game."); return; diff --git a/src/main/java/emu/grasscutter/command/commands/WeatherCommand.java b/src/main/java/emu/grasscutter/command/commands/WeatherCommand.java index bb9ae4a42..6fd3c453b 100644 --- a/src/main/java/emu/grasscutter/command/commands/WeatherCommand.java +++ b/src/main/java/emu/grasscutter/command/commands/WeatherCommand.java @@ -2,7 +2,7 @@ package emu.grasscutter.command.commands; import emu.grasscutter.command.Command; import emu.grasscutter.command.CommandHandler; -import emu.grasscutter.game.GenshinPlayer; +import emu.grasscutter.game.player.Player; import emu.grasscutter.game.props.ClimateType; import emu.grasscutter.server.packet.send.PacketSceneAreaWeatherNotify; @@ -13,7 +13,7 @@ import java.util.List; public final class WeatherCommand implements CommandHandler { @Override - public void execute(GenshinPlayer sender, List<String> args) { + public void execute(Player sender, List<String> args) { if (sender == null) { CommandHandler.sendMessage(null, "Run this command in-game."); return; diff --git a/src/main/java/emu/grasscutter/data/GenshinData.java b/src/main/java/emu/grasscutter/data/GameData.java similarity index 98% rename from src/main/java/emu/grasscutter/data/GenshinData.java rename to src/main/java/emu/grasscutter/data/GameData.java index 29410b1c7..4c7363054 100644 --- a/src/main/java/emu/grasscutter/data/GenshinData.java +++ b/src/main/java/emu/grasscutter/data/GameData.java @@ -16,7 +16,7 @@ import it.unimi.dsi.fastutil.ints.Int2ObjectLinkedOpenHashMap; import it.unimi.dsi.fastutil.ints.Int2ObjectMap; import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap; -public class GenshinData { +public class GameData { // BinOutputs private static final Int2ObjectMap<String> abilityHashes = new Int2ObjectOpenHashMap<>(); private static final Map<String, AbilityEmbryoEntry> abilityEmbryos = new HashMap<>(); @@ -69,7 +69,7 @@ public class GenshinData { Int2ObjectMap<?> map = null; try { - Field field = GenshinData.class.getDeclaredField(Utils.lowerCaseFirstChar(resourceDefinition.getSimpleName()) + "Map"); + Field field = GameData.class.getDeclaredField(Utils.lowerCaseFirstChar(resourceDefinition.getSimpleName()) + "Map"); field.setAccessible(true); map = (Int2ObjectMap<?>) field.get(null); diff --git a/src/main/java/emu/grasscutter/data/GenshinDepot.java b/src/main/java/emu/grasscutter/data/GameDepot.java similarity index 92% rename from src/main/java/emu/grasscutter/data/GenshinDepot.java rename to src/main/java/emu/grasscutter/data/GameDepot.java index 7281853df..fa5aecba5 100644 --- a/src/main/java/emu/grasscutter/data/GenshinDepot.java +++ b/src/main/java/emu/grasscutter/data/GameDepot.java @@ -15,21 +15,21 @@ import emu.grasscutter.utils.WeightedList; import it.unimi.dsi.fastutil.ints.Int2ObjectMap; import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap; -public class GenshinDepot { +public class GameDepot { private static Int2ObjectMap<WeightedList<ReliquaryMainPropData>> relicMainPropDepot = new Int2ObjectOpenHashMap<>(); private static Int2ObjectMap<List<ReliquaryAffixData>> relicAffixDepot = new Int2ObjectOpenHashMap<>(); private static Int2ObjectMap<SpatialIndex<SpawnGroupEntry>> spawnLists = new Int2ObjectOpenHashMap<>(); public static void load() { - for (ReliquaryMainPropData data : GenshinData.getReliquaryMainPropDataMap().values()) { + for (ReliquaryMainPropData data : GameData.getReliquaryMainPropDataMap().values()) { if (data.getWeight() <= 0 || data.getPropDepotId() <= 0) { continue; } WeightedList<ReliquaryMainPropData> list = relicMainPropDepot.computeIfAbsent(data.getPropDepotId(), k -> new WeightedList<>()); list.add(data.getWeight(), data); } - for (ReliquaryAffixData data : GenshinData.getReliquaryAffixDataMap().values()) { + for (ReliquaryAffixData data : GameData.getReliquaryAffixDataMap().values()) { if (data.getWeight() <= 0 || data.getDepotId() <= 0) { continue; } diff --git a/src/main/java/emu/grasscutter/data/GenshinResource.java b/src/main/java/emu/grasscutter/data/GameResource.java similarity index 72% rename from src/main/java/emu/grasscutter/data/GenshinResource.java rename to src/main/java/emu/grasscutter/data/GameResource.java index 92e06354e..f3d47a516 100644 --- a/src/main/java/emu/grasscutter/data/GenshinResource.java +++ b/src/main/java/emu/grasscutter/data/GameResource.java @@ -1,6 +1,6 @@ package emu.grasscutter.data; -public abstract class GenshinResource { +public abstract class GameResource { public int getId() { return 0; diff --git a/src/main/java/emu/grasscutter/data/ResourceLoader.java b/src/main/java/emu/grasscutter/data/ResourceLoader.java index 57d0ea824..589f6aca8 100644 --- a/src/main/java/emu/grasscutter/data/ResourceLoader.java +++ b/src/main/java/emu/grasscutter/data/ResourceLoader.java @@ -27,7 +27,7 @@ public class ResourceLoader { public static List<Class<?>> getResourceDefClasses() { Reflections reflections = new Reflections(ResourceLoader.class.getPackage().getName()); - Set<?> classes = reflections.getSubTypesOf(GenshinResource.class); + Set<?> classes = reflections.getSubTypesOf(GameResource.class); List<Class<?>> classList = new ArrayList<>(classes.size()); classes.forEach(o -> { @@ -50,12 +50,12 @@ public class ResourceLoader { loadResources(); loadScenePoints(); // Process into depots - GenshinDepot.load(); + GameDepot.load(); // Load spawn data loadSpawnData(); // Custom - TODO move this somewhere else try { - GenshinData.getAvatarSkillDepotDataMap().get(504).setAbilities( + GameData.getAvatarSkillDepotDataMap().get(504).setAbilities( new AbilityEmbryoEntry( "", new String[] { @@ -68,7 +68,7 @@ public class ResourceLoader { "Avatar_Player_WindBreathe_CameraController" } )); - GenshinData.getAvatarSkillDepotDataMap().get(704).setAbilities( + GameData.getAvatarSkillDepotDataMap().get(704).setAbilities( new AbilityEmbryoEntry( "", new String[] { @@ -95,7 +95,7 @@ public class ResourceLoader { } @SuppressWarnings("rawtypes") - Int2ObjectMap map = GenshinData.getMapByResourceDef(resourceDefinition); + Int2ObjectMap map = GameData.getMapByResourceDef(resourceDefinition); if (map == null) { continue; @@ -123,7 +123,7 @@ public class ResourceLoader { List list = Grasscutter.getGsonFactory().fromJson(fileReader, TypeToken.getParameterized(Collection.class, c).getType()); for (Object o : list) { - GenshinResource res = (GenshinResource) o; + GameResource res = (GameResource) o; res.onLoad(); map.put(res.getId(), res); } @@ -170,7 +170,7 @@ public class ResourceLoader { } for (ScenePointEntry entry : scenePointList) { - GenshinData.getScenePointEntries().put(entry.getName(), entry); + GameData.getScenePointEntries().put(entry.getName(), entry); } } } @@ -233,7 +233,7 @@ public class ResourceLoader { } for (AbilityEmbryoEntry entry : embryoList) { - GenshinData.getAbilityEmbryoInfo().put(entry.getName(), entry); + GameData.getAbilityEmbryoInfo().put(entry.getName(), entry); } } @@ -260,7 +260,7 @@ public class ResourceLoader { entry.getSpawns().stream().forEach(s -> { s.setGroup(entry); }); - GenshinDepot.getSpawnListById(entry.getSceneId()).insert(entry, entry.getPos().getX(), entry.getPos().getZ()); + GameDepot.getSpawnListById(entry.getSceneId()).insert(entry, entry.getPos().getX(), entry.getPos().getZ()); } } @@ -328,7 +328,7 @@ public class ResourceLoader { } for (OpenConfigEntry entry : list) { - GenshinData.getOpenConfigEntries().put(entry.getName(), entry); + GameData.getOpenConfigEntries().put(entry.getName(), entry); } } diff --git a/src/main/java/emu/grasscutter/data/def/AvatarCostumeData.java b/src/main/java/emu/grasscutter/data/def/AvatarCostumeData.java index b45bac9c7..c6166bd71 100644 --- a/src/main/java/emu/grasscutter/data/def/AvatarCostumeData.java +++ b/src/main/java/emu/grasscutter/data/def/AvatarCostumeData.java @@ -1,11 +1,11 @@ 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; @ResourceType(name = "AvatarCostumeExcelConfigData.json") -public class AvatarCostumeData extends GenshinResource { +public class AvatarCostumeData extends GameResource { private int CostumeId; private int ItemId; private int AvatarId; @@ -25,6 +25,6 @@ public class AvatarCostumeData extends GenshinResource { @Override public void onLoad() { - GenshinData.getAvatarCostumeDataItemIdMap().put(this.getItemId(), this); + GameData.getAvatarCostumeDataItemIdMap().put(this.getItemId(), this); } } diff --git a/src/main/java/emu/grasscutter/data/def/AvatarCurveData.java b/src/main/java/emu/grasscutter/data/def/AvatarCurveData.java index da560b2b8..586c0517d 100644 --- a/src/main/java/emu/grasscutter/data/def/AvatarCurveData.java +++ b/src/main/java/emu/grasscutter/data/def/AvatarCurveData.java @@ -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 = "AvatarCurveExcelConfigData.json") -public class AvatarCurveData extends GenshinResource { +public class AvatarCurveData extends GameResource { private int Level; private CurveInfo[] CurveInfos; diff --git a/src/main/java/emu/grasscutter/data/def/AvatarData.java b/src/main/java/emu/grasscutter/data/def/AvatarData.java index 3beb21eec..27555fc0d 100644 --- a/src/main/java/emu/grasscutter/data/def/AvatarData.java +++ b/src/main/java/emu/grasscutter/data/def/AvatarData.java @@ -2,8 +2,8 @@ package emu.grasscutter.data.def; import java.util.List; -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.data.ResourceType.LoadPriority; import emu.grasscutter.data.common.PropGrowCurve; @@ -15,7 +15,7 @@ import it.unimi.dsi.fastutil.ints.IntArrayList; import it.unimi.dsi.fastutil.ints.IntList; @ResourceType(name = "AvatarExcelConfigData.json", loadPriority = LoadPriority.LOW) -public class AvatarData extends GenshinResource { +public class AvatarData extends GameResource { private String name; private String IconName; @@ -178,7 +178,7 @@ public class AvatarData extends GenshinResource { if (growCurve == null) { return 1f; } - AvatarCurveData curveData = GenshinData.getAvatarCurveDataMap().get(level); + AvatarCurveData curveData = GameData.getAvatarCurveDataMap().get(level); if (curveData == null) { return 1f; } @@ -211,24 +211,24 @@ public class AvatarData extends GenshinResource { @Override public void onLoad() { - this.skillDepot = GenshinData.getAvatarSkillDepotDataMap().get(this.SkillDepotId); + this.skillDepot = GameData.getAvatarSkillDepotDataMap().get(this.SkillDepotId); - // Get fetters from GenshinData - this.fetters = GenshinData.getFetterDataEntries().get(this.Id); + // Get fetters from GameData + this.fetters = GameData.getFetterDataEntries().get(this.Id); - if (GenshinData.getFetterCharacterCardDataMap().get(this.Id) != null) { - this.nameCardRewardId = GenshinData.getFetterCharacterCardDataMap().get(this.Id).getRewardId(); + if (GameData.getFetterCharacterCardDataMap().get(this.Id) != null) { + this.nameCardRewardId = GameData.getFetterCharacterCardDataMap().get(this.Id).getRewardId(); } - if (GenshinData.getRewardDataMap().get(this.nameCardRewardId) != null) { - this.nameCardId = GenshinData.getRewardDataMap().get(this.nameCardRewardId).getRewardItemList().get(0).getItemId(); + if (GameData.getRewardDataMap().get(this.nameCardRewardId) != null) { + this.nameCardId = GameData.getRewardDataMap().get(this.nameCardRewardId).getRewardItemList().get(0).getItemId(); } - int size = GenshinData.getAvatarCurveDataMap().size(); + int size = GameData.getAvatarCurveDataMap().size(); this.hpGrowthCurve = new float[size]; this.attackGrowthCurve = new float[size]; this.defenseGrowthCurve = new float[size]; - for (AvatarCurveData curveData : GenshinData.getAvatarCurveDataMap().values()) { + for (AvatarCurveData curveData : GameData.getAvatarCurveDataMap().values()) { int level = curveData.getLevel() - 1; for (PropGrowCurve growCurve : this.PropGrowCurves) { FightProperty prop = FightProperty.getPropByName(growCurve.getType()); @@ -260,7 +260,7 @@ public class AvatarData extends GenshinResource { if (split.length > 0) { this.name = split[split.length - 1]; - AbilityEmbryoEntry info = GenshinData.getAbilityEmbryoInfo().get(this.name); + AbilityEmbryoEntry info = GameData.getAbilityEmbryoInfo().get(this.name); if (info != null) { this.abilities = new IntArrayList(info.getAbilities().length); for (String ability : info.getAbilities()) { diff --git a/src/main/java/emu/grasscutter/data/def/AvatarFetterLevelData.java b/src/main/java/emu/grasscutter/data/def/AvatarFetterLevelData.java index 8dd93eea5..a02915069 100644 --- a/src/main/java/emu/grasscutter/data/def/AvatarFetterLevelData.java +++ b/src/main/java/emu/grasscutter/data/def/AvatarFetterLevelData.java @@ -1,10 +1,10 @@ package emu.grasscutter.data.def; -import emu.grasscutter.data.GenshinResource; +import emu.grasscutter.data.GameResource; import emu.grasscutter.data.ResourceType; @ResourceType(name = "AvatarFettersLevelExcelConfigData.json") -public class AvatarFetterLevelData extends GenshinResource { +public class AvatarFetterLevelData extends GameResource { private int FetterLevel; private int NeedExp; diff --git a/src/main/java/emu/grasscutter/data/def/AvatarFlycloakData.java b/src/main/java/emu/grasscutter/data/def/AvatarFlycloakData.java index 29d04cce5..100a6c87c 100644 --- a/src/main/java/emu/grasscutter/data/def/AvatarFlycloakData.java +++ b/src/main/java/emu/grasscutter/data/def/AvatarFlycloakData.java @@ -1,10 +1,10 @@ package emu.grasscutter.data.def; -import emu.grasscutter.data.GenshinResource; +import emu.grasscutter.data.GameResource; import emu.grasscutter.data.ResourceType; @ResourceType(name = "AvatarFlycloakExcelConfigData.json") -public class AvatarFlycloakData extends GenshinResource { +public class AvatarFlycloakData extends GameResource { private int FlycloakId; private long NameTextMapHash; diff --git a/src/main/java/emu/grasscutter/data/def/AvatarLevelData.java b/src/main/java/emu/grasscutter/data/def/AvatarLevelData.java index f7586f690..bc6ca671c 100644 --- a/src/main/java/emu/grasscutter/data/def/AvatarLevelData.java +++ b/src/main/java/emu/grasscutter/data/def/AvatarLevelData.java @@ -1,10 +1,10 @@ package emu.grasscutter.data.def; -import emu.grasscutter.data.GenshinResource; +import emu.grasscutter.data.GameResource; import emu.grasscutter.data.ResourceType; @ResourceType(name = "AvatarLevelExcelConfigData.json") -public class AvatarLevelData extends GenshinResource { +public class AvatarLevelData extends GameResource { private int Level; private int Exp; diff --git a/src/main/java/emu/grasscutter/data/def/AvatarPromoteData.java b/src/main/java/emu/grasscutter/data/def/AvatarPromoteData.java index 2a40d44ad..c397902e4 100644 --- a/src/main/java/emu/grasscutter/data/def/AvatarPromoteData.java +++ b/src/main/java/emu/grasscutter/data/def/AvatarPromoteData.java @@ -1,13 +1,13 @@ 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 = "AvatarPromoteExcelConfigData.json") -public class AvatarPromoteData extends GenshinResource { +public class AvatarPromoteData extends GameResource { private int AvatarPromoteId; private int PromoteLevel; diff --git a/src/main/java/emu/grasscutter/data/def/AvatarSkillData.java b/src/main/java/emu/grasscutter/data/def/AvatarSkillData.java index 147c22d10..3efc2a142 100644 --- a/src/main/java/emu/grasscutter/data/def/AvatarSkillData.java +++ b/src/main/java/emu/grasscutter/data/def/AvatarSkillData.java @@ -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.ResourceType.LoadPriority; @ResourceType(name = "AvatarSkillExcelConfigData.json", loadPriority = LoadPriority.HIGHEST) -public class AvatarSkillData extends GenshinResource { +public class AvatarSkillData extends GameResource { private int Id; private float CdTime; private int CostElemVal; diff --git a/src/main/java/emu/grasscutter/data/def/AvatarSkillDepotData.java b/src/main/java/emu/grasscutter/data/def/AvatarSkillDepotData.java index 4beb6ec8c..7916bfd45 100644 --- a/src/main/java/emu/grasscutter/data/def/AvatarSkillDepotData.java +++ b/src/main/java/emu/grasscutter/data/def/AvatarSkillDepotData.java @@ -2,8 +2,8 @@ package emu.grasscutter.data.def; import java.util.List; -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.data.ResourceType.LoadPriority; import emu.grasscutter.data.custom.AbilityEmbryoEntry; @@ -13,7 +13,7 @@ import it.unimi.dsi.fastutil.ints.IntArrayList; import it.unimi.dsi.fastutil.ints.IntList; @ResourceType(name = "AvatarSkillDepotExcelConfigData.json", loadPriority = LoadPriority.HIGH) -public class AvatarSkillDepotData extends GenshinResource { +public class AvatarSkillDepotData extends GameResource { private int Id; private int EnergySkill; @@ -94,7 +94,7 @@ public class AvatarSkillDepotData extends GenshinResource { @Override public void onLoad() { - this.energySkillData = GenshinData.getAvatarSkillDataMap().get(this.EnergySkill); + this.energySkillData = GameData.getAvatarSkillDataMap().get(this.EnergySkill); if (getEnergySkillData() != null) { this.elementType = ElementType.getTypeByName(getEnergySkillData().getCostElemType()); } else { diff --git a/src/main/java/emu/grasscutter/data/def/AvatarTalentData.java b/src/main/java/emu/grasscutter/data/def/AvatarTalentData.java index 6708da8c8..fdf96875d 100644 --- a/src/main/java/emu/grasscutter/data/def/AvatarTalentData.java +++ b/src/main/java/emu/grasscutter/data/def/AvatarTalentData.java @@ -1,13 +1,13 @@ 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.ResourceType.LoadPriority; import emu.grasscutter.data.common.FightPropData; @ResourceType(name = "AvatarTalentExcelConfigData.json", loadPriority = LoadPriority.HIGHEST) -public class AvatarTalentData extends GenshinResource { +public class AvatarTalentData extends GameResource { private int TalentId; private int PrevTalent; private long NameTextMapHash; diff --git a/src/main/java/emu/grasscutter/data/def/EquipAffixData.java b/src/main/java/emu/grasscutter/data/def/EquipAffixData.java index af08276df..9020c7b46 100644 --- a/src/main/java/emu/grasscutter/data/def/EquipAffixData.java +++ b/src/main/java/emu/grasscutter/data/def/EquipAffixData.java @@ -1,12 +1,12 @@ 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; @ResourceType(name = "EquipAffixExcelConfigData.json") -public class EquipAffixData extends GenshinResource { +public class EquipAffixData extends GameResource { private int AffixId; private int Id; diff --git a/src/main/java/emu/grasscutter/data/def/FetterCharacterCardData.java b/src/main/java/emu/grasscutter/data/def/FetterCharacterCardData.java index 2bf96ad8e..62e323509 100644 --- a/src/main/java/emu/grasscutter/data/def/FetterCharacterCardData.java +++ b/src/main/java/emu/grasscutter/data/def/FetterCharacterCardData.java @@ -1,11 +1,11 @@ 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.LoadPriority; @ResourceType(name = "FetterCharacterCardExcelConfigData.json", loadPriority = LoadPriority.HIGHEST) -public class FetterCharacterCardData extends GenshinResource { +public class FetterCharacterCardData extends GameResource { private int AvatarId; private int RewardId; diff --git a/src/main/java/emu/grasscutter/data/def/FetterData.java b/src/main/java/emu/grasscutter/data/def/FetterData.java index dc88fd795..f4e6abbd9 100644 --- a/src/main/java/emu/grasscutter/data/def/FetterData.java +++ b/src/main/java/emu/grasscutter/data/def/FetterData.java @@ -2,13 +2,13 @@ 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.ResourceType.LoadPriority; import emu.grasscutter.data.common.OpenCondData; @ResourceType(name = {"FetterInfoExcelConfigData.json", "FettersExcelConfigData.json", "FetterStoryExcelConfigData.json"}, loadPriority = LoadPriority.HIGHEST) -public class FetterData extends GenshinResource { +public class FetterData extends GameResource { private int AvatarId; private int FetterId; private List<OpenCondData> OpenCond; diff --git a/src/main/java/emu/grasscutter/data/def/GadgetData.java b/src/main/java/emu/grasscutter/data/def/GadgetData.java index ec7754863..7a071972b 100644 --- a/src/main/java/emu/grasscutter/data/def/GadgetData.java +++ b/src/main/java/emu/grasscutter/data/def/GadgetData.java @@ -1,10 +1,10 @@ package emu.grasscutter.data.def; -import emu.grasscutter.data.GenshinResource; +import emu.grasscutter.data.GameResource; import emu.grasscutter.data.ResourceType; @ResourceType(name = "GadgetExcelConfigData.json") -public class GadgetData extends GenshinResource { +public class GadgetData extends GameResource { private int Id; private String Type; diff --git a/src/main/java/emu/grasscutter/data/def/ItemData.java b/src/main/java/emu/grasscutter/data/def/ItemData.java index 25be666e7..5cd1df751 100644 --- a/src/main/java/emu/grasscutter/data/def/ItemData.java +++ b/src/main/java/emu/grasscutter/data/def/ItemData.java @@ -1,13 +1,13 @@ 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; import it.unimi.dsi.fastutil.ints.IntOpenHashSet; import it.unimi.dsi.fastutil.ints.IntSet; @ResourceType(name = {"MaterialExcelConfigData.json", "WeaponExcelConfigData.json", "ReliquaryExcelConfigData.json"}) -public class ItemData extends GenshinResource { +public class ItemData extends GameResource { private int Id; private int StackLimit = 1; diff --git a/src/main/java/emu/grasscutter/data/def/MonsterCurveData.java b/src/main/java/emu/grasscutter/data/def/MonsterCurveData.java index 77a44bd6a..07c705403 100644 --- a/src/main/java/emu/grasscutter/data/def/MonsterCurveData.java +++ b/src/main/java/emu/grasscutter/data/def/MonsterCurveData.java @@ -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 = "MonsterCurveExcelConfigData.json") -public class MonsterCurveData extends GenshinResource { +public class MonsterCurveData extends GameResource { private int Level; private CurveInfo[] CurveInfos; diff --git a/src/main/java/emu/grasscutter/data/def/MonsterData.java b/src/main/java/emu/grasscutter/data/def/MonsterData.java index 2cf41bf7e..341a10ce0 100644 --- a/src/main/java/emu/grasscutter/data/def/MonsterData.java +++ b/src/main/java/emu/grasscutter/data/def/MonsterData.java @@ -2,14 +2,14 @@ package emu.grasscutter.data.def; import java.util.List; -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.data.ResourceType.LoadPriority; import emu.grasscutter.data.common.PropGrowCurve; @ResourceType(name = "MonsterExcelConfigData.json", loadPriority = LoadPriority.LOW) -public class MonsterData extends GenshinResource { +public class MonsterData extends GameResource { private int Id; private String MonsterName; @@ -168,13 +168,13 @@ public class MonsterData extends GenshinResource { @Override public void onLoad() { - this.describeData = GenshinData.getMonsterDescribeDataMap().get(this.getDescribeId()); + this.describeData = GameData.getMonsterDescribeDataMap().get(this.getDescribeId()); for (int id : this.Equips) { if (id == 0) { continue; } - GadgetData gadget = GenshinData.getGadgetDataMap().get(id); + GadgetData gadget = GameData.getGadgetDataMap().get(id); if (gadget == null) { continue; } diff --git a/src/main/java/emu/grasscutter/data/def/MonsterDescribeData.java b/src/main/java/emu/grasscutter/data/def/MonsterDescribeData.java index 6d6271a77..41b826c5b 100644 --- a/src/main/java/emu/grasscutter/data/def/MonsterDescribeData.java +++ b/src/main/java/emu/grasscutter/data/def/MonsterDescribeData.java @@ -1,11 +1,11 @@ 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.LoadPriority; @ResourceType(name = "MonsterDescribeExcelConfigData.json", loadPriority = LoadPriority.HIGH) -public class MonsterDescribeData extends GenshinResource { +public class MonsterDescribeData extends GameResource { private int Id; private long NameTextMapHash; private int TitleID; diff --git a/src/main/java/emu/grasscutter/data/def/NpcData.java b/src/main/java/emu/grasscutter/data/def/NpcData.java index ad08ca9ee..37fa78776 100644 --- a/src/main/java/emu/grasscutter/data/def/NpcData.java +++ b/src/main/java/emu/grasscutter/data/def/NpcData.java @@ -1,10 +1,10 @@ package emu.grasscutter.data.def; -import emu.grasscutter.data.GenshinResource; +import emu.grasscutter.data.GameResource; import emu.grasscutter.data.ResourceType; @ResourceType(name = "NpcExcelConfigData.json") -public class NpcData extends GenshinResource { +public class NpcData extends GameResource { private int Id; private String JsonName; diff --git a/src/main/java/emu/grasscutter/data/def/PlayerLevelData.java b/src/main/java/emu/grasscutter/data/def/PlayerLevelData.java index 3735b7e59..1e02e3eca 100644 --- a/src/main/java/emu/grasscutter/data/def/PlayerLevelData.java +++ b/src/main/java/emu/grasscutter/data/def/PlayerLevelData.java @@ -1,10 +1,10 @@ package emu.grasscutter.data.def; -import emu.grasscutter.data.GenshinResource; +import emu.grasscutter.data.GameResource; import emu.grasscutter.data.ResourceType; @ResourceType(name = "PlayerLevelExcelConfigData.json") -public class PlayerLevelData extends GenshinResource { +public class PlayerLevelData extends GameResource { private int Level; private int Exp; private int RewardId; diff --git a/src/main/java/emu/grasscutter/data/def/ProudSkillData.java b/src/main/java/emu/grasscutter/data/def/ProudSkillData.java index 6ffb180d2..3eff8b94d 100644 --- a/src/main/java/emu/grasscutter/data/def/ProudSkillData.java +++ b/src/main/java/emu/grasscutter/data/def/ProudSkillData.java @@ -3,13 +3,13 @@ package emu.grasscutter.data.def; import java.util.ArrayList; import java.util.List; -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 = "ProudSkillExcelConfigData.json") -public class ProudSkillData extends GenshinResource { +public class ProudSkillData extends GameResource { private int ProudSkillId; private int ProudSkillGroupId; diff --git a/src/main/java/emu/grasscutter/data/def/ReliquaryAffixData.java b/src/main/java/emu/grasscutter/data/def/ReliquaryAffixData.java index 25e7693c3..ba9b1d369 100644 --- a/src/main/java/emu/grasscutter/data/def/ReliquaryAffixData.java +++ b/src/main/java/emu/grasscutter/data/def/ReliquaryAffixData.java @@ -1,11 +1,11 @@ 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 = "ReliquaryAffixExcelConfigData.json") -public class ReliquaryAffixData extends GenshinResource { +public class ReliquaryAffixData extends GameResource { private int Id; private int DepotId; diff --git a/src/main/java/emu/grasscutter/data/def/ReliquaryLevelData.java b/src/main/java/emu/grasscutter/data/def/ReliquaryLevelData.java index 0217ff48b..b4e37dd90 100644 --- a/src/main/java/emu/grasscutter/data/def/ReliquaryLevelData.java +++ b/src/main/java/emu/grasscutter/data/def/ReliquaryLevelData.java @@ -2,14 +2,14 @@ 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.game.props.FightProperty; import it.unimi.dsi.fastutil.ints.Int2ObjectMap; import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap; @ResourceType(name = "ReliquaryLevelExcelConfigData.json") -public class ReliquaryLevelData extends GenshinResource { +public class ReliquaryLevelData extends GameResource { private int id; private Int2ObjectMap<Float> propMap; diff --git a/src/main/java/emu/grasscutter/data/def/ReliquaryMainPropData.java b/src/main/java/emu/grasscutter/data/def/ReliquaryMainPropData.java index a67233f51..6b2c920e4 100644 --- a/src/main/java/emu/grasscutter/data/def/ReliquaryMainPropData.java +++ b/src/main/java/emu/grasscutter/data/def/ReliquaryMainPropData.java @@ -1,11 +1,11 @@ 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; diff --git a/src/main/java/emu/grasscutter/data/def/ReliquarySetData.java b/src/main/java/emu/grasscutter/data/def/ReliquarySetData.java index 85c3e3237..9eac2c050 100644 --- a/src/main/java/emu/grasscutter/data/def/ReliquarySetData.java +++ b/src/main/java/emu/grasscutter/data/def/ReliquarySetData.java @@ -1,10 +1,10 @@ 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; diff --git a/src/main/java/emu/grasscutter/data/def/RewardData.java b/src/main/java/emu/grasscutter/data/def/RewardData.java index 46c39ac10..d8ea58415 100644 --- a/src/main/java/emu/grasscutter/data/def/RewardData.java +++ b/src/main/java/emu/grasscutter/data/def/RewardData.java @@ -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; diff --git a/src/main/java/emu/grasscutter/data/def/SceneData.java b/src/main/java/emu/grasscutter/data/def/SceneData.java index d9c0bd0ab..220579faf 100644 --- a/src/main/java/emu/grasscutter/data/def/SceneData.java +++ b/src/main/java/emu/grasscutter/data/def/SceneData.java @@ -1,13 +1,13 @@ 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; diff --git a/src/main/java/emu/grasscutter/data/def/WeaponCurveData.java b/src/main/java/emu/grasscutter/data/def/WeaponCurveData.java index 0bccd603a..287ce8af6 100644 --- a/src/main/java/emu/grasscutter/data/def/WeaponCurveData.java +++ b/src/main/java/emu/grasscutter/data/def/WeaponCurveData.java @@ -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; diff --git a/src/main/java/emu/grasscutter/data/def/WeaponLevelData.java b/src/main/java/emu/grasscutter/data/def/WeaponLevelData.java index c3f415681..98550b24a 100644 --- a/src/main/java/emu/grasscutter/data/def/WeaponLevelData.java +++ b/src/main/java/emu/grasscutter/data/def/WeaponLevelData.java @@ -1,10 +1,10 @@ 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; diff --git a/src/main/java/emu/grasscutter/data/def/WeaponPromoteData.java b/src/main/java/emu/grasscutter/data/def/WeaponPromoteData.java index ab008bfed..8e75b2b7c 100644 --- a/src/main/java/emu/grasscutter/data/def/WeaponPromoteData.java +++ b/src/main/java/emu/grasscutter/data/def/WeaponPromoteData.java @@ -1,13 +1,13 @@ 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; diff --git a/src/main/java/emu/grasscutter/data/def/WorldLevelData.java b/src/main/java/emu/grasscutter/data/def/WorldLevelData.java index c2072d8f2..3b101f9b8 100644 --- a/src/main/java/emu/grasscutter/data/def/WorldLevelData.java +++ b/src/main/java/emu/grasscutter/data/def/WorldLevelData.java @@ -1,10 +1,10 @@ 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; diff --git a/src/main/java/emu/grasscutter/database/DatabaseHelper.java b/src/main/java/emu/grasscutter/database/DatabaseHelper.java index fc24b70e6..c1800c145 100644 --- a/src/main/java/emu/grasscutter/database/DatabaseHelper.java +++ b/src/main/java/emu/grasscutter/database/DatabaseHelper.java @@ -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.avatar.Avatar; import emu.grasscutter.game.friends.Friendship; -import emu.grasscutter.game.inventory.GenshinItem; +import emu.grasscutter.game.inventory.GameItem; +import emu.grasscutter.game.player.Player; public final class DatabaseHelper { public 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,15 +90,19 @@ public final class DatabaseHelper { return DatabaseManager.getDatastore().find(Account.class).filter(Filters.eq("username", username)).delete().getDeletedCount() > 0; } - public static GenshinPlayer getPlayerById(int id) { - return DatabaseManager.getDatastore().find(GenshinPlayer.class).filter(Filters.eq("_id", id)).first(); + public static List<Player> getAllPlayers() { + return DatabaseManager.getDatastore().find(Player.class).stream().toList(); + } + + public static Player getPlayerById(int id) { + return DatabaseManager.getDatastore().find(Player.class).filter(Filters.eq("_id", id)).first(); } public static boolean checkPlayerExists(int id) { - 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)) { @@ -123,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(); } diff --git a/src/main/java/emu/grasscutter/database/DatabaseManager.java b/src/main/java/emu/grasscutter/database/DatabaseManager.java index 6df2ca9f0..68e1f5e87 100644 --- a/src/main/java/emu/grasscutter/database/DatabaseManager.java +++ b/src/main/java/emu/grasscutter/database/DatabaseManager.java @@ -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.avatar.Avatar; import emu.grasscutter.game.friends.Friendship; -import emu.grasscutter.game.inventory.GenshinItem; +import emu.grasscutter.game.inventory.GameItem; +import emu.grasscutter.game.player.Player; public final class DatabaseManager { @@ -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() { diff --git a/src/main/java/emu/grasscutter/game/CoopRequest.java b/src/main/java/emu/grasscutter/game/CoopRequest.java index 1e885672c..80a004ca7 100644 --- a/src/main/java/emu/grasscutter/game/CoopRequest.java +++ b/src/main/java/emu/grasscutter/game/CoopRequest.java @@ -1,17 +1,19 @@ package emu.grasscutter.game; +import emu.grasscutter.game.player.Player; + 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; } diff --git a/src/main/java/emu/grasscutter/game/avatar/GenshinAvatar.java b/src/main/java/emu/grasscutter/game/avatar/Avatar.java similarity index 88% rename from src/main/java/emu/grasscutter/game/avatar/GenshinAvatar.java rename to src/main/java/emu/grasscutter/game/avatar/Avatar.java index a68e2683e..d16b9a2fa 100644 --- a/src/main/java/emu/grasscutter/game/avatar/GenshinAvatar.java +++ b/src/main/java/emu/grasscutter/game/avatar/Avatar.java @@ -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.entity.EntityAvatar; import emu.grasscutter.game.inventory.EquipType; -import emu.grasscutter.game.inventory.GenshinItem; +import emu.grasscutter.game.inventory.GameItem; +import emu.grasscutter.game.player.Player; import emu.grasscutter.game.props.ElementType; import emu.grasscutter.game.props.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()); } diff --git a/src/main/java/emu/grasscutter/game/avatar/AvatarProfileData.java b/src/main/java/emu/grasscutter/game/avatar/AvatarProfileData.java index d04c9d326..b38855b81 100644 --- a/src/main/java/emu/grasscutter/game/avatar/AvatarProfileData.java +++ b/src/main/java/emu/grasscutter/game/avatar/AvatarProfileData.java @@ -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(); } diff --git a/src/main/java/emu/grasscutter/game/avatar/AvatarStorage.java b/src/main/java/emu/grasscutter/game/avatar/AvatarStorage.java index 5162156bc..99ccda173 100644 --- a/src/main/java/emu/grasscutter/game/avatar/AvatarStorage.java +++ b/src/main/java/emu/grasscutter/game/avatar/AvatarStorage.java @@ -3,12 +3,12 @@ package emu.grasscutter.game.avatar; import java.util.Iterator; import java.util.List; -import emu.grasscutter.data.GenshinData; +import emu.grasscutter.data.GameData; import emu.grasscutter.data.def.AvatarData; import emu.grasscutter.database.DatabaseHelper; -import emu.grasscutter.game.GenshinPlayer; import emu.grasscutter.game.entity.EntityAvatar; -import emu.grasscutter.game.inventory.GenshinItem; +import emu.grasscutter.game.inventory.GameItem; +import emu.grasscutter.game.player.Player; import emu.grasscutter.server.packet.send.PacketAvatarChangeCostumeNotify; import emu.grasscutter.server.packet.send.PacketAvatarFlycloakChangeNotify; import it.unimi.dsi.fastutil.ints.Int2ObjectMap; @@ -16,22 +16,22 @@ import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap; import it.unimi.dsi.fastutil.longs.Long2ObjectMap; import it.unimi.dsi.fastutil.longs.Long2ObjectOpenHashMap; -public class AvatarStorage implements Iterable<GenshinAvatar> { - private final GenshinPlayer player; - private final Int2ObjectMap<GenshinAvatar> avatars; - private final Long2ObjectMap<GenshinAvatar> avatarsGuid; +public class AvatarStorage implements Iterable<Avatar> { + private final Player player; + private final Int2ObjectMap<Avatar> avatars; + private final Long2ObjectMap<Avatar> avatarsGuid; - public AvatarStorage(GenshinPlayer player) { + public AvatarStorage(Player player) { this.player = player; this.avatars = new Int2ObjectOpenHashMap<>(); this.avatarsGuid = new Long2ObjectOpenHashMap<>(); } - public GenshinPlayer getPlayer() { + public Player getPlayer() { return player; } - public Int2ObjectMap<GenshinAvatar> getAvatars() { + public Int2ObjectMap<Avatar> getAvatars() { return avatars; } @@ -39,11 +39,11 @@ public class AvatarStorage implements Iterable<GenshinAvatar> { return this.avatars.size(); } - public GenshinAvatar getAvatarById(int id) { + public Avatar getAvatarById(int id) { return getAvatars().get(id); } - public GenshinAvatar getAvatarByGuid(long id) { + public Avatar getAvatarByGuid(long id) { return avatarsGuid.get(id); } @@ -51,7 +51,7 @@ public class AvatarStorage implements Iterable<GenshinAvatar> { return getAvatars().containsKey(id); } - public boolean addAvatar(GenshinAvatar avatar) { + public boolean addAvatar(Avatar avatar) { if (avatar.getAvatarData() == null || this.hasAvatar(avatar.getAvatarId())) { return false; } @@ -68,14 +68,14 @@ public class AvatarStorage implements Iterable<GenshinAvatar> { return true; } - public void addStartingWeapon(GenshinAvatar avatar) { + public void addStartingWeapon(Avatar avatar) { // Make sure avatar owner is this player if (avatar.getPlayer() != this.getPlayer()) { return; } // Create weapon - GenshinItem weapon = new GenshinItem(avatar.getAvatarData().getInitialWeapon()); + GameItem weapon = new GameItem(avatar.getAvatarData().getInitialWeapon()); if (weapon.getItemData() != null) { this.getPlayer().getInventory().addItem(weapon); @@ -85,7 +85,7 @@ public class AvatarStorage implements Iterable<GenshinAvatar> { } public boolean wearFlycloak(long avatarGuid, int flycloakId) { - GenshinAvatar avatar = this.getAvatarByGuid(avatarGuid); + Avatar avatar = this.getAvatarByGuid(avatarGuid); if (avatar == null || !getPlayer().getFlyCloakList().contains(flycloakId)) { return false; @@ -101,7 +101,7 @@ public class AvatarStorage implements Iterable<GenshinAvatar> { } public boolean changeCostume(long avatarGuid, int costumeId) { - GenshinAvatar avatar = this.getAvatarByGuid(avatarGuid); + Avatar avatar = this.getAvatarByGuid(avatarGuid); if (avatar == null) { return false; @@ -130,15 +130,15 @@ public class AvatarStorage implements Iterable<GenshinAvatar> { } public void loadFromDatabase() { - List<GenshinAvatar> avatars = DatabaseHelper.getAvatars(getPlayer()); + List<Avatar> avatars = DatabaseHelper.getAvatars(getPlayer()); - for (GenshinAvatar avatar : avatars) { + for (Avatar avatar : avatars) { // Should never happen if (avatar.getObjectId() == null) { continue; } - AvatarData avatarData = GenshinData.getAvatarDataMap().get(avatar.getAvatarId()); + AvatarData avatarData = GameData.getAvatarDataMap().get(avatar.getAvatarId()); if (avatarData == null) { continue; } @@ -157,7 +157,7 @@ public class AvatarStorage implements Iterable<GenshinAvatar> { } public void postLoad() { - for (GenshinAvatar avatar : this) { + for (Avatar avatar : this) { // Weapon check if (avatar.getWeapon() == null) { this.addStartingWeapon(avatar); @@ -168,7 +168,7 @@ public class AvatarStorage implements Iterable<GenshinAvatar> { } @Override - public Iterator<GenshinAvatar> iterator() { + public Iterator<Avatar> iterator() { return getAvatars().values().iterator(); } } diff --git a/src/main/java/emu/grasscutter/game/entity/EntityAvatar.java b/src/main/java/emu/grasscutter/game/entity/EntityAvatar.java index 7788f932a..a21e14360 100644 --- a/src/main/java/emu/grasscutter/game/entity/EntityAvatar.java +++ b/src/main/java/emu/grasscutter/game/entity/EntityAvatar.java @@ -1,18 +1,18 @@ package emu.grasscutter.game.entity; -import emu.grasscutter.GenshinConstants; -import emu.grasscutter.data.GenshinData; +import emu.grasscutter.GameConstants; +import emu.grasscutter.data.GameData; import emu.grasscutter.data.def.AvatarData; import emu.grasscutter.data.def.AvatarSkillDepotData; -import emu.grasscutter.game.GenshinPlayer; -import emu.grasscutter.game.GenshinScene; -import emu.grasscutter.game.World; -import emu.grasscutter.game.avatar.GenshinAvatar; +import emu.grasscutter.game.avatar.Avatar; import emu.grasscutter.game.inventory.EquipType; -import emu.grasscutter.game.inventory.GenshinItem; +import emu.grasscutter.game.inventory.GameItem; +import emu.grasscutter.game.player.Player; import emu.grasscutter.game.props.EntityIdType; import emu.grasscutter.game.props.FightProperty; import emu.grasscutter.game.props.PlayerProperty; +import emu.grasscutter.game.world.Scene; +import emu.grasscutter.game.world.World; import emu.grasscutter.net.proto.AbilityControlBlockOuterClass.AbilityControlBlock; import emu.grasscutter.net.proto.AbilityEmbryoOuterClass.AbilityEmbryo; import emu.grasscutter.net.proto.AbilitySyncStateInfoOuterClass.AbilitySyncStateInfo; @@ -34,29 +34,29 @@ import emu.grasscutter.utils.Utils; import it.unimi.dsi.fastutil.ints.Int2FloatMap; import it.unimi.dsi.fastutil.ints.Int2FloatOpenHashMap; -public class EntityAvatar extends GenshinEntity { - private final GenshinAvatar avatar; +public class EntityAvatar extends GameEntity { + private final Avatar avatar; private PlayerDieType killedType; private int killedBy; - public EntityAvatar(GenshinScene scene, GenshinAvatar avatar) { + public EntityAvatar(Scene scene, Avatar avatar) { super(scene); this.avatar = avatar; this.id = getScene().getWorld().getNextEntityId(EntityIdType.AVATAR); - GenshinItem weapon = this.getAvatar().getWeapon(); + GameItem weapon = this.getAvatar().getWeapon(); if (weapon != null) { weapon.setWeaponEntityId(getScene().getWorld().getNextEntityId(EntityIdType.WEAPON)); } } - public EntityAvatar(GenshinAvatar avatar) { + public EntityAvatar(Avatar avatar) { super(null); this.avatar = avatar; } - public GenshinPlayer getPlayer() { + public Player getPlayer() { return avatar.getPlayer(); } @@ -70,7 +70,7 @@ public class EntityAvatar extends GenshinEntity { return getPlayer().getRotation(); } - public GenshinAvatar getAvatar() { + public Avatar getAvatar() { return avatar; } @@ -122,7 +122,7 @@ public class EntityAvatar extends GenshinEntity { .setCostumeId(this.getAvatar().getCostume()) .setBornTime(this.getAvatar().getBornTime()); - for (GenshinItem item : avatar.getEquips().values()) { + for (GameItem item : avatar.getEquips().values()) { if (item.getItemData().getEquipType() == EquipType.EQUIP_WEAPON) { avatarInfo.setWeapon(item.createSceneWeaponInfo()); } else { @@ -187,17 +187,17 @@ public class EntityAvatar extends GenshinEntity { AbilityEmbryo emb = AbilityEmbryo.newBuilder() .setAbilityId(++embryoId) .setAbilityNameHash(id) - .setAbilityOverrideNameHash(GenshinConstants.DEFAULT_ABILITY_NAME) + .setAbilityOverrideNameHash(GameConstants.DEFAULT_ABILITY_NAME) .build(); abilityControlBlock.addAbilityEmbryoList(emb); } } // Add default abilities - for (int id : GenshinConstants.DEFAULT_ABILITY_HASHES) { + for (int id : GameConstants.DEFAULT_ABILITY_HASHES) { AbilityEmbryo emb = AbilityEmbryo.newBuilder() .setAbilityId(++embryoId) .setAbilityNameHash(id) - .setAbilityOverrideNameHash(GenshinConstants.DEFAULT_ABILITY_NAME) + .setAbilityOverrideNameHash(GameConstants.DEFAULT_ABILITY_NAME) .build(); abilityControlBlock.addAbilityEmbryoList(emb); } @@ -206,18 +206,18 @@ public class EntityAvatar extends GenshinEntity { AbilityEmbryo emb = AbilityEmbryo.newBuilder() .setAbilityId(++embryoId) .setAbilityNameHash(id) - .setAbilityOverrideNameHash(GenshinConstants.DEFAULT_ABILITY_NAME) + .setAbilityOverrideNameHash(GameConstants.DEFAULT_ABILITY_NAME) .build(); abilityControlBlock.addAbilityEmbryoList(emb); } // Add skill depot abilities - AvatarSkillDepotData skillDepot = GenshinData.getAvatarSkillDepotDataMap().get(this.getAvatar().getSkillDepotId()); + AvatarSkillDepotData skillDepot = GameData.getAvatarSkillDepotDataMap().get(this.getAvatar().getSkillDepotId()); if (skillDepot != null && skillDepot.getAbilities() != null) { for (int id : skillDepot.getAbilities()) { AbilityEmbryo emb = AbilityEmbryo.newBuilder() .setAbilityId(++embryoId) .setAbilityNameHash(id) - .setAbilityOverrideNameHash(GenshinConstants.DEFAULT_ABILITY_NAME) + .setAbilityOverrideNameHash(GameConstants.DEFAULT_ABILITY_NAME) .build(); abilityControlBlock.addAbilityEmbryoList(emb); } @@ -228,7 +228,7 @@ public class EntityAvatar extends GenshinEntity { AbilityEmbryo emb = AbilityEmbryo.newBuilder() .setAbilityId(++embryoId) .setAbilityNameHash(Utils.abilityHash(skill)) - .setAbilityOverrideNameHash(GenshinConstants.DEFAULT_ABILITY_NAME) + .setAbilityOverrideNameHash(GameConstants.DEFAULT_ABILITY_NAME) .build(); abilityControlBlock.addAbilityEmbryoList(emb); } diff --git a/src/main/java/emu/grasscutter/game/entity/EntityClientGadget.java b/src/main/java/emu/grasscutter/game/entity/EntityClientGadget.java index 04f045c03..464789426 100644 --- a/src/main/java/emu/grasscutter/game/entity/EntityClientGadget.java +++ b/src/main/java/emu/grasscutter/game/entity/EntityClientGadget.java @@ -1,9 +1,9 @@ package emu.grasscutter.game.entity; -import emu.grasscutter.game.GenshinPlayer; -import emu.grasscutter.game.GenshinScene; -import emu.grasscutter.game.World; +import emu.grasscutter.game.player.Player; import emu.grasscutter.game.props.PlayerProperty; +import emu.grasscutter.game.world.Scene; +import emu.grasscutter.game.world.World; import emu.grasscutter.net.proto.AbilitySyncStateInfoOuterClass.AbilitySyncStateInfo; import emu.grasscutter.net.proto.AnimatorParameterValueInfoPairOuterClass.AnimatorParameterValueInfoPair; import emu.grasscutter.net.proto.ClientGadgetInfoOuterClass; @@ -24,7 +24,7 @@ import emu.grasscutter.utils.ProtoHelper; import it.unimi.dsi.fastutil.ints.Int2FloatOpenHashMap; public class EntityClientGadget extends EntityGadget { - private final GenshinPlayer owner; + private final Player owner; private final Position pos; private final Position rot; @@ -36,7 +36,7 @@ public class EntityClientGadget extends EntityGadget { private int targetEntityId; private boolean asyncLoad; - public EntityClientGadget(GenshinScene scene, GenshinPlayer player, EvtCreateGadgetNotify notify) { + public EntityClientGadget(Scene scene, Player player, EvtCreateGadgetNotify notify) { super(scene); this.owner = player; this.id = notify.getEntityId(); @@ -55,7 +55,7 @@ public class EntityClientGadget extends EntityGadget { return configId; } - public GenshinPlayer getOwner() { + public Player getOwner() { return owner; } diff --git a/src/main/java/emu/grasscutter/game/entity/EntityGadget.java b/src/main/java/emu/grasscutter/game/entity/EntityGadget.java index 081c2fe3f..c09504c21 100644 --- a/src/main/java/emu/grasscutter/game/entity/EntityGadget.java +++ b/src/main/java/emu/grasscutter/game/entity/EntityGadget.java @@ -1,11 +1,11 @@ package emu.grasscutter.game.entity; -import emu.grasscutter.game.GenshinScene; -import emu.grasscutter.game.World; +import emu.grasscutter.game.world.Scene; +import emu.grasscutter.game.world.World; -public abstract class EntityGadget extends GenshinEntity { +public abstract class EntityGadget extends GameEntity { - public EntityGadget(GenshinScene scene) { + public EntityGadget(Scene scene) { super(scene); } diff --git a/src/main/java/emu/grasscutter/game/entity/EntityItem.java b/src/main/java/emu/grasscutter/game/entity/EntityItem.java index ebd8051e6..5b1e05fc7 100644 --- a/src/main/java/emu/grasscutter/game/entity/EntityItem.java +++ b/src/main/java/emu/grasscutter/game/entity/EntityItem.java @@ -1,12 +1,12 @@ package emu.grasscutter.game.entity; import emu.grasscutter.data.def.ItemData; -import emu.grasscutter.game.GenshinPlayer; -import emu.grasscutter.game.GenshinScene; -import emu.grasscutter.game.World; -import emu.grasscutter.game.inventory.GenshinItem; +import emu.grasscutter.game.inventory.GameItem; +import emu.grasscutter.game.player.Player; import emu.grasscutter.game.props.EntityIdType; import emu.grasscutter.game.props.PlayerProperty; +import emu.grasscutter.game.world.Scene; +import emu.grasscutter.game.world.World; import emu.grasscutter.net.proto.AbilitySyncStateInfoOuterClass.AbilitySyncStateInfo; import emu.grasscutter.net.proto.AnimatorParameterValueInfoPairOuterClass.AnimatorParameterValueInfoPair; import emu.grasscutter.net.proto.EntityAuthorityInfoOuterClass.EntityAuthorityInfo; @@ -28,16 +28,16 @@ public class EntityItem extends EntityGadget { private final Position pos; private final Position rot; - private final GenshinItem item; + private final GameItem item; private final long guid; - public EntityItem(GenshinScene scene, GenshinPlayer player, ItemData itemData, Position pos, int count) { + public EntityItem(Scene scene, Player player, ItemData itemData, Position pos, int count) { super(scene); this.id = getScene().getWorld().getNextEntityId(EntityIdType.GADGET); this.pos = new Position(pos); this.rot = new Position(); - this.guid = player.getNextGenshinGuid(); - this.item = new GenshinItem(itemData, count); + this.guid = player.getNextGameGuid(); + this.item = new GameItem(itemData, count); } @Override @@ -45,7 +45,7 @@ public class EntityItem extends EntityGadget { return this.id; } - private GenshinItem getItem() { + private GameItem getItem() { return this.item; } diff --git a/src/main/java/emu/grasscutter/game/entity/EntityMonster.java b/src/main/java/emu/grasscutter/game/entity/EntityMonster.java index a1900f5c9..b9f212fe1 100644 --- a/src/main/java/emu/grasscutter/game/entity/EntityMonster.java +++ b/src/main/java/emu/grasscutter/game/entity/EntityMonster.java @@ -1,14 +1,14 @@ package emu.grasscutter.game.entity; -import emu.grasscutter.data.GenshinData; +import emu.grasscutter.data.GameData; import emu.grasscutter.data.common.PropGrowCurve; import emu.grasscutter.data.def.MonsterCurveData; import emu.grasscutter.data.def.MonsterData; -import emu.grasscutter.game.GenshinScene; -import emu.grasscutter.game.World; import emu.grasscutter.game.props.EntityIdType; import emu.grasscutter.game.props.FightProperty; import emu.grasscutter.game.props.PlayerProperty; +import emu.grasscutter.game.world.Scene; +import emu.grasscutter.game.world.World; import emu.grasscutter.net.proto.AbilitySyncStateInfoOuterClass.AbilitySyncStateInfo; import emu.grasscutter.net.proto.AnimatorParameterValueInfoPairOuterClass.AnimatorParameterValueInfoPair; import emu.grasscutter.net.proto.EntityAuthorityInfoOuterClass.EntityAuthorityInfo; @@ -27,7 +27,7 @@ import emu.grasscutter.utils.ProtoHelper; import it.unimi.dsi.fastutil.ints.Int2FloatMap; import it.unimi.dsi.fastutil.ints.Int2FloatOpenHashMap; -public class EntityMonster extends GenshinEntity { +public class EntityMonster extends GameEntity { private final MonsterData monsterData; private final Int2FloatOpenHashMap fightProp; @@ -41,7 +41,7 @@ public class EntityMonster extends GenshinEntity { private int configId; private int poseId; - public EntityMonster(GenshinScene scene, MonsterData monsterData, Position pos, int level) { + public EntityMonster(Scene scene, MonsterData monsterData, Position pos, int level) { super(scene); this.id = getWorld().getNextEntityId(EntityIdType.MONSTER); this.monsterData = monsterData; @@ -160,7 +160,7 @@ public class EntityMonster extends GenshinEntity { this.setFightProperty(FightProperty.FIGHT_PROP_ICE_SUB_HURT, data.getIceSubHurt()); // Level curve - MonsterCurveData curve = GenshinData.getMonsterCurveDataMap().get(this.getLevel()); + MonsterCurveData curve = GameData.getMonsterCurveDataMap().get(this.getLevel()); if (curve != null) { for (PropGrowCurve growCurve : data.getPropGrowCurves()) { FightProperty prop = FightProperty.getPropByName(growCurve.getType()); diff --git a/src/main/java/emu/grasscutter/game/entity/GenshinEntity.java b/src/main/java/emu/grasscutter/game/entity/GameEntity.java similarity index 92% rename from src/main/java/emu/grasscutter/game/entity/GenshinEntity.java rename to src/main/java/emu/grasscutter/game/entity/GameEntity.java index c766f493c..aef3378b6 100644 --- a/src/main/java/emu/grasscutter/game/entity/GenshinEntity.java +++ b/src/main/java/emu/grasscutter/game/entity/GameEntity.java @@ -1,10 +1,10 @@ package emu.grasscutter.game.entity; -import emu.grasscutter.game.GenshinScene; -import emu.grasscutter.game.World; import emu.grasscutter.game.props.FightProperty; import emu.grasscutter.game.props.LifeState; +import emu.grasscutter.game.world.Scene; import emu.grasscutter.game.world.SpawnDataEntry; +import emu.grasscutter.game.world.World; import emu.grasscutter.net.proto.MotionInfoOuterClass.MotionInfo; import emu.grasscutter.net.proto.MotionStateOuterClass.MotionState; import emu.grasscutter.net.proto.SceneEntityInfoOuterClass.SceneEntityInfo; @@ -12,16 +12,16 @@ import emu.grasscutter.net.proto.VectorOuterClass.Vector; import emu.grasscutter.utils.Position; import it.unimi.dsi.fastutil.ints.Int2FloatOpenHashMap; -public abstract class GenshinEntity { +public abstract class GameEntity { protected int id; - private final GenshinScene scene; + private final Scene scene; private SpawnDataEntry spawnEntry; private MotionState moveState; private int lastMoveSceneTimeMs; private int lastMoveReliableSeq; - public GenshinEntity(GenshinScene scene) { + public GameEntity(Scene scene) { this.scene = scene; this.moveState = MotionState.MOTION_NONE; } @@ -34,7 +34,7 @@ public abstract class GenshinEntity { return this.getScene().getWorld(); } - public GenshinScene getScene() { + public Scene getScene() { return this.scene; } diff --git a/src/main/java/emu/grasscutter/game/friends/FriendsList.java b/src/main/java/emu/grasscutter/game/friends/FriendsList.java index c7756763c..de73ecb30 100644 --- a/src/main/java/emu/grasscutter/game/friends/FriendsList.java +++ b/src/main/java/emu/grasscutter/game/friends/FriendsList.java @@ -3,7 +3,7 @@ package emu.grasscutter.game.friends; import java.util.List; import emu.grasscutter.database.DatabaseHelper; -import emu.grasscutter.game.GenshinPlayer; +import emu.grasscutter.game.player.Player; import emu.grasscutter.net.proto.DealAddFriendResultTypeOuterClass.DealAddFriendResultType; import emu.grasscutter.server.packet.send.PacketAskAddFriendNotify; import emu.grasscutter.server.packet.send.PacketAskAddFriendRsp; @@ -14,20 +14,20 @@ import it.unimi.dsi.fastutil.ints.Int2ObjectMap; import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap; public class FriendsList { - private final GenshinPlayer player; + private final Player player; private final Int2ObjectMap<Friendship> friends; private final Int2ObjectMap<Friendship> pendingFriends; private boolean loaded = false; - public FriendsList(GenshinPlayer player) { + public FriendsList(Player player) { this.player = player; this.friends = new Int2ObjectOpenHashMap<Friendship>(); this.pendingFriends = new Int2ObjectOpenHashMap<Friendship>(); } - public GenshinPlayer getPlayer() { + public Player getPlayer() { return player; } @@ -83,7 +83,7 @@ public class FriendsList { return; } - GenshinPlayer target = getPlayer().getSession().getServer().getPlayerByUid(targetUid, true); + Player target = getPlayer().getSession().getServer().getPlayerByUid(targetUid, true); if (target == null) { return; // Should never happen } @@ -143,7 +143,7 @@ public class FriendsList { myFriendship.delete(); Friendship theirFriendship = null; - GenshinPlayer friend = myFriendship.getFriendProfile().getPlayer(); + Player friend = myFriendship.getFriendProfile().getPlayer(); if (friend != null) { // Friend online theirFriendship = friend.getFriendsList().getFriendById(this.getPlayer().getUid()); @@ -165,7 +165,7 @@ public class FriendsList { } public synchronized void sendFriendRequest(int targetUid) { - GenshinPlayer target = getPlayer().getSession().getServer().getPlayerByUid(targetUid, true); + Player target = getPlayer().getSession().getServer().getPlayerByUid(targetUid, true); if (target == null || target == this.getPlayer()) { return; @@ -220,7 +220,7 @@ public class FriendsList { friendship.setOwner(getPlayer()); // Check if friend is online - GenshinPlayer friend = getPlayer().getSession().getServer().getPlayerByUid(friendship.getFriendProfile().getUid()); + Player friend = getPlayer().getSession().getServer().getPlayerByUid(friendship.getFriendProfile().getUid()); if (friend != null) { // Set friend to online mode friendship.setFriendProfile(friend); diff --git a/src/main/java/emu/grasscutter/game/friends/Friendship.java b/src/main/java/emu/grasscutter/game/friends/Friendship.java index 81d219901..ef0bed109 100644 --- a/src/main/java/emu/grasscutter/game/friends/Friendship.java +++ b/src/main/java/emu/grasscutter/game/friends/Friendship.java @@ -5,7 +5,7 @@ import org.bson.types.ObjectId; import dev.morphia.annotations.*; import emu.grasscutter.database.DatabaseHelper; -import emu.grasscutter.game.GenshinPlayer; +import emu.grasscutter.game.player.Player; import emu.grasscutter.net.proto.FriendBriefOuterClass.FriendBrief; import emu.grasscutter.net.proto.FriendOnlineStateOuterClass.FriendOnlineState; import emu.grasscutter.net.proto.HeadImageOuterClass.HeadImage; @@ -14,7 +14,7 @@ import emu.grasscutter.net.proto.HeadImageOuterClass.HeadImage; public class Friendship { @Id private ObjectId id; - @Transient private GenshinPlayer owner; + @Transient private Player owner; @Indexed private int ownerId; @Indexed private int friendId; @@ -26,7 +26,7 @@ public class Friendship { @Deprecated // Morphia use only public Friendship() { } - public Friendship(GenshinPlayer owner, GenshinPlayer friend, GenshinPlayer asker) { + public Friendship(Player owner, Player friend, Player asker) { this.setOwner(owner); this.ownerId = owner.getUid(); this.friendId = friend.getUid(); @@ -34,11 +34,11 @@ public class Friendship { this.askerId = asker.getUid(); } - public GenshinPlayer getOwner() { + public Player getOwner() { return owner; } - public void setOwner(GenshinPlayer owner) { + public void setOwner(Player owner) { this.owner = owner; } @@ -70,7 +70,7 @@ public class Friendship { return profile; } - public void setFriendProfile(GenshinPlayer character) { + public void setFriendProfile(Player character) { if (character == null || this.friendId != character.getUid()) return; this.profile = character.getProfile(); } diff --git a/src/main/java/emu/grasscutter/game/friends/PlayerProfile.java b/src/main/java/emu/grasscutter/game/friends/PlayerProfile.java index 4af5f570e..8b39ec0f4 100644 --- a/src/main/java/emu/grasscutter/game/friends/PlayerProfile.java +++ b/src/main/java/emu/grasscutter/game/friends/PlayerProfile.java @@ -1,12 +1,12 @@ package emu.grasscutter.game.friends; import dev.morphia.annotations.*; -import emu.grasscutter.game.GenshinPlayer; +import emu.grasscutter.game.player.Player; import emu.grasscutter.utils.Utils; @Entity public class PlayerProfile { - @Transient private GenshinPlayer player; + @Transient private Player player; @AlsoLoad("id") private int uid; private int nameCard; @@ -22,7 +22,7 @@ public class PlayerProfile { @Deprecated // Morphia only public PlayerProfile() { } - public PlayerProfile(GenshinPlayer player) { + public PlayerProfile(Player player) { this.uid = player.getUid(); this.syncWithCharacter(player); } @@ -31,11 +31,11 @@ public class PlayerProfile { return uid; } - public GenshinPlayer getPlayer() { + public Player getPlayer() { return player; } - public synchronized void setPlayer(GenshinPlayer player) { + public synchronized void setPlayer(Player player) { this.player = player; } @@ -83,7 +83,7 @@ public class PlayerProfile { return this.getPlayer() != null; } - public void syncWithCharacter(GenshinPlayer player) { + public void syncWithCharacter(Player player) { if (player == null) { return; } diff --git a/src/main/java/emu/grasscutter/game/gacha/GachaManager.java b/src/main/java/emu/grasscutter/game/gacha/GachaManager.java index ffb68a1d7..fa26569e4 100644 --- a/src/main/java/emu/grasscutter/game/gacha/GachaManager.java +++ b/src/main/java/emu/grasscutter/game/gacha/GachaManager.java @@ -12,13 +12,13 @@ import com.google.gson.reflect.TypeToken; import com.sun.nio.file.SensitivityWatchEventModifier; import emu.grasscutter.Grasscutter; -import emu.grasscutter.data.GenshinData; +import emu.grasscutter.data.GameData; import emu.grasscutter.data.def.ItemData; -import emu.grasscutter.game.GenshinPlayer; -import emu.grasscutter.game.avatar.GenshinAvatar; -import emu.grasscutter.game.inventory.GenshinItem; +import emu.grasscutter.game.avatar.Avatar; +import emu.grasscutter.game.inventory.GameItem; import emu.grasscutter.game.inventory.ItemType; import emu.grasscutter.game.inventory.MaterialType; +import emu.grasscutter.game.player.Player; import emu.grasscutter.net.proto.GachaItemOuterClass.GachaItem; import emu.grasscutter.net.proto.GachaTransferItemOuterClass.GachaTransferItem; import emu.grasscutter.net.proto.GetGachaInfoRspOuterClass.GetGachaInfoRsp; @@ -89,7 +89,7 @@ public class GachaManager { } } - public synchronized void doPulls(GenshinPlayer player, int gachaType, int times) { + public synchronized void doPulls(Player player, int gachaType, int times) { // Sanity check if (times != 10 && times != 1) { return; @@ -108,7 +108,7 @@ public class GachaManager { // Spend currency if (banner.getCostItem() > 0) { - GenshinItem costItem = player.getInventory().getInventoryTab(ItemType.ITEM_MATERIAL).getItemById(banner.getCostItem()); + GameItem costItem = player.getInventory().getInventoryTab(ItemType.ITEM_MATERIAL).getItemById(banner.getCostItem()); if (costItem == null || costItem.getCount() < times) { return; } @@ -191,7 +191,7 @@ public class GachaManager { int stardust = 0, starglitter = 0; for (int itemId : wonItems) { - ItemData itemData = GenshinData.getItemDataMap().get(itemId); + ItemData itemData = GameData.getItemDataMap().get(itemId); if (itemData == null) { continue; } @@ -204,11 +204,11 @@ public class GachaManager { // Const check if (itemData.getMaterialType() == MaterialType.MATERIAL_AVATAR) { int avatarId = (itemData.getId() % 1000) + 10000000; - GenshinAvatar avatar = player.getAvatars().getAvatarById(avatarId); + Avatar avatar = player.getAvatars().getAvatarById(avatarId); if (avatar != null) { int constLevel = avatar.getCoreProudSkillLevel(); int constItemId = itemData.getId() + 100; - GenshinItem constItem = player.getInventory().getInventoryTab(ItemType.ITEM_MATERIAL).getItemById(constItemId); + GameItem constItem = player.getInventory().getInventoryTab(ItemType.ITEM_MATERIAL).getItemById(constItemId); if (constItem != null) { constLevel += constItem.getCount(); } @@ -249,7 +249,7 @@ public class GachaManager { } // Create item - GenshinItem item = new GenshinItem(itemData); + GameItem item = new GameItem(itemData); gachaItem.setGachaItem(item.toItemParam()); player.getInventory().addItem(item); diff --git a/src/main/java/emu/grasscutter/game/inventory/EquipInventoryTab.java b/src/main/java/emu/grasscutter/game/inventory/EquipInventoryTab.java index af33558c8..e1d6c062f 100644 --- a/src/main/java/emu/grasscutter/game/inventory/EquipInventoryTab.java +++ b/src/main/java/emu/grasscutter/game/inventory/EquipInventoryTab.java @@ -4,26 +4,26 @@ import java.util.HashSet; import java.util.Set; public class EquipInventoryTab implements InventoryTab { - private final Set<GenshinItem> items; + private final Set<GameItem> items; private final int maxCapacity; public EquipInventoryTab(int maxCapacity) { - this.items = new HashSet<GenshinItem>(); + this.items = new HashSet<GameItem>(); this.maxCapacity = maxCapacity; } @Override - public GenshinItem getItemById(int id) { + public GameItem getItemById(int id) { return null; } @Override - public void onAddItem(GenshinItem item) { + public void onAddItem(GameItem item) { this.items.add(item); } @Override - public void onRemoveItem(GenshinItem item) { + public void onRemoveItem(GameItem item) { this.items.remove(item); } diff --git a/src/main/java/emu/grasscutter/game/inventory/GenshinItem.java b/src/main/java/emu/grasscutter/game/inventory/GameItem.java similarity index 88% rename from src/main/java/emu/grasscutter/game/inventory/GenshinItem.java rename to src/main/java/emu/grasscutter/game/inventory/GameItem.java index 89c0e7169..8f3bef7f2 100644 --- a/src/main/java/emu/grasscutter/game/inventory/GenshinItem.java +++ b/src/main/java/emu/grasscutter/game/inventory/GameItem.java @@ -13,13 +13,13 @@ import dev.morphia.annotations.Indexed; import dev.morphia.annotations.PostLoad; import dev.morphia.annotations.Transient; -import emu.grasscutter.data.GenshinData; -import emu.grasscutter.data.GenshinDepot; +import emu.grasscutter.data.GameData; +import emu.grasscutter.data.GameDepot; import emu.grasscutter.data.def.ItemData; import emu.grasscutter.data.def.ReliquaryAffixData; import emu.grasscutter.data.def.ReliquaryMainPropData; import emu.grasscutter.database.DatabaseHelper; -import emu.grasscutter.game.GenshinPlayer; +import emu.grasscutter.game.player.Player; import emu.grasscutter.game.props.FightProperty; import emu.grasscutter.net.proto.AbilitySyncStateInfoOuterClass.AbilitySyncStateInfo; import emu.grasscutter.net.proto.EquipOuterClass.Equip; @@ -35,7 +35,7 @@ import emu.grasscutter.net.proto.WeaponOuterClass.Weapon; import emu.grasscutter.utils.WeightedList; @Entity(value = "items", useDiscriminator = false) -public class GenshinItem { +public class GameItem { @Id private ObjectId id; @Indexed private int ownerId; private int itemId; @@ -62,23 +62,23 @@ public class GenshinItem { private int equipCharacter; @Transient private int weaponEntityId; - public GenshinItem() { + public GameItem() { // Morphia only } - public GenshinItem(int itemId) { - this(GenshinData.getItemDataMap().get(itemId)); + public GameItem(int itemId) { + this(GameData.getItemDataMap().get(itemId)); } - public GenshinItem(int itemId, int count) { - this(GenshinData.getItemDataMap().get(itemId), count); + public GameItem(int itemId, int count) { + this(GameData.getItemDataMap().get(itemId), count); } - public GenshinItem(ItemData data) { + public GameItem(ItemData data) { this(data, 1); } - public GenshinItem(ItemData data, int count) { + public GameItem(ItemData data, int count) { this.itemId = data.getId(); this.itemData = data; @@ -103,7 +103,7 @@ public class GenshinItem { this.level = 1; this.appendPropIdList = new ArrayList<>(); // Create main property - ReliquaryMainPropData mainPropData = GenshinDepot.getRandomRelicMainProp(getItemData().getMainPropDepotId()); + ReliquaryMainPropData mainPropData = GameDepot.getRandomRelicMainProp(getItemData().getMainPropDepotId()); if (mainPropData != null) { this.mainPropId = mainPropData.getId(); } @@ -124,9 +124,9 @@ public class GenshinItem { return ownerId; } - public void setOwner(GenshinPlayer player) { + public void setOwner(Player player) { this.ownerId = player.getUid(); - this.guid = player.getNextGenshinGuid(); + this.guid = player.getNextGameGuid(); } public int getItemId() { return itemId; @@ -261,7 +261,7 @@ public class GenshinItem { } private void addNewAppendProp() { - List<ReliquaryAffixData> affixList = GenshinDepot.getRandomRelicAffixList(getItemData().getAppendPropDepotId()); + List<ReliquaryAffixData> affixList = GameDepot.getRandomRelicAffixList(getItemData().getAppendPropDepotId()); if (affixList == null) { return; @@ -269,13 +269,13 @@ public class GenshinItem { // Build blacklist - Dont add same stat as main/sub stat Set<FightProperty> blacklist = new HashSet<>(); - ReliquaryMainPropData mainPropData = GenshinData.getReliquaryMainPropDataMap().get(this.getMainPropId()); + ReliquaryMainPropData mainPropData = GameData.getReliquaryMainPropDataMap().get(this.getMainPropId()); if (mainPropData != null) { blacklist.add(mainPropData.getFightProp()); } int len = Math.min(4, this.getAppendPropIdList().size()); for (int i = 0; i < len; i++) { - ReliquaryAffixData affixData = GenshinData.getReliquaryAffixDataMap().get((int) this.getAppendPropIdList().get(i)); + ReliquaryAffixData affixData = GameData.getReliquaryAffixDataMap().get((int) this.getAppendPropIdList().get(i)); if (affixData != null) { blacklist.add(affixData.getFightProp()); } @@ -299,7 +299,7 @@ public class GenshinItem { } private void upgradeRandomAppendProp() { - List<ReliquaryAffixData> affixList = GenshinDepot.getRandomRelicAffixList(getItemData().getAppendPropDepotId()); + List<ReliquaryAffixData> affixList = GameDepot.getRandomRelicAffixList(getItemData().getAppendPropDepotId()); if (affixList == null) { return; @@ -309,7 +309,7 @@ public class GenshinItem { Set<FightProperty> whitelist = new HashSet<>(); int len = Math.min(4, this.getAppendPropIdList().size()); for (int i = 0; i < len; i++) { - ReliquaryAffixData affixData = GenshinData.getReliquaryAffixDataMap().get((int) this.getAppendPropIdList().get(i)); + ReliquaryAffixData affixData = GameData.getReliquaryAffixDataMap().get((int) this.getAppendPropIdList().get(i)); if (affixData != null) { whitelist.add(affixData.getFightProp()); } @@ -331,7 +331,7 @@ public class GenshinItem { @PostLoad public void onLoad() { if (this.itemData == null) { - this.itemData = GenshinData.getItemDataMap().get(getItemId()); + this.itemData = GameData.getItemDataMap().get(getItemId()); } } diff --git a/src/main/java/emu/grasscutter/game/inventory/Inventory.java b/src/main/java/emu/grasscutter/game/inventory/Inventory.java index 8954b1031..bb8dfad46 100644 --- a/src/main/java/emu/grasscutter/game/inventory/Inventory.java +++ b/src/main/java/emu/grasscutter/game/inventory/Inventory.java @@ -5,20 +5,22 @@ import java.util.Iterator; import java.util.LinkedList; import java.util.List; -import emu.grasscutter.GenshinConstants; +import emu.grasscutter.GameConstants; import emu.grasscutter.Grasscutter; -import emu.grasscutter.data.GenshinData; +import emu.grasscutter.data.GameData; import emu.grasscutter.data.def.AvatarCostumeData; import emu.grasscutter.data.def.AvatarData; import emu.grasscutter.data.def.AvatarFlycloakData; import emu.grasscutter.data.def.ItemData; import emu.grasscutter.database.DatabaseHelper; -import emu.grasscutter.game.GenshinPlayer; import emu.grasscutter.game.avatar.AvatarStorage; -import emu.grasscutter.game.avatar.GenshinAvatar; +import emu.grasscutter.game.avatar.Avatar; import emu.grasscutter.game.entity.EntityAvatar; +import emu.grasscutter.game.player.Player; +import emu.grasscutter.game.props.ActionReason; import emu.grasscutter.net.proto.ItemParamOuterClass.ItemParam; import emu.grasscutter.server.packet.send.PacketAvatarEquipChangeNotify; +import emu.grasscutter.server.packet.send.PacketItemAddHintNotify; import emu.grasscutter.server.packet.send.PacketStoreItemChangeNotify; import emu.grasscutter.server.packet.send.PacketStoreItemDelNotify; import it.unimi.dsi.fastutil.ints.Int2ObjectMap; @@ -26,13 +28,13 @@ import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap; import it.unimi.dsi.fastutil.longs.Long2ObjectMap; import it.unimi.dsi.fastutil.longs.Long2ObjectOpenHashMap; -public class Inventory implements Iterable<GenshinItem> { - private final GenshinPlayer player; +public class Inventory implements Iterable<GameItem> { + private final Player player; - private final Long2ObjectMap<GenshinItem> store; + private final Long2ObjectMap<GameItem> store; private final Int2ObjectMap<InventoryTab> inventoryTypes; - public Inventory(GenshinPlayer player) { + public Inventory(Player player) { this.player = player; this.store = new Long2ObjectOpenHashMap<>(); this.inventoryTypes = new Int2ObjectOpenHashMap<>(); @@ -43,7 +45,7 @@ public class Inventory implements Iterable<GenshinItem> { this.createInventoryTab(ItemType.ITEM_FURNITURE, new MaterialInventoryTab(Grasscutter.getConfig().getGameServerOptions().InventoryLimitFurniture)); } - public GenshinPlayer getPlayer() { + public Player getPlayer() { return player; } @@ -51,7 +53,7 @@ public class Inventory implements Iterable<GenshinItem> { return this.getPlayer().getAvatars(); } - public Long2ObjectMap<GenshinItem> getItems() { + public Long2ObjectMap<GameItem> getItems() { return store; } @@ -67,7 +69,7 @@ public class Inventory implements Iterable<GenshinItem> { this.getInventoryTypes().put(type.getValue(), tab); } - public GenshinItem getItemByGuid(long id) { + public GameItem getItemByGuid(long id) { return this.getItems().get(id); } @@ -76,19 +78,19 @@ public class Inventory implements Iterable<GenshinItem> { } public boolean addItem(int itemId, int count) { - ItemData itemData = GenshinData.getItemDataMap().get(itemId); + ItemData itemData = GameData.getItemDataMap().get(itemId); if (itemData == null) { return false; } - GenshinItem item = new GenshinItem(itemData, count); + GameItem item = new GameItem(itemData, count); return addItem(item); } - - public boolean addItem(GenshinItem item) { - GenshinItem result = putItem(item); + + public boolean addItem(GameItem item) { + GameItem result = putItem(item); if (result != null) { getPlayer().sendPacket(new PacketStoreItemChangeNotify(result)); @@ -98,34 +100,46 @@ public class Inventory implements Iterable<GenshinItem> { return false; } - public void addItems(Collection<GenshinItem> items) { - List<GenshinItem> changedItems = new LinkedList<>(); + public boolean addItem(GameItem item, ActionReason reason) { + boolean result = addItem(item); - for (GenshinItem item : items) { - GenshinItem result = putItem(item); + if (result && reason != null) { + getPlayer().sendPacket(new PacketItemAddHintNotify(item, reason)); + } + + return result; + } + + public void addItems(Collection<GameItem> items) { + this.addItems(items, null); + } + + public void addItems(Collection<GameItem> items, ActionReason reason) { + List<GameItem> changedItems = new LinkedList<>(); + + for (GameItem item : items) { + GameItem result = putItem(item); if (result != null) { changedItems.add(result); } } + if (changedItems.size() == 0) { + return; + } + + if (reason != null) { + getPlayer().sendPacket(new PacketItemAddHintNotify(changedItems, reason)); + } + getPlayer().sendPacket(new PacketStoreItemChangeNotify(changedItems)); } public void addItemParams(Collection<ItemParam> items) { - List<GenshinItem> changedItems = new LinkedList<>(); - - for (ItemParam itemParam : items) { - GenshinItem toAdd = new GenshinItem(itemParam.getItemId(), itemParam.getCount()); - GenshinItem result = putItem(toAdd); - if (result != null) { - changedItems.add(result); - } - } - - getPlayer().sendPacket(new PacketStoreItemChangeNotify(changedItems)); + addItems(items.stream().map(param -> new GameItem(param.getItemId(), param.getCount())).toList(), null); } - private synchronized GenshinItem putItem(GenshinItem item) { + private synchronized GameItem putItem(GameItem item) { // Dont add items that dont have a valid item definition. if (item.getItemData() == null) { return null; @@ -149,23 +163,23 @@ public class Inventory implements Iterable<GenshinItem> { // Get avatar id int avatarId = (item.getItemId() % 1000) + 10000000; // Dont let people give themselves extra main characters - if (avatarId == GenshinConstants.MAIN_CHARACTER_MALE || avatarId == GenshinConstants.MAIN_CHARACTER_FEMALE) { + if (avatarId == GameConstants.MAIN_CHARACTER_MALE || avatarId == GameConstants.MAIN_CHARACTER_FEMALE) { return null; } // Add avatar - AvatarData avatarData = GenshinData.getAvatarDataMap().get(avatarId); + AvatarData avatarData = GameData.getAvatarDataMap().get(avatarId); if (avatarData != null && !player.getAvatars().hasAvatar(avatarId)) { - this.getPlayer().addAvatar(new GenshinAvatar(avatarData)); + this.getPlayer().addAvatar(new Avatar(avatarData)); } return null; } else if (item.getItemData().getMaterialType() == MaterialType.MATERIAL_FLYCLOAK) { - AvatarFlycloakData flycloakData = GenshinData.getAvatarFlycloakDataMap().get(item.getItemId()); + AvatarFlycloakData flycloakData = GameData.getAvatarFlycloakDataMap().get(item.getItemId()); if (flycloakData != null && !player.getFlyCloakList().contains(item.getItemId())) { getPlayer().addFlycloak(item.getItemId()); } return null; } else if (item.getItemData().getMaterialType() == MaterialType.MATERIAL_COSTUME) { - AvatarCostumeData costumeData = GenshinData.getAvatarCostumeDataItemIdMap().get(item.getItemId()); + AvatarCostumeData costumeData = GameData.getAvatarCostumeDataItemIdMap().get(item.getItemId()); if (costumeData != null && !player.getCostumeList().contains(costumeData.getId())) { getPlayer().addCostume(costumeData.getId()); } @@ -176,7 +190,7 @@ public class Inventory implements Iterable<GenshinItem> { } return null; } else if (tab != null) { - GenshinItem existingItem = tab.getItemById(item.getItemId()); + GameItem existingItem = tab.getItemById(item.getItemId()); if (existingItem == null) { // Item type didnt exist before, we will add it to main inventory map if there is enough space if (tab.getSize() >= tab.getMaxCapacity()) { @@ -199,7 +213,7 @@ public class Inventory implements Iterable<GenshinItem> { return item; } - private synchronized void putItem(GenshinItem item, InventoryTab tab) { + private synchronized void putItem(GameItem item, InventoryTab tab) { // Set owner and guid FIRST! item.setOwner(getPlayer()); // Put in item store @@ -228,9 +242,9 @@ public class Inventory implements Iterable<GenshinItem> { } } - public void removeItems(List<GenshinItem> items) { + public void removeItems(List<GameItem> items) { // TODO Bulk delete - for (GenshinItem item : items) { + for (GameItem item : items) { this.removeItem(item, item.getCount()); } } @@ -240,7 +254,7 @@ public class Inventory implements Iterable<GenshinItem> { } public synchronized boolean removeItem(long guid, int count) { - GenshinItem item = this.getItemByGuid(guid); + GameItem item = this.getItemByGuid(guid); if (item == null) { return false; @@ -249,11 +263,11 @@ public class Inventory implements Iterable<GenshinItem> { return removeItem(item, count); } - public synchronized boolean removeItem(GenshinItem item) { + public synchronized boolean removeItem(GameItem item) { return removeItem(item, item.getCount()); } - public synchronized boolean removeItem(GenshinItem item, int count) { + public synchronized boolean removeItem(GameItem item, int count) { // Sanity check if (count <= 0 || item == null) { return false; @@ -282,7 +296,7 @@ public class Inventory implements Iterable<GenshinItem> { return true; } - private void deleteItem(GenshinItem item, InventoryTab tab) { + private void deleteItem(GameItem item, InventoryTab tab) { getItems().remove(item.getGuid()); if (tab != null) { tab.onRemoveItem(item); @@ -290,8 +304,8 @@ public class Inventory implements Iterable<GenshinItem> { } public boolean equipItem(long avatarGuid, long equipGuid) { - GenshinAvatar avatar = getPlayer().getAvatars().getAvatarByGuid(avatarGuid); - GenshinItem item = this.getItemByGuid(equipGuid); + Avatar avatar = getPlayer().getAvatars().getAvatarByGuid(avatarGuid); + GameItem item = this.getItemByGuid(equipGuid); if (avatar != null && item != null) { return avatar.equipItem(item, true); @@ -301,7 +315,7 @@ public class Inventory implements Iterable<GenshinItem> { } public boolean unequipItem(long avatarGuid, int slot) { - GenshinAvatar avatar = getPlayer().getAvatars().getAvatarByGuid(avatarGuid); + Avatar avatar = getPlayer().getAvatars().getAvatarByGuid(avatarGuid); EquipType equipType = EquipType.getTypeByValue(slot); if (avatar != null && equipType != EquipType.EQUIP_WEAPON) { @@ -316,15 +330,15 @@ public class Inventory implements Iterable<GenshinItem> { } public void loadFromDatabase() { - List<GenshinItem> items = DatabaseHelper.getInventoryItems(getPlayer()); + List<GameItem> items = DatabaseHelper.getInventoryItems(getPlayer()); - for (GenshinItem item : items) { + for (GameItem item : items) { // Should never happen if (item.getObjectId() == null) { continue; } - ItemData itemData = GenshinData.getItemDataMap().get(item.getItemId()); + ItemData itemData = GameData.getItemDataMap().get(item.getItemId()); if (itemData == null) { continue; } @@ -340,7 +354,7 @@ public class Inventory implements Iterable<GenshinItem> { // Equip to a character if possible if (item.isEquipped()) { - GenshinAvatar avatar = getPlayer().getAvatars().getAvatarById(item.getEquipCharacter()); + Avatar avatar = getPlayer().getAvatars().getAvatarById(item.getEquipCharacter()); boolean hasEquipped = false; if (avatar != null) { @@ -356,7 +370,7 @@ public class Inventory implements Iterable<GenshinItem> { } @Override - public Iterator<GenshinItem> iterator() { + public Iterator<GameItem> iterator() { return this.getItems().values().iterator(); } } diff --git a/src/main/java/emu/grasscutter/game/inventory/InventoryTab.java b/src/main/java/emu/grasscutter/game/inventory/InventoryTab.java index 72099642b..465c3cffa 100644 --- a/src/main/java/emu/grasscutter/game/inventory/InventoryTab.java +++ b/src/main/java/emu/grasscutter/game/inventory/InventoryTab.java @@ -1,11 +1,11 @@ package emu.grasscutter.game.inventory; public interface InventoryTab { - public GenshinItem getItemById(int id); + public GameItem getItemById(int id); - public void onAddItem(GenshinItem item); + public void onAddItem(GameItem item); - public void onRemoveItem(GenshinItem item); + public void onRemoveItem(GameItem item); public int getSize(); diff --git a/src/main/java/emu/grasscutter/game/inventory/MaterialInventoryTab.java b/src/main/java/emu/grasscutter/game/inventory/MaterialInventoryTab.java index f5ebfc5d7..7cea186db 100644 --- a/src/main/java/emu/grasscutter/game/inventory/MaterialInventoryTab.java +++ b/src/main/java/emu/grasscutter/game/inventory/MaterialInventoryTab.java @@ -4,7 +4,7 @@ import it.unimi.dsi.fastutil.ints.Int2ObjectMap; import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap; public class MaterialInventoryTab implements InventoryTab { - private final Int2ObjectMap<GenshinItem> items; + private final Int2ObjectMap<GameItem> items; private final int maxCapacity; public MaterialInventoryTab(int maxCapacity) { @@ -13,17 +13,17 @@ public class MaterialInventoryTab implements InventoryTab { } @Override - public GenshinItem getItemById(int id) { + public GameItem getItemById(int id) { return this.items.get(id); } @Override - public void onAddItem(GenshinItem item) { + public void onAddItem(GameItem item) { this.items.put(item.getItemId(), item); } @Override - public void onRemoveItem(GenshinItem item) { + public void onRemoveItem(GameItem item) { this.items.remove(item.getItemId()); } diff --git a/src/main/java/emu/grasscutter/game/mail/Mail.java b/src/main/java/emu/grasscutter/game/mail/Mail.java new file mode 100644 index 000000000..19fd79adc --- /dev/null +++ b/src/main/java/emu/grasscutter/game/mail/Mail.java @@ -0,0 +1,96 @@ +package emu.grasscutter.game.mail; + +import dev.morphia.annotations.Entity; +import emu.grasscutter.game.player.Player; + +import java.time.Instant; +import java.util.ArrayList; +import java.util.List; + +@Entity +public class Mail { + + public MailContent mailContent; + public List<MailItem> itemList; + public long sendTime; + public long expireTime; + public int importance; + public boolean isRead; + public boolean isAttachmentGot; + public int stateValue; + + public Mail() { + this(new MailContent(), new ArrayList<MailItem>(), (int) Instant.now().getEpochSecond() + 604800); // TODO: add expire time to send mail command + } + + public Mail(MailContent mailContent, List<MailItem> itemList, long expireTime) { + this(mailContent, itemList, expireTime, 0); + } + + public Mail(MailContent mailContent, List<MailItem> itemList, long expireTime, int importance) { + this(mailContent, itemList, expireTime, importance, 1); + } + + public Mail(MailContent mailContent, List<MailItem> itemList, long expireTime, int importance, int state) { + this.mailContent = mailContent; + this.itemList = itemList; + this.sendTime = (int) Instant.now().getEpochSecond(); + this.expireTime = expireTime; + this.importance = importance; // Starred mail, 0 = No star, 1 = Star. + this.isRead = false; + this.isAttachmentGot = false; + this.stateValue = state; // Different mailboxes, 1 = Default, 3 = Gift-box. + } + + @Entity + public static class MailContent { + public String title; + public String content; + public String sender; + + public MailContent() { + this.title = ""; + this.content = "loading..."; + this.sender = "loading"; + } + + public MailContent(String title, String content) { + this(title, content, "Server"); + } + + public MailContent(String title, String content, Player sender) { + this(title, content, sender.getNickname()); + } + + public MailContent(String title, String content, String sender) { + this.title = title; + this.content = content; + this.sender = sender; + } + } + + @Entity + public static class MailItem { + public int itemId; + public int itemCount; + public int itemLevel; + + public MailItem() { + this.itemId = 11101; + this.itemCount = 1; + this.itemLevel = 1; + } + + public MailItem(int itemId) { + this(itemId, 1); + } + + public MailItem(int itemId, int itemCount) { this(itemId, itemCount, 1); } + + public MailItem(int itemId, int itemCount, int itemLevel) { + this.itemId = itemId; + this.itemCount = itemCount; + this.itemLevel = itemLevel; + } + } +} diff --git a/src/main/java/emu/grasscutter/game/managers/ChatManager.java b/src/main/java/emu/grasscutter/game/managers/ChatManager.java index d9867e875..ababbf2e1 100644 --- a/src/main/java/emu/grasscutter/game/managers/ChatManager.java +++ b/src/main/java/emu/grasscutter/game/managers/ChatManager.java @@ -1,8 +1,8 @@ package emu.grasscutter.game.managers; import emu.grasscutter.command.CommandMap; -import emu.grasscutter.game.GenshinPlayer; -import emu.grasscutter.net.packet.GenshinPacket; +import emu.grasscutter.game.player.Player; +import emu.grasscutter.net.packet.BasePacket; import emu.grasscutter.server.game.GameServer; import emu.grasscutter.server.packet.send.PacketPlayerChatNotify; import emu.grasscutter.server.packet.send.PacketPrivateChatNotify; @@ -23,7 +23,7 @@ public class ChatManager { return server; } - public void sendPrivateMessage(GenshinPlayer player, int targetUid, String message) { + public void sendPrivateMessage(Player player, int targetUid, String message) { // Sanity checks if (message == null || message.length() == 0) { return; @@ -36,35 +36,35 @@ public class ChatManager { } // Get target - GenshinPlayer target = getServer().getPlayerByUid(targetUid); + Player target = getServer().getPlayerByUid(targetUid); if (target == null) { return; } // Create chat packet - GenshinPacket packet = new PacketPrivateChatNotify(player.getUid(), target.getUid(), message); + BasePacket packet = new PacketPrivateChatNotify(player.getUid(), target.getUid(), message); player.sendPacket(packet); target.sendPacket(packet); } - public void sendPrivateMessage(GenshinPlayer player, int targetUid, int emote) { + public void sendPrivateMessage(Player player, int targetUid, int emote) { // Get target - GenshinPlayer target = getServer().getPlayerByUid(targetUid); + Player target = getServer().getPlayerByUid(targetUid); if (target == null) { return; } // Create chat packet - GenshinPacket packet = new PacketPrivateChatNotify(player.getUid(), target.getUid(), emote); + BasePacket packet = new PacketPrivateChatNotify(player.getUid(), target.getUid(), emote); player.sendPacket(packet); target.sendPacket(packet); } - public void sendTeamMessage(GenshinPlayer player, int channel, String message) { + public void sendTeamMessage(Player player, int channel, String message) { // Sanity checks if (message == null || message.length() == 0) { return; @@ -80,7 +80,7 @@ public class ChatManager { player.getWorld().broadcastPacket(new PacketPlayerChatNotify(player, channel, message)); } - public void sendTeamMessage(GenshinPlayer player, int channel, int icon) { + public void sendTeamMessage(Player player, int channel, int icon) { // Create and send chat packet player.getWorld().broadcastPacket(new PacketPlayerChatNotify(player, channel, icon)); } diff --git a/src/main/java/emu/grasscutter/game/managers/InventoryManager.java b/src/main/java/emu/grasscutter/game/managers/InventoryManager.java index 4b71db904..904d2cbdd 100644 --- a/src/main/java/emu/grasscutter/game/managers/InventoryManager.java +++ b/src/main/java/emu/grasscutter/game/managers/InventoryManager.java @@ -5,7 +5,7 @@ import java.util.List; import java.util.Map; import java.util.stream.Collectors; -import emu.grasscutter.data.GenshinData; +import emu.grasscutter.data.GameData; import emu.grasscutter.data.common.ItemParamData; import emu.grasscutter.data.custom.OpenConfigEntry; import emu.grasscutter.data.def.AvatarPromoteData; @@ -15,11 +15,11 @@ import emu.grasscutter.data.def.WeaponPromoteData; import emu.grasscutter.data.def.AvatarSkillDepotData.InherentProudSkillOpens; import emu.grasscutter.data.def.AvatarTalentData; import emu.grasscutter.data.def.ProudSkillData; -import emu.grasscutter.game.GenshinPlayer; -import emu.grasscutter.game.avatar.GenshinAvatar; -import emu.grasscutter.game.inventory.GenshinItem; +import emu.grasscutter.game.avatar.Avatar; +import emu.grasscutter.game.inventory.GameItem; import emu.grasscutter.game.inventory.ItemType; import emu.grasscutter.game.inventory.MaterialType; +import emu.grasscutter.game.player.Player; import emu.grasscutter.net.proto.ItemParamOuterClass.ItemParam; import emu.grasscutter.net.proto.MaterialInfoOuterClass.MaterialInfo; import emu.grasscutter.server.game.GameServer; @@ -72,8 +72,8 @@ public class InventoryManager { return server; } - public void lockEquip(GenshinPlayer player, long targetEquipGuid, boolean isLocked) { - GenshinItem equip = player.getInventory().getItemByGuid(targetEquipGuid); + public void lockEquip(Player player, long targetEquipGuid, boolean isLocked) { + GameItem equip = player.getInventory().getItemByGuid(targetEquipGuid); if (equip == null || !equip.getItemData().isEquip()) { return; @@ -86,8 +86,8 @@ public class InventoryManager { player.sendPacket(new PacketSetEquipLockStateRsp(equip)); } - public void upgradeRelic(GenshinPlayer player, long targetGuid, List<Long> foodRelicList, List<ItemParam> list) { - GenshinItem relic = player.getInventory().getItemByGuid(targetGuid); + public void upgradeRelic(Player player, long targetGuid, List<Long> foodRelicList, List<ItemParam> list) { + GameItem relic = player.getInventory().getItemByGuid(targetGuid); if (relic == null || relic.getItemType() != ItemType.ITEM_RELIQUARY) { return; @@ -98,7 +98,7 @@ public class InventoryManager { for (long guid : foodRelicList) { // Add to delete queue - GenshinItem food = player.getInventory().getItemByGuid(guid); + GameItem food = player.getInventory().getItemByGuid(guid); if (food == null || !food.isDestroyable()) { continue; } @@ -111,7 +111,7 @@ public class InventoryManager { } } for (ItemParam itemParam : list) { - GenshinItem food = player.getInventory().getInventoryTab(ItemType.ITEM_MATERIAL).getItemById(itemParam.getItemId()); + GameItem food = player.getInventory().getInventoryTab(ItemType.ITEM_MATERIAL).getItemById(itemParam.getItemId()); if (food == null || food.getItemData().getMaterialType() != MaterialType.MATERIAL_RELIQUARY_MATERIAL) { continue; } @@ -139,14 +139,14 @@ public class InventoryManager { // Consume food items for (long guid : foodRelicList) { - GenshinItem food = player.getInventory().getItemByGuid(guid); + GameItem food = player.getInventory().getItemByGuid(guid); if (food == null || !food.isDestroyable()) { continue; } player.getInventory().removeItem(food); } for (ItemParam itemParam : list) { - GenshinItem food = player.getInventory().getInventoryTab(ItemType.ITEM_MATERIAL).getItemById(itemParam.getItemId()); + GameItem food = player.getInventory().getInventoryTab(ItemType.ITEM_MATERIAL).getItemById(itemParam.getItemId()); if (food == null || food.getItemData().getMaterialType() != MaterialType.MATERIAL_RELIQUARY_MATERIAL) { continue; } @@ -169,7 +169,7 @@ public class InventoryManager { int oldLevel = level; int exp = relic.getExp(); int totalExp = relic.getTotalExp(); - int reqExp = GenshinData.getRelicExpRequired(relic.getItemData().getRankLevel(), level); + int reqExp = GameData.getRelicExpRequired(relic.getItemData().getRankLevel(), level); int upgrades = 0; List<Integer> oldAppendPropIdList = relic.getAppendPropIdList(); @@ -189,7 +189,7 @@ public class InventoryManager { upgrades += 1; } // Set req exp - reqExp = GenshinData.getRelicExpRequired(relic.getItemData().getRankLevel(), level); + reqExp = GameData.getRelicExpRequired(relic.getItemData().getRankLevel(), level); } } @@ -209,7 +209,7 @@ public class InventoryManager { // Avatar if (oldLevel != level) { - GenshinAvatar avatar = relic.getEquipCharacter() > 0 ? player.getAvatars().getAvatarById(relic.getEquipCharacter()) : null; + Avatar avatar = relic.getEquipCharacter() > 0 ? player.getAvatars().getAvatarById(relic.getEquipCharacter()) : null; if (avatar != null) { avatar.recalcStats(); } @@ -220,15 +220,15 @@ public class InventoryManager { player.sendPacket(new PacketReliquaryUpgradeRsp(relic, rate, oldLevel, oldAppendPropIdList)); } - public List<ItemParam> calcWeaponUpgradeReturnItems(GenshinPlayer player, long targetGuid, List<Long> foodWeaponGuidList, List<ItemParam> itemParamList) { - GenshinItem weapon = player.getInventory().getItemByGuid(targetGuid); + public List<ItemParam> calcWeaponUpgradeReturnItems(Player player, long targetGuid, List<Long> foodWeaponGuidList, List<ItemParam> itemParamList) { + GameItem weapon = player.getInventory().getItemByGuid(targetGuid); // Sanity checks if (weapon == null || weapon.getItemType() != ItemType.ITEM_WEAPON) { return null; } - WeaponPromoteData promoteData = GenshinData.getWeaponPromoteData(weapon.getItemData().getWeaponPromoteId(), weapon.getPromoteLevel()); + WeaponPromoteData promoteData = GameData.getWeaponPromoteData(weapon.getItemData().getWeaponPromoteId(), weapon.getPromoteLevel()); if (promoteData == null) { return null; } @@ -236,7 +236,7 @@ public class InventoryManager { // Get exp gain int expGain = 0; for (long guid : foodWeaponGuidList) { - GenshinItem food = player.getInventory().getItemByGuid(guid); + GameItem food = player.getInventory().getItemByGuid(guid); if (food == null) { continue; } @@ -246,7 +246,7 @@ public class InventoryManager { } } for (ItemParam param : itemParamList) { - GenshinItem food = player.getInventory().getInventoryTab(ItemType.ITEM_MATERIAL).getItemById(param.getItemId()); + GameItem food = player.getInventory().getInventoryTab(ItemType.ITEM_MATERIAL).getItemById(param.getItemId()); if (food == null || food.getItemData().getMaterialType() != MaterialType.MATERIAL_WEAPON_EXP_STONE) { continue; } @@ -264,7 +264,7 @@ public class InventoryManager { int maxLevel = promoteData.getUnlockMaxLevel(); int level = weapon.getLevel(); int exp = weapon.getExp(); - int reqExp = GenshinData.getWeaponExpRequired(weapon.getItemData().getRankLevel(), level); + int reqExp = GameData.getWeaponExpRequired(weapon.getItemData().getRankLevel(), level); while (expGain > 0 && reqExp > 0 && level < maxLevel) { // Do calculations @@ -277,7 +277,7 @@ public class InventoryManager { exp = 0; level += 1; // Set req exp - reqExp = GenshinData.getWeaponExpRequired(weapon.getItemData().getRankLevel(), level); + reqExp = GameData.getWeaponExpRequired(weapon.getItemData().getRankLevel(), level); } } @@ -285,15 +285,15 @@ public class InventoryManager { } - public void upgradeWeapon(GenshinPlayer player, long targetGuid, List<Long> foodWeaponGuidList, List<ItemParam> itemParamList) { - GenshinItem weapon = player.getInventory().getItemByGuid(targetGuid); + public void upgradeWeapon(Player player, long targetGuid, List<Long> foodWeaponGuidList, List<ItemParam> itemParamList) { + GameItem weapon = player.getInventory().getItemByGuid(targetGuid); // Sanity checks if (weapon == null || weapon.getItemType() != ItemType.ITEM_WEAPON) { return; } - WeaponPromoteData promoteData = GenshinData.getWeaponPromoteData(weapon.getItemData().getWeaponPromoteId(), weapon.getPromoteLevel()); + WeaponPromoteData promoteData = GameData.getWeaponPromoteData(weapon.getItemData().getWeaponPromoteId(), weapon.getPromoteLevel()); if (promoteData == null) { return; } @@ -302,7 +302,7 @@ public class InventoryManager { int expGain = 0, moraCost = 0; for (long guid : foodWeaponGuidList) { - GenshinItem food = player.getInventory().getItemByGuid(guid); + GameItem food = player.getInventory().getItemByGuid(guid); if (food == null || !food.isDestroyable()) { continue; } @@ -313,7 +313,7 @@ public class InventoryManager { } } for (ItemParam param : itemParamList) { - GenshinItem food = player.getInventory().getInventoryTab(ItemType.ITEM_MATERIAL).getItemById(param.getItemId()); + GameItem food = player.getInventory().getInventoryTab(ItemType.ITEM_MATERIAL).getItemById(param.getItemId()); if (food == null || food.getItemData().getMaterialType() != MaterialType.MATERIAL_WEAPON_EXP_STONE) { continue; } @@ -344,14 +344,14 @@ public class InventoryManager { // Consume weapon/items used to feed for (long guid : foodWeaponGuidList) { - GenshinItem food = player.getInventory().getItemByGuid(guid); + GameItem food = player.getInventory().getItemByGuid(guid); if (food == null || !food.isDestroyable()) { continue; } player.getInventory().removeItem(food); } for (ItemParam param : itemParamList) { - GenshinItem food = player.getInventory().getInventoryTab(ItemType.ITEM_MATERIAL).getItemById(param.getItemId()); + GameItem food = player.getInventory().getInventoryTab(ItemType.ITEM_MATERIAL).getItemById(param.getItemId()); if (food == null || food.getItemData().getMaterialType() != MaterialType.MATERIAL_WEAPON_EXP_STONE) { continue; } @@ -365,7 +365,7 @@ public class InventoryManager { int oldLevel = level; int exp = weapon.getExp(); int totalExp = weapon.getTotalExp(); - int reqExp = GenshinData.getWeaponExpRequired(weapon.getItemData().getRankLevel(), level); + int reqExp = GameData.getWeaponExpRequired(weapon.getItemData().getRankLevel(), level); while (expGain > 0 && reqExp > 0 && level < maxLevel) { // Do calculations @@ -379,7 +379,7 @@ public class InventoryManager { exp = 0; level += 1; // Set req exp - reqExp = GenshinData.getWeaponExpRequired(weapon.getItemData().getRankLevel(), level); + reqExp = GameData.getWeaponExpRequired(weapon.getItemData().getRankLevel(), level); } } @@ -393,7 +393,7 @@ public class InventoryManager { // Avatar if (oldLevel != level) { - GenshinAvatar avatar = weapon.getEquipCharacter() > 0 ? player.getAvatars().getAvatarById(weapon.getEquipCharacter()) : null; + Avatar avatar = weapon.getEquipCharacter() > 0 ? player.getAvatars().getAvatarById(weapon.getEquipCharacter()) : null; if (avatar != null) { avatar.recalcStats(); } @@ -429,9 +429,9 @@ public class InventoryManager { return leftoverOreList; } - public void refineWeapon(GenshinPlayer player, long targetGuid, long feedGuid) { - GenshinItem weapon = player.getInventory().getItemByGuid(targetGuid); - GenshinItem feed = player.getInventory().getItemByGuid(feedGuid); + public void refineWeapon(Player player, long targetGuid, long feedGuid) { + GameItem weapon = player.getInventory().getItemByGuid(targetGuid); + GameItem feed = player.getInventory().getItemByGuid(feedGuid); // Sanity checks if (weapon == null || feed == null || !feed.isDestroyable()) { @@ -478,7 +478,7 @@ public class InventoryManager { weapon.save(); // Avatar - GenshinAvatar avatar = weapon.getEquipCharacter() > 0 ? player.getAvatars().getAvatarById(weapon.getEquipCharacter()) : null; + Avatar avatar = weapon.getEquipCharacter() > 0 ? player.getAvatars().getAvatarById(weapon.getEquipCharacter()) : null; if (avatar != null) { avatar.recalcStats(); } @@ -488,16 +488,16 @@ public class InventoryManager { player.sendPacket(new PacketWeaponAwakenRsp(avatar, weapon, feed, oldRefineLevel)); } - public void promoteWeapon(GenshinPlayer player, long targetGuid) { - GenshinItem weapon = player.getInventory().getItemByGuid(targetGuid); + public void promoteWeapon(Player player, long targetGuid) { + GameItem weapon = player.getInventory().getItemByGuid(targetGuid); if (weapon == null || weapon.getItemType() != ItemType.ITEM_WEAPON) { return; } int nextPromoteLevel = weapon.getPromoteLevel() + 1; - WeaponPromoteData currentPromoteData = GenshinData.getWeaponPromoteData(weapon.getItemData().getWeaponPromoteId(), weapon.getPromoteLevel()); - WeaponPromoteData nextPromoteData = GenshinData.getWeaponPromoteData(weapon.getItemData().getWeaponPromoteId(), nextPromoteLevel); + WeaponPromoteData currentPromoteData = GameData.getWeaponPromoteData(weapon.getItemData().getWeaponPromoteId(), weapon.getPromoteLevel()); + WeaponPromoteData nextPromoteData = GameData.getWeaponPromoteData(weapon.getItemData().getWeaponPromoteId(), nextPromoteLevel); if (currentPromoteData == null || nextPromoteData == null) { return; } @@ -509,7 +509,7 @@ public class InventoryManager { // Make sure player has promote items for (ItemParamData cost : nextPromoteData.getCostItems()) { - GenshinItem feedItem = player.getInventory().getInventoryTab(ItemType.ITEM_MATERIAL).getItemById(cost.getId()); + GameItem feedItem = player.getInventory().getInventoryTab(ItemType.ITEM_MATERIAL).getItemById(cost.getId()); if (feedItem == null || feedItem.getCount() < cost.getCount()) { return; } @@ -524,7 +524,7 @@ public class InventoryManager { // Consume promote filler items for (ItemParamData cost : nextPromoteData.getCostItems()) { - GenshinItem feedItem = player.getInventory().getInventoryTab(ItemType.ITEM_MATERIAL).getItemById(cost.getId()); + GameItem feedItem = player.getInventory().getInventoryTab(ItemType.ITEM_MATERIAL).getItemById(cost.getId()); player.getInventory().removeItem(feedItem, cost.getCount()); } @@ -533,7 +533,7 @@ public class InventoryManager { weapon.save(); // Avatar - GenshinAvatar avatar = weapon.getEquipCharacter() > 0 ? player.getAvatars().getAvatarById(weapon.getEquipCharacter()) : null; + Avatar avatar = weapon.getEquipCharacter() > 0 ? player.getAvatars().getAvatarById(weapon.getEquipCharacter()) : null; if (avatar != null) { avatar.recalcStats(); } @@ -543,8 +543,8 @@ public class InventoryManager { player.sendPacket(new PacketWeaponPromoteRsp(weapon, oldPromoteLevel)); } - public void promoteAvatar(GenshinPlayer player, long guid) { - GenshinAvatar avatar = player.getAvatars().getAvatarByGuid(guid); + public void promoteAvatar(Player player, long guid) { + Avatar avatar = player.getAvatars().getAvatarByGuid(guid); // Sanity checks if (avatar == null) { @@ -552,8 +552,8 @@ public class InventoryManager { } int nextPromoteLevel = avatar.getPromoteLevel() + 1; - AvatarPromoteData currentPromoteData = GenshinData.getAvatarPromoteData(avatar.getAvatarData().getAvatarPromoteId(), avatar.getPromoteLevel()); - AvatarPromoteData nextPromoteData = GenshinData.getAvatarPromoteData(avatar.getAvatarData().getAvatarPromoteId(), nextPromoteLevel); + AvatarPromoteData currentPromoteData = GameData.getAvatarPromoteData(avatar.getAvatarData().getAvatarPromoteId(), avatar.getPromoteLevel()); + AvatarPromoteData nextPromoteData = GameData.getAvatarPromoteData(avatar.getAvatarData().getAvatarPromoteId(), nextPromoteLevel); if (currentPromoteData == null || nextPromoteData == null) { return; } @@ -565,7 +565,7 @@ public class InventoryManager { // Make sure player has cost items for (ItemParamData cost : nextPromoteData.getCostItems()) { - GenshinItem feedItem = player.getInventory().getInventoryTab(ItemType.ITEM_MATERIAL).getItemById(cost.getId()); + GameItem feedItem = player.getInventory().getInventoryTab(ItemType.ITEM_MATERIAL).getItemById(cost.getId()); if (feedItem == null || feedItem.getCount() < cost.getCount()) { return; } @@ -580,7 +580,7 @@ public class InventoryManager { // Consume promote filler items for (ItemParamData cost : nextPromoteData.getCostItems()) { - GenshinItem feedItem = player.getInventory().getInventoryTab(ItemType.ITEM_MATERIAL).getItemById(cost.getId()); + GameItem feedItem = player.getInventory().getInventoryTab(ItemType.ITEM_MATERIAL).getItemById(cost.getId()); player.getInventory().removeItem(feedItem, cost.getCount()); } @@ -588,7 +588,7 @@ public class InventoryManager { avatar.setPromoteLevel(nextPromoteLevel); // Update proud skills - AvatarSkillDepotData skillDepot = GenshinData.getAvatarSkillDepotDataMap().get(avatar.getSkillDepotId()); + AvatarSkillDepotData skillDepot = GameData.getAvatarSkillDepotDataMap().get(avatar.getSkillDepotId()); if (skillDepot != null && skillDepot.getInherentProudSkillOpens() != null) { for (InherentProudSkillOpens openData : skillDepot.getInherentProudSkillOpens()) { @@ -597,7 +597,7 @@ public class InventoryManager { } if (openData.getNeedAvatarPromoteLevel() == avatar.getPromoteLevel()) { int proudSkillId = (openData.getProudSkillGroupId() * 100) + 1; - if (GenshinData.getProudSkillDataMap().containsKey(proudSkillId)) { + if (GameData.getProudSkillDataMap().containsKey(proudSkillId)) { avatar.getProudSkillList().add(proudSkillId); player.sendPacket(new PacketProudSkillChangeNotify(avatar)); } @@ -614,20 +614,20 @@ public class InventoryManager { avatar.save(); } - public void upgradeAvatar(GenshinPlayer player, long guid, int itemId, int count) { - GenshinAvatar avatar = player.getAvatars().getAvatarByGuid(guid); + public void upgradeAvatar(Player player, long guid, int itemId, int count) { + Avatar avatar = player.getAvatars().getAvatarByGuid(guid); // Sanity checks if (avatar == null) { return; } - AvatarPromoteData promoteData = GenshinData.getAvatarPromoteData(avatar.getAvatarData().getAvatarPromoteId(), avatar.getPromoteLevel()); + AvatarPromoteData promoteData = GameData.getAvatarPromoteData(avatar.getAvatarData().getAvatarPromoteId(), avatar.getPromoteLevel()); if (promoteData == null) { return; } - GenshinItem feedItem = player.getInventory().getInventoryTab(ItemType.ITEM_MATERIAL).getItemById(itemId); + GameItem feedItem = player.getInventory().getInventoryTab(ItemType.ITEM_MATERIAL).getItemById(itemId); if (feedItem == null || feedItem.getItemData().getMaterialType() != MaterialType.MATERIAL_EXP_FRUIT || feedItem.getCount() < count) { return; @@ -660,8 +660,8 @@ public class InventoryManager { upgradeAvatar(player, avatar, promoteData, expGain); } - public void upgradeAvatar(GenshinPlayer player, GenshinAvatar avatar, int expGain) { - AvatarPromoteData promoteData = GenshinData.getAvatarPromoteData(avatar.getAvatarData().getAvatarPromoteId(), avatar.getPromoteLevel()); + public void upgradeAvatar(Player player, Avatar avatar, int expGain) { + AvatarPromoteData promoteData = GameData.getAvatarPromoteData(avatar.getAvatarData().getAvatarPromoteId(), avatar.getPromoteLevel()); if (promoteData == null) { return; } @@ -669,12 +669,12 @@ public class InventoryManager { upgradeAvatar(player, avatar, promoteData, expGain); } - public void upgradeAvatar(GenshinPlayer player, GenshinAvatar avatar, AvatarPromoteData promoteData, int expGain) { + public void upgradeAvatar(Player player, Avatar avatar, AvatarPromoteData promoteData, int expGain) { int maxLevel = promoteData.getUnlockMaxLevel(); int level = avatar.getLevel(); int oldLevel = level; int exp = avatar.getExp(); - int reqExp = GenshinData.getAvatarLevelExpRequired(level); + int reqExp = GameData.getAvatarLevelExpRequired(level); while (expGain > 0 && reqExp > 0 && level < maxLevel) { // Do calculations @@ -687,7 +687,7 @@ public class InventoryManager { exp = 0; level += 1; // Set req exp - reqExp = GenshinData.getAvatarLevelExpRequired(level); + reqExp = GameData.getAvatarLevelExpRequired(level); } } @@ -711,12 +711,12 @@ public class InventoryManager { player.sendPacket(new PacketAvatarUpgradeRsp(avatar, oldLevel, oldPropMap)); } - public void upgradeAvatarFetterLevel(GenshinPlayer player, GenshinAvatar avatar, int expGain) { + public void upgradeAvatarFetterLevel(Player player, Avatar avatar, int expGain) { // May work. Not test. int maxLevel = 10; // Keep it until I think of a more "elegant" way int level = avatar.getFetterLevel(); int exp = avatar.getFetterExp(); - int reqExp = GenshinData.getAvatarFetterLevelExpRequired(level); + int reqExp = GameData.getAvatarFetterLevelExpRequired(level); while (expGain > 0 && reqExp > 0 && level < maxLevel) { int toGain = Math.min(expGain, reqExp - exp); @@ -725,7 +725,7 @@ public class InventoryManager { if (exp >= reqExp) { exp = 0; level += 1; - reqExp = GenshinData.getAvatarFetterLevelExpRequired(level); + reqExp = GameData.getAvatarFetterLevelExpRequired(level); } } @@ -736,9 +736,9 @@ public class InventoryManager { player.sendPacket(new PacketAvatarPropNotify(avatar)); } - public void upgradeAvatarSkill(GenshinPlayer player, long guid, int skillId) { + public void upgradeAvatarSkill(Player player, long guid, int skillId) { // Sanity checks - GenshinAvatar avatar = player.getAvatars().getAvatarByGuid(guid); + Avatar avatar = player.getAvatars().getAvatarByGuid(guid); if (avatar == null) { return; } @@ -748,7 +748,7 @@ public class InventoryManager { return; } - AvatarSkillData skillData = GenshinData.getAvatarSkillDataMap().get(skillId); + AvatarSkillData skillData = GameData.getAvatarSkillDataMap().get(skillId); if (skillData == null) { return; } @@ -764,7 +764,7 @@ public class InventoryManager { } // Proud skill data - ProudSkillData proudSkill = GenshinData.getProudSkillDataMap().get(proudSkillId); + ProudSkillData proudSkill = GameData.getProudSkillDataMap().get(proudSkillId); if (proudSkill == null) { return; } @@ -779,7 +779,7 @@ public class InventoryManager { if (cost.getId() == 0) { continue; } - GenshinItem feedItem = player.getInventory().getInventoryTab(ItemType.ITEM_MATERIAL).getItemById(cost.getId()); + GameItem feedItem = player.getInventory().getInventoryTab(ItemType.ITEM_MATERIAL).getItemById(cost.getId()); if (feedItem == null || feedItem.getCount() < cost.getCount()) { return; } @@ -797,7 +797,7 @@ public class InventoryManager { if (cost.getId() == 0) { continue; } - GenshinItem feedItem = player.getInventory().getInventoryTab(ItemType.ITEM_MATERIAL).getItemById(cost.getId()); + GameItem feedItem = player.getInventory().getInventoryTab(ItemType.ITEM_MATERIAL).getItemById(cost.getId()); player.getInventory().removeItem(feedItem, cost.getCount()); } @@ -810,9 +810,9 @@ public class InventoryManager { player.sendPacket(new PacketAvatarSkillUpgradeRsp(avatar, skillId, currentLevel, nextLevel)); } - public void unlockAvatarConstellation(GenshinPlayer player, long guid) { + public void unlockAvatarConstellation(Player player, long guid) { // Sanity checks - GenshinAvatar avatar = player.getAvatars().getAvatarByGuid(guid); + Avatar avatar = player.getAvatars().getAvatarByGuid(guid); if (avatar == null) { return; } @@ -826,13 +826,13 @@ public class InventoryManager { nextTalentId = 40 + currentTalentLevel + 1; } - AvatarTalentData talentData = GenshinData.getAvatarTalentDataMap().get(nextTalentId); + AvatarTalentData talentData = GameData.getAvatarTalentDataMap().get(nextTalentId); if (talentData == null) { return; } - GenshinItem costItem = player.getInventory().getInventoryTab(ItemType.ITEM_MATERIAL).getItemById(talentData.getMainCostItemId()); + GameItem costItem = player.getInventory().getInventoryTab(ItemType.ITEM_MATERIAL).getItemById(talentData.getMainCostItemId()); if (costItem == null || costItem.getCount() < talentData.getMainCostItemCount()) { return; } @@ -849,7 +849,7 @@ public class InventoryManager { player.sendPacket(new PacketUnlockAvatarTalentRsp(avatar, nextTalentId)); // Proud skill bonus map (Extra skills) - OpenConfigEntry entry = GenshinData.getOpenConfigEntries().get(talentData.getOpenConfig()); + OpenConfigEntry entry = GameData.getOpenConfigEntries().get(talentData.getOpenConfig()); if (entry != null && entry.getExtraTalentIndex() > 0) { avatar.recalcProudSkillBonusMap(); player.sendPacket(new PacketProudSkillExtraLevelNotify(avatar, entry.getExtraTalentIndex())); @@ -860,7 +860,7 @@ public class InventoryManager { avatar.save(); } - public void destroyMaterial(GenshinPlayer player, List<MaterialInfo> list) { + public void destroyMaterial(Player player, List<MaterialInfo> list) { // Return materials Int2IntOpenHashMap returnMaterialMap = new Int2IntOpenHashMap(); @@ -870,7 +870,7 @@ public class InventoryManager { continue; } - GenshinItem item = player.getInventory().getItemByGuid(info.getGuid()); + GameItem item = player.getInventory().getItemByGuid(info.getGuid()); if (item == null || !item.isDestroyable()) { continue; } @@ -890,7 +890,7 @@ public class InventoryManager { // Give back items if (returnMaterialMap.size() > 0) { for (Int2IntMap.Entry e : returnMaterialMap.int2IntEntrySet()) { - player.getInventory().addItem(new GenshinItem(e.getIntKey(), e.getIntValue())); + player.getInventory().addItem(new GameItem(e.getIntKey(), e.getIntValue())); } } @@ -898,9 +898,9 @@ public class InventoryManager { player.sendPacket(new PacketDestroyMaterialRsp(returnMaterialMap)); } - public GenshinItem useItem(GenshinPlayer player, long targetGuid, long itemGuid, int count) { - GenshinAvatar target = player.getAvatars().getAvatarByGuid(targetGuid); - GenshinItem useItem = player.getInventory().getItemByGuid(itemGuid); + public GameItem useItem(Player player, long targetGuid, long itemGuid, int count) { + Avatar target = player.getAvatars().getAvatarByGuid(targetGuid); + GameItem useItem = player.getInventory().getItemByGuid(itemGuid); if (useItem == null) { return null; diff --git a/src/main/java/emu/grasscutter/game/managers/MultiplayerManager.java b/src/main/java/emu/grasscutter/game/managers/MultiplayerManager.java index e42f7a789..247b3356d 100644 --- a/src/main/java/emu/grasscutter/game/managers/MultiplayerManager.java +++ b/src/main/java/emu/grasscutter/game/managers/MultiplayerManager.java @@ -1,12 +1,12 @@ package emu.grasscutter.game.managers; import emu.grasscutter.game.CoopRequest; -import emu.grasscutter.game.GenshinPlayer; -import emu.grasscutter.game.GenshinPlayer.SceneLoadState; import emu.grasscutter.game.props.EnterReason; +import emu.grasscutter.game.world.World; import emu.grasscutter.net.proto.EnterTypeOuterClass.EnterType; import emu.grasscutter.net.proto.PlayerApplyEnterMpReasonOuterClass.PlayerApplyEnterMpReason; -import emu.grasscutter.game.World; +import emu.grasscutter.game.player.Player; +import emu.grasscutter.game.player.Player.SceneLoadState; import emu.grasscutter.net.proto.PlayerApplyEnterMpResultNotifyOuterClass; import emu.grasscutter.server.game.GameServer; import emu.grasscutter.server.packet.send.PacketPlayerApplyEnterMpNotify; @@ -24,8 +24,8 @@ public class MultiplayerManager { return server; } - public void applyEnterMp(GenshinPlayer player, int targetUid) { - GenshinPlayer target = getServer().getPlayerByUid(targetUid); + public void applyEnterMp(Player player, int targetUid) { + Player target = getServer().getPlayerByUid(targetUid); if (target == null) { player.sendPacket(new PacketPlayerApplyEnterMpResultNotify(targetUid, "", false, PlayerApplyEnterMpResultNotifyOuterClass.PlayerApplyEnterMpResultNotify.Reason.PLAYER_CANNOT_ENTER_MP)); return; @@ -59,7 +59,7 @@ public class MultiplayerManager { target.sendPacket(new PacketPlayerApplyEnterMpNotify(player)); } - public void applyEnterMpReply(GenshinPlayer hostPlayer, int applyUid, boolean isAgreed) { + public void applyEnterMpReply(Player hostPlayer, int applyUid, boolean isAgreed) { // Checks CoopRequest request = hostPlayer.getCoopRequests().get(applyUid); if (request == null || request.isExpired()) { @@ -67,7 +67,7 @@ public class MultiplayerManager { } // Remove now that we are handling it - GenshinPlayer requester = request.getRequester(); + Player requester = request.getRequester(); hostPlayer.getCoopRequests().remove(applyUid); // Sanity checks - Dont let the requesting player join if they are already in multiplayer @@ -108,14 +108,14 @@ public class MultiplayerManager { requester.sendPacket(new PacketPlayerEnterSceneNotify(requester, hostPlayer, EnterType.ENTER_OTHER, EnterReason.TeamJoin, hostPlayer.getScene().getId(), hostPlayer.getPos())); } - public boolean leaveCoop(GenshinPlayer player) { + public boolean leaveCoop(Player player) { // Make sure player's world is multiplayer if (!player.getWorld().isMultiplayer()) { return false; } // Make sure everyone's scene is loaded - for (GenshinPlayer p : player.getWorld().getPlayers()) { + for (Player p : player.getWorld().getPlayers()) { if (p.getSceneLoadState() != SceneLoadState.LOADED) { return false; } @@ -131,14 +131,14 @@ public class MultiplayerManager { return true; } - public boolean kickPlayer(GenshinPlayer player, int targetUid) { + public boolean kickPlayer(Player player, int targetUid) { // Make sure player's world is multiplayer and that player is owner if (!player.getWorld().isMultiplayer() || player.getWorld().getHost() != player) { return false; } // Get victim and sanity checks - GenshinPlayer victim = player.getServer().getPlayerByUid(targetUid); + Player victim = player.getServer().getPlayerByUid(targetUid); if (victim == null || victim == player) { return false; diff --git a/src/main/java/emu/grasscutter/game/InvokeHandler.java b/src/main/java/emu/grasscutter/game/player/InvokeHandler.java similarity index 71% rename from src/main/java/emu/grasscutter/game/InvokeHandler.java rename to src/main/java/emu/grasscutter/game/player/InvokeHandler.java index b8272d30b..edfcbfc83 100644 --- a/src/main/java/emu/grasscutter/game/InvokeHandler.java +++ b/src/main/java/emu/grasscutter/game/player/InvokeHandler.java @@ -1,17 +1,18 @@ -package emu.grasscutter.game; +package emu.grasscutter.game.player; 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 +29,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 +39,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(); } diff --git a/src/main/java/emu/grasscutter/game/GenshinPlayer.java b/src/main/java/emu/grasscutter/game/player/Player.java similarity index 87% rename from src/main/java/emu/grasscutter/game/GenshinPlayer.java rename to src/main/java/emu/grasscutter/game/player/Player.java index 4c5afb88f..5970c3f13 100644 --- a/src/main/java/emu/grasscutter/game/GenshinPlayer.java +++ b/src/main/java/emu/grasscutter/game/player/Player.java @@ -1,25 +1,33 @@ -package emu.grasscutter.game; +package emu.grasscutter.game.player; + +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.data.GenshinData; +import emu.grasscutter.command.CommandHandler; +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.Account; +import emu.grasscutter.game.CoopRequest; +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.mail.Mail; import emu.grasscutter.game.props.ActionReason; import emu.grasscutter.game.props.PlayerProperty; -import emu.grasscutter.net.packet.GenshinPacket; +import emu.grasscutter.game.world.Scene; +import emu.grasscutter.game.world.World; +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; @@ -42,7 +50,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; @@ -63,7 +71,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; @@ -72,10 +80,10 @@ public class GenshinPlayer { private TeamManager teamManager; private PlayerGachaInfo gachaInfo; private PlayerProfile playerProfile; - private MpSettingType mpSetting = MpSettingType.MP_SETTING_ENTER_AFTER_APPLY; private boolean showAvatar; private ArrayList<AvatarProfileData> shownAvatars; private Set<Integer> rewardedLevels; + private ArrayList<Mail> mail; private int sceneId; private int regionId; @@ -100,7 +108,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); @@ -119,6 +127,8 @@ public class GenshinPlayer { this.flyCloakList = new HashSet<>(); this.costumeList = new HashSet<>(); + this.mail = new ArrayList<>(); + this.setSceneId(3); this.setRegionId(1); this.sceneState = SceneLoadState.NONE; @@ -134,7 +144,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(); @@ -153,7 +163,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); } @@ -165,7 +175,7 @@ public class GenshinPlayer { this.id = id; } - public long getNextGenshinGuid() { + public long getNextGameGuid() { long nextId = ++this.nextGuid; return ((long) this.getUid() << 32) + nextId; } @@ -203,11 +213,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; } @@ -261,6 +271,11 @@ public class GenshinPlayer { public int getWorldLevel() { return this.getProperty(PlayerProperty.PROP_PLAYER_WORLD_LEVEL); } + + public void setWorldLevel(int level) { + this.setProperty(PlayerProperty.PROP_PLAYER_WORLD_LEVEL, level); + this.sendPacket(new PacketPlayerPropNotify(this, PlayerProperty.PROP_PLAYER_WORLD_LEVEL)); + } public int getPrimogems() { return this.getProperty(PlayerProperty.PROP_PLAYER_HCOIN); @@ -281,7 +296,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; } @@ -374,7 +389,7 @@ public class GenshinPlayer { } public MpSettingType getMpSetting() { - return mpSetting; + return MpSettingType.MP_SETTING_ENTER_AFTER_APPLY; // TEMP } public synchronized Int2ObjectMap<CoopRequest> getCoopRequests() { @@ -393,10 +408,6 @@ public class GenshinPlayer { return clientAbilityInitFinishHandler; } - public void setMpSetting(MpSettingType mpSetting) { - this.mpSetting = mpSetting; - } - public AvatarStorage getAvatars() { return avatars; } @@ -539,9 +550,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) { @@ -576,9 +587,8 @@ public class GenshinPlayer { } moonCardGetTimes.add(now); addMoonCardDays(1); - GenshinItem genshinItem = new GenshinItem(201, 90); - getInventory().addItem(genshinItem); - session.send(new PacketItemAddHintNotify(genshinItem, ActionReason.BlessingRedeemReward)); + GameItem item = new GameItem(201, 90); + getInventory().addItem(item, ActionReason.BlessingRedeemReward); session.send(new PacketCardProductRewardNotify(getMoonCardRemainDays())); } @@ -598,29 +608,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 @@ -653,7 +653,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())); } /** @@ -662,12 +662,53 @@ 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())); } + // ---------------------MAIL------------------------ + + public List<Mail> getAllMail() { return this.mail; } + + public void sendMail(Mail message) { + this.mail.add(message); + this.save(); + Grasscutter.getLogger().info("Mail sent to user [" + this.getUid() + ":" + this.getNickname() + "]!"); + if(this.isOnline()) { + this.sendPacket(new PacketMailChangeNotify(this, message)); + } // TODO: setup a way for the mail notification to show up when someone receives mail when they were offline + } + + public boolean deleteMail(int mailId) { + Mail message = getMail(mailId); + + if(message != null) { + int index = getMailId(message); + message.expireTime = (int) Instant.now().getEpochSecond(); // Just set the mail as expired for now. I don't want to implement a counter specifically for an account... + this.replaceMailByIndex(index, message); + return true; + } + + return false; + } + + public Mail getMail(int index) { return this.mail.get(index); } + public int getMailId(Mail message) { + return this.mail.indexOf(message); + } + + public boolean replaceMailByIndex(int index, Mail message) { + if(getMail(index) != null) { + this.mail.set(index, message); + this.save(); + return true; + } else { + return false; + } + } + public void interactWith(int gadgetEntityId) { - GenshinEntity entity = getScene().getEntityById(gadgetEntityId); + GameEntity entity = getScene().getEntityById(gadgetEntityId); if (entity == null) { return; @@ -680,12 +721,11 @@ 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); + boolean success = getInventory().addItem(item, ActionReason.SubfieldDrop); if (success) { this.sendPacket(new PacketGadgetInteractRsp(drop, InteractType.INTERACT_PICK_ITEM)); - this.sendPacket(new PacketItemAddHintNotify(item, ActionReason.SubfieldDrop)); } } @@ -700,7 +740,7 @@ public class GenshinPlayer { } - public void sendPacket(GenshinPacket packet) { + public void sendPacket(BasePacket packet) { if (this.hasSentAvatarDataNotify) { this.getSession().send(packet); } @@ -829,7 +869,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(); } diff --git a/src/main/java/emu/grasscutter/game/TeamInfo.java b/src/main/java/emu/grasscutter/game/player/TeamInfo.java similarity index 87% rename from src/main/java/emu/grasscutter/game/TeamInfo.java rename to src/main/java/emu/grasscutter/game/player/TeamInfo.java index efaf5ea1c..5c66f1aaa 100644 --- a/src/main/java/emu/grasscutter/game/TeamInfo.java +++ b/src/main/java/emu/grasscutter/game/player/TeamInfo.java @@ -1,12 +1,12 @@ -package emu.grasscutter.game; +package emu.grasscutter.game.player; 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; } diff --git a/src/main/java/emu/grasscutter/game/TeamManager.java b/src/main/java/emu/grasscutter/game/player/TeamManager.java similarity index 92% rename from src/main/java/emu/grasscutter/game/TeamManager.java rename to src/main/java/emu/grasscutter/game/player/TeamManager.java index c32d3edfb..b942604f5 100644 --- a/src/main/java/emu/grasscutter/game/TeamManager.java +++ b/src/main/java/emu/grasscutter/game/player/TeamManager.java @@ -1,4 +1,4 @@ -package emu.grasscutter.game; +package emu.grasscutter.game.player; import java.util.ArrayList; import java.util.HashMap; @@ -10,16 +10,17 @@ 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.game.world.World; +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 +45,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 +66,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 +85,7 @@ public class TeamManager { return player.getWorld(); } - public void setPlayer(GenshinPlayer player) { + public void setPlayer(Player player) { this.player = player; } @@ -207,7 +208,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 +288,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 +300,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 +324,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 +336,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 +438,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 +477,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() { diff --git a/src/main/java/emu/grasscutter/game/GenshinScene.java b/src/main/java/emu/grasscutter/game/world/Scene.java similarity index 80% rename from src/main/java/emu/grasscutter/game/GenshinScene.java rename to src/main/java/emu/grasscutter/game/world/Scene.java index 6f8591348..d9b01e0ef 100644 --- a/src/main/java/emu/grasscutter/game/GenshinScene.java +++ b/src/main/java/emu/grasscutter/game/world/Scene.java @@ -1,4 +1,4 @@ -package emu.grasscutter.game; +package emu.grasscutter.game.world; import java.util.ArrayList; import java.util.Collection; @@ -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,15 @@ 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.player.Player; +import emu.grasscutter.game.player.TeamInfo; 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 +42,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 +56,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 +85,7 @@ public class GenshinScene { return getSceneData().getSceneType(); } - public List<GenshinPlayer> getPlayers() { + public List<Player> getPlayers() { return players; } @@ -92,11 +93,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 +141,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 +164,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 +183,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 +200,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 +208,7 @@ public class GenshinScene { } } - public void spawnPlayer(GenshinPlayer player) { + public void spawnPlayer(Player player) { if (this.isInScene(player.getTeamManager().getCurrentAvatarEntity())) { return; } @@ -219,33 +220,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 +259,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 +274,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 +307,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 +322,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 +340,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 +348,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 +374,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 +408,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 +431,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; } diff --git a/src/main/java/emu/grasscutter/game/World.java b/src/main/java/emu/grasscutter/game/world/World.java similarity index 79% rename from src/main/java/emu/grasscutter/game/World.java rename to src/main/java/emu/grasscutter/game/world/World.java index eefaabc16..292e63d32 100644 --- a/src/main/java/emu/grasscutter/game/World.java +++ b/src/main/java/emu/grasscutter/game/world/World.java @@ -1,4 +1,4 @@ -package emu.grasscutter.game; +package emu.grasscutter.game.world; import java.util.ArrayList; import java.util.Collection; @@ -8,19 +8,20 @@ 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.player.Player; +import emu.grasscutter.game.player.Player.SceneLoadState; 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.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 +41,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 +53,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 +69,7 @@ public class World implements Iterable<GenshinPlayer> { this.owner.getServer().registerWorld(this); } - public GenshinPlayer getHost() { + public Player getHost() { return owner; } @@ -95,25 +96,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 +134,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 +160,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 +169,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 +183,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 +193,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 +203,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 +229,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 +246,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 +270,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 +288,7 @@ public class World implements Iterable<GenshinPlayer> { } @Override - public Iterator<GenshinPlayer> iterator() { + public Iterator<Player> iterator() { return getPlayers().iterator(); } } diff --git a/src/main/java/emu/grasscutter/net/packet/GenshinPacket.java b/src/main/java/emu/grasscutter/net/packet/BasePacket.java similarity index 93% rename from src/main/java/emu/grasscutter/net/packet/GenshinPacket.java rename to src/main/java/emu/grasscutter/net/packet/BasePacket.java index 158c0d3c0..7fae74c8a 100644 --- a/src/main/java/emu/grasscutter/net/packet/GenshinPacket.java +++ b/src/main/java/emu/grasscutter/net/packet/BasePacket.java @@ -7,7 +7,7 @@ import com.google.protobuf.GeneratedMessageV3; import emu.grasscutter.net.proto.PacketHeadOuterClass.PacketHead; import emu.grasscutter.utils.Crypto; -public class GenshinPacket { +public class BasePacket { private static final int const1 = 17767; // 0x4567 private static final int const2 = -30293; // 0x89ab @@ -21,16 +21,16 @@ public class GenshinPacket { private boolean useDispatchKey; public boolean shouldEncrypt = true; - public GenshinPacket(int opcode) { + public BasePacket(int opcode) { this.opcode = opcode; } - public GenshinPacket(int opcode, int clientSequence) { + public BasePacket(int opcode, int clientSequence) { this.opcode = opcode; this.buildHeader(clientSequence); } - public GenshinPacket(int opcode, boolean buildHeader) { + public BasePacket(int opcode, boolean buildHeader) { this.opcode = opcode; this.shouldBuildHeader = buildHeader; } @@ -80,7 +80,7 @@ public class GenshinPacket { this.data = proto.build().toByteArray(); } - public GenshinPacket buildHeader(int clientSequence) { + public BasePacket buildHeader(int clientSequence) { if (this.getHeader() != null && clientSequence == 0) { return this; } diff --git a/src/main/java/emu/grasscutter/netty/MihoyoKcpChannel.java b/src/main/java/emu/grasscutter/netty/KcpChannel.java similarity index 96% rename from src/main/java/emu/grasscutter/netty/MihoyoKcpChannel.java rename to src/main/java/emu/grasscutter/netty/KcpChannel.java index 233579199..2c234ae7c 100644 --- a/src/main/java/emu/grasscutter/netty/MihoyoKcpChannel.java +++ b/src/main/java/emu/grasscutter/netty/KcpChannel.java @@ -8,7 +8,7 @@ import io.netty.buffer.Unpooled; import io.netty.channel.ChannelHandlerContext; import io.netty.channel.ChannelInboundHandlerAdapter; -public abstract class MihoyoKcpChannel extends ChannelInboundHandlerAdapter { +public abstract class KcpChannel extends ChannelInboundHandlerAdapter { private UkcpChannel kcpChannel; private ChannelHandlerContext ctx; private boolean isActive; diff --git a/src/main/java/emu/grasscutter/netty/MihoyoKcpHandshaker.java b/src/main/java/emu/grasscutter/netty/KcpHandshaker.java similarity index 91% rename from src/main/java/emu/grasscutter/netty/MihoyoKcpHandshaker.java rename to src/main/java/emu/grasscutter/netty/KcpHandshaker.java index cf94c7c75..9940402f1 100644 --- a/src/main/java/emu/grasscutter/netty/MihoyoKcpHandshaker.java +++ b/src/main/java/emu/grasscutter/netty/KcpHandshaker.java @@ -10,9 +10,9 @@ import io.netty.channel.ChannelMetadata; import io.netty.channel.ChannelOutboundBuffer; import io.netty.channel.nio.AbstractNioMessageChannel; -public class MihoyoKcpHandshaker extends AbstractNioMessageChannel { +public class KcpHandshaker extends AbstractNioMessageChannel { - protected MihoyoKcpHandshaker(Channel parent, SelectableChannel ch, int readInterestOp) { + protected KcpHandshaker(Channel parent, SelectableChannel ch, int readInterestOp) { super(parent, ch, readInterestOp); } diff --git a/src/main/java/emu/grasscutter/netty/MihoyoKcpServer.java b/src/main/java/emu/grasscutter/netty/KcpServer.java similarity index 93% rename from src/main/java/emu/grasscutter/netty/MihoyoKcpServer.java rename to src/main/java/emu/grasscutter/netty/KcpServer.java index 41e8ad412..4825a1b85 100644 --- a/src/main/java/emu/grasscutter/netty/MihoyoKcpServer.java +++ b/src/main/java/emu/grasscutter/netty/KcpServer.java @@ -13,14 +13,14 @@ import io.netty.channel.EventLoopGroup; import io.netty.channel.nio.NioEventLoopGroup; @SuppressWarnings("rawtypes") -public class MihoyoKcpServer extends Thread { +public class KcpServer extends Thread { private EventLoopGroup group; private UkcpServerBootstrap bootstrap; private ChannelInitializer serverInitializer; private InetSocketAddress address; - public MihoyoKcpServer(InetSocketAddress address) { + public KcpServer(InetSocketAddress address) { this.address = address; this.setName("Netty Server Thread"); } @@ -40,7 +40,7 @@ public class MihoyoKcpServer extends Thread { @Override public void run() { if (getServerInitializer() == null) { - this.setServerInitializer(new MihoyoKcpServerInitializer()); + this.setServerInitializer(new KcpServerInitializer()); } try { diff --git a/src/main/java/emu/grasscutter/netty/MihoyoKcpServerInitializer.java b/src/main/java/emu/grasscutter/netty/KcpServerInitializer.java similarity index 79% rename from src/main/java/emu/grasscutter/netty/MihoyoKcpServerInitializer.java rename to src/main/java/emu/grasscutter/netty/KcpServerInitializer.java index 7d4e58926..86d871c5f 100644 --- a/src/main/java/emu/grasscutter/netty/MihoyoKcpServerInitializer.java +++ b/src/main/java/emu/grasscutter/netty/KcpServerInitializer.java @@ -5,7 +5,7 @@ import io.netty.channel.ChannelInitializer; import io.netty.channel.ChannelPipeline; @SuppressWarnings("unused") -public class MihoyoKcpServerInitializer extends ChannelInitializer<UkcpChannel> { +public class KcpServerInitializer extends ChannelInitializer<UkcpChannel> { @Override protected void initChannel(UkcpChannel ch) throws Exception { diff --git a/src/main/java/emu/grasscutter/plugin/api/PlayerHook.java b/src/main/java/emu/grasscutter/plugin/api/PlayerHook.java index 3f2961e19..3760ea42c 100644 --- a/src/main/java/emu/grasscutter/plugin/api/PlayerHook.java +++ b/src/main/java/emu/grasscutter/plugin/api/PlayerHook.java @@ -1,11 +1,11 @@ package emu.grasscutter.plugin.api; -import emu.grasscutter.game.GenshinPlayer; -import emu.grasscutter.game.avatar.GenshinAvatar; +import emu.grasscutter.game.avatar.Avatar; import emu.grasscutter.game.entity.EntityAvatar; +import emu.grasscutter.game.player.Player; 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.proto.EnterTypeOuterClass.EnterType; import emu.grasscutter.server.packet.send.PacketAvatarFightPropUpdateNotify; import emu.grasscutter.server.packet.send.PacketAvatarLifeStateChangeNotify; @@ -13,16 +13,16 @@ import emu.grasscutter.server.packet.send.PacketPlayerEnterSceneNotify; import emu.grasscutter.utils.Position; /** - * Hooks into the {@link GenshinPlayer} class, adding convenient ways to do certain things. + * Hooks into the {@link Player} class, adding convenient ways to do certain things. */ public final class PlayerHook { - private final GenshinPlayer player; + private final Player player; /** * Hooks into the player. * @param player The player to hook into. */ - public PlayerHook(GenshinPlayer player) { + public PlayerHook(Player player) { this.player = player; } @@ -53,7 +53,7 @@ public final class PlayerHook { * Broadcasts the packet sent to all world players. * @param packet The packet to send. */ - public void broadcastPacketToWorld(GenshinPacket packet) { + public void broadcastPacketToWorld(BasePacket packet) { this.player.getWorld().broadcastPacket(packet); } @@ -70,7 +70,7 @@ public final class PlayerHook { * Revives the specified avatar. * @param avatar The avatar to revive. */ - public void reviveAvatar(GenshinAvatar avatar) { + public void reviveAvatar(Avatar avatar) { this.broadcastPacketToWorld(new PacketAvatarLifeStateChangeNotify(avatar)); } @@ -105,9 +105,9 @@ public final class PlayerHook { /** * Gets the currently selected avatar. - * @return The avatar as an {@link GenshinAvatar}. + * @return The avatar as an {@link Avatar}. */ - public GenshinAvatar getCurrentAvatar() { + public Avatar getCurrentAvatar() { return this.getCurrentAvatarEntity().getAvatar(); } } \ No newline at end of file diff --git a/src/main/java/emu/grasscutter/plugin/api/ServerHook.java b/src/main/java/emu/grasscutter/plugin/api/ServerHook.java index 34ceb25f4..cbca97b8f 100644 --- a/src/main/java/emu/grasscutter/plugin/api/ServerHook.java +++ b/src/main/java/emu/grasscutter/plugin/api/ServerHook.java @@ -1,6 +1,6 @@ package emu.grasscutter.plugin.api; -import emu.grasscutter.game.GenshinPlayer; +import emu.grasscutter.game.player.Player; import emu.grasscutter.server.game.GameServer; import java.util.LinkedList; @@ -35,7 +35,7 @@ public final class ServerHook { * Gets all online players. * @return Players connected to the server. */ - public List<GenshinPlayer> getOnlinePlayers() { + public List<Player> getOnlinePlayers() { return new LinkedList<>(this.server.getPlayers().values()); } } \ No newline at end of file diff --git a/src/main/java/emu/grasscutter/server/dispatch/DispatchServer.java b/src/main/java/emu/grasscutter/server/dispatch/DispatchServer.java index 654cf91b3..1ac721ce2 100644 --- a/src/main/java/emu/grasscutter/server/dispatch/DispatchServer.java +++ b/src/main/java/emu/grasscutter/server/dispatch/DispatchServer.java @@ -55,9 +55,14 @@ public final class DispatchServer { this.initRegion(); } + @Deprecated public HttpServer getServer() { return server; } + + public HttpServer getHttpServer() { + return server; + } public InetSocketAddress getAddress() { return address; @@ -203,56 +208,65 @@ public final class DispatchServer { } return null; } + + private KeyManagerFactory createKeyManagerFactory(File keystore, String password) throws Exception { + char[] pass = password.toCharArray(); + KeyManagerFactory kmf = null; + + try (FileInputStream fis = new FileInputStream(keystore)) { + + KeyStore ks = KeyStore.getInstance("PKCS12"); + ks.load(fis, pass); + + kmf = KeyManagerFactory.getInstance("SunX509"); + kmf.init(ks, pass); + } catch (Exception e) { + throw e; + } + + return kmf; + } public void start() throws Exception { if (Grasscutter.getConfig().getDispatchOptions().UseSSL) { - HttpsServer httpsServer = HttpsServer.create(getAddress(), 0); + // Keystore SSLContext sslContext = SSLContext.getInstance("TLS"); - try (FileInputStream fis = new FileInputStream(Grasscutter.getConfig().getDispatchOptions().KeystorePath)) { - char[] keystorePassword = Grasscutter.getConfig().getDispatchOptions().KeystorePassword.toCharArray(); - KeyManagerFactory _kmf; + KeyManagerFactory kmf = null; + File keystoreFile = new File(Grasscutter.getConfig().getDispatchOptions().KeystorePath); + + if (keystoreFile.exists()) { try { - KeyStore ks = KeyStore.getInstance("PKCS12"); - ks.load(fis, keystorePassword); - KeyManagerFactory kmf = KeyManagerFactory.getInstance("SunX509"); - _kmf = kmf; - kmf.init(ks, keystorePassword); - } catch (Exception originalEx) { + kmf = createKeyManagerFactory(keystoreFile, Grasscutter.getConfig().getDispatchOptions().KeystorePassword); + } catch (Exception e) { + Grasscutter.getLogger().warn("[Dispatch] Unable to load keystore. Trying default keystore password..."); + try { - // try to initialize kmf with the default password - char[] defaultPassword = "123456".toCharArray(); - - Grasscutter.getLogger() - .warn("[Dispatch] Unable to load keystore. Trying default keystore password..."); - KeyStore ks = KeyStore.getInstance("PKCS12"); - ks.load(fis, defaultPassword); - KeyManagerFactory kmf = KeyManagerFactory.getInstance("SunX509"); - kmf.init(ks, defaultPassword); - _kmf = kmf; - + kmf = createKeyManagerFactory(keystoreFile, "123456"); Grasscutter.getLogger().warn( - "[Dispatch] The default keystore password was loaded successfully. Please consider setting the password in config.json."); - } catch (Exception ignored) { + "[Dispatch] The default keystore password was loaded successfully. Please consider setting the password to 123456 in config.json."); + } catch (Exception e2) { Grasscutter.getLogger().warn("[Dispatch] Error while loading keystore!"); - - // don't care about the exception for the "123456" default password attempt - originalEx.printStackTrace(); - throw originalEx; + e2.printStackTrace(); } } - - sslContext.init(_kmf.getKeyManagers(), null, null); - - httpsServer.setHttpsConfigurator(new HttpsConfigurator(sslContext)); - server = httpsServer; - } catch (BindException ignored) { - Grasscutter.getLogger().error("Unable to bind to port: " + getAddress().getPort() + " (HTTPS)"); - server = this.safelyCreateServer(this.getAddress()); - } catch (Exception e) { + } + + if (kmf == null) { Grasscutter.getLogger().warn("[Dispatch] No SSL cert found! Falling back to HTTP server."); Grasscutter.getConfig().getDispatchOptions().UseSSL = false; server = this.safelyCreateServer(this.getAddress()); } + + HttpsServer httpsServer = null; + + try { + httpsServer = HttpsServer.create(getAddress(), 0); + sslContext.init(kmf.getKeyManagers(), null, null); + httpsServer.setHttpsConfigurator(new HttpsConfigurator(sslContext)); + server = httpsServer; + } catch (BindException e) { + Grasscutter.getLogger().error("Unable to bind to port: " + getAddress().getPort() + " (HTTPS)"); + } } else { server = this.safelyCreateServer(this.getAddress()); } diff --git a/src/main/java/emu/grasscutter/server/event/game/SendPacketEvent.java b/src/main/java/emu/grasscutter/server/event/game/SendPacketEvent.java index 7a25b4e10..b78e0d0c8 100644 --- a/src/main/java/emu/grasscutter/server/event/game/SendPacketEvent.java +++ b/src/main/java/emu/grasscutter/server/event/game/SendPacketEvent.java @@ -1,15 +1,15 @@ package emu.grasscutter.server.event.game; -import emu.grasscutter.net.packet.GenshinPacket; +import emu.grasscutter.net.packet.BasePacket; import emu.grasscutter.server.event.Cancellable; import emu.grasscutter.server.event.ServerEvent; import emu.grasscutter.server.game.GameSession; public final class SendPacketEvent extends ServerEvent implements Cancellable { private final GameSession gameSession; - private GenshinPacket packet; + private BasePacket packet; - public SendPacketEvent(GameSession gameSession, GenshinPacket packet) { + public SendPacketEvent(GameSession gameSession, BasePacket packet) { super(Type.GAME); this.gameSession = gameSession; @@ -20,11 +20,11 @@ public final class SendPacketEvent extends ServerEvent implements Cancellable { return this.gameSession; } - public void setPacket(GenshinPacket packet) { + public void setPacket(BasePacket packet) { this.packet = packet; } - public GenshinPacket getPacket() { + public BasePacket getPacket() { return this.packet; } } diff --git a/src/main/java/emu/grasscutter/server/game/GameServer.java b/src/main/java/emu/grasscutter/server/game/GameServer.java index 77f64fb88..50889fd56 100644 --- a/src/main/java/emu/grasscutter/server/game/GameServer.java +++ b/src/main/java/emu/grasscutter/server/game/GameServer.java @@ -5,33 +5,33 @@ import java.time.OffsetDateTime; import java.util.*; import java.util.concurrent.ConcurrentHashMap; -import emu.grasscutter.GenshinConstants; +import emu.grasscutter.GameConstants; import emu.grasscutter.Grasscutter; import emu.grasscutter.command.CommandMap; import emu.grasscutter.database.DatabaseHelper; import emu.grasscutter.game.Account; -import emu.grasscutter.game.GenshinPlayer; -import emu.grasscutter.game.World; import emu.grasscutter.game.dungeons.DungeonManager; import emu.grasscutter.game.gacha.GachaManager; import emu.grasscutter.game.managers.ChatManager; import emu.grasscutter.game.managers.InventoryManager; import emu.grasscutter.game.managers.MultiplayerManager; +import emu.grasscutter.game.player.Player; import emu.grasscutter.game.shop.ShopManager; +import emu.grasscutter.game.world.World; import emu.grasscutter.net.packet.PacketHandler; import emu.grasscutter.net.proto.SocialDetailOuterClass.SocialDetail; -import emu.grasscutter.netty.MihoyoKcpServer; +import emu.grasscutter.netty.KcpServer; import emu.grasscutter.server.event.ServerEvent; import emu.grasscutter.server.event.game.ServerTickEvent; import emu.grasscutter.server.event.internal.ServerStartEvent; import emu.grasscutter.server.event.internal.ServerStopEvent; import emu.grasscutter.task.TaskMap; -public final class GameServer extends MihoyoKcpServer { +public final class GameServer extends KcpServer { private final InetSocketAddress address; private final GameServerPacketHandler packetHandler; - private final Map<Integer, GenshinPlayer> players; + private final Map<Integer, Player> players; private final Set<World> worlds; private final ChatManager chatManager; @@ -82,7 +82,7 @@ public final class GameServer extends MihoyoKcpServer { return packetHandler; } - public Map<Integer, GenshinPlayer> getPlayers() { + public Map<Integer, Player> getPlayers() { return players; } @@ -122,22 +122,22 @@ public final class GameServer extends MihoyoKcpServer { return this.taskMap; } - public void registerPlayer(GenshinPlayer player) { + public void registerPlayer(Player player) { getPlayers().put(player.getUid(), player); } - public GenshinPlayer getPlayerByUid(int id) { + public Player getPlayerByUid(int id) { return this.getPlayerByUid(id, false); } - public GenshinPlayer getPlayerByUid(int id, boolean allowOfflinePlayers) { + public Player getPlayerByUid(int id, boolean allowOfflinePlayers) { // Console check - if (id == GenshinConstants.SERVER_CONSOLE_UID) { + if (id == GameConstants.SERVER_CONSOLE_UID) { return null; } // Get from online players - GenshinPlayer player = this.getPlayers().get(id); + Player player = this.getPlayers().get(id); if (!allowOfflinePlayers) { return player; @@ -153,7 +153,7 @@ public final class GameServer extends MihoyoKcpServer { public SocialDetail.Builder getSocialDetailByUid(int id) { // Get from online players - GenshinPlayer player = this.getPlayerByUid(id, true); + Player player = this.getPlayerByUid(id, true); if (player == null) { return null; @@ -163,7 +163,7 @@ public final class GameServer extends MihoyoKcpServer { } public Account getAccountByName(String username) { - Optional<GenshinPlayer> playerOpt = getPlayers().values().stream().filter(player -> player.getAccount().getUsername().equals(username)).findFirst(); + Optional<Player> playerOpt = getPlayers().values().stream().filter(player -> player.getAccount().getUsername().equals(username)).findFirst(); if (playerOpt.isPresent()) { return playerOpt.get().getAccount(); } @@ -204,10 +204,10 @@ public final class GameServer extends MihoyoKcpServer { ServerStopEvent event = new ServerStopEvent(ServerEvent.Type.GAME, OffsetDateTime.now()); event.call(); // Kick and save all players - List<GenshinPlayer> list = new ArrayList<>(this.getPlayers().size()); + List<Player> list = new ArrayList<>(this.getPlayers().size()); list.addAll(this.getPlayers().values()); - for (GenshinPlayer player : list) { + for (Player player : list) { player.getSession().close(); } } diff --git a/src/main/java/emu/grasscutter/server/game/GameServerInitializer.java b/src/main/java/emu/grasscutter/server/game/GameServerInitializer.java index 5472c1db5..1c5f51388 100644 --- a/src/main/java/emu/grasscutter/server/game/GameServerInitializer.java +++ b/src/main/java/emu/grasscutter/server/game/GameServerInitializer.java @@ -1,10 +1,10 @@ package emu.grasscutter.server.game; -import emu.grasscutter.netty.MihoyoKcpServerInitializer; +import emu.grasscutter.netty.KcpServerInitializer; import io.jpower.kcp.netty.UkcpChannel; import io.netty.channel.ChannelPipeline; -public class GameServerInitializer extends MihoyoKcpServerInitializer { +public class GameServerInitializer extends KcpServerInitializer { private GameServer server; public GameServerInitializer(GameServer server) { diff --git a/src/main/java/emu/grasscutter/server/game/GameSession.java b/src/main/java/emu/grasscutter/server/game/GameSession.java index 1beea2f3a..227d3fd65 100644 --- a/src/main/java/emu/grasscutter/server/game/GameSession.java +++ b/src/main/java/emu/grasscutter/server/game/GameSession.java @@ -8,11 +8,11 @@ import java.util.Set; import emu.grasscutter.Grasscutter; import emu.grasscutter.game.Account; -import emu.grasscutter.game.GenshinPlayer; -import emu.grasscutter.net.packet.GenshinPacket; +import emu.grasscutter.game.player.Player; +import emu.grasscutter.net.packet.BasePacket; import emu.grasscutter.net.packet.PacketOpcodes; import emu.grasscutter.net.packet.PacketOpcodesUtil; -import emu.grasscutter.netty.MihoyoKcpChannel; +import emu.grasscutter.netty.KcpChannel; import emu.grasscutter.server.event.game.SendPacketEvent; import emu.grasscutter.utils.Crypto; import emu.grasscutter.utils.FileUtils; @@ -21,11 +21,11 @@ import io.netty.buffer.ByteBuf; import io.netty.buffer.Unpooled; import io.netty.channel.ChannelHandlerContext; -public class GameSession extends MihoyoKcpChannel { +public class GameSession extends KcpChannel { private GameServer server; private Account account; - private GenshinPlayer player; + private Player player; private boolean useSecretKey; private SessionState state; @@ -67,11 +67,11 @@ public class GameSession extends MihoyoKcpChannel { return this.getAccount().getId(); } - public GenshinPlayer getPlayer() { + public Player getPlayer() { return player; } - public synchronized void setPlayer(GenshinPlayer player) { + public synchronized void setPlayer(Player player) { this.player = player; this.player.setSession(this); this.player.setAccount(this.getAccount()); @@ -144,43 +144,35 @@ public class GameSession extends MihoyoKcpChannel { byte[] packet = FileUtils.read(p); - GenshinPacket genshinPacket = new GenshinPacket(opcode); - genshinPacket.setData(packet); + BasePacket basePacket = new BasePacket(opcode); + basePacket.setData(packet); - // Log - logPacket(genshinPacket.getOpcode()); - - send(genshinPacket); + send(basePacket); } - public void send(GenshinPacket genshinPacket) { + public void send(BasePacket packet) { // Test - if (genshinPacket.getOpcode() <= 0) { + if (packet.getOpcode() <= 0) { Grasscutter.getLogger().warn("Tried to send packet with missing cmd id!"); return; } // Header - if (genshinPacket.shouldBuildHeader()) { - genshinPacket.buildHeader(this.getNextClientSequence()); + if (packet.shouldBuildHeader()) { + packet.buildHeader(this.getNextClientSequence()); } // Log if (Grasscutter.getConfig().getGameServerOptions().LOG_PACKETS) { - logPacket(genshinPacket); + logPacket(packet); } // Invoke event. - SendPacketEvent event = new SendPacketEvent(this, genshinPacket); event.call(); + SendPacketEvent event = new SendPacketEvent(this, packet); event.call(); if(!event.isCanceled()) // If event is not cancelled, continue. this.send(event.getPacket().build()); } - private void logPacket(int opcode) { - //Grasscutter.getLogger().info("SEND: " + PacketOpcodesUtil.getOpcodeName(opcode)); - //System.out.println(Utils.bytesToHex(genshinPacket.getData())); - } - private static final Set<Integer> loopPacket = Set.of( PacketOpcodes.PingReq, PacketOpcodes.PingRsp, @@ -189,10 +181,10 @@ public class GameSession extends MihoyoKcpChannel { PacketOpcodes.QueryPathReq ); - private void logPacket(GenshinPacket genshinPacket) { - if (!loopPacket.contains(genshinPacket.getOpcode())) { - Grasscutter.getLogger().info("SEND: " + PacketOpcodesUtil.getOpcodeName(genshinPacket.getOpcode()) + " (" + genshinPacket.getOpcode() + ")"); - System.out.println(Utils.bytesToHex(genshinPacket.getData())); + private void logPacket(BasePacket packet) { + if (!loopPacket.contains(packet.getOpcode())) { + Grasscutter.getLogger().info("SEND: " + PacketOpcodesUtil.getOpcodeName(packet.getOpcode()) + " (" + packet.getOpcode() + ")"); + System.out.println(Utils.bytesToHex(packet.getData())); } } diff --git a/src/main/java/emu/grasscutter/server/packet/recv/HandlerAvatarFetterLevelRewardReq.java b/src/main/java/emu/grasscutter/server/packet/recv/HandlerAvatarFetterLevelRewardReq.java index b8b4f5e57..fa760a7a8 100644 --- a/src/main/java/emu/grasscutter/server/packet/recv/HandlerAvatarFetterLevelRewardReq.java +++ b/src/main/java/emu/grasscutter/server/packet/recv/HandlerAvatarFetterLevelRewardReq.java @@ -1,9 +1,9 @@ package emu.grasscutter.server.packet.recv; -import emu.grasscutter.data.GenshinData; +import emu.grasscutter.data.GameData; import emu.grasscutter.data.def.RewardData; -import emu.grasscutter.game.avatar.GenshinAvatar; -import emu.grasscutter.game.inventory.GenshinItem; +import emu.grasscutter.game.avatar.Avatar; +import emu.grasscutter.game.inventory.GameItem; import emu.grasscutter.game.props.ActionReason; import emu.grasscutter.net.packet.Opcodes; import emu.grasscutter.net.packet.PacketOpcodes; @@ -27,14 +27,14 @@ public class HandlerAvatarFetterLevelRewardReq extends PacketHandler { } else { long avatarGuid = req.getAvatarGuid(); - GenshinAvatar avatar = session + Avatar avatar = session .getPlayer() .getAvatars() .getAvatarByGuid(avatarGuid); int rewardId = avatar.getNameCardRewardId(); - RewardData card = GenshinData.getRewardDataMap().get(rewardId); + RewardData card = GameData.getRewardDataMap().get(rewardId); int cardId = card.getRewardItemList().get(0).getItemId(); if (session.getPlayer().getNameCardList().contains(cardId)) { @@ -43,9 +43,8 @@ public class HandlerAvatarFetterLevelRewardReq extends PacketHandler { return; } - GenshinItem item = new GenshinItem(cardId); - session.getPlayer().getInventory().addItem(item); - session.getPlayer().sendPacket(new PacketItemAddHintNotify(item, ActionReason.FetterLevelReward)); + GameItem item = new GameItem(cardId); + session.getPlayer().getInventory().addItem(item, ActionReason.FetterLevelReward); session.getPlayer().sendPacket(new PacketUnlockNameCardNotify(cardId)); session.send(new PacketAvatarFetterDataNotify(avatar)); session.send(new PacketAvatarDataNotify(avatar.getPlayer())); diff --git a/src/main/java/emu/grasscutter/server/packet/recv/HandlerChangeMailStarNotify.java b/src/main/java/emu/grasscutter/server/packet/recv/HandlerChangeMailStarNotify.java new file mode 100644 index 000000000..0967cfc47 --- /dev/null +++ b/src/main/java/emu/grasscutter/server/packet/recv/HandlerChangeMailStarNotify.java @@ -0,0 +1,34 @@ +package emu.grasscutter.server.packet.recv; + +import emu.grasscutter.game.mail.Mail; +import emu.grasscutter.net.packet.Opcodes; +import emu.grasscutter.net.packet.PacketHandler; +import emu.grasscutter.net.packet.PacketOpcodes; +import emu.grasscutter.net.proto.ChangeMailStarNotifyOuterClass; +import emu.grasscutter.server.game.GameSession; +import emu.grasscutter.server.packet.send.PacketMailChangeNotify; + +import java.util.ArrayList; +import java.util.List; + +@Opcodes(PacketOpcodes.ChangeMailStarNotify) +public class HandlerChangeMailStarNotify extends PacketHandler { + + @Override + public void handle(GameSession session, byte[] header, byte[] payload) throws Exception { + ChangeMailStarNotifyOuterClass.ChangeMailStarNotify req = ChangeMailStarNotifyOuterClass.ChangeMailStarNotify.parseFrom(payload); + + List<Mail> updatedMail = new ArrayList<>(); + + for (int mailId : req.getMailIdListList()) { + Mail message = session.getPlayer().getMail(mailId); + + message.importance = req.getIsStar() == true ? 1 : 0; + + session.getPlayer().replaceMailByIndex(mailId, message); + updatedMail.add(message); + } + + session.send(new PacketMailChangeNotify(session.getPlayer(), updatedMail)); + } +} diff --git a/src/main/java/emu/grasscutter/server/packet/recv/HandlerCombatInvocationsNotify.java b/src/main/java/emu/grasscutter/server/packet/recv/HandlerCombatInvocationsNotify.java index e06cd51da..a5a3fd4c3 100644 --- a/src/main/java/emu/grasscutter/server/packet/recv/HandlerCombatInvocationsNotify.java +++ b/src/main/java/emu/grasscutter/server/packet/recv/HandlerCombatInvocationsNotify.java @@ -1,6 +1,6 @@ package emu.grasscutter.server.packet.recv; -import emu.grasscutter.game.entity.GenshinEntity; +import emu.grasscutter.game.entity.GameEntity; import emu.grasscutter.net.packet.Opcodes; import emu.grasscutter.net.packet.PacketOpcodes; import emu.grasscutter.net.proto.CombatInvocationsNotifyOuterClass.CombatInvocationsNotify; @@ -27,7 +27,7 @@ public class HandlerCombatInvocationsNotify extends PacketHandler { case ENTITY_MOVE: // Handle movement EntityMoveInfo moveInfo = EntityMoveInfo.parseFrom(entry.getCombatData()); - GenshinEntity entity = session.getPlayer().getScene().getEntityById(moveInfo.getEntityId()); + GameEntity entity = session.getPlayer().getScene().getEntityById(moveInfo.getEntityId()); if (entity != null) { entity.getPosition().set(moveInfo.getMotionInfo().getPos()); entity.getRotation().set(moveInfo.getMotionInfo().getRot()); diff --git a/src/main/java/emu/grasscutter/server/packet/recv/HandlerDelMailReq.java b/src/main/java/emu/grasscutter/server/packet/recv/HandlerDelMailReq.java new file mode 100644 index 000000000..4c6473996 --- /dev/null +++ b/src/main/java/emu/grasscutter/server/packet/recv/HandlerDelMailReq.java @@ -0,0 +1,21 @@ +package emu.grasscutter.server.packet.recv; + +import emu.grasscutter.net.packet.Opcodes; +import emu.grasscutter.net.packet.PacketHandler; +import emu.grasscutter.net.packet.PacketOpcodes; +import emu.grasscutter.net.proto.DelMailReqOuterClass; +import emu.grasscutter.net.proto.DeleteFriendReqOuterClass; +import emu.grasscutter.server.game.GameSession; +import emu.grasscutter.server.packet.send.PacketDelMailRsp; + +@Opcodes(PacketOpcodes.DelMailReq) +public class HandlerDelMailReq extends PacketHandler { + + @Override + public void handle(GameSession session, byte[] header, byte[] payload) throws Exception { + DelMailReqOuterClass.DelMailReq req = DelMailReqOuterClass.DelMailReq.parseFrom(payload); + + session.send(new PacketDelMailRsp(session.getPlayer(), req.getMailIdListList())); + } + +} diff --git a/src/main/java/emu/grasscutter/server/packet/recv/HandlerEnterSceneDoneReq.java b/src/main/java/emu/grasscutter/server/packet/recv/HandlerEnterSceneDoneReq.java index 2f7da6884..d374cfd46 100644 --- a/src/main/java/emu/grasscutter/server/packet/recv/HandlerEnterSceneDoneReq.java +++ b/src/main/java/emu/grasscutter/server/packet/recv/HandlerEnterSceneDoneReq.java @@ -1,6 +1,6 @@ package emu.grasscutter.server.packet.recv; -import emu.grasscutter.game.GenshinPlayer.SceneLoadState; +import emu.grasscutter.game.player.Player.SceneLoadState; import emu.grasscutter.net.packet.Opcodes; import emu.grasscutter.net.packet.PacketOpcodes; import emu.grasscutter.net.packet.PacketHandler; diff --git a/src/main/java/emu/grasscutter/server/packet/recv/HandleEvtAvatarSitDownNotify.java b/src/main/java/emu/grasscutter/server/packet/recv/HandlerEvtAvatarSitDownNotify.java similarity index 91% rename from src/main/java/emu/grasscutter/server/packet/recv/HandleEvtAvatarSitDownNotify.java rename to src/main/java/emu/grasscutter/server/packet/recv/HandlerEvtAvatarSitDownNotify.java index 8f653dde9..d825bf21a 100644 --- a/src/main/java/emu/grasscutter/server/packet/recv/HandleEvtAvatarSitDownNotify.java +++ b/src/main/java/emu/grasscutter/server/packet/recv/HandlerEvtAvatarSitDownNotify.java @@ -8,7 +8,7 @@ import emu.grasscutter.server.game.GameSession; import emu.grasscutter.server.packet.send.PacketEvtAvatarSitDownNotify; @Opcodes(PacketOpcodes.EvtAvatarSitDownNotify) -public class HandleEvtAvatarSitDownNotify extends PacketHandler { +public class HandlerEvtAvatarSitDownNotify extends PacketHandler { @Override public void handle(GameSession session, byte[] header, byte[] payload) throws Exception { diff --git a/src/main/java/emu/grasscutter/server/packet/recv/HandlerGetAllMailReq.java b/src/main/java/emu/grasscutter/server/packet/recv/HandlerGetAllMailReq.java new file mode 100644 index 000000000..899ba6d95 --- /dev/null +++ b/src/main/java/emu/grasscutter/server/packet/recv/HandlerGetAllMailReq.java @@ -0,0 +1,21 @@ +package emu.grasscutter.server.packet.recv; + +import emu.grasscutter.Grasscutter; +import emu.grasscutter.net.packet.Opcodes; +import emu.grasscutter.net.packet.PacketOpcodes; +import emu.grasscutter.net.packet.PacketHandler; +import emu.grasscutter.net.proto.GetAllMailReqOuterClass; +import emu.grasscutter.net.proto.GetPlayerTokenReqOuterClass; +import emu.grasscutter.server.game.GameSession; +import emu.grasscutter.server.packet.send.PacketGetAllMailRsp; +import emu.grasscutter.server.packet.send.PacketGetGachaInfoRsp; + +@Opcodes(PacketOpcodes.GetAllMailReq) +public class HandlerGetAllMailReq extends PacketHandler { + + @Override + public void handle(GameSession session, byte[] header, byte[] payload) throws Exception { + GetAllMailReqOuterClass.GetAllMailReq req = GetAllMailReqOuterClass.GetAllMailReq.parseFrom(payload); + session.send(new PacketGetAllMailRsp(session.getPlayer(), req.getIsGiftMail())); + } +} diff --git a/src/main/java/emu/grasscutter/server/packet/recv/HandlerGetMailItemReq.java b/src/main/java/emu/grasscutter/server/packet/recv/HandlerGetMailItemReq.java new file mode 100644 index 000000000..f00bf911e --- /dev/null +++ b/src/main/java/emu/grasscutter/server/packet/recv/HandlerGetMailItemReq.java @@ -0,0 +1,20 @@ +package emu.grasscutter.server.packet.recv; + +import emu.grasscutter.Grasscutter; +import emu.grasscutter.net.packet.Opcodes; +import emu.grasscutter.net.packet.PacketHandler; +import emu.grasscutter.net.packet.PacketOpcodes; +import emu.grasscutter.net.proto.GetMailItemReqOuterClass; +import emu.grasscutter.server.game.GameSession; +import emu.grasscutter.server.packet.send.PacketGetMailItemRsp; + +@Opcodes(PacketOpcodes.GetMailItemReq) +public class HandlerGetMailItemReq extends PacketHandler { + + @Override + public void handle(GameSession session, byte[] header, byte[] payload) throws Exception { + GetMailItemReqOuterClass.GetMailItemReq req = GetMailItemReqOuterClass.GetMailItemReq.parseFrom(payload); + session.send(new PacketGetMailItemRsp(session.getPlayer(), req.getMailIdListList())); + } + +} diff --git a/src/main/java/emu/grasscutter/server/packet/recv/HandlerGetPlayerBlacklistReq.java b/src/main/java/emu/grasscutter/server/packet/recv/HandlerGetPlayerBlacklistReq.java index 2d0b650d8..7036aff6a 100644 --- a/src/main/java/emu/grasscutter/server/packet/recv/HandlerGetPlayerBlacklistReq.java +++ b/src/main/java/emu/grasscutter/server/packet/recv/HandlerGetPlayerBlacklistReq.java @@ -1,6 +1,6 @@ package emu.grasscutter.server.packet.recv; -import emu.grasscutter.net.packet.GenshinPacket; +import emu.grasscutter.net.packet.BasePacket; import emu.grasscutter.net.packet.Opcodes; import emu.grasscutter.net.packet.PacketOpcodes; import emu.grasscutter.net.packet.PacketHandler; @@ -11,7 +11,7 @@ public class HandlerGetPlayerBlacklistReq extends PacketHandler { @Override public void handle(GameSession session, byte[] header, byte[] payload) throws Exception { - session.send(new GenshinPacket(PacketOpcodes.GetPlayerBlacklistRsp).buildHeader(3)); + session.send(new BasePacket(PacketOpcodes.GetPlayerBlacklistRsp).buildHeader(3)); } } diff --git a/src/main/java/emu/grasscutter/server/packet/recv/HandlerMarkMapReq.java b/src/main/java/emu/grasscutter/server/packet/recv/HandlerMarkMapReq.java index a46aec718..bd403047f 100644 --- a/src/main/java/emu/grasscutter/server/packet/recv/HandlerMarkMapReq.java +++ b/src/main/java/emu/grasscutter/server/packet/recv/HandlerMarkMapReq.java @@ -1,8 +1,8 @@ package emu.grasscutter.server.packet.recv; import emu.grasscutter.Grasscutter; -import emu.grasscutter.game.World; import emu.grasscutter.game.props.EnterReason; +import emu.grasscutter.game.world.World; import emu.grasscutter.net.packet.Opcodes; import emu.grasscutter.net.packet.PacketOpcodes; import emu.grasscutter.net.proto.EnterTypeOuterClass.EnterType; diff --git a/src/main/java/emu/grasscutter/server/packet/recv/HandlerNpcTalkReq.java b/src/main/java/emu/grasscutter/server/packet/recv/HandlerNpcTalkReq.java index 588e1c4e1..309d7e2e2 100644 --- a/src/main/java/emu/grasscutter/server/packet/recv/HandlerNpcTalkReq.java +++ b/src/main/java/emu/grasscutter/server/packet/recv/HandlerNpcTalkReq.java @@ -1,6 +1,6 @@ package emu.grasscutter.server.packet.recv; -import emu.grasscutter.game.inventory.GenshinItem; +import emu.grasscutter.game.inventory.GameItem; import emu.grasscutter.net.packet.Opcodes; import emu.grasscutter.net.packet.PacketOpcodes; import emu.grasscutter.net.proto.NpcTalkReqOuterClass.NpcTalkReq; diff --git a/src/main/java/emu/grasscutter/server/packet/recv/HandlerPlayerLoginReq.java b/src/main/java/emu/grasscutter/server/packet/recv/HandlerPlayerLoginReq.java index 05753aec0..a419a0db9 100644 --- a/src/main/java/emu/grasscutter/server/packet/recv/HandlerPlayerLoginReq.java +++ b/src/main/java/emu/grasscutter/server/packet/recv/HandlerPlayerLoginReq.java @@ -1,8 +1,8 @@ package emu.grasscutter.server.packet.recv; import emu.grasscutter.database.DatabaseHelper; -import emu.grasscutter.game.GenshinPlayer; -import emu.grasscutter.net.packet.GenshinPacket; +import emu.grasscutter.game.player.Player; +import emu.grasscutter.net.packet.BasePacket; import emu.grasscutter.net.packet.Opcodes; import emu.grasscutter.net.packet.PacketOpcodes; import emu.grasscutter.net.proto.PlayerLoginReqOuterClass.PlayerLoginReq; @@ -30,12 +30,12 @@ public class HandlerPlayerLoginReq extends PacketHandler { } // Load character from db - GenshinPlayer player = DatabaseHelper.getPlayerById(session.getAccount().getPlayerUid()); + Player player = DatabaseHelper.getPlayerById(session.getAccount().getPlayerUid()); if (player == null) { // Send packets session.setState(SessionState.PICKING_CHARACTER); - session.send(new GenshinPacket(PacketOpcodes.DoSetPlayerBornDataNotify)); + session.send(new BasePacket(PacketOpcodes.DoSetPlayerBornDataNotify)); } else { // Set character session.setPlayer(player); diff --git a/src/main/java/emu/grasscutter/server/packet/recv/HandlerPrivateChatReq.java b/src/main/java/emu/grasscutter/server/packet/recv/HandlerPrivateChatReq.java index b576bbb20..89c0621cb 100644 --- a/src/main/java/emu/grasscutter/server/packet/recv/HandlerPrivateChatReq.java +++ b/src/main/java/emu/grasscutter/server/packet/recv/HandlerPrivateChatReq.java @@ -19,8 +19,6 @@ public class HandlerPrivateChatReq extends PacketHandler { } else if (content == PrivateChatReq.ContentCase.ICON) { session.getServer().getChatManager().sendPrivateMessage(session.getPlayer(), req.getTargetUid(), req.getIcon()); } - - //session.send(new GenshinPacket(PacketOpcodes.PrivateChatRsp)); // Unused by server } } diff --git a/src/main/java/emu/grasscutter/server/packet/recv/HandlerReadMailNotify.java b/src/main/java/emu/grasscutter/server/packet/recv/HandlerReadMailNotify.java new file mode 100644 index 000000000..8c9c87149 --- /dev/null +++ b/src/main/java/emu/grasscutter/server/packet/recv/HandlerReadMailNotify.java @@ -0,0 +1,35 @@ +package emu.grasscutter.server.packet.recv; + +import emu.grasscutter.game.mail.Mail; +import emu.grasscutter.net.packet.Opcodes; +import emu.grasscutter.net.packet.PacketHandler; +import emu.grasscutter.net.packet.PacketOpcodes; +import emu.grasscutter.net.proto.GetAllMailReqOuterClass; +import emu.grasscutter.net.proto.ReadMailNotifyOuterClass; +import emu.grasscutter.server.game.GameSession; +import emu.grasscutter.server.packet.send.PacketMailChangeNotify; + +import java.util.ArrayList; +import java.util.List; + +@Opcodes(PacketOpcodes.ReadMailNotify) +public class HandlerReadMailNotify extends PacketHandler { + + @Override + public void handle(GameSession session, byte[] header, byte[] payload) throws Exception { + ReadMailNotifyOuterClass.ReadMailNotify req = ReadMailNotifyOuterClass.ReadMailNotify.parseFrom(payload); + + List<Mail> updatedMail = new ArrayList<>(); + + for (int mailId : req.getMailIdListList()) { + Mail message = session.getPlayer().getMail(mailId); + + message.isRead = true; + + session.getPlayer().replaceMailByIndex(mailId, message); + updatedMail.add(message); + } + + session.send(new PacketMailChangeNotify(session.getPlayer(), updatedMail)); + } +} diff --git a/src/main/java/emu/grasscutter/server/packet/recv/HandlerSceneEntityDrownReq.java b/src/main/java/emu/grasscutter/server/packet/recv/HandlerSceneEntityDrownReq.java index e69de29bb..fefbee3b6 100644 --- a/src/main/java/emu/grasscutter/server/packet/recv/HandlerSceneEntityDrownReq.java +++ b/src/main/java/emu/grasscutter/server/packet/recv/HandlerSceneEntityDrownReq.java @@ -0,0 +1,35 @@ +package emu.grasscutter.server.packet.recv; + +import emu.grasscutter.game.entity.EntityAvatar; +import emu.grasscutter.game.entity.EntityMonster; +import emu.grasscutter.game.entity.GameEntity; +import emu.grasscutter.game.props.FightProperty; +import emu.grasscutter.game.props.LifeState; +import emu.grasscutter.net.packet.Opcodes; +import emu.grasscutter.net.packet.PacketHandler; +import emu.grasscutter.net.packet.PacketOpcodes; +import emu.grasscutter.net.proto.SceneEntityDrownReqOuterClass.SceneEntityDrownReq; +import emu.grasscutter.server.game.GameSession; +import emu.grasscutter.server.packet.send.PacketSceneEntityDrownRsp; + +@Opcodes(PacketOpcodes.SceneEntityDrownReq) +public class HandlerSceneEntityDrownReq extends PacketHandler { + + @Override + public void handle(GameSession session, byte[] header, byte[] payload) throws Exception { + SceneEntityDrownReq req = SceneEntityDrownReq.parseFrom(payload); + + GameEntity entity = session.getPlayer().getScene().getEntityById(req.getEntityId()); + + if (entity == null || !(entity instanceof EntityMonster || entity instanceof EntityAvatar)) { + return; + } + + entity.setFightProperty(FightProperty.FIGHT_PROP_CUR_HP, 0); + + //TODO: make a list somewhere of all entities to remove per tick rather than one by one + session.getPlayer().getScene().killEntity(entity, 0); + session.getPlayer().getScene().broadcastPacket(new PacketSceneEntityDrownRsp(req.getEntityId())); + } + +} diff --git a/src/main/java/emu/grasscutter/server/packet/recv/HandlerSceneInitFinishReq.java b/src/main/java/emu/grasscutter/server/packet/recv/HandlerSceneInitFinishReq.java index 4a4dbfcf1..587cf7ce1 100644 --- a/src/main/java/emu/grasscutter/server/packet/recv/HandlerSceneInitFinishReq.java +++ b/src/main/java/emu/grasscutter/server/packet/recv/HandlerSceneInitFinishReq.java @@ -1,7 +1,7 @@ package emu.grasscutter.server.packet.recv; -import emu.grasscutter.game.GenshinPlayer.SceneLoadState; -import emu.grasscutter.net.packet.GenshinPacket; +import emu.grasscutter.game.player.Player.SceneLoadState; +import emu.grasscutter.net.packet.BasePacket; import emu.grasscutter.net.packet.Opcodes; import emu.grasscutter.net.packet.PacketOpcodes; import emu.grasscutter.net.packet.PacketHandler; @@ -31,7 +31,7 @@ public class HandlerSceneInitFinishReq extends PacketHandler { session.send(new PacketWorldPlayerInfoNotify(session.getPlayer().getWorld())); session.send(new PacketWorldDataNotify(session.getPlayer().getWorld())); session.send(new PacketSceneUnlockInfoNotify()); - session.send(new GenshinPacket(PacketOpcodes.SceneForceUnlockNotify)); + session.send(new BasePacket(PacketOpcodes.SceneForceUnlockNotify)); session.send(new PacketHostPlayerNotify(session.getPlayer().getWorld())); session.send(new PacketSceneTimeNotify(session.getPlayer())); diff --git a/src/main/java/emu/grasscutter/server/packet/recv/HandlerSceneTransToPointReq.java b/src/main/java/emu/grasscutter/server/packet/recv/HandlerSceneTransToPointReq.java index f01f5980d..65783d01b 100644 --- a/src/main/java/emu/grasscutter/server/packet/recv/HandlerSceneTransToPointReq.java +++ b/src/main/java/emu/grasscutter/server/packet/recv/HandlerSceneTransToPointReq.java @@ -1,6 +1,6 @@ package emu.grasscutter.server.packet.recv; -import emu.grasscutter.data.GenshinData; +import emu.grasscutter.data.GameData; import emu.grasscutter.data.custom.ScenePointEntry; import emu.grasscutter.net.packet.Opcodes; import emu.grasscutter.net.packet.PacketOpcodes; @@ -19,7 +19,7 @@ public class HandlerSceneTransToPointReq extends PacketHandler { SceneTransToPointReq req = SceneTransToPointReq.parseFrom(payload); String code = req.getSceneId() + "_" + req.getPointId(); - ScenePointEntry scenePointEntry = GenshinData.getScenePointEntries().get(code); + ScenePointEntry scenePointEntry = GameData.getScenePointEntries().get(code); if (scenePointEntry != null) { float x = scenePointEntry.getPointData().getTranPos().getX(); diff --git a/src/main/java/emu/grasscutter/server/packet/recv/HandlerSetEntityClientDataNotify.java b/src/main/java/emu/grasscutter/server/packet/recv/HandlerSetEntityClientDataNotify.java index d194e1465..5151034f2 100644 --- a/src/main/java/emu/grasscutter/server/packet/recv/HandlerSetEntityClientDataNotify.java +++ b/src/main/java/emu/grasscutter/server/packet/recv/HandlerSetEntityClientDataNotify.java @@ -1,6 +1,6 @@ package emu.grasscutter.server.packet.recv; -import emu.grasscutter.net.packet.GenshinPacket; +import emu.grasscutter.net.packet.BasePacket; import emu.grasscutter.net.packet.Opcodes; import emu.grasscutter.net.packet.PacketOpcodes; import emu.grasscutter.net.proto.SetEntityClientDataNotifyOuterClass.SetEntityClientDataNotify; @@ -20,7 +20,7 @@ public class HandlerSetEntityClientDataNotify extends PacketHandler { // Make sure packet is a valid proto before replaying it to the other players SetEntityClientDataNotify notif = SetEntityClientDataNotify.parseFrom(payload); - GenshinPacket packet = new GenshinPacket(PacketOpcodes.SetEntityClientDataNotify, true); + BasePacket packet = new BasePacket(PacketOpcodes.SetEntityClientDataNotify, true); packet.setData(notif); session.getPlayer().getScene().broadcastPacketToOthers(session.getPlayer(), packet); diff --git a/src/main/java/emu/grasscutter/server/packet/recv/HandlerSetPlayerBornDataReq.java b/src/main/java/emu/grasscutter/server/packet/recv/HandlerSetPlayerBornDataReq.java index 72fc709d9..53312b5b1 100644 --- a/src/main/java/emu/grasscutter/server/packet/recv/HandlerSetPlayerBornDataReq.java +++ b/src/main/java/emu/grasscutter/server/packet/recv/HandlerSetPlayerBornDataReq.java @@ -1,12 +1,12 @@ package emu.grasscutter.server.packet.recv; -import emu.grasscutter.GenshinConstants; +import emu.grasscutter.GameConstants; import emu.grasscutter.Grasscutter; -import emu.grasscutter.data.GenshinData; +import emu.grasscutter.data.GameData; import emu.grasscutter.database.DatabaseHelper; -import emu.grasscutter.game.GenshinPlayer; -import emu.grasscutter.game.avatar.GenshinAvatar; -import emu.grasscutter.net.packet.GenshinPacket; +import emu.grasscutter.game.avatar.Avatar; +import emu.grasscutter.game.player.Player; +import emu.grasscutter.net.packet.BasePacket; import emu.grasscutter.net.packet.Opcodes; import emu.grasscutter.net.packet.PacketOpcodes; import emu.grasscutter.net.proto.SetPlayerBornDataReqOuterClass.SetPlayerBornDataReq; @@ -24,9 +24,9 @@ public class HandlerSetPlayerBornDataReq extends PacketHandler { // Sanity checks int avatarId = req.getAvatarId(); int startingSkillDepot = 0; - if (avatarId == GenshinConstants.MAIN_CHARACTER_MALE) { + if (avatarId == GameConstants.MAIN_CHARACTER_MALE) { startingSkillDepot = 504; - } else if (avatarId == GenshinConstants.MAIN_CHARACTER_FEMALE) { + } else if (avatarId == GameConstants.MAIN_CHARACTER_FEMALE) { startingSkillDepot = 704; } else { return; @@ -38,7 +38,7 @@ public class HandlerSetPlayerBornDataReq extends PacketHandler { } // Create character - GenshinPlayer player = new GenshinPlayer(session); + Player player = new Player(session); player.setNickname(nickname); try { @@ -47,8 +47,8 @@ public class HandlerSetPlayerBornDataReq extends PacketHandler { // Create avatar if (player.getAvatars().getAvatarCount() == 0) { - GenshinAvatar mainCharacter = new GenshinAvatar(avatarId); - mainCharacter.setSkillDepot(GenshinData.getAvatarSkillDepotDataMap().get(startingSkillDepot)); + Avatar mainCharacter = new Avatar(avatarId); + mainCharacter.setSkillDepot(GameData.getAvatarSkillDepotDataMap().get(startingSkillDepot)); player.addAvatar(mainCharacter); player.setMainCharacterId(avatarId); player.setHeadImage(avatarId); @@ -68,7 +68,7 @@ public class HandlerSetPlayerBornDataReq extends PacketHandler { session.setState(SessionState.ACTIVE); // Born resp packet - session.send(new GenshinPacket(PacketOpcodes.SetPlayerBornDataRsp)); + session.send(new BasePacket(PacketOpcodes.SetPlayerBornDataRsp)); } catch (Exception e) { Grasscutter.getLogger().error("Error creating player object: ", e); session.close(); diff --git a/src/main/java/emu/grasscutter/server/packet/recv/HandlerTakePlayerLevelRewardReq.java b/src/main/java/emu/grasscutter/server/packet/recv/HandlerTakePlayerLevelRewardReq.java index a81da7758..8ee2d934b 100644 --- a/src/main/java/emu/grasscutter/server/packet/recv/HandlerTakePlayerLevelRewardReq.java +++ b/src/main/java/emu/grasscutter/server/packet/recv/HandlerTakePlayerLevelRewardReq.java @@ -5,9 +5,9 @@ import java.util.List; import java.util.Set; import emu.grasscutter.Grasscutter; -import emu.grasscutter.data.GenshinData; +import emu.grasscutter.data.GameData; import emu.grasscutter.data.common.RewardItemData; -import emu.grasscutter.game.inventory.GenshinItem; +import emu.grasscutter.game.inventory.GameItem; import emu.grasscutter.game.props.ActionReason; import emu.grasscutter.net.packet.Opcodes; import emu.grasscutter.net.packet.PacketHandler; @@ -24,15 +24,15 @@ public class HandlerTakePlayerLevelRewardReq extends PacketHandler { TakePlayerLevelRewardReq req = TakePlayerLevelRewardReq.parseFrom(payload); int level = req.getLevel(); - int rewardId = GenshinData.getPlayerLevelDataMap().get(level).getRewardId(); + int rewardId = GameData.getPlayerLevelDataMap().get(level).getRewardId(); if (rewardId != 0) { - List<RewardItemData> rewardItems = GenshinData.getRewardDataMap().get(rewardId).getRewardItemList(); - List<GenshinItem> items = new LinkedList<>(); + List<RewardItemData> rewardItems = GameData.getRewardDataMap().get(rewardId).getRewardItemList(); + List<GameItem> items = new LinkedList<>(); for (RewardItemData rewardItem : rewardItems) { if (rewardItem != null) { if (rewardItem.getItemId() != 0) { - items.add(new GenshinItem(rewardItem.getItemId(), rewardItem.getItemCount())); + items.add(new GameItem(rewardItem.getItemId(), rewardItem.getItemCount())); } } } diff --git a/src/main/java/emu/grasscutter/server/packet/recv/HandlerUseItemReq.java b/src/main/java/emu/grasscutter/server/packet/recv/HandlerUseItemReq.java index 8a1f4a70c..81a1f160b 100644 --- a/src/main/java/emu/grasscutter/server/packet/recv/HandlerUseItemReq.java +++ b/src/main/java/emu/grasscutter/server/packet/recv/HandlerUseItemReq.java @@ -1,6 +1,6 @@ package emu.grasscutter.server.packet.recv; -import emu.grasscutter.game.inventory.GenshinItem; +import emu.grasscutter.game.inventory.GameItem; import emu.grasscutter.net.packet.Opcodes; import emu.grasscutter.net.packet.PacketOpcodes; import emu.grasscutter.net.proto.UseItemReqOuterClass.UseItemReq; @@ -15,7 +15,7 @@ public class HandlerUseItemReq extends PacketHandler { public void handle(GameSession session, byte[] header, byte[] payload) throws Exception { UseItemReq req = UseItemReq.parseFrom(payload); - GenshinItem useItem = session.getServer().getInventoryManager().useItem(session.getPlayer(), req.getTargetGuid(), req.getGuid(), req.getCount()); + GameItem useItem = session.getServer().getInventoryManager().useItem(session.getPlayer(), req.getTargetGuid(), req.getGuid(), req.getCount()); if (useItem != null) { session.send(new PacketUseItemRsp(req.getTargetGuid(), useItem)); } else { diff --git a/src/main/java/emu/grasscutter/server/packet/send/Packet.java b/src/main/java/emu/grasscutter/server/packet/send/Packet.java index 70306892d..22f4924a1 100644 --- a/src/main/java/emu/grasscutter/server/packet/send/Packet.java +++ b/src/main/java/emu/grasscutter/server/packet/send/Packet.java @@ -1,9 +1,9 @@ package emu.grasscutter.server.packet.send; -import emu.grasscutter.net.packet.GenshinPacket; +import emu.grasscutter.net.packet.BasePacket; import emu.grasscutter.net.packet.PacketOpcodes; -public class Packet extends GenshinPacket { +public class Packet extends BasePacket { public Packet() { super(PacketOpcodes.NONE); diff --git a/src/main/java/emu/grasscutter/server/packet/send/PacketAbilityChangeNotify.java b/src/main/java/emu/grasscutter/server/packet/send/PacketAbilityChangeNotify.java index d8cdfdef8..e6ce9ee00 100644 --- a/src/main/java/emu/grasscutter/server/packet/send/PacketAbilityChangeNotify.java +++ b/src/main/java/emu/grasscutter/server/packet/send/PacketAbilityChangeNotify.java @@ -1,11 +1,11 @@ package emu.grasscutter.server.packet.send; import emu.grasscutter.game.entity.EntityAvatar; -import emu.grasscutter.net.packet.GenshinPacket; +import emu.grasscutter.net.packet.BasePacket; import emu.grasscutter.net.packet.PacketOpcodes; import emu.grasscutter.net.proto.AbilityChangeNotifyOuterClass.AbilityChangeNotify; -public class PacketAbilityChangeNotify extends GenshinPacket { +public class PacketAbilityChangeNotify extends BasePacket { public PacketAbilityChangeNotify(EntityAvatar entity) { super(PacketOpcodes.AbilityChangeNotify, true); diff --git a/src/main/java/emu/grasscutter/server/packet/send/PacketAbilityInvocationsNotify.java b/src/main/java/emu/grasscutter/server/packet/send/PacketAbilityInvocationsNotify.java index 5b1b19a4b..c674fb9d6 100644 --- a/src/main/java/emu/grasscutter/server/packet/send/PacketAbilityInvocationsNotify.java +++ b/src/main/java/emu/grasscutter/server/packet/send/PacketAbilityInvocationsNotify.java @@ -2,12 +2,12 @@ package emu.grasscutter.server.packet.send; import java.util.List; -import emu.grasscutter.net.packet.GenshinPacket; +import emu.grasscutter.net.packet.BasePacket; import emu.grasscutter.net.packet.PacketOpcodes; import emu.grasscutter.net.proto.AbilityInvocationsNotifyOuterClass.AbilityInvocationsNotify; import emu.grasscutter.net.proto.AbilityInvokeEntryOuterClass.AbilityInvokeEntry; -public class PacketAbilityInvocationsNotify extends GenshinPacket { +public class PacketAbilityInvocationsNotify extends BasePacket { public PacketAbilityInvocationsNotify(AbilityInvokeEntry entry) { super(PacketOpcodes.AbilityInvocationsNotify, true); diff --git a/src/main/java/emu/grasscutter/server/packet/send/PacketAskAddFriendNotify.java b/src/main/java/emu/grasscutter/server/packet/send/PacketAskAddFriendNotify.java index a0f2e428f..c71ea4beb 100644 --- a/src/main/java/emu/grasscutter/server/packet/send/PacketAskAddFriendNotify.java +++ b/src/main/java/emu/grasscutter/server/packet/send/PacketAskAddFriendNotify.java @@ -1,11 +1,11 @@ package emu.grasscutter.server.packet.send; import emu.grasscutter.game.friends.Friendship; -import emu.grasscutter.net.packet.GenshinPacket; +import emu.grasscutter.net.packet.BasePacket; import emu.grasscutter.net.packet.PacketOpcodes; import emu.grasscutter.net.proto.AskAddFriendNotifyOuterClass.AskAddFriendNotify; -public class PacketAskAddFriendNotify extends GenshinPacket { +public class PacketAskAddFriendNotify extends BasePacket { public PacketAskAddFriendNotify(Friendship friendship) { super(PacketOpcodes.AskAddFriendNotify); diff --git a/src/main/java/emu/grasscutter/server/packet/send/PacketAskAddFriendRsp.java b/src/main/java/emu/grasscutter/server/packet/send/PacketAskAddFriendRsp.java index df46ac296..3f258b75a 100644 --- a/src/main/java/emu/grasscutter/server/packet/send/PacketAskAddFriendRsp.java +++ b/src/main/java/emu/grasscutter/server/packet/send/PacketAskAddFriendRsp.java @@ -1,10 +1,10 @@ package emu.grasscutter.server.packet.send; -import emu.grasscutter.net.packet.GenshinPacket; +import emu.grasscutter.net.packet.BasePacket; import emu.grasscutter.net.packet.PacketOpcodes; import emu.grasscutter.net.proto.AskAddFriendRspOuterClass.AskAddFriendRsp; -public class PacketAskAddFriendRsp extends GenshinPacket { +public class PacketAskAddFriendRsp extends BasePacket { public PacketAskAddFriendRsp(int targetUid) { super(PacketOpcodes.AskAddFriendRsp); diff --git a/src/main/java/emu/grasscutter/server/packet/send/PacketAvatarAddNotify.java b/src/main/java/emu/grasscutter/server/packet/send/PacketAvatarAddNotify.java index 620165d5c..5ee2fb803 100644 --- a/src/main/java/emu/grasscutter/server/packet/send/PacketAvatarAddNotify.java +++ b/src/main/java/emu/grasscutter/server/packet/send/PacketAvatarAddNotify.java @@ -1,13 +1,13 @@ package emu.grasscutter.server.packet.send; -import emu.grasscutter.game.avatar.GenshinAvatar; -import emu.grasscutter.net.packet.GenshinPacket; +import emu.grasscutter.game.avatar.Avatar; +import emu.grasscutter.net.packet.BasePacket; import emu.grasscutter.net.packet.PacketOpcodes; import emu.grasscutter.net.proto.AvatarAddNotifyOuterClass.AvatarAddNotify; -public class PacketAvatarAddNotify extends GenshinPacket { +public class PacketAvatarAddNotify extends BasePacket { - public PacketAvatarAddNotify(GenshinAvatar avatar, boolean addedToTeam) { + public PacketAvatarAddNotify(Avatar avatar, boolean addedToTeam) { super(PacketOpcodes.AvatarAddNotify); AvatarAddNotify proto = AvatarAddNotify.newBuilder() diff --git a/src/main/java/emu/grasscutter/server/packet/send/PacketAvatarChangeCostumeNotify.java b/src/main/java/emu/grasscutter/server/packet/send/PacketAvatarChangeCostumeNotify.java index 4176bf71d..a14be26d1 100644 --- a/src/main/java/emu/grasscutter/server/packet/send/PacketAvatarChangeCostumeNotify.java +++ b/src/main/java/emu/grasscutter/server/packet/send/PacketAvatarChangeCostumeNotify.java @@ -1,11 +1,11 @@ package emu.grasscutter.server.packet.send; import emu.grasscutter.game.entity.EntityAvatar; -import emu.grasscutter.net.packet.GenshinPacket; +import emu.grasscutter.net.packet.BasePacket; import emu.grasscutter.net.packet.PacketOpcodes; import emu.grasscutter.net.proto.AvatarChangeCostumeNotifyOuterClass.AvatarChangeCostumeNotify; -public class PacketAvatarChangeCostumeNotify extends GenshinPacket { +public class PacketAvatarChangeCostumeNotify extends BasePacket { public PacketAvatarChangeCostumeNotify(EntityAvatar entity) { super(PacketOpcodes.AvatarChangeCostumeNotify); diff --git a/src/main/java/emu/grasscutter/server/packet/send/PacketAvatarChangeCostumeRsp.java b/src/main/java/emu/grasscutter/server/packet/send/PacketAvatarChangeCostumeRsp.java index cb39f6bbd..da5848378 100644 --- a/src/main/java/emu/grasscutter/server/packet/send/PacketAvatarChangeCostumeRsp.java +++ b/src/main/java/emu/grasscutter/server/packet/send/PacketAvatarChangeCostumeRsp.java @@ -1,11 +1,11 @@ package emu.grasscutter.server.packet.send; -import emu.grasscutter.net.packet.GenshinPacket; +import emu.grasscutter.net.packet.BasePacket; import emu.grasscutter.net.packet.PacketOpcodes; import emu.grasscutter.net.proto.AvatarChangeCostumeRspOuterClass.AvatarChangeCostumeRsp; import emu.grasscutter.net.proto.RetcodeOuterClass; -public class PacketAvatarChangeCostumeRsp extends GenshinPacket { +public class PacketAvatarChangeCostumeRsp extends BasePacket { public PacketAvatarChangeCostumeRsp(long avatarGuid, int costumeId) { super(PacketOpcodes.AvatarChangeCostumeRsp); diff --git a/src/main/java/emu/grasscutter/server/packet/send/PacketAvatarDataNotify.java b/src/main/java/emu/grasscutter/server/packet/send/PacketAvatarDataNotify.java index a05a2dabb..ca50b8f94 100644 --- a/src/main/java/emu/grasscutter/server/packet/send/PacketAvatarDataNotify.java +++ b/src/main/java/emu/grasscutter/server/packet/send/PacketAvatarDataNotify.java @@ -2,17 +2,17 @@ package emu.grasscutter.server.packet.send; import java.util.Map.Entry; -import emu.grasscutter.game.GenshinPlayer; -import emu.grasscutter.game.TeamInfo; -import emu.grasscutter.game.avatar.GenshinAvatar; -import emu.grasscutter.net.packet.GenshinPacket; +import emu.grasscutter.game.avatar.Avatar; +import emu.grasscutter.game.player.Player; +import emu.grasscutter.game.player.TeamInfo; +import emu.grasscutter.net.packet.BasePacket; import emu.grasscutter.net.packet.PacketOpcodes; import emu.grasscutter.net.proto.AvatarDataNotifyOuterClass.AvatarDataNotify; import emu.grasscutter.net.proto.AvatarTeamOuterClass.AvatarTeam; -public class PacketAvatarDataNotify extends GenshinPacket { +public class PacketAvatarDataNotify extends BasePacket { - public PacketAvatarDataNotify(GenshinPlayer player) { + public PacketAvatarDataNotify(Player player) { super(PacketOpcodes.AvatarDataNotify, 2); AvatarDataNotify.Builder proto = AvatarDataNotify.newBuilder() @@ -21,7 +21,7 @@ public class PacketAvatarDataNotify extends GenshinPacket { .addAllOwnedFlycloakList(player.getFlyCloakList()) .addAllOwnedCostumeList(player.getCostumeList()); - for (GenshinAvatar avatar : player.getAvatars()) { + for (Avatar avatar : player.getAvatars()) { proto.addAvatarList(avatar.toProto()); } @@ -31,7 +31,7 @@ public class PacketAvatarDataNotify extends GenshinPacket { .setTeamName(teamInfo.getName()); for (int i = 0; i < teamInfo.getAvatars().size(); i++) { - GenshinAvatar avatar = player.getAvatars().getAvatarById(teamInfo.getAvatars().get(i)); + Avatar avatar = player.getAvatars().getAvatarById(teamInfo.getAvatars().get(i)); avatarTeam.addAvatarGuidList(avatar.getGuid()); } diff --git a/src/main/java/emu/grasscutter/server/packet/send/PacketAvatarDieAnimationEndRsp.java b/src/main/java/emu/grasscutter/server/packet/send/PacketAvatarDieAnimationEndRsp.java index 3fa913a0a..b057ef34d 100644 --- a/src/main/java/emu/grasscutter/server/packet/send/PacketAvatarDieAnimationEndRsp.java +++ b/src/main/java/emu/grasscutter/server/packet/send/PacketAvatarDieAnimationEndRsp.java @@ -1,10 +1,10 @@ package emu.grasscutter.server.packet.send; -import emu.grasscutter.net.packet.GenshinPacket; +import emu.grasscutter.net.packet.BasePacket; import emu.grasscutter.net.packet.PacketOpcodes; import emu.grasscutter.net.proto.AvatarDieAnimationEndRspOuterClass.AvatarDieAnimationEndRsp; -public class PacketAvatarDieAnimationEndRsp extends GenshinPacket { +public class PacketAvatarDieAnimationEndRsp extends BasePacket { public PacketAvatarDieAnimationEndRsp(long dieGuid, int skillId) { super(PacketOpcodes.AvatarDieAnimationEndRsp); diff --git a/src/main/java/emu/grasscutter/server/packet/send/PacketAvatarEquipChangeNotify.java b/src/main/java/emu/grasscutter/server/packet/send/PacketAvatarEquipChangeNotify.java index 000c72d38..dc00ad75c 100644 --- a/src/main/java/emu/grasscutter/server/packet/send/PacketAvatarEquipChangeNotify.java +++ b/src/main/java/emu/grasscutter/server/packet/send/PacketAvatarEquipChangeNotify.java @@ -1,15 +1,15 @@ package emu.grasscutter.server.packet.send; -import emu.grasscutter.game.avatar.GenshinAvatar; +import emu.grasscutter.game.avatar.Avatar; import emu.grasscutter.game.inventory.EquipType; -import emu.grasscutter.game.inventory.GenshinItem; -import emu.grasscutter.net.packet.GenshinPacket; +import emu.grasscutter.game.inventory.GameItem; +import emu.grasscutter.net.packet.BasePacket; import emu.grasscutter.net.packet.PacketOpcodes; import emu.grasscutter.net.proto.AvatarEquipChangeNotifyOuterClass.AvatarEquipChangeNotify; -public class PacketAvatarEquipChangeNotify extends GenshinPacket { +public class PacketAvatarEquipChangeNotify extends BasePacket { - public PacketAvatarEquipChangeNotify(GenshinAvatar avatar, GenshinItem item) { + public PacketAvatarEquipChangeNotify(Avatar avatar, GameItem item) { super(PacketOpcodes.AvatarEquipChangeNotify); AvatarEquipChangeNotify.Builder proto = AvatarEquipChangeNotify.newBuilder() @@ -27,7 +27,7 @@ public class PacketAvatarEquipChangeNotify extends GenshinPacket { this.setData(proto); } - public PacketAvatarEquipChangeNotify(GenshinAvatar avatar, EquipType slot) { + public PacketAvatarEquipChangeNotify(Avatar avatar, EquipType slot) { super(PacketOpcodes.AvatarEquipChangeNotify); AvatarEquipChangeNotify.Builder proto = AvatarEquipChangeNotify.newBuilder() diff --git a/src/main/java/emu/grasscutter/server/packet/send/PacketAvatarFetterDataNotify.java b/src/main/java/emu/grasscutter/server/packet/send/PacketAvatarFetterDataNotify.java index 68d3dbeac..816fec64b 100644 --- a/src/main/java/emu/grasscutter/server/packet/send/PacketAvatarFetterDataNotify.java +++ b/src/main/java/emu/grasscutter/server/packet/send/PacketAvatarFetterDataNotify.java @@ -1,16 +1,16 @@ package emu.grasscutter.server.packet.send; -import emu.grasscutter.game.avatar.GenshinAvatar; +import emu.grasscutter.game.avatar.Avatar; import emu.grasscutter.game.props.FetterState; -import emu.grasscutter.net.packet.GenshinPacket; +import emu.grasscutter.net.packet.BasePacket; import emu.grasscutter.net.packet.PacketOpcodes; import emu.grasscutter.net.proto.AvatarFetterDataNotifyOuterClass.AvatarFetterDataNotify; import emu.grasscutter.net.proto.AvatarFetterInfoOuterClass.AvatarFetterInfo; import emu.grasscutter.net.proto.FetterDataOuterClass.FetterData; -public class PacketAvatarFetterDataNotify extends GenshinPacket { +public class PacketAvatarFetterDataNotify extends BasePacket { - public PacketAvatarFetterDataNotify(GenshinAvatar avatar) { + public PacketAvatarFetterDataNotify(Avatar avatar) { super(PacketOpcodes.AvatarFetterDataNotify); int fetterLevel = avatar.getFetterLevel(); diff --git a/src/main/java/emu/grasscutter/server/packet/send/PacketAvatarFetterLevelRewardRsp.java b/src/main/java/emu/grasscutter/server/packet/send/PacketAvatarFetterLevelRewardRsp.java index e9d4895ff..481cdb620 100644 --- a/src/main/java/emu/grasscutter/server/packet/send/PacketAvatarFetterLevelRewardRsp.java +++ b/src/main/java/emu/grasscutter/server/packet/send/PacketAvatarFetterLevelRewardRsp.java @@ -1,10 +1,10 @@ package emu.grasscutter.server.packet.send; -import emu.grasscutter.net.packet.GenshinPacket; +import emu.grasscutter.net.packet.BasePacket; import emu.grasscutter.net.packet.PacketOpcodes; import emu.grasscutter.net.proto.AvatarFetterLevelRewardRspOuterClass.AvatarFetterLevelRewardRsp; -public class PacketAvatarFetterLevelRewardRsp extends GenshinPacket { +public class PacketAvatarFetterLevelRewardRsp extends BasePacket { public PacketAvatarFetterLevelRewardRsp(long guid, int fetterLevel, int rewardId) { super(PacketOpcodes.AvatarFetterLevelRewardRsp); diff --git a/src/main/java/emu/grasscutter/server/packet/send/PacketAvatarFightPropNotify.java b/src/main/java/emu/grasscutter/server/packet/send/PacketAvatarFightPropNotify.java index bb68c5d12..556ba8626 100644 --- a/src/main/java/emu/grasscutter/server/packet/send/PacketAvatarFightPropNotify.java +++ b/src/main/java/emu/grasscutter/server/packet/send/PacketAvatarFightPropNotify.java @@ -1,13 +1,13 @@ package emu.grasscutter.server.packet.send; -import emu.grasscutter.game.avatar.GenshinAvatar; -import emu.grasscutter.net.packet.GenshinPacket; +import emu.grasscutter.game.avatar.Avatar; +import emu.grasscutter.net.packet.BasePacket; import emu.grasscutter.net.packet.PacketOpcodes; import emu.grasscutter.net.proto.AvatarFightPropNotifyOuterClass.AvatarFightPropNotify; -public class PacketAvatarFightPropNotify extends GenshinPacket { +public class PacketAvatarFightPropNotify extends BasePacket { - public PacketAvatarFightPropNotify(GenshinAvatar avatar) { + public PacketAvatarFightPropNotify(Avatar avatar) { super(PacketOpcodes.AvatarFightPropNotify); AvatarFightPropNotify proto = AvatarFightPropNotify.newBuilder() diff --git a/src/main/java/emu/grasscutter/server/packet/send/PacketAvatarFightPropUpdateNotify.java b/src/main/java/emu/grasscutter/server/packet/send/PacketAvatarFightPropUpdateNotify.java index a939ba057..9b9f4e9dd 100644 --- a/src/main/java/emu/grasscutter/server/packet/send/PacketAvatarFightPropUpdateNotify.java +++ b/src/main/java/emu/grasscutter/server/packet/send/PacketAvatarFightPropUpdateNotify.java @@ -1,14 +1,14 @@ package emu.grasscutter.server.packet.send; -import emu.grasscutter.game.avatar.GenshinAvatar; +import emu.grasscutter.game.avatar.Avatar; 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.AvatarFightPropUpdateNotifyOuterClass.AvatarFightPropUpdateNotify; -public class PacketAvatarFightPropUpdateNotify extends GenshinPacket { +public class PacketAvatarFightPropUpdateNotify extends BasePacket { - public PacketAvatarFightPropUpdateNotify(GenshinAvatar avatar, FightProperty prop) { + public PacketAvatarFightPropUpdateNotify(Avatar avatar, FightProperty prop) { super(PacketOpcodes.AvatarFightPropUpdateNotify); AvatarFightPropUpdateNotify proto = AvatarFightPropUpdateNotify.newBuilder() diff --git a/src/main/java/emu/grasscutter/server/packet/send/PacketAvatarFlycloakChangeNotify.java b/src/main/java/emu/grasscutter/server/packet/send/PacketAvatarFlycloakChangeNotify.java index 88efecfe7..23a35c815 100644 --- a/src/main/java/emu/grasscutter/server/packet/send/PacketAvatarFlycloakChangeNotify.java +++ b/src/main/java/emu/grasscutter/server/packet/send/PacketAvatarFlycloakChangeNotify.java @@ -1,13 +1,13 @@ package emu.grasscutter.server.packet.send; -import emu.grasscutter.game.avatar.GenshinAvatar; -import emu.grasscutter.net.packet.GenshinPacket; +import emu.grasscutter.game.avatar.Avatar; +import emu.grasscutter.net.packet.BasePacket; import emu.grasscutter.net.packet.PacketOpcodes; import emu.grasscutter.net.proto.AvatarFlycloakChangeNotifyOuterClass.AvatarFlycloakChangeNotify; -public class PacketAvatarFlycloakChangeNotify extends GenshinPacket { +public class PacketAvatarFlycloakChangeNotify extends BasePacket { - public PacketAvatarFlycloakChangeNotify(GenshinAvatar avatar) { + public PacketAvatarFlycloakChangeNotify(Avatar avatar) { super(PacketOpcodes.AvatarFlycloakChangeNotify); AvatarFlycloakChangeNotify proto = AvatarFlycloakChangeNotify.newBuilder() diff --git a/src/main/java/emu/grasscutter/server/packet/send/PacketAvatarGainCostumeNotify.java b/src/main/java/emu/grasscutter/server/packet/send/PacketAvatarGainCostumeNotify.java index 74946d959..f8b14cda7 100644 --- a/src/main/java/emu/grasscutter/server/packet/send/PacketAvatarGainCostumeNotify.java +++ b/src/main/java/emu/grasscutter/server/packet/send/PacketAvatarGainCostumeNotify.java @@ -1,10 +1,10 @@ package emu.grasscutter.server.packet.send; -import emu.grasscutter.net.packet.GenshinPacket; +import emu.grasscutter.net.packet.BasePacket; import emu.grasscutter.net.packet.PacketOpcodes; import emu.grasscutter.net.proto.AvatarGainCostumeNotifyOuterClass.AvatarGainCostumeNotify; -public class PacketAvatarGainCostumeNotify extends GenshinPacket { +public class PacketAvatarGainCostumeNotify extends BasePacket { public PacketAvatarGainCostumeNotify(int costumeId) { super(PacketOpcodes.AvatarGainCostumeNotify); diff --git a/src/main/java/emu/grasscutter/server/packet/send/PacketAvatarGainFlycloakNotify.java b/src/main/java/emu/grasscutter/server/packet/send/PacketAvatarGainFlycloakNotify.java index a3dfacc13..88856ad25 100644 --- a/src/main/java/emu/grasscutter/server/packet/send/PacketAvatarGainFlycloakNotify.java +++ b/src/main/java/emu/grasscutter/server/packet/send/PacketAvatarGainFlycloakNotify.java @@ -1,10 +1,10 @@ package emu.grasscutter.server.packet.send; -import emu.grasscutter.net.packet.GenshinPacket; +import emu.grasscutter.net.packet.BasePacket; import emu.grasscutter.net.packet.PacketOpcodes; import emu.grasscutter.net.proto.AvatarGainFlycloakNotifyOuterClass.AvatarGainFlycloakNotify; -public class PacketAvatarGainFlycloakNotify extends GenshinPacket { +public class PacketAvatarGainFlycloakNotify extends BasePacket { public PacketAvatarGainFlycloakNotify(int flycloak) { super(PacketOpcodes.AvatarGainFlycloakNotify); diff --git a/src/main/java/emu/grasscutter/server/packet/send/PacketAvatarLifeStateChangeNotify.java b/src/main/java/emu/grasscutter/server/packet/send/PacketAvatarLifeStateChangeNotify.java index d9acb5d4e..fcdce2b9a 100644 --- a/src/main/java/emu/grasscutter/server/packet/send/PacketAvatarLifeStateChangeNotify.java +++ b/src/main/java/emu/grasscutter/server/packet/send/PacketAvatarLifeStateChangeNotify.java @@ -1,15 +1,15 @@ package emu.grasscutter.server.packet.send; -import emu.grasscutter.game.avatar.GenshinAvatar; +import emu.grasscutter.game.avatar.Avatar; import emu.grasscutter.game.props.FightProperty; import emu.grasscutter.game.props.LifeState; -import emu.grasscutter.net.packet.GenshinPacket; +import emu.grasscutter.net.packet.BasePacket; import emu.grasscutter.net.packet.PacketOpcodes; import emu.grasscutter.net.proto.AvatarLifeStateChangeNotifyOuterClass.AvatarLifeStateChangeNotify; -public class PacketAvatarLifeStateChangeNotify extends GenshinPacket { +public class PacketAvatarLifeStateChangeNotify extends BasePacket { - public PacketAvatarLifeStateChangeNotify(GenshinAvatar avatar) { + public PacketAvatarLifeStateChangeNotify(Avatar avatar) { super(PacketOpcodes.AvatarLifeStateChangeNotify); AvatarLifeStateChangeNotify proto = AvatarLifeStateChangeNotify.newBuilder() diff --git a/src/main/java/emu/grasscutter/server/packet/send/PacketAvatarPromoteRsp.java b/src/main/java/emu/grasscutter/server/packet/send/PacketAvatarPromoteRsp.java index feef149e7..80d7d6ca9 100644 --- a/src/main/java/emu/grasscutter/server/packet/send/PacketAvatarPromoteRsp.java +++ b/src/main/java/emu/grasscutter/server/packet/send/PacketAvatarPromoteRsp.java @@ -1,13 +1,13 @@ package emu.grasscutter.server.packet.send; -import emu.grasscutter.game.avatar.GenshinAvatar; -import emu.grasscutter.net.packet.GenshinPacket; +import emu.grasscutter.game.avatar.Avatar; +import emu.grasscutter.net.packet.BasePacket; import emu.grasscutter.net.packet.PacketOpcodes; import emu.grasscutter.net.proto.AvatarPromoteRspOuterClass.AvatarPromoteRsp; -public class PacketAvatarPromoteRsp extends GenshinPacket { +public class PacketAvatarPromoteRsp extends BasePacket { - public PacketAvatarPromoteRsp(GenshinAvatar avatar) { + public PacketAvatarPromoteRsp(Avatar avatar) { super(PacketOpcodes.AvatarPromoteRsp); AvatarPromoteRsp proto = AvatarPromoteRsp.newBuilder() diff --git a/src/main/java/emu/grasscutter/server/packet/send/PacketAvatarPropNotify.java b/src/main/java/emu/grasscutter/server/packet/send/PacketAvatarPropNotify.java index d1c04d9db..21d373838 100644 --- a/src/main/java/emu/grasscutter/server/packet/send/PacketAvatarPropNotify.java +++ b/src/main/java/emu/grasscutter/server/packet/send/PacketAvatarPropNotify.java @@ -1,13 +1,13 @@ package emu.grasscutter.server.packet.send; -import emu.grasscutter.game.avatar.GenshinAvatar; +import emu.grasscutter.game.avatar.Avatar; import emu.grasscutter.game.props.PlayerProperty; -import emu.grasscutter.net.packet.GenshinPacket; +import emu.grasscutter.net.packet.BasePacket; import emu.grasscutter.net.packet.PacketOpcodes; import emu.grasscutter.net.proto.AvatarPropNotifyOuterClass.AvatarPropNotify; -public class PacketAvatarPropNotify extends GenshinPacket { - public PacketAvatarPropNotify(GenshinAvatar avatar) { +public class PacketAvatarPropNotify extends BasePacket { + public PacketAvatarPropNotify(Avatar avatar) { super(PacketOpcodes.AvatarPropNotify); AvatarPropNotify proto = AvatarPropNotify.newBuilder() @@ -22,7 +22,7 @@ public class PacketAvatarPropNotify extends GenshinPacket { this.setData(proto); } - public PacketAvatarPropNotify(GenshinAvatar avatar, PlayerProperty prop, int value) { + public PacketAvatarPropNotify(Avatar avatar, PlayerProperty prop, int value) { super(PacketOpcodes.AvatarPropNotify); AvatarPropNotify proto = AvatarPropNotify.newBuilder() diff --git a/src/main/java/emu/grasscutter/server/packet/send/PacketAvatarSkillChangeNotify.java b/src/main/java/emu/grasscutter/server/packet/send/PacketAvatarSkillChangeNotify.java index ba787ee7c..ba260ce6c 100644 --- a/src/main/java/emu/grasscutter/server/packet/send/PacketAvatarSkillChangeNotify.java +++ b/src/main/java/emu/grasscutter/server/packet/send/PacketAvatarSkillChangeNotify.java @@ -1,13 +1,13 @@ package emu.grasscutter.server.packet.send; -import emu.grasscutter.game.avatar.GenshinAvatar; -import emu.grasscutter.net.packet.GenshinPacket; +import emu.grasscutter.game.avatar.Avatar; +import emu.grasscutter.net.packet.BasePacket; import emu.grasscutter.net.packet.PacketOpcodes; import emu.grasscutter.net.proto.AvatarSkillChangeNotifyOuterClass.AvatarSkillChangeNotify; -public class PacketAvatarSkillChangeNotify extends GenshinPacket { +public class PacketAvatarSkillChangeNotify extends BasePacket { - public PacketAvatarSkillChangeNotify(GenshinAvatar avatar, int skillId, int oldLevel, int curLevel) { + public PacketAvatarSkillChangeNotify(Avatar avatar, int skillId, int oldLevel, int curLevel) { super(PacketOpcodes.AvatarSkillChangeNotify); AvatarSkillChangeNotify proto = AvatarSkillChangeNotify.newBuilder() diff --git a/src/main/java/emu/grasscutter/server/packet/send/PacketAvatarSkillUpgradeRsp.java b/src/main/java/emu/grasscutter/server/packet/send/PacketAvatarSkillUpgradeRsp.java index 21163e901..22678db64 100644 --- a/src/main/java/emu/grasscutter/server/packet/send/PacketAvatarSkillUpgradeRsp.java +++ b/src/main/java/emu/grasscutter/server/packet/send/PacketAvatarSkillUpgradeRsp.java @@ -1,13 +1,13 @@ package emu.grasscutter.server.packet.send; -import emu.grasscutter.game.avatar.GenshinAvatar; -import emu.grasscutter.net.packet.GenshinPacket; +import emu.grasscutter.game.avatar.Avatar; +import emu.grasscutter.net.packet.BasePacket; import emu.grasscutter.net.packet.PacketOpcodes; import emu.grasscutter.net.proto.AvatarSkillUpgradeRspOuterClass.AvatarSkillUpgradeRsp; -public class PacketAvatarSkillUpgradeRsp extends GenshinPacket { +public class PacketAvatarSkillUpgradeRsp extends BasePacket { - public PacketAvatarSkillUpgradeRsp(GenshinAvatar avatar, int skillId, int oldLevel, int newLevel) { + public PacketAvatarSkillUpgradeRsp(Avatar avatar, int skillId, int oldLevel, int newLevel) { super(PacketOpcodes.AvatarSkillUpgradeRsp); AvatarSkillUpgradeRsp proto = AvatarSkillUpgradeRsp.newBuilder() diff --git a/src/main/java/emu/grasscutter/server/packet/send/PacketAvatarTeamUpdateNotify.java b/src/main/java/emu/grasscutter/server/packet/send/PacketAvatarTeamUpdateNotify.java index 519584cc3..93e9e12c3 100644 --- a/src/main/java/emu/grasscutter/server/packet/send/PacketAvatarTeamUpdateNotify.java +++ b/src/main/java/emu/grasscutter/server/packet/send/PacketAvatarTeamUpdateNotify.java @@ -2,17 +2,17 @@ package emu.grasscutter.server.packet.send; import java.util.Map.Entry; -import emu.grasscutter.game.GenshinPlayer; -import emu.grasscutter.game.TeamInfo; -import emu.grasscutter.game.avatar.GenshinAvatar; -import emu.grasscutter.net.packet.GenshinPacket; +import emu.grasscutter.game.avatar.Avatar; +import emu.grasscutter.game.player.Player; +import emu.grasscutter.game.player.TeamInfo; +import emu.grasscutter.net.packet.BasePacket; import emu.grasscutter.net.packet.PacketOpcodes; import emu.grasscutter.net.proto.AvatarTeamOuterClass.AvatarTeam; import emu.grasscutter.net.proto.AvatarTeamUpdateNotifyOuterClass.AvatarTeamUpdateNotify; -public class PacketAvatarTeamUpdateNotify extends GenshinPacket { +public class PacketAvatarTeamUpdateNotify extends BasePacket { - public PacketAvatarTeamUpdateNotify(GenshinPlayer player) { + public PacketAvatarTeamUpdateNotify(Player player) { super(PacketOpcodes.AvatarTeamUpdateNotify); AvatarTeamUpdateNotify.Builder proto = AvatarTeamUpdateNotify.newBuilder(); @@ -23,7 +23,7 @@ public class PacketAvatarTeamUpdateNotify extends GenshinPacket { .setTeamName(teamInfo.getName()); for (int i = 0; i < teamInfo.getAvatars().size(); i++) { - GenshinAvatar avatar = player.getAvatars().getAvatarById(teamInfo.getAvatars().get(i)); + Avatar avatar = player.getAvatars().getAvatarById(teamInfo.getAvatars().get(i)); avatarTeam.addAvatarGuidList(avatar.getGuid()); } diff --git a/src/main/java/emu/grasscutter/server/packet/send/PacketAvatarUnlockTalentNotify.java b/src/main/java/emu/grasscutter/server/packet/send/PacketAvatarUnlockTalentNotify.java index 4c0b11ae9..baa93bccf 100644 --- a/src/main/java/emu/grasscutter/server/packet/send/PacketAvatarUnlockTalentNotify.java +++ b/src/main/java/emu/grasscutter/server/packet/send/PacketAvatarUnlockTalentNotify.java @@ -1,13 +1,13 @@ package emu.grasscutter.server.packet.send; -import emu.grasscutter.game.avatar.GenshinAvatar; -import emu.grasscutter.net.packet.GenshinPacket; +import emu.grasscutter.game.avatar.Avatar; +import emu.grasscutter.net.packet.BasePacket; import emu.grasscutter.net.packet.PacketOpcodes; import emu.grasscutter.net.proto.AvatarUnlockTalentNotifyOuterClass.AvatarUnlockTalentNotify; -public class PacketAvatarUnlockTalentNotify extends GenshinPacket { +public class PacketAvatarUnlockTalentNotify extends BasePacket { - public PacketAvatarUnlockTalentNotify(GenshinAvatar avatar, int talentId) { + public PacketAvatarUnlockTalentNotify(Avatar avatar, int talentId) { super(PacketOpcodes.AvatarUnlockTalentNotify); AvatarUnlockTalentNotify proto = AvatarUnlockTalentNotify.newBuilder() diff --git a/src/main/java/emu/grasscutter/server/packet/send/PacketAvatarUpgradeRsp.java b/src/main/java/emu/grasscutter/server/packet/send/PacketAvatarUpgradeRsp.java index 031313ea6..99ac311fd 100644 --- a/src/main/java/emu/grasscutter/server/packet/send/PacketAvatarUpgradeRsp.java +++ b/src/main/java/emu/grasscutter/server/packet/send/PacketAvatarUpgradeRsp.java @@ -2,14 +2,14 @@ package emu.grasscutter.server.packet.send; import java.util.Map; -import emu.grasscutter.game.avatar.GenshinAvatar; -import emu.grasscutter.net.packet.GenshinPacket; +import emu.grasscutter.game.avatar.Avatar; +import emu.grasscutter.net.packet.BasePacket; import emu.grasscutter.net.packet.PacketOpcodes; import emu.grasscutter.net.proto.AvatarUpgradeRspOuterClass.AvatarUpgradeRsp; -public class PacketAvatarUpgradeRsp extends GenshinPacket { +public class PacketAvatarUpgradeRsp extends BasePacket { - public PacketAvatarUpgradeRsp(GenshinAvatar avatar, int oldLevel, Map<Integer, Float> oldFightPropMap) { + public PacketAvatarUpgradeRsp(Avatar avatar, int oldLevel, Map<Integer, Float> oldFightPropMap) { super(PacketOpcodes.AvatarUpgradeRsp); this.buildHeader(0); diff --git a/src/main/java/emu/grasscutter/server/packet/send/PacketAvatarWearFlycloakRsp.java b/src/main/java/emu/grasscutter/server/packet/send/PacketAvatarWearFlycloakRsp.java index 6cb513a7a..0995e5d18 100644 --- a/src/main/java/emu/grasscutter/server/packet/send/PacketAvatarWearFlycloakRsp.java +++ b/src/main/java/emu/grasscutter/server/packet/send/PacketAvatarWearFlycloakRsp.java @@ -1,11 +1,11 @@ package emu.grasscutter.server.packet.send; -import emu.grasscutter.net.packet.GenshinPacket; +import emu.grasscutter.net.packet.BasePacket; import emu.grasscutter.net.packet.PacketOpcodes; import emu.grasscutter.net.proto.AvatarWearFlycloakRspOuterClass.AvatarWearFlycloakRsp; import emu.grasscutter.net.proto.RetcodeOuterClass; -public class PacketAvatarWearFlycloakRsp extends GenshinPacket { +public class PacketAvatarWearFlycloakRsp extends BasePacket { public PacketAvatarWearFlycloakRsp(long avatarGuid, int costumeId) { super(PacketOpcodes.AvatarWearFlycloakRsp); diff --git a/src/main/java/emu/grasscutter/server/packet/send/PacketCalcWeaponUpgradeReturnItemsRsp.java b/src/main/java/emu/grasscutter/server/packet/send/PacketCalcWeaponUpgradeReturnItemsRsp.java index 874f7da73..8d2bfacfb 100644 --- a/src/main/java/emu/grasscutter/server/packet/send/PacketCalcWeaponUpgradeReturnItemsRsp.java +++ b/src/main/java/emu/grasscutter/server/packet/send/PacketCalcWeaponUpgradeReturnItemsRsp.java @@ -2,13 +2,13 @@ package emu.grasscutter.server.packet.send; import java.util.List; -import emu.grasscutter.net.packet.GenshinPacket; +import emu.grasscutter.net.packet.BasePacket; import emu.grasscutter.net.packet.PacketOpcodes; import emu.grasscutter.net.proto.CalcWeaponUpgradeReturnItemsRspOuterClass.CalcWeaponUpgradeReturnItemsRsp; import emu.grasscutter.net.proto.ItemParamOuterClass.ItemParam; import emu.grasscutter.net.proto.RetcodeOuterClass; -public class PacketCalcWeaponUpgradeReturnItemsRsp extends GenshinPacket { +public class PacketCalcWeaponUpgradeReturnItemsRsp extends BasePacket { public PacketCalcWeaponUpgradeReturnItemsRsp(long itemGuid, List<ItemParam> returnItems) { super(PacketOpcodes.CalcWeaponUpgradeReturnItemsRsp); diff --git a/src/main/java/emu/grasscutter/server/packet/send/PacketCardProductRewardNotify.java b/src/main/java/emu/grasscutter/server/packet/send/PacketCardProductRewardNotify.java index ca5a5fc00..606c77fff 100644 --- a/src/main/java/emu/grasscutter/server/packet/send/PacketCardProductRewardNotify.java +++ b/src/main/java/emu/grasscutter/server/packet/send/PacketCardProductRewardNotify.java @@ -1,11 +1,11 @@ package emu.grasscutter.server.packet.send; -import emu.grasscutter.net.packet.GenshinPacket; +import emu.grasscutter.net.packet.BasePacket; import emu.grasscutter.net.packet.PacketOpcodes; import emu.grasscutter.net.proto.CardProductRewardNotifyOuterClass.CardProductRewardNotify; -public class PacketCardProductRewardNotify extends GenshinPacket { +public class PacketCardProductRewardNotify extends BasePacket { public PacketCardProductRewardNotify(int remainsDay) { super(PacketOpcodes.CardProductRewardNotify); diff --git a/src/main/java/emu/grasscutter/server/packet/send/PacketChangeAvatarRsp.java b/src/main/java/emu/grasscutter/server/packet/send/PacketChangeAvatarRsp.java index 720e924ec..f5efe6808 100644 --- a/src/main/java/emu/grasscutter/server/packet/send/PacketChangeAvatarRsp.java +++ b/src/main/java/emu/grasscutter/server/packet/send/PacketChangeAvatarRsp.java @@ -1,11 +1,11 @@ package emu.grasscutter.server.packet.send; -import emu.grasscutter.net.packet.GenshinPacket; +import emu.grasscutter.net.packet.BasePacket; import emu.grasscutter.net.packet.PacketOpcodes; import emu.grasscutter.net.proto.ChangeAvatarRspOuterClass.ChangeAvatarRsp; import emu.grasscutter.net.proto.RetcodeOuterClass; -public class PacketChangeAvatarRsp extends GenshinPacket { +public class PacketChangeAvatarRsp extends BasePacket { public PacketChangeAvatarRsp(long guid) { super(PacketOpcodes.ChangeAvatarRsp); diff --git a/src/main/java/emu/grasscutter/server/packet/send/PacketChangeGameTimeRsp.java b/src/main/java/emu/grasscutter/server/packet/send/PacketChangeGameTimeRsp.java index 45a485553..b0b46bde9 100644 --- a/src/main/java/emu/grasscutter/server/packet/send/PacketChangeGameTimeRsp.java +++ b/src/main/java/emu/grasscutter/server/packet/send/PacketChangeGameTimeRsp.java @@ -1,14 +1,14 @@ package emu.grasscutter.server.packet.send; -import emu.grasscutter.game.GenshinPlayer; -import emu.grasscutter.game.World; -import emu.grasscutter.net.packet.GenshinPacket; +import emu.grasscutter.game.player.Player; +import emu.grasscutter.game.world.World; +import emu.grasscutter.net.packet.BasePacket; import emu.grasscutter.net.packet.PacketOpcodes; import emu.grasscutter.net.proto.ChangeGameTimeRspOuterClass.ChangeGameTimeRsp; -public class PacketChangeGameTimeRsp extends GenshinPacket { +public class PacketChangeGameTimeRsp extends BasePacket { - public PacketChangeGameTimeRsp(GenshinPlayer player) { + public PacketChangeGameTimeRsp(Player player) { super(PacketOpcodes.ChangeGameTimeRsp); ChangeGameTimeRsp proto = ChangeGameTimeRsp.newBuilder() diff --git a/src/main/java/emu/grasscutter/server/packet/send/PacketChangeMpTeamAvatarRsp.java b/src/main/java/emu/grasscutter/server/packet/send/PacketChangeMpTeamAvatarRsp.java index 36d2ed248..f44c3326e 100644 --- a/src/main/java/emu/grasscutter/server/packet/send/PacketChangeMpTeamAvatarRsp.java +++ b/src/main/java/emu/grasscutter/server/packet/send/PacketChangeMpTeamAvatarRsp.java @@ -1,14 +1,14 @@ package emu.grasscutter.server.packet.send; -import emu.grasscutter.game.GenshinPlayer; -import emu.grasscutter.game.TeamInfo; -import emu.grasscutter.net.packet.GenshinPacket; +import emu.grasscutter.game.player.Player; +import emu.grasscutter.game.player.TeamInfo; +import emu.grasscutter.net.packet.BasePacket; import emu.grasscutter.net.packet.PacketOpcodes; import emu.grasscutter.net.proto.ChangeMpTeamAvatarRspOuterClass.ChangeMpTeamAvatarRsp; -public class PacketChangeMpTeamAvatarRsp extends GenshinPacket { +public class PacketChangeMpTeamAvatarRsp extends BasePacket { - public PacketChangeMpTeamAvatarRsp(GenshinPlayer player, TeamInfo teamInfo) { + public PacketChangeMpTeamAvatarRsp(Player player, TeamInfo teamInfo) { super(PacketOpcodes.ChangeMpTeamAvatarRsp); ChangeMpTeamAvatarRsp.Builder proto = ChangeMpTeamAvatarRsp.newBuilder() diff --git a/src/main/java/emu/grasscutter/server/packet/send/PacketChangeTeamNameRsp.java b/src/main/java/emu/grasscutter/server/packet/send/PacketChangeTeamNameRsp.java index 52c6bccbf..a965eb1bb 100644 --- a/src/main/java/emu/grasscutter/server/packet/send/PacketChangeTeamNameRsp.java +++ b/src/main/java/emu/grasscutter/server/packet/send/PacketChangeTeamNameRsp.java @@ -1,10 +1,10 @@ package emu.grasscutter.server.packet.send; -import emu.grasscutter.net.packet.GenshinPacket; +import emu.grasscutter.net.packet.BasePacket; import emu.grasscutter.net.packet.PacketOpcodes; import emu.grasscutter.net.proto.ChangeTeamNameRspOuterClass.ChangeTeamNameRsp; -public class PacketChangeTeamNameRsp extends GenshinPacket { +public class PacketChangeTeamNameRsp extends BasePacket { public PacketChangeTeamNameRsp(int teamId, String teamName) { super(PacketOpcodes.ChangeTeamNameRsp); diff --git a/src/main/java/emu/grasscutter/server/packet/send/PacketChooseCurAvatarTeamRsp.java b/src/main/java/emu/grasscutter/server/packet/send/PacketChooseCurAvatarTeamRsp.java index 2af34109a..3eaecdb6d 100644 --- a/src/main/java/emu/grasscutter/server/packet/send/PacketChooseCurAvatarTeamRsp.java +++ b/src/main/java/emu/grasscutter/server/packet/send/PacketChooseCurAvatarTeamRsp.java @@ -1,10 +1,10 @@ package emu.grasscutter.server.packet.send; -import emu.grasscutter.net.packet.GenshinPacket; +import emu.grasscutter.net.packet.BasePacket; import emu.grasscutter.net.packet.PacketOpcodes; import emu.grasscutter.net.proto.ChooseCurAvatarTeamRspOuterClass.ChooseCurAvatarTeamRsp; -public class PacketChooseCurAvatarTeamRsp extends GenshinPacket { +public class PacketChooseCurAvatarTeamRsp extends BasePacket { public PacketChooseCurAvatarTeamRsp(int teamId) { super(PacketOpcodes.ChooseCurAvatarTeamRsp); diff --git a/src/main/java/emu/grasscutter/server/packet/send/PacketClientAbilityInitFinishNotify.java b/src/main/java/emu/grasscutter/server/packet/send/PacketClientAbilityInitFinishNotify.java index dc676c4d1..61a682b4e 100644 --- a/src/main/java/emu/grasscutter/server/packet/send/PacketClientAbilityInitFinishNotify.java +++ b/src/main/java/emu/grasscutter/server/packet/send/PacketClientAbilityInitFinishNotify.java @@ -2,12 +2,12 @@ package emu.grasscutter.server.packet.send; import java.util.List; -import emu.grasscutter.net.packet.GenshinPacket; +import emu.grasscutter.net.packet.BasePacket; import emu.grasscutter.net.packet.PacketOpcodes; import emu.grasscutter.net.proto.AbilityInvokeEntryOuterClass.AbilityInvokeEntry; import emu.grasscutter.net.proto.ClientAbilityInitFinishNotifyOuterClass.ClientAbilityInitFinishNotify; -public class PacketClientAbilityInitFinishNotify extends GenshinPacket { +public class PacketClientAbilityInitFinishNotify extends BasePacket { public PacketClientAbilityInitFinishNotify(List<AbilityInvokeEntry> entries) { super(PacketOpcodes.ClientAbilityInitFinishNotify, true); diff --git a/src/main/java/emu/grasscutter/server/packet/send/PacketCombatInvocationsNotify.java b/src/main/java/emu/grasscutter/server/packet/send/PacketCombatInvocationsNotify.java index c2031065f..7e9fba335 100644 --- a/src/main/java/emu/grasscutter/server/packet/send/PacketCombatInvocationsNotify.java +++ b/src/main/java/emu/grasscutter/server/packet/send/PacketCombatInvocationsNotify.java @@ -2,12 +2,12 @@ package emu.grasscutter.server.packet.send; import java.util.List; -import emu.grasscutter.net.packet.GenshinPacket; +import emu.grasscutter.net.packet.BasePacket; import emu.grasscutter.net.packet.PacketOpcodes; import emu.grasscutter.net.proto.CombatInvocationsNotifyOuterClass.CombatInvocationsNotify; import emu.grasscutter.net.proto.CombatInvokeEntryOuterClass.CombatInvokeEntry; -public class PacketCombatInvocationsNotify extends GenshinPacket { +public class PacketCombatInvocationsNotify extends BasePacket { public PacketCombatInvocationsNotify(CombatInvokeEntry entry) { super(PacketOpcodes.CombatInvocationsNotify, true); diff --git a/src/main/java/emu/grasscutter/server/packet/send/PacketCombineRsp.java b/src/main/java/emu/grasscutter/server/packet/send/PacketCombineRsp.java index d5fda887b..f552d1ec7 100644 --- a/src/main/java/emu/grasscutter/server/packet/send/PacketCombineRsp.java +++ b/src/main/java/emu/grasscutter/server/packet/send/PacketCombineRsp.java @@ -1,13 +1,13 @@ package emu.grasscutter.server.packet.send; -import emu.grasscutter.net.packet.GenshinPacket; +import emu.grasscutter.net.packet.BasePacket; import emu.grasscutter.net.packet.PacketOpcodes; import emu.grasscutter.net.proto.CombineReqOuterClass; import emu.grasscutter.net.proto.CombineRspOuterClass; import emu.grasscutter.net.proto.ItemParamOuterClass; import emu.grasscutter.net.proto.RetcodeOuterClass; -public class PacketCombineRsp extends GenshinPacket { +public class PacketCombineRsp extends BasePacket { public PacketCombineRsp() { super(PacketOpcodes.CombineRsp); diff --git a/src/main/java/emu/grasscutter/server/packet/send/PacketDealAddFriendRsp.java b/src/main/java/emu/grasscutter/server/packet/send/PacketDealAddFriendRsp.java index 590506c1f..9163797f4 100644 --- a/src/main/java/emu/grasscutter/server/packet/send/PacketDealAddFriendRsp.java +++ b/src/main/java/emu/grasscutter/server/packet/send/PacketDealAddFriendRsp.java @@ -1,11 +1,11 @@ package emu.grasscutter.server.packet.send; -import emu.grasscutter.net.packet.GenshinPacket; +import emu.grasscutter.net.packet.BasePacket; import emu.grasscutter.net.packet.PacketOpcodes; import emu.grasscutter.net.proto.DealAddFriendResultTypeOuterClass.DealAddFriendResultType; import emu.grasscutter.net.proto.DealAddFriendRspOuterClass.DealAddFriendRsp; -public class PacketDealAddFriendRsp extends GenshinPacket { +public class PacketDealAddFriendRsp extends BasePacket { public PacketDealAddFriendRsp(int targetUid, DealAddFriendResultType result) { super(PacketOpcodes.DealAddFriendRsp); diff --git a/src/main/java/emu/grasscutter/server/packet/send/PacketDelMailRsp.java b/src/main/java/emu/grasscutter/server/packet/send/PacketDelMailRsp.java new file mode 100644 index 000000000..e8348a144 --- /dev/null +++ b/src/main/java/emu/grasscutter/server/packet/send/PacketDelMailRsp.java @@ -0,0 +1,29 @@ +package emu.grasscutter.server.packet.send; + +import emu.grasscutter.game.player.Player; +import emu.grasscutter.net.packet.BasePacket; +import emu.grasscutter.net.packet.PacketOpcodes; +import emu.grasscutter.net.proto.DelMailRspOuterClass.DelMailRsp; + +import java.util.ArrayList; +import java.util.List; + +public class PacketDelMailRsp extends BasePacket { + + public PacketDelMailRsp(Player player, List<Integer> toDeleteIds) { + super(PacketOpcodes.DelMailRsp); + + DelMailRsp.Builder proto = DelMailRsp.newBuilder(); + + List<Integer> deletedIds = new ArrayList<>(); + + for(int mailId : toDeleteIds) { + if(player.deleteMail(mailId)) { + deletedIds.add(mailId); + } + } + + this.setData(proto.build()); + player.getSession().send(new PacketMailChangeNotify(player, null, deletedIds)); + } +} \ No newline at end of file diff --git a/src/main/java/emu/grasscutter/server/packet/send/PacketDelTeamEntityNotify.java b/src/main/java/emu/grasscutter/server/packet/send/PacketDelTeamEntityNotify.java index 8e6bd10f3..23f7570ac 100644 --- a/src/main/java/emu/grasscutter/server/packet/send/PacketDelTeamEntityNotify.java +++ b/src/main/java/emu/grasscutter/server/packet/send/PacketDelTeamEntityNotify.java @@ -2,11 +2,11 @@ package emu.grasscutter.server.packet.send; import java.util.List; -import emu.grasscutter.net.packet.GenshinPacket; +import emu.grasscutter.net.packet.BasePacket; import emu.grasscutter.net.packet.PacketOpcodes; import emu.grasscutter.net.proto.DelTeamEntityNotifyOuterClass.DelTeamEntityNotify; -public class PacketDelTeamEntityNotify extends GenshinPacket { +public class PacketDelTeamEntityNotify extends BasePacket { public PacketDelTeamEntityNotify(int sceneId, int teamEntityId) { super(PacketOpcodes.DelTeamEntityNotify); diff --git a/src/main/java/emu/grasscutter/server/packet/send/PacketDeleteFriendNotify.java b/src/main/java/emu/grasscutter/server/packet/send/PacketDeleteFriendNotify.java index 7b41b14a5..d56dd639d 100644 --- a/src/main/java/emu/grasscutter/server/packet/send/PacketDeleteFriendNotify.java +++ b/src/main/java/emu/grasscutter/server/packet/send/PacketDeleteFriendNotify.java @@ -1,10 +1,10 @@ package emu.grasscutter.server.packet.send; -import emu.grasscutter.net.packet.GenshinPacket; +import emu.grasscutter.net.packet.BasePacket; import emu.grasscutter.net.packet.PacketOpcodes; import emu.grasscutter.net.proto.DeleteFriendNotifyOuterClass.DeleteFriendNotify; -public class PacketDeleteFriendNotify extends GenshinPacket { +public class PacketDeleteFriendNotify extends BasePacket { public PacketDeleteFriendNotify(int targetUid) { super(PacketOpcodes.DeleteFriendNotify); diff --git a/src/main/java/emu/grasscutter/server/packet/send/PacketDeleteFriendRsp.java b/src/main/java/emu/grasscutter/server/packet/send/PacketDeleteFriendRsp.java index bfe7c2ced..a4181feec 100644 --- a/src/main/java/emu/grasscutter/server/packet/send/PacketDeleteFriendRsp.java +++ b/src/main/java/emu/grasscutter/server/packet/send/PacketDeleteFriendRsp.java @@ -1,10 +1,10 @@ package emu.grasscutter.server.packet.send; -import emu.grasscutter.net.packet.GenshinPacket; +import emu.grasscutter.net.packet.BasePacket; import emu.grasscutter.net.packet.PacketOpcodes; import emu.grasscutter.net.proto.DeleteFriendRspOuterClass.DeleteFriendRsp; -public class PacketDeleteFriendRsp extends GenshinPacket { +public class PacketDeleteFriendRsp extends BasePacket { public PacketDeleteFriendRsp(int targetUid) { super(PacketOpcodes.DeleteFriendRsp); diff --git a/src/main/java/emu/grasscutter/server/packet/send/PacketDestroyMaterialRsp.java b/src/main/java/emu/grasscutter/server/packet/send/PacketDestroyMaterialRsp.java index 76bc1ebb5..95fb95b6d 100644 --- a/src/main/java/emu/grasscutter/server/packet/send/PacketDestroyMaterialRsp.java +++ b/src/main/java/emu/grasscutter/server/packet/send/PacketDestroyMaterialRsp.java @@ -1,12 +1,12 @@ package emu.grasscutter.server.packet.send; -import emu.grasscutter.net.packet.GenshinPacket; +import emu.grasscutter.net.packet.BasePacket; import emu.grasscutter.net.packet.PacketOpcodes; import emu.grasscutter.net.proto.DestroyMaterialRspOuterClass.DestroyMaterialRsp; import it.unimi.dsi.fastutil.ints.Int2IntMap; import it.unimi.dsi.fastutil.ints.Int2IntOpenHashMap; -public class PacketDestroyMaterialRsp extends GenshinPacket { +public class PacketDestroyMaterialRsp extends BasePacket { public PacketDestroyMaterialRsp(Int2IntOpenHashMap returnMaterialMap) { super(PacketOpcodes.DestroyMaterialRsp); diff --git a/src/main/java/emu/grasscutter/server/packet/send/PacketDoGachaRsp.java b/src/main/java/emu/grasscutter/server/packet/send/PacketDoGachaRsp.java index f019239b9..9144c0d8e 100644 --- a/src/main/java/emu/grasscutter/server/packet/send/PacketDoGachaRsp.java +++ b/src/main/java/emu/grasscutter/server/packet/send/PacketDoGachaRsp.java @@ -3,13 +3,13 @@ package emu.grasscutter.server.packet.send; import java.util.List; import emu.grasscutter.game.gacha.GachaBanner; -import emu.grasscutter.net.packet.GenshinPacket; +import emu.grasscutter.net.packet.BasePacket; import emu.grasscutter.net.packet.PacketOpcodes; import emu.grasscutter.net.proto.DoGachaRspOuterClass.DoGachaRsp; import emu.grasscutter.net.proto.GachaItemOuterClass.GachaItem; import emu.grasscutter.net.proto.RetcodeOuterClass; -public class PacketDoGachaRsp extends GenshinPacket { +public class PacketDoGachaRsp extends BasePacket { public PacketDoGachaRsp(GachaBanner banner, List<GachaItem> list) { super(PacketOpcodes.DoGachaRsp); diff --git a/src/main/java/emu/grasscutter/server/packet/send/PacketEnterSceneDoneRsp.java b/src/main/java/emu/grasscutter/server/packet/send/PacketEnterSceneDoneRsp.java index 6f1314a25..c32f6a922 100644 --- a/src/main/java/emu/grasscutter/server/packet/send/PacketEnterSceneDoneRsp.java +++ b/src/main/java/emu/grasscutter/server/packet/send/PacketEnterSceneDoneRsp.java @@ -1,13 +1,13 @@ package emu.grasscutter.server.packet.send; -import emu.grasscutter.game.GenshinPlayer; -import emu.grasscutter.net.packet.GenshinPacket; +import emu.grasscutter.game.player.Player; +import emu.grasscutter.net.packet.BasePacket; import emu.grasscutter.net.packet.PacketOpcodes; import emu.grasscutter.net.proto.EnterSceneDoneRspOuterClass.EnterSceneDoneRsp; -public class PacketEnterSceneDoneRsp extends GenshinPacket { +public class PacketEnterSceneDoneRsp extends BasePacket { - public PacketEnterSceneDoneRsp(GenshinPlayer player) { + public PacketEnterSceneDoneRsp(Player player) { super(PacketOpcodes.EnterSceneDoneRsp); EnterSceneDoneRsp p = EnterSceneDoneRsp.newBuilder() diff --git a/src/main/java/emu/grasscutter/server/packet/send/PacketEnterScenePeerNotify.java b/src/main/java/emu/grasscutter/server/packet/send/PacketEnterScenePeerNotify.java index 07c2bbf27..c41c40bdd 100644 --- a/src/main/java/emu/grasscutter/server/packet/send/PacketEnterScenePeerNotify.java +++ b/src/main/java/emu/grasscutter/server/packet/send/PacketEnterScenePeerNotify.java @@ -1,13 +1,13 @@ package emu.grasscutter.server.packet.send; -import emu.grasscutter.game.GenshinPlayer; -import emu.grasscutter.net.packet.GenshinPacket; +import emu.grasscutter.game.player.Player; +import emu.grasscutter.net.packet.BasePacket; import emu.grasscutter.net.packet.PacketOpcodes; import emu.grasscutter.net.proto.EnterScenePeerNotifyOuterClass.EnterScenePeerNotify; -public class PacketEnterScenePeerNotify extends GenshinPacket { +public class PacketEnterScenePeerNotify extends BasePacket { - public PacketEnterScenePeerNotify(GenshinPlayer player) { + public PacketEnterScenePeerNotify(Player player) { super(PacketOpcodes.EnterScenePeerNotify); EnterScenePeerNotify proto = EnterScenePeerNotify.newBuilder() diff --git a/src/main/java/emu/grasscutter/server/packet/send/PacketEnterSceneReadyRsp.java b/src/main/java/emu/grasscutter/server/packet/send/PacketEnterSceneReadyRsp.java index c426bc728..5dfbc3407 100644 --- a/src/main/java/emu/grasscutter/server/packet/send/PacketEnterSceneReadyRsp.java +++ b/src/main/java/emu/grasscutter/server/packet/send/PacketEnterSceneReadyRsp.java @@ -1,13 +1,13 @@ package emu.grasscutter.server.packet.send; -import emu.grasscutter.game.GenshinPlayer; -import emu.grasscutter.net.packet.GenshinPacket; +import emu.grasscutter.game.player.Player; +import emu.grasscutter.net.packet.BasePacket; import emu.grasscutter.net.packet.PacketOpcodes; import emu.grasscutter.net.proto.EnterSceneReadyRspOuterClass.EnterSceneReadyRsp; -public class PacketEnterSceneReadyRsp extends GenshinPacket { +public class PacketEnterSceneReadyRsp extends BasePacket { - public PacketEnterSceneReadyRsp(GenshinPlayer player) { + public PacketEnterSceneReadyRsp(Player player) { super(PacketOpcodes.EnterSceneReadyRsp, 11); EnterSceneReadyRsp p = EnterSceneReadyRsp.newBuilder() diff --git a/src/main/java/emu/grasscutter/server/packet/send/PacketEnterWorldAreaRsp.java b/src/main/java/emu/grasscutter/server/packet/send/PacketEnterWorldAreaRsp.java index 0d907f318..53e57b78a 100644 --- a/src/main/java/emu/grasscutter/server/packet/send/PacketEnterWorldAreaRsp.java +++ b/src/main/java/emu/grasscutter/server/packet/send/PacketEnterWorldAreaRsp.java @@ -1,11 +1,11 @@ package emu.grasscutter.server.packet.send; -import emu.grasscutter.net.packet.GenshinPacket; +import emu.grasscutter.net.packet.BasePacket; import emu.grasscutter.net.packet.PacketOpcodes; import emu.grasscutter.net.proto.EnterWorldAreaReqOuterClass.EnterWorldAreaReq; import emu.grasscutter.net.proto.EnterWorldAreaRspOuterClass.EnterWorldAreaRsp; -public class PacketEnterWorldAreaRsp extends GenshinPacket { +public class PacketEnterWorldAreaRsp extends BasePacket { public PacketEnterWorldAreaRsp(int clientSequence, EnterWorldAreaReq enterWorld) { super(PacketOpcodes.EnterWorldAreaRsp, clientSequence); diff --git a/src/main/java/emu/grasscutter/server/packet/send/PacketEntityAiSyncNotify.java b/src/main/java/emu/grasscutter/server/packet/send/PacketEntityAiSyncNotify.java index 36e4d813e..a3e300c25 100644 --- a/src/main/java/emu/grasscutter/server/packet/send/PacketEntityAiSyncNotify.java +++ b/src/main/java/emu/grasscutter/server/packet/send/PacketEntityAiSyncNotify.java @@ -1,11 +1,11 @@ package emu.grasscutter.server.packet.send; -import emu.grasscutter.net.packet.GenshinPacket; +import emu.grasscutter.net.packet.BasePacket; import emu.grasscutter.net.packet.PacketOpcodes; import emu.grasscutter.net.proto.AiSyncInfoOuterClass.AiSyncInfo; import emu.grasscutter.net.proto.EntityAiSyncNotifyOuterClass.EntityAiSyncNotify; -public class PacketEntityAiSyncNotify extends GenshinPacket { +public class PacketEntityAiSyncNotify extends BasePacket { public PacketEntityAiSyncNotify(EntityAiSyncNotify notify) { super(PacketOpcodes.EntityAiSyncNotify, true); diff --git a/src/main/java/emu/grasscutter/server/packet/send/PacketEntityFightPropUpdateNotify.java b/src/main/java/emu/grasscutter/server/packet/send/PacketEntityFightPropUpdateNotify.java index 8d76891ef..85c207dde 100644 --- a/src/main/java/emu/grasscutter/server/packet/send/PacketEntityFightPropUpdateNotify.java +++ b/src/main/java/emu/grasscutter/server/packet/send/PacketEntityFightPropUpdateNotify.java @@ -1,14 +1,14 @@ package emu.grasscutter.server.packet.send; -import emu.grasscutter.game.entity.GenshinEntity; +import emu.grasscutter.game.entity.GameEntity; 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.EntityFightPropUpdateNotifyOuterClass.EntityFightPropUpdateNotify; -public class PacketEntityFightPropUpdateNotify extends GenshinPacket { +public class PacketEntityFightPropUpdateNotify extends BasePacket { - public PacketEntityFightPropUpdateNotify(GenshinEntity entity, FightProperty prop) { + public PacketEntityFightPropUpdateNotify(GameEntity entity, FightProperty prop) { super(PacketOpcodes.EntityFightPropUpdateNotify); EntityFightPropUpdateNotify proto = EntityFightPropUpdateNotify.newBuilder() diff --git a/src/main/java/emu/grasscutter/server/packet/send/PacketEvtAvatarSitDownNotify.java b/src/main/java/emu/grasscutter/server/packet/send/PacketEvtAvatarSitDownNotify.java index 6a051024a..f85bbfbc3 100644 --- a/src/main/java/emu/grasscutter/server/packet/send/PacketEvtAvatarSitDownNotify.java +++ b/src/main/java/emu/grasscutter/server/packet/send/PacketEvtAvatarSitDownNotify.java @@ -1,10 +1,10 @@ package emu.grasscutter.server.packet.send; -import emu.grasscutter.net.packet.GenshinPacket; +import emu.grasscutter.net.packet.BasePacket; import emu.grasscutter.net.packet.PacketOpcodes; import emu.grasscutter.net.proto.EvtAvatarSitDownNotifyOuterClass.EvtAvatarSitDownNotify; -public class PacketEvtAvatarSitDownNotify extends GenshinPacket { +public class PacketEvtAvatarSitDownNotify extends BasePacket { public PacketEvtAvatarSitDownNotify(EvtAvatarSitDownNotify notify) { super(PacketOpcodes.EvtAvatarSitDownNotify); diff --git a/src/main/java/emu/grasscutter/server/packet/send/PacketGadgetInteractRsp.java b/src/main/java/emu/grasscutter/server/packet/send/PacketGadgetInteractRsp.java index e7847dfdb..d15cca8a8 100644 --- a/src/main/java/emu/grasscutter/server/packet/send/PacketGadgetInteractRsp.java +++ b/src/main/java/emu/grasscutter/server/packet/send/PacketGadgetInteractRsp.java @@ -1,13 +1,13 @@ package emu.grasscutter.server.packet.send; import emu.grasscutter.game.entity.EntityGadget; -import emu.grasscutter.net.packet.GenshinPacket; +import emu.grasscutter.net.packet.BasePacket; import emu.grasscutter.net.packet.PacketOpcodes; import emu.grasscutter.net.proto.GadgetInteractRspOuterClass.GadgetInteractRsp; import emu.grasscutter.net.proto.InteractTypeOuterClass.InteractType; import emu.grasscutter.net.proto.RetcodeOuterClass; -public class PacketGadgetInteractRsp extends GenshinPacket { +public class PacketGadgetInteractRsp extends BasePacket { public PacketGadgetInteractRsp(EntityGadget gadget, InteractType interact) { super(PacketOpcodes.GadgetInteractRsp); diff --git a/src/main/java/emu/grasscutter/server/packet/send/PacketGetActivityInfoRsp.java b/src/main/java/emu/grasscutter/server/packet/send/PacketGetActivityInfoRsp.java index 8b8a5cffa..1808391c6 100644 --- a/src/main/java/emu/grasscutter/server/packet/send/PacketGetActivityInfoRsp.java +++ b/src/main/java/emu/grasscutter/server/packet/send/PacketGetActivityInfoRsp.java @@ -1,10 +1,10 @@ package emu.grasscutter.server.packet.send; -import emu.grasscutter.net.packet.GenshinPacket; +import emu.grasscutter.net.packet.BasePacket; import emu.grasscutter.net.packet.PacketOpcodes; import emu.grasscutter.net.proto.GetActivityInfoRspOuterClass.GetActivityInfoRsp; -public class PacketGetActivityInfoRsp extends GenshinPacket { +public class PacketGetActivityInfoRsp extends BasePacket { public PacketGetActivityInfoRsp() { super(PacketOpcodes.GetActivityInfoRsp); diff --git a/src/main/java/emu/grasscutter/server/packet/send/PacketGetAllMailRsp.java b/src/main/java/emu/grasscutter/server/packet/send/PacketGetAllMailRsp.java new file mode 100644 index 000000000..8c8fb4b07 --- /dev/null +++ b/src/main/java/emu/grasscutter/server/packet/send/PacketGetAllMailRsp.java @@ -0,0 +1,95 @@ +package emu.grasscutter.server.packet.send; + +import emu.grasscutter.Grasscutter; +import emu.grasscutter.game.mail.Mail; +import emu.grasscutter.game.player.Player; +import emu.grasscutter.net.packet.BasePacket; +import emu.grasscutter.net.packet.PacketOpcodes; +import emu.grasscutter.net.proto.GetAllMailRspOuterClass.GetAllMailRsp; +import emu.grasscutter.net.proto.ItemParamOuterClass; +import emu.grasscutter.net.proto.MailDataOuterClass; +import emu.grasscutter.net.proto.MailDataOuterClass.MailData; +import emu.grasscutter.net.proto.MailItemOuterClass; +import emu.grasscutter.net.proto.MailTextContentOuterClass.MailTextContent; + +import java.time.Instant; +import java.util.ArrayList; +import java.util.Base64; +import java.util.List; + +public class PacketGetAllMailRsp extends BasePacket { + + public PacketGetAllMailRsp(Player player, boolean isGiftMail) { + super(PacketOpcodes.GetAllMailRsp); + + if (isGiftMail) { + // TODO: Gift Mail + // Make sure to send the stupid empty packet + Base64.Decoder decoder = Base64.getDecoder(); + byte[] rsp = decoder.decode("IAE="); + try { + GetAllMailRsp var = GetAllMailRsp.parseFrom(rsp); + this.setData(var.toBuilder().build()); + } catch (Exception e) { + } + + } else { + if (player.getAllMail().size() != 0) { // Make sure the player has mail + GetAllMailRsp.Builder proto = GetAllMailRsp.newBuilder(); + List<MailData> mailDataList = new ArrayList<MailData>(); + + for (Mail message : player.getAllMail()) { + + if(message.stateValue == 1) { // Make sure it isn't a gift + if (message.expireTime > (int) Instant.now().getEpochSecond()) { // Make sure the message isn't expired (The game won't show expired mail, but I don't want to send unnecessary information). + if(mailDataList.size() <= 1000) { // Make sure that there isn't over 1000 messages in the mailbox. (idk what will happen if there is but the game probably won't like it.) + MailTextContent.Builder mailTextContent = MailTextContent.newBuilder(); + mailTextContent.setTitle(message.mailContent.title); + mailTextContent.setContent(message.mailContent.content); + mailTextContent.setSender(message.mailContent.sender); + + List<MailItemOuterClass.MailItem> mailItems = new ArrayList<>(); + + for (Mail.MailItem item : message.itemList) { + MailItemOuterClass.MailItem.Builder mailItem = MailItemOuterClass.MailItem.newBuilder(); + ItemParamOuterClass.ItemParam.Builder itemParam = ItemParamOuterClass.ItemParam.newBuilder(); + itemParam.setItemId(item.itemId); + itemParam.setCount(item.itemCount); + mailItem.setItemParam(itemParam.build()); + + mailItems.add(mailItem.build()); + } + + MailDataOuterClass.MailData.Builder mailData = MailDataOuterClass.MailData.newBuilder(); + mailData.setMailId(player.getMailId(message)); + mailData.setMailTextContent(mailTextContent.build()); + mailData.addAllItemList(mailItems); + mailData.setSendTime((int) message.sendTime); + mailData.setExpireTime((int) message.expireTime); + mailData.setImportance(message.importance); + mailData.setIsRead(message.isRead); + mailData.setIsAttachmentGot(message.isAttachmentGot); + mailData.setStateValue(1); + + mailDataList.add(mailData.build()); + } + } + } + } + + proto.addAllMailList(mailDataList); + proto.setIsTruncated(mailDataList.size() <= 1000 ? false : true); // When enabled this will send a notification to the user telling them their inbox is full and they should delete old messages when opening the mailbox. + + this.setData(proto.build()); + } else { + // Make sure to send the stupid empty packet + Base64.Decoder decoder = Base64.getDecoder(); + byte[] rsp = decoder.decode("IAE="); + try { + GetAllMailRsp var = GetAllMailRsp.parseFrom(rsp); + this.setData(var.toBuilder().build()); + } catch (Exception e) {} + } + } + } +} diff --git a/src/main/java/emu/grasscutter/server/packet/send/PacketGetAllUnlockNameCardRsp.java b/src/main/java/emu/grasscutter/server/packet/send/PacketGetAllUnlockNameCardRsp.java index 0ac6516de..d1f9393cd 100644 --- a/src/main/java/emu/grasscutter/server/packet/send/PacketGetAllUnlockNameCardRsp.java +++ b/src/main/java/emu/grasscutter/server/packet/send/PacketGetAllUnlockNameCardRsp.java @@ -1,13 +1,13 @@ package emu.grasscutter.server.packet.send; -import emu.grasscutter.game.GenshinPlayer; -import emu.grasscutter.net.packet.GenshinPacket; +import emu.grasscutter.game.player.Player; +import emu.grasscutter.net.packet.BasePacket; import emu.grasscutter.net.packet.PacketOpcodes; import emu.grasscutter.net.proto.GetAllUnlockNameCardRspOuterClass.GetAllUnlockNameCardRsp; -public class PacketGetAllUnlockNameCardRsp extends GenshinPacket { +public class PacketGetAllUnlockNameCardRsp extends BasePacket { - public PacketGetAllUnlockNameCardRsp(GenshinPlayer player) { + public PacketGetAllUnlockNameCardRsp(Player player) { super(PacketOpcodes.GetAllUnlockNameCardRsp); GetAllUnlockNameCardRsp proto = GetAllUnlockNameCardRsp.newBuilder() diff --git a/src/main/java/emu/grasscutter/server/packet/send/PacketGetAuthkeyRsp.java b/src/main/java/emu/grasscutter/server/packet/send/PacketGetAuthkeyRsp.java index 2265f2f6f..0e798cd59 100644 --- a/src/main/java/emu/grasscutter/server/packet/send/PacketGetAuthkeyRsp.java +++ b/src/main/java/emu/grasscutter/server/packet/send/PacketGetAuthkeyRsp.java @@ -1,11 +1,11 @@ package emu.grasscutter.server.packet.send; -import emu.grasscutter.net.packet.GenshinPacket; +import emu.grasscutter.net.packet.BasePacket; import emu.grasscutter.net.packet.PacketOpcodes; import emu.grasscutter.net.proto.GetAuthkeyRspOuterClass.GetAuthkeyRsp; import emu.grasscutter.net.proto.RetcodeOuterClass; -public class PacketGetAuthkeyRsp extends GenshinPacket { +public class PacketGetAuthkeyRsp extends BasePacket { public PacketGetAuthkeyRsp() { super(PacketOpcodes.GetAuthkeyRsp); diff --git a/src/main/java/emu/grasscutter/server/packet/send/PacketGetGachaInfoRsp.java b/src/main/java/emu/grasscutter/server/packet/send/PacketGetGachaInfoRsp.java index 6772516a7..89af334a5 100644 --- a/src/main/java/emu/grasscutter/server/packet/send/PacketGetGachaInfoRsp.java +++ b/src/main/java/emu/grasscutter/server/packet/send/PacketGetGachaInfoRsp.java @@ -1,10 +1,10 @@ package emu.grasscutter.server.packet.send; import emu.grasscutter.game.gacha.GachaManager; -import emu.grasscutter.net.packet.GenshinPacket; +import emu.grasscutter.net.packet.BasePacket; import emu.grasscutter.net.packet.PacketOpcodes; -public class PacketGetGachaInfoRsp extends GenshinPacket { +public class PacketGetGachaInfoRsp extends BasePacket { public PacketGetGachaInfoRsp(GachaManager manager) { super(PacketOpcodes.GetGachaInfoRsp); diff --git a/src/main/java/emu/grasscutter/server/packet/send/PacketGetMailItemRsp.java b/src/main/java/emu/grasscutter/server/packet/send/PacketGetMailItemRsp.java new file mode 100644 index 000000000..37f753c17 --- /dev/null +++ b/src/main/java/emu/grasscutter/server/packet/send/PacketGetMailItemRsp.java @@ -0,0 +1,72 @@ +package emu.grasscutter.server.packet.send; + +import emu.grasscutter.data.GameData; +import emu.grasscutter.game.inventory.GameItem; +import emu.grasscutter.game.mail.Mail; +import emu.grasscutter.game.player.Player; +import emu.grasscutter.game.props.ActionReason; +import emu.grasscutter.net.packet.BasePacket; +import emu.grasscutter.net.packet.PacketOpcodes; +import emu.grasscutter.net.proto.EquipParamOuterClass; +import emu.grasscutter.net.proto.GetMailItemRspOuterClass.GetMailItemRsp; + +import java.util.ArrayList; +import java.util.List; +import java.util.stream.Collectors; + +public class PacketGetMailItemRsp extends BasePacket { + + public PacketGetMailItemRsp(Player player, List<Integer> mailList) { + super(PacketOpcodes.GetMailItemRsp); + + List<Mail> claimedMessages = new ArrayList<>(); + List<EquipParamOuterClass.EquipParam> claimedItems = new ArrayList<>(); + + GetMailItemRsp.Builder proto = GetMailItemRsp.newBuilder(); + + for (int mailId : mailList) { + Mail message = player.getMail(mailId); + + for(Mail.MailItem mailItem : message.itemList) { + EquipParamOuterClass.EquipParam.Builder item = EquipParamOuterClass.EquipParam.newBuilder(); + int promoteLevel = 0; + if (mailItem.itemLevel > 20) { // 20/40 + promoteLevel = 1; + } else if (mailItem.itemLevel > 40) { // 40/50 + promoteLevel = 2; + } else if (mailItem.itemLevel > 50) { // 50/60 + promoteLevel = 3; + } else if (mailItem.itemLevel > 60) { // 60/70 + promoteLevel = 4; + } else if (mailItem.itemLevel > 70) { // 70/80 + promoteLevel = 5; + } else if (mailItem.itemLevel > 80) { // 80/90 + promoteLevel = 6; + } + + item.setItemId(mailItem.itemId); + item.setItemNum(mailItem.itemCount); + item.setItemLevel(mailItem.itemLevel); + item.setPromoteLevel(promoteLevel); + claimedItems.add(item.build()); + + GameItem gameItem = new GameItem(GameData.getItemDataMap().get(mailItem.itemId)); + gameItem.setCount(mailItem.itemCount); + gameItem.setLevel(mailItem.itemLevel); + gameItem.setPromoteLevel(promoteLevel); + player.getInventory().addItem(gameItem, ActionReason.MailAttachment); + } + + message.isAttachmentGot = true; + claimedMessages.add(message); + + player.replaceMailByIndex(mailId, message); + } + + proto.addAllMailIdList(claimedMessages.stream().map(message -> player.getMailId(message)).collect(Collectors.toList())); + proto.addAllItemList(claimedItems); + + this.setData(proto.build()); + player.getSession().send(new PacketMailChangeNotify(player, claimedMessages)); // For some reason you have to also send the MailChangeNotify packet + } +} diff --git a/src/main/java/emu/grasscutter/server/packet/send/PacketGetPlayerAskFriendListRsp.java b/src/main/java/emu/grasscutter/server/packet/send/PacketGetPlayerAskFriendListRsp.java index e0aa0601f..7fc37e280 100644 --- a/src/main/java/emu/grasscutter/server/packet/send/PacketGetPlayerAskFriendListRsp.java +++ b/src/main/java/emu/grasscutter/server/packet/send/PacketGetPlayerAskFriendListRsp.java @@ -1,14 +1,14 @@ package emu.grasscutter.server.packet.send; -import emu.grasscutter.game.GenshinPlayer; import emu.grasscutter.game.friends.Friendship; -import emu.grasscutter.net.packet.GenshinPacket; +import emu.grasscutter.game.player.Player; +import emu.grasscutter.net.packet.BasePacket; import emu.grasscutter.net.packet.PacketOpcodes; import emu.grasscutter.net.proto.GetPlayerAskFriendListRspOuterClass.GetPlayerAskFriendListRsp; -public class PacketGetPlayerAskFriendListRsp extends GenshinPacket { +public class PacketGetPlayerAskFriendListRsp extends BasePacket { - public PacketGetPlayerAskFriendListRsp(GenshinPlayer player) { + public PacketGetPlayerAskFriendListRsp(Player player) { super(PacketOpcodes.GetPlayerAskFriendListRsp); GetPlayerAskFriendListRsp.Builder proto = GetPlayerAskFriendListRsp.newBuilder(); diff --git a/src/main/java/emu/grasscutter/server/packet/send/PacketGetPlayerFriendListRsp.java b/src/main/java/emu/grasscutter/server/packet/send/PacketGetPlayerFriendListRsp.java index 85e0b9849..b2628e36d 100644 --- a/src/main/java/emu/grasscutter/server/packet/send/PacketGetPlayerFriendListRsp.java +++ b/src/main/java/emu/grasscutter/server/packet/send/PacketGetPlayerFriendListRsp.java @@ -1,9 +1,9 @@ package emu.grasscutter.server.packet.send; -import emu.grasscutter.GenshinConstants; -import emu.grasscutter.game.GenshinPlayer; +import emu.grasscutter.GameConstants; import emu.grasscutter.game.friends.Friendship; -import emu.grasscutter.net.packet.GenshinPacket; +import emu.grasscutter.game.player.Player; +import emu.grasscutter.net.packet.BasePacket; import emu.grasscutter.net.packet.PacketOpcodes; import emu.grasscutter.net.proto.FriendBriefOuterClass.FriendBrief; import emu.grasscutter.net.proto.FriendOnlineStateOuterClass.FriendOnlineState; @@ -11,16 +11,16 @@ import emu.grasscutter.net.proto.GetPlayerFriendListRspOuterClass.GetPlayerFrien import emu.grasscutter.net.proto.HeadImageOuterClass.HeadImage; import emu.grasscutter.net.proto.PlatformTypeOuterClass; -public class PacketGetPlayerFriendListRsp extends GenshinPacket { +public class PacketGetPlayerFriendListRsp extends BasePacket { - public PacketGetPlayerFriendListRsp(GenshinPlayer player) { + public PacketGetPlayerFriendListRsp(Player player) { super(PacketOpcodes.GetPlayerFriendListRsp); FriendBrief serverFriend = FriendBrief.newBuilder() - .setUid(GenshinConstants.SERVER_CONSOLE_UID) + .setUid(GameConstants.SERVER_CONSOLE_UID) .setNickname("Server") .setLevel(1) - .setAvatarId(HeadImage.newBuilder().setAvatarId(GenshinConstants.MAIN_CHARACTER_FEMALE).getAvatarId()) + .setAvatarId(HeadImage.newBuilder().setAvatarId(GameConstants.MAIN_CHARACTER_FEMALE).getAvatarId()) .setWorldLevel(0) .setSignature("") .setLastActiveTime((int) (System.currentTimeMillis() / 1000f)) diff --git a/src/main/java/emu/grasscutter/server/packet/send/PacketGetPlayerSocialDetailRsp.java b/src/main/java/emu/grasscutter/server/packet/send/PacketGetPlayerSocialDetailRsp.java index c704afa2f..6c36e1729 100644 --- a/src/main/java/emu/grasscutter/server/packet/send/PacketGetPlayerSocialDetailRsp.java +++ b/src/main/java/emu/grasscutter/server/packet/send/PacketGetPlayerSocialDetailRsp.java @@ -1,12 +1,12 @@ package emu.grasscutter.server.packet.send; -import emu.grasscutter.net.packet.GenshinPacket; +import emu.grasscutter.net.packet.BasePacket; import emu.grasscutter.net.packet.PacketOpcodes; import emu.grasscutter.net.proto.GetPlayerSocialDetailRspOuterClass.GetPlayerSocialDetailRsp; import emu.grasscutter.net.proto.RetcodeOuterClass; import emu.grasscutter.net.proto.SocialDetailOuterClass.SocialDetail; -public class PacketGetPlayerSocialDetailRsp extends GenshinPacket { +public class PacketGetPlayerSocialDetailRsp extends BasePacket { public PacketGetPlayerSocialDetailRsp(SocialDetail.Builder detail) { super(PacketOpcodes.GetPlayerSocialDetailRsp); diff --git a/src/main/java/emu/grasscutter/server/packet/send/PacketGetPlayerTokenRsp.java b/src/main/java/emu/grasscutter/server/packet/send/PacketGetPlayerTokenRsp.java index 994987232..3a5e0f08c 100644 --- a/src/main/java/emu/grasscutter/server/packet/send/PacketGetPlayerTokenRsp.java +++ b/src/main/java/emu/grasscutter/server/packet/send/PacketGetPlayerTokenRsp.java @@ -2,13 +2,13 @@ package emu.grasscutter.server.packet.send; import com.google.protobuf.ByteString; -import emu.grasscutter.net.packet.GenshinPacket; +import emu.grasscutter.net.packet.BasePacket; import emu.grasscutter.net.packet.PacketOpcodes; import emu.grasscutter.net.proto.GetPlayerTokenRspOuterClass.GetPlayerTokenRsp; import emu.grasscutter.server.game.GameSession; import emu.grasscutter.utils.Crypto; -public class PacketGetPlayerTokenRsp extends GenshinPacket { +public class PacketGetPlayerTokenRsp extends BasePacket { public PacketGetPlayerTokenRsp(GameSession session, boolean doesPlayerExist) { super(PacketOpcodes.GetPlayerTokenRsp, true); diff --git a/src/main/java/emu/grasscutter/server/packet/send/PacketGetSceneAreaRsp.java b/src/main/java/emu/grasscutter/server/packet/send/PacketGetSceneAreaRsp.java index e0f6c5a03..280b62623 100644 --- a/src/main/java/emu/grasscutter/server/packet/send/PacketGetSceneAreaRsp.java +++ b/src/main/java/emu/grasscutter/server/packet/send/PacketGetSceneAreaRsp.java @@ -3,12 +3,12 @@ package emu.grasscutter.server.packet.send; import java.util.Arrays; import java.util.stream.Collectors; -import emu.grasscutter.net.packet.GenshinPacket; +import emu.grasscutter.net.packet.BasePacket; import emu.grasscutter.net.packet.PacketOpcodes; import emu.grasscutter.net.proto.CityInfoOuterClass.CityInfo; import emu.grasscutter.net.proto.GetSceneAreaRspOuterClass.GetSceneAreaRsp; -public class PacketGetSceneAreaRsp extends GenshinPacket { +public class PacketGetSceneAreaRsp extends BasePacket { public PacketGetSceneAreaRsp(int sceneId) { super(PacketOpcodes.GetSceneAreaRsp); diff --git a/src/main/java/emu/grasscutter/server/packet/send/PacketGetScenePointRsp.java b/src/main/java/emu/grasscutter/server/packet/send/PacketGetScenePointRsp.java index 73807bed7..85b7ab02f 100644 --- a/src/main/java/emu/grasscutter/server/packet/send/PacketGetScenePointRsp.java +++ b/src/main/java/emu/grasscutter/server/packet/send/PacketGetScenePointRsp.java @@ -1,10 +1,10 @@ package emu.grasscutter.server.packet.send; -import emu.grasscutter.net.packet.GenshinPacket; +import emu.grasscutter.net.packet.BasePacket; import emu.grasscutter.net.packet.PacketOpcodes; import emu.grasscutter.net.proto.GetScenePointRspOuterClass.GetScenePointRsp; -public class PacketGetScenePointRsp extends GenshinPacket { +public class PacketGetScenePointRsp extends BasePacket { public PacketGetScenePointRsp(int sceneId) { super(PacketOpcodes.GetScenePointRsp); diff --git a/src/main/java/emu/grasscutter/server/packet/send/PacketGetShopRsp.java b/src/main/java/emu/grasscutter/server/packet/send/PacketGetShopRsp.java index d80d445d9..64d415763 100644 --- a/src/main/java/emu/grasscutter/server/packet/send/PacketGetShopRsp.java +++ b/src/main/java/emu/grasscutter/server/packet/send/PacketGetShopRsp.java @@ -1,11 +1,11 @@ package emu.grasscutter.server.packet.send; -import emu.grasscutter.net.packet.GenshinPacket; +import emu.grasscutter.net.packet.BasePacket; import emu.grasscutter.net.packet.PacketOpcodes; import emu.grasscutter.net.proto.GetShopRspOuterClass.GetShopRsp; import emu.grasscutter.net.proto.ShopOuterClass.Shop; -public class PacketGetShopRsp extends GenshinPacket { +public class PacketGetShopRsp extends BasePacket { public PacketGetShopRsp(int shopType) { super(PacketOpcodes.GetShopRsp); diff --git a/src/main/java/emu/grasscutter/server/packet/send/PacketGetShopmallDataRsp.java b/src/main/java/emu/grasscutter/server/packet/send/PacketGetShopmallDataRsp.java index 38b44b5b6..17f682406 100644 --- a/src/main/java/emu/grasscutter/server/packet/send/PacketGetShopmallDataRsp.java +++ b/src/main/java/emu/grasscutter/server/packet/send/PacketGetShopmallDataRsp.java @@ -1,10 +1,10 @@ package emu.grasscutter.server.packet.send; -import emu.grasscutter.net.packet.GenshinPacket; +import emu.grasscutter.net.packet.BasePacket; import emu.grasscutter.net.packet.PacketOpcodes; import emu.grasscutter.net.proto.GetShopmallDataRspOuterClass.GetShopmallDataRsp; -public class PacketGetShopmallDataRsp extends GenshinPacket { +public class PacketGetShopmallDataRsp extends BasePacket { public PacketGetShopmallDataRsp() { super(PacketOpcodes.GetShopmallDataRsp); diff --git a/src/main/java/emu/grasscutter/server/packet/send/PacketGetWorldMpInfoRsp.java b/src/main/java/emu/grasscutter/server/packet/send/PacketGetWorldMpInfoRsp.java index 1b06c2cfe..7ab3c88e4 100644 --- a/src/main/java/emu/grasscutter/server/packet/send/PacketGetWorldMpInfoRsp.java +++ b/src/main/java/emu/grasscutter/server/packet/send/PacketGetWorldMpInfoRsp.java @@ -1,11 +1,11 @@ package emu.grasscutter.server.packet.send; -import emu.grasscutter.game.World; -import emu.grasscutter.net.packet.GenshinPacket; +import emu.grasscutter.game.world.World; +import emu.grasscutter.net.packet.BasePacket; import emu.grasscutter.net.packet.PacketOpcodes; import emu.grasscutter.net.proto.GetWorldMpInfoRspOuterClass.GetWorldMpInfoRsp; -public class PacketGetWorldMpInfoRsp extends GenshinPacket { +public class PacketGetWorldMpInfoRsp extends BasePacket { public PacketGetWorldMpInfoRsp(World world) { super(PacketOpcodes.GetWorldMpInfoRsp); diff --git a/src/main/java/emu/grasscutter/server/packet/send/PacketH5ActivityIdsNotify.java b/src/main/java/emu/grasscutter/server/packet/send/PacketH5ActivityIdsNotify.java index 9ce59137b..128a15133 100644 --- a/src/main/java/emu/grasscutter/server/packet/send/PacketH5ActivityIdsNotify.java +++ b/src/main/java/emu/grasscutter/server/packet/send/PacketH5ActivityIdsNotify.java @@ -1,10 +1,10 @@ package emu.grasscutter.server.packet.send; -import emu.grasscutter.net.packet.GenshinPacket; +import emu.grasscutter.net.packet.BasePacket; import emu.grasscutter.net.packet.PacketOpcodes; import emu.grasscutter.net.proto.H5ActivityIdsNotifyOuterClass.H5ActivityIdsNotify; -public class PacketH5ActivityIdsNotify extends GenshinPacket { +public class PacketH5ActivityIdsNotify extends BasePacket { public PacketH5ActivityIdsNotify() { super(PacketOpcodes.H5ActivityIdsNotify); diff --git a/src/main/java/emu/grasscutter/server/packet/send/PacketHostPlayerNotify.java b/src/main/java/emu/grasscutter/server/packet/send/PacketHostPlayerNotify.java index 9a43124e4..48d0f7b9e 100644 --- a/src/main/java/emu/grasscutter/server/packet/send/PacketHostPlayerNotify.java +++ b/src/main/java/emu/grasscutter/server/packet/send/PacketHostPlayerNotify.java @@ -1,11 +1,11 @@ package emu.grasscutter.server.packet.send; -import emu.grasscutter.game.World; -import emu.grasscutter.net.packet.GenshinPacket; +import emu.grasscutter.game.world.World; +import emu.grasscutter.net.packet.BasePacket; import emu.grasscutter.net.packet.PacketOpcodes; import emu.grasscutter.net.proto.HostPlayerNotifyOuterClass.HostPlayerNotify; -public class PacketHostPlayerNotify extends GenshinPacket { +public class PacketHostPlayerNotify extends BasePacket { public PacketHostPlayerNotify(World world) { super(PacketOpcodes.HostPlayerNotify); diff --git a/src/main/java/emu/grasscutter/server/packet/send/PacketItemAddHintNotify.java b/src/main/java/emu/grasscutter/server/packet/send/PacketItemAddHintNotify.java index 598b9a0f6..7b0275c50 100644 --- a/src/main/java/emu/grasscutter/server/packet/send/PacketItemAddHintNotify.java +++ b/src/main/java/emu/grasscutter/server/packet/send/PacketItemAddHintNotify.java @@ -1,16 +1,17 @@ package emu.grasscutter.server.packet.send; +import java.util.Collection; import java.util.List; -import emu.grasscutter.game.inventory.GenshinItem; +import emu.grasscutter.game.inventory.GameItem; import emu.grasscutter.game.props.ActionReason; -import emu.grasscutter.net.packet.GenshinPacket; +import emu.grasscutter.net.packet.BasePacket; import emu.grasscutter.net.packet.PacketOpcodes; import emu.grasscutter.net.proto.ItemAddHintNotifyOuterClass.ItemAddHintNotify; -public class PacketItemAddHintNotify extends GenshinPacket { +public class PacketItemAddHintNotify extends BasePacket { - public PacketItemAddHintNotify(GenshinItem item, ActionReason reason) { + public PacketItemAddHintNotify(GameItem item, ActionReason reason) { super(PacketOpcodes.ItemAddHintNotify); ItemAddHintNotify proto = ItemAddHintNotify.newBuilder() @@ -21,13 +22,13 @@ public class PacketItemAddHintNotify extends GenshinPacket { this.setData(proto); } - public PacketItemAddHintNotify(List<GenshinItem> items, ActionReason reason) { + public PacketItemAddHintNotify(Collection<GameItem> items, ActionReason reason) { super(PacketOpcodes.ItemAddHintNotify); ItemAddHintNotify.Builder proto = ItemAddHintNotify.newBuilder() .setReason(reason.getValue()); - for (GenshinItem item : items) { + for (GameItem item : items) { proto.addItemList(item.toItemHintProto()); } diff --git a/src/main/java/emu/grasscutter/server/packet/send/PacketLifeStateChangeNotify.java b/src/main/java/emu/grasscutter/server/packet/send/PacketLifeStateChangeNotify.java index 1f26717a3..c70d117d7 100644 --- a/src/main/java/emu/grasscutter/server/packet/send/PacketLifeStateChangeNotify.java +++ b/src/main/java/emu/grasscutter/server/packet/send/PacketLifeStateChangeNotify.java @@ -1,13 +1,13 @@ package emu.grasscutter.server.packet.send; -import emu.grasscutter.game.entity.GenshinEntity; +import emu.grasscutter.game.entity.GameEntity; import emu.grasscutter.game.props.LifeState; -import emu.grasscutter.net.packet.GenshinPacket; +import emu.grasscutter.net.packet.BasePacket; import emu.grasscutter.net.packet.PacketOpcodes; import emu.grasscutter.net.proto.LifeStateChangeNotifyOuterClass.LifeStateChangeNotify; -public class PacketLifeStateChangeNotify extends GenshinPacket { - public PacketLifeStateChangeNotify(GenshinEntity attacker, GenshinEntity target, LifeState lifeState) { +public class PacketLifeStateChangeNotify extends BasePacket { + public PacketLifeStateChangeNotify(GameEntity attacker, GameEntity target, LifeState lifeState) { super(PacketOpcodes.LifeStateChangeNotify); LifeStateChangeNotify proto = LifeStateChangeNotify.newBuilder() @@ -18,7 +18,7 @@ public class PacketLifeStateChangeNotify extends GenshinPacket { this.setData(proto); } - public PacketLifeStateChangeNotify(int attackerId, GenshinEntity target, LifeState lifeState) { + public PacketLifeStateChangeNotify(int attackerId, GameEntity target, LifeState lifeState) { super(PacketOpcodes.LifeStateChangeNotify); LifeStateChangeNotify proto = LifeStateChangeNotify.newBuilder() diff --git a/src/main/java/emu/grasscutter/server/packet/send/PacketMailChangeNotify.java b/src/main/java/emu/grasscutter/server/packet/send/PacketMailChangeNotify.java new file mode 100644 index 000000000..c4b2b229e --- /dev/null +++ b/src/main/java/emu/grasscutter/server/packet/send/PacketMailChangeNotify.java @@ -0,0 +1,69 @@ +package emu.grasscutter.server.packet.send; + + +import emu.grasscutter.Grasscutter; +import emu.grasscutter.game.mail.Mail; +import emu.grasscutter.game.player.Player; +import emu.grasscutter.net.packet.BasePacket; +import emu.grasscutter.net.packet.PacketOpcodes; +import emu.grasscutter.net.proto.*; + +import java.util.ArrayList; +import java.util.List; + +public class PacketMailChangeNotify extends BasePacket { + + public PacketMailChangeNotify(Player player, Mail message) { + this (player, new ArrayList<Mail>(){{add(message);}}); + } + + public PacketMailChangeNotify(Player player, List<Mail> mailList) { + this(player, mailList, null); + } + + public PacketMailChangeNotify(Player player, List<Mail> mailList, List<Integer> delMailIdList) { + super(PacketOpcodes.MailChangeNotify); + + MailChangeNotifyOuterClass.MailChangeNotify.Builder proto = MailChangeNotifyOuterClass.MailChangeNotify.newBuilder(); + + if (mailList != null) { + for (Mail message : mailList) { + MailTextContentOuterClass.MailTextContent.Builder mailTextContent = MailTextContentOuterClass.MailTextContent.newBuilder(); + mailTextContent.setTitle(message.mailContent.title); + mailTextContent.setContent(message.mailContent.content); + mailTextContent.setSender(message.mailContent.sender); + + List<MailItemOuterClass.MailItem> mailItems = new ArrayList<MailItemOuterClass.MailItem>(); + + for (Mail.MailItem item : message.itemList) { + MailItemOuterClass.MailItem.Builder mailItem = MailItemOuterClass.MailItem.newBuilder(); + ItemParamOuterClass.ItemParam.Builder itemParam = ItemParamOuterClass.ItemParam.newBuilder(); + itemParam.setItemId(item.itemId); + itemParam.setCount(item.itemCount); + mailItem.setItemParam(itemParam.build()); + + mailItems.add(mailItem.build()); + } + + MailDataOuterClass.MailData.Builder mailData = MailDataOuterClass.MailData.newBuilder(); + mailData.setMailId(player.getMailId(message)); + mailData.setMailTextContent(mailTextContent.build()); + mailData.addAllItemList(mailItems); + mailData.setSendTime((int) message.sendTime); + mailData.setExpireTime((int) message.expireTime); + mailData.setImportance(message.importance); + mailData.setIsRead(message.isRead); + mailData.setIsAttachmentGot(message.isAttachmentGot); + mailData.setStateValue(message.stateValue); + + proto.addMailList(mailData.build()); + } + } + + if(delMailIdList != null) { + proto.addAllDelMailIdList(delMailIdList); + } + + this.setData(proto.build()); + } +} \ No newline at end of file diff --git a/src/main/java/emu/grasscutter/server/packet/send/PacketNpcTalkRsp.java b/src/main/java/emu/grasscutter/server/packet/send/PacketNpcTalkRsp.java index b447a19eb..f3720a60e 100644 --- a/src/main/java/emu/grasscutter/server/packet/send/PacketNpcTalkRsp.java +++ b/src/main/java/emu/grasscutter/server/packet/send/PacketNpcTalkRsp.java @@ -1,10 +1,10 @@ package emu.grasscutter.server.packet.send; -import emu.grasscutter.net.packet.GenshinPacket; +import emu.grasscutter.net.packet.BasePacket; import emu.grasscutter.net.packet.PacketOpcodes; import emu.grasscutter.net.proto.NpcTalkRspOuterClass.NpcTalkRsp; -public class PacketNpcTalkRsp extends GenshinPacket { +public class PacketNpcTalkRsp extends BasePacket { public PacketNpcTalkRsp(int npcEntityId, int curTalkId, int entityId) { super(PacketOpcodes.NpcTalkRsp); diff --git a/src/main/java/emu/grasscutter/server/packet/send/PacketOpenStateUpdateNotify.java b/src/main/java/emu/grasscutter/server/packet/send/PacketOpenStateUpdateNotify.java index c0b5fd38f..df74264ca 100644 --- a/src/main/java/emu/grasscutter/server/packet/send/PacketOpenStateUpdateNotify.java +++ b/src/main/java/emu/grasscutter/server/packet/send/PacketOpenStateUpdateNotify.java @@ -1,11 +1,11 @@ package emu.grasscutter.server.packet.send; import emu.grasscutter.game.props.OpenState; -import emu.grasscutter.net.packet.GenshinPacket; +import emu.grasscutter.net.packet.BasePacket; import emu.grasscutter.net.packet.PacketOpcodes; import emu.grasscutter.net.proto.OpenStateUpdateNotifyOuterClass.OpenStateUpdateNotify; -public class PacketOpenStateUpdateNotify extends GenshinPacket { +public class PacketOpenStateUpdateNotify extends BasePacket { public PacketOpenStateUpdateNotify() { super(PacketOpcodes.OpenStateUpdateNotify); diff --git a/src/main/java/emu/grasscutter/server/packet/send/PacketPathfindingEnterSceneRsp.java b/src/main/java/emu/grasscutter/server/packet/send/PacketPathfindingEnterSceneRsp.java index 029b0fc7e..16caca296 100644 --- a/src/main/java/emu/grasscutter/server/packet/send/PacketPathfindingEnterSceneRsp.java +++ b/src/main/java/emu/grasscutter/server/packet/send/PacketPathfindingEnterSceneRsp.java @@ -1,9 +1,9 @@ package emu.grasscutter.server.packet.send; -import emu.grasscutter.net.packet.GenshinPacket; +import emu.grasscutter.net.packet.BasePacket; import emu.grasscutter.net.packet.PacketOpcodes; -public class PacketPathfindingEnterSceneRsp extends GenshinPacket { +public class PacketPathfindingEnterSceneRsp extends BasePacket { public PacketPathfindingEnterSceneRsp(int clientSequence) { super(PacketOpcodes.PathfindingEnterSceneRsp); diff --git a/src/main/java/emu/grasscutter/server/packet/send/PacketPingRsp.java b/src/main/java/emu/grasscutter/server/packet/send/PacketPingRsp.java index 47151bf06..735fe855b 100644 --- a/src/main/java/emu/grasscutter/server/packet/send/PacketPingRsp.java +++ b/src/main/java/emu/grasscutter/server/packet/send/PacketPingRsp.java @@ -1,10 +1,10 @@ package emu.grasscutter.server.packet.send; -import emu.grasscutter.net.packet.GenshinPacket; +import emu.grasscutter.net.packet.BasePacket; import emu.grasscutter.net.packet.PacketOpcodes; import emu.grasscutter.net.proto.PingRspOuterClass.PingRsp; -public class PacketPingRsp extends GenshinPacket { +public class PacketPingRsp extends BasePacket { public PacketPingRsp(int clientSeq, int time) { super(PacketOpcodes.PingRsp, clientSeq); diff --git a/src/main/java/emu/grasscutter/server/packet/send/PacketPlayerApplyEnterMpNotify.java b/src/main/java/emu/grasscutter/server/packet/send/PacketPlayerApplyEnterMpNotify.java index 7d064aa9c..bbf0c03c6 100644 --- a/src/main/java/emu/grasscutter/server/packet/send/PacketPlayerApplyEnterMpNotify.java +++ b/src/main/java/emu/grasscutter/server/packet/send/PacketPlayerApplyEnterMpNotify.java @@ -1,13 +1,13 @@ package emu.grasscutter.server.packet.send; -import emu.grasscutter.game.GenshinPlayer; -import emu.grasscutter.net.packet.GenshinPacket; +import emu.grasscutter.game.player.Player; +import emu.grasscutter.net.packet.BasePacket; import emu.grasscutter.net.packet.PacketOpcodes; import emu.grasscutter.net.proto.PlayerApplyEnterMpNotifyOuterClass.PlayerApplyEnterMpNotify; -public class PacketPlayerApplyEnterMpNotify extends GenshinPacket { +public class PacketPlayerApplyEnterMpNotify extends BasePacket { - public PacketPlayerApplyEnterMpNotify(GenshinPlayer srcPlayer) { + public PacketPlayerApplyEnterMpNotify(Player srcPlayer) { super(PacketOpcodes.PlayerApplyEnterMpNotify); PlayerApplyEnterMpNotify proto = PlayerApplyEnterMpNotify.newBuilder() diff --git a/src/main/java/emu/grasscutter/server/packet/send/PacketPlayerApplyEnterMpResultNotify.java b/src/main/java/emu/grasscutter/server/packet/send/PacketPlayerApplyEnterMpResultNotify.java index c55ee3b12..b92f8a3b3 100644 --- a/src/main/java/emu/grasscutter/server/packet/send/PacketPlayerApplyEnterMpResultNotify.java +++ b/src/main/java/emu/grasscutter/server/packet/send/PacketPlayerApplyEnterMpResultNotify.java @@ -1,14 +1,15 @@ package emu.grasscutter.server.packet.send; -import emu.grasscutter.game.GenshinPlayer; -import emu.grasscutter.net.packet.GenshinPacket; +import emu.grasscutter.game.player.Player; +import emu.grasscutter.net.packet.BasePacket; import emu.grasscutter.net.packet.PacketOpcodes; import emu.grasscutter.net.proto.PlayerApplyEnterMpReasonOuterClass.PlayerApplyEnterMpReason; +import emu.grasscutter.net.proto.PlayerApplyEnterMpResultNotifyOuterClass; import emu.grasscutter.net.proto.PlayerApplyEnterMpResultNotifyOuterClass.PlayerApplyEnterMpResultNotify; -public class PacketPlayerApplyEnterMpResultNotify extends GenshinPacket { +public class PacketPlayerApplyEnterMpResultNotify extends BasePacket { - public PacketPlayerApplyEnterMpResultNotify(GenshinPlayer target, boolean isAgreed, PlayerApplyEnterMpResultNotify.Reason reason) { + public PacketPlayerApplyEnterMpResultNotify(Player target, boolean isAgreed, PlayerApplyEnterMpResultNotifyOuterClass.PlayerApplyEnterMpResultNotify.Reason reason) { super(PacketOpcodes.PlayerApplyEnterMpResultNotify); PlayerApplyEnterMpResultNotify proto = PlayerApplyEnterMpResultNotify.newBuilder() diff --git a/src/main/java/emu/grasscutter/server/packet/send/PacketPlayerApplyEnterMpResultRsp.java b/src/main/java/emu/grasscutter/server/packet/send/PacketPlayerApplyEnterMpResultRsp.java index 7fa4baa55..94fcb3150 100644 --- a/src/main/java/emu/grasscutter/server/packet/send/PacketPlayerApplyEnterMpResultRsp.java +++ b/src/main/java/emu/grasscutter/server/packet/send/PacketPlayerApplyEnterMpResultRsp.java @@ -1,10 +1,10 @@ package emu.grasscutter.server.packet.send; -import emu.grasscutter.net.packet.GenshinPacket; +import emu.grasscutter.net.packet.BasePacket; import emu.grasscutter.net.packet.PacketOpcodes; import emu.grasscutter.net.proto.PlayerApplyEnterMpResultRspOuterClass.PlayerApplyEnterMpResultRsp; -public class PacketPlayerApplyEnterMpResultRsp extends GenshinPacket { +public class PacketPlayerApplyEnterMpResultRsp extends BasePacket { public PacketPlayerApplyEnterMpResultRsp(int applyUid, boolean isAgreed) { super(PacketOpcodes.PlayerApplyEnterMpResultRsp); diff --git a/src/main/java/emu/grasscutter/server/packet/send/PacketPlayerApplyEnterMpRsp.java b/src/main/java/emu/grasscutter/server/packet/send/PacketPlayerApplyEnterMpRsp.java index 71174371d..1dce6f8b5 100644 --- a/src/main/java/emu/grasscutter/server/packet/send/PacketPlayerApplyEnterMpRsp.java +++ b/src/main/java/emu/grasscutter/server/packet/send/PacketPlayerApplyEnterMpRsp.java @@ -1,10 +1,10 @@ package emu.grasscutter.server.packet.send; -import emu.grasscutter.net.packet.GenshinPacket; +import emu.grasscutter.net.packet.BasePacket; import emu.grasscutter.net.packet.PacketOpcodes; import emu.grasscutter.net.proto.PlayerApplyEnterMpRspOuterClass.PlayerApplyEnterMpRsp; -public class PacketPlayerApplyEnterMpRsp extends GenshinPacket { +public class PacketPlayerApplyEnterMpRsp extends BasePacket { public PacketPlayerApplyEnterMpRsp(int targetUid) { super(PacketOpcodes.PlayerApplyEnterMpRsp); diff --git a/src/main/java/emu/grasscutter/server/packet/send/PacketPlayerChatNotify.java b/src/main/java/emu/grasscutter/server/packet/send/PacketPlayerChatNotify.java index 3118adf57..16ce6a6f7 100644 --- a/src/main/java/emu/grasscutter/server/packet/send/PacketPlayerChatNotify.java +++ b/src/main/java/emu/grasscutter/server/packet/send/PacketPlayerChatNotify.java @@ -1,15 +1,15 @@ package emu.grasscutter.server.packet.send; -import emu.grasscutter.game.GenshinPlayer; -import emu.grasscutter.net.packet.GenshinPacket; +import emu.grasscutter.game.player.Player; +import emu.grasscutter.net.packet.BasePacket; import emu.grasscutter.net.packet.PacketOpcodes; import emu.grasscutter.net.proto.ChatInfoOuterClass.ChatInfo; import emu.grasscutter.net.proto.PlayerChatNotifyOuterClass.PlayerChatNotify; import emu.grasscutter.net.proto.SystemHintOuterClass.SystemHint; -public class PacketPlayerChatNotify extends GenshinPacket { +public class PacketPlayerChatNotify extends BasePacket { - public PacketPlayerChatNotify(GenshinPlayer sender, int channelId, String message) { + public PacketPlayerChatNotify(Player sender, int channelId, String message) { super(PacketOpcodes.PlayerChatNotify); ChatInfo info = ChatInfo.newBuilder() @@ -26,7 +26,7 @@ public class PacketPlayerChatNotify extends GenshinPacket { this.setData(proto); } - public PacketPlayerChatNotify(GenshinPlayer sender, int channelId, int emote) { + public PacketPlayerChatNotify(Player sender, int channelId, int emote) { super(PacketOpcodes.PlayerChatNotify); ChatInfo info = ChatInfo.newBuilder() @@ -43,7 +43,7 @@ public class PacketPlayerChatNotify extends GenshinPacket { this.setData(proto); } - public PacketPlayerChatNotify(GenshinPlayer sender, int channelId, ChatInfo.SystemHint systemHint) { + public PacketPlayerChatNotify(Player sender, int channelId, ChatInfo.SystemHint systemHint) { super(PacketOpcodes.PlayerChatNotify); ChatInfo info = ChatInfo.newBuilder() diff --git a/src/main/java/emu/grasscutter/server/packet/send/PacketPlayerChatRsp.java b/src/main/java/emu/grasscutter/server/packet/send/PacketPlayerChatRsp.java index 83b51a2a2..9dbda6c88 100644 --- a/src/main/java/emu/grasscutter/server/packet/send/PacketPlayerChatRsp.java +++ b/src/main/java/emu/grasscutter/server/packet/send/PacketPlayerChatRsp.java @@ -1,10 +1,10 @@ package emu.grasscutter.server.packet.send; -import emu.grasscutter.net.packet.GenshinPacket; +import emu.grasscutter.net.packet.BasePacket; import emu.grasscutter.net.packet.PacketOpcodes; import emu.grasscutter.net.proto.PlayerChatRspOuterClass.PlayerChatRsp; -public class PacketPlayerChatRsp extends GenshinPacket { +public class PacketPlayerChatRsp extends BasePacket { public PacketPlayerChatRsp() { super(PacketOpcodes.PlayerChatRsp); diff --git a/src/main/java/emu/grasscutter/server/packet/send/PacketPlayerDataNotify.java b/src/main/java/emu/grasscutter/server/packet/send/PacketPlayerDataNotify.java index c5eb76238..81da25821 100644 --- a/src/main/java/emu/grasscutter/server/packet/send/PacketPlayerDataNotify.java +++ b/src/main/java/emu/grasscutter/server/packet/send/PacketPlayerDataNotify.java @@ -1,14 +1,14 @@ package emu.grasscutter.server.packet.send; -import emu.grasscutter.game.GenshinPlayer; -import emu.grasscutter.net.packet.GenshinPacket; +import emu.grasscutter.game.player.Player; +import emu.grasscutter.net.packet.BasePacket; import emu.grasscutter.net.packet.PacketOpcodes; import emu.grasscutter.net.proto.PlayerDataNotifyOuterClass.PlayerDataNotify; import emu.grasscutter.net.proto.PropValueOuterClass.PropValue; -public class PacketPlayerDataNotify extends GenshinPacket { +public class PacketPlayerDataNotify extends BasePacket { - public PacketPlayerDataNotify(GenshinPlayer player) { + public PacketPlayerDataNotify(Player player) { super(PacketOpcodes.PlayerDataNotify, 2); PlayerDataNotify.Builder p = PlayerDataNotify.newBuilder() diff --git a/src/main/java/emu/grasscutter/server/packet/send/PacketPlayerEnterSceneInfoNotify.java b/src/main/java/emu/grasscutter/server/packet/send/PacketPlayerEnterSceneInfoNotify.java index 9668a250c..c0bc5abe1 100644 --- a/src/main/java/emu/grasscutter/server/packet/send/PacketPlayerEnterSceneInfoNotify.java +++ b/src/main/java/emu/grasscutter/server/packet/send/PacketPlayerEnterSceneInfoNotify.java @@ -1,9 +1,9 @@ package emu.grasscutter.server.packet.send; -import emu.grasscutter.game.GenshinPlayer; import emu.grasscutter.game.entity.EntityAvatar; -import emu.grasscutter.game.inventory.GenshinItem; -import emu.grasscutter.net.packet.GenshinPacket; +import emu.grasscutter.game.inventory.GameItem; +import emu.grasscutter.game.player.Player; +import emu.grasscutter.net.packet.BasePacket; import emu.grasscutter.net.packet.PacketOpcodes; import emu.grasscutter.net.proto.AbilityControlBlockOuterClass; import emu.grasscutter.net.proto.AbilitySyncStateInfoOuterClass.AbilitySyncStateInfo; @@ -12,9 +12,9 @@ import emu.grasscutter.net.proto.MPLevelEntityInfoOuterClass.MPLevelEntityInfo; import emu.grasscutter.net.proto.PlayerEnterSceneInfoNotifyOuterClass.PlayerEnterSceneInfoNotify; import emu.grasscutter.net.proto.TeamEnterSceneInfoOuterClass.TeamEnterSceneInfo; -public class PacketPlayerEnterSceneInfoNotify extends GenshinPacket { +public class PacketPlayerEnterSceneInfoNotify extends BasePacket { - public PacketPlayerEnterSceneInfoNotify(GenshinPlayer player) { + public PacketPlayerEnterSceneInfoNotify(Player player) { super(PacketOpcodes.PlayerEnterSceneInfoNotify); AbilitySyncStateInfo empty = AbilitySyncStateInfo.newBuilder().build(); @@ -37,7 +37,7 @@ public class PacketPlayerEnterSceneInfoNotify extends GenshinPacket { ); for (EntityAvatar avatarEntity : player.getTeamManager().getActiveTeam()) { - GenshinItem weapon = avatarEntity.getAvatar().getWeapon(); + GameItem weapon = avatarEntity.getAvatar().getWeapon(); long weaponGuid = weapon != null ? weapon.getGuid() : 0; AvatarEnterSceneInfo avatarInfo = AvatarEnterSceneInfo.newBuilder() diff --git a/src/main/java/emu/grasscutter/server/packet/send/PacketPlayerEnterSceneNotify.java b/src/main/java/emu/grasscutter/server/packet/send/PacketPlayerEnterSceneNotify.java index cd2f78a0d..42fe3a12f 100644 --- a/src/main/java/emu/grasscutter/server/packet/send/PacketPlayerEnterSceneNotify.java +++ b/src/main/java/emu/grasscutter/server/packet/send/PacketPlayerEnterSceneNotify.java @@ -1,19 +1,19 @@ package emu.grasscutter.server.packet.send; -import emu.grasscutter.game.GenshinPlayer; -import emu.grasscutter.game.GenshinPlayer.SceneLoadState; +import emu.grasscutter.game.player.Player; +import emu.grasscutter.game.player.Player.SceneLoadState; import emu.grasscutter.game.props.EnterReason; -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.PlayerEnterSceneNotifyOuterClass.PlayerEnterSceneNotify; import emu.grasscutter.utils.Position; import emu.grasscutter.utils.Utils; -public class PacketPlayerEnterSceneNotify extends GenshinPacket { +public class PacketPlayerEnterSceneNotify extends BasePacket { // Login - public PacketPlayerEnterSceneNotify(GenshinPlayer player) { + public PacketPlayerEnterSceneNotify(Player player) { super(PacketOpcodes.PlayerEnterSceneNotify); player.setSceneLoadState(SceneLoadState.LOADING); @@ -36,12 +36,12 @@ public class PacketPlayerEnterSceneNotify extends GenshinPacket { this.setData(proto); } - public PacketPlayerEnterSceneNotify(GenshinPlayer player, EnterType type, EnterReason reason, int newScene, Position newPos) { + public PacketPlayerEnterSceneNotify(Player player, EnterType type, EnterReason reason, int newScene, Position newPos) { this(player, player, type, reason, newScene, newPos); } // Teleport or go somewhere - public PacketPlayerEnterSceneNotify(GenshinPlayer player, GenshinPlayer target, EnterType type, EnterReason reason, int newScene, Position newPos) { + public PacketPlayerEnterSceneNotify(Player player, Player target, EnterType type, EnterReason reason, int newScene, Position newPos) { super(PacketOpcodes.PlayerEnterSceneNotify); player.setEnterSceneToken(Utils.randomRange(1000, 99999)); diff --git a/src/main/java/emu/grasscutter/server/packet/send/PacketPlayerGameTimeNotify.java b/src/main/java/emu/grasscutter/server/packet/send/PacketPlayerGameTimeNotify.java index 1dd219e1e..51bcef3a5 100644 --- a/src/main/java/emu/grasscutter/server/packet/send/PacketPlayerGameTimeNotify.java +++ b/src/main/java/emu/grasscutter/server/packet/send/PacketPlayerGameTimeNotify.java @@ -1,14 +1,14 @@ package emu.grasscutter.server.packet.send; -import emu.grasscutter.game.GenshinPlayer; -import emu.grasscutter.game.World; -import emu.grasscutter.net.packet.GenshinPacket; +import emu.grasscutter.game.player.Player; +import emu.grasscutter.game.world.World; +import emu.grasscutter.net.packet.BasePacket; import emu.grasscutter.net.packet.PacketOpcodes; import emu.grasscutter.net.proto.PlayerGameTimeNotifyOuterClass.PlayerGameTimeNotify; -public class PacketPlayerGameTimeNotify extends GenshinPacket { +public class PacketPlayerGameTimeNotify extends BasePacket { - public PacketPlayerGameTimeNotify(GenshinPlayer player) { + public PacketPlayerGameTimeNotify(Player player) { super(PacketOpcodes.PlayerGameTimeNotify); PlayerGameTimeNotify proto = PlayerGameTimeNotify.newBuilder() diff --git a/src/main/java/emu/grasscutter/server/packet/send/PacketPlayerGetForceQuitBanInfoRsp.java b/src/main/java/emu/grasscutter/server/packet/send/PacketPlayerGetForceQuitBanInfoRsp.java index acc030817..057f9f005 100644 --- a/src/main/java/emu/grasscutter/server/packet/send/PacketPlayerGetForceQuitBanInfoRsp.java +++ b/src/main/java/emu/grasscutter/server/packet/send/PacketPlayerGetForceQuitBanInfoRsp.java @@ -1,10 +1,10 @@ package emu.grasscutter.server.packet.send; -import emu.grasscutter.net.packet.GenshinPacket; +import emu.grasscutter.net.packet.BasePacket; import emu.grasscutter.net.packet.PacketOpcodes; import emu.grasscutter.net.proto.PlayerGetForceQuitBanInfoRspOuterClass.PlayerGetForceQuitBanInfoRsp; -public class PacketPlayerGetForceQuitBanInfoRsp extends GenshinPacket { +public class PacketPlayerGetForceQuitBanInfoRsp extends BasePacket { public PacketPlayerGetForceQuitBanInfoRsp(int retcode) { super(PacketOpcodes.PlayerGetForceQuitBanInfoRsp); diff --git a/src/main/java/emu/grasscutter/server/packet/send/PacketPlayerLevelRewardUpdateNotify.java b/src/main/java/emu/grasscutter/server/packet/send/PacketPlayerLevelRewardUpdateNotify.java index 6a20e288b..972e507c9 100644 --- a/src/main/java/emu/grasscutter/server/packet/send/PacketPlayerLevelRewardUpdateNotify.java +++ b/src/main/java/emu/grasscutter/server/packet/send/PacketPlayerLevelRewardUpdateNotify.java @@ -2,11 +2,11 @@ package emu.grasscutter.server.packet.send; import java.util.Set; -import emu.grasscutter.net.packet.GenshinPacket; +import emu.grasscutter.net.packet.BasePacket; import emu.grasscutter.net.packet.PacketOpcodes; import emu.grasscutter.net.proto.PlayerLevelRewardUpdateNotifyOuterClass.PlayerLevelRewardUpdateNotify; -public class PacketPlayerLevelRewardUpdateNotify extends GenshinPacket { +public class PacketPlayerLevelRewardUpdateNotify extends BasePacket { public PacketPlayerLevelRewardUpdateNotify(Set<Integer> rewardedLevels) { super(PacketOpcodes.PlayerLevelRewardUpdateNotify); diff --git a/src/main/java/emu/grasscutter/server/packet/send/PacketPlayerLoginRsp.java b/src/main/java/emu/grasscutter/server/packet/send/PacketPlayerLoginRsp.java index f48047633..18ff6c03e 100644 --- a/src/main/java/emu/grasscutter/server/packet/send/PacketPlayerLoginRsp.java +++ b/src/main/java/emu/grasscutter/server/packet/send/PacketPlayerLoginRsp.java @@ -2,7 +2,7 @@ package emu.grasscutter.server.packet.send; import com.google.protobuf.ByteString; import emu.grasscutter.Grasscutter; -import emu.grasscutter.net.packet.GenshinPacket; +import emu.grasscutter.net.packet.BasePacket; import emu.grasscutter.net.packet.PacketOpcodes; import emu.grasscutter.net.proto.PlayerLoginRspOuterClass.PlayerLoginRsp; import emu.grasscutter.net.proto.QueryCurrRegionHttpRspOuterClass; @@ -14,7 +14,7 @@ import java.io.File; import java.net.URL; import java.util.Base64; -public class PacketPlayerLoginRsp extends GenshinPacket { +public class PacketPlayerLoginRsp extends BasePacket { private static QueryCurrRegionHttpRspOuterClass.QueryCurrRegionHttpRsp regionCache; diff --git a/src/main/java/emu/grasscutter/server/packet/send/PacketPlayerPropNotify.java b/src/main/java/emu/grasscutter/server/packet/send/PacketPlayerPropNotify.java index 2e2812eb8..4cd708045 100644 --- a/src/main/java/emu/grasscutter/server/packet/send/PacketPlayerPropNotify.java +++ b/src/main/java/emu/grasscutter/server/packet/send/PacketPlayerPropNotify.java @@ -1,15 +1,15 @@ package emu.grasscutter.server.packet.send; -import emu.grasscutter.game.GenshinPlayer; +import emu.grasscutter.game.player.Player; import emu.grasscutter.game.props.PlayerProperty; -import emu.grasscutter.net.packet.GenshinPacket; +import emu.grasscutter.net.packet.BasePacket; import emu.grasscutter.net.packet.PacketOpcodes; import emu.grasscutter.net.proto.PlayerPropNotifyOuterClass.PlayerPropNotify; import emu.grasscutter.utils.ProtoHelper; -public class PacketPlayerPropNotify extends GenshinPacket { +public class PacketPlayerPropNotify extends BasePacket { - public PacketPlayerPropNotify(GenshinPlayer player, PlayerProperty prop) { + public PacketPlayerPropNotify(Player player, PlayerProperty prop) { super(PacketOpcodes.PlayerPropNotify); this.buildHeader(0); diff --git a/src/main/java/emu/grasscutter/server/packet/send/PacketPlayerSetPauseRsp.java b/src/main/java/emu/grasscutter/server/packet/send/PacketPlayerSetPauseRsp.java index e199381f8..7f79c629a 100644 --- a/src/main/java/emu/grasscutter/server/packet/send/PacketPlayerSetPauseRsp.java +++ b/src/main/java/emu/grasscutter/server/packet/send/PacketPlayerSetPauseRsp.java @@ -1,9 +1,9 @@ package emu.grasscutter.server.packet.send; -import emu.grasscutter.net.packet.GenshinPacket; +import emu.grasscutter.net.packet.BasePacket; import emu.grasscutter.net.packet.PacketOpcodes; -public class PacketPlayerSetPauseRsp extends GenshinPacket { +public class PacketPlayerSetPauseRsp extends BasePacket { public PacketPlayerSetPauseRsp(int clientSequence) { super(PacketOpcodes.PlayerSetPauseRsp); diff --git a/src/main/java/emu/grasscutter/server/packet/send/PacketPlayerStoreNotify.java b/src/main/java/emu/grasscutter/server/packet/send/PacketPlayerStoreNotify.java index f9649d4b4..a3a6ff7b8 100644 --- a/src/main/java/emu/grasscutter/server/packet/send/PacketPlayerStoreNotify.java +++ b/src/main/java/emu/grasscutter/server/packet/send/PacketPlayerStoreNotify.java @@ -1,18 +1,18 @@ package emu.grasscutter.server.packet.send; -import emu.grasscutter.GenshinConstants; +import emu.grasscutter.GameConstants; import emu.grasscutter.Grasscutter; -import emu.grasscutter.game.GenshinPlayer; -import emu.grasscutter.game.inventory.GenshinItem; -import emu.grasscutter.net.packet.GenshinPacket; +import emu.grasscutter.game.inventory.GameItem; +import emu.grasscutter.game.player.Player; +import emu.grasscutter.net.packet.BasePacket; import emu.grasscutter.net.packet.PacketOpcodes; import emu.grasscutter.net.proto.ItemOuterClass.Item; import emu.grasscutter.net.proto.PlayerStoreNotifyOuterClass.PlayerStoreNotify; import emu.grasscutter.net.proto.StoreTypeOuterClass.StoreType; -public class PacketPlayerStoreNotify extends GenshinPacket { +public class PacketPlayerStoreNotify extends BasePacket { - public PacketPlayerStoreNotify(GenshinPlayer player) { + public PacketPlayerStoreNotify(Player player) { super(PacketOpcodes.PlayerStoreNotify); this.buildHeader(2); @@ -21,7 +21,7 @@ public class PacketPlayerStoreNotify extends GenshinPacket { .setStoreType(StoreType.STORE_PACK) .setWeightLimit(Grasscutter.getConfig().getGameServerOptions().InventoryLimitAll); - for (GenshinItem item : player.getInventory()) { + for (GameItem item : player.getInventory()) { Item itemProto = item.toProto(); p.addItemList(itemProto); } diff --git a/src/main/java/emu/grasscutter/server/packet/send/PacketPlayerTimeNotify.java b/src/main/java/emu/grasscutter/server/packet/send/PacketPlayerTimeNotify.java index ad9a869cf..9bd2a1f08 100644 --- a/src/main/java/emu/grasscutter/server/packet/send/PacketPlayerTimeNotify.java +++ b/src/main/java/emu/grasscutter/server/packet/send/PacketPlayerTimeNotify.java @@ -1,13 +1,13 @@ package emu.grasscutter.server.packet.send; -import emu.grasscutter.game.GenshinPlayer; -import emu.grasscutter.net.packet.GenshinPacket; +import emu.grasscutter.game.player.Player; +import emu.grasscutter.net.packet.BasePacket; import emu.grasscutter.net.packet.PacketOpcodes; import emu.grasscutter.net.proto.PlayerTimeNotifyOuterClass.PlayerTimeNotify; -public class PacketPlayerTimeNotify extends GenshinPacket { +public class PacketPlayerTimeNotify extends BasePacket { - public PacketPlayerTimeNotify(GenshinPlayer player) { + public PacketPlayerTimeNotify(Player player) { super(PacketOpcodes.PlayerTimeNotify); PlayerTimeNotify proto = PlayerTimeNotify.newBuilder() diff --git a/src/main/java/emu/grasscutter/server/packet/send/PacketPostEnterSceneRsp.java b/src/main/java/emu/grasscutter/server/packet/send/PacketPostEnterSceneRsp.java index be8dede98..2bdc30dbc 100644 --- a/src/main/java/emu/grasscutter/server/packet/send/PacketPostEnterSceneRsp.java +++ b/src/main/java/emu/grasscutter/server/packet/send/PacketPostEnterSceneRsp.java @@ -1,13 +1,13 @@ package emu.grasscutter.server.packet.send; -import emu.grasscutter.game.GenshinPlayer; -import emu.grasscutter.net.packet.GenshinPacket; +import emu.grasscutter.game.player.Player; +import emu.grasscutter.net.packet.BasePacket; import emu.grasscutter.net.packet.PacketOpcodes; import emu.grasscutter.net.proto.PostEnterSceneRspOuterClass.PostEnterSceneRsp; -public class PacketPostEnterSceneRsp extends GenshinPacket { +public class PacketPostEnterSceneRsp extends BasePacket { - public PacketPostEnterSceneRsp(GenshinPlayer player) { + public PacketPostEnterSceneRsp(Player player) { super(PacketOpcodes.PostEnterSceneRsp); PostEnterSceneRsp p = PostEnterSceneRsp.newBuilder() diff --git a/src/main/java/emu/grasscutter/server/packet/send/PacketPrivateChatNotify.java b/src/main/java/emu/grasscutter/server/packet/send/PacketPrivateChatNotify.java index 60e08827b..94f389521 100644 --- a/src/main/java/emu/grasscutter/server/packet/send/PacketPrivateChatNotify.java +++ b/src/main/java/emu/grasscutter/server/packet/send/PacketPrivateChatNotify.java @@ -1,11 +1,11 @@ package emu.grasscutter.server.packet.send; -import emu.grasscutter.net.packet.GenshinPacket; +import emu.grasscutter.net.packet.BasePacket; import emu.grasscutter.net.packet.PacketOpcodes; import emu.grasscutter.net.proto.ChatInfoOuterClass.ChatInfo; import emu.grasscutter.net.proto.PrivateChatNotifyOuterClass.PrivateChatNotify; -public class PacketPrivateChatNotify extends GenshinPacket { +public class PacketPrivateChatNotify extends BasePacket { public PacketPrivateChatNotify(int senderId, int recvId, String message) { super(PacketOpcodes.PrivateChatNotify); diff --git a/src/main/java/emu/grasscutter/server/packet/send/PacketProudSkillChangeNotify.java b/src/main/java/emu/grasscutter/server/packet/send/PacketProudSkillChangeNotify.java index b089e5c8e..0ba63718a 100644 --- a/src/main/java/emu/grasscutter/server/packet/send/PacketProudSkillChangeNotify.java +++ b/src/main/java/emu/grasscutter/server/packet/send/PacketProudSkillChangeNotify.java @@ -1,13 +1,13 @@ package emu.grasscutter.server.packet.send; -import emu.grasscutter.game.avatar.GenshinAvatar; -import emu.grasscutter.net.packet.GenshinPacket; +import emu.grasscutter.game.avatar.Avatar; +import emu.grasscutter.net.packet.BasePacket; import emu.grasscutter.net.packet.PacketOpcodes; import emu.grasscutter.net.proto.ProudSkillChangeNotifyOuterClass.ProudSkillChangeNotify; -public class PacketProudSkillChangeNotify extends GenshinPacket { +public class PacketProudSkillChangeNotify extends BasePacket { - public PacketProudSkillChangeNotify(GenshinAvatar avatar) { + public PacketProudSkillChangeNotify(Avatar avatar) { super(PacketOpcodes.ProudSkillChangeNotify); ProudSkillChangeNotify proto = ProudSkillChangeNotify.newBuilder() diff --git a/src/main/java/emu/grasscutter/server/packet/send/PacketProudSkillExtraLevelNotify.java b/src/main/java/emu/grasscutter/server/packet/send/PacketProudSkillExtraLevelNotify.java index 127a0ec4f..2c8ac7867 100644 --- a/src/main/java/emu/grasscutter/server/packet/send/PacketProudSkillExtraLevelNotify.java +++ b/src/main/java/emu/grasscutter/server/packet/send/PacketProudSkillExtraLevelNotify.java @@ -1,13 +1,13 @@ package emu.grasscutter.server.packet.send; -import emu.grasscutter.game.avatar.GenshinAvatar; -import emu.grasscutter.net.packet.GenshinPacket; +import emu.grasscutter.game.avatar.Avatar; +import emu.grasscutter.net.packet.BasePacket; import emu.grasscutter.net.packet.PacketOpcodes; import emu.grasscutter.net.proto.ProudSkillExtraLevelNotifyOuterClass.ProudSkillExtraLevelNotify; -public class PacketProudSkillExtraLevelNotify extends GenshinPacket { +public class PacketProudSkillExtraLevelNotify extends BasePacket { - public PacketProudSkillExtraLevelNotify(GenshinAvatar avatar, int talentIndex) { + public PacketProudSkillExtraLevelNotify(Avatar avatar, int talentIndex) { super(PacketOpcodes.ProudSkillExtraLevelNotify); ProudSkillExtraLevelNotify proto = ProudSkillExtraLevelNotify.newBuilder() diff --git a/src/main/java/emu/grasscutter/server/packet/send/PacketPullPrivateChatRsp.java b/src/main/java/emu/grasscutter/server/packet/send/PacketPullPrivateChatRsp.java index 6d5e829c3..094a1e9c1 100644 --- a/src/main/java/emu/grasscutter/server/packet/send/PacketPullPrivateChatRsp.java +++ b/src/main/java/emu/grasscutter/server/packet/send/PacketPullPrivateChatRsp.java @@ -1,10 +1,10 @@ package emu.grasscutter.server.packet.send; -import emu.grasscutter.net.packet.GenshinPacket; +import emu.grasscutter.net.packet.BasePacket; import emu.grasscutter.net.packet.PacketOpcodes; import emu.grasscutter.net.proto.PullPrivateChatRspOuterClass.PullPrivateChatRsp; -public class PacketPullPrivateChatRsp extends GenshinPacket { +public class PacketPullPrivateChatRsp extends BasePacket { public PacketPullPrivateChatRsp() { super(PacketOpcodes.PullPrivateChatRsp); diff --git a/src/main/java/emu/grasscutter/server/packet/send/PacketPullRecentChatRsp.java b/src/main/java/emu/grasscutter/server/packet/send/PacketPullRecentChatRsp.java index 5af6999d5..871534b53 100644 --- a/src/main/java/emu/grasscutter/server/packet/send/PacketPullRecentChatRsp.java +++ b/src/main/java/emu/grasscutter/server/packet/send/PacketPullRecentChatRsp.java @@ -1,17 +1,17 @@ package emu.grasscutter.server.packet.send; import emu.grasscutter.Config.GameServerOptions; -import emu.grasscutter.GenshinConstants; +import emu.grasscutter.game.player.Player; +import emu.grasscutter.GameConstants; import emu.grasscutter.Grasscutter; -import emu.grasscutter.game.GenshinPlayer; -import emu.grasscutter.net.packet.GenshinPacket; +import emu.grasscutter.net.packet.BasePacket; import emu.grasscutter.net.packet.PacketOpcodes; import emu.grasscutter.net.proto.ChatInfoOuterClass.ChatInfo; import emu.grasscutter.net.proto.PullRecentChatRspOuterClass.PullRecentChatRsp; import emu.grasscutter.utils.Utils; -public class PacketPullRecentChatRsp extends GenshinPacket { - public PacketPullRecentChatRsp(GenshinPlayer player) { +public class PacketPullRecentChatRsp extends BasePacket { + public PacketPullRecentChatRsp(Player player) { super(PacketOpcodes.PullRecentChatRsp); GameServerOptions serverOptions = Grasscutter.getConfig().getGameServerOptions(); @@ -20,7 +20,7 @@ public class PacketPullRecentChatRsp extends GenshinPacket { if (serverOptions.WelcomeEmotes != null && serverOptions.WelcomeEmotes.length > 0) { ChatInfo welcomeEmote = ChatInfo.newBuilder() .setTime((int) (System.currentTimeMillis() / 1000)) - .setUid(GenshinConstants.SERVER_CONSOLE_UID) + .setUid(GameConstants.SERVER_CONSOLE_UID) .setToUid(player.getUid()) .setIcon(serverOptions.WelcomeEmotes[Utils.randomRange(0, serverOptions.WelcomeEmotes.length - 1)]) .build(); @@ -31,7 +31,7 @@ public class PacketPullRecentChatRsp extends GenshinPacket { if (serverOptions.WelcomeMotd != null && serverOptions.WelcomeMotd.length() > 0) { ChatInfo welcomeMotd = ChatInfo.newBuilder() .setTime((int) (System.currentTimeMillis() / 1000)) - .setUid(GenshinConstants.SERVER_CONSOLE_UID) + .setUid(GameConstants.SERVER_CONSOLE_UID) .setToUid(player.getUid()) .setText(Grasscutter.getConfig().getGameServerOptions().WelcomeMotd) .build(); diff --git a/src/main/java/emu/grasscutter/server/packet/send/PacketReliquaryUpgradeRsp.java b/src/main/java/emu/grasscutter/server/packet/send/PacketReliquaryUpgradeRsp.java index 34c9c3d85..14bd76fa6 100644 --- a/src/main/java/emu/grasscutter/server/packet/send/PacketReliquaryUpgradeRsp.java +++ b/src/main/java/emu/grasscutter/server/packet/send/PacketReliquaryUpgradeRsp.java @@ -2,14 +2,14 @@ package emu.grasscutter.server.packet.send; import java.util.List; -import emu.grasscutter.game.inventory.GenshinItem; -import emu.grasscutter.net.packet.GenshinPacket; +import emu.grasscutter.game.inventory.GameItem; +import emu.grasscutter.net.packet.BasePacket; import emu.grasscutter.net.packet.PacketOpcodes; import emu.grasscutter.net.proto.ReliquaryUpgradeRspOuterClass.ReliquaryUpgradeRsp; -public class PacketReliquaryUpgradeRsp extends GenshinPacket { +public class PacketReliquaryUpgradeRsp extends BasePacket { - public PacketReliquaryUpgradeRsp(GenshinItem relic, int rate, int oldLevel, List<Integer> oldAppendPropIdList) { + public PacketReliquaryUpgradeRsp(GameItem relic, int rate, int oldLevel, List<Integer> oldAppendPropIdList) { super(PacketOpcodes.ReliquaryUpgradeRsp); ReliquaryUpgradeRsp proto = ReliquaryUpgradeRsp.newBuilder() diff --git a/src/main/java/emu/grasscutter/server/packet/send/PacketSceneAreaWeatherNotify.java b/src/main/java/emu/grasscutter/server/packet/send/PacketSceneAreaWeatherNotify.java index 69c40dba0..91112871d 100644 --- a/src/main/java/emu/grasscutter/server/packet/send/PacketSceneAreaWeatherNotify.java +++ b/src/main/java/emu/grasscutter/server/packet/send/PacketSceneAreaWeatherNotify.java @@ -1,14 +1,14 @@ package emu.grasscutter.server.packet.send; -import emu.grasscutter.game.GenshinPlayer; -import emu.grasscutter.game.World; -import emu.grasscutter.net.packet.GenshinPacket; +import emu.grasscutter.game.player.Player; +import emu.grasscutter.game.world.World; +import emu.grasscutter.net.packet.BasePacket; import emu.grasscutter.net.packet.PacketOpcodes; import emu.grasscutter.net.proto.SceneAreaWeatherNotifyOuterClass.SceneAreaWeatherNotify; -public class PacketSceneAreaWeatherNotify extends GenshinPacket { +public class PacketSceneAreaWeatherNotify extends BasePacket { - public PacketSceneAreaWeatherNotify(GenshinPlayer player) { + public PacketSceneAreaWeatherNotify(Player player) { super(PacketOpcodes.SceneAreaWeatherNotify); SceneAreaWeatherNotify proto = SceneAreaWeatherNotify.newBuilder() diff --git a/src/main/java/emu/grasscutter/server/packet/send/PacketSceneEntityAppearNotify.java b/src/main/java/emu/grasscutter/server/packet/send/PacketSceneEntityAppearNotify.java index 10cac2453..78c17a5d5 100644 --- a/src/main/java/emu/grasscutter/server/packet/send/PacketSceneEntityAppearNotify.java +++ b/src/main/java/emu/grasscutter/server/packet/send/PacketSceneEntityAppearNotify.java @@ -2,16 +2,16 @@ package emu.grasscutter.server.packet.send; import java.util.Collection; -import emu.grasscutter.game.GenshinPlayer; -import emu.grasscutter.game.entity.GenshinEntity; -import emu.grasscutter.net.packet.GenshinPacket; +import emu.grasscutter.game.entity.GameEntity; +import emu.grasscutter.game.player.Player; +import emu.grasscutter.net.packet.BasePacket; import emu.grasscutter.net.packet.PacketOpcodes; import emu.grasscutter.net.proto.SceneEntityAppearNotifyOuterClass.SceneEntityAppearNotify; import emu.grasscutter.net.proto.VisionTypeOuterClass.VisionType; -public class PacketSceneEntityAppearNotify extends GenshinPacket { +public class PacketSceneEntityAppearNotify extends BasePacket { - public PacketSceneEntityAppearNotify(GenshinEntity entity) { + public PacketSceneEntityAppearNotify(GameEntity entity) { super(PacketOpcodes.SceneEntityAppearNotify, true); SceneEntityAppearNotify.Builder proto = SceneEntityAppearNotify.newBuilder() @@ -21,7 +21,7 @@ public class PacketSceneEntityAppearNotify extends GenshinPacket { this.setData(proto.build()); } - public PacketSceneEntityAppearNotify(GenshinEntity entity, VisionType vision, int param) { + public PacketSceneEntityAppearNotify(GameEntity entity, VisionType vision, int param) { super(PacketOpcodes.SceneEntityAppearNotify, true); SceneEntityAppearNotify.Builder proto = SceneEntityAppearNotify.newBuilder() @@ -32,11 +32,11 @@ public class PacketSceneEntityAppearNotify extends GenshinPacket { this.setData(proto.build()); } - public PacketSceneEntityAppearNotify(GenshinPlayer player) { + public PacketSceneEntityAppearNotify(Player player) { this(player.getTeamManager().getCurrentAvatarEntity()); } - public PacketSceneEntityAppearNotify(Collection<GenshinEntity> entities, VisionType visionType) { + public PacketSceneEntityAppearNotify(Collection<GameEntity> entities, VisionType visionType) { super(PacketOpcodes.SceneEntityAppearNotify, true); SceneEntityAppearNotify.Builder proto = SceneEntityAppearNotify.newBuilder() diff --git a/src/main/java/emu/grasscutter/server/packet/send/PacketSceneEntityDisappearNotify.java b/src/main/java/emu/grasscutter/server/packet/send/PacketSceneEntityDisappearNotify.java index 65dd8066b..49b334666 100644 --- a/src/main/java/emu/grasscutter/server/packet/send/PacketSceneEntityDisappearNotify.java +++ b/src/main/java/emu/grasscutter/server/packet/send/PacketSceneEntityDisappearNotify.java @@ -3,15 +3,15 @@ package emu.grasscutter.server.packet.send; import java.util.Collection; import java.util.List; -import emu.grasscutter.game.entity.GenshinEntity; -import emu.grasscutter.net.packet.GenshinPacket; +import emu.grasscutter.game.entity.GameEntity; +import emu.grasscutter.net.packet.BasePacket; import emu.grasscutter.net.packet.PacketOpcodes; import emu.grasscutter.net.proto.SceneEntityDisappearNotifyOuterClass.SceneEntityDisappearNotify; import emu.grasscutter.net.proto.VisionTypeOuterClass.VisionType; -public class PacketSceneEntityDisappearNotify extends GenshinPacket { +public class PacketSceneEntityDisappearNotify extends BasePacket { - public PacketSceneEntityDisappearNotify(GenshinEntity entity, VisionType disappearType) { + public PacketSceneEntityDisappearNotify(GameEntity entity, VisionType disappearType) { super(PacketOpcodes.SceneEntityDisappearNotify); SceneEntityDisappearNotify proto = SceneEntityDisappearNotify.newBuilder() @@ -22,7 +22,7 @@ public class PacketSceneEntityDisappearNotify extends GenshinPacket { this.setData(proto); } - public PacketSceneEntityDisappearNotify(Collection<GenshinEntity> entities, VisionType disappearType) { + public PacketSceneEntityDisappearNotify(Collection<GameEntity> entities, VisionType disappearType) { super(PacketOpcodes.SceneEntityDisappearNotify); SceneEntityDisappearNotify.Builder proto = SceneEntityDisappearNotify.newBuilder() diff --git a/src/main/java/emu/grasscutter/server/packet/send/PacketSceneEntityDrownRsp.java b/src/main/java/emu/grasscutter/server/packet/send/PacketSceneEntityDrownRsp.java index e69de29bb..20b1f4963 100644 --- a/src/main/java/emu/grasscutter/server/packet/send/PacketSceneEntityDrownRsp.java +++ b/src/main/java/emu/grasscutter/server/packet/send/PacketSceneEntityDrownRsp.java @@ -0,0 +1,18 @@ +package emu.grasscutter.server.packet.send; + +import emu.grasscutter.net.packet.BasePacket; +import emu.grasscutter.net.packet.PacketOpcodes; +import emu.grasscutter.net.proto.SceneEntityDrownRspOuterClass.SceneEntityDrownRsp; + +public class PacketSceneEntityDrownRsp extends BasePacket { + + public PacketSceneEntityDrownRsp(int entityId) { + super(PacketOpcodes.SceneEntityDrownRsp); + + SceneEntityDrownRsp proto = SceneEntityDrownRsp.newBuilder().setEntityId(entityId).build(); + + this.setData(proto); + } +} + + diff --git a/src/main/java/emu/grasscutter/server/packet/send/PacketSceneEntityMoveNotify.java b/src/main/java/emu/grasscutter/server/packet/send/PacketSceneEntityMoveNotify.java index c3230f4d4..8a64585dd 100644 --- a/src/main/java/emu/grasscutter/server/packet/send/PacketSceneEntityMoveNotify.java +++ b/src/main/java/emu/grasscutter/server/packet/send/PacketSceneEntityMoveNotify.java @@ -1,11 +1,11 @@ package emu.grasscutter.server.packet.send; -import emu.grasscutter.net.packet.GenshinPacket; +import emu.grasscutter.net.packet.BasePacket; import emu.grasscutter.net.packet.PacketOpcodes; import emu.grasscutter.net.proto.EntityMoveInfoOuterClass.EntityMoveInfo; import emu.grasscutter.net.proto.SceneEntityMoveNotifyOuterClass.SceneEntityMoveNotify; -public class PacketSceneEntityMoveNotify extends GenshinPacket { +public class PacketSceneEntityMoveNotify extends BasePacket { public PacketSceneEntityMoveNotify(EntityMoveInfo moveInfo) { super(PacketOpcodes.SceneEntityMoveNotify, true); diff --git a/src/main/java/emu/grasscutter/server/packet/send/PacketSceneInitFinishRsp.java b/src/main/java/emu/grasscutter/server/packet/send/PacketSceneInitFinishRsp.java index 78661f014..e2751a2c9 100644 --- a/src/main/java/emu/grasscutter/server/packet/send/PacketSceneInitFinishRsp.java +++ b/src/main/java/emu/grasscutter/server/packet/send/PacketSceneInitFinishRsp.java @@ -1,13 +1,13 @@ package emu.grasscutter.server.packet.send; -import emu.grasscutter.game.GenshinPlayer; -import emu.grasscutter.net.packet.GenshinPacket; +import emu.grasscutter.game.player.Player; +import emu.grasscutter.net.packet.BasePacket; import emu.grasscutter.net.packet.PacketOpcodes; import emu.grasscutter.net.proto.SceneInitFinishRspOuterClass.SceneInitFinishRsp; -public class PacketSceneInitFinishRsp extends GenshinPacket { +public class PacketSceneInitFinishRsp extends BasePacket { - public PacketSceneInitFinishRsp(GenshinPlayer player) { + public PacketSceneInitFinishRsp(Player player) { super(PacketOpcodes.SceneInitFinishRsp, 11); SceneInitFinishRsp p = SceneInitFinishRsp.newBuilder().setEnterSceneToken(player.getEnterSceneToken()).build(); diff --git a/src/main/java/emu/grasscutter/server/packet/send/PacketSceneKickPlayerRsp.java b/src/main/java/emu/grasscutter/server/packet/send/PacketSceneKickPlayerRsp.java index edc73d5e7..7b15b54d0 100644 --- a/src/main/java/emu/grasscutter/server/packet/send/PacketSceneKickPlayerRsp.java +++ b/src/main/java/emu/grasscutter/server/packet/send/PacketSceneKickPlayerRsp.java @@ -1,11 +1,11 @@ package emu.grasscutter.server.packet.send; -import emu.grasscutter.net.packet.GenshinPacket; +import emu.grasscutter.net.packet.BasePacket; import emu.grasscutter.net.packet.PacketOpcodes; import emu.grasscutter.net.proto.RetcodeOuterClass; import emu.grasscutter.net.proto.SceneKickPlayerRspOuterClass.SceneKickPlayerRsp; -public class PacketSceneKickPlayerRsp extends GenshinPacket { +public class PacketSceneKickPlayerRsp extends BasePacket { public PacketSceneKickPlayerRsp(int targetUid) { super(PacketOpcodes.SceneKickPlayerRsp); diff --git a/src/main/java/emu/grasscutter/server/packet/send/PacketScenePlayerInfoNotify.java b/src/main/java/emu/grasscutter/server/packet/send/PacketScenePlayerInfoNotify.java index 0fa20784e..469a26cff 100644 --- a/src/main/java/emu/grasscutter/server/packet/send/PacketScenePlayerInfoNotify.java +++ b/src/main/java/emu/grasscutter/server/packet/send/PacketScenePlayerInfoNotify.java @@ -1,13 +1,13 @@ package emu.grasscutter.server.packet.send; -import emu.grasscutter.game.GenshinPlayer; -import emu.grasscutter.game.World; -import emu.grasscutter.net.packet.GenshinPacket; +import emu.grasscutter.game.player.Player; +import emu.grasscutter.game.world.World; +import emu.grasscutter.net.packet.BasePacket; import emu.grasscutter.net.packet.PacketOpcodes; import emu.grasscutter.net.proto.ScenePlayerInfoNotifyOuterClass.ScenePlayerInfoNotify; import emu.grasscutter.net.proto.ScenePlayerInfoOuterClass.ScenePlayerInfo; -public class PacketScenePlayerInfoNotify extends GenshinPacket { +public class PacketScenePlayerInfoNotify extends BasePacket { public PacketScenePlayerInfoNotify(World world) { super(PacketOpcodes.ScenePlayerInfoNotify); @@ -15,7 +15,7 @@ public class PacketScenePlayerInfoNotify extends GenshinPacket { ScenePlayerInfoNotify.Builder proto = ScenePlayerInfoNotify.newBuilder(); for (int i = 0; i < world.getPlayers().size(); i++) { - GenshinPlayer p = world.getPlayers().get(i); + Player p = world.getPlayers().get(i); ScenePlayerInfo pInfo = ScenePlayerInfo.newBuilder() .setUid(p.getUid()) diff --git a/src/main/java/emu/grasscutter/server/packet/send/PacketScenePlayerLocationNotify.java b/src/main/java/emu/grasscutter/server/packet/send/PacketScenePlayerLocationNotify.java index 2e9fb479d..427e94573 100644 --- a/src/main/java/emu/grasscutter/server/packet/send/PacketScenePlayerLocationNotify.java +++ b/src/main/java/emu/grasscutter/server/packet/send/PacketScenePlayerLocationNotify.java @@ -1,20 +1,20 @@ package emu.grasscutter.server.packet.send; -import emu.grasscutter.game.GenshinPlayer; -import emu.grasscutter.game.GenshinScene; -import emu.grasscutter.net.packet.GenshinPacket; +import emu.grasscutter.game.player.Player; +import emu.grasscutter.game.world.Scene; +import emu.grasscutter.net.packet.BasePacket; import emu.grasscutter.net.packet.PacketOpcodes; import emu.grasscutter.net.proto.ScenePlayerLocationNotifyOuterClass.ScenePlayerLocationNotify; -public class PacketScenePlayerLocationNotify extends GenshinPacket { +public class PacketScenePlayerLocationNotify extends BasePacket { - public PacketScenePlayerLocationNotify(GenshinScene scene) { + public PacketScenePlayerLocationNotify(Scene scene) { super(PacketOpcodes.ScenePlayerLocationNotify); ScenePlayerLocationNotify.Builder proto = ScenePlayerLocationNotify.newBuilder() .setSceneId(scene.getId()); - for (GenshinPlayer p : scene.getPlayers()) { + for (Player p : scene.getPlayers()) { proto.addPlayerLocList(p.getPlayerLocationInfo()); } diff --git a/src/main/java/emu/grasscutter/server/packet/send/PacketSceneTeamUpdateNotify.java b/src/main/java/emu/grasscutter/server/packet/send/PacketSceneTeamUpdateNotify.java index ddfc4e154..ec3fea082 100644 --- a/src/main/java/emu/grasscutter/server/packet/send/PacketSceneTeamUpdateNotify.java +++ b/src/main/java/emu/grasscutter/server/packet/send/PacketSceneTeamUpdateNotify.java @@ -1,22 +1,22 @@ package emu.grasscutter.server.packet.send; -import emu.grasscutter.game.GenshinPlayer; import emu.grasscutter.game.entity.EntityAvatar; -import emu.grasscutter.net.packet.GenshinPacket; +import emu.grasscutter.game.player.Player; +import emu.grasscutter.net.packet.BasePacket; import emu.grasscutter.net.packet.PacketOpcodes; import emu.grasscutter.net.proto.AbilitySyncStateInfoOuterClass.AbilitySyncStateInfo; import emu.grasscutter.net.proto.SceneTeamAvatarOuterClass.SceneTeamAvatar; import emu.grasscutter.net.proto.SceneTeamUpdateNotifyOuterClass.SceneTeamUpdateNotify; -public class PacketSceneTeamUpdateNotify extends GenshinPacket { +public class PacketSceneTeamUpdateNotify extends BasePacket { - public PacketSceneTeamUpdateNotify(GenshinPlayer player) { + public PacketSceneTeamUpdateNotify(Player player) { super(PacketOpcodes.SceneTeamUpdateNotify); SceneTeamUpdateNotify.Builder proto = SceneTeamUpdateNotify.newBuilder() .setIsInMp(player.getWorld().isMultiplayer()); - for (GenshinPlayer p : player.getWorld().getPlayers()) { + for (Player p : player.getWorld().getPlayers()) { for (EntityAvatar entityAvatar : p.getTeamManager().getActiveTeam()) { SceneTeamAvatar.Builder avatarProto = SceneTeamAvatar.newBuilder() .setPlayerUid(p.getUid()) diff --git a/src/main/java/emu/grasscutter/server/packet/send/PacketSceneTimeNotify.java b/src/main/java/emu/grasscutter/server/packet/send/PacketSceneTimeNotify.java index 5af88cf26..874efcc4b 100644 --- a/src/main/java/emu/grasscutter/server/packet/send/PacketSceneTimeNotify.java +++ b/src/main/java/emu/grasscutter/server/packet/send/PacketSceneTimeNotify.java @@ -1,13 +1,13 @@ package emu.grasscutter.server.packet.send; -import emu.grasscutter.game.GenshinPlayer; -import emu.grasscutter.net.packet.GenshinPacket; +import emu.grasscutter.game.player.Player; +import emu.grasscutter.net.packet.BasePacket; import emu.grasscutter.net.packet.PacketOpcodes; import emu.grasscutter.net.proto.SceneTimeNotifyOuterClass.SceneTimeNotify; -public class PacketSceneTimeNotify extends GenshinPacket { +public class PacketSceneTimeNotify extends BasePacket { - public PacketSceneTimeNotify(GenshinPlayer player) { + public PacketSceneTimeNotify(Player player) { super(PacketOpcodes.SceneTimeNotify); SceneTimeNotify proto = SceneTimeNotify.newBuilder() diff --git a/src/main/java/emu/grasscutter/server/packet/send/PacketSceneTransToPointRsp.java b/src/main/java/emu/grasscutter/server/packet/send/PacketSceneTransToPointRsp.java index 7aea3e333..b421dfe40 100644 --- a/src/main/java/emu/grasscutter/server/packet/send/PacketSceneTransToPointRsp.java +++ b/src/main/java/emu/grasscutter/server/packet/send/PacketSceneTransToPointRsp.java @@ -1,17 +1,17 @@ package emu.grasscutter.server.packet.send; -import emu.grasscutter.data.GenshinData; +import emu.grasscutter.data.GameData; import emu.grasscutter.data.custom.ScenePointEntry; -import emu.grasscutter.game.GenshinPlayer; -import emu.grasscutter.net.packet.GenshinPacket; +import emu.grasscutter.game.player.Player; +import emu.grasscutter.net.packet.BasePacket; import emu.grasscutter.net.packet.PacketOpcodes; import emu.grasscutter.net.proto.RetcodeOuterClass; import emu.grasscutter.net.proto.SceneTransToPointRspOuterClass.SceneTransToPointRsp; import emu.grasscutter.utils.Position; -public class PacketSceneTransToPointRsp extends GenshinPacket { +public class PacketSceneTransToPointRsp extends BasePacket { - public PacketSceneTransToPointRsp(GenshinPlayer player, int pointId, int sceneId) { + public PacketSceneTransToPointRsp(Player player, int pointId, int sceneId) { super(PacketOpcodes.SceneTransToPointRsp); SceneTransToPointRsp proto = SceneTransToPointRsp.newBuilder() diff --git a/src/main/java/emu/grasscutter/server/packet/send/PacketSceneUnlockInfoNotify.java b/src/main/java/emu/grasscutter/server/packet/send/PacketSceneUnlockInfoNotify.java index bd1b30685..223efc776 100644 --- a/src/main/java/emu/grasscutter/server/packet/send/PacketSceneUnlockInfoNotify.java +++ b/src/main/java/emu/grasscutter/server/packet/send/PacketSceneUnlockInfoNotify.java @@ -1,11 +1,11 @@ package emu.grasscutter.server.packet.send; -import emu.grasscutter.net.packet.GenshinPacket; +import emu.grasscutter.net.packet.BasePacket; import emu.grasscutter.net.packet.PacketOpcodes; import emu.grasscutter.net.proto.SceneUnlockInfoNotifyOuterClass.SceneUnlockInfoNotify; import emu.grasscutter.net.proto.SceneUnlockInfoOuterClass.SceneUnlockInfo; -public class PacketSceneUnlockInfoNotify extends GenshinPacket { +public class PacketSceneUnlockInfoNotify extends BasePacket { public PacketSceneUnlockInfoNotify() { super(PacketOpcodes.SceneUnlockInfoNotify); // Rename opcode later diff --git a/src/main/java/emu/grasscutter/server/packet/send/PacketServerTimeNotify.java b/src/main/java/emu/grasscutter/server/packet/send/PacketServerTimeNotify.java index a58b634f1..7086873e4 100644 --- a/src/main/java/emu/grasscutter/server/packet/send/PacketServerTimeNotify.java +++ b/src/main/java/emu/grasscutter/server/packet/send/PacketServerTimeNotify.java @@ -1,10 +1,10 @@ package emu.grasscutter.server.packet.send; -import emu.grasscutter.net.packet.GenshinPacket; +import emu.grasscutter.net.packet.BasePacket; import emu.grasscutter.net.packet.PacketOpcodes; import emu.grasscutter.net.proto.ServerTimeNotifyOuterClass.ServerTimeNotify; -public class PacketServerTimeNotify extends GenshinPacket { +public class PacketServerTimeNotify extends BasePacket { public PacketServerTimeNotify() { super(PacketOpcodes.ServerTimeNotify); diff --git a/src/main/java/emu/grasscutter/server/packet/send/PacketSetEquipLockStateRsp.java b/src/main/java/emu/grasscutter/server/packet/send/PacketSetEquipLockStateRsp.java index 7614c449d..612cd9d07 100644 --- a/src/main/java/emu/grasscutter/server/packet/send/PacketSetEquipLockStateRsp.java +++ b/src/main/java/emu/grasscutter/server/packet/send/PacketSetEquipLockStateRsp.java @@ -1,13 +1,13 @@ package emu.grasscutter.server.packet.send; -import emu.grasscutter.game.inventory.GenshinItem; -import emu.grasscutter.net.packet.GenshinPacket; +import emu.grasscutter.game.inventory.GameItem; +import emu.grasscutter.net.packet.BasePacket; import emu.grasscutter.net.packet.PacketOpcodes; import emu.grasscutter.net.proto.SetEquipLockStateRspOuterClass.SetEquipLockStateRsp; -public class PacketSetEquipLockStateRsp extends GenshinPacket { +public class PacketSetEquipLockStateRsp extends BasePacket { - public PacketSetEquipLockStateRsp(GenshinItem equip) { + public PacketSetEquipLockStateRsp(GameItem equip) { super(PacketOpcodes.SetEquipLockStateRsp); this.buildHeader(0); diff --git a/src/main/java/emu/grasscutter/server/packet/send/PacketSetNameCardRsp.java b/src/main/java/emu/grasscutter/server/packet/send/PacketSetNameCardRsp.java index b3c77c33f..efc50f023 100644 --- a/src/main/java/emu/grasscutter/server/packet/send/PacketSetNameCardRsp.java +++ b/src/main/java/emu/grasscutter/server/packet/send/PacketSetNameCardRsp.java @@ -1,10 +1,10 @@ package emu.grasscutter.server.packet.send; -import emu.grasscutter.net.packet.GenshinPacket; +import emu.grasscutter.net.packet.BasePacket; import emu.grasscutter.net.packet.PacketOpcodes; import emu.grasscutter.net.proto.SetNameCardRspOuterClass.SetNameCardRsp; -public class PacketSetNameCardRsp extends GenshinPacket { +public class PacketSetNameCardRsp extends BasePacket { public PacketSetNameCardRsp(int nameCardId) { super(PacketOpcodes.SetNameCardRsp); diff --git a/src/main/java/emu/grasscutter/server/packet/send/PacketSetPlayerBirthdayRsp.java b/src/main/java/emu/grasscutter/server/packet/send/PacketSetPlayerBirthdayRsp.java index a023ec761..6c875af56 100644 --- a/src/main/java/emu/grasscutter/server/packet/send/PacketSetPlayerBirthdayRsp.java +++ b/src/main/java/emu/grasscutter/server/packet/send/PacketSetPlayerBirthdayRsp.java @@ -1,12 +1,12 @@ package emu.grasscutter.server.packet.send; -import emu.grasscutter.game.GenshinPlayer; -import emu.grasscutter.net.packet.GenshinPacket; +import emu.grasscutter.game.player.Player; +import emu.grasscutter.net.packet.BasePacket; import emu.grasscutter.net.packet.PacketOpcodes; import emu.grasscutter.net.proto.SetPlayerBirthdayRspOuterClass.SetPlayerBirthdayRsp; import emu.grasscutter.net.proto.SetPlayerBornDataReqOuterClass; -public class PacketSetPlayerBirthdayRsp extends GenshinPacket { +public class PacketSetPlayerBirthdayRsp extends BasePacket { public PacketSetPlayerBirthdayRsp(int retCode) { super(PacketOpcodes.SetPlayerBirthdayRsp); @@ -18,7 +18,7 @@ public class PacketSetPlayerBirthdayRsp extends GenshinPacket { this.setData(proto); } - public PacketSetPlayerBirthdayRsp(GenshinPlayer player) { + public PacketSetPlayerBirthdayRsp(Player player) { super(PacketOpcodes.SetPlayerBirthdayRsp); SetPlayerBirthdayRsp proto = SetPlayerBirthdayRsp.newBuilder() diff --git a/src/main/java/emu/grasscutter/server/packet/send/PacketSetPlayerHeadImageRsp.java b/src/main/java/emu/grasscutter/server/packet/send/PacketSetPlayerHeadImageRsp.java index b3b17416c..9b736dc3e 100644 --- a/src/main/java/emu/grasscutter/server/packet/send/PacketSetPlayerHeadImageRsp.java +++ b/src/main/java/emu/grasscutter/server/packet/send/PacketSetPlayerHeadImageRsp.java @@ -1,14 +1,14 @@ package emu.grasscutter.server.packet.send; -import emu.grasscutter.game.GenshinPlayer; -import emu.grasscutter.net.packet.GenshinPacket; +import emu.grasscutter.game.player.Player; +import emu.grasscutter.net.packet.BasePacket; import emu.grasscutter.net.packet.PacketOpcodes; import emu.grasscutter.net.proto.HeadImageOuterClass.HeadImage; import emu.grasscutter.net.proto.SetPlayerHeadImageRspOuterClass.SetPlayerHeadImageRsp; -public class PacketSetPlayerHeadImageRsp extends GenshinPacket { +public class PacketSetPlayerHeadImageRsp extends BasePacket { - public PacketSetPlayerHeadImageRsp(GenshinPlayer player) { + public PacketSetPlayerHeadImageRsp(Player player) { super(PacketOpcodes.SetPlayerHeadImageRsp); SetPlayerHeadImageRsp proto = SetPlayerHeadImageRsp.newBuilder() diff --git a/src/main/java/emu/grasscutter/server/packet/send/PacketSetPlayerNameRsp.java b/src/main/java/emu/grasscutter/server/packet/send/PacketSetPlayerNameRsp.java index a40b5115f..935957f70 100644 --- a/src/main/java/emu/grasscutter/server/packet/send/PacketSetPlayerNameRsp.java +++ b/src/main/java/emu/grasscutter/server/packet/send/PacketSetPlayerNameRsp.java @@ -1,13 +1,13 @@ package emu.grasscutter.server.packet.send; -import emu.grasscutter.game.GenshinPlayer; -import emu.grasscutter.net.packet.GenshinPacket; +import emu.grasscutter.game.player.Player; +import emu.grasscutter.net.packet.BasePacket; import emu.grasscutter.net.packet.PacketOpcodes; import emu.grasscutter.net.proto.SetPlayerNameRspOuterClass.SetPlayerNameRsp; -public class PacketSetPlayerNameRsp extends GenshinPacket { +public class PacketSetPlayerNameRsp extends BasePacket { - public PacketSetPlayerNameRsp(GenshinPlayer player) { + public PacketSetPlayerNameRsp(Player player) { super(PacketOpcodes.SetPlayerNameRsp); SetPlayerNameRsp proto = SetPlayerNameRsp.newBuilder() diff --git a/src/main/java/emu/grasscutter/server/packet/send/PacketSetPlayerSignatureRsp.java b/src/main/java/emu/grasscutter/server/packet/send/PacketSetPlayerSignatureRsp.java index 98ee97b68..9a4361b83 100644 --- a/src/main/java/emu/grasscutter/server/packet/send/PacketSetPlayerSignatureRsp.java +++ b/src/main/java/emu/grasscutter/server/packet/send/PacketSetPlayerSignatureRsp.java @@ -1,13 +1,13 @@ package emu.grasscutter.server.packet.send; -import emu.grasscutter.game.GenshinPlayer; -import emu.grasscutter.net.packet.GenshinPacket; +import emu.grasscutter.game.player.Player; +import emu.grasscutter.net.packet.BasePacket; import emu.grasscutter.net.packet.PacketOpcodes; import emu.grasscutter.net.proto.SetPlayerSignatureRspOuterClass.SetPlayerSignatureRsp; -public class PacketSetPlayerSignatureRsp extends GenshinPacket { +public class PacketSetPlayerSignatureRsp extends BasePacket { - public PacketSetPlayerSignatureRsp(GenshinPlayer player) { + public PacketSetPlayerSignatureRsp(Player player) { super(PacketOpcodes.SetPlayerSignatureRsp); SetPlayerSignatureRsp proto = SetPlayerSignatureRsp.newBuilder() diff --git a/src/main/java/emu/grasscutter/server/packet/send/PacketSetUpAvatarTeamRsp.java b/src/main/java/emu/grasscutter/server/packet/send/PacketSetUpAvatarTeamRsp.java index 55e530196..66d484248 100644 --- a/src/main/java/emu/grasscutter/server/packet/send/PacketSetUpAvatarTeamRsp.java +++ b/src/main/java/emu/grasscutter/server/packet/send/PacketSetUpAvatarTeamRsp.java @@ -1,14 +1,14 @@ package emu.grasscutter.server.packet.send; -import emu.grasscutter.game.GenshinPlayer; -import emu.grasscutter.game.TeamInfo; -import emu.grasscutter.net.packet.GenshinPacket; +import emu.grasscutter.game.player.Player; +import emu.grasscutter.game.player.TeamInfo; +import emu.grasscutter.net.packet.BasePacket; import emu.grasscutter.net.packet.PacketOpcodes; import emu.grasscutter.net.proto.SetUpAvatarTeamRspOuterClass.SetUpAvatarTeamRsp; -public class PacketSetUpAvatarTeamRsp extends GenshinPacket { +public class PacketSetUpAvatarTeamRsp extends BasePacket { - public PacketSetUpAvatarTeamRsp(GenshinPlayer player, int teamId, TeamInfo teamInfo) { + public PacketSetUpAvatarTeamRsp(Player player, int teamId, TeamInfo teamInfo) { super(PacketOpcodes.SetUpAvatarTeamRsp); SetUpAvatarTeamRsp.Builder proto = SetUpAvatarTeamRsp.newBuilder() diff --git a/src/main/java/emu/grasscutter/server/packet/send/PacketStoreItemChangeNotify.java b/src/main/java/emu/grasscutter/server/packet/send/PacketStoreItemChangeNotify.java index 20082582e..4d951c0d6 100644 --- a/src/main/java/emu/grasscutter/server/packet/send/PacketStoreItemChangeNotify.java +++ b/src/main/java/emu/grasscutter/server/packet/send/PacketStoreItemChangeNotify.java @@ -2,19 +2,19 @@ package emu.grasscutter.server.packet.send; import java.util.Collection; -import emu.grasscutter.game.inventory.GenshinItem; -import emu.grasscutter.net.packet.GenshinPacket; +import emu.grasscutter.game.inventory.GameItem; +import emu.grasscutter.net.packet.BasePacket; import emu.grasscutter.net.packet.PacketOpcodes; import emu.grasscutter.net.proto.StoreItemChangeNotifyOuterClass.StoreItemChangeNotify; import emu.grasscutter.net.proto.StoreTypeOuterClass.StoreType; -public class PacketStoreItemChangeNotify extends GenshinPacket { +public class PacketStoreItemChangeNotify extends BasePacket { private PacketStoreItemChangeNotify() { super(PacketOpcodes.StoreItemChangeNotify); } - public PacketStoreItemChangeNotify(GenshinItem item) { + public PacketStoreItemChangeNotify(GameItem item) { this(); StoreItemChangeNotify.Builder proto = StoreItemChangeNotify.newBuilder() @@ -24,7 +24,7 @@ public class PacketStoreItemChangeNotify extends GenshinPacket { this.setData(proto); } - public PacketStoreItemChangeNotify(Collection<GenshinItem> items) { + public PacketStoreItemChangeNotify(Collection<GameItem> items) { this(); StoreItemChangeNotify.Builder proto = StoreItemChangeNotify.newBuilder() diff --git a/src/main/java/emu/grasscutter/server/packet/send/PacketStoreItemDelNotify.java b/src/main/java/emu/grasscutter/server/packet/send/PacketStoreItemDelNotify.java index 6bf377a44..197d4a32a 100644 --- a/src/main/java/emu/grasscutter/server/packet/send/PacketStoreItemDelNotify.java +++ b/src/main/java/emu/grasscutter/server/packet/send/PacketStoreItemDelNotify.java @@ -2,19 +2,19 @@ package emu.grasscutter.server.packet.send; import java.util.Collection; -import emu.grasscutter.game.inventory.GenshinItem; -import emu.grasscutter.net.packet.GenshinPacket; +import emu.grasscutter.game.inventory.GameItem; +import emu.grasscutter.net.packet.BasePacket; import emu.grasscutter.net.packet.PacketOpcodes; import emu.grasscutter.net.proto.StoreItemDelNotifyOuterClass.StoreItemDelNotify; import emu.grasscutter.net.proto.StoreTypeOuterClass.StoreType; -public class PacketStoreItemDelNotify extends GenshinPacket { +public class PacketStoreItemDelNotify extends BasePacket { private PacketStoreItemDelNotify() { super(PacketOpcodes.StoreItemDelNotify); } - public PacketStoreItemDelNotify(GenshinItem item) { + public PacketStoreItemDelNotify(GameItem item) { this(); StoreItemDelNotify.Builder proto = StoreItemDelNotify.newBuilder() @@ -24,7 +24,7 @@ public class PacketStoreItemDelNotify extends GenshinPacket { this.setData(proto); } - public PacketStoreItemDelNotify(Collection<GenshinItem> items) { + public PacketStoreItemDelNotify(Collection<GameItem> items) { this(); StoreItemDelNotify.Builder proto = StoreItemDelNotify.newBuilder() diff --git a/src/main/java/emu/grasscutter/server/packet/send/PacketStoreWeightLimitNotify.java b/src/main/java/emu/grasscutter/server/packet/send/PacketStoreWeightLimitNotify.java index 590efd800..61b51948b 100644 --- a/src/main/java/emu/grasscutter/server/packet/send/PacketStoreWeightLimitNotify.java +++ b/src/main/java/emu/grasscutter/server/packet/send/PacketStoreWeightLimitNotify.java @@ -1,12 +1,12 @@ package emu.grasscutter.server.packet.send; import emu.grasscutter.Grasscutter; -import emu.grasscutter.net.packet.GenshinPacket; +import emu.grasscutter.net.packet.BasePacket; import emu.grasscutter.net.packet.PacketOpcodes; import emu.grasscutter.net.proto.StoreTypeOuterClass.StoreType; import emu.grasscutter.net.proto.StoreWeightLimitNotifyOuterClass.StoreWeightLimitNotify; -public class PacketStoreWeightLimitNotify extends GenshinPacket { +public class PacketStoreWeightLimitNotify extends BasePacket { public PacketStoreWeightLimitNotify() { super(PacketOpcodes.StoreWeightLimitNotify); diff --git a/src/main/java/emu/grasscutter/server/packet/send/PacketSyncScenePlayTeamEntityNotify.java b/src/main/java/emu/grasscutter/server/packet/send/PacketSyncScenePlayTeamEntityNotify.java index 2983adbcb..c50b7c0a8 100644 --- a/src/main/java/emu/grasscutter/server/packet/send/PacketSyncScenePlayTeamEntityNotify.java +++ b/src/main/java/emu/grasscutter/server/packet/send/PacketSyncScenePlayTeamEntityNotify.java @@ -1,13 +1,13 @@ package emu.grasscutter.server.packet.send; -import emu.grasscutter.game.GenshinPlayer; -import emu.grasscutter.net.packet.GenshinPacket; +import emu.grasscutter.game.player.Player; +import emu.grasscutter.net.packet.BasePacket; import emu.grasscutter.net.packet.PacketOpcodes; import emu.grasscutter.net.proto.SyncScenePlayTeamEntityNotifyOuterClass.SyncScenePlayTeamEntityNotify; -public class PacketSyncScenePlayTeamEntityNotify extends GenshinPacket { +public class PacketSyncScenePlayTeamEntityNotify extends BasePacket { - public PacketSyncScenePlayTeamEntityNotify(GenshinPlayer player) { + public PacketSyncScenePlayTeamEntityNotify(Player player) { super(PacketOpcodes.SyncScenePlayTeamEntityNotify); SyncScenePlayTeamEntityNotify proto = SyncScenePlayTeamEntityNotify.newBuilder() diff --git a/src/main/java/emu/grasscutter/server/packet/send/PacketSyncTeamEntityNotify.java b/src/main/java/emu/grasscutter/server/packet/send/PacketSyncTeamEntityNotify.java index 2c0bae908..ebb38df13 100644 --- a/src/main/java/emu/grasscutter/server/packet/send/PacketSyncTeamEntityNotify.java +++ b/src/main/java/emu/grasscutter/server/packet/send/PacketSyncTeamEntityNotify.java @@ -1,22 +1,22 @@ package emu.grasscutter.server.packet.send; -import emu.grasscutter.game.GenshinPlayer; -import emu.grasscutter.net.packet.GenshinPacket; +import emu.grasscutter.game.player.Player; +import emu.grasscutter.net.packet.BasePacket; import emu.grasscutter.net.packet.PacketOpcodes; import emu.grasscutter.net.proto.AbilitySyncStateInfoOuterClass.AbilitySyncStateInfo; import emu.grasscutter.net.proto.SyncTeamEntityNotifyOuterClass.SyncTeamEntityNotify; import emu.grasscutter.net.proto.TeamEntityInfoOuterClass.TeamEntityInfo; -public class PacketSyncTeamEntityNotify extends GenshinPacket { +public class PacketSyncTeamEntityNotify extends BasePacket { - public PacketSyncTeamEntityNotify(GenshinPlayer player) { + public PacketSyncTeamEntityNotify(Player player) { super(PacketOpcodes.SyncTeamEntityNotify); SyncTeamEntityNotify.Builder proto = SyncTeamEntityNotify.newBuilder() .setSceneId(player.getSceneId()); if (player.getWorld().isMultiplayer()) { - for (GenshinPlayer p : player.getWorld().getPlayers()) { + for (Player p : player.getWorld().getPlayers()) { // Skip if same player if (player == p) { continue; diff --git a/src/main/java/emu/grasscutter/server/packet/send/PacketTakePlayerLevelRewardRsp.java b/src/main/java/emu/grasscutter/server/packet/send/PacketTakePlayerLevelRewardRsp.java index 5a50d0806..c944a18d8 100644 --- a/src/main/java/emu/grasscutter/server/packet/send/PacketTakePlayerLevelRewardRsp.java +++ b/src/main/java/emu/grasscutter/server/packet/send/PacketTakePlayerLevelRewardRsp.java @@ -1,10 +1,10 @@ package emu.grasscutter.server.packet.send; -import emu.grasscutter.net.packet.GenshinPacket; +import emu.grasscutter.net.packet.BasePacket; import emu.grasscutter.net.packet.PacketOpcodes; import emu.grasscutter.net.proto.TakePlayerLevelRewardRspOuterClass.TakePlayerLevelRewardRsp; -public class PacketTakePlayerLevelRewardRsp extends GenshinPacket { +public class PacketTakePlayerLevelRewardRsp extends BasePacket { public PacketTakePlayerLevelRewardRsp(int level, int rewardId) { super(PacketOpcodes.TakePlayerLevelRewardRsp); diff --git a/src/main/java/emu/grasscutter/server/packet/send/PacketTakeoffEquipRsp.java b/src/main/java/emu/grasscutter/server/packet/send/PacketTakeoffEquipRsp.java index 7250491e2..45297b29f 100644 --- a/src/main/java/emu/grasscutter/server/packet/send/PacketTakeoffEquipRsp.java +++ b/src/main/java/emu/grasscutter/server/packet/send/PacketTakeoffEquipRsp.java @@ -1,10 +1,10 @@ package emu.grasscutter.server.packet.send; -import emu.grasscutter.net.packet.GenshinPacket; +import emu.grasscutter.net.packet.BasePacket; import emu.grasscutter.net.packet.PacketOpcodes; import emu.grasscutter.net.proto.TakeoffEquipRspOuterClass.TakeoffEquipRsp; -public class PacketTakeoffEquipRsp extends GenshinPacket { +public class PacketTakeoffEquipRsp extends BasePacket { public PacketTakeoffEquipRsp(long avatarGuid, int slot) { super(PacketOpcodes.TakeoffEquipRsp); diff --git a/src/main/java/emu/grasscutter/server/packet/send/PacketTowerAllDataRsp.java b/src/main/java/emu/grasscutter/server/packet/send/PacketTowerAllDataRsp.java index cb0d75abb..2bd1d0171 100644 --- a/src/main/java/emu/grasscutter/server/packet/send/PacketTowerAllDataRsp.java +++ b/src/main/java/emu/grasscutter/server/packet/send/PacketTowerAllDataRsp.java @@ -1,12 +1,12 @@ package emu.grasscutter.server.packet.send; -import emu.grasscutter.net.packet.GenshinPacket; +import emu.grasscutter.net.packet.BasePacket; import emu.grasscutter.net.packet.PacketOpcodes; import emu.grasscutter.net.proto.TowerAllDataRspOuterClass.TowerAllDataRsp; import emu.grasscutter.net.proto.TowerCurLevelRecordOuterClass.TowerCurLevelRecord; import emu.grasscutter.net.proto.TowerFloorRecordOuterClass.TowerFloorRecord; -public class PacketTowerAllDataRsp extends GenshinPacket { +public class PacketTowerAllDataRsp extends BasePacket { public PacketTowerAllDataRsp() { super(PacketOpcodes.TowerAllDataRsp); diff --git a/src/main/java/emu/grasscutter/server/packet/send/PacketUnlockAvatarTalentRsp.java b/src/main/java/emu/grasscutter/server/packet/send/PacketUnlockAvatarTalentRsp.java index 7c87f14e3..b980b9c89 100644 --- a/src/main/java/emu/grasscutter/server/packet/send/PacketUnlockAvatarTalentRsp.java +++ b/src/main/java/emu/grasscutter/server/packet/send/PacketUnlockAvatarTalentRsp.java @@ -1,13 +1,13 @@ package emu.grasscutter.server.packet.send; -import emu.grasscutter.game.avatar.GenshinAvatar; -import emu.grasscutter.net.packet.GenshinPacket; +import emu.grasscutter.game.avatar.Avatar; +import emu.grasscutter.net.packet.BasePacket; import emu.grasscutter.net.packet.PacketOpcodes; import emu.grasscutter.net.proto.UnlockAvatarTalentRspOuterClass.UnlockAvatarTalentRsp; -public class PacketUnlockAvatarTalentRsp extends GenshinPacket { +public class PacketUnlockAvatarTalentRsp extends BasePacket { - public PacketUnlockAvatarTalentRsp(GenshinAvatar avatar, int talentId) { + public PacketUnlockAvatarTalentRsp(Avatar avatar, int talentId) { super(PacketOpcodes.UnlockAvatarTalentRsp); UnlockAvatarTalentRsp proto = UnlockAvatarTalentRsp.newBuilder() diff --git a/src/main/java/emu/grasscutter/server/packet/send/PacketUnlockNameCardNotify.java b/src/main/java/emu/grasscutter/server/packet/send/PacketUnlockNameCardNotify.java index 9bbd7d5c3..4bb2aec7a 100644 --- a/src/main/java/emu/grasscutter/server/packet/send/PacketUnlockNameCardNotify.java +++ b/src/main/java/emu/grasscutter/server/packet/send/PacketUnlockNameCardNotify.java @@ -1,10 +1,10 @@ package emu.grasscutter.server.packet.send; -import emu.grasscutter.net.packet.GenshinPacket; +import emu.grasscutter.net.packet.BasePacket; import emu.grasscutter.net.packet.PacketOpcodes; import emu.grasscutter.net.proto.UnlockNameCardNotifyOuterClass.UnlockNameCardNotify; -public class PacketUnlockNameCardNotify extends GenshinPacket { +public class PacketUnlockNameCardNotify extends BasePacket { public PacketUnlockNameCardNotify(int nameCard) { super(PacketOpcodes.UnlockNameCardNotify); diff --git a/src/main/java/emu/grasscutter/server/packet/send/PacketUseItemRsp.java b/src/main/java/emu/grasscutter/server/packet/send/PacketUseItemRsp.java index b58638ebb..f6722bf56 100644 --- a/src/main/java/emu/grasscutter/server/packet/send/PacketUseItemRsp.java +++ b/src/main/java/emu/grasscutter/server/packet/send/PacketUseItemRsp.java @@ -1,14 +1,14 @@ package emu.grasscutter.server.packet.send; -import emu.grasscutter.game.inventory.GenshinItem; -import emu.grasscutter.net.packet.GenshinPacket; +import emu.grasscutter.game.inventory.GameItem; +import emu.grasscutter.net.packet.BasePacket; import emu.grasscutter.net.packet.PacketOpcodes; import emu.grasscutter.net.proto.RetcodeOuterClass; import emu.grasscutter.net.proto.UseItemRspOuterClass.UseItemRsp; -public class PacketUseItemRsp extends GenshinPacket { +public class PacketUseItemRsp extends BasePacket { - public PacketUseItemRsp(long targetGuid, GenshinItem useItem) { + public PacketUseItemRsp(long targetGuid, GameItem useItem) { super(PacketOpcodes.UseItemRsp); UseItemRsp proto = UseItemRsp.newBuilder() diff --git a/src/main/java/emu/grasscutter/server/packet/send/PacketWeaponAwakenRsp.java b/src/main/java/emu/grasscutter/server/packet/send/PacketWeaponAwakenRsp.java index 6ffba63fa..77a4e21ed 100644 --- a/src/main/java/emu/grasscutter/server/packet/send/PacketWeaponAwakenRsp.java +++ b/src/main/java/emu/grasscutter/server/packet/send/PacketWeaponAwakenRsp.java @@ -1,14 +1,14 @@ package emu.grasscutter.server.packet.send; -import emu.grasscutter.game.avatar.GenshinAvatar; -import emu.grasscutter.game.inventory.GenshinItem; -import emu.grasscutter.net.packet.GenshinPacket; +import emu.grasscutter.game.avatar.Avatar; +import emu.grasscutter.game.inventory.GameItem; +import emu.grasscutter.net.packet.BasePacket; import emu.grasscutter.net.packet.PacketOpcodes; import emu.grasscutter.net.proto.WeaponAwakenRspOuterClass.WeaponAwakenRsp; -public class PacketWeaponAwakenRsp extends GenshinPacket { +public class PacketWeaponAwakenRsp extends BasePacket { - public PacketWeaponAwakenRsp(GenshinAvatar avatar, GenshinItem item, GenshinItem feedWeapon, int oldRefineLevel) { + public PacketWeaponAwakenRsp(Avatar avatar, GameItem item, GameItem feedWeapon, int oldRefineLevel) { super(PacketOpcodes.WeaponAwakenRsp); WeaponAwakenRsp.Builder proto = WeaponAwakenRsp.newBuilder() diff --git a/src/main/java/emu/grasscutter/server/packet/send/PacketWeaponPromoteRsp.java b/src/main/java/emu/grasscutter/server/packet/send/PacketWeaponPromoteRsp.java index f647bd1ff..02f02eab7 100644 --- a/src/main/java/emu/grasscutter/server/packet/send/PacketWeaponPromoteRsp.java +++ b/src/main/java/emu/grasscutter/server/packet/send/PacketWeaponPromoteRsp.java @@ -1,13 +1,13 @@ package emu.grasscutter.server.packet.send; -import emu.grasscutter.game.inventory.GenshinItem; -import emu.grasscutter.net.packet.GenshinPacket; +import emu.grasscutter.game.inventory.GameItem; +import emu.grasscutter.net.packet.BasePacket; import emu.grasscutter.net.packet.PacketOpcodes; import emu.grasscutter.net.proto.WeaponPromoteRspOuterClass.WeaponPromoteRsp; -public class PacketWeaponPromoteRsp extends GenshinPacket { +public class PacketWeaponPromoteRsp extends BasePacket { - public PacketWeaponPromoteRsp(GenshinItem item, int oldPromoteLevel) { + public PacketWeaponPromoteRsp(GameItem item, int oldPromoteLevel) { super(PacketOpcodes.WeaponPromoteRsp); WeaponPromoteRsp proto = WeaponPromoteRsp.newBuilder() diff --git a/src/main/java/emu/grasscutter/server/packet/send/PacketWeaponUpgradeRsp.java b/src/main/java/emu/grasscutter/server/packet/send/PacketWeaponUpgradeRsp.java index b00accb60..2e0505d0e 100644 --- a/src/main/java/emu/grasscutter/server/packet/send/PacketWeaponUpgradeRsp.java +++ b/src/main/java/emu/grasscutter/server/packet/send/PacketWeaponUpgradeRsp.java @@ -2,15 +2,15 @@ package emu.grasscutter.server.packet.send; import java.util.List; -import emu.grasscutter.game.inventory.GenshinItem; -import emu.grasscutter.net.packet.GenshinPacket; +import emu.grasscutter.game.inventory.GameItem; +import emu.grasscutter.net.packet.BasePacket; import emu.grasscutter.net.packet.PacketOpcodes; import emu.grasscutter.net.proto.ItemParamOuterClass.ItemParam; import emu.grasscutter.net.proto.WeaponUpgradeRspOuterClass.WeaponUpgradeRsp; -public class PacketWeaponUpgradeRsp extends GenshinPacket { +public class PacketWeaponUpgradeRsp extends BasePacket { - public PacketWeaponUpgradeRsp(GenshinItem item, int oldLevel, List<ItemParam> leftoverOres) { + public PacketWeaponUpgradeRsp(GameItem item, int oldLevel, List<ItemParam> leftoverOres) { super(PacketOpcodes.WeaponUpgradeRsp); WeaponUpgradeRsp proto = WeaponUpgradeRsp.newBuilder() diff --git a/src/main/java/emu/grasscutter/server/packet/send/PacketWearEquipRsp.java b/src/main/java/emu/grasscutter/server/packet/send/PacketWearEquipRsp.java index 26e48566c..090e6f7bd 100644 --- a/src/main/java/emu/grasscutter/server/packet/send/PacketWearEquipRsp.java +++ b/src/main/java/emu/grasscutter/server/packet/send/PacketWearEquipRsp.java @@ -1,10 +1,10 @@ package emu.grasscutter.server.packet.send; -import emu.grasscutter.net.packet.GenshinPacket; +import emu.grasscutter.net.packet.BasePacket; import emu.grasscutter.net.packet.PacketOpcodes; import emu.grasscutter.net.proto.WearEquipRspOuterClass.WearEquipRsp; -public class PacketWearEquipRsp extends GenshinPacket { +public class PacketWearEquipRsp extends BasePacket { public PacketWearEquipRsp(long avatarGuid, long equipGuid) { super(PacketOpcodes.WearEquipRsp); diff --git a/src/main/java/emu/grasscutter/server/packet/send/PacketWorldDataNotify.java b/src/main/java/emu/grasscutter/server/packet/send/PacketWorldDataNotify.java index 9a5aeb88d..159ca42a1 100644 --- a/src/main/java/emu/grasscutter/server/packet/send/PacketWorldDataNotify.java +++ b/src/main/java/emu/grasscutter/server/packet/send/PacketWorldDataNotify.java @@ -1,12 +1,12 @@ package emu.grasscutter.server.packet.send; -import emu.grasscutter.game.World; -import emu.grasscutter.net.packet.GenshinPacket; +import emu.grasscutter.game.world.World; +import emu.grasscutter.net.packet.BasePacket; import emu.grasscutter.net.packet.PacketOpcodes; import emu.grasscutter.net.proto.PropValueOuterClass.PropValue; import emu.grasscutter.net.proto.WorldDataNotifyOuterClass.WorldDataNotify; -public class PacketWorldDataNotify extends GenshinPacket { +public class PacketWorldDataNotify extends BasePacket { public PacketWorldDataNotify(World world) { super(PacketOpcodes.WorldDataNotify); diff --git a/src/main/java/emu/grasscutter/server/packet/send/PacketWorldPlayerDieNotify.java b/src/main/java/emu/grasscutter/server/packet/send/PacketWorldPlayerDieNotify.java index f67ff0d57..4f9c839d9 100644 --- a/src/main/java/emu/grasscutter/server/packet/send/PacketWorldPlayerDieNotify.java +++ b/src/main/java/emu/grasscutter/server/packet/send/PacketWorldPlayerDieNotify.java @@ -1,11 +1,11 @@ package emu.grasscutter.server.packet.send; -import emu.grasscutter.net.packet.GenshinPacket; +import emu.grasscutter.net.packet.BasePacket; import emu.grasscutter.net.packet.PacketOpcodes; import emu.grasscutter.net.proto.PlayerDieTypeOuterClass.PlayerDieType; import emu.grasscutter.net.proto.WorldPlayerDieNotifyOuterClass.WorldPlayerDieNotify; -public class PacketWorldPlayerDieNotify extends GenshinPacket { +public class PacketWorldPlayerDieNotify extends BasePacket { public PacketWorldPlayerDieNotify(PlayerDieType playerDieType, int killerId) { super(PacketOpcodes.WorldPlayerDieNotify); diff --git a/src/main/java/emu/grasscutter/server/packet/send/PacketWorldPlayerInfoNotify.java b/src/main/java/emu/grasscutter/server/packet/send/PacketWorldPlayerInfoNotify.java index 709a128d2..64fef4f3e 100644 --- a/src/main/java/emu/grasscutter/server/packet/send/PacketWorldPlayerInfoNotify.java +++ b/src/main/java/emu/grasscutter/server/packet/send/PacketWorldPlayerInfoNotify.java @@ -1,12 +1,12 @@ package emu.grasscutter.server.packet.send; -import emu.grasscutter.game.GenshinPlayer; -import emu.grasscutter.game.World; -import emu.grasscutter.net.packet.GenshinPacket; +import emu.grasscutter.game.player.Player; +import emu.grasscutter.game.world.World; +import emu.grasscutter.net.packet.BasePacket; import emu.grasscutter.net.packet.PacketOpcodes; import emu.grasscutter.net.proto.WorldPlayerInfoNotifyOuterClass.WorldPlayerInfoNotify; -public class PacketWorldPlayerInfoNotify extends GenshinPacket { +public class PacketWorldPlayerInfoNotify extends BasePacket { public PacketWorldPlayerInfoNotify(World world) { super(PacketOpcodes.WorldPlayerInfoNotify); @@ -14,7 +14,7 @@ public class PacketWorldPlayerInfoNotify extends GenshinPacket { WorldPlayerInfoNotify.Builder proto = WorldPlayerInfoNotify.newBuilder(); for (int i = 0; i < world.getPlayers().size(); i++) { - GenshinPlayer p = world.getPlayers().get(i); + Player p = world.getPlayers().get(i); proto.addPlayerInfoList(p.getOnlinePlayerInfo()); proto.addPlayerUidList(p.getUid()); diff --git a/src/main/java/emu/grasscutter/server/packet/send/PacketWorldPlayerLocationNotify.java b/src/main/java/emu/grasscutter/server/packet/send/PacketWorldPlayerLocationNotify.java index 9ef9cfb73..0b6d3521c 100644 --- a/src/main/java/emu/grasscutter/server/packet/send/PacketWorldPlayerLocationNotify.java +++ b/src/main/java/emu/grasscutter/server/packet/send/PacketWorldPlayerLocationNotify.java @@ -1,19 +1,19 @@ package emu.grasscutter.server.packet.send; -import emu.grasscutter.game.GenshinPlayer; -import emu.grasscutter.game.World; -import emu.grasscutter.net.packet.GenshinPacket; +import emu.grasscutter.game.player.Player; +import emu.grasscutter.game.world.World; +import emu.grasscutter.net.packet.BasePacket; import emu.grasscutter.net.packet.PacketOpcodes; import emu.grasscutter.net.proto.WorldPlayerLocationNotifyOuterClass.WorldPlayerLocationNotify; -public class PacketWorldPlayerLocationNotify extends GenshinPacket { +public class PacketWorldPlayerLocationNotify extends BasePacket { public PacketWorldPlayerLocationNotify(World world) { super(PacketOpcodes.WorldPlayerLocationNotify); WorldPlayerLocationNotify.Builder proto = WorldPlayerLocationNotify.newBuilder(); - for (GenshinPlayer p : world.getPlayers()) { + for (Player p : world.getPlayers()) { proto.addPlayerWorldLocList(p.getWorldPlayerLocationInfo()); } diff --git a/src/main/java/emu/grasscutter/server/packet/send/PacketWorldPlayerRTTNotify.java b/src/main/java/emu/grasscutter/server/packet/send/PacketWorldPlayerRTTNotify.java index 1154b3ee3..0ba3234d7 100644 --- a/src/main/java/emu/grasscutter/server/packet/send/PacketWorldPlayerRTTNotify.java +++ b/src/main/java/emu/grasscutter/server/packet/send/PacketWorldPlayerRTTNotify.java @@ -1,20 +1,20 @@ package emu.grasscutter.server.packet.send; -import emu.grasscutter.game.GenshinPlayer; -import emu.grasscutter.game.World; -import emu.grasscutter.net.packet.GenshinPacket; +import emu.grasscutter.game.player.Player; +import emu.grasscutter.game.world.World; +import emu.grasscutter.net.packet.BasePacket; import emu.grasscutter.net.packet.PacketOpcodes; import emu.grasscutter.net.proto.PlayerRTTInfoOuterClass.PlayerRTTInfo; import emu.grasscutter.net.proto.WorldPlayerRTTNotifyOuterClass.WorldPlayerRTTNotify; -public class PacketWorldPlayerRTTNotify extends GenshinPacket { +public class PacketWorldPlayerRTTNotify extends BasePacket { public PacketWorldPlayerRTTNotify(World world) { super(PacketOpcodes.WorldPlayerRTTNotify); WorldPlayerRTTNotify.Builder proto = WorldPlayerRTTNotify.newBuilder(); - for (GenshinPlayer player : world.getPlayers()) { + for (Player player : world.getPlayers()) { proto.addPlayerRttList( PlayerRTTInfo.newBuilder() .setUid(player.getUid()) diff --git a/src/main/java/emu/grasscutter/task/TaskMap.java b/src/main/java/emu/grasscutter/task/TaskMap.java index 3da550a67..077ff1f59 100644 --- a/src/main/java/emu/grasscutter/task/TaskMap.java +++ b/src/main/java/emu/grasscutter/task/TaskMap.java @@ -2,7 +2,7 @@ package emu.grasscutter.task; import emu.grasscutter.Grasscutter; import emu.grasscutter.game.Account; -import emu.grasscutter.game.GenshinPlayer; +import emu.grasscutter.game.player.Player; import org.quartz.CronScheduleBuilder; import org.quartz.CronTrigger; diff --git a/src/main/java/emu/grasscutter/task/tasks/MoonCard.java b/src/main/java/emu/grasscutter/task/tasks/MoonCard.java index 26f7b9788..45c04586e 100644 --- a/src/main/java/emu/grasscutter/task/tasks/MoonCard.java +++ b/src/main/java/emu/grasscutter/task/tasks/MoonCard.java @@ -1,7 +1,7 @@ package emu.grasscutter.task.tasks; import emu.grasscutter.database.DatabaseManager; -import emu.grasscutter.game.GenshinPlayer; +import emu.grasscutter.game.player.Player; import emu.grasscutter.task.Task; import emu.grasscutter.task.TaskHandler; @@ -15,8 +15,8 @@ import org.quartz.JobExecutionException; public final class MoonCard implements TaskHandler { @Override public void execute(JobExecutionContext context) throws JobExecutionException { - List<GenshinPlayer> players = DatabaseManager.getDatastore().find(GenshinPlayer.class).stream().toList(); - for (GenshinPlayer player : players) { + List<Player> players = DatabaseManager.getDatastore().find(Player.class).stream().toList(); + for (Player player : players) { if (player.isOnline()) { if (player.inMoonCard()) { player.getTodayMoonCard(); diff --git a/src/main/java/emu/grasscutter/tools/Tools.java b/src/main/java/emu/grasscutter/tools/Tools.java index 1afcc1ebe..d0ac55c7d 100644 --- a/src/main/java/emu/grasscutter/tools/Tools.java +++ b/src/main/java/emu/grasscutter/tools/Tools.java @@ -18,9 +18,9 @@ import java.util.stream.Collectors; import com.google.gson.reflect.TypeToken; -import emu.grasscutter.GenshinConstants; +import emu.grasscutter.GameConstants; import emu.grasscutter.Grasscutter; -import emu.grasscutter.data.GenshinData; +import emu.grasscutter.data.GameData; import emu.grasscutter.data.ResourceLoader; import emu.grasscutter.data.def.AvatarData; import emu.grasscutter.data.def.ItemData; @@ -45,48 +45,48 @@ public final class Tools { DateTimeFormatter dtf = DateTimeFormatter.ofPattern("yyyy/MM/dd HH:mm:ss"); LocalDateTime now = LocalDateTime.now(); - writer.println("// Genshin Impact " + GenshinConstants.VERSION + " GM Handbook"); + writer.println("// Grasscutter " + GameConstants.VERSION + " GM Handbook"); writer.println("// Created " + dtf.format(now) + System.lineSeparator() + System.lineSeparator()); - list = new ArrayList<>(GenshinData.getAvatarDataMap().keySet()); + list = new ArrayList<>(GameData.getAvatarDataMap().keySet()); Collections.sort(list); writer.println("// Avatars"); for (Integer id : list) { - AvatarData data = GenshinData.getAvatarDataMap().get(id); + AvatarData data = GameData.getAvatarDataMap().get(id); writer.println(data.getId() + " : " + map.get(data.getNameTextMapHash())); } writer.println(); - list = new ArrayList<>(GenshinData.getItemDataMap().keySet()); + list = new ArrayList<>(GameData.getItemDataMap().keySet()); Collections.sort(list); writer.println("// Items"); for (Integer id : list) { - ItemData data = GenshinData.getItemDataMap().get(id); + ItemData data = GameData.getItemDataMap().get(id); writer.println(data.getId() + " : " + map.get(data.getNameTextMapHash())); } writer.println(); writer.println("// Scenes"); - list = new ArrayList<>(GenshinData.getSceneDataMap().keySet()); + list = new ArrayList<>(GameData.getSceneDataMap().keySet()); Collections.sort(list); for (Integer id : list) { - SceneData data = GenshinData.getSceneDataMap().get(id); + SceneData data = GameData.getSceneDataMap().get(id); writer.println(data.getId() + " : " + data.getScriptData()); } writer.println(); writer.println("// Monsters"); - list = new ArrayList<>(GenshinData.getMonsterDataMap().keySet()); + list = new ArrayList<>(GameData.getMonsterDataMap().keySet()); Collections.sort(list); for (Integer id : list) { - MonsterData data = GenshinData.getMonsterDataMap().get(id); + MonsterData data = GameData.getMonsterDataMap().get(id); writer.println(data.getId() + " : " + map.get(data.getNameTextMapHash())); } } diff --git a/src/main/java/emu/grasscutter/utils/Utils.java b/src/main/java/emu/grasscutter/utils/Utils.java index 16b9c344b..8129a1188 100644 --- a/src/main/java/emu/grasscutter/utils/Utils.java +++ b/src/main/java/emu/grasscutter/utils/Utils.java @@ -174,11 +174,11 @@ public final class Utils { // Check for resources folder. if(!fileExists(resourcesFolder)) { logger.info("Creating resources folder..."); - logger.info("Place a copy of 'GenshinData' in the resources folder."); + logger.info("Place a copy of 'BinOutput' and 'ExcelBinOutput' in the resources folder."); createFolder(resourcesFolder); exit = true; } - // Check for GenshinData. + // Check for BinOutput + ExcelBinOuput. if(!fileExists(resourcesFolder + "BinOutput") || !fileExists(resourcesFolder + "ExcelBinOutput")) { logger.info("Place a copy of 'BinOutput' and 'ExcelBinOutput' in the resources folder.");