diff --git a/data/Banners.json b/data/Banners.json index 959a8b436..a4f724ac9 100644 --- a/data/Banners.json +++ b/data/Banners.json @@ -19,7 +19,7 @@ "bannerType": "EVENT", "prefabPath": "GachaShowPanel_A079", "previewPrefabPath": "UI_Tab_GachaShowPanel_A079", - "titlePath": "UI_GACHA_SHOW_PANEL_A079_TITLE", + "titlePath": "UI_GACHA_SHOW_PANEL_A048_TITLE", "costItem": 223, "beginTime": 0, "endTime": 1924992000, @@ -34,7 +34,7 @@ "bannerType": "WEAPON", "prefabPath": "GachaShowPanel_A080", "previewPrefabPath": "UI_Tab_GachaShowPanel_A080", - "titlePath": "UI_GACHA_SHOW_PANEL_A080_TITLE", + "titlePath": "UI_GACHA_SHOW_PANEL_A021_TITLE", "costItem": 223, "beginTime": 0, "endTime": 1924992000, diff --git a/src/main/java/emu/grasscutter/Config.java b/src/main/java/emu/grasscutter/Config.java index 938cbec77..8f2701d57 100644 --- a/src/main/java/emu/grasscutter/Config.java +++ b/src/main/java/emu/grasscutter/Config.java @@ -27,6 +27,7 @@ public final class Config { public String Ip = "127.0.0.1"; public String PublicIp = ""; public int Port = 443; + public int OverseaLogPort = 8888; public int UploadLogPort = 80; public String KeystorePath = "./keystore.p12"; public String KeystorePassword = ""; diff --git a/src/main/java/emu/grasscutter/command/commands/AccountCommand.java b/src/main/java/emu/grasscutter/command/commands/AccountCommand.java index 2c21cba79..26570e0e8 100644 --- a/src/main/java/emu/grasscutter/command/commands/AccountCommand.java +++ b/src/main/java/emu/grasscutter/command/commands/AccountCommand.java @@ -46,7 +46,7 @@ public final class AccountCommand implements CommandHandler { CommandHandler.sendMessage(null, "Account already exists."); return; } else { - CommandHandler.sendMessage(null, "Account created with UID " + account.getPlayerId() + "."); + CommandHandler.sendMessage(null, "Account created with UID " + account.getPlayerUid() + "."); account.addPermission("*"); // Grant the player superuser permissions. account.save(); // Save account to database. } diff --git a/src/main/java/emu/grasscutter/command/commands/ChangeSceneCommand.java b/src/main/java/emu/grasscutter/command/commands/ChangeSceneCommand.java index a5afe7bf7..eb2e998f2 100644 --- a/src/main/java/emu/grasscutter/command/commands/ChangeSceneCommand.java +++ b/src/main/java/emu/grasscutter/command/commands/ChangeSceneCommand.java @@ -23,11 +23,17 @@ public final class ChangeSceneCommand implements CommandHandler { try { int sceneId = Integer.parseInt(args.get(0)); + + if (sceneId == sender.getSceneId()) { + CommandHandler.sendMessage(sender, "You are already in that scene"); + return; + } + boolean result = sender.getWorld().transferPlayerToScene(sender, sceneId, sender.getPos()); - CommandHandler.sendMessage(sender, "Changed to scene " + sceneId); + if (!result) { - CommandHandler.sendMessage(sender, "Scene does not exist or you are already in it"); + CommandHandler.sendMessage(sender, "Scene does not exist"); } } catch (Exception e) { CommandHandler.sendMessage(sender, "Usage: changescene "); diff --git a/src/main/java/emu/grasscutter/command/commands/KickCommand.java b/src/main/java/emu/grasscutter/command/commands/KickCommand.java index 188ce1877..61e9d759b 100644 --- a/src/main/java/emu/grasscutter/command/commands/KickCommand.java +++ b/src/main/java/emu/grasscutter/command/commands/KickCommand.java @@ -22,7 +22,7 @@ public final class KickCommand implements CommandHandler { } if (sender != null) { - CommandHandler.sendMessage(sender, String.format("Player [%s:%s] has kicked player [%s:%s]", sender.getAccount().getPlayerId(), sender.getAccount().getUsername(), target, targetPlayer.getAccount().getUsername())); + CommandHandler.sendMessage(sender, String.format("Player [%s:%s] has kicked player [%s:%s]", sender.getAccount().getPlayerUid(), sender.getAccount().getUsername(), target, targetPlayer.getAccount().getUsername())); } CommandHandler.sendMessage(sender, String.format("Kicking player [%s:%s]", target, targetPlayer.getAccount().getUsername())); diff --git a/src/main/java/emu/grasscutter/game/Account.java b/src/main/java/emu/grasscutter/game/Account.java index 2eeeed3b1..dfb1e2829 100644 --- a/src/main/java/emu/grasscutter/game/Account.java +++ b/src/main/java/emu/grasscutter/game/Account.java @@ -1,5 +1,6 @@ package emu.grasscutter.game; +import dev.morphia.annotations.AlsoLoad; import dev.morphia.annotations.Collation; import dev.morphia.annotations.Entity; import dev.morphia.annotations.Id; @@ -24,7 +25,7 @@ public class Account { private String username; private String password; // Unused for now - private int playerId; + @AlsoLoad("playerUid") private int playerId; private String email; private String token; @@ -68,7 +69,7 @@ public class Account { this.token = token; } - public int getPlayerId() { + public int getPlayerUid() { return this.playerId; } diff --git a/src/main/java/emu/grasscutter/game/GenshinPlayer.java b/src/main/java/emu/grasscutter/game/GenshinPlayer.java index bf841090e..3cd5e4544 100644 --- a/src/main/java/emu/grasscutter/game/GenshinPlayer.java +++ b/src/main/java/emu/grasscutter/game/GenshinPlayer.java @@ -31,6 +31,7 @@ import emu.grasscutter.net.proto.OnlinePlayerInfoOuterClass.OnlinePlayerInfo; import emu.grasscutter.net.proto.PlayerApplyEnterMpReasonOuterClass.PlayerApplyEnterMpReason; import emu.grasscutter.net.proto.PlayerLocationInfoOuterClass.PlayerLocationInfo; import emu.grasscutter.net.proto.SocialDetailOuterClass.SocialDetail; +import emu.grasscutter.net.proto.WorldPlayerLocationInfoOuterClass.WorldPlayerLocationInfo; import emu.grasscutter.server.game.GameServer; import emu.grasscutter.server.game.GameSession; import emu.grasscutter.server.packet.send.PacketAbilityInvocationsNotify; @@ -49,9 +50,11 @@ import emu.grasscutter.server.packet.send.PacketPlayerEnterSceneNotify; import emu.grasscutter.server.packet.send.PacketPlayerPropNotify; import emu.grasscutter.server.packet.send.PacketPlayerStoreNotify; import emu.grasscutter.server.packet.send.PacketPrivateChatNotify; +import emu.grasscutter.server.packet.send.PacketScenePlayerLocationNotify; import emu.grasscutter.server.packet.send.PacketSetNameCardRsp; import emu.grasscutter.server.packet.send.PacketStoreWeightLimitNotify; import emu.grasscutter.server.packet.send.PacketUnlockNameCardNotify; +import emu.grasscutter.server.packet.send.PacketWorldPlayerLocationNotify; import emu.grasscutter.server.packet.send.PacketWorldPlayerRTTNotify; import emu.grasscutter.utils.Position; @@ -101,6 +104,7 @@ public class GenshinPlayer { @Transient private int enterSceneToken; @Transient private SceneLoadState sceneState; @Transient private boolean hasSentAvatarDataNotify; + @Transient private long nextSendPlayerLocTime = 0; @Transient private final Int2ObjectMap coopRequests; @Transient private final InvokeHandler combatInvokeHandler; @@ -121,6 +125,12 @@ public class GenshinPlayer { } this.properties.put(prop.getId(), 0); } + + this.gachaInfo = new PlayerGachaInfo(); + this.nameCardList = new HashSet<>(); + this.flyCloakList = new HashSet<>(); + this.costumeList = new HashSet<>(); + this.setSceneId(3); this.setRegionId(1); this.sceneState = SceneLoadState.NONE; @@ -140,11 +150,6 @@ public class GenshinPlayer { this.nickname = "Traveler"; this.signature = ""; this.teamManager = new TeamManager(this); - this.gachaInfo = new PlayerGachaInfo(); - this.playerProfile = new PlayerProfile(this); - this.nameCardList = new HashSet<>(); - this.flyCloakList = new HashSet<>(); - this.costumeList = new HashSet<>(); this.setProperty(PlayerProperty.PROP_PLAYER_LEVEL, 1); this.setProperty(PlayerProperty.PROP_IS_SPRING_AUTO_USE, 1); this.setProperty(PlayerProperty.PROP_SPRING_AUTO_USE_PERCENT, 50); @@ -165,6 +170,7 @@ public class GenshinPlayer { public void setUid(int id) { this.id = id; + this.getProfile().syncWithCharacter(this); } public long getNextGenshinGuid() { @@ -654,6 +660,13 @@ public class GenshinPlayer { return social; } + public WorldPlayerLocationInfo getWorldPlayerLocationInfo() { + return WorldPlayerLocationInfo.newBuilder() + .setSceneId(this.getSceneId()) + .setPlayerLoc(this.getPlayerLocationInfo()) + .build(); + } + public PlayerLocationInfo getPlayerLocationInfo() { return PlayerLocationInfo.newBuilder() .setUid(this.getUid()) @@ -679,9 +692,22 @@ public class GenshinPlayer { } // Ping if (this.getWorld() != null) { - this.sendPacket(new PacketWorldPlayerRTTNotify(this.getWorld())); // Player ping + // RTT notify - very important to send this often + this.sendPacket(new PacketWorldPlayerRTTNotify(this.getWorld())); + + // Update player locations if in multiplayer every 5 seconds + long time = System.currentTimeMillis(); + if (this.getWorld().isMultiplayer() && this.getScene() != null && time > nextSendPlayerLocTime) { + this.sendPacket(new PacketWorldPlayerLocationNotify(this.getWorld())); + this.sendPacket(new PacketScenePlayerLocationNotify(this.getScene())); + this.resetSendPlayerLocTime(); + } } } + + public void resetSendPlayerLocTime() { + this.nextSendPlayerLocTime = System.currentTimeMillis() + 5000; + } @PostLoad private void onLoad() { @@ -696,12 +722,8 @@ public class GenshinPlayer { // Make sure these exist if (this.getTeamManager() == null) { this.teamManager = new TeamManager(this); - } if (this.getGachaInfo() == null) { - this.gachaInfo = new PlayerGachaInfo(); - } if (this.nameCardList == null) { - this.nameCardList = new HashSet<>(); - } if (this.costumeList == null) { - this.costumeList = new HashSet<>(); + } if (this.getProfile().getUid() == 0) { + this.getProfile().syncWithCharacter(this); } // Check if player object exists in server diff --git a/src/main/java/emu/grasscutter/game/World.java b/src/main/java/emu/grasscutter/game/World.java index 4375d8e4f..f88d3bee4 100644 --- a/src/main/java/emu/grasscutter/game/World.java +++ b/src/main/java/emu/grasscutter/game/World.java @@ -206,28 +206,9 @@ public class World implements Iterable { public void deregisterScene(GenshinScene scene) { this.getScenes().remove(scene.getId()); } - - public boolean forceTransferPlayerToScene(GenshinPlayer player, int sceneId, Position pos) { - // Forces the client to reload the scene map to prevent the player from falling off the map. - if (GenshinData.getSceneDataMap().get(sceneId) == null) { - return false; - } - - if (player.getScene() != null) { - player.getScene().removePlayer(player); - } - - GenshinScene scene = this.getSceneById(sceneId); - scene.addPlayer(player); - player.getPos().set(pos); - - // Teleport packet - player.sendPacket(new PacketPlayerEnterSceneNotify(player, EnterType.EnterSelf, EnterReason.TransPoint, sceneId, pos)); - return true; - } public boolean transferPlayerToScene(GenshinPlayer player, int sceneId, Position pos) { - if (player.getScene().getId() == sceneId || GenshinData.getSceneDataMap().get(sceneId) == null) { + if (GenshinData.getSceneDataMap().get(sceneId) == null) { return false; } diff --git a/src/main/java/emu/grasscutter/game/avatar/GenshinAvatar.java b/src/main/java/emu/grasscutter/game/avatar/GenshinAvatar.java index a5dcb3ee8..9723c23d7 100644 --- a/src/main/java/emu/grasscutter/game/avatar/GenshinAvatar.java +++ b/src/main/java/emu/grasscutter/game/avatar/GenshinAvatar.java @@ -13,6 +13,7 @@ import dev.morphia.annotations.Indexed; 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.common.FightPropData; import emu.grasscutter.data.custom.OpenConfigEntry; @@ -42,6 +43,7 @@ import emu.grasscutter.game.props.FightProperty; import emu.grasscutter.game.props.PlayerProperty; import emu.grasscutter.net.proto.AvatarFetterInfoOuterClass.AvatarFetterInfo; import emu.grasscutter.net.proto.AvatarInfoOuterClass.AvatarInfo; +import emu.grasscutter.server.packet.send.PacketAbilityChangeNotify; import emu.grasscutter.server.packet.send.PacketAvatarEquipChangeNotify; import emu.grasscutter.server.packet.send.PacketAvatarFightPropNotify; import emu.grasscutter.utils.ProtoHelper; @@ -69,7 +71,7 @@ public class GenshinAvatar { @Transient private final Int2ObjectMap equips; @Transient private final Int2FloatOpenHashMap fightProp; - @Transient private final Set bonusAbilityList; + @Transient private Set extraAbilityEmbryos; private Map skillLevelMap; // Talent levels private Map proudSkillBonusMap; // Talent bonus levels (from const) @@ -86,7 +88,7 @@ public class GenshinAvatar { // Morhpia only! this.equips = new Int2ObjectOpenHashMap<>(); this.fightProp = new Int2FloatOpenHashMap(); - this.bonusAbilityList = new HashSet<>(); + this.extraAbilityEmbryos = new HashSet<>(); this.proudSkillBonusMap = new HashMap<>(); // TODO Move to genshin avatar } @@ -260,8 +262,8 @@ public class GenshinAvatar { return proudSkillBonusMap; } - public Set getBonusAbilityList() { - return bonusAbilityList; + public Set getExtraAbilityEmbryos() { + return extraAbilityEmbryos; } public float getCurrentHp() { @@ -347,14 +349,14 @@ public class GenshinAvatar { item.setEquipCharacter(this.getAvatarId()); item.save(); + if (this.getPlayer().hasSentAvatarDataNotify()) { + this.getPlayer().sendPacket(new PacketAvatarEquipChangeNotify(this, item)); + } + if (shouldRecalc) { this.recalcStats(); } - if (this.getPlayer().hasSentAvatarDataNotify()) { - this.getPlayer().sendPacket(new PacketAvatarEquipChangeNotify(this, item)); - } - return true; } @@ -371,11 +373,18 @@ public class GenshinAvatar { } public void recalcStats() { + recalcStats(false); + } + + public void recalcStats(boolean forceSendAbilityChange) { // Setup AvatarData data = this.getAvatarData(); AvatarPromoteData promoteData = GenshinData.getAvatarPromoteData(data.getAvatarPromoteId(), this.getPromoteLevel()); Int2IntOpenHashMap setMap = new Int2IntOpenHashMap(); - this.getBonusAbilityList().clear(); + + // Extra ability embryos + Set prevExtraAbilityEmbryos = this.getExtraAbilityEmbryos(); + this.extraAbilityEmbryos = new HashSet<>(); // Get hp percent, set to 100% if none float hpPercent = this.getFightProperty(FightProperty.FIGHT_PROP_MAX_HP) <= 0 ? 1f : this.getFightProperty(FightProperty.FIGHT_PROP_CUR_HP) / this.getFightProperty(FightProperty.FIGHT_PROP_MAX_HP); @@ -458,7 +467,7 @@ public class GenshinAvatar { } // Add any skill strings from this affix - this.addToAbilityList(affix.getOpenConfig(), true); + this.addToExtraAbilityEmbryos(affix.getOpenConfig(), true); } else { break; } @@ -505,7 +514,7 @@ public class GenshinAvatar { } // Add any skill strings from this affix - this.addToAbilityList(affix.getOpenConfig(), true); + this.addToExtraAbilityEmbryos(affix.getOpenConfig(), true); } } } @@ -538,7 +547,7 @@ public class GenshinAvatar { } // Add any skill strings from this proud skill - this.addToAbilityList(proudSkillData.getOpenConfig(), true); + this.addToExtraAbilityEmbryos(proudSkillData.getOpenConfig(), true); } // Constellations @@ -550,7 +559,7 @@ public class GenshinAvatar { } // Add any skill strings from this constellation - this.addToAbilityList(avatarTalentData.getOpenConfig(), false); + this.addToExtraAbilityEmbryos(avatarTalentData.getOpenConfig(), false); } } @@ -573,11 +582,17 @@ public class GenshinAvatar { // Packet if (getPlayer() != null && getPlayer().hasSentAvatarDataNotify()) { + // Update stats for client getPlayer().sendPacket(new PacketAvatarFightPropNotify(this)); + // Update client abilities + EntityAvatar entity = this.getAsEntity(); + if (entity != null && (!this.getExtraAbilityEmbryos().equals(prevExtraAbilityEmbryos) || forceSendAbilityChange)) { + getPlayer().sendPacket(new PacketAbilityChangeNotify(entity)); + } } } - public void addToAbilityList(String openConfig, boolean forceAdd) { + public void addToExtraAbilityEmbryos(String openConfig, boolean forceAdd) { if (openConfig == null || openConfig.length() == 0) { return; } @@ -586,14 +601,14 @@ public class GenshinAvatar { if (entry == null) { if (forceAdd) { // Add config string to ability skill list anyways - this.getBonusAbilityList().add(openConfig); + this.getExtraAbilityEmbryos().add(openConfig); } return; } if (entry.getAddAbilities() != null) { for (String ability : entry.getAddAbilities()) { - this.getBonusAbilityList().add(ability); + this.getExtraAbilityEmbryos().add(ability); } } } diff --git a/src/main/java/emu/grasscutter/game/entity/EntityAvatar.java b/src/main/java/emu/grasscutter/game/entity/EntityAvatar.java index 86e8ea458..233da5288 100644 --- a/src/main/java/emu/grasscutter/game/entity/EntityAvatar.java +++ b/src/main/java/emu/grasscutter/game/entity/EntityAvatar.java @@ -223,8 +223,8 @@ public class EntityAvatar extends GenshinEntity { } } // Add equip abilities - if (this.getAvatar().getBonusAbilityList().size() > 0) { - for (String skill : this.getAvatar().getBonusAbilityList()) { + if (this.getAvatar().getExtraAbilityEmbryos().size() > 0) { + for (String skill : this.getAvatar().getExtraAbilityEmbryos()) { AbilityEmbryo emb = AbilityEmbryo.newBuilder() .setAbilityId(++embryoId) .setAbilityNameHash(Utils.abilityHash(skill)) diff --git a/src/main/java/emu/grasscutter/game/friends/FriendsList.java b/src/main/java/emu/grasscutter/game/friends/FriendsList.java index 582a10efd..45a11fb1c 100644 --- a/src/main/java/emu/grasscutter/game/friends/FriendsList.java +++ b/src/main/java/emu/grasscutter/game/friends/FriendsList.java @@ -220,7 +220,7 @@ public class FriendsList { friendship.setOwner(getPlayer()); // Check if friend is online - GenshinPlayer friend = getPlayer().getSession().getServer().getPlayerByUid(friendship.getFriendProfile().getId()); + GenshinPlayer 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 2be7d1fce..172d1bd43 100644 --- a/src/main/java/emu/grasscutter/game/friends/Friendship.java +++ b/src/main/java/emu/grasscutter/game/friends/Friendship.java @@ -88,7 +88,7 @@ public class Friendship { public FriendBrief toProto() { FriendBrief proto = FriendBrief.newBuilder() - .setUid(getFriendProfile().getId()) + .setUid(getFriendProfile().getUid()) .setNickname(getFriendProfile().getName()) .setLevel(getFriendProfile().getPlayerLevel()) .setAvatar(HeadImage.newBuilder().setAvatarId(getFriendProfile().getAvatarId())) diff --git a/src/main/java/emu/grasscutter/game/friends/PlayerProfile.java b/src/main/java/emu/grasscutter/game/friends/PlayerProfile.java index cc7408aa6..b9381c901 100644 --- a/src/main/java/emu/grasscutter/game/friends/PlayerProfile.java +++ b/src/main/java/emu/grasscutter/game/friends/PlayerProfile.java @@ -7,7 +7,7 @@ import emu.grasscutter.utils.Utils; public class PlayerProfile { @Transient private GenshinPlayer player; - private int id; + @AlsoLoad("id") private int uid; private int nameCard; private int avatarId; private String name; @@ -22,12 +22,12 @@ public class PlayerProfile { public PlayerProfile() { } public PlayerProfile(GenshinPlayer player) { - this.id = player.getUid(); + this.uid = player.getUid(); this.syncWithCharacter(player); } - public int getId() { - return id; + public int getUid() { + return uid; } public GenshinPlayer getPlayer() { @@ -87,6 +87,7 @@ public class PlayerProfile { return; } + this.uid = player.getUid(); this.name = player.getNickname(); this.avatarId = player.getHeadImage(); this.signature = player.getSignature(); diff --git a/src/main/java/emu/grasscutter/game/managers/InventoryManager.java b/src/main/java/emu/grasscutter/game/managers/InventoryManager.java index 935652d77..532155db1 100644 --- a/src/main/java/emu/grasscutter/game/managers/InventoryManager.java +++ b/src/main/java/emu/grasscutter/game/managers/InventoryManager.java @@ -589,7 +589,6 @@ public class InventoryManager { // Update proud skills AvatarSkillDepotData skillDepot = GenshinData.getAvatarSkillDepotDataMap().get(avatar.getSkillDepotId()); - boolean hasAddedProudSkill = false; if (skillDepot != null && skillDepot.getInherentProudSkillOpens() != null) { for (InherentProudSkillOpens openData : skillDepot.getInherentProudSkillOpens()) { @@ -599,7 +598,6 @@ public class InventoryManager { if (openData.getNeedAvatarPromoteLevel() == avatar.getPromoteLevel()) { int proudSkillId = (openData.getProudSkillGroupId() * 100) + 1; if (GenshinData.getProudSkillDataMap().containsKey(proudSkillId)) { - hasAddedProudSkill = true; avatar.getProudSkillList().add(proudSkillId); player.sendPacket(new PacketProudSkillChangeNotify(avatar)); } @@ -607,20 +605,13 @@ public class InventoryManager { } } - // Racalc stats and save avatar - avatar.recalcStats(); - avatar.save(); - - // Resend ability embryos if proud skill has been added - if (hasAddedProudSkill && avatar.getAsEntity() != null) { - player.sendPacket(new PacketAbilityChangeNotify(avatar.getAsEntity())); - } - - // TODO Send entity prop update packet to world - // Packets player.sendPacket(new PacketAvatarPropNotify(avatar)); player.sendPacket(new PacketAvatarPromoteRsp(avatar)); + + // TODO Send entity prop update packet to world + avatar.recalcStats(true); + avatar.save(); } public void upgradeAvatar(GenshinPlayer player, long guid, int itemId, int count) { @@ -827,25 +818,20 @@ public class InventoryManager { // Apply + recalc avatar.getTalentIdList().add(talentData.getId()); avatar.setCoreProudSkillLevel(currentTalentLevel + 1); - avatar.recalcStats(); // Packet player.sendPacket(new PacketAvatarUnlockTalentNotify(avatar, nextTalentId)); player.sendPacket(new PacketUnlockAvatarTalentRsp(avatar, nextTalentId)); - // Proud skill bonus map + // Proud skill bonus map (Extra skills) OpenConfigEntry entry = GenshinData.getOpenConfigEntries().get(talentData.getOpenConfig()); if (entry != null && entry.getExtraTalentIndex() > 0) { avatar.recalcProudSkillBonusMap(); player.sendPacket(new PacketProudSkillExtraLevelNotify(avatar, entry.getExtraTalentIndex())); } - // Resend ability embryos - if (avatar.getAsEntity() != null) { - player.sendPacket(new PacketAbilityChangeNotify(avatar.getAsEntity())); - } - - // Save avatar + // Recalc + save avatar + avatar.recalcStats(true); avatar.save(); } diff --git a/src/main/java/emu/grasscutter/net/proto/WorldPlayerLocationInfoOuterClass.java b/src/main/java/emu/grasscutter/net/proto/WorldPlayerLocationInfoOuterClass.java new file mode 100644 index 000000000..b8c634fd1 --- /dev/null +++ b/src/main/java/emu/grasscutter/net/proto/WorldPlayerLocationInfoOuterClass.java @@ -0,0 +1,743 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: WorldPlayerLocationInfo.proto + +package emu.grasscutter.net.proto; + +public final class WorldPlayerLocationInfoOuterClass { + private WorldPlayerLocationInfoOuterClass() {} + public static void registerAllExtensions( + com.google.protobuf.ExtensionRegistryLite registry) { + } + + public static void registerAllExtensions( + com.google.protobuf.ExtensionRegistry registry) { + registerAllExtensions( + (com.google.protobuf.ExtensionRegistryLite) registry); + } + public interface WorldPlayerLocationInfoOrBuilder extends + // @@protoc_insertion_point(interface_extends:WorldPlayerLocationInfo) + com.google.protobuf.MessageOrBuilder { + + /** + * uint32 sceneId = 1; + * @return The sceneId. + */ + int getSceneId(); + + /** + * .PlayerLocationInfo playerLoc = 2; + * @return Whether the playerLoc field is set. + */ + boolean hasPlayerLoc(); + /** + * .PlayerLocationInfo playerLoc = 2; + * @return The playerLoc. + */ + emu.grasscutter.net.proto.PlayerLocationInfoOuterClass.PlayerLocationInfo getPlayerLoc(); + /** + * .PlayerLocationInfo playerLoc = 2; + */ + emu.grasscutter.net.proto.PlayerLocationInfoOuterClass.PlayerLocationInfoOrBuilder getPlayerLocOrBuilder(); + } + /** + * Protobuf type {@code WorldPlayerLocationInfo} + */ + public static final class WorldPlayerLocationInfo extends + com.google.protobuf.GeneratedMessageV3 implements + // @@protoc_insertion_point(message_implements:WorldPlayerLocationInfo) + WorldPlayerLocationInfoOrBuilder { + private static final long serialVersionUID = 0L; + // Use WorldPlayerLocationInfo.newBuilder() to construct. + private WorldPlayerLocationInfo(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + private WorldPlayerLocationInfo() { + } + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance( + UnusedPrivateParameter unused) { + return new WorldPlayerLocationInfo(); + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet + getUnknownFields() { + return this.unknownFields; + } + private WorldPlayerLocationInfo( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + this(); + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder(); + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 8: { + + sceneId_ = input.readUInt32(); + break; + } + case 18: { + emu.grasscutter.net.proto.PlayerLocationInfoOuterClass.PlayerLocationInfo.Builder subBuilder = null; + if (playerLoc_ != null) { + subBuilder = playerLoc_.toBuilder(); + } + playerLoc_ = input.readMessage(emu.grasscutter.net.proto.PlayerLocationInfoOuterClass.PlayerLocationInfo.parser(), extensionRegistry); + if (subBuilder != null) { + subBuilder.mergeFrom(playerLoc_); + playerLoc_ = subBuilder.buildPartial(); + } + + break; + } + default: { + if (!parseUnknownField( + input, unknownFields, extensionRegistry, tag)) { + done = true; + } + break; + } + } + } + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(this); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException( + e).setUnfinishedMessage(this); + } finally { + this.unknownFields = unknownFields.build(); + makeExtensionsImmutable(); + } + } + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return emu.grasscutter.net.proto.WorldPlayerLocationInfoOuterClass.internal_static_WorldPlayerLocationInfo_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return emu.grasscutter.net.proto.WorldPlayerLocationInfoOuterClass.internal_static_WorldPlayerLocationInfo_fieldAccessorTable + .ensureFieldAccessorsInitialized( + emu.grasscutter.net.proto.WorldPlayerLocationInfoOuterClass.WorldPlayerLocationInfo.class, emu.grasscutter.net.proto.WorldPlayerLocationInfoOuterClass.WorldPlayerLocationInfo.Builder.class); + } + + public static final int SCENEID_FIELD_NUMBER = 1; + private int sceneId_; + /** + * uint32 sceneId = 1; + * @return The sceneId. + */ + @java.lang.Override + public int getSceneId() { + return sceneId_; + } + + public static final int PLAYERLOC_FIELD_NUMBER = 2; + private emu.grasscutter.net.proto.PlayerLocationInfoOuterClass.PlayerLocationInfo playerLoc_; + /** + * .PlayerLocationInfo playerLoc = 2; + * @return Whether the playerLoc field is set. + */ + @java.lang.Override + public boolean hasPlayerLoc() { + return playerLoc_ != null; + } + /** + * .PlayerLocationInfo playerLoc = 2; + * @return The playerLoc. + */ + @java.lang.Override + public emu.grasscutter.net.proto.PlayerLocationInfoOuterClass.PlayerLocationInfo getPlayerLoc() { + return playerLoc_ == null ? emu.grasscutter.net.proto.PlayerLocationInfoOuterClass.PlayerLocationInfo.getDefaultInstance() : playerLoc_; + } + /** + * .PlayerLocationInfo playerLoc = 2; + */ + @java.lang.Override + public emu.grasscutter.net.proto.PlayerLocationInfoOuterClass.PlayerLocationInfoOrBuilder getPlayerLocOrBuilder() { + return getPlayerLoc(); + } + + private byte memoizedIsInitialized = -1; + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) + throws java.io.IOException { + if (sceneId_ != 0) { + output.writeUInt32(1, sceneId_); + } + if (playerLoc_ != null) { + output.writeMessage(2, getPlayerLoc()); + } + unknownFields.writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (sceneId_ != 0) { + size += com.google.protobuf.CodedOutputStream + .computeUInt32Size(1, sceneId_); + } + if (playerLoc_ != null) { + size += com.google.protobuf.CodedOutputStream + .computeMessageSize(2, getPlayerLoc()); + } + size += unknownFields.getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof emu.grasscutter.net.proto.WorldPlayerLocationInfoOuterClass.WorldPlayerLocationInfo)) { + return super.equals(obj); + } + emu.grasscutter.net.proto.WorldPlayerLocationInfoOuterClass.WorldPlayerLocationInfo other = (emu.grasscutter.net.proto.WorldPlayerLocationInfoOuterClass.WorldPlayerLocationInfo) obj; + + if (getSceneId() + != other.getSceneId()) return false; + if (hasPlayerLoc() != other.hasPlayerLoc()) return false; + if (hasPlayerLoc()) { + if (!getPlayerLoc() + .equals(other.getPlayerLoc())) return false; + } + if (!unknownFields.equals(other.unknownFields)) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + hash = (37 * hash) + SCENEID_FIELD_NUMBER; + hash = (53 * hash) + getSceneId(); + if (hasPlayerLoc()) { + hash = (37 * hash) + PLAYERLOC_FIELD_NUMBER; + hash = (53 * hash) + getPlayerLoc().hashCode(); + } + hash = (29 * hash) + unknownFields.hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static emu.grasscutter.net.proto.WorldPlayerLocationInfoOuterClass.WorldPlayerLocationInfo parseFrom( + java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static emu.grasscutter.net.proto.WorldPlayerLocationInfoOuterClass.WorldPlayerLocationInfo parseFrom( + java.nio.ByteBuffer data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static emu.grasscutter.net.proto.WorldPlayerLocationInfoOuterClass.WorldPlayerLocationInfo parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static emu.grasscutter.net.proto.WorldPlayerLocationInfoOuterClass.WorldPlayerLocationInfo parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static emu.grasscutter.net.proto.WorldPlayerLocationInfoOuterClass.WorldPlayerLocationInfo parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static emu.grasscutter.net.proto.WorldPlayerLocationInfoOuterClass.WorldPlayerLocationInfo parseFrom( + byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static emu.grasscutter.net.proto.WorldPlayerLocationInfoOuterClass.WorldPlayerLocationInfo parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input); + } + public static emu.grasscutter.net.proto.WorldPlayerLocationInfoOuterClass.WorldPlayerLocationInfo parseFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input, extensionRegistry); + } + public static emu.grasscutter.net.proto.WorldPlayerLocationInfoOuterClass.WorldPlayerLocationInfo parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseDelimitedWithIOException(PARSER, input); + } + public static emu.grasscutter.net.proto.WorldPlayerLocationInfoOuterClass.WorldPlayerLocationInfo parseDelimitedFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseDelimitedWithIOException(PARSER, input, extensionRegistry); + } + public static emu.grasscutter.net.proto.WorldPlayerLocationInfoOuterClass.WorldPlayerLocationInfo parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input); + } + public static emu.grasscutter.net.proto.WorldPlayerLocationInfoOuterClass.WorldPlayerLocationInfo parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { return newBuilder(); } + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + public static Builder newBuilder(emu.grasscutter.net.proto.WorldPlayerLocationInfoOuterClass.WorldPlayerLocationInfo prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE + ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType( + com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * Protobuf type {@code WorldPlayerLocationInfo} + */ + public static final class Builder extends + com.google.protobuf.GeneratedMessageV3.Builder implements + // @@protoc_insertion_point(builder_implements:WorldPlayerLocationInfo) + emu.grasscutter.net.proto.WorldPlayerLocationInfoOuterClass.WorldPlayerLocationInfoOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return emu.grasscutter.net.proto.WorldPlayerLocationInfoOuterClass.internal_static_WorldPlayerLocationInfo_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return emu.grasscutter.net.proto.WorldPlayerLocationInfoOuterClass.internal_static_WorldPlayerLocationInfo_fieldAccessorTable + .ensureFieldAccessorsInitialized( + emu.grasscutter.net.proto.WorldPlayerLocationInfoOuterClass.WorldPlayerLocationInfo.class, emu.grasscutter.net.proto.WorldPlayerLocationInfoOuterClass.WorldPlayerLocationInfo.Builder.class); + } + + // Construct using emu.grasscutter.net.proto.WorldPlayerLocationInfoOuterClass.WorldPlayerLocationInfo.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder( + com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessageV3 + .alwaysUseFieldBuilders) { + } + } + @java.lang.Override + public Builder clear() { + super.clear(); + sceneId_ = 0; + + if (playerLocBuilder_ == null) { + playerLoc_ = null; + } else { + playerLoc_ = null; + playerLocBuilder_ = null; + } + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor + getDescriptorForType() { + return emu.grasscutter.net.proto.WorldPlayerLocationInfoOuterClass.internal_static_WorldPlayerLocationInfo_descriptor; + } + + @java.lang.Override + public emu.grasscutter.net.proto.WorldPlayerLocationInfoOuterClass.WorldPlayerLocationInfo getDefaultInstanceForType() { + return emu.grasscutter.net.proto.WorldPlayerLocationInfoOuterClass.WorldPlayerLocationInfo.getDefaultInstance(); + } + + @java.lang.Override + public emu.grasscutter.net.proto.WorldPlayerLocationInfoOuterClass.WorldPlayerLocationInfo build() { + emu.grasscutter.net.proto.WorldPlayerLocationInfoOuterClass.WorldPlayerLocationInfo result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public emu.grasscutter.net.proto.WorldPlayerLocationInfoOuterClass.WorldPlayerLocationInfo buildPartial() { + emu.grasscutter.net.proto.WorldPlayerLocationInfoOuterClass.WorldPlayerLocationInfo result = new emu.grasscutter.net.proto.WorldPlayerLocationInfoOuterClass.WorldPlayerLocationInfo(this); + result.sceneId_ = sceneId_; + if (playerLocBuilder_ == null) { + result.playerLoc_ = playerLoc_; + } else { + result.playerLoc_ = playerLocBuilder_.build(); + } + onBuilt(); + return result; + } + + @java.lang.Override + public Builder clone() { + return super.clone(); + } + @java.lang.Override + public Builder setField( + com.google.protobuf.Descriptors.FieldDescriptor field, + java.lang.Object value) { + return super.setField(field, value); + } + @java.lang.Override + public Builder clearField( + com.google.protobuf.Descriptors.FieldDescriptor field) { + return super.clearField(field); + } + @java.lang.Override + public Builder clearOneof( + com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return super.clearOneof(oneof); + } + @java.lang.Override + public Builder setRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, + int index, java.lang.Object value) { + return super.setRepeatedField(field, index, value); + } + @java.lang.Override + public Builder addRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, + java.lang.Object value) { + return super.addRepeatedField(field, value); + } + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof emu.grasscutter.net.proto.WorldPlayerLocationInfoOuterClass.WorldPlayerLocationInfo) { + return mergeFrom((emu.grasscutter.net.proto.WorldPlayerLocationInfoOuterClass.WorldPlayerLocationInfo)other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(emu.grasscutter.net.proto.WorldPlayerLocationInfoOuterClass.WorldPlayerLocationInfo other) { + if (other == emu.grasscutter.net.proto.WorldPlayerLocationInfoOuterClass.WorldPlayerLocationInfo.getDefaultInstance()) return this; + if (other.getSceneId() != 0) { + setSceneId(other.getSceneId()); + } + if (other.hasPlayerLoc()) { + mergePlayerLoc(other.getPlayerLoc()); + } + this.mergeUnknownFields(other.unknownFields); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + emu.grasscutter.net.proto.WorldPlayerLocationInfoOuterClass.WorldPlayerLocationInfo parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = (emu.grasscutter.net.proto.WorldPlayerLocationInfoOuterClass.WorldPlayerLocationInfo) e.getUnfinishedMessage(); + throw e.unwrapIOException(); + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + + private int sceneId_ ; + /** + * uint32 sceneId = 1; + * @return The sceneId. + */ + @java.lang.Override + public int getSceneId() { + return sceneId_; + } + /** + * uint32 sceneId = 1; + * @param value The sceneId to set. + * @return This builder for chaining. + */ + public Builder setSceneId(int value) { + + sceneId_ = value; + onChanged(); + return this; + } + /** + * uint32 sceneId = 1; + * @return This builder for chaining. + */ + public Builder clearSceneId() { + + sceneId_ = 0; + onChanged(); + return this; + } + + private emu.grasscutter.net.proto.PlayerLocationInfoOuterClass.PlayerLocationInfo playerLoc_; + private com.google.protobuf.SingleFieldBuilderV3< + emu.grasscutter.net.proto.PlayerLocationInfoOuterClass.PlayerLocationInfo, emu.grasscutter.net.proto.PlayerLocationInfoOuterClass.PlayerLocationInfo.Builder, emu.grasscutter.net.proto.PlayerLocationInfoOuterClass.PlayerLocationInfoOrBuilder> playerLocBuilder_; + /** + * .PlayerLocationInfo playerLoc = 2; + * @return Whether the playerLoc field is set. + */ + public boolean hasPlayerLoc() { + return playerLocBuilder_ != null || playerLoc_ != null; + } + /** + * .PlayerLocationInfo playerLoc = 2; + * @return The playerLoc. + */ + public emu.grasscutter.net.proto.PlayerLocationInfoOuterClass.PlayerLocationInfo getPlayerLoc() { + if (playerLocBuilder_ == null) { + return playerLoc_ == null ? emu.grasscutter.net.proto.PlayerLocationInfoOuterClass.PlayerLocationInfo.getDefaultInstance() : playerLoc_; + } else { + return playerLocBuilder_.getMessage(); + } + } + /** + * .PlayerLocationInfo playerLoc = 2; + */ + public Builder setPlayerLoc(emu.grasscutter.net.proto.PlayerLocationInfoOuterClass.PlayerLocationInfo value) { + if (playerLocBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + playerLoc_ = value; + onChanged(); + } else { + playerLocBuilder_.setMessage(value); + } + + return this; + } + /** + * .PlayerLocationInfo playerLoc = 2; + */ + public Builder setPlayerLoc( + emu.grasscutter.net.proto.PlayerLocationInfoOuterClass.PlayerLocationInfo.Builder builderForValue) { + if (playerLocBuilder_ == null) { + playerLoc_ = builderForValue.build(); + onChanged(); + } else { + playerLocBuilder_.setMessage(builderForValue.build()); + } + + return this; + } + /** + * .PlayerLocationInfo playerLoc = 2; + */ + public Builder mergePlayerLoc(emu.grasscutter.net.proto.PlayerLocationInfoOuterClass.PlayerLocationInfo value) { + if (playerLocBuilder_ == null) { + if (playerLoc_ != null) { + playerLoc_ = + emu.grasscutter.net.proto.PlayerLocationInfoOuterClass.PlayerLocationInfo.newBuilder(playerLoc_).mergeFrom(value).buildPartial(); + } else { + playerLoc_ = value; + } + onChanged(); + } else { + playerLocBuilder_.mergeFrom(value); + } + + return this; + } + /** + * .PlayerLocationInfo playerLoc = 2; + */ + public Builder clearPlayerLoc() { + if (playerLocBuilder_ == null) { + playerLoc_ = null; + onChanged(); + } else { + playerLoc_ = null; + playerLocBuilder_ = null; + } + + return this; + } + /** + * .PlayerLocationInfo playerLoc = 2; + */ + public emu.grasscutter.net.proto.PlayerLocationInfoOuterClass.PlayerLocationInfo.Builder getPlayerLocBuilder() { + + onChanged(); + return getPlayerLocFieldBuilder().getBuilder(); + } + /** + * .PlayerLocationInfo playerLoc = 2; + */ + public emu.grasscutter.net.proto.PlayerLocationInfoOuterClass.PlayerLocationInfoOrBuilder getPlayerLocOrBuilder() { + if (playerLocBuilder_ != null) { + return playerLocBuilder_.getMessageOrBuilder(); + } else { + return playerLoc_ == null ? + emu.grasscutter.net.proto.PlayerLocationInfoOuterClass.PlayerLocationInfo.getDefaultInstance() : playerLoc_; + } + } + /** + * .PlayerLocationInfo playerLoc = 2; + */ + private com.google.protobuf.SingleFieldBuilderV3< + emu.grasscutter.net.proto.PlayerLocationInfoOuterClass.PlayerLocationInfo, emu.grasscutter.net.proto.PlayerLocationInfoOuterClass.PlayerLocationInfo.Builder, emu.grasscutter.net.proto.PlayerLocationInfoOuterClass.PlayerLocationInfoOrBuilder> + getPlayerLocFieldBuilder() { + if (playerLocBuilder_ == null) { + playerLocBuilder_ = new com.google.protobuf.SingleFieldBuilderV3< + emu.grasscutter.net.proto.PlayerLocationInfoOuterClass.PlayerLocationInfo, emu.grasscutter.net.proto.PlayerLocationInfoOuterClass.PlayerLocationInfo.Builder, emu.grasscutter.net.proto.PlayerLocationInfoOuterClass.PlayerLocationInfoOrBuilder>( + getPlayerLoc(), + getParentForChildren(), + isClean()); + playerLoc_ = null; + } + return playerLocBuilder_; + } + @java.lang.Override + public final Builder setUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.setUnknownFields(unknownFields); + } + + @java.lang.Override + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } + + + // @@protoc_insertion_point(builder_scope:WorldPlayerLocationInfo) + } + + // @@protoc_insertion_point(class_scope:WorldPlayerLocationInfo) + private static final emu.grasscutter.net.proto.WorldPlayerLocationInfoOuterClass.WorldPlayerLocationInfo DEFAULT_INSTANCE; + static { + DEFAULT_INSTANCE = new emu.grasscutter.net.proto.WorldPlayerLocationInfoOuterClass.WorldPlayerLocationInfo(); + } + + public static emu.grasscutter.net.proto.WorldPlayerLocationInfoOuterClass.WorldPlayerLocationInfo getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser + PARSER = new com.google.protobuf.AbstractParser() { + @java.lang.Override + public WorldPlayerLocationInfo parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new WorldPlayerLocationInfo(input, extensionRegistry); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public emu.grasscutter.net.proto.WorldPlayerLocationInfoOuterClass.WorldPlayerLocationInfo getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } + + } + + private static final com.google.protobuf.Descriptors.Descriptor + internal_static_WorldPlayerLocationInfo_descriptor; + private static final + com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_WorldPlayerLocationInfo_fieldAccessorTable; + + public static com.google.protobuf.Descriptors.FileDescriptor + getDescriptor() { + return descriptor; + } + private static com.google.protobuf.Descriptors.FileDescriptor + descriptor; + static { + java.lang.String[] descriptorData = { + "\n\035WorldPlayerLocationInfo.proto\032\030PlayerL" + + "ocationInfo.proto\"R\n\027WorldPlayerLocation" + + "Info\022\017\n\007sceneId\030\001 \001(\r\022&\n\tplayerLoc\030\002 \001(\013" + + "2\023.PlayerLocationInfoB\033\n\031emu.grasscutter" + + ".net.protob\006proto3" + }; + descriptor = com.google.protobuf.Descriptors.FileDescriptor + .internalBuildGeneratedFileFrom(descriptorData, + new com.google.protobuf.Descriptors.FileDescriptor[] { + emu.grasscutter.net.proto.PlayerLocationInfoOuterClass.getDescriptor(), + }); + internal_static_WorldPlayerLocationInfo_descriptor = + getDescriptor().getMessageTypes().get(0); + internal_static_WorldPlayerLocationInfo_fieldAccessorTable = new + com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_WorldPlayerLocationInfo_descriptor, + new java.lang.String[] { "SceneId", "PlayerLoc", }); + emu.grasscutter.net.proto.PlayerLocationInfoOuterClass.getDescriptor(); + } + + // @@protoc_insertion_point(outer_class_scope) +} diff --git a/src/main/java/emu/grasscutter/net/proto/WorldPlayerLocationNotifyOuterClass.java b/src/main/java/emu/grasscutter/net/proto/WorldPlayerLocationNotifyOuterClass.java index fb3321673..89859a9d1 100644 --- a/src/main/java/emu/grasscutter/net/proto/WorldPlayerLocationNotifyOuterClass.java +++ b/src/main/java/emu/grasscutter/net/proto/WorldPlayerLocationNotifyOuterClass.java @@ -19,27 +19,27 @@ public final class WorldPlayerLocationNotifyOuterClass { com.google.protobuf.MessageOrBuilder { /** - * repeated .PlayerLocationInfo playerLocList = 1; + * repeated .WorldPlayerLocationInfo playerLocList = 2; */ - java.util.List + java.util.List getPlayerLocListList(); /** - * repeated .PlayerLocationInfo playerLocList = 1; + * repeated .WorldPlayerLocationInfo playerLocList = 2; */ - emu.grasscutter.net.proto.PlayerLocationInfoOuterClass.PlayerLocationInfo getPlayerLocList(int index); + emu.grasscutter.net.proto.WorldPlayerLocationInfoOuterClass.WorldPlayerLocationInfo getPlayerLocList(int index); /** - * repeated .PlayerLocationInfo playerLocList = 1; + * repeated .WorldPlayerLocationInfo playerLocList = 2; */ int getPlayerLocListCount(); /** - * repeated .PlayerLocationInfo playerLocList = 1; + * repeated .WorldPlayerLocationInfo playerLocList = 2; */ - java.util.List + java.util.List getPlayerLocListOrBuilderList(); /** - * repeated .PlayerLocationInfo playerLocList = 1; + * repeated .WorldPlayerLocationInfo playerLocList = 2; */ - emu.grasscutter.net.proto.PlayerLocationInfoOuterClass.PlayerLocationInfoOrBuilder getPlayerLocListOrBuilder( + emu.grasscutter.net.proto.WorldPlayerLocationInfoOuterClass.WorldPlayerLocationInfoOrBuilder getPlayerLocListOrBuilder( int index); } /** @@ -89,13 +89,13 @@ public final class WorldPlayerLocationNotifyOuterClass { case 0: done = true; break; - case 10: { + case 18: { if (!((mutable_bitField0_ & 0x00000001) != 0)) { - playerLocList_ = new java.util.ArrayList(); + playerLocList_ = new java.util.ArrayList(); mutable_bitField0_ |= 0x00000001; } playerLocList_.add( - input.readMessage(emu.grasscutter.net.proto.PlayerLocationInfoOuterClass.PlayerLocationInfo.parser(), extensionRegistry)); + input.readMessage(emu.grasscutter.net.proto.WorldPlayerLocationInfoOuterClass.WorldPlayerLocationInfo.parser(), extensionRegistry)); break; } default: { @@ -133,42 +133,42 @@ public final class WorldPlayerLocationNotifyOuterClass { emu.grasscutter.net.proto.WorldPlayerLocationNotifyOuterClass.WorldPlayerLocationNotify.class, emu.grasscutter.net.proto.WorldPlayerLocationNotifyOuterClass.WorldPlayerLocationNotify.Builder.class); } - public static final int PLAYERLOCLIST_FIELD_NUMBER = 1; - private java.util.List playerLocList_; + public static final int PLAYERLOCLIST_FIELD_NUMBER = 2; + private java.util.List playerLocList_; /** - * repeated .PlayerLocationInfo playerLocList = 1; + * repeated .WorldPlayerLocationInfo playerLocList = 2; */ @java.lang.Override - public java.util.List getPlayerLocListList() { + public java.util.List getPlayerLocListList() { return playerLocList_; } /** - * repeated .PlayerLocationInfo playerLocList = 1; + * repeated .WorldPlayerLocationInfo playerLocList = 2; */ @java.lang.Override - public java.util.List + public java.util.List getPlayerLocListOrBuilderList() { return playerLocList_; } /** - * repeated .PlayerLocationInfo playerLocList = 1; + * repeated .WorldPlayerLocationInfo playerLocList = 2; */ @java.lang.Override public int getPlayerLocListCount() { return playerLocList_.size(); } /** - * repeated .PlayerLocationInfo playerLocList = 1; + * repeated .WorldPlayerLocationInfo playerLocList = 2; */ @java.lang.Override - public emu.grasscutter.net.proto.PlayerLocationInfoOuterClass.PlayerLocationInfo getPlayerLocList(int index) { + public emu.grasscutter.net.proto.WorldPlayerLocationInfoOuterClass.WorldPlayerLocationInfo getPlayerLocList(int index) { return playerLocList_.get(index); } /** - * repeated .PlayerLocationInfo playerLocList = 1; + * repeated .WorldPlayerLocationInfo playerLocList = 2; */ @java.lang.Override - public emu.grasscutter.net.proto.PlayerLocationInfoOuterClass.PlayerLocationInfoOrBuilder getPlayerLocListOrBuilder( + public emu.grasscutter.net.proto.WorldPlayerLocationInfoOuterClass.WorldPlayerLocationInfoOrBuilder getPlayerLocListOrBuilder( int index) { return playerLocList_.get(index); } @@ -188,7 +188,7 @@ public final class WorldPlayerLocationNotifyOuterClass { public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { for (int i = 0; i < playerLocList_.size(); i++) { - output.writeMessage(1, playerLocList_.get(i)); + output.writeMessage(2, playerLocList_.get(i)); } unknownFields.writeTo(output); } @@ -201,7 +201,7 @@ public final class WorldPlayerLocationNotifyOuterClass { size = 0; for (int i = 0; i < playerLocList_.size(); i++) { size += com.google.protobuf.CodedOutputStream - .computeMessageSize(1, playerLocList_.get(i)); + .computeMessageSize(2, playerLocList_.get(i)); } size += unknownFields.getSerializedSize(); memoizedSize = size; @@ -515,22 +515,22 @@ public final class WorldPlayerLocationNotifyOuterClass { } private int bitField0_; - private java.util.List playerLocList_ = + private java.util.List playerLocList_ = java.util.Collections.emptyList(); private void ensurePlayerLocListIsMutable() { if (!((bitField0_ & 0x00000001) != 0)) { - playerLocList_ = new java.util.ArrayList(playerLocList_); + playerLocList_ = new java.util.ArrayList(playerLocList_); bitField0_ |= 0x00000001; } } private com.google.protobuf.RepeatedFieldBuilderV3< - emu.grasscutter.net.proto.PlayerLocationInfoOuterClass.PlayerLocationInfo, emu.grasscutter.net.proto.PlayerLocationInfoOuterClass.PlayerLocationInfo.Builder, emu.grasscutter.net.proto.PlayerLocationInfoOuterClass.PlayerLocationInfoOrBuilder> playerLocListBuilder_; + emu.grasscutter.net.proto.WorldPlayerLocationInfoOuterClass.WorldPlayerLocationInfo, emu.grasscutter.net.proto.WorldPlayerLocationInfoOuterClass.WorldPlayerLocationInfo.Builder, emu.grasscutter.net.proto.WorldPlayerLocationInfoOuterClass.WorldPlayerLocationInfoOrBuilder> playerLocListBuilder_; /** - * repeated .PlayerLocationInfo playerLocList = 1; + * repeated .WorldPlayerLocationInfo playerLocList = 2; */ - public java.util.List getPlayerLocListList() { + public java.util.List getPlayerLocListList() { if (playerLocListBuilder_ == null) { return java.util.Collections.unmodifiableList(playerLocList_); } else { @@ -538,7 +538,7 @@ public final class WorldPlayerLocationNotifyOuterClass { } } /** - * repeated .PlayerLocationInfo playerLocList = 1; + * repeated .WorldPlayerLocationInfo playerLocList = 2; */ public int getPlayerLocListCount() { if (playerLocListBuilder_ == null) { @@ -548,9 +548,9 @@ public final class WorldPlayerLocationNotifyOuterClass { } } /** - * repeated .PlayerLocationInfo playerLocList = 1; + * repeated .WorldPlayerLocationInfo playerLocList = 2; */ - public emu.grasscutter.net.proto.PlayerLocationInfoOuterClass.PlayerLocationInfo getPlayerLocList(int index) { + public emu.grasscutter.net.proto.WorldPlayerLocationInfoOuterClass.WorldPlayerLocationInfo getPlayerLocList(int index) { if (playerLocListBuilder_ == null) { return playerLocList_.get(index); } else { @@ -558,10 +558,10 @@ public final class WorldPlayerLocationNotifyOuterClass { } } /** - * repeated .PlayerLocationInfo playerLocList = 1; + * repeated .WorldPlayerLocationInfo playerLocList = 2; */ public Builder setPlayerLocList( - int index, emu.grasscutter.net.proto.PlayerLocationInfoOuterClass.PlayerLocationInfo value) { + int index, emu.grasscutter.net.proto.WorldPlayerLocationInfoOuterClass.WorldPlayerLocationInfo value) { if (playerLocListBuilder_ == null) { if (value == null) { throw new NullPointerException(); @@ -575,10 +575,10 @@ public final class WorldPlayerLocationNotifyOuterClass { return this; } /** - * repeated .PlayerLocationInfo playerLocList = 1; + * repeated .WorldPlayerLocationInfo playerLocList = 2; */ public Builder setPlayerLocList( - int index, emu.grasscutter.net.proto.PlayerLocationInfoOuterClass.PlayerLocationInfo.Builder builderForValue) { + int index, emu.grasscutter.net.proto.WorldPlayerLocationInfoOuterClass.WorldPlayerLocationInfo.Builder builderForValue) { if (playerLocListBuilder_ == null) { ensurePlayerLocListIsMutable(); playerLocList_.set(index, builderForValue.build()); @@ -589,9 +589,9 @@ public final class WorldPlayerLocationNotifyOuterClass { return this; } /** - * repeated .PlayerLocationInfo playerLocList = 1; + * repeated .WorldPlayerLocationInfo playerLocList = 2; */ - public Builder addPlayerLocList(emu.grasscutter.net.proto.PlayerLocationInfoOuterClass.PlayerLocationInfo value) { + public Builder addPlayerLocList(emu.grasscutter.net.proto.WorldPlayerLocationInfoOuterClass.WorldPlayerLocationInfo value) { if (playerLocListBuilder_ == null) { if (value == null) { throw new NullPointerException(); @@ -605,10 +605,10 @@ public final class WorldPlayerLocationNotifyOuterClass { return this; } /** - * repeated .PlayerLocationInfo playerLocList = 1; + * repeated .WorldPlayerLocationInfo playerLocList = 2; */ public Builder addPlayerLocList( - int index, emu.grasscutter.net.proto.PlayerLocationInfoOuterClass.PlayerLocationInfo value) { + int index, emu.grasscutter.net.proto.WorldPlayerLocationInfoOuterClass.WorldPlayerLocationInfo value) { if (playerLocListBuilder_ == null) { if (value == null) { throw new NullPointerException(); @@ -622,10 +622,10 @@ public final class WorldPlayerLocationNotifyOuterClass { return this; } /** - * repeated .PlayerLocationInfo playerLocList = 1; + * repeated .WorldPlayerLocationInfo playerLocList = 2; */ public Builder addPlayerLocList( - emu.grasscutter.net.proto.PlayerLocationInfoOuterClass.PlayerLocationInfo.Builder builderForValue) { + emu.grasscutter.net.proto.WorldPlayerLocationInfoOuterClass.WorldPlayerLocationInfo.Builder builderForValue) { if (playerLocListBuilder_ == null) { ensurePlayerLocListIsMutable(); playerLocList_.add(builderForValue.build()); @@ -636,10 +636,10 @@ public final class WorldPlayerLocationNotifyOuterClass { return this; } /** - * repeated .PlayerLocationInfo playerLocList = 1; + * repeated .WorldPlayerLocationInfo playerLocList = 2; */ public Builder addPlayerLocList( - int index, emu.grasscutter.net.proto.PlayerLocationInfoOuterClass.PlayerLocationInfo.Builder builderForValue) { + int index, emu.grasscutter.net.proto.WorldPlayerLocationInfoOuterClass.WorldPlayerLocationInfo.Builder builderForValue) { if (playerLocListBuilder_ == null) { ensurePlayerLocListIsMutable(); playerLocList_.add(index, builderForValue.build()); @@ -650,10 +650,10 @@ public final class WorldPlayerLocationNotifyOuterClass { return this; } /** - * repeated .PlayerLocationInfo playerLocList = 1; + * repeated .WorldPlayerLocationInfo playerLocList = 2; */ public Builder addAllPlayerLocList( - java.lang.Iterable values) { + java.lang.Iterable values) { if (playerLocListBuilder_ == null) { ensurePlayerLocListIsMutable(); com.google.protobuf.AbstractMessageLite.Builder.addAll( @@ -665,7 +665,7 @@ public final class WorldPlayerLocationNotifyOuterClass { return this; } /** - * repeated .PlayerLocationInfo playerLocList = 1; + * repeated .WorldPlayerLocationInfo playerLocList = 2; */ public Builder clearPlayerLocList() { if (playerLocListBuilder_ == null) { @@ -678,7 +678,7 @@ public final class WorldPlayerLocationNotifyOuterClass { return this; } /** - * repeated .PlayerLocationInfo playerLocList = 1; + * repeated .WorldPlayerLocationInfo playerLocList = 2; */ public Builder removePlayerLocList(int index) { if (playerLocListBuilder_ == null) { @@ -691,16 +691,16 @@ public final class WorldPlayerLocationNotifyOuterClass { return this; } /** - * repeated .PlayerLocationInfo playerLocList = 1; + * repeated .WorldPlayerLocationInfo playerLocList = 2; */ - public emu.grasscutter.net.proto.PlayerLocationInfoOuterClass.PlayerLocationInfo.Builder getPlayerLocListBuilder( + public emu.grasscutter.net.proto.WorldPlayerLocationInfoOuterClass.WorldPlayerLocationInfo.Builder getPlayerLocListBuilder( int index) { return getPlayerLocListFieldBuilder().getBuilder(index); } /** - * repeated .PlayerLocationInfo playerLocList = 1; + * repeated .WorldPlayerLocationInfo playerLocList = 2; */ - public emu.grasscutter.net.proto.PlayerLocationInfoOuterClass.PlayerLocationInfoOrBuilder getPlayerLocListOrBuilder( + public emu.grasscutter.net.proto.WorldPlayerLocationInfoOuterClass.WorldPlayerLocationInfoOrBuilder getPlayerLocListOrBuilder( int index) { if (playerLocListBuilder_ == null) { return playerLocList_.get(index); } else { @@ -708,9 +708,9 @@ public final class WorldPlayerLocationNotifyOuterClass { } } /** - * repeated .PlayerLocationInfo playerLocList = 1; + * repeated .WorldPlayerLocationInfo playerLocList = 2; */ - public java.util.List + public java.util.List getPlayerLocListOrBuilderList() { if (playerLocListBuilder_ != null) { return playerLocListBuilder_.getMessageOrBuilderList(); @@ -719,33 +719,33 @@ public final class WorldPlayerLocationNotifyOuterClass { } } /** - * repeated .PlayerLocationInfo playerLocList = 1; + * repeated .WorldPlayerLocationInfo playerLocList = 2; */ - public emu.grasscutter.net.proto.PlayerLocationInfoOuterClass.PlayerLocationInfo.Builder addPlayerLocListBuilder() { + public emu.grasscutter.net.proto.WorldPlayerLocationInfoOuterClass.WorldPlayerLocationInfo.Builder addPlayerLocListBuilder() { return getPlayerLocListFieldBuilder().addBuilder( - emu.grasscutter.net.proto.PlayerLocationInfoOuterClass.PlayerLocationInfo.getDefaultInstance()); + emu.grasscutter.net.proto.WorldPlayerLocationInfoOuterClass.WorldPlayerLocationInfo.getDefaultInstance()); } /** - * repeated .PlayerLocationInfo playerLocList = 1; + * repeated .WorldPlayerLocationInfo playerLocList = 2; */ - public emu.grasscutter.net.proto.PlayerLocationInfoOuterClass.PlayerLocationInfo.Builder addPlayerLocListBuilder( + public emu.grasscutter.net.proto.WorldPlayerLocationInfoOuterClass.WorldPlayerLocationInfo.Builder addPlayerLocListBuilder( int index) { return getPlayerLocListFieldBuilder().addBuilder( - index, emu.grasscutter.net.proto.PlayerLocationInfoOuterClass.PlayerLocationInfo.getDefaultInstance()); + index, emu.grasscutter.net.proto.WorldPlayerLocationInfoOuterClass.WorldPlayerLocationInfo.getDefaultInstance()); } /** - * repeated .PlayerLocationInfo playerLocList = 1; + * repeated .WorldPlayerLocationInfo playerLocList = 2; */ - public java.util.List + public java.util.List getPlayerLocListBuilderList() { return getPlayerLocListFieldBuilder().getBuilderList(); } private com.google.protobuf.RepeatedFieldBuilderV3< - emu.grasscutter.net.proto.PlayerLocationInfoOuterClass.PlayerLocationInfo, emu.grasscutter.net.proto.PlayerLocationInfoOuterClass.PlayerLocationInfo.Builder, emu.grasscutter.net.proto.PlayerLocationInfoOuterClass.PlayerLocationInfoOrBuilder> + emu.grasscutter.net.proto.WorldPlayerLocationInfoOuterClass.WorldPlayerLocationInfo, emu.grasscutter.net.proto.WorldPlayerLocationInfoOuterClass.WorldPlayerLocationInfo.Builder, emu.grasscutter.net.proto.WorldPlayerLocationInfoOuterClass.WorldPlayerLocationInfoOrBuilder> getPlayerLocListFieldBuilder() { if (playerLocListBuilder_ == null) { playerLocListBuilder_ = new com.google.protobuf.RepeatedFieldBuilderV3< - emu.grasscutter.net.proto.PlayerLocationInfoOuterClass.PlayerLocationInfo, emu.grasscutter.net.proto.PlayerLocationInfoOuterClass.PlayerLocationInfo.Builder, emu.grasscutter.net.proto.PlayerLocationInfoOuterClass.PlayerLocationInfoOrBuilder>( + emu.grasscutter.net.proto.WorldPlayerLocationInfoOuterClass.WorldPlayerLocationInfo, emu.grasscutter.net.proto.WorldPlayerLocationInfoOuterClass.WorldPlayerLocationInfo.Builder, emu.grasscutter.net.proto.WorldPlayerLocationInfoOuterClass.WorldPlayerLocationInfoOrBuilder>( playerLocList_, ((bitField0_ & 0x00000001) != 0), getParentForChildren(), @@ -821,16 +821,16 @@ public final class WorldPlayerLocationNotifyOuterClass { descriptor; static { java.lang.String[] descriptorData = { - "\n\037WorldPlayerLocationNotify.proto\032\030Playe" + - "rLocationInfo.proto\"G\n\031WorldPlayerLocati" + - "onNotify\022*\n\rplayerLocList\030\001 \003(\0132\023.Player" + - "LocationInfoB\033\n\031emu.grasscutter.net.prot" + - "ob\006proto3" + "\n\037WorldPlayerLocationNotify.proto\032\035World" + + "PlayerLocationInfo.proto\"L\n\031WorldPlayerL" + + "ocationNotify\022/\n\rplayerLocList\030\002 \003(\0132\030.W" + + "orldPlayerLocationInfoB\033\n\031emu.grasscutte" + + "r.net.protob\006proto3" }; descriptor = com.google.protobuf.Descriptors.FileDescriptor .internalBuildGeneratedFileFrom(descriptorData, new com.google.protobuf.Descriptors.FileDescriptor[] { - emu.grasscutter.net.proto.PlayerLocationInfoOuterClass.getDescriptor(), + emu.grasscutter.net.proto.WorldPlayerLocationInfoOuterClass.getDescriptor(), }); internal_static_WorldPlayerLocationNotify_descriptor = getDescriptor().getMessageTypes().get(0); @@ -838,7 +838,7 @@ public final class WorldPlayerLocationNotifyOuterClass { com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( internal_static_WorldPlayerLocationNotify_descriptor, new java.lang.String[] { "PlayerLocList", }); - emu.grasscutter.net.proto.PlayerLocationInfoOuterClass.getDescriptor(); + emu.grasscutter.net.proto.WorldPlayerLocationInfoOuterClass.getDescriptor(); } // @@protoc_insertion_point(outer_class_scope) diff --git a/src/main/java/emu/grasscutter/server/dispatch/DispatchServer.java b/src/main/java/emu/grasscutter/server/dispatch/DispatchServer.java index 53699b05b..6b2661def 100644 --- a/src/main/java/emu/grasscutter/server/dispatch/DispatchServer.java +++ b/src/main/java/emu/grasscutter/server/dispatch/DispatchServer.java @@ -456,7 +456,7 @@ public final class DispatchServer { Grasscutter.getLogger().info("Dispatch server started on port " + getAddress().getPort()); // Logging servers - HttpServer overseaLogServer = HttpServer.create(new InetSocketAddress(Grasscutter.getConfig().getDispatchOptions().Ip, 8888), 0); + HttpServer overseaLogServer = HttpServer.create(new InetSocketAddress(Grasscutter.getConfig().getDispatchOptions().Ip, Grasscutter.getConfig().getDispatchOptions().OverseaLogPort), 0); overseaLogServer.createContext( // overseauspider.yuanshen.com "/log", new DispatchHttpJsonHandler("{\"code\":0}") 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 5b56a39f4..2f7da6884 100644 --- a/src/main/java/emu/grasscutter/server/packet/recv/HandlerEnterSceneDoneReq.java +++ b/src/main/java/emu/grasscutter/server/packet/recv/HandlerEnterSceneDoneReq.java @@ -31,8 +31,11 @@ public class HandlerEnterSceneDoneReq extends PacketHandler { // Locations session.send(new PacketWorldPlayerLocationNotify(session.getPlayer().getWorld())); - session.send(new PacketScenePlayerLocationNotify(session.getPlayer())); + session.send(new PacketScenePlayerLocationNotify(session.getPlayer().getScene())); session.send(new PacketWorldPlayerRTTNotify(session.getPlayer().getWorld())); + + // Reset timer for sending player locations + session.getPlayer().resetSendPlayerLocTime(); } } diff --git a/src/main/java/emu/grasscutter/server/packet/recv/HandlerGetPlayerTokenReq.java b/src/main/java/emu/grasscutter/server/packet/recv/HandlerGetPlayerTokenReq.java index dc686f5c1..5034fb01a 100644 --- a/src/main/java/emu/grasscutter/server/packet/recv/HandlerGetPlayerTokenReq.java +++ b/src/main/java/emu/grasscutter/server/packet/recv/HandlerGetPlayerTokenReq.java @@ -35,15 +35,15 @@ public class HandlerGetPlayerTokenReq extends PacketHandler { // Has character boolean doesPlayerExist = false; - if (account.getPlayerId() > 0) { + if (account.getPlayerUid() > 0) { // Set flag for player existing - doesPlayerExist = DatabaseHelper.checkPlayerExists(account.getPlayerId()); + doesPlayerExist = DatabaseHelper.checkPlayerExists(account.getPlayerUid()); } // Set reserve player id if account doesnt exist if (!doesPlayerExist) { - int id = DatabaseHelper.getNextPlayerId(session.getAccount().getPlayerId()); - if (id != session.getAccount().getPlayerId()) { + int id = DatabaseHelper.getNextPlayerId(session.getAccount().getPlayerUid()); + if (id != session.getAccount().getPlayerUid()) { session.getAccount().setPlayerId(id); session.getAccount().save(); } 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 183ef7461..05753aec0 100644 --- a/src/main/java/emu/grasscutter/server/packet/recv/HandlerPlayerLoginReq.java +++ b/src/main/java/emu/grasscutter/server/packet/recv/HandlerPlayerLoginReq.java @@ -30,7 +30,7 @@ public class HandlerPlayerLoginReq extends PacketHandler { } // Load character from db - GenshinPlayer player = DatabaseHelper.getPlayerById(session.getAccount().getPlayerId()); + GenshinPlayer player = DatabaseHelper.getPlayerById(session.getAccount().getPlayerUid()); if (player == null) { // Send packets 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 619a37b1e..f01f5980d 100644 --- a/src/main/java/emu/grasscutter/server/packet/recv/HandlerSceneTransToPointReq.java +++ b/src/main/java/emu/grasscutter/server/packet/recv/HandlerSceneTransToPointReq.java @@ -1,11 +1,15 @@ package emu.grasscutter.server.packet.recv; +import emu.grasscutter.data.GenshinData; +import emu.grasscutter.data.custom.ScenePointEntry; import emu.grasscutter.net.packet.Opcodes; import emu.grasscutter.net.packet.PacketOpcodes; import emu.grasscutter.net.proto.SceneTransToPointReqOuterClass.SceneTransToPointReq; +import emu.grasscutter.net.proto.SceneTransToPointRspOuterClass.SceneTransToPointRsp; import emu.grasscutter.net.packet.PacketHandler; import emu.grasscutter.server.game.GameSession; import emu.grasscutter.server.packet.send.PacketSceneTransToPointRsp; +import emu.grasscutter.utils.Position; @Opcodes(PacketOpcodes.SceneTransToPointReq) public class HandlerSceneTransToPointReq extends PacketHandler { @@ -13,7 +17,20 @@ public class HandlerSceneTransToPointReq extends PacketHandler { @Override public void handle(GameSession session, byte[] header, byte[] payload) throws Exception { SceneTransToPointReq req = SceneTransToPointReq.parseFrom(payload); - session.send(new PacketSceneTransToPointRsp(session.getPlayer(), req.getPointId(), req.getSceneId())); + + String code = req.getSceneId() + "_" + req.getPointId(); + ScenePointEntry scenePointEntry = GenshinData.getScenePointEntries().get(code); + + if (scenePointEntry != null) { + float x = scenePointEntry.getPointData().getTranPos().getX(); + float y = scenePointEntry.getPointData().getTranPos().getY(); + float z = scenePointEntry.getPointData().getTranPos().getZ(); + + session.getPlayer().getWorld().transferPlayerToScene(session.getPlayer(), req.getSceneId(), new Position(x, y, z)); + session.send(new PacketSceneTransToPointRsp(session.getPlayer(), req.getPointId(), req.getSceneId())); + } else { + session.send(new PacketSceneTransToPointRsp()); + } } } 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 1a60f677b..d194e1465 100644 --- a/src/main/java/emu/grasscutter/server/packet/recv/HandlerSetEntityClientDataNotify.java +++ b/src/main/java/emu/grasscutter/server/packet/recv/HandlerSetEntityClientDataNotify.java @@ -3,6 +3,7 @@ package emu.grasscutter.server.packet.recv; import emu.grasscutter.net.packet.GenshinPacket; import emu.grasscutter.net.packet.Opcodes; import emu.grasscutter.net.packet.PacketOpcodes; +import emu.grasscutter.net.proto.SetEntityClientDataNotifyOuterClass.SetEntityClientDataNotify; import emu.grasscutter.net.packet.PacketHandler; import emu.grasscutter.server.game.GameSession; @@ -16,8 +17,11 @@ public class HandlerSetEntityClientDataNotify extends PacketHandler { return; } + // 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); - packet.setData(payload); + 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 5cbbd8d04..72fc709d9 100644 --- a/src/main/java/emu/grasscutter/server/packet/recv/HandlerSetPlayerBornDataReq.java +++ b/src/main/java/emu/grasscutter/server/packet/recv/HandlerSetPlayerBornDataReq.java @@ -43,7 +43,7 @@ public class HandlerSetPlayerBornDataReq extends PacketHandler { try { // Save to db - DatabaseHelper.createPlayer(player, session.getAccount().getPlayerId()); + DatabaseHelper.createPlayer(player, session.getAccount().getPlayerUid()); // Create avatar if (player.getAvatars().getAvatarCount() == 0) { 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 a6e1fb452..d8cdfdef8 100644 --- a/src/main/java/emu/grasscutter/server/packet/send/PacketAbilityChangeNotify.java +++ b/src/main/java/emu/grasscutter/server/packet/send/PacketAbilityChangeNotify.java @@ -8,8 +8,8 @@ import emu.grasscutter.net.proto.AbilityChangeNotifyOuterClass.AbilityChangeNoti public class PacketAbilityChangeNotify extends GenshinPacket { public PacketAbilityChangeNotify(EntityAvatar entity) { - super(PacketOpcodes.AbilityChangeNotify); - + super(PacketOpcodes.AbilityChangeNotify, true); + AbilityChangeNotify proto = AbilityChangeNotify.newBuilder() .setEntityId(entity.getId()) .setAbilityControlBlock(entity.getAbilityControlBlock()) 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 9df89af5f..4d22f9603 100644 --- a/src/main/java/emu/grasscutter/server/packet/send/PacketGetPlayerFriendListRsp.java +++ b/src/main/java/emu/grasscutter/server/packet/send/PacketGetPlayerFriendListRsp.java @@ -23,7 +23,6 @@ public class PacketGetPlayerFriendListRsp extends GenshinPacket { .setWorldLevel(0) .setSignature("") .setLastActiveTime((int) (System.currentTimeMillis() / 1000f)) - .setIsMpModeAvailable(true) .setNameCardId(210001) .setOnlineState(FriendOnlineState.FRIEND_ONLINE) .setParam(1) 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 2306aa0ae..00f512ea7 100644 --- a/src/main/java/emu/grasscutter/server/packet/send/PacketGetPlayerTokenRsp.java +++ b/src/main/java/emu/grasscutter/server/packet/send/PacketGetPlayerTokenRsp.java @@ -16,7 +16,7 @@ public class PacketGetPlayerTokenRsp extends GenshinPacket { this.setUseDispatchKey(true); GetPlayerTokenRsp p = GetPlayerTokenRsp.newBuilder() - .setPlayerUid(session.getAccount().getPlayerId()) + .setPlayerUid(session.getAccount().getPlayerUid()) .setAccountToken(session.getAccount().getToken()) .setAccountType(1) .setIsProficientPlayer(doesPlayerExist) // Not sure where this goes 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 f6fa9b8f0..2e9fb479d 100644 --- a/src/main/java/emu/grasscutter/server/packet/send/PacketScenePlayerLocationNotify.java +++ b/src/main/java/emu/grasscutter/server/packet/send/PacketScenePlayerLocationNotify.java @@ -1,19 +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.net.packet.PacketOpcodes; import emu.grasscutter.net.proto.ScenePlayerLocationNotifyOuterClass.ScenePlayerLocationNotify; public class PacketScenePlayerLocationNotify extends GenshinPacket { - public PacketScenePlayerLocationNotify(GenshinPlayer player) { + public PacketScenePlayerLocationNotify(GenshinScene scene) { super(PacketOpcodes.ScenePlayerLocationNotify); ScenePlayerLocationNotify.Builder proto = ScenePlayerLocationNotify.newBuilder() - .setSceneId(player.getSceneId()); + .setSceneId(scene.getId()); - for (GenshinPlayer p : player.getWorld().getPlayers()) { + for (GenshinPlayer p : scene.getPlayers()) { proto.addPlayerLocList(p.getPlayerLocationInfo()); } 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 965c6aa6b..4795c5e9f 100644 --- a/src/main/java/emu/grasscutter/server/packet/send/PacketSceneTransToPointRsp.java +++ b/src/main/java/emu/grasscutter/server/packet/send/PacketSceneTransToPointRsp.java @@ -13,23 +13,22 @@ public class PacketSceneTransToPointRsp extends GenshinPacket { public PacketSceneTransToPointRsp(GenshinPlayer player, int pointId, int sceneId) { super(PacketOpcodes.SceneTransToPointRsp); - String code = sceneId + "_" + pointId; - ScenePointEntry scenePointEntry = GenshinData.getScenePointEntries().get(code); - - float x = scenePointEntry.getPointData().getTranPos().getX(); - float y = scenePointEntry.getPointData().getTranPos().getY(); - float z = scenePointEntry.getPointData().getTranPos().getZ(); - - player.getPos().set(new Position(x, y, z)); - - player.getWorld().forceTransferPlayerToScene(player, sceneId, player.getPos()); - SceneTransToPointRsp proto = SceneTransToPointRsp.newBuilder() - .setRetcode(0) - .setPointId(pointId) - .setSceneId(sceneId) - .build(); + .setRetcode(0) + .setPointId(pointId) + .setSceneId(sceneId) + .build(); + + this.setData(proto); + } + + public PacketSceneTransToPointRsp() { + super(PacketOpcodes.SceneTransToPointRsp); + SceneTransToPointRsp proto = SceneTransToPointRsp.newBuilder() + .setRetcode(1) // Internal server error + .build(); + this.setData(proto); } } 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 857f9879c..fb45bb361 100644 --- a/src/main/java/emu/grasscutter/server/packet/send/PacketSceneUnlockInfoNotify.java +++ b/src/main/java/emu/grasscutter/server/packet/send/PacketSceneUnlockInfoNotify.java @@ -13,7 +13,7 @@ public class PacketSceneUnlockInfoNotify extends GenshinPacket { SceneUnlockInfoNotify proto = SceneUnlockInfoNotify.newBuilder() .addUnlockInfos(SceneUnlockInfo.newBuilder().setSceneId(1)) .addUnlockInfos(SceneUnlockInfo.newBuilder().setSceneId(3)) - .addUnlockInfos(SceneUnlockInfo.newBuilder().setSceneId(4)) + .addUnlockInfos(SceneUnlockInfo.newBuilder().setSceneId(4).addSceneTagIdList(106).addSceneTagIdList(109)) .addUnlockInfos(SceneUnlockInfo.newBuilder().setSceneId(5)) .addUnlockInfos(SceneUnlockInfo.newBuilder().setSceneId(6)) .addUnlockInfos(SceneUnlockInfo.newBuilder().setSceneId(7)) 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 cb546f0e7..1bb09f8db 100644 --- a/src/main/java/emu/grasscutter/server/packet/send/PacketWorldPlayerLocationNotify.java +++ b/src/main/java/emu/grasscutter/server/packet/send/PacketWorldPlayerLocationNotify.java @@ -14,7 +14,7 @@ public class PacketWorldPlayerLocationNotify extends GenshinPacket { WorldPlayerLocationNotify.Builder proto = WorldPlayerLocationNotify.newBuilder(); for (GenshinPlayer p : world.getPlayers()) { - proto.addPlayerLocList(p.getPlayerLocationInfo()); + proto.addPlayerLocList(p.getWorldPlayerLocationInfo()); } this.setData(proto);