mirror of
https://github.com/openfrontio/OpenFrontIO.git
synced 2026-07-07 22:20:41 +00:00
fix(protocol): support bot targets in binary player refs
This commit is contained in:
@@ -36,6 +36,14 @@ const clientIntentMessages: ClientIntentMessage[] = [
|
||||
troops: 12.5,
|
||||
},
|
||||
},
|
||||
{
|
||||
type: "intent",
|
||||
intent: {
|
||||
type: "attack",
|
||||
targetID: "kli0dx59",
|
||||
troops: 18,
|
||||
},
|
||||
},
|
||||
{
|
||||
type: "intent",
|
||||
intent: {
|
||||
@@ -300,6 +308,26 @@ describe("BinaryCodec", () => {
|
||||
expect(decoded).toEqual(message);
|
||||
});
|
||||
|
||||
it("round-trips server turn messages with non-lobby target ids", () => {
|
||||
const message: ServerTurnMessage = {
|
||||
type: "turn",
|
||||
turn: {
|
||||
turnNumber: 6,
|
||||
intents: [
|
||||
{
|
||||
type: "attack",
|
||||
targetID: "kli0dx59",
|
||||
troops: 9,
|
||||
clientID: "P0000001",
|
||||
},
|
||||
],
|
||||
},
|
||||
};
|
||||
const encoded = encodeBinaryServerGameplayMessage(message, context);
|
||||
const decoded = decodeBinaryServerGameplayMessage(encoded, context);
|
||||
expect(decoded).toEqual(message);
|
||||
});
|
||||
|
||||
it("round-trips server desync messages", () => {
|
||||
const message: ServerDesyncMessage = {
|
||||
type: "desync",
|
||||
|
||||
Reference in New Issue
Block a user