Implement support for multiple scenes in a world

This commit is contained in:
Melledy 2022-04-18 09:39:29 -07:00
parent 589d0dd6f8
commit 06ad1e8f9b
34 changed files with 2154 additions and 331 deletions

View File

@ -0,0 +1,9 @@
syntax = "proto3";
option java_package = "emu.grasscutter.net.proto";
message SceneUnlockInfo {
uint32 sceneId = 1;
bool isLocked = 2;
repeated uint32 sceneTagIdList = 3;
}

View File

@ -0,0 +1,9 @@
syntax = "proto3";
option java_package = "emu.grasscutter.net.proto";
import "SceneUnlockInfo.proto";
message SceneUnlockInfoNotify {
repeated SceneUnlockInfo unlockInfos = 1;
}

View File

@ -170,12 +170,12 @@ public class PlayerCommands {
float range = (5f + (.1f * count));
for (int i = 0; i < count; i++) {
Position pos = player.getPos().clone().addX((float) (Math.random() * range) - (range / 2)).addY(3f).addZ((float) (Math.random() * range) - (range / 2));
EntityItem entity = new EntityItem(player.getWorld(), player, itemData, pos, 1);
player.getWorld().addEntity(entity);
EntityItem entity = new EntityItem(player.getScene(), player, itemData, pos, 1);
player.getScene().addEntity(entity);
}
} else {
EntityItem entity = new EntityItem(player.getWorld(), player, itemData, player.getPos().clone().addY(3f), count);
player.getWorld().addEntity(entity);
EntityItem entity = new EntityItem(player.getScene(), player, itemData, player.getPos().clone().addY(3f), count);
player.getScene().addEntity(entity);
}
}
}
@ -216,8 +216,8 @@ public class PlayerCommands {
float range = (5f + (.1f * count));
for (int i = 0; i < count; i++) {
Position pos = player.getPos().clone().addX((float) (Math.random() * range) - (range / 2)).addY(3f).addZ((float) (Math.random() * range) - (range / 2));
EntityMonster entity = new EntityMonster(player.getWorld(), monsterData, pos, level);
player.getWorld().addEntity(entity);
EntityMonster entity = new EntityMonster(player.getScene(), monsterData, pos, level);
player.getScene().addEntity(entity);
}
}
}
@ -227,12 +227,12 @@ public class PlayerCommands {
@Override
public void execute(GenshinPlayer player, String raw) {
List<GenshinEntity> toRemove = new LinkedList<>();
for (GenshinEntity entity : player.getWorld().getEntities().values()) {
for (GenshinEntity entity : player.getScene().getEntities().values()) {
if (entity instanceof EntityMonster) {
toRemove.add(entity);
}
}
toRemove.forEach(e -> player.getWorld().killEntity(e, 0));
toRemove.forEach(e -> player.getScene().killEntity(e, 0));
}
}
@ -286,7 +286,7 @@ public class PlayerCommands {
}
entity.setFightProperty(FightProperty.FIGHT_PROP_CUR_HP, hp);
entity.getWorld().broadcastPacket(new PacketEntityFightPropUpdateNotify(entity, FightProperty.FIGHT_PROP_CUR_HP));
entity.getScene().broadcastPacket(new PacketEntityFightPropUpdateNotify(entity, FightProperty.FIGHT_PROP_CUR_HP));
}
}

View File

@ -83,6 +83,7 @@ public class GenshinPlayer {
@Transient private long nextGuid = 0;
@Transient private int peerId;
@Transient private World world;
@Transient private GenshinScene scene;
@Transient private GameSession session;
@Transient private AvatarStorage avatars;
@Transient private Inventory inventory;
@ -206,6 +207,14 @@ public class GenshinPlayer {
this.world = world;
}
public GenshinScene getScene() {
return scene;
}
public void setScene(GenshinScene scene) {
this.scene = scene;
}
public int getGmLevel() {
return 1;
}
@ -560,14 +569,14 @@ public class GenshinPlayer {
}
public void interactWith(int gadgetEntityId) {
GenshinEntity entity = getWorld().getEntityById(gadgetEntityId);
GenshinEntity entity = getScene().getEntityById(gadgetEntityId);
if (entity == null) {
return;
}
// Delete
entity.getWorld().removeEntity(entity);
entity.getScene().removeEntity(entity);
// Handle
if (entity instanceof EntityItem) {

View File

@ -0,0 +1,317 @@
package emu.grasscutter.game;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;
import emu.grasscutter.game.entity.EntityAvatar;
import emu.grasscutter.game.entity.EntityClientGadget;
import emu.grasscutter.game.entity.EntityGadget;
import emu.grasscutter.game.entity.GenshinEntity;
import emu.grasscutter.game.props.ClimateType;
import emu.grasscutter.game.props.FightProperty;
import emu.grasscutter.game.props.LifeState;
import emu.grasscutter.net.packet.GenshinPacket;
import emu.grasscutter.net.proto.AttackResultOuterClass.AttackResult;
import emu.grasscutter.net.proto.VisionTypeOuterClass.VisionType;
import emu.grasscutter.server.packet.send.PacketEntityFightPropUpdateNotify;
import emu.grasscutter.server.packet.send.PacketLifeStateChangeNotify;
import emu.grasscutter.server.packet.send.PacketSceneEntityAppearNotify;
import emu.grasscutter.server.packet.send.PacketSceneEntityDisappearNotify;
import it.unimi.dsi.fastutil.ints.Int2ObjectMap;
import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap;
public class GenshinScene {
private final World world;
private final List<GenshinPlayer> players;
private final Int2ObjectMap<GenshinEntity> entities;
private final int id;
private int time;
private ClimateType climate;
public GenshinScene(World world, int sceneId) {
this.world = world;
this.players = Collections.synchronizedList(new ArrayList<>());
this.entities = new Int2ObjectOpenHashMap<>();
this.id = sceneId;
this.time = 8 * 60;
this.climate = ClimateType.CLIMATE_SUNNY;
}
public int getId() {
return id;
}
public World getWorld() {
return world;
}
public List<GenshinPlayer> getPlayers() {
return players;
}
public int getPlayerCount() {
return this.getPlayers().size();
}
public Int2ObjectMap<GenshinEntity> getEntities() {
return entities;
}
public GenshinEntity getEntityById(int id) {
return this.entities.get(id);
}
public int getTime() {
return time;
}
public void changeTime(int time) {
this.time = time % 1440;
}
public ClimateType getClimate() {
return climate;
}
public void setClimate(ClimateType climate) {
this.climate = climate;
}
public boolean isInScene(GenshinEntity entity) {
return this.entities.containsKey(entity.getId());
}
public void addPlayer(GenshinPlayer player) {
// Check if player already in
if (getPlayers().contains(player)) {
return;
}
// Remove player from prev scene
if (player.getScene() != null) {
player.getScene().removePlayer(player);
}
// Add
getPlayers().add(player);
player.setSceneId(this.getId());
player.setScene(this);
this.setupPlayerAvatars(player);
}
public void removePlayer(GenshinPlayer player) {
getPlayers().remove(player);
player.setScene(null);
// Remove player avatars
this.removePlayerAvatars(player);
// Remove player gadgets
for (EntityGadget gadget : player.getTeamManager().getGadgets()) {
this.removeEntity(gadget);
}
}
private void setupPlayerAvatars(GenshinPlayer player) {
// Clear entities from old team
player.getTeamManager().getActiveTeam().clear();
// Add new entities for player
TeamInfo teamInfo = player.getTeamManager().getCurrentTeamInfo();
for (int avatarId : teamInfo.getAvatars()) {
EntityAvatar entity = new EntityAvatar(player.getScene(), player.getAvatars().getAvatarById(avatarId));
player.getTeamManager().getActiveTeam().add(entity);
}
// Limit character index in case its out of bounds
if (player.getTeamManager().getCurrentCharacterIndex() >= player.getTeamManager().getActiveTeam().size() || player.getTeamManager().getCurrentCharacterIndex() < 0) {
player.getTeamManager().setCurrentCharacterIndex(player.getTeamManager().getCurrentCharacterIndex() - 1);
}
}
private void removePlayerAvatars(GenshinPlayer player) {
Iterator<EntityAvatar> it = player.getTeamManager().getActiveTeam().iterator();
while (it.hasNext()) {
this.removeEntity(it.next(), VisionType.VisionRemove);
it.remove();
}
}
public void spawnPlayer(GenshinPlayer player) {
if (this.isInScene(player.getTeamManager().getCurrentAvatarEntity())) {
return;
}
if (player.getTeamManager().getCurrentAvatarEntity().getFightProperty(FightProperty.FIGHT_PROP_CUR_HP) <= 0f) {
player.getTeamManager().getCurrentAvatarEntity().setFightProperty(FightProperty.FIGHT_PROP_CUR_HP, 1f);
}
this.addEntity(player.getTeamManager().getCurrentAvatarEntity());
}
private void addEntityDirectly(GenshinEntity entity) {
getEntities().put(entity.getId(), entity);
}
public synchronized void addEntity(GenshinEntity entity) {
this.addEntityDirectly(entity);
this.broadcastPacket(new PacketSceneEntityAppearNotify(entity));
}
public synchronized void addEntities(Collection<GenshinEntity> entities) {
for (GenshinEntity entity : entities) {
this.addEntityDirectly(entity);
}
this.broadcastPacket(new PacketSceneEntityAppearNotify(entities, VisionType.VisionBorn));
}
private GenshinEntity removeEntityDirectly(GenshinEntity entity) {
return getEntities().remove(entity.getId());
}
public void removeEntity(GenshinEntity entity) {
this.removeEntity(entity, VisionType.VisionDie);
}
public synchronized void removeEntity(GenshinEntity entity, VisionType visionType) {
GenshinEntity removed = this.removeEntityDirectly(entity);
if (removed != null) {
this.broadcastPacket(new PacketSceneEntityDisappearNotify(removed, visionType));
}
}
public synchronized void replaceEntity(EntityAvatar oldEntity, EntityAvatar newEntity) {
this.removeEntityDirectly(oldEntity);
this.addEntityDirectly(newEntity);
this.broadcastPacket(new PacketSceneEntityDisappearNotify(oldEntity, VisionType.VisionReplace));
this.broadcastPacket(new PacketSceneEntityAppearNotify(newEntity, VisionType.VisionReplace, oldEntity.getId()));
}
public void showOtherEntities(GenshinPlayer player) {
List<GenshinEntity> entities = new LinkedList<>();
GenshinEntity currentEntity = player.getTeamManager().getCurrentAvatarEntity();
for (GenshinEntity entity : this.getEntities().values()) {
if (entity == currentEntity) {
continue;
}
entities.add(entity);
}
player.sendPacket(new PacketSceneEntityAppearNotify(entities, VisionType.VisionMeet));
}
public void handleAttack(AttackResult result) {
//GenshinEntity attacker = getEntityById(result.getAttackerId());
GenshinEntity target = getEntityById(result.getDefenseId());
if (target == null) {
return;
}
// Godmode check
if (target instanceof EntityAvatar) {
if (((EntityAvatar) target).getPlayer().hasGodmode()) {
return;
}
}
// Lose hp
target.addFightProperty(FightProperty.FIGHT_PROP_CUR_HP, -result.getDamage());
// Check if dead
boolean isDead = false;
if (target.getFightProperty(FightProperty.FIGHT_PROP_CUR_HP) <= 0f) {
target.setFightProperty(FightProperty.FIGHT_PROP_CUR_HP, 0f);
isDead = true;
}
// Packets
this.broadcastPacket(new PacketEntityFightPropUpdateNotify(target, FightProperty.FIGHT_PROP_CUR_HP));
// Check if dead
if (isDead) {
this.killEntity(target, result.getAttackerId());
}
}
public void killEntity(GenshinEntity target, int attackerId) {
// Packet
this.broadcastPacket(new PacketLifeStateChangeNotify(attackerId, target, LifeState.LIFE_DEAD));
this.removeEntity(target);
// Death event
target.onDeath(attackerId);
}
// Gadgets
public void onPlayerCreateGadget(EntityClientGadget gadget) {
// Directly add
this.addEntityDirectly(gadget);
// Add to owner's gadget list
gadget.getOwner().getTeamManager().getGadgets().add(gadget);
// Optimization
if (this.getPlayerCount() == 1 && this.getPlayers().get(0) == gadget.getOwner()) {
return;
}
this.broadcastPacketToOthers(gadget.getOwner(), new PacketSceneEntityAppearNotify(gadget));
}
public void onPlayerDestroyGadget(int entityId) {
GenshinEntity entity = getEntities().get(entityId);
if (entity == null || !(entity instanceof EntityClientGadget)) {
return;
}
// Get and remove entity
EntityClientGadget gadget = (EntityClientGadget) entity;
this.removeEntityDirectly(gadget);
// Remove from owner's gadget list
gadget.getOwner().getTeamManager().getGadgets().remove(gadget);
// Optimization
if (this.getPlayerCount() == 1 && this.getPlayers().get(0) == gadget.getOwner()) {
return;
}
this.broadcastPacketToOthers(gadget.getOwner(), new PacketSceneEntityDisappearNotify(gadget, VisionType.VisionDie));
}
// Broadcasting
public void broadcastPacket(GenshinPacket packet) {
// Send to all players - might have to check if player has been sent data packets
for (GenshinPlayer player : this.getPlayers()) {
player.getSession().send(packet);
}
}
public void broadcastPacketToOthers(GenshinPlayer excludedPlayer, GenshinPacket 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()) {
if (player == excludedPlayer) {
continue;
}
// Send
player.getSession().send(packet);
}
}
}

View File

@ -46,12 +46,12 @@ public class InvokeHandler<T> {
try {
if (entryListForwardAll.size() > 0) {
GenshinPacket packet = packetClass.getDeclaredConstructor(List.class).newInstance(this.entryListForwardAll);
player.getWorld().broadcastPacket(packet);
player.getScene().broadcastPacket(packet);
this.entryListForwardAll.clear();
}
if (entryListForwardAllExceptCur.size() > 0) {
GenshinPacket packet = packetClass.getDeclaredConstructor(List.class).newInstance(this.entryListForwardAllExceptCur);
player.getWorld().broadcastPacketToOthers(player, packet);
player.getScene().broadcastPacketToOthers(player, packet);
this.entryListForwardAllExceptCur.clear();
}
if (entryListForwardHost.size() > 0) {

View File

@ -158,7 +158,7 @@ public class TeamManager {
}
public boolean isSpawned() {
return getPlayer().getWorld() != null && getPlayer().getWorld().getEntities().containsKey(getCurrentAvatarEntity().getId());
return getPlayer().getWorld() != null && getPlayer().getScene().getEntities().containsKey(getCurrentAvatarEntity().getId());
}
public int getMaxTeamSize() {
@ -233,7 +233,7 @@ public class TeamManager {
prevSelectedAvatarIndex = i;
}
} else {
entity = new EntityAvatar(getPlayer().getWorld(), getPlayer().getAvatars().getAvatarById(avatarId));
entity = new EntityAvatar(getPlayer().getScene(), getPlayer().getAvatars().getAvatarById(avatarId));
}
this.getActiveTeam().add(entity);
@ -241,7 +241,7 @@ public class TeamManager {
// Unload removed entities
for (EntityAvatar entity : existingAvatars.values()) {
getPlayer().getWorld().removeEntity(entity);
getPlayer().getScene().removeEntity(entity);
entity.getAvatar().save();
}
@ -256,7 +256,7 @@ public class TeamManager {
updateTeamResonances();
// Packets
getPlayer().getWorld().broadcastPacket(new PacketSceneTeamUpdateNotify(getPlayer()));
getPlayer().getScene().broadcastPacket(new PacketSceneTeamUpdateNotify(getPlayer()));
// Run callback
if (responsePacket != null) {
@ -266,7 +266,7 @@ public class TeamManager {
// Check if character changed
if (currentEntity != getCurrentAvatarEntity()) {
// Remove and Add
getWorld().replaceEntity(currentEntity, getCurrentAvatarEntity());
getPlayer().getScene().replaceEntity(currentEntity, getCurrentAvatarEntity());
}
}
@ -396,7 +396,7 @@ public class TeamManager {
oldEntity.setMotionState(MotionState.MotionStandby);
// Remove and Add
getWorld().replaceEntity(oldEntity, newEntity);
getPlayer().getScene().replaceEntity(oldEntity, newEntity);
getPlayer().sendPacket(new PacketChangeAvatarRsp(guid));
}
@ -426,7 +426,7 @@ public class TeamManager {
} else {
// Set index and spawn replacement member
this.setCurrentCharacterIndex(replaceIndex);
getWorld().addEntity(replacement);
getPlayer().getScene().addEntity(replacement);
}
// Response packet

View File

@ -33,24 +33,21 @@ import emu.grasscutter.server.packet.send.PacketSyncScenePlayTeamEntityNotify;
import emu.grasscutter.server.packet.send.PacketSyncTeamEntityNotify;
import emu.grasscutter.server.packet.send.PacketWorldPlayerInfoNotify;
import emu.grasscutter.server.packet.send.PacketWorldPlayerRTTNotify;
import emu.grasscutter.utils.Position;
import it.unimi.dsi.fastutil.ints.Int2ObjectMap;
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;
private int levelEntityId;
private int nextEntityId = 0;
private int nextPeerId = 0;
private final Int2ObjectMap<GenshinEntity> entities;
private int worldLevel;
private int sceneId;
private int time;
private ClimateType climate;
private boolean isMultiplayer;
private boolean isDungeon;
public World(GenshinPlayer player) {
this(player, false);
@ -59,11 +56,9 @@ public class World implements Iterable<GenshinPlayer> {
public World(GenshinPlayer player, boolean isMultiplayer) {
this.owner = player;
this.players = Collections.synchronizedList(new ArrayList<>());
this.entities = new Int2ObjectOpenHashMap<>();
this.scenes = new Int2ObjectOpenHashMap<>();
this.levelEntityId = getNextEntityId(EntityIdType.MPLEVEL);
this.sceneId = player.getSceneId();
this.time = 8 * 60;
this.climate = ClimateType.CLIMATE_SUNNY;
this.worldLevel = player.getWorldLevel();
this.isMultiplayer = isMultiplayer;
}
@ -87,22 +82,6 @@ public class World implements Iterable<GenshinPlayer> {
return ++this.nextPeerId;
}
public int getSceneId() {
return sceneId;
}
public void setSceneId(int sceneId) {
this.sceneId = sceneId;
}
public int getTime() {
return time;
}
public void changeTime(int time) {
this.time = time % 1440;
}
public int getWorldLevel() {
return worldLevel;
}
@ -111,46 +90,30 @@ public class World implements Iterable<GenshinPlayer> {
this.worldLevel = worldLevel;
}
public ClimateType getClimate() {
return climate;
}
public void setClimate(ClimateType climate) {
this.climate = climate;
}
public List<GenshinPlayer> getPlayers() {
return players;
}
public Int2ObjectMap<GenshinScene> getScenes() {
return this.scenes;
}
public GenshinScene getSceneById(int sceneId) {
return getScenes().computeIfAbsent(sceneId, id -> new GenshinScene(this, id));
}
public int getPlayerCount() {
return getPlayers().size();
}
public Int2ObjectMap<GenshinEntity> getEntities() {
return this.entities;
}
public boolean isInWorld(GenshinEntity entity) {
return this.entities.containsKey(entity.getId());
}
public boolean isMultiplayer() {
return isMultiplayer;
}
public boolean isDungeon() {
return isDungeon;
}
public int getNextEntityId(EntityIdType idType) {
return (idType.getId() << 24) + ++this.nextEntityId;
}
public GenshinEntity getEntityById(int id) {
return this.entities.get(id);
}
public synchronized void addPlayer(GenshinPlayer player) {
// Check if player already in
if (getPlayers().contains(player)) {
@ -165,13 +128,20 @@ public class World implements Iterable<GenshinPlayer> {
// Register
player.setWorld(this);
getPlayers().add(player);
// Set player variables
player.setPeerId(this.getNextPeerId());
player.getTeamManager().setEntityId(getNextEntityId(EntityIdType.TEAM));
// Setup team avatars
this.setupPlayerAvatars(player);
// Copy main team to mp team
if (this.isMultiplayer()) {
player.getTeamManager().getMpTeam().copyFrom(player.getTeamManager().getCurrentSinglePlayerTeamInfo(), player.getTeamManager().getMaxTeamSize());
}
// Add to scene
GenshinScene scene = this.getSceneById(player.getSceneId());
scene.addPlayer(player);
// Info packet for other players
if (this.getPlayers().size() > 1) {
this.updatePlayerInfos(player);
@ -191,18 +161,15 @@ public class World implements Iterable<GenshinPlayer> {
getPlayers().remove(player);
player.setWorld(null);
this.removePlayerAvatars(player);
// Remove from scene
GenshinScene scene = this.getSceneById(player.getSceneId());
scene.removePlayer(player);
// Info packet for other players
if (this.getPlayers().size() > 0) {
this.updatePlayerInfos(player);
}
// Remove player gadgets
for (EntityGadget gadget : player.getTeamManager().getGadgets()) {
this.removeEntity(gadget);
}
// Disband world if host leaves
if (getHost() == player) {
List<GenshinPlayer> kicked = new ArrayList<>(this.getPlayers());
@ -210,11 +177,24 @@ public class World implements Iterable<GenshinPlayer> {
World world = new World(victim);
world.addPlayer(victim);
victim.sendPacket(new PacketPlayerEnterSceneNotify(victim, EnterType.EnterSelf, EnterReason.TeamKick, victim.getWorld().getSceneId(), victim.getPos()));
victim.sendPacket(new PacketPlayerEnterSceneNotify(victim, EnterType.EnterSelf, EnterReason.TeamKick, victim.getSceneId(), victim.getPos()));
}
}
}
public void transferPlayerToScene(GenshinPlayer player, int sceneId, Position pos) {
if (player.getScene() != null) {
player.getScene().removePlayer(player);
}
GenshinScene scene = this.getSceneById(sceneId);
scene.addPlayer(player);
player.getPos().set(pos);
player.sendPacket(new PacketPlayerEnterSceneNotify(player, EnterType.EnterSelf, EnterReason.TransPoint, sceneId, pos));
}
private void updatePlayerInfos(GenshinPlayer paramPlayer) {
for (GenshinPlayer player : getPlayers()) {
// Dont send packets if player is loading in and filter out joining player
@ -239,185 +219,6 @@ public class World implements Iterable<GenshinPlayer> {
}
}
private void addEntityDirectly(GenshinEntity entity) {
getEntities().put(entity.getId(), entity);
}
public synchronized void addEntity(GenshinEntity entity) {
this.addEntityDirectly(entity);
this.broadcastPacket(new PacketSceneEntityAppearNotify(entity));
}
public synchronized void addEntities(Collection<GenshinEntity> entities) {
for (GenshinEntity entity : entities) {
this.addEntityDirectly(entity);
}
this.broadcastPacket(new PacketSceneEntityAppearNotify(entities, VisionType.VisionBorn));
}
private GenshinEntity removeEntityDirectly(GenshinEntity entity) {
return getEntities().remove(entity.getId());
}
public void removeEntity(GenshinEntity entity) {
this.removeEntity(entity, VisionType.VisionDie);
}
public synchronized void removeEntity(GenshinEntity entity, VisionType visionType) {
GenshinEntity removed = this.removeEntityDirectly(entity);
if (removed != null) {
this.broadcastPacket(new PacketSceneEntityDisappearNotify(removed, visionType));
}
}
public synchronized void replaceEntity(EntityAvatar oldEntity, EntityAvatar newEntity) {
this.removeEntityDirectly(oldEntity);
this.addEntityDirectly(newEntity);
this.broadcastPacket(new PacketSceneEntityDisappearNotify(oldEntity, VisionType.VisionReplace));
this.broadcastPacket(new PacketSceneEntityAppearNotify(newEntity, VisionType.VisionReplace, oldEntity.getId()));
}
private void setupPlayerAvatars(GenshinPlayer player) {
// Copy main team to mp team
if (this.isMultiplayer()) {
player.getTeamManager().getMpTeam().copyFrom(player.getTeamManager().getCurrentSinglePlayerTeamInfo(), player.getTeamManager().getMaxTeamSize());
}
// Clear entities from old team
player.getTeamManager().getActiveTeam().clear();
// Add new entities for player
TeamInfo teamInfo = player.getTeamManager().getCurrentTeamInfo();
for (int avatarId : teamInfo.getAvatars()) {
EntityAvatar entity = new EntityAvatar(this, player.getAvatars().getAvatarById(avatarId));
player.getTeamManager().getActiveTeam().add(entity);
}
// Limit character index in case its out of bounds
if (player.getTeamManager().getCurrentCharacterIndex() >= player.getTeamManager().getActiveTeam().size() || player.getTeamManager().getCurrentCharacterIndex() < 0) {
player.getTeamManager().setCurrentCharacterIndex(player.getTeamManager().getCurrentCharacterIndex() - 1);
}
}
private void removePlayerAvatars(GenshinPlayer player) {
Iterator<EntityAvatar> it = player.getTeamManager().getActiveTeam().iterator();
while (it.hasNext()) {
this.removeEntity(it.next(), VisionType.VisionRemove);
it.remove();
}
}
public void spawnPlayer(GenshinPlayer player) {
if (isInWorld(player.getTeamManager().getCurrentAvatarEntity())) {
return;
}
if (player.getTeamManager().getCurrentAvatarEntity().getFightProperty(FightProperty.FIGHT_PROP_CUR_HP) <= 0f) {
player.getTeamManager().getCurrentAvatarEntity().setFightProperty(FightProperty.FIGHT_PROP_CUR_HP, 1f);
}
this.addEntity(player.getTeamManager().getCurrentAvatarEntity());
}
public void showOtherEntities(GenshinPlayer player) {
List<GenshinEntity> entities = new LinkedList<>();
GenshinEntity currentEntity = player.getTeamManager().getCurrentAvatarEntity();
for (GenshinEntity entity : this.getEntities().values()) {
if (entity == currentEntity) {
continue;
}
entities.add(entity);
}
player.sendPacket(new PacketSceneEntityAppearNotify(entities, VisionType.VisionMeet));
}
public void handleAttack(AttackResult result) {
//GenshinEntity attacker = getEntityById(result.getAttackerId());
GenshinEntity target = getEntityById(result.getDefenseId());
if (target == null) {
return;
}
// Godmode check
if (target instanceof EntityAvatar) {
if (((EntityAvatar) target).getPlayer().hasGodmode()) {
return;
}
}
// Lose hp
target.addFightProperty(FightProperty.FIGHT_PROP_CUR_HP, -result.getDamage());
// Check if dead
boolean isDead = false;
if (target.getFightProperty(FightProperty.FIGHT_PROP_CUR_HP) <= 0f) {
target.setFightProperty(FightProperty.FIGHT_PROP_CUR_HP, 0f);
isDead = true;
}
// Packets
this.broadcastPacket(new PacketEntityFightPropUpdateNotify(target, FightProperty.FIGHT_PROP_CUR_HP));
// Check if dead
if (isDead) {
this.killEntity(target, result.getAttackerId());
}
}
public void killEntity(GenshinEntity target, int attackerId) {
// Packet
this.broadcastPacket(new PacketLifeStateChangeNotify(attackerId, target, LifeState.LIFE_DEAD));
this.removeEntity(target);
// Death event
target.onDeath(attackerId);
}
// Gadgets
public void onPlayerCreateGadget(EntityClientGadget gadget) {
// Directly add
this.addEntityDirectly(gadget);
// Add to owner's gadget list
gadget.getOwner().getTeamManager().getGadgets().add(gadget);
// Optimization
if (this.getPlayerCount() == 1 && this.getPlayers().get(0) == gadget.getOwner()) {
return;
}
this.broadcastPacketToOthers(gadget.getOwner(), new PacketSceneEntityAppearNotify(gadget));
}
public void onPlayerDestroyGadget(int entityId) {
GenshinEntity entity = getEntities().get(entityId);
if (entity == null || !(entity instanceof EntityClientGadget)) {
return;
}
// Get and remove entity
EntityClientGadget gadget = (EntityClientGadget) entity;
this.removeEntityDirectly(gadget);
// Remove from owner's gadget list
gadget.getOwner().getTeamManager().getGadgets().remove(gadget);
// Optimization
if (this.getPlayerCount() == 1 && this.getPlayers().get(0) == gadget.getOwner()) {
return;
}
this.broadcastPacketToOthers(gadget.getOwner(), new PacketSceneEntityDisappearNotify(gadget, VisionType.VisionDie));
}
// Broadcasting
public void broadcastPacket(GenshinPacket packet) {
// Send to all players - might have to check if player has been sent data packets
for (GenshinPlayer player : this.getPlayers()) {
@ -425,21 +226,6 @@ public class World implements Iterable<GenshinPlayer> {
}
}
public void broadcastPacketToOthers(GenshinPlayer excludedPlayer, GenshinPacket 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()) {
if (player == excludedPlayer) {
continue;
}
// Send
player.getSession().send(packet);
}
}
public void close() {
}

View File

@ -122,7 +122,7 @@ public class AvatarStorage implements Iterable<GenshinAvatar> {
entity = new EntityAvatar(avatar);
getPlayer().sendPacket(new PacketAvatarChangeCostumeNotify(entity));
} else {
getPlayer().getWorld().broadcastPacket(new PacketAvatarChangeCostumeNotify(entity));
getPlayer().getScene().broadcastPacket(new PacketAvatarChangeCostumeNotify(entity));
}
// Done

View File

@ -5,6 +5,7 @@ import emu.grasscutter.data.GenshinData;
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.inventory.EquipType;
@ -39,14 +40,14 @@ public class EntityAvatar extends GenshinEntity {
private PlayerDieType killedType;
private int killedBy;
public EntityAvatar(World world, GenshinAvatar avatar) {
super(world);
public EntityAvatar(GenshinScene scene, GenshinAvatar avatar) {
super(scene);
this.avatar = avatar;
this.id = world.getNextEntityId(EntityIdType.AVATAR);
this.id = getScene().getWorld().getNextEntityId(EntityIdType.AVATAR);
GenshinItem weapon = this.getAvatar().getWeapon();
if (weapon != null) {
weapon.setWeaponEntityId(world.getNextEntityId(EntityIdType.WEAPON));
weapon.setWeaponEntityId(getScene().getWorld().getNextEntityId(EntityIdType.WEAPON));
}
}
@ -152,7 +153,7 @@ public class EntityAvatar extends GenshinEntity {
.setLastMoveReliableSeq(this.getLastMoveReliableSeq())
.setLifeState(this.getLifeState().getValue());
if (this.getWorld() != null) {
if (this.getScene() != null) {
entityInfo.setMotionInfo(this.getMotionInfo());
}

View File

@ -1,6 +1,7 @@
package emu.grasscutter.game.entity;
import emu.grasscutter.game.GenshinPlayer;
import emu.grasscutter.game.GenshinScene;
import emu.grasscutter.game.World;
import emu.grasscutter.game.props.PlayerProperty;
import emu.grasscutter.net.proto.AbilitySyncStateInfoOuterClass.AbilitySyncStateInfo;
@ -34,8 +35,8 @@ public class EntityClientGadget extends EntityGadget {
private int targetEntityId;
private boolean asyncLoad;
public EntityClientGadget(World world, GenshinPlayer player, EvtCreateGadgetNotify notify) {
super(world);
public EntityClientGadget(GenshinScene scene, GenshinPlayer player, EvtCreateGadgetNotify notify) {
super(scene);
this.owner = player;
this.id = notify.getEntityId();
this.pos = new Position(notify.getInitPos());

View File

@ -1,11 +1,12 @@
package emu.grasscutter.game.entity;
import emu.grasscutter.game.GenshinScene;
import emu.grasscutter.game.World;
public abstract class EntityGadget extends GenshinEntity {
public EntityGadget(World world) {
super(world);
public EntityGadget(GenshinScene scene) {
super(scene);
}
public abstract int getGadgetId();

View File

@ -2,6 +2,7 @@ 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.props.EntityIdType;
@ -30,9 +31,9 @@ public class EntityItem extends EntityGadget {
private final GenshinItem item;
private final long guid;
public EntityItem(World world, GenshinPlayer player, ItemData itemData, Position pos, int count) {
super(world);
this.id = world.getNextEntityId(EntityIdType.GADGET);
public EntityItem(GenshinScene scene, GenshinPlayer 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.getNextGuid();

View File

@ -4,6 +4,7 @@ import emu.grasscutter.data.GenshinData;
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;
@ -36,9 +37,9 @@ public class EntityMonster extends GenshinEntity {
private final int level;
private int weaponEntityId;
public EntityMonster(World world, MonsterData monsterData, Position pos, int level) {
super(world);
this.id = world.getNextEntityId(EntityIdType.MONSTER);
public EntityMonster(GenshinScene scene, MonsterData monsterData, Position pos, int level) {
super(scene);
this.id = getWorld().getNextEntityId(EntityIdType.MONSTER);
this.monsterData = monsterData;
this.fightProp = new Int2FloatOpenHashMap();
this.pos = new Position(pos);
@ -48,7 +49,7 @@ public class EntityMonster extends GenshinEntity {
// Monster weapon
if (getMonsterWeaponId() > 0) {
this.weaponEntityId = world.getNextEntityId(EntityIdType.WEAPON);
this.weaponEntityId = getWorld().getNextEntityId(EntityIdType.WEAPON);
}
this.recalcStats();

View File

@ -1,5 +1,6 @@
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;
@ -12,23 +13,27 @@ import it.unimi.dsi.fastutil.ints.Int2FloatOpenHashMap;
public abstract class GenshinEntity {
protected int id;
private final World world;
private final GenshinScene scene;
private MotionState moveState;
private int lastMoveSceneTimeMs;
private int lastMoveReliableSeq;
public GenshinEntity(World world) {
this.world = world;
public GenshinEntity(GenshinScene scene) {
this.scene = scene;
this.moveState = MotionState.MotionNone;
}
public int getId() {
return this.id;
}
public World getWorld() {
return world;
return this.getScene().getWorld();
}
public GenshinScene getScene() {
return this.scene;
}
public boolean isAlive() {

View File

@ -35,10 +35,12 @@ public class MultiplayerManager {
return;
}
/*
if (target.getWorld().isDungeon()) {
player.sendPacket(new PacketPlayerApplyEnterMpResultNotify(targetUid, "", false, PlayerApplyEnterMpReason.SceneCannotEnter));
return;
}
*/
// Get request
CoopRequest request = target.getCoopRequests().get(player.getId());
@ -90,14 +92,14 @@ public class MultiplayerManager {
world.addPlayer(player);
// Rejoin packet
player.sendPacket(new PacketPlayerEnterSceneNotify(player, player, EnterType.EnterSelf, EnterReason.HostFromSingleToMp, player.getWorld().getSceneId(), player.getPos()));
player.sendPacket(new PacketPlayerEnterSceneNotify(player, player, EnterType.EnterSelf, EnterReason.HostFromSingleToMp, player.getScene().getId(), player.getPos()));
}
// Make requester join
player.getWorld().addPlayer(requester);
// Packet
requester.sendPacket(new PacketPlayerEnterSceneNotify(requester, player, EnterType.EnterOther, EnterReason.TeamJoin, player.getWorld().getSceneId(), player.getPos()));
requester.sendPacket(new PacketPlayerEnterSceneNotify(requester, player, EnterType.EnterOther, EnterReason.TeamJoin, player.getScene().getId(), player.getPos()));
requester.getPos().set(player.getPos());
requester.getRotation().set(player.getRotation());
}
@ -120,7 +122,7 @@ public class MultiplayerManager {
world.addPlayer(player);
// Packet
player.sendPacket(new PacketPlayerEnterSceneNotify(player, EnterType.EnterSelf, EnterReason.TeamBack, player.getWorld().getSceneId(), player.getPos()));
player.sendPacket(new PacketPlayerEnterSceneNotify(player, EnterType.EnterSelf, EnterReason.TeamBack, player.getScene().getId(), player.getPos()));
return true;
}
@ -147,7 +149,7 @@ public class MultiplayerManager {
World world = new World(victim);
world.addPlayer(victim);
victim.sendPacket(new PacketPlayerEnterSceneNotify(victim, EnterType.EnterSelf, EnterReason.TeamKick, victim.getWorld().getSceneId(), victim.getPos()));
victim.sendPacket(new PacketPlayerEnterSceneNotify(victim, EnterType.EnterSelf, EnterReason.TeamKick, victim.getScene().getId(), victim.getPos()));
return true;
}
}

View File

@ -958,6 +958,7 @@ public class PacketOpcodes {
public static final int SceneTimeNotify = 229;
public static final int SceneTransToPointReq = 256;
public static final int SceneTransToPointRsp = 283;
public static final int SceneUnlockInfoNotify = 3386;
public static final int SceneWeatherForcastReq = 3167;
public static final int SceneWeatherForcastRsp = 3023;
public static final int SeaLampCoinNotify = 2028;

View File

@ -0,0 +1,844 @@
// Generated by the protocol buffer compiler. DO NOT EDIT!
// source: SceneUnlockInfoNotify.proto
package emu.grasscutter.net.proto;
public final class SceneUnlockInfoNotifyOuterClass {
private SceneUnlockInfoNotifyOuterClass() {}
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 SceneUnlockInfoNotifyOrBuilder extends
// @@protoc_insertion_point(interface_extends:SceneUnlockInfoNotify)
com.google.protobuf.MessageOrBuilder {
/**
* <code>repeated .SceneUnlockInfo unlockInfos = 1;</code>
*/
java.util.List<emu.grasscutter.net.proto.SceneUnlockInfoOuterClass.SceneUnlockInfo>
getUnlockInfosList();
/**
* <code>repeated .SceneUnlockInfo unlockInfos = 1;</code>
*/
emu.grasscutter.net.proto.SceneUnlockInfoOuterClass.SceneUnlockInfo getUnlockInfos(int index);
/**
* <code>repeated .SceneUnlockInfo unlockInfos = 1;</code>
*/
int getUnlockInfosCount();
/**
* <code>repeated .SceneUnlockInfo unlockInfos = 1;</code>
*/
java.util.List<? extends emu.grasscutter.net.proto.SceneUnlockInfoOuterClass.SceneUnlockInfoOrBuilder>
getUnlockInfosOrBuilderList();
/**
* <code>repeated .SceneUnlockInfo unlockInfos = 1;</code>
*/
emu.grasscutter.net.proto.SceneUnlockInfoOuterClass.SceneUnlockInfoOrBuilder getUnlockInfosOrBuilder(
int index);
}
/**
* Protobuf type {@code SceneUnlockInfoNotify}
*/
public static final class SceneUnlockInfoNotify extends
com.google.protobuf.GeneratedMessageV3 implements
// @@protoc_insertion_point(message_implements:SceneUnlockInfoNotify)
SceneUnlockInfoNotifyOrBuilder {
private static final long serialVersionUID = 0L;
// Use SceneUnlockInfoNotify.newBuilder() to construct.
private SceneUnlockInfoNotify(com.google.protobuf.GeneratedMessageV3.Builder<?> builder) {
super(builder);
}
private SceneUnlockInfoNotify() {
unlockInfos_ = java.util.Collections.emptyList();
}
@java.lang.Override
@SuppressWarnings({"unused"})
protected java.lang.Object newInstance(
UnusedPrivateParameter unused) {
return new SceneUnlockInfoNotify();
}
@java.lang.Override
public final com.google.protobuf.UnknownFieldSet
getUnknownFields() {
return this.unknownFields;
}
private SceneUnlockInfoNotify(
com.google.protobuf.CodedInputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
this();
if (extensionRegistry == null) {
throw new java.lang.NullPointerException();
}
int mutable_bitField0_ = 0;
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 10: {
if (!((mutable_bitField0_ & 0x00000001) != 0)) {
unlockInfos_ = new java.util.ArrayList<emu.grasscutter.net.proto.SceneUnlockInfoOuterClass.SceneUnlockInfo>();
mutable_bitField0_ |= 0x00000001;
}
unlockInfos_.add(
input.readMessage(emu.grasscutter.net.proto.SceneUnlockInfoOuterClass.SceneUnlockInfo.parser(), extensionRegistry));
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 {
if (((mutable_bitField0_ & 0x00000001) != 0)) {
unlockInfos_ = java.util.Collections.unmodifiableList(unlockInfos_);
}
this.unknownFields = unknownFields.build();
makeExtensionsImmutable();
}
}
public static final com.google.protobuf.Descriptors.Descriptor
getDescriptor() {
return emu.grasscutter.net.proto.SceneUnlockInfoNotifyOuterClass.internal_static_SceneUnlockInfoNotify_descriptor;
}
@java.lang.Override
protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
internalGetFieldAccessorTable() {
return emu.grasscutter.net.proto.SceneUnlockInfoNotifyOuterClass.internal_static_SceneUnlockInfoNotify_fieldAccessorTable
.ensureFieldAccessorsInitialized(
emu.grasscutter.net.proto.SceneUnlockInfoNotifyOuterClass.SceneUnlockInfoNotify.class, emu.grasscutter.net.proto.SceneUnlockInfoNotifyOuterClass.SceneUnlockInfoNotify.Builder.class);
}
public static final int UNLOCKINFOS_FIELD_NUMBER = 1;
private java.util.List<emu.grasscutter.net.proto.SceneUnlockInfoOuterClass.SceneUnlockInfo> unlockInfos_;
/**
* <code>repeated .SceneUnlockInfo unlockInfos = 1;</code>
*/
@java.lang.Override
public java.util.List<emu.grasscutter.net.proto.SceneUnlockInfoOuterClass.SceneUnlockInfo> getUnlockInfosList() {
return unlockInfos_;
}
/**
* <code>repeated .SceneUnlockInfo unlockInfos = 1;</code>
*/
@java.lang.Override
public java.util.List<? extends emu.grasscutter.net.proto.SceneUnlockInfoOuterClass.SceneUnlockInfoOrBuilder>
getUnlockInfosOrBuilderList() {
return unlockInfos_;
}
/**
* <code>repeated .SceneUnlockInfo unlockInfos = 1;</code>
*/
@java.lang.Override
public int getUnlockInfosCount() {
return unlockInfos_.size();
}
/**
* <code>repeated .SceneUnlockInfo unlockInfos = 1;</code>
*/
@java.lang.Override
public emu.grasscutter.net.proto.SceneUnlockInfoOuterClass.SceneUnlockInfo getUnlockInfos(int index) {
return unlockInfos_.get(index);
}
/**
* <code>repeated .SceneUnlockInfo unlockInfos = 1;</code>
*/
@java.lang.Override
public emu.grasscutter.net.proto.SceneUnlockInfoOuterClass.SceneUnlockInfoOrBuilder getUnlockInfosOrBuilder(
int index) {
return unlockInfos_.get(index);
}
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 {
for (int i = 0; i < unlockInfos_.size(); i++) {
output.writeMessage(1, unlockInfos_.get(i));
}
unknownFields.writeTo(output);
}
@java.lang.Override
public int getSerializedSize() {
int size = memoizedSize;
if (size != -1) return size;
size = 0;
for (int i = 0; i < unlockInfos_.size(); i++) {
size += com.google.protobuf.CodedOutputStream
.computeMessageSize(1, unlockInfos_.get(i));
}
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.SceneUnlockInfoNotifyOuterClass.SceneUnlockInfoNotify)) {
return super.equals(obj);
}
emu.grasscutter.net.proto.SceneUnlockInfoNotifyOuterClass.SceneUnlockInfoNotify other = (emu.grasscutter.net.proto.SceneUnlockInfoNotifyOuterClass.SceneUnlockInfoNotify) obj;
if (!getUnlockInfosList()
.equals(other.getUnlockInfosList())) 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();
if (getUnlockInfosCount() > 0) {
hash = (37 * hash) + UNLOCKINFOS_FIELD_NUMBER;
hash = (53 * hash) + getUnlockInfosList().hashCode();
}
hash = (29 * hash) + unknownFields.hashCode();
memoizedHashCode = hash;
return hash;
}
public static emu.grasscutter.net.proto.SceneUnlockInfoNotifyOuterClass.SceneUnlockInfoNotify parseFrom(
java.nio.ByteBuffer data)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data);
}
public static emu.grasscutter.net.proto.SceneUnlockInfoNotifyOuterClass.SceneUnlockInfoNotify 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.SceneUnlockInfoNotifyOuterClass.SceneUnlockInfoNotify parseFrom(
com.google.protobuf.ByteString data)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data);
}
public static emu.grasscutter.net.proto.SceneUnlockInfoNotifyOuterClass.SceneUnlockInfoNotify 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.SceneUnlockInfoNotifyOuterClass.SceneUnlockInfoNotify parseFrom(byte[] data)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data);
}
public static emu.grasscutter.net.proto.SceneUnlockInfoNotifyOuterClass.SceneUnlockInfoNotify parseFrom(
byte[] data,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data, extensionRegistry);
}
public static emu.grasscutter.net.proto.SceneUnlockInfoNotifyOuterClass.SceneUnlockInfoNotify parseFrom(java.io.InputStream input)
throws java.io.IOException {
return com.google.protobuf.GeneratedMessageV3
.parseWithIOException(PARSER, input);
}
public static emu.grasscutter.net.proto.SceneUnlockInfoNotifyOuterClass.SceneUnlockInfoNotify 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.SceneUnlockInfoNotifyOuterClass.SceneUnlockInfoNotify parseDelimitedFrom(java.io.InputStream input)
throws java.io.IOException {
return com.google.protobuf.GeneratedMessageV3
.parseDelimitedWithIOException(PARSER, input);
}
public static emu.grasscutter.net.proto.SceneUnlockInfoNotifyOuterClass.SceneUnlockInfoNotify 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.SceneUnlockInfoNotifyOuterClass.SceneUnlockInfoNotify parseFrom(
com.google.protobuf.CodedInputStream input)
throws java.io.IOException {
return com.google.protobuf.GeneratedMessageV3
.parseWithIOException(PARSER, input);
}
public static emu.grasscutter.net.proto.SceneUnlockInfoNotifyOuterClass.SceneUnlockInfoNotify 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.SceneUnlockInfoNotifyOuterClass.SceneUnlockInfoNotify 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 SceneUnlockInfoNotify}
*/
public static final class Builder extends
com.google.protobuf.GeneratedMessageV3.Builder<Builder> implements
// @@protoc_insertion_point(builder_implements:SceneUnlockInfoNotify)
emu.grasscutter.net.proto.SceneUnlockInfoNotifyOuterClass.SceneUnlockInfoNotifyOrBuilder {
public static final com.google.protobuf.Descriptors.Descriptor
getDescriptor() {
return emu.grasscutter.net.proto.SceneUnlockInfoNotifyOuterClass.internal_static_SceneUnlockInfoNotify_descriptor;
}
@java.lang.Override
protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
internalGetFieldAccessorTable() {
return emu.grasscutter.net.proto.SceneUnlockInfoNotifyOuterClass.internal_static_SceneUnlockInfoNotify_fieldAccessorTable
.ensureFieldAccessorsInitialized(
emu.grasscutter.net.proto.SceneUnlockInfoNotifyOuterClass.SceneUnlockInfoNotify.class, emu.grasscutter.net.proto.SceneUnlockInfoNotifyOuterClass.SceneUnlockInfoNotify.Builder.class);
}
// Construct using emu.grasscutter.net.proto.SceneUnlockInfoNotifyOuterClass.SceneUnlockInfoNotify.newBuilder()
private Builder() {
maybeForceBuilderInitialization();
}
private Builder(
com.google.protobuf.GeneratedMessageV3.BuilderParent parent) {
super(parent);
maybeForceBuilderInitialization();
}
private void maybeForceBuilderInitialization() {
if (com.google.protobuf.GeneratedMessageV3
.alwaysUseFieldBuilders) {
getUnlockInfosFieldBuilder();
}
}
@java.lang.Override
public Builder clear() {
super.clear();
if (unlockInfosBuilder_ == null) {
unlockInfos_ = java.util.Collections.emptyList();
bitField0_ = (bitField0_ & ~0x00000001);
} else {
unlockInfosBuilder_.clear();
}
return this;
}
@java.lang.Override
public com.google.protobuf.Descriptors.Descriptor
getDescriptorForType() {
return emu.grasscutter.net.proto.SceneUnlockInfoNotifyOuterClass.internal_static_SceneUnlockInfoNotify_descriptor;
}
@java.lang.Override
public emu.grasscutter.net.proto.SceneUnlockInfoNotifyOuterClass.SceneUnlockInfoNotify getDefaultInstanceForType() {
return emu.grasscutter.net.proto.SceneUnlockInfoNotifyOuterClass.SceneUnlockInfoNotify.getDefaultInstance();
}
@java.lang.Override
public emu.grasscutter.net.proto.SceneUnlockInfoNotifyOuterClass.SceneUnlockInfoNotify build() {
emu.grasscutter.net.proto.SceneUnlockInfoNotifyOuterClass.SceneUnlockInfoNotify result = buildPartial();
if (!result.isInitialized()) {
throw newUninitializedMessageException(result);
}
return result;
}
@java.lang.Override
public emu.grasscutter.net.proto.SceneUnlockInfoNotifyOuterClass.SceneUnlockInfoNotify buildPartial() {
emu.grasscutter.net.proto.SceneUnlockInfoNotifyOuterClass.SceneUnlockInfoNotify result = new emu.grasscutter.net.proto.SceneUnlockInfoNotifyOuterClass.SceneUnlockInfoNotify(this);
int from_bitField0_ = bitField0_;
if (unlockInfosBuilder_ == null) {
if (((bitField0_ & 0x00000001) != 0)) {
unlockInfos_ = java.util.Collections.unmodifiableList(unlockInfos_);
bitField0_ = (bitField0_ & ~0x00000001);
}
result.unlockInfos_ = unlockInfos_;
} else {
result.unlockInfos_ = unlockInfosBuilder_.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.SceneUnlockInfoNotifyOuterClass.SceneUnlockInfoNotify) {
return mergeFrom((emu.grasscutter.net.proto.SceneUnlockInfoNotifyOuterClass.SceneUnlockInfoNotify)other);
} else {
super.mergeFrom(other);
return this;
}
}
public Builder mergeFrom(emu.grasscutter.net.proto.SceneUnlockInfoNotifyOuterClass.SceneUnlockInfoNotify other) {
if (other == emu.grasscutter.net.proto.SceneUnlockInfoNotifyOuterClass.SceneUnlockInfoNotify.getDefaultInstance()) return this;
if (unlockInfosBuilder_ == null) {
if (!other.unlockInfos_.isEmpty()) {
if (unlockInfos_.isEmpty()) {
unlockInfos_ = other.unlockInfos_;
bitField0_ = (bitField0_ & ~0x00000001);
} else {
ensureUnlockInfosIsMutable();
unlockInfos_.addAll(other.unlockInfos_);
}
onChanged();
}
} else {
if (!other.unlockInfos_.isEmpty()) {
if (unlockInfosBuilder_.isEmpty()) {
unlockInfosBuilder_.dispose();
unlockInfosBuilder_ = null;
unlockInfos_ = other.unlockInfos_;
bitField0_ = (bitField0_ & ~0x00000001);
unlockInfosBuilder_ =
com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders ?
getUnlockInfosFieldBuilder() : null;
} else {
unlockInfosBuilder_.addAllMessages(other.unlockInfos_);
}
}
}
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.SceneUnlockInfoNotifyOuterClass.SceneUnlockInfoNotify parsedMessage = null;
try {
parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry);
} catch (com.google.protobuf.InvalidProtocolBufferException e) {
parsedMessage = (emu.grasscutter.net.proto.SceneUnlockInfoNotifyOuterClass.SceneUnlockInfoNotify) e.getUnfinishedMessage();
throw e.unwrapIOException();
} finally {
if (parsedMessage != null) {
mergeFrom(parsedMessage);
}
}
return this;
}
private int bitField0_;
private java.util.List<emu.grasscutter.net.proto.SceneUnlockInfoOuterClass.SceneUnlockInfo> unlockInfos_ =
java.util.Collections.emptyList();
private void ensureUnlockInfosIsMutable() {
if (!((bitField0_ & 0x00000001) != 0)) {
unlockInfos_ = new java.util.ArrayList<emu.grasscutter.net.proto.SceneUnlockInfoOuterClass.SceneUnlockInfo>(unlockInfos_);
bitField0_ |= 0x00000001;
}
}
private com.google.protobuf.RepeatedFieldBuilderV3<
emu.grasscutter.net.proto.SceneUnlockInfoOuterClass.SceneUnlockInfo, emu.grasscutter.net.proto.SceneUnlockInfoOuterClass.SceneUnlockInfo.Builder, emu.grasscutter.net.proto.SceneUnlockInfoOuterClass.SceneUnlockInfoOrBuilder> unlockInfosBuilder_;
/**
* <code>repeated .SceneUnlockInfo unlockInfos = 1;</code>
*/
public java.util.List<emu.grasscutter.net.proto.SceneUnlockInfoOuterClass.SceneUnlockInfo> getUnlockInfosList() {
if (unlockInfosBuilder_ == null) {
return java.util.Collections.unmodifiableList(unlockInfos_);
} else {
return unlockInfosBuilder_.getMessageList();
}
}
/**
* <code>repeated .SceneUnlockInfo unlockInfos = 1;</code>
*/
public int getUnlockInfosCount() {
if (unlockInfosBuilder_ == null) {
return unlockInfos_.size();
} else {
return unlockInfosBuilder_.getCount();
}
}
/**
* <code>repeated .SceneUnlockInfo unlockInfos = 1;</code>
*/
public emu.grasscutter.net.proto.SceneUnlockInfoOuterClass.SceneUnlockInfo getUnlockInfos(int index) {
if (unlockInfosBuilder_ == null) {
return unlockInfos_.get(index);
} else {
return unlockInfosBuilder_.getMessage(index);
}
}
/**
* <code>repeated .SceneUnlockInfo unlockInfos = 1;</code>
*/
public Builder setUnlockInfos(
int index, emu.grasscutter.net.proto.SceneUnlockInfoOuterClass.SceneUnlockInfo value) {
if (unlockInfosBuilder_ == null) {
if (value == null) {
throw new NullPointerException();
}
ensureUnlockInfosIsMutable();
unlockInfos_.set(index, value);
onChanged();
} else {
unlockInfosBuilder_.setMessage(index, value);
}
return this;
}
/**
* <code>repeated .SceneUnlockInfo unlockInfos = 1;</code>
*/
public Builder setUnlockInfos(
int index, emu.grasscutter.net.proto.SceneUnlockInfoOuterClass.SceneUnlockInfo.Builder builderForValue) {
if (unlockInfosBuilder_ == null) {
ensureUnlockInfosIsMutable();
unlockInfos_.set(index, builderForValue.build());
onChanged();
} else {
unlockInfosBuilder_.setMessage(index, builderForValue.build());
}
return this;
}
/**
* <code>repeated .SceneUnlockInfo unlockInfos = 1;</code>
*/
public Builder addUnlockInfos(emu.grasscutter.net.proto.SceneUnlockInfoOuterClass.SceneUnlockInfo value) {
if (unlockInfosBuilder_ == null) {
if (value == null) {
throw new NullPointerException();
}
ensureUnlockInfosIsMutable();
unlockInfos_.add(value);
onChanged();
} else {
unlockInfosBuilder_.addMessage(value);
}
return this;
}
/**
* <code>repeated .SceneUnlockInfo unlockInfos = 1;</code>
*/
public Builder addUnlockInfos(
int index, emu.grasscutter.net.proto.SceneUnlockInfoOuterClass.SceneUnlockInfo value) {
if (unlockInfosBuilder_ == null) {
if (value == null) {
throw new NullPointerException();
}
ensureUnlockInfosIsMutable();
unlockInfos_.add(index, value);
onChanged();
} else {
unlockInfosBuilder_.addMessage(index, value);
}
return this;
}
/**
* <code>repeated .SceneUnlockInfo unlockInfos = 1;</code>
*/
public Builder addUnlockInfos(
emu.grasscutter.net.proto.SceneUnlockInfoOuterClass.SceneUnlockInfo.Builder builderForValue) {
if (unlockInfosBuilder_ == null) {
ensureUnlockInfosIsMutable();
unlockInfos_.add(builderForValue.build());
onChanged();
} else {
unlockInfosBuilder_.addMessage(builderForValue.build());
}
return this;
}
/**
* <code>repeated .SceneUnlockInfo unlockInfos = 1;</code>
*/
public Builder addUnlockInfos(
int index, emu.grasscutter.net.proto.SceneUnlockInfoOuterClass.SceneUnlockInfo.Builder builderForValue) {
if (unlockInfosBuilder_ == null) {
ensureUnlockInfosIsMutable();
unlockInfos_.add(index, builderForValue.build());
onChanged();
} else {
unlockInfosBuilder_.addMessage(index, builderForValue.build());
}
return this;
}
/**
* <code>repeated .SceneUnlockInfo unlockInfos = 1;</code>
*/
public Builder addAllUnlockInfos(
java.lang.Iterable<? extends emu.grasscutter.net.proto.SceneUnlockInfoOuterClass.SceneUnlockInfo> values) {
if (unlockInfosBuilder_ == null) {
ensureUnlockInfosIsMutable();
com.google.protobuf.AbstractMessageLite.Builder.addAll(
values, unlockInfos_);
onChanged();
} else {
unlockInfosBuilder_.addAllMessages(values);
}
return this;
}
/**
* <code>repeated .SceneUnlockInfo unlockInfos = 1;</code>
*/
public Builder clearUnlockInfos() {
if (unlockInfosBuilder_ == null) {
unlockInfos_ = java.util.Collections.emptyList();
bitField0_ = (bitField0_ & ~0x00000001);
onChanged();
} else {
unlockInfosBuilder_.clear();
}
return this;
}
/**
* <code>repeated .SceneUnlockInfo unlockInfos = 1;</code>
*/
public Builder removeUnlockInfos(int index) {
if (unlockInfosBuilder_ == null) {
ensureUnlockInfosIsMutable();
unlockInfos_.remove(index);
onChanged();
} else {
unlockInfosBuilder_.remove(index);
}
return this;
}
/**
* <code>repeated .SceneUnlockInfo unlockInfos = 1;</code>
*/
public emu.grasscutter.net.proto.SceneUnlockInfoOuterClass.SceneUnlockInfo.Builder getUnlockInfosBuilder(
int index) {
return getUnlockInfosFieldBuilder().getBuilder(index);
}
/**
* <code>repeated .SceneUnlockInfo unlockInfos = 1;</code>
*/
public emu.grasscutter.net.proto.SceneUnlockInfoOuterClass.SceneUnlockInfoOrBuilder getUnlockInfosOrBuilder(
int index) {
if (unlockInfosBuilder_ == null) {
return unlockInfos_.get(index); } else {
return unlockInfosBuilder_.getMessageOrBuilder(index);
}
}
/**
* <code>repeated .SceneUnlockInfo unlockInfos = 1;</code>
*/
public java.util.List<? extends emu.grasscutter.net.proto.SceneUnlockInfoOuterClass.SceneUnlockInfoOrBuilder>
getUnlockInfosOrBuilderList() {
if (unlockInfosBuilder_ != null) {
return unlockInfosBuilder_.getMessageOrBuilderList();
} else {
return java.util.Collections.unmodifiableList(unlockInfos_);
}
}
/**
* <code>repeated .SceneUnlockInfo unlockInfos = 1;</code>
*/
public emu.grasscutter.net.proto.SceneUnlockInfoOuterClass.SceneUnlockInfo.Builder addUnlockInfosBuilder() {
return getUnlockInfosFieldBuilder().addBuilder(
emu.grasscutter.net.proto.SceneUnlockInfoOuterClass.SceneUnlockInfo.getDefaultInstance());
}
/**
* <code>repeated .SceneUnlockInfo unlockInfos = 1;</code>
*/
public emu.grasscutter.net.proto.SceneUnlockInfoOuterClass.SceneUnlockInfo.Builder addUnlockInfosBuilder(
int index) {
return getUnlockInfosFieldBuilder().addBuilder(
index, emu.grasscutter.net.proto.SceneUnlockInfoOuterClass.SceneUnlockInfo.getDefaultInstance());
}
/**
* <code>repeated .SceneUnlockInfo unlockInfos = 1;</code>
*/
public java.util.List<emu.grasscutter.net.proto.SceneUnlockInfoOuterClass.SceneUnlockInfo.Builder>
getUnlockInfosBuilderList() {
return getUnlockInfosFieldBuilder().getBuilderList();
}
private com.google.protobuf.RepeatedFieldBuilderV3<
emu.grasscutter.net.proto.SceneUnlockInfoOuterClass.SceneUnlockInfo, emu.grasscutter.net.proto.SceneUnlockInfoOuterClass.SceneUnlockInfo.Builder, emu.grasscutter.net.proto.SceneUnlockInfoOuterClass.SceneUnlockInfoOrBuilder>
getUnlockInfosFieldBuilder() {
if (unlockInfosBuilder_ == null) {
unlockInfosBuilder_ = new com.google.protobuf.RepeatedFieldBuilderV3<
emu.grasscutter.net.proto.SceneUnlockInfoOuterClass.SceneUnlockInfo, emu.grasscutter.net.proto.SceneUnlockInfoOuterClass.SceneUnlockInfo.Builder, emu.grasscutter.net.proto.SceneUnlockInfoOuterClass.SceneUnlockInfoOrBuilder>(
unlockInfos_,
((bitField0_ & 0x00000001) != 0),
getParentForChildren(),
isClean());
unlockInfos_ = null;
}
return unlockInfosBuilder_;
}
@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:SceneUnlockInfoNotify)
}
// @@protoc_insertion_point(class_scope:SceneUnlockInfoNotify)
private static final emu.grasscutter.net.proto.SceneUnlockInfoNotifyOuterClass.SceneUnlockInfoNotify DEFAULT_INSTANCE;
static {
DEFAULT_INSTANCE = new emu.grasscutter.net.proto.SceneUnlockInfoNotifyOuterClass.SceneUnlockInfoNotify();
}
public static emu.grasscutter.net.proto.SceneUnlockInfoNotifyOuterClass.SceneUnlockInfoNotify getDefaultInstance() {
return DEFAULT_INSTANCE;
}
private static final com.google.protobuf.Parser<SceneUnlockInfoNotify>
PARSER = new com.google.protobuf.AbstractParser<SceneUnlockInfoNotify>() {
@java.lang.Override
public SceneUnlockInfoNotify parsePartialFrom(
com.google.protobuf.CodedInputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
return new SceneUnlockInfoNotify(input, extensionRegistry);
}
};
public static com.google.protobuf.Parser<SceneUnlockInfoNotify> parser() {
return PARSER;
}
@java.lang.Override
public com.google.protobuf.Parser<SceneUnlockInfoNotify> getParserForType() {
return PARSER;
}
@java.lang.Override
public emu.grasscutter.net.proto.SceneUnlockInfoNotifyOuterClass.SceneUnlockInfoNotify getDefaultInstanceForType() {
return DEFAULT_INSTANCE;
}
}
private static final com.google.protobuf.Descriptors.Descriptor
internal_static_SceneUnlockInfoNotify_descriptor;
private static final
com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
internal_static_SceneUnlockInfoNotify_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\033SceneUnlockInfoNotify.proto\032\025SceneUnlo" +
"ckInfo.proto\">\n\025SceneUnlockInfoNotify\022%\n" +
"\013unlockInfos\030\001 \003(\0132\020.SceneUnlockInfoB\033\n\031" +
"emu.grasscutter.net.protob\006proto3"
};
descriptor = com.google.protobuf.Descriptors.FileDescriptor
.internalBuildGeneratedFileFrom(descriptorData,
new com.google.protobuf.Descriptors.FileDescriptor[] {
emu.grasscutter.net.proto.SceneUnlockInfoOuterClass.getDescriptor(),
});
internal_static_SceneUnlockInfoNotify_descriptor =
getDescriptor().getMessageTypes().get(0);
internal_static_SceneUnlockInfoNotify_fieldAccessorTable = new
com.google.protobuf.GeneratedMessageV3.FieldAccessorTable(
internal_static_SceneUnlockInfoNotify_descriptor,
new java.lang.String[] { "UnlockInfos", });
emu.grasscutter.net.proto.SceneUnlockInfoOuterClass.getDescriptor();
}
// @@protoc_insertion_point(outer_class_scope)
}

View File

@ -0,0 +1,805 @@
// Generated by the protocol buffer compiler. DO NOT EDIT!
// source: SceneUnlockInfo.proto
package emu.grasscutter.net.proto;
public final class SceneUnlockInfoOuterClass {
private SceneUnlockInfoOuterClass() {}
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 SceneUnlockInfoOrBuilder extends
// @@protoc_insertion_point(interface_extends:SceneUnlockInfo)
com.google.protobuf.MessageOrBuilder {
/**
* <code>uint32 sceneId = 1;</code>
* @return The sceneId.
*/
int getSceneId();
/**
* <code>bool isLocked = 2;</code>
* @return The isLocked.
*/
boolean getIsLocked();
/**
* <code>repeated uint32 sceneTagIdList = 3;</code>
* @return A list containing the sceneTagIdList.
*/
java.util.List<java.lang.Integer> getSceneTagIdListList();
/**
* <code>repeated uint32 sceneTagIdList = 3;</code>
* @return The count of sceneTagIdList.
*/
int getSceneTagIdListCount();
/**
* <code>repeated uint32 sceneTagIdList = 3;</code>
* @param index The index of the element to return.
* @return The sceneTagIdList at the given index.
*/
int getSceneTagIdList(int index);
}
/**
* Protobuf type {@code SceneUnlockInfo}
*/
public static final class SceneUnlockInfo extends
com.google.protobuf.GeneratedMessageV3 implements
// @@protoc_insertion_point(message_implements:SceneUnlockInfo)
SceneUnlockInfoOrBuilder {
private static final long serialVersionUID = 0L;
// Use SceneUnlockInfo.newBuilder() to construct.
private SceneUnlockInfo(com.google.protobuf.GeneratedMessageV3.Builder<?> builder) {
super(builder);
}
private SceneUnlockInfo() {
sceneTagIdList_ = emptyIntList();
}
@java.lang.Override
@SuppressWarnings({"unused"})
protected java.lang.Object newInstance(
UnusedPrivateParameter unused) {
return new SceneUnlockInfo();
}
@java.lang.Override
public final com.google.protobuf.UnknownFieldSet
getUnknownFields() {
return this.unknownFields;
}
private SceneUnlockInfo(
com.google.protobuf.CodedInputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
this();
if (extensionRegistry == null) {
throw new java.lang.NullPointerException();
}
int mutable_bitField0_ = 0;
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 16: {
isLocked_ = input.readBool();
break;
}
case 24: {
if (!((mutable_bitField0_ & 0x00000001) != 0)) {
sceneTagIdList_ = newIntList();
mutable_bitField0_ |= 0x00000001;
}
sceneTagIdList_.addInt(input.readUInt32());
break;
}
case 26: {
int length = input.readRawVarint32();
int limit = input.pushLimit(length);
if (!((mutable_bitField0_ & 0x00000001) != 0) && input.getBytesUntilLimit() > 0) {
sceneTagIdList_ = newIntList();
mutable_bitField0_ |= 0x00000001;
}
while (input.getBytesUntilLimit() > 0) {
sceneTagIdList_.addInt(input.readUInt32());
}
input.popLimit(limit);
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 {
if (((mutable_bitField0_ & 0x00000001) != 0)) {
sceneTagIdList_.makeImmutable(); // C
}
this.unknownFields = unknownFields.build();
makeExtensionsImmutable();
}
}
public static final com.google.protobuf.Descriptors.Descriptor
getDescriptor() {
return emu.grasscutter.net.proto.SceneUnlockInfoOuterClass.internal_static_SceneUnlockInfo_descriptor;
}
@java.lang.Override
protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
internalGetFieldAccessorTable() {
return emu.grasscutter.net.proto.SceneUnlockInfoOuterClass.internal_static_SceneUnlockInfo_fieldAccessorTable
.ensureFieldAccessorsInitialized(
emu.grasscutter.net.proto.SceneUnlockInfoOuterClass.SceneUnlockInfo.class, emu.grasscutter.net.proto.SceneUnlockInfoOuterClass.SceneUnlockInfo.Builder.class);
}
public static final int SCENEID_FIELD_NUMBER = 1;
private int sceneId_;
/**
* <code>uint32 sceneId = 1;</code>
* @return The sceneId.
*/
@java.lang.Override
public int getSceneId() {
return sceneId_;
}
public static final int ISLOCKED_FIELD_NUMBER = 2;
private boolean isLocked_;
/**
* <code>bool isLocked = 2;</code>
* @return The isLocked.
*/
@java.lang.Override
public boolean getIsLocked() {
return isLocked_;
}
public static final int SCENETAGIDLIST_FIELD_NUMBER = 3;
private com.google.protobuf.Internal.IntList sceneTagIdList_;
/**
* <code>repeated uint32 sceneTagIdList = 3;</code>
* @return A list containing the sceneTagIdList.
*/
@java.lang.Override
public java.util.List<java.lang.Integer>
getSceneTagIdListList() {
return sceneTagIdList_;
}
/**
* <code>repeated uint32 sceneTagIdList = 3;</code>
* @return The count of sceneTagIdList.
*/
public int getSceneTagIdListCount() {
return sceneTagIdList_.size();
}
/**
* <code>repeated uint32 sceneTagIdList = 3;</code>
* @param index The index of the element to return.
* @return The sceneTagIdList at the given index.
*/
public int getSceneTagIdList(int index) {
return sceneTagIdList_.getInt(index);
}
private int sceneTagIdListMemoizedSerializedSize = -1;
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 {
getSerializedSize();
if (sceneId_ != 0) {
output.writeUInt32(1, sceneId_);
}
if (isLocked_ != false) {
output.writeBool(2, isLocked_);
}
if (getSceneTagIdListList().size() > 0) {
output.writeUInt32NoTag(26);
output.writeUInt32NoTag(sceneTagIdListMemoizedSerializedSize);
}
for (int i = 0; i < sceneTagIdList_.size(); i++) {
output.writeUInt32NoTag(sceneTagIdList_.getInt(i));
}
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 (isLocked_ != false) {
size += com.google.protobuf.CodedOutputStream
.computeBoolSize(2, isLocked_);
}
{
int dataSize = 0;
for (int i = 0; i < sceneTagIdList_.size(); i++) {
dataSize += com.google.protobuf.CodedOutputStream
.computeUInt32SizeNoTag(sceneTagIdList_.getInt(i));
}
size += dataSize;
if (!getSceneTagIdListList().isEmpty()) {
size += 1;
size += com.google.protobuf.CodedOutputStream
.computeInt32SizeNoTag(dataSize);
}
sceneTagIdListMemoizedSerializedSize = dataSize;
}
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.SceneUnlockInfoOuterClass.SceneUnlockInfo)) {
return super.equals(obj);
}
emu.grasscutter.net.proto.SceneUnlockInfoOuterClass.SceneUnlockInfo other = (emu.grasscutter.net.proto.SceneUnlockInfoOuterClass.SceneUnlockInfo) obj;
if (getSceneId()
!= other.getSceneId()) return false;
if (getIsLocked()
!= other.getIsLocked()) return false;
if (!getSceneTagIdListList()
.equals(other.getSceneTagIdListList())) 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();
hash = (37 * hash) + ISLOCKED_FIELD_NUMBER;
hash = (53 * hash) + com.google.protobuf.Internal.hashBoolean(
getIsLocked());
if (getSceneTagIdListCount() > 0) {
hash = (37 * hash) + SCENETAGIDLIST_FIELD_NUMBER;
hash = (53 * hash) + getSceneTagIdListList().hashCode();
}
hash = (29 * hash) + unknownFields.hashCode();
memoizedHashCode = hash;
return hash;
}
public static emu.grasscutter.net.proto.SceneUnlockInfoOuterClass.SceneUnlockInfo parseFrom(
java.nio.ByteBuffer data)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data);
}
public static emu.grasscutter.net.proto.SceneUnlockInfoOuterClass.SceneUnlockInfo 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.SceneUnlockInfoOuterClass.SceneUnlockInfo parseFrom(
com.google.protobuf.ByteString data)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data);
}
public static emu.grasscutter.net.proto.SceneUnlockInfoOuterClass.SceneUnlockInfo 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.SceneUnlockInfoOuterClass.SceneUnlockInfo parseFrom(byte[] data)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data);
}
public static emu.grasscutter.net.proto.SceneUnlockInfoOuterClass.SceneUnlockInfo parseFrom(
byte[] data,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data, extensionRegistry);
}
public static emu.grasscutter.net.proto.SceneUnlockInfoOuterClass.SceneUnlockInfo parseFrom(java.io.InputStream input)
throws java.io.IOException {
return com.google.protobuf.GeneratedMessageV3
.parseWithIOException(PARSER, input);
}
public static emu.grasscutter.net.proto.SceneUnlockInfoOuterClass.SceneUnlockInfo 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.SceneUnlockInfoOuterClass.SceneUnlockInfo parseDelimitedFrom(java.io.InputStream input)
throws java.io.IOException {
return com.google.protobuf.GeneratedMessageV3
.parseDelimitedWithIOException(PARSER, input);
}
public static emu.grasscutter.net.proto.SceneUnlockInfoOuterClass.SceneUnlockInfo 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.SceneUnlockInfoOuterClass.SceneUnlockInfo parseFrom(
com.google.protobuf.CodedInputStream input)
throws java.io.IOException {
return com.google.protobuf.GeneratedMessageV3
.parseWithIOException(PARSER, input);
}
public static emu.grasscutter.net.proto.SceneUnlockInfoOuterClass.SceneUnlockInfo 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.SceneUnlockInfoOuterClass.SceneUnlockInfo 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 SceneUnlockInfo}
*/
public static final class Builder extends
com.google.protobuf.GeneratedMessageV3.Builder<Builder> implements
// @@protoc_insertion_point(builder_implements:SceneUnlockInfo)
emu.grasscutter.net.proto.SceneUnlockInfoOuterClass.SceneUnlockInfoOrBuilder {
public static final com.google.protobuf.Descriptors.Descriptor
getDescriptor() {
return emu.grasscutter.net.proto.SceneUnlockInfoOuterClass.internal_static_SceneUnlockInfo_descriptor;
}
@java.lang.Override
protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
internalGetFieldAccessorTable() {
return emu.grasscutter.net.proto.SceneUnlockInfoOuterClass.internal_static_SceneUnlockInfo_fieldAccessorTable
.ensureFieldAccessorsInitialized(
emu.grasscutter.net.proto.SceneUnlockInfoOuterClass.SceneUnlockInfo.class, emu.grasscutter.net.proto.SceneUnlockInfoOuterClass.SceneUnlockInfo.Builder.class);
}
// Construct using emu.grasscutter.net.proto.SceneUnlockInfoOuterClass.SceneUnlockInfo.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;
isLocked_ = false;
sceneTagIdList_ = emptyIntList();
bitField0_ = (bitField0_ & ~0x00000001);
return this;
}
@java.lang.Override
public com.google.protobuf.Descriptors.Descriptor
getDescriptorForType() {
return emu.grasscutter.net.proto.SceneUnlockInfoOuterClass.internal_static_SceneUnlockInfo_descriptor;
}
@java.lang.Override
public emu.grasscutter.net.proto.SceneUnlockInfoOuterClass.SceneUnlockInfo getDefaultInstanceForType() {
return emu.grasscutter.net.proto.SceneUnlockInfoOuterClass.SceneUnlockInfo.getDefaultInstance();
}
@java.lang.Override
public emu.grasscutter.net.proto.SceneUnlockInfoOuterClass.SceneUnlockInfo build() {
emu.grasscutter.net.proto.SceneUnlockInfoOuterClass.SceneUnlockInfo result = buildPartial();
if (!result.isInitialized()) {
throw newUninitializedMessageException(result);
}
return result;
}
@java.lang.Override
public emu.grasscutter.net.proto.SceneUnlockInfoOuterClass.SceneUnlockInfo buildPartial() {
emu.grasscutter.net.proto.SceneUnlockInfoOuterClass.SceneUnlockInfo result = new emu.grasscutter.net.proto.SceneUnlockInfoOuterClass.SceneUnlockInfo(this);
int from_bitField0_ = bitField0_;
result.sceneId_ = sceneId_;
result.isLocked_ = isLocked_;
if (((bitField0_ & 0x00000001) != 0)) {
sceneTagIdList_.makeImmutable();
bitField0_ = (bitField0_ & ~0x00000001);
}
result.sceneTagIdList_ = sceneTagIdList_;
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.SceneUnlockInfoOuterClass.SceneUnlockInfo) {
return mergeFrom((emu.grasscutter.net.proto.SceneUnlockInfoOuterClass.SceneUnlockInfo)other);
} else {
super.mergeFrom(other);
return this;
}
}
public Builder mergeFrom(emu.grasscutter.net.proto.SceneUnlockInfoOuterClass.SceneUnlockInfo other) {
if (other == emu.grasscutter.net.proto.SceneUnlockInfoOuterClass.SceneUnlockInfo.getDefaultInstance()) return this;
if (other.getSceneId() != 0) {
setSceneId(other.getSceneId());
}
if (other.getIsLocked() != false) {
setIsLocked(other.getIsLocked());
}
if (!other.sceneTagIdList_.isEmpty()) {
if (sceneTagIdList_.isEmpty()) {
sceneTagIdList_ = other.sceneTagIdList_;
bitField0_ = (bitField0_ & ~0x00000001);
} else {
ensureSceneTagIdListIsMutable();
sceneTagIdList_.addAll(other.sceneTagIdList_);
}
onChanged();
}
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.SceneUnlockInfoOuterClass.SceneUnlockInfo parsedMessage = null;
try {
parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry);
} catch (com.google.protobuf.InvalidProtocolBufferException e) {
parsedMessage = (emu.grasscutter.net.proto.SceneUnlockInfoOuterClass.SceneUnlockInfo) e.getUnfinishedMessage();
throw e.unwrapIOException();
} finally {
if (parsedMessage != null) {
mergeFrom(parsedMessage);
}
}
return this;
}
private int bitField0_;
private int sceneId_ ;
/**
* <code>uint32 sceneId = 1;</code>
* @return The sceneId.
*/
@java.lang.Override
public int getSceneId() {
return sceneId_;
}
/**
* <code>uint32 sceneId = 1;</code>
* @param value The sceneId to set.
* @return This builder for chaining.
*/
public Builder setSceneId(int value) {
sceneId_ = value;
onChanged();
return this;
}
/**
* <code>uint32 sceneId = 1;</code>
* @return This builder for chaining.
*/
public Builder clearSceneId() {
sceneId_ = 0;
onChanged();
return this;
}
private boolean isLocked_ ;
/**
* <code>bool isLocked = 2;</code>
* @return The isLocked.
*/
@java.lang.Override
public boolean getIsLocked() {
return isLocked_;
}
/**
* <code>bool isLocked = 2;</code>
* @param value The isLocked to set.
* @return This builder for chaining.
*/
public Builder setIsLocked(boolean value) {
isLocked_ = value;
onChanged();
return this;
}
/**
* <code>bool isLocked = 2;</code>
* @return This builder for chaining.
*/
public Builder clearIsLocked() {
isLocked_ = false;
onChanged();
return this;
}
private com.google.protobuf.Internal.IntList sceneTagIdList_ = emptyIntList();
private void ensureSceneTagIdListIsMutable() {
if (!((bitField0_ & 0x00000001) != 0)) {
sceneTagIdList_ = mutableCopy(sceneTagIdList_);
bitField0_ |= 0x00000001;
}
}
/**
* <code>repeated uint32 sceneTagIdList = 3;</code>
* @return A list containing the sceneTagIdList.
*/
public java.util.List<java.lang.Integer>
getSceneTagIdListList() {
return ((bitField0_ & 0x00000001) != 0) ?
java.util.Collections.unmodifiableList(sceneTagIdList_) : sceneTagIdList_;
}
/**
* <code>repeated uint32 sceneTagIdList = 3;</code>
* @return The count of sceneTagIdList.
*/
public int getSceneTagIdListCount() {
return sceneTagIdList_.size();
}
/**
* <code>repeated uint32 sceneTagIdList = 3;</code>
* @param index The index of the element to return.
* @return The sceneTagIdList at the given index.
*/
public int getSceneTagIdList(int index) {
return sceneTagIdList_.getInt(index);
}
/**
* <code>repeated uint32 sceneTagIdList = 3;</code>
* @param index The index to set the value at.
* @param value The sceneTagIdList to set.
* @return This builder for chaining.
*/
public Builder setSceneTagIdList(
int index, int value) {
ensureSceneTagIdListIsMutable();
sceneTagIdList_.setInt(index, value);
onChanged();
return this;
}
/**
* <code>repeated uint32 sceneTagIdList = 3;</code>
* @param value The sceneTagIdList to add.
* @return This builder for chaining.
*/
public Builder addSceneTagIdList(int value) {
ensureSceneTagIdListIsMutable();
sceneTagIdList_.addInt(value);
onChanged();
return this;
}
/**
* <code>repeated uint32 sceneTagIdList = 3;</code>
* @param values The sceneTagIdList to add.
* @return This builder for chaining.
*/
public Builder addAllSceneTagIdList(
java.lang.Iterable<? extends java.lang.Integer> values) {
ensureSceneTagIdListIsMutable();
com.google.protobuf.AbstractMessageLite.Builder.addAll(
values, sceneTagIdList_);
onChanged();
return this;
}
/**
* <code>repeated uint32 sceneTagIdList = 3;</code>
* @return This builder for chaining.
*/
public Builder clearSceneTagIdList() {
sceneTagIdList_ = emptyIntList();
bitField0_ = (bitField0_ & ~0x00000001);
onChanged();
return this;
}
@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:SceneUnlockInfo)
}
// @@protoc_insertion_point(class_scope:SceneUnlockInfo)
private static final emu.grasscutter.net.proto.SceneUnlockInfoOuterClass.SceneUnlockInfo DEFAULT_INSTANCE;
static {
DEFAULT_INSTANCE = new emu.grasscutter.net.proto.SceneUnlockInfoOuterClass.SceneUnlockInfo();
}
public static emu.grasscutter.net.proto.SceneUnlockInfoOuterClass.SceneUnlockInfo getDefaultInstance() {
return DEFAULT_INSTANCE;
}
private static final com.google.protobuf.Parser<SceneUnlockInfo>
PARSER = new com.google.protobuf.AbstractParser<SceneUnlockInfo>() {
@java.lang.Override
public SceneUnlockInfo parsePartialFrom(
com.google.protobuf.CodedInputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
return new SceneUnlockInfo(input, extensionRegistry);
}
};
public static com.google.protobuf.Parser<SceneUnlockInfo> parser() {
return PARSER;
}
@java.lang.Override
public com.google.protobuf.Parser<SceneUnlockInfo> getParserForType() {
return PARSER;
}
@java.lang.Override
public emu.grasscutter.net.proto.SceneUnlockInfoOuterClass.SceneUnlockInfo getDefaultInstanceForType() {
return DEFAULT_INSTANCE;
}
}
private static final com.google.protobuf.Descriptors.Descriptor
internal_static_SceneUnlockInfo_descriptor;
private static final
com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
internal_static_SceneUnlockInfo_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\025SceneUnlockInfo.proto\"L\n\017SceneUnlockIn" +
"fo\022\017\n\007sceneId\030\001 \001(\r\022\020\n\010isLocked\030\002 \001(\010\022\026\n" +
"\016sceneTagIdList\030\003 \003(\rB\033\n\031emu.grasscutter" +
".net.protob\006proto3"
};
descriptor = com.google.protobuf.Descriptors.FileDescriptor
.internalBuildGeneratedFileFrom(descriptorData,
new com.google.protobuf.Descriptors.FileDescriptor[] {
});
internal_static_SceneUnlockInfo_descriptor =
getDescriptor().getMessageTypes().get(0);
internal_static_SceneUnlockInfo_fieldAccessorTable = new
com.google.protobuf.GeneratedMessageV3.FieldAccessorTable(
internal_static_SceneUnlockInfo_descriptor,
new java.lang.String[] { "SceneId", "IsLocked", "SceneTagIdList", });
}
// @@protoc_insertion_point(outer_class_scope)
}

View File

@ -14,8 +14,8 @@ public class HandlerChangeGameTimeReq extends PacketHandler {
public void handle(GameSession session, byte[] header, byte[] payload) throws Exception {
ChangeGameTimeReq req = ChangeGameTimeReq.parseFrom(payload);
session.getPlayer().getWorld().changeTime(req.getGameTime());
session.getPlayer().sendPacket(new PacketChangeGameTimeRsp(session.getPlayer().getWorld()));
session.getPlayer().getScene().changeTime(req.getGameTime());
session.getPlayer().sendPacket(new PacketChangeGameTimeRsp(session.getPlayer()));
}
}

View File

@ -22,12 +22,12 @@ public class HandlerCombatInvocationsNotify extends PacketHandler {
case CombatEvtBeingHit:
// Handle damage
EvtBeingHitInfo hitInfo = EvtBeingHitInfo.parseFrom(entry.getCombatData());
session.getPlayer().getWorld().handleAttack(hitInfo.getAttackResult());
session.getPlayer().getScene().handleAttack(hitInfo.getAttackResult());
break;
case EntityMove:
// Handle movement
EntityMoveInfo moveInfo = EntityMoveInfo.parseFrom(entry.getCombatData());
GenshinEntity entity = session.getPlayer().getWorld().getEntityById(moveInfo.getEntityId());
GenshinEntity entity = session.getPlayer().getScene().getEntityById(moveInfo.getEntityId());
if (entity != null) {
entity.getPosition().set(moveInfo.getMotionInfo().getPos());
entity.getRotation().set(moveInfo.getMotionInfo().getRot());

View File

@ -24,10 +24,10 @@ public class HandlerEnterSceneDoneReq extends PacketHandler {
session.send(new PacketPlayerTimeNotify(session.getPlayer())); // Probably not the right place
// Spawn player in world
session.getPlayer().getWorld().spawnPlayer(session.getPlayer());
session.getPlayer().getScene().spawnPlayer(session.getPlayer());
// Spawn other entites already in world
session.getPlayer().getWorld().showOtherEntities(session.getPlayer());
session.getPlayer().getScene().showOtherEntities(session.getPlayer());
// Locations
session.send(new PacketWorldPlayerLocationNotify(session.getPlayer().getWorld()));

View File

@ -15,7 +15,7 @@ public class HandlerEntityAiSyncNotify extends PacketHandler {
EntityAiSyncNotify notify = EntityAiSyncNotify.parseFrom(payload);
if (notify.getLocalAvatarAlertedMonsterListCount() > 0) {
session.getPlayer().getWorld().broadcastPacket(new PacketEntityAiSyncNotify(notify));
session.getPlayer().getScene().broadcastPacket(new PacketEntityAiSyncNotify(notify));
}
}

View File

@ -20,13 +20,13 @@ public class HandlerEvtCreateGadgetNotify extends PacketHandler {
}
// Sanity check - dont add duplicate entities
if (session.getPlayer().getWorld().getEntityById(notify.getEntityId()) != null) {
if (session.getPlayer().getScene().getEntityById(notify.getEntityId()) != null) {
return;
}
// Create entity and summon in world
EntityClientGadget gadget = new EntityClientGadget(session.getPlayer().getWorld(), session.getPlayer(), notify);
session.getPlayer().getWorld().onPlayerCreateGadget(gadget);
EntityClientGadget gadget = new EntityClientGadget(session.getPlayer().getScene(), session.getPlayer(), notify);
session.getPlayer().getScene().onPlayerCreateGadget(gadget);
}
}

View File

@ -18,7 +18,7 @@ public class HandlerEvtDestroyGadgetNotify extends PacketHandler {
return;
}
session.getPlayer().getWorld().onPlayerDestroyGadget(notify.getEntityId());
session.getPlayer().getScene().onPlayerDestroyGadget(notify.getEntityId());
}
}

View File

@ -1,12 +1,16 @@
package emu.grasscutter.server.packet.recv;
import emu.grasscutter.Grasscutter;
import emu.grasscutter.game.World;
import emu.grasscutter.game.props.EnterReason;
import emu.grasscutter.net.packet.Opcodes;
import emu.grasscutter.net.packet.PacketOpcodes;
import emu.grasscutter.net.proto.EnterTypeOuterClass.EnterType;
import emu.grasscutter.net.proto.MarkMapReqOuterClass.MarkMapReq;
import emu.grasscutter.net.proto.OperationOuterClass.Operation;
import emu.grasscutter.net.packet.PacketHandler;
import emu.grasscutter.server.game.GameSession;
import emu.grasscutter.server.packet.send.PacketPlayerEnterSceneNotify;
import emu.grasscutter.server.packet.send.PacketSceneEntityAppearNotify;
@Opcodes(PacketOpcodes.MarkMapReq)
@ -19,14 +23,18 @@ public class HandlerMarkMapReq extends PacketHandler {
if (req.getOp() != Operation.Add) {
return;
}
session.getPlayer().getPos().setX(req.getMark().getPos().getX());
session.getPlayer().getPos().setZ(req.getMark().getPos().getZ());
session.getPlayer().getPos().setY(300);
Grasscutter.getLogger().info("Player [" + session.getPlayer().getId() + ":" + session.getPlayer().getNickname() + "] tp to " + session.getPlayer().getPos());
Grasscutter.getLogger().info("Player [" + session.getPlayer().getId() + ":" + session.getPlayer().getNickname() + "] tp to " + session.getPlayer().getPos() + " Scene id: " + req.getMark().getSceneId());
session.getPlayer().getWorld().broadcastPacket(new PacketSceneEntityAppearNotify(session.getPlayer()));
if (req.getMark().getSceneId() != session.getPlayer().getSceneId()) {
session.getPlayer().getWorld().transferPlayerToScene(session.getPlayer(), req.getMark().getSceneId(), session.getPlayer().getPos());
} else {
session.getPlayer().getScene().broadcastPacket(new PacketSceneEntityAppearNotify(session.getPlayer()));
}
}
}

View File

@ -14,6 +14,7 @@ import emu.grasscutter.server.packet.send.PacketSceneInitFinishRsp;
import emu.grasscutter.server.packet.send.PacketScenePlayerInfoNotify;
import emu.grasscutter.server.packet.send.PacketSceneTeamUpdateNotify;
import emu.grasscutter.server.packet.send.PacketSceneTimeNotify;
import emu.grasscutter.server.packet.send.PacketSceneUnlockInfoNotify;
import emu.grasscutter.server.packet.send.PacketServerTimeNotify;
import emu.grasscutter.server.packet.send.PacketSyncScenePlayTeamEntityNotify;
import emu.grasscutter.server.packet.send.PacketSyncTeamEntityNotify;
@ -29,13 +30,14 @@ public class HandlerSceneInitFinishReq extends PacketHandler {
session.send(new PacketServerTimeNotify());
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 PacketHostPlayerNotify(session.getPlayer().getWorld()));
session.send(new PacketSceneTimeNotify(session.getPlayer()));
session.send(new PacketPlayerGameTimeNotify(session.getPlayer().getWorld(), session.getPlayer()));
session.send(new PacketPlayerGameTimeNotify(session.getPlayer()));
session.send(new PacketPlayerEnterSceneInfoNotify(session.getPlayer()));
session.send(new PacketSceneAreaWeatherNotify(session.getPlayer().getWorld(), session.getPlayer()));
session.send(new PacketSceneAreaWeatherNotify(session.getPlayer()));
session.send(new PacketScenePlayerInfoNotify(session.getPlayer().getWorld()));
session.send(new PacketSceneTeamUpdateNotify(session.getPlayer()));

View File

@ -1,5 +1,6 @@
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.net.packet.PacketOpcodes;
@ -7,11 +8,11 @@ import emu.grasscutter.net.proto.ChangeGameTimeRspOuterClass.ChangeGameTimeRsp;
public class PacketChangeGameTimeRsp extends GenshinPacket {
public PacketChangeGameTimeRsp(World world) {
public PacketChangeGameTimeRsp(GenshinPlayer player) {
super(PacketOpcodes.ChangeGameTimeRsp);
ChangeGameTimeRsp proto = ChangeGameTimeRsp.newBuilder()
.setCurGameTime(world.getTime())
.setCurGameTime(player.getScene().getTime())
.build();
this.setData(proto);

View File

@ -16,8 +16,8 @@ public class PacketGetSceneAreaRsp extends GenshinPacket {
this.buildHeader(0);
GetSceneAreaRsp p = GetSceneAreaRsp.newBuilder()
.setSceneId(3)
.addAllAreaIdList(Arrays.stream(new int[] {1,2,3,4,5,6,7,8,9,10,11,12,13,14,17,18,19}).boxed().collect(Collectors.toList()))
.setSceneId(sceneId)
.addAllAreaIdList(Arrays.stream(new int[] {1,2,3,4,5,6,7,8,9,10,11,12,13,14,17,18,19,100,101,102,103,200,210,300}).boxed().collect(Collectors.toList()))
.addCityInfoList(CityInfo.newBuilder().setCityId(1).setLevel(1).build())
.addCityInfoList(CityInfo.newBuilder().setCityId(2).setLevel(1).build())
.addCityInfoList(CityInfo.newBuilder().setCityId(3).setLevel(1).build())

View File

@ -29,10 +29,6 @@ public class PacketPlayerEnterSceneNotify extends GenshinPacket {
.setWorldLevel(player.getWorldLevel())
.setEnterReason(EnterReason.Login.getValue())
.setIsFirstLoginEnterScene(player.isFirstLoginEnterScene())
.addSceneTagIdList(102)
.addSceneTagIdList(107)
.addSceneTagIdList(113)
.addSceneTagIdList(117)
.setUnk1(1)
.setUnk2("3-" + player.getId() + "-" + (int) (System.currentTimeMillis() / 1000) + "-" + 18402)
.build();

View File

@ -8,11 +8,11 @@ import emu.grasscutter.net.proto.PlayerGameTimeNotifyOuterClass.PlayerGameTimeNo
public class PacketPlayerGameTimeNotify extends GenshinPacket {
public PacketPlayerGameTimeNotify(World world, GenshinPlayer player) {
public PacketPlayerGameTimeNotify(GenshinPlayer player) {
super(PacketOpcodes.PlayerGameTimeNotify);
PlayerGameTimeNotify proto = PlayerGameTimeNotify.newBuilder()
.setGameTime(world.getTime())
.setGameTime(player.getScene().getTime())
.setUid(player.getId())
.build();

View File

@ -8,12 +8,12 @@ import emu.grasscutter.net.proto.SceneAreaWeatherNotifyOuterClass.SceneAreaWeath
public class PacketSceneAreaWeatherNotify extends GenshinPacket {
public PacketSceneAreaWeatherNotify(World world, GenshinPlayer player) {
public PacketSceneAreaWeatherNotify(GenshinPlayer player) {
super(PacketOpcodes.SceneAreaWeatherNotify);
SceneAreaWeatherNotify proto = SceneAreaWeatherNotify.newBuilder()
.setWeatherAreaId(1)
.setClimateType(world.getClimate().getValue())
.setClimateType(player.getScene().getClimate().getValue())
.build();
this.setData(proto);

View File

@ -21,7 +21,7 @@ public class PacketScenePlayerInfoNotify extends GenshinPacket {
.setUid(p.getId())
.setPeerId(p.getPeerId())
.setName(p.getNickname())
.setSceneId(world.getSceneId())
.setSceneId(p.getSceneId())
.setOnlinePlayerInfo(p.getOnlinePlayerInfo())
.build();

View File

@ -0,0 +1,24 @@
package emu.grasscutter.server.packet.send;
import emu.grasscutter.net.packet.GenshinPacket;
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 PacketSceneUnlockInfoNotify() {
super(PacketOpcodes.SceneUnlockInfoNotify); // Rename opcode later
SceneUnlockInfoNotify proto = SceneUnlockInfoNotify.newBuilder()
.addUnlockInfos(SceneUnlockInfo.newBuilder().setSceneId(1))
.addUnlockInfos(SceneUnlockInfo.newBuilder().setSceneId(3))
.addUnlockInfos(SceneUnlockInfo.newBuilder().setSceneId(4))
.addUnlockInfos(SceneUnlockInfo.newBuilder().setSceneId(5))
.addUnlockInfos(SceneUnlockInfo.newBuilder().setSceneId(6))
.addUnlockInfos(SceneUnlockInfo.newBuilder().setSceneId(7))
.build();
this.setData(proto);
}
}