Commit d32f706c authored by KingRainbow44's avatar KingRainbow44
Browse files

Merge branch 'development' into api

# Conflicts:
#	src/main/java/emu/grasscutter/plugin/api/ServerHook.java
parents 47d8fd3c f0d728b4
package emu.grasscutter.server.packet.send;
import emu.grasscutter.net.packet.BasePacket;
import emu.grasscutter.net.packet.PacketOpcodes;
import emu.grasscutter.net.proto.SceneEntityDrownRspOuterClass.SceneEntityDrownRsp;
public class PacketSceneEntityDrownRsp extends BasePacket {
public PacketSceneEntityDrownRsp(int entityId) {
super(PacketOpcodes.SceneEntityDrownRsp);
SceneEntityDrownRsp proto = SceneEntityDrownRsp.newBuilder().setEntityId(entityId).build();
this.setData(proto);
}
}
package emu.grasscutter.server.packet.send;
import emu.grasscutter.net.packet.GenshinPacket;
import emu.grasscutter.net.packet.BasePacket;
import emu.grasscutter.net.packet.PacketOpcodes;
import emu.grasscutter.net.proto.EntityMoveInfoOuterClass.EntityMoveInfo;
import emu.grasscutter.net.proto.SceneEntityMoveNotifyOuterClass.SceneEntityMoveNotify;
public class PacketSceneEntityMoveNotify extends GenshinPacket {
public class PacketSceneEntityMoveNotify extends BasePacket {
public PacketSceneEntityMoveNotify(EntityMoveInfo moveInfo) {
super(PacketOpcodes.SceneEntityMoveNotify, true);
......
package emu.grasscutter.server.packet.send;
import emu.grasscutter.game.GenshinPlayer;
import emu.grasscutter.net.packet.GenshinPacket;
import emu.grasscutter.game.player.Player;
import emu.grasscutter.net.packet.BasePacket;
import emu.grasscutter.net.packet.PacketOpcodes;
import emu.grasscutter.net.proto.SceneInitFinishRspOuterClass.SceneInitFinishRsp;
public class PacketSceneInitFinishRsp extends GenshinPacket {
public class PacketSceneInitFinishRsp extends BasePacket {
public PacketSceneInitFinishRsp(GenshinPlayer player) {
public PacketSceneInitFinishRsp(Player player) {
super(PacketOpcodes.SceneInitFinishRsp, 11);
SceneInitFinishRsp p = SceneInitFinishRsp.newBuilder().setEnterSceneToken(player.getEnterSceneToken()).build();
......
package emu.grasscutter.server.packet.send;
import emu.grasscutter.net.packet.GenshinPacket;
import emu.grasscutter.net.packet.BasePacket;
import emu.grasscutter.net.packet.PacketOpcodes;
import emu.grasscutter.net.proto.RetcodeOuterClass;
import emu.grasscutter.net.proto.SceneKickPlayerRspOuterClass.SceneKickPlayerRsp;
public class PacketSceneKickPlayerRsp extends GenshinPacket {
public class PacketSceneKickPlayerRsp extends BasePacket {
public PacketSceneKickPlayerRsp(int targetUid) {
super(PacketOpcodes.SceneKickPlayerRsp);
......@@ -20,7 +21,7 @@ public class PacketSceneKickPlayerRsp extends GenshinPacket {
super(PacketOpcodes.SceneKickPlayerRsp);
SceneKickPlayerRsp proto = SceneKickPlayerRsp.newBuilder()
.setRetcode(1)
.setRetcode(RetcodeOuterClass.Retcode.RET_SVR_ERROR_VALUE)
.build();
this.setData(proto);
......
package emu.grasscutter.server.packet.send;
import emu.grasscutter.game.GenshinPlayer;
import emu.grasscutter.game.World;
import emu.grasscutter.net.packet.GenshinPacket;
import emu.grasscutter.game.player.Player;
import emu.grasscutter.game.world.World;
import emu.grasscutter.net.packet.BasePacket;
import emu.grasscutter.net.packet.PacketOpcodes;
import emu.grasscutter.net.proto.ScenePlayerInfoNotifyOuterClass.ScenePlayerInfoNotify;
import emu.grasscutter.net.proto.ScenePlayerInfoOuterClass.ScenePlayerInfo;
public class PacketScenePlayerInfoNotify extends GenshinPacket {
public class PacketScenePlayerInfoNotify extends BasePacket {
public PacketScenePlayerInfoNotify(World world) {
super(PacketOpcodes.ScenePlayerInfoNotify);
......@@ -15,7 +15,7 @@ public class PacketScenePlayerInfoNotify extends GenshinPacket {
ScenePlayerInfoNotify.Builder proto = ScenePlayerInfoNotify.newBuilder();
for (int i = 0; i < world.getPlayers().size(); i++) {
GenshinPlayer p = world.getPlayers().get(i);
Player p = world.getPlayers().get(i);
ScenePlayerInfo pInfo = ScenePlayerInfo.newBuilder()
.setUid(p.getUid())
......
package emu.grasscutter.server.packet.send;
import emu.grasscutter.game.GenshinPlayer;
import emu.grasscutter.game.GenshinScene;
import emu.grasscutter.net.packet.GenshinPacket;
import emu.grasscutter.game.player.Player;
import emu.grasscutter.game.world.Scene;
import emu.grasscutter.net.packet.BasePacket;
import emu.grasscutter.net.packet.PacketOpcodes;
import emu.grasscutter.net.proto.ScenePlayerLocationNotifyOuterClass.ScenePlayerLocationNotify;
public class PacketScenePlayerLocationNotify extends GenshinPacket {
public class PacketScenePlayerLocationNotify extends BasePacket {
public PacketScenePlayerLocationNotify(GenshinScene scene) {
public PacketScenePlayerLocationNotify(Scene scene) {
super(PacketOpcodes.ScenePlayerLocationNotify);
ScenePlayerLocationNotify.Builder proto = ScenePlayerLocationNotify.newBuilder()
.setSceneId(scene.getId());
for (GenshinPlayer p : scene.getPlayers()) {
for (Player p : scene.getPlayers()) {
proto.addPlayerLocList(p.getPlayerLocationInfo());
}
......
package emu.grasscutter.server.packet.send;
import emu.grasscutter.game.GenshinPlayer;
import emu.grasscutter.game.entity.EntityAvatar;
import emu.grasscutter.net.packet.GenshinPacket;
import emu.grasscutter.game.player.Player;
import emu.grasscutter.net.packet.BasePacket;
import emu.grasscutter.net.packet.PacketOpcodes;
import emu.grasscutter.net.proto.AbilitySyncStateInfoOuterClass.AbilitySyncStateInfo;
import emu.grasscutter.net.proto.SceneTeamAvatarOuterClass.SceneTeamAvatar;
import emu.grasscutter.net.proto.SceneTeamUpdateNotifyOuterClass.SceneTeamUpdateNotify;
public class PacketSceneTeamUpdateNotify extends GenshinPacket {
public class PacketSceneTeamUpdateNotify extends BasePacket {
public PacketSceneTeamUpdateNotify(GenshinPlayer player) {
public PacketSceneTeamUpdateNotify(Player player) {
super(PacketOpcodes.SceneTeamUpdateNotify);
SceneTeamUpdateNotify.Builder proto = SceneTeamUpdateNotify.newBuilder()
.setIsInMp(player.getWorld().isMultiplayer());
for (GenshinPlayer p : player.getWorld().getPlayers()) {
for (Player p : player.getWorld().getPlayers()) {
for (EntityAvatar entityAvatar : p.getTeamManager().getActiveTeam()) {
SceneTeamAvatar.Builder avatarProto = SceneTeamAvatar.newBuilder()
.setPlayerId(p.getUid())
.setPlayerUid(p.getUid())
.setAvatarGuid(entityAvatar.getAvatar().getGuid())
.setSceneId(p.getSceneId())
.setEntityId(entityAvatar.getId())
......
package emu.grasscutter.server.packet.send;
import emu.grasscutter.game.GenshinPlayer;
import emu.grasscutter.net.packet.GenshinPacket;
import emu.grasscutter.game.player.Player;
import emu.grasscutter.net.packet.BasePacket;
import emu.grasscutter.net.packet.PacketOpcodes;
import emu.grasscutter.net.proto.SceneTimeNotifyOuterClass.SceneTimeNotify;
public class PacketSceneTimeNotify extends GenshinPacket {
public class PacketSceneTimeNotify extends BasePacket {
public PacketSceneTimeNotify(GenshinPlayer player) {
public PacketSceneTimeNotify(Player player) {
super(PacketOpcodes.SceneTimeNotify);
SceneTimeNotify proto = SceneTimeNotify.newBuilder()
......
package emu.grasscutter.server.packet.send;
import emu.grasscutter.data.GenshinData;
import emu.grasscutter.data.GameData;
import emu.grasscutter.data.custom.ScenePointEntry;
import emu.grasscutter.game.GenshinPlayer;
import emu.grasscutter.net.packet.GenshinPacket;
import emu.grasscutter.game.player.Player;
import emu.grasscutter.net.packet.BasePacket;
import emu.grasscutter.net.packet.PacketOpcodes;
import emu.grasscutter.net.proto.RetcodeOuterClass;
import emu.grasscutter.net.proto.SceneTransToPointRspOuterClass.SceneTransToPointRsp;
import emu.grasscutter.utils.Position;
public class PacketSceneTransToPointRsp extends GenshinPacket {
public class PacketSceneTransToPointRsp extends BasePacket {
public PacketSceneTransToPointRsp(GenshinPlayer player, int pointId, int sceneId) {
public PacketSceneTransToPointRsp(Player player, int pointId, int sceneId) {
super(PacketOpcodes.SceneTransToPointRsp);
SceneTransToPointRsp proto = SceneTransToPointRsp.newBuilder()
......@@ -26,7 +27,7 @@ public class PacketSceneTransToPointRsp extends GenshinPacket {
super(PacketOpcodes.SceneTransToPointRsp);
SceneTransToPointRsp proto = SceneTransToPointRsp.newBuilder()
.setRetcode(1) // Internal server error
.setRetcode(RetcodeOuterClass.Retcode.RET_SVR_ERROR_VALUE) // Internal server error
.build();
this.setData(proto);
......
package emu.grasscutter.server.packet.send;
import emu.grasscutter.net.packet.GenshinPacket;
import emu.grasscutter.net.packet.BasePacket;
import emu.grasscutter.net.packet.PacketOpcodes;
import emu.grasscutter.net.proto.SceneUnlockInfoNotifyOuterClass.SceneUnlockInfoNotify;
import emu.grasscutter.net.proto.SceneUnlockInfoOuterClass.SceneUnlockInfo;
public class PacketSceneUnlockInfoNotify extends GenshinPacket {
public class PacketSceneUnlockInfoNotify extends BasePacket {
public PacketSceneUnlockInfoNotify() {
super(PacketOpcodes.SceneUnlockInfoNotify); // Rename opcode later
......
package emu.grasscutter.server.packet.send;
import emu.grasscutter.net.packet.GenshinPacket;
import emu.grasscutter.net.packet.BasePacket;
import emu.grasscutter.net.packet.PacketOpcodes;
import emu.grasscutter.net.proto.ServerTimeNotifyOuterClass.ServerTimeNotify;
public class PacketServerTimeNotify extends GenshinPacket {
public class PacketServerTimeNotify extends BasePacket {
public PacketServerTimeNotify() {
super(PacketOpcodes.ServerTimeNotify);
......
package emu.grasscutter.server.packet.send;
import emu.grasscutter.game.inventory.GenshinItem;
import emu.grasscutter.net.packet.GenshinPacket;
import emu.grasscutter.game.inventory.GameItem;
import emu.grasscutter.net.packet.BasePacket;
import emu.grasscutter.net.packet.PacketOpcodes;
import emu.grasscutter.net.proto.SetEquipLockStateRspOuterClass.SetEquipLockStateRsp;
public class PacketSetEquipLockStateRsp extends GenshinPacket {
public class PacketSetEquipLockStateRsp extends BasePacket {
public PacketSetEquipLockStateRsp(GenshinItem equip) {
public PacketSetEquipLockStateRsp(GameItem equip) {
super(PacketOpcodes.SetEquipLockStateRsp);
this.buildHeader(0);
......
package emu.grasscutter.server.packet.send;
import emu.grasscutter.net.packet.GenshinPacket;
import emu.grasscutter.net.packet.BasePacket;
import emu.grasscutter.net.packet.PacketOpcodes;
import emu.grasscutter.net.proto.SetNameCardRspOuterClass.SetNameCardRsp;
public class PacketSetNameCardRsp extends GenshinPacket {
public class PacketSetNameCardRsp extends BasePacket {
public PacketSetNameCardRsp(int nameCardId) {
super(PacketOpcodes.SetNameCardRsp);
......
package emu.grasscutter.server.packet.send;
import emu.grasscutter.game.GenshinPlayer;
import emu.grasscutter.net.packet.GenshinPacket;
import emu.grasscutter.game.player.Player;
import emu.grasscutter.net.packet.BasePacket;
import emu.grasscutter.net.packet.PacketOpcodes;
import emu.grasscutter.net.proto.SetPlayerBirthdayRspOuterClass.SetPlayerBirthdayRsp;
import emu.grasscutter.net.proto.SetPlayerBornDataReqOuterClass;
public class PacketSetPlayerBirthdayRsp extends GenshinPacket {
public class PacketSetPlayerBirthdayRsp extends BasePacket {
public PacketSetPlayerBirthdayRsp(int retCode) {
super(PacketOpcodes.SetPlayerBirthdayRsp);
......@@ -17,7 +18,7 @@ public class PacketSetPlayerBirthdayRsp extends GenshinPacket {
this.setData(proto);
}
public PacketSetPlayerBirthdayRsp(GenshinPlayer player) {
public PacketSetPlayerBirthdayRsp(Player player) {
super(PacketOpcodes.SetPlayerBirthdayRsp);
SetPlayerBirthdayRsp proto = SetPlayerBirthdayRsp.newBuilder()
......
package emu.grasscutter.server.packet.send;
import emu.grasscutter.game.GenshinPlayer;
import emu.grasscutter.net.packet.GenshinPacket;
import emu.grasscutter.game.player.Player;
import emu.grasscutter.net.packet.BasePacket;
import emu.grasscutter.net.packet.PacketOpcodes;
import emu.grasscutter.net.proto.HeadImageOuterClass.HeadImage;
import emu.grasscutter.net.proto.SetPlayerHeadImageRspOuterClass.SetPlayerHeadImageRsp;
public class PacketSetPlayerHeadImageRsp extends GenshinPacket {
public class PacketSetPlayerHeadImageRsp extends BasePacket {
public PacketSetPlayerHeadImageRsp(GenshinPlayer player) {
public PacketSetPlayerHeadImageRsp(Player player) {
super(PacketOpcodes.SetPlayerHeadImageRsp);
SetPlayerHeadImageRsp proto = SetPlayerHeadImageRsp.newBuilder()
.setAvatar(HeadImage.newBuilder().setAvatarId(player.getHeadImage()))
.setAvatarId(HeadImage.newBuilder().setAvatarId(player.getHeadImage()).getAvatarId())
.build();
this.setData(proto);
......
package emu.grasscutter.server.packet.send;
import emu.grasscutter.game.GenshinPlayer;
import emu.grasscutter.net.packet.GenshinPacket;
import emu.grasscutter.game.player.Player;
import emu.grasscutter.net.packet.BasePacket;
import emu.grasscutter.net.packet.PacketOpcodes;
import emu.grasscutter.net.proto.SetPlayerNameRspOuterClass.SetPlayerNameRsp;
public class PacketSetPlayerNameRsp extends GenshinPacket {
public class PacketSetPlayerNameRsp extends BasePacket {
public PacketSetPlayerNameRsp(GenshinPlayer player) {
public PacketSetPlayerNameRsp(Player player) {
super(PacketOpcodes.SetPlayerNameRsp);
SetPlayerNameRsp proto = SetPlayerNameRsp.newBuilder()
......
package emu.grasscutter.server.packet.send;
import emu.grasscutter.game.GenshinPlayer;
import emu.grasscutter.net.packet.GenshinPacket;
import emu.grasscutter.game.player.Player;
import emu.grasscutter.net.packet.BasePacket;
import emu.grasscutter.net.packet.PacketOpcodes;
import emu.grasscutter.net.proto.SetPlayerSignatureRspOuterClass.SetPlayerSignatureRsp;
public class PacketSetPlayerSignatureRsp extends GenshinPacket {
public class PacketSetPlayerSignatureRsp extends BasePacket {
public PacketSetPlayerSignatureRsp(GenshinPlayer player) {
public PacketSetPlayerSignatureRsp(Player player) {
super(PacketOpcodes.SetPlayerSignatureRsp);
SetPlayerSignatureRsp proto = SetPlayerSignatureRsp.newBuilder()
......
package emu.grasscutter.server.packet.send;
import emu.grasscutter.game.GenshinPlayer;
import emu.grasscutter.game.TeamInfo;
import emu.grasscutter.net.packet.GenshinPacket;
import emu.grasscutter.game.player.Player;
import emu.grasscutter.game.player.TeamInfo;
import emu.grasscutter.net.packet.BasePacket;
import emu.grasscutter.net.packet.PacketOpcodes;
import emu.grasscutter.net.proto.SetUpAvatarTeamRspOuterClass.SetUpAvatarTeamRsp;
public class PacketSetUpAvatarTeamRsp extends GenshinPacket {
public class PacketSetUpAvatarTeamRsp extends BasePacket {
public PacketSetUpAvatarTeamRsp(GenshinPlayer player, int teamId, TeamInfo teamInfo) {
public PacketSetUpAvatarTeamRsp(Player player, int teamId, TeamInfo teamInfo) {
super(PacketOpcodes.SetUpAvatarTeamRsp);
SetUpAvatarTeamRsp.Builder proto = SetUpAvatarTeamRsp.newBuilder()
......
package emu.grasscutter.server.packet.send;
import emu.grasscutter.net.packet.GenshinPacket;
import emu.grasscutter.net.packet.PacketOpcodes;
import emu.grasscutter.net.proto.SitRspOuterClass.SitRsp;
import emu.grasscutter.utils.Position;
public class PacketSitRsp extends GenshinPacket {
public PacketSitRsp(long chairId, Position pos, int EntityId) {
super(PacketOpcodes.SitRsp);
SitRsp proto = SitRsp.newBuilder()
.setEntityId(EntityId)
.setPosition(pos.toProto())
.setChairId(chairId)
.build();
this.setData(proto);
}
}
......@@ -2,35 +2,35 @@ package emu.grasscutter.server.packet.send;
import java.util.Collection;
import emu.grasscutter.game.inventory.GenshinItem;
import emu.grasscutter.net.packet.GenshinPacket;
import emu.grasscutter.game.inventory.GameItem;
import emu.grasscutter.net.packet.BasePacket;
import emu.grasscutter.net.packet.PacketOpcodes;
import emu.grasscutter.net.proto.StoreItemChangeNotifyOuterClass.StoreItemChangeNotify;
import emu.grasscutter.net.proto.StoreTypeOuterClass.StoreType;
public class PacketStoreItemChangeNotify extends GenshinPacket {
public class PacketStoreItemChangeNotify extends BasePacket {
private PacketStoreItemChangeNotify() {
super(PacketOpcodes.StoreItemChangeNotify);
}
public PacketStoreItemChangeNotify(GenshinItem item) {
public PacketStoreItemChangeNotify(GameItem item) {
this();
StoreItemChangeNotify.Builder proto = StoreItemChangeNotify.newBuilder()
.setStoreType(StoreType.StorePack)
.setStoreType(StoreType.STORE_PACK)
.addItemList(item.toProto());
this.setData(proto);
}
public PacketStoreItemChangeNotify(Collection<GenshinItem> items) {
public PacketStoreItemChangeNotify(Collection<GameItem> items) {
this();
StoreItemChangeNotify.Builder proto = StoreItemChangeNotify.newBuilder()
.setStoreType(StoreType.StorePack);
.setStoreType(StoreType.STORE_PACK);
items.stream().forEach(item -> proto.addItemList(item.toProto()));
items.forEach(item -> proto.addItemList(item.toProto()));
this.setData(proto);
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment