Commit 1500d2e8 authored by Benjamin Elsdon's avatar Benjamin Elsdon
Browse files

Merge branch 'development' of https://github.com/Melledy/Grasscutter into development

parents 9ce43602 4c1dc34c
...@@ -43,7 +43,7 @@ public class HandlerSetPlayerBornDataReq extends PacketHandler { ...@@ -43,7 +43,7 @@ public class HandlerSetPlayerBornDataReq extends PacketHandler {
try { try {
// Save to db // Save to db
DatabaseHelper.createPlayer(player, session.getAccount().getPlayerId()); DatabaseHelper.createPlayer(player, session.getAccount().getPlayerUid());
// Create avatar // Create avatar
if (player.getAvatars().getAvatarCount() == 0) { if (player.getAvatars().getAvatarCount() == 0) {
......
...@@ -8,8 +8,8 @@ import emu.grasscutter.net.proto.AbilityChangeNotifyOuterClass.AbilityChangeNoti ...@@ -8,8 +8,8 @@ import emu.grasscutter.net.proto.AbilityChangeNotifyOuterClass.AbilityChangeNoti
public class PacketAbilityChangeNotify extends GenshinPacket { public class PacketAbilityChangeNotify extends GenshinPacket {
public PacketAbilityChangeNotify(EntityAvatar entity) { public PacketAbilityChangeNotify(EntityAvatar entity) {
super(PacketOpcodes.AbilityChangeNotify); super(PacketOpcodes.AbilityChangeNotify, true);
AbilityChangeNotify proto = AbilityChangeNotify.newBuilder() AbilityChangeNotify proto = AbilityChangeNotify.newBuilder()
.setEntityId(entity.getId()) .setEntityId(entity.getId())
.setAbilityControlBlock(entity.getAbilityControlBlock()) .setAbilityControlBlock(entity.getAbilityControlBlock())
......
...@@ -23,7 +23,6 @@ public class PacketGetPlayerFriendListRsp extends GenshinPacket { ...@@ -23,7 +23,6 @@ public class PacketGetPlayerFriendListRsp extends GenshinPacket {
.setWorldLevel(0) .setWorldLevel(0)
.setSignature("") .setSignature("")
.setLastActiveTime((int) (System.currentTimeMillis() / 1000f)) .setLastActiveTime((int) (System.currentTimeMillis() / 1000f))
.setIsMpModeAvailable(true)
.setNameCardId(210001) .setNameCardId(210001)
.setOnlineState(FriendOnlineState.FRIEND_ONLINE) .setOnlineState(FriendOnlineState.FRIEND_ONLINE)
.setParam(1) .setParam(1)
......
...@@ -16,7 +16,7 @@ public class PacketGetPlayerTokenRsp extends GenshinPacket { ...@@ -16,7 +16,7 @@ public class PacketGetPlayerTokenRsp extends GenshinPacket {
this.setUseDispatchKey(true); this.setUseDispatchKey(true);
GetPlayerTokenRsp p = GetPlayerTokenRsp.newBuilder() GetPlayerTokenRsp p = GetPlayerTokenRsp.newBuilder()
.setPlayerUid(session.getAccount().getPlayerId()) .setPlayerUid(session.getAccount().getPlayerUid())
.setAccountToken(session.getAccount().getToken()) .setAccountToken(session.getAccount().getToken())
.setAccountType(1) .setAccountType(1)
.setIsProficientPlayer(doesPlayerExist) // Not sure where this goes .setIsProficientPlayer(doesPlayerExist) // Not sure where this goes
......
package emu.grasscutter.server.packet.send; package emu.grasscutter.server.packet.send;
import emu.grasscutter.game.GenshinPlayer; import emu.grasscutter.game.GenshinPlayer;
import emu.grasscutter.game.GenshinScene;
import emu.grasscutter.net.packet.GenshinPacket; import emu.grasscutter.net.packet.GenshinPacket;
import emu.grasscutter.net.packet.PacketOpcodes; import emu.grasscutter.net.packet.PacketOpcodes;
import emu.grasscutter.net.proto.ScenePlayerLocationNotifyOuterClass.ScenePlayerLocationNotify; import emu.grasscutter.net.proto.ScenePlayerLocationNotifyOuterClass.ScenePlayerLocationNotify;
public class PacketScenePlayerLocationNotify extends GenshinPacket { public class PacketScenePlayerLocationNotify extends GenshinPacket {
public PacketScenePlayerLocationNotify(GenshinPlayer player) { public PacketScenePlayerLocationNotify(GenshinScene scene) {
super(PacketOpcodes.ScenePlayerLocationNotify); super(PacketOpcodes.ScenePlayerLocationNotify);
ScenePlayerLocationNotify.Builder proto = ScenePlayerLocationNotify.newBuilder() ScenePlayerLocationNotify.Builder proto = ScenePlayerLocationNotify.newBuilder()
.setSceneId(player.getSceneId()); .setSceneId(scene.getId());
for (GenshinPlayer p : player.getWorld().getPlayers()) { for (GenshinPlayer p : scene.getPlayers()) {
proto.addPlayerLocList(p.getPlayerLocationInfo()); proto.addPlayerLocList(p.getPlayerLocationInfo());
} }
......
...@@ -13,23 +13,22 @@ public class PacketSceneTransToPointRsp extends GenshinPacket { ...@@ -13,23 +13,22 @@ public class PacketSceneTransToPointRsp extends GenshinPacket {
public PacketSceneTransToPointRsp(GenshinPlayer player, int pointId, int sceneId) { public PacketSceneTransToPointRsp(GenshinPlayer player, int pointId, int sceneId) {
super(PacketOpcodes.SceneTransToPointRsp); super(PacketOpcodes.SceneTransToPointRsp);
String code = sceneId + "_" + pointId; SceneTransToPointRsp proto = SceneTransToPointRsp.newBuilder()
ScenePointEntry scenePointEntry = GenshinData.getScenePointEntries().get(code); .setRetcode(0)
.setPointId(pointId)
float x = scenePointEntry.getPointData().getTranPos().getX(); .setSceneId(sceneId)
float y = scenePointEntry.getPointData().getTranPos().getY(); .build();
float z = scenePointEntry.getPointData().getTranPos().getZ();
player.getPos().set(new Position(x, y, z));
player.getWorld().forceTransferPlayerToScene(player, sceneId, player.getPos()); this.setData(proto);
}
SceneTransToPointRsp proto = SceneTransToPointRsp.newBuilder() public PacketSceneTransToPointRsp() {
.setRetcode(0) super(PacketOpcodes.SceneTransToPointRsp);
.setPointId(pointId)
.setSceneId(sceneId)
.build();
SceneTransToPointRsp proto = SceneTransToPointRsp.newBuilder()
.setRetcode(1) // Internal server error
.build();
this.setData(proto); this.setData(proto);
} }
} }
...@@ -13,7 +13,7 @@ public class PacketSceneUnlockInfoNotify extends GenshinPacket { ...@@ -13,7 +13,7 @@ public class PacketSceneUnlockInfoNotify extends GenshinPacket {
SceneUnlockInfoNotify proto = SceneUnlockInfoNotify.newBuilder() SceneUnlockInfoNotify proto = SceneUnlockInfoNotify.newBuilder()
.addUnlockInfos(SceneUnlockInfo.newBuilder().setSceneId(1)) .addUnlockInfos(SceneUnlockInfo.newBuilder().setSceneId(1))
.addUnlockInfos(SceneUnlockInfo.newBuilder().setSceneId(3)) .addUnlockInfos(SceneUnlockInfo.newBuilder().setSceneId(3))
.addUnlockInfos(SceneUnlockInfo.newBuilder().setSceneId(4)) .addUnlockInfos(SceneUnlockInfo.newBuilder().setSceneId(4).addSceneTagIdList(106).addSceneTagIdList(109))
.addUnlockInfos(SceneUnlockInfo.newBuilder().setSceneId(5)) .addUnlockInfos(SceneUnlockInfo.newBuilder().setSceneId(5))
.addUnlockInfos(SceneUnlockInfo.newBuilder().setSceneId(6)) .addUnlockInfos(SceneUnlockInfo.newBuilder().setSceneId(6))
.addUnlockInfos(SceneUnlockInfo.newBuilder().setSceneId(7)) .addUnlockInfos(SceneUnlockInfo.newBuilder().setSceneId(7))
......
...@@ -14,7 +14,7 @@ public class PacketWorldPlayerLocationNotify extends GenshinPacket { ...@@ -14,7 +14,7 @@ public class PacketWorldPlayerLocationNotify extends GenshinPacket {
WorldPlayerLocationNotify.Builder proto = WorldPlayerLocationNotify.newBuilder(); WorldPlayerLocationNotify.Builder proto = WorldPlayerLocationNotify.newBuilder();
for (GenshinPlayer p : world.getPlayers()) { for (GenshinPlayer p : world.getPlayers()) {
proto.addPlayerLocList(p.getPlayerLocationInfo()); proto.addPlayerLocList(p.getWorldPlayerLocationInfo());
} }
this.setData(proto); 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