0
0
Fork 0
mirror of https://github.com/Sanae6/SmoOnlineServer.git synced 2024-11-21 18:55:17 +00:00

Fix 2, electric boogaloo

This commit is contained in:
Sanae 2022-04-26 23:06:27 -06:00
parent 3e462ddb64
commit 7a088eb314
2 changed files with 7 additions and 9 deletions

View file

@ -88,7 +88,8 @@ server.PacketHandler = (c, p) => {
break;
}
server.BroadcastReplace(gamePacket, c, (from, to, gp) => {
gp.ScenarioNum = (byte?) from.Metadata["scenario"] ?? 200;
gp.ScenarioNum = (byte?) to.Metadata["scenario"] ?? 200;
from.Logger.Warn($"to {to.Logger.Name}, {to.Metadata["scenario"]}-{gp.ScenarioNum}");
to.Send(gp, from);
});

View file

@ -5,17 +5,14 @@ namespace Shared.Packet.Packets;
[Packet(PacketType.Game)]
public struct GamePacket : IPacket {
private const int StageSize = 0x30;
public bool Is2d;
public byte ScenarioNum;
private const int StageSize = 0x38;
public bool Is2d = false;
public byte ScenarioNum = 0;
public string Stage = "";
public GamePacket() {
Is2d = false;
ScenarioNum = 0;
}
public GamePacket() { }
public short Size => 0x32;
public short Size => 0x3A;
public void Serialize(Span<byte> data) {
MemoryMarshal.Write(data[..0], ref Is2d);
MemoryMarshal.Write(data[1..], ref ScenarioNum);