From 63175bf4da95d91f86f1d692a5cc0ff80766e249 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Tue, 24 Mar 2026 22:45:53 +0000 Subject: [PATCH 1/3] Initial plan From ccd8163c203631ef3a551fb4539527b286359dc5 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Tue, 24 Mar 2026 22:57:45 +0000 Subject: [PATCH 2/3] Initial progress report - planning phase Co-authored-by: sven-n <5238610+sven-n@users.noreply.github.com> Agent-Logs-Url: https://github.com/MUnique/OpenMU/sessions/e54e4799-894b-41f7-9cb1-9ecf15b0e759 --- docs/Packets/C1-11-ObjectHitExtended_by-server.md | 6 ++++-- docs/Packets/C1-11-ObjectHit_by-server.md | 6 ++++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/docs/Packets/C1-11-ObjectHitExtended_by-server.md b/docs/Packets/C1-11-ObjectHitExtended_by-server.md index fd9e2109e..8d78388e6 100644 --- a/docs/Packets/C1-11-ObjectHitExtended_by-server.md +++ b/docs/Packets/C1-11-ObjectHitExtended_by-server.md @@ -16,6 +16,8 @@ The damage is shown at the object which received the hit. | 1 | 1 | Byte | 16 | Packet header - length of the packet | | 2 | 1 | Byte | 0x11 | Packet header - packet type identifier | | 3 << 0 | 4 bit | DamageKind | | Kind | +| 3 << 4 | 1 bit | Boolean | | IsRageFighterStreakHit | +| 3 << 5 | 1 bit | Boolean | | IsRageFighterStreakFinalHit | | 3 << 6 | 1 bit | Boolean | | IsDoubleDamage | | 3 << 7 | 1 bit | Boolean | | IsTripleDamage | | 4 | 2 | ShortLittleEndian | | ObjectId | @@ -34,7 +36,7 @@ Defines the kind of the damage. | 1 | IgnoreDefenseCyan | Cyan color, usually used by ignore defense damage. | | 2 | ExcellentLightGreen | Light green color, usually used by excellent damage. | | 3 | CriticalBlue | Blue color, usually used by critical damage. | -| 4 | LightPink | Light pink color. | +| 4 | ReflectedLightPink | Light pink color, usually used by reflected damage. | | 5 | PoisonDarkGreen | Dark green color, usually used by poison damage. | -| 6 | ReflectedDarkPink | Dark pink color, usually used by reflected damage. | +| 6 | DarkPink | Dark pink color. | | 7 | White | White color. | \ No newline at end of file diff --git a/docs/Packets/C1-11-ObjectHit_by-server.md b/docs/Packets/C1-11-ObjectHit_by-server.md index de9120dfc..7dc7c6dfd 100644 --- a/docs/Packets/C1-11-ObjectHit_by-server.md +++ b/docs/Packets/C1-11-ObjectHit_by-server.md @@ -19,6 +19,8 @@ The damage is shown at the object which received the hit. | 3 | 2 | ShortBigEndian | | ObjectId | | 5 | 2 | ShortBigEndian | | HealthDamage | | 7 << 0 | 4 bit | DamageKind | | Kind | +| 7 << 4 | 1 bit | Boolean | | IsRageFighterStreakHit | +| 7 << 5 | 1 bit | Boolean | | IsRageFighterStreakFinalHit | | 7 << 6 | 1 bit | Boolean | | IsDoubleDamage | | 7 << 7 | 1 bit | Boolean | | IsTripleDamage | | 8 | 2 | ShortBigEndian | | ShieldDamage | @@ -33,7 +35,7 @@ Defines the kind of the damage. | 1 | IgnoreDefenseCyan | Cyan color, usually used by ignore defense damage. | | 2 | ExcellentLightGreen | Light green color, usually used by excellent damage. | | 3 | CriticalBlue | Blue color, usually used by critical damage. | -| 4 | LightPink | Light pink color. | +| 4 | ReflectedLightPink | Light pink color, usually used by reflected damage. | | 5 | PoisonDarkGreen | Dark green color, usually used by poison damage. | -| 6 | ReflectedDarkPink | Dark pink color, usually used by reflected damage. | +| 6 | DarkPink | Dark pink color. | | 7 | White | White color. | \ No newline at end of file From ec79b5c175d9594474a1cd7f17de6b5522b0b0f6 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Tue, 24 Mar 2026 23:01:34 +0000 Subject: [PATCH 3/3] =?UTF-8?q?Add=20Castle=20Siege=20and=20Guild=20Allian?= =?UTF-8?q?ce=20S=E2=86=92C=20packet=20definitions=20to=20ServerToClientPa?= =?UTF-8?q?ckets.xml?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: sven-n <5238610+sven-n@users.noreply.github.com> Agent-Logs-Url: https://github.com/MUnique/OpenMU/sessions/e54e4799-894b-41f7-9cb1-9ecf15b0e759 --- ...-00-CastleSiegeStatusResponse_by-server.md | 38 + ...stleSiegeRegistrationResponse_by-server.md | 20 + ...CastleSiegeUnregisterResponse_by-server.md | 19 + ...iegeRegistrationStateResponse_by-server.md | 21 + ...SiegeMarkRegistrationResponse_by-server.md | 21 + ...CastleSiegeDefenseBuyResponse_by-server.md | 21 + ...tleSiegeDefenseRepairResponse_by-server.md | 21 + ...leSiegeDefenseUpgradeResponse_by-server.md | 23 + ...08-CastleSiegeTaxInfoResponse_by-server.md | 23 + ...-CastleSiegeTaxChangeResponse_by-server.md | 21 + ...eSiegeTributeWithdrawResponse_by-server.md | 20 + ...stleSiegeJoinSideNotification_by-server.md | 19 + ...astleSiegeGateOperateResponse_by-server.md | 20 + ...3-CastleSiegeCrownStateUpdate_by-server.md | 19 + ...4-CastleSiegeCrownAccessState_by-server.md | 20 + ...1-B2-15-CastleSiegeSwitchInfo_by-server.md | 24 + ...geOwnershipChangeNotification_by-server.md | 19 + ...-17-CastleSiegeBattleStartEnd_by-server.md | 19 + ...2-18-CastleSiegeRemainingTime_by-server.md | 20 + ...9-CastleSiegeGateOperateState_by-server.md | 20 + ...C1-B3-00-CastleSiegeGateState_by-server.md | 20 + ...1-CastleSiegeMachineUseResult_by-server.md | 21 + ...astleSiegeMachineRegionNotify_by-server.md | 20 + ...3-CastleSiegeMachineInterface_by-server.md | 19 + ...-05-CastleSiegeLifeStoneState_by-server.md | 19 + .../C1-B9-02-CastleOwnerLogo_by-server.md | 19 + ...C1-B9-03-HuntingZoneGuardInfo_by-server.md | 20 + ...ildRelationshipChangeResponse_by-server.md | 20 + ...leSiegeMiniMapPlayerPositions_by-server.md | 31 + ...astleSiegeMiniMapNpcPositions_by-server.md | 32 + .../C2-B3-02-CastleSiegeNpcList_by-server.md | 39 + ...astleSiegeRegisteredGuildList_by-server.md | 32 + .../C2-B5-CastleSiegeGuildList_by-server.md | 33 + docs/Packets/C2-E9-AllianceList_by-server.md | 31 + docs/Packets/ServerToClient.md | 34 + .../ServerToClient/ConnectionExtensions.cs | 894 ++++ .../ServerToClient/ServerToClientPackets.cs | 3813 +++++++++++++++++ .../ServerToClient/ServerToClientPackets.xml | 1091 +++++ .../ServerToClientPacketsRef.cs | 3813 +++++++++++++++++ 39 files changed, 10429 insertions(+) create mode 100644 docs/Packets/C1-B2-00-CastleSiegeStatusResponse_by-server.md create mode 100644 docs/Packets/C1-B2-01-CastleSiegeRegistrationResponse_by-server.md create mode 100644 docs/Packets/C1-B2-02-CastleSiegeUnregisterResponse_by-server.md create mode 100644 docs/Packets/C1-B2-03-CastleSiegeRegistrationStateResponse_by-server.md create mode 100644 docs/Packets/C1-B2-04-CastleSiegeMarkRegistrationResponse_by-server.md create mode 100644 docs/Packets/C1-B2-05-CastleSiegeDefenseBuyResponse_by-server.md create mode 100644 docs/Packets/C1-B2-06-CastleSiegeDefenseRepairResponse_by-server.md create mode 100644 docs/Packets/C1-B2-07-CastleSiegeDefenseUpgradeResponse_by-server.md create mode 100644 docs/Packets/C1-B2-08-CastleSiegeTaxInfoResponse_by-server.md create mode 100644 docs/Packets/C1-B2-09-CastleSiegeTaxChangeResponse_by-server.md create mode 100644 docs/Packets/C1-B2-10-CastleSiegeTributeWithdrawResponse_by-server.md create mode 100644 docs/Packets/C1-B2-11-CastleSiegeJoinSideNotification_by-server.md create mode 100644 docs/Packets/C1-B2-12-CastleSiegeGateOperateResponse_by-server.md create mode 100644 docs/Packets/C1-B2-13-CastleSiegeCrownStateUpdate_by-server.md create mode 100644 docs/Packets/C1-B2-14-CastleSiegeCrownAccessState_by-server.md create mode 100644 docs/Packets/C1-B2-15-CastleSiegeSwitchInfo_by-server.md create mode 100644 docs/Packets/C1-B2-16-CastleSiegeOwnershipChangeNotification_by-server.md create mode 100644 docs/Packets/C1-B2-17-CastleSiegeBattleStartEnd_by-server.md create mode 100644 docs/Packets/C1-B2-18-CastleSiegeRemainingTime_by-server.md create mode 100644 docs/Packets/C1-B2-19-CastleSiegeGateOperateState_by-server.md create mode 100644 docs/Packets/C1-B3-00-CastleSiegeGateState_by-server.md create mode 100644 docs/Packets/C1-B7-01-CastleSiegeMachineUseResult_by-server.md create mode 100644 docs/Packets/C1-B7-02-CastleSiegeMachineRegionNotify_by-server.md create mode 100644 docs/Packets/C1-B7-03-CastleSiegeMachineInterface_by-server.md create mode 100644 docs/Packets/C1-B7-05-CastleSiegeLifeStoneState_by-server.md create mode 100644 docs/Packets/C1-B9-02-CastleOwnerLogo_by-server.md create mode 100644 docs/Packets/C1-B9-03-HuntingZoneGuardInfo_by-server.md create mode 100644 docs/Packets/C1-E6-GuildRelationshipChangeResponse_by-server.md create mode 100644 docs/Packets/C2-B2-1A-CastleSiegeMiniMapPlayerPositions_by-server.md create mode 100644 docs/Packets/C2-B2-1B-CastleSiegeMiniMapNpcPositions_by-server.md create mode 100644 docs/Packets/C2-B3-02-CastleSiegeNpcList_by-server.md create mode 100644 docs/Packets/C2-B4-CastleSiegeRegisteredGuildList_by-server.md create mode 100644 docs/Packets/C2-B5-CastleSiegeGuildList_by-server.md create mode 100644 docs/Packets/C2-E9-AllianceList_by-server.md diff --git a/docs/Packets/C1-B2-00-CastleSiegeStatusResponse_by-server.md b/docs/Packets/C1-B2-00-CastleSiegeStatusResponse_by-server.md new file mode 100644 index 000000000..f31cf244f --- /dev/null +++ b/docs/Packets/C1-B2-00-CastleSiegeStatusResponse_by-server.md @@ -0,0 +1,38 @@ +# C1 B2 00 - CastleSiegeStatusResponse (by server) + +## Is sent when + +After the player requested the current castle siege status from a castle siege npc. + +## Causes the following actions on the client side + +The client shows the castle siege status. + +## Structure + +| Index | Length | Data Type | Value | Description | +|-------|--------|-----------|-------|-------------| +| 0 | 1 | Byte | 0xC1 | [Packet type](PacketTypes.md) | +| 1 | 1 | Byte | 46 | Packet header - length of the packet | +| 2 | 1 | Byte | 0xB2 | Packet header - packet type identifier | +| 3 | 1 | Byte | 0x00 | Packet header - sub packet type identifier | +| 4 | 1 | Byte | | Result | +| 5 | 1 | Byte | | State | +| 6 | 2 | ShortBigEndian | | StartYear | +| 8 | 1 | Byte | | StartMonth | +| 9 | 1 | Byte | | StartDay | +| 10 | 1 | Byte | | StartHour | +| 11 | 1 | Byte | | StartMinute | +| 12 | 2 | ShortBigEndian | | EndYear | +| 14 | 1 | Byte | | EndMonth | +| 15 | 1 | Byte | | EndDay | +| 16 | 1 | Byte | | EndHour | +| 17 | 1 | Byte | | EndMinute | +| 18 | 2 | ShortBigEndian | | SiegeStartYear | +| 20 | 1 | Byte | | SiegeStartMonth | +| 21 | 1 | Byte | | SiegeStartDay | +| 22 | 1 | Byte | | SiegeStartHour | +| 23 | 1 | Byte | | SiegeStartMinute | +| 24 | 8 | String | | GuildName | +| 32 | 10 | String | | GuildMasterName | +| 42 | 4 | IntegerBigEndian | | RemainingTime | \ No newline at end of file diff --git a/docs/Packets/C1-B2-01-CastleSiegeRegistrationResponse_by-server.md b/docs/Packets/C1-B2-01-CastleSiegeRegistrationResponse_by-server.md new file mode 100644 index 000000000..5969b6ecb --- /dev/null +++ b/docs/Packets/C1-B2-01-CastleSiegeRegistrationResponse_by-server.md @@ -0,0 +1,20 @@ +# C1 B2 01 - CastleSiegeRegistrationResponse (by server) + +## Is sent when + +After the player requested to register his guild for the next castle siege. + +## Causes the following actions on the client side + +The client shows the result of the registration attempt. + +## Structure + +| Index | Length | Data Type | Value | Description | +|-------|--------|-----------|-------|-------------| +| 0 | 1 | Byte | 0xC1 | [Packet type](PacketTypes.md) | +| 1 | 1 | Byte | 13 | Packet header - length of the packet | +| 2 | 1 | Byte | 0xB2 | Packet header - packet type identifier | +| 3 | 1 | Byte | 0x01 | Packet header - sub packet type identifier | +| 4 | 1 | Byte | | Result | +| 5 | 8 | String | | GuildName | \ No newline at end of file diff --git a/docs/Packets/C1-B2-02-CastleSiegeUnregisterResponse_by-server.md b/docs/Packets/C1-B2-02-CastleSiegeUnregisterResponse_by-server.md new file mode 100644 index 000000000..043b762e1 --- /dev/null +++ b/docs/Packets/C1-B2-02-CastleSiegeUnregisterResponse_by-server.md @@ -0,0 +1,19 @@ +# C1 B2 02 - CastleSiegeUnregisterResponse (by server) + +## Is sent when + +After the player requested to un-register his guild from the next castle siege. + +## Causes the following actions on the client side + +The client shows the result of the un-registration attempt. + +## Structure + +| Index | Length | Data Type | Value | Description | +|-------|--------|-----------|-------|-------------| +| 0 | 1 | Byte | 0xC1 | [Packet type](PacketTypes.md) | +| 1 | 1 | Byte | 5 | Packet header - length of the packet | +| 2 | 1 | Byte | 0xB2 | Packet header - packet type identifier | +| 3 | 1 | Byte | 0x02 | Packet header - sub packet type identifier | +| 4 | 1 | Byte | | Result | \ No newline at end of file diff --git a/docs/Packets/C1-B2-03-CastleSiegeRegistrationStateResponse_by-server.md b/docs/Packets/C1-B2-03-CastleSiegeRegistrationStateResponse_by-server.md new file mode 100644 index 000000000..e31d95af5 --- /dev/null +++ b/docs/Packets/C1-B2-03-CastleSiegeRegistrationStateResponse_by-server.md @@ -0,0 +1,21 @@ +# C1 B2 03 - CastleSiegeRegistrationStateResponse (by server) + +## Is sent when + +After the player requested the current registration state of his guild. + +## Causes the following actions on the client side + +The client shows the current registration state including the number of submitted guild marks. + +## Structure + +| Index | Length | Data Type | Value | Description | +|-------|--------|-----------|-------|-------------| +| 0 | 1 | Byte | 0xC1 | [Packet type](PacketTypes.md) | +| 1 | 1 | Byte | 20 | Packet header - length of the packet | +| 2 | 1 | Byte | 0xB2 | Packet header - packet type identifier | +| 3 | 1 | Byte | 0x03 | Packet header - sub packet type identifier | +| 4 | 8 | String | | GuildName | +| 12 | 4 | IntegerBigEndian | | GuildMarkCount | +| 16 | 4 | IntegerBigEndian | | RegistrationId | \ No newline at end of file diff --git a/docs/Packets/C1-B2-04-CastleSiegeMarkRegistrationResponse_by-server.md b/docs/Packets/C1-B2-04-CastleSiegeMarkRegistrationResponse_by-server.md new file mode 100644 index 000000000..4d5643604 --- /dev/null +++ b/docs/Packets/C1-B2-04-CastleSiegeMarkRegistrationResponse_by-server.md @@ -0,0 +1,21 @@ +# C1 B2 04 - CastleSiegeMarkRegistrationResponse (by server) + +## Is sent when + +After the player submitted a guild mark for the castle siege registration. + +## Causes the following actions on the client side + +The client shows the updated guild mark count. + +## Structure + +| Index | Length | Data Type | Value | Description | +|-------|--------|-----------|-------|-------------| +| 0 | 1 | Byte | 0xC1 | [Packet type](PacketTypes.md) | +| 1 | 1 | Byte | 17 | Packet header - length of the packet | +| 2 | 1 | Byte | 0xB2 | Packet header - packet type identifier | +| 3 | 1 | Byte | 0x04 | Packet header - sub packet type identifier | +| 4 | 1 | Byte | | Result | +| 5 | 8 | String | | GuildName | +| 13 | 4 | IntegerBigEndian | | GuildMarkCount | \ No newline at end of file diff --git a/docs/Packets/C1-B2-05-CastleSiegeDefenseBuyResponse_by-server.md b/docs/Packets/C1-B2-05-CastleSiegeDefenseBuyResponse_by-server.md new file mode 100644 index 000000000..d0fefab9e --- /dev/null +++ b/docs/Packets/C1-B2-05-CastleSiegeDefenseBuyResponse_by-server.md @@ -0,0 +1,21 @@ +# C1 B2 05 - CastleSiegeDefenseBuyResponse (by server) + +## Is sent when + +After the player requested to buy a castle siege defense structure (gate or statue). + +## Causes the following actions on the client side + +The client shows the result of the buy request. + +## Structure + +| Index | Length | Data Type | Value | Description | +|-------|--------|-----------|-------|-------------| +| 0 | 1 | Byte | 0xC1 | [Packet type](PacketTypes.md) | +| 1 | 1 | Byte | 13 | Packet header - length of the packet | +| 2 | 1 | Byte | 0xB2 | Packet header - packet type identifier | +| 3 | 1 | Byte | 0x05 | Packet header - sub packet type identifier | +| 4 | 1 | Byte | | Result | +| 5 | 4 | IntegerLittleEndian | | NpcNumber | +| 9 | 4 | IntegerLittleEndian | | NpcIndex | \ No newline at end of file diff --git a/docs/Packets/C1-B2-06-CastleSiegeDefenseRepairResponse_by-server.md b/docs/Packets/C1-B2-06-CastleSiegeDefenseRepairResponse_by-server.md new file mode 100644 index 000000000..58cef42fc --- /dev/null +++ b/docs/Packets/C1-B2-06-CastleSiegeDefenseRepairResponse_by-server.md @@ -0,0 +1,21 @@ +# C1 B2 06 - CastleSiegeDefenseRepairResponse (by server) + +## Is sent when + +After the player requested to repair a castle siege defense structure (gate or statue). + +## Causes the following actions on the client side + +The client shows the result of the repair request. + +## Structure + +| Index | Length | Data Type | Value | Description | +|-------|--------|-----------|-------|-------------| +| 0 | 1 | Byte | 0xC1 | [Packet type](PacketTypes.md) | +| 1 | 1 | Byte | 13 | Packet header - length of the packet | +| 2 | 1 | Byte | 0xB2 | Packet header - packet type identifier | +| 3 | 1 | Byte | 0x06 | Packet header - sub packet type identifier | +| 4 | 1 | Byte | | Result | +| 5 | 4 | IntegerLittleEndian | | NpcNumber | +| 9 | 4 | IntegerLittleEndian | | NpcIndex | \ No newline at end of file diff --git a/docs/Packets/C1-B2-07-CastleSiegeDefenseUpgradeResponse_by-server.md b/docs/Packets/C1-B2-07-CastleSiegeDefenseUpgradeResponse_by-server.md new file mode 100644 index 000000000..2a98654a1 --- /dev/null +++ b/docs/Packets/C1-B2-07-CastleSiegeDefenseUpgradeResponse_by-server.md @@ -0,0 +1,23 @@ +# C1 B2 07 - CastleSiegeDefenseUpgradeResponse (by server) + +## Is sent when + +After the player requested to upgrade a castle siege defense structure (gate or statue). + +## Causes the following actions on the client side + +The client shows the result of the upgrade request and the new upgrade values. + +## Structure + +| Index | Length | Data Type | Value | Description | +|-------|--------|-----------|-------|-------------| +| 0 | 1 | Byte | 0xC1 | [Packet type](PacketTypes.md) | +| 1 | 1 | Byte | 21 | Packet header - length of the packet | +| 2 | 1 | Byte | 0xB2 | Packet header - packet type identifier | +| 3 | 1 | Byte | 0x07 | Packet header - sub packet type identifier | +| 4 | 1 | Byte | | Result | +| 5 | 4 | IntegerLittleEndian | | NpcNumber | +| 9 | 4 | IntegerLittleEndian | | NpcIndex | +| 13 | 4 | IntegerLittleEndian | | NpcUpgradeType | +| 17 | 4 | IntegerLittleEndian | | NpcUpgradeValue | \ No newline at end of file diff --git a/docs/Packets/C1-B2-08-CastleSiegeTaxInfoResponse_by-server.md b/docs/Packets/C1-B2-08-CastleSiegeTaxInfoResponse_by-server.md new file mode 100644 index 000000000..71f78e089 --- /dev/null +++ b/docs/Packets/C1-B2-08-CastleSiegeTaxInfoResponse_by-server.md @@ -0,0 +1,23 @@ +# C1 B2 08 - CastleSiegeTaxInfoResponse (by server) + +## Is sent when + +After the guild master opened the castle npc to manage the castle taxes. + +## Causes the following actions on the client side + +The client shows the current tax configuration and treasury amount. + +## Structure + +| Index | Length | Data Type | Value | Description | +|-------|--------|-----------|-------|-------------| +| 0 | 1 | Byte | 0xC1 | [Packet type](PacketTypes.md) | +| 1 | 1 | Byte | 19 | Packet header - length of the packet | +| 2 | 1 | Byte | 0xB2 | Packet header - packet type identifier | +| 3 | 1 | Byte | 0x08 | Packet header - sub packet type identifier | +| 4 | 1 | Byte | | TaxRateChaosMachine | +| 5 | 1 | Byte | | TaxRateNormal | +| 6 | 4 | IntegerBigEndian | | TaxRateLandOfTrials | +| 10 | 1 | Boolean | | IsPublicHuntingAllowed | +| 11 | 8 | LongBigEndian | | Treasury | \ No newline at end of file diff --git a/docs/Packets/C1-B2-09-CastleSiegeTaxChangeResponse_by-server.md b/docs/Packets/C1-B2-09-CastleSiegeTaxChangeResponse_by-server.md new file mode 100644 index 000000000..d952fe43b --- /dev/null +++ b/docs/Packets/C1-B2-09-CastleSiegeTaxChangeResponse_by-server.md @@ -0,0 +1,21 @@ +# C1 B2 09 - CastleSiegeTaxChangeResponse (by server) + +## Is sent when + +After the guild master changed the tax rate. + +## Causes the following actions on the client side + +The client shows the result of the tax rate change. + +## Structure + +| Index | Length | Data Type | Value | Description | +|-------|--------|-----------|-------|-------------| +| 0 | 1 | Byte | 0xC1 | [Packet type](PacketTypes.md) | +| 1 | 1 | Byte | 10 | Packet header - length of the packet | +| 2 | 1 | Byte | 0xB2 | Packet header - packet type identifier | +| 3 | 1 | Byte | 0x09 | Packet header - sub packet type identifier | +| 4 | 1 | Byte | | Result | +| 5 | 1 | Byte | | TaxType | +| 6 | 4 | IntegerBigEndian | | TaxRate | \ No newline at end of file diff --git a/docs/Packets/C1-B2-10-CastleSiegeTributeWithdrawResponse_by-server.md b/docs/Packets/C1-B2-10-CastleSiegeTributeWithdrawResponse_by-server.md new file mode 100644 index 000000000..a0f611740 --- /dev/null +++ b/docs/Packets/C1-B2-10-CastleSiegeTributeWithdrawResponse_by-server.md @@ -0,0 +1,20 @@ +# C1 B2 10 - CastleSiegeTributeWithdrawResponse (by server) + +## Is sent when + +After the guild master requested to withdraw tax money from the castle treasury. + +## Causes the following actions on the client side + +The client shows the result of the withdrawal and the withdrawn amount. + +## Structure + +| Index | Length | Data Type | Value | Description | +|-------|--------|-----------|-------|-------------| +| 0 | 1 | Byte | 0xC1 | [Packet type](PacketTypes.md) | +| 1 | 1 | Byte | 13 | Packet header - length of the packet | +| 2 | 1 | Byte | 0xB2 | Packet header - packet type identifier | +| 3 | 1 | Byte | 0x10 | Packet header - sub packet type identifier | +| 4 | 1 | Byte | | Result | +| 5 | 8 | LongBigEndian | | Money | \ No newline at end of file diff --git a/docs/Packets/C1-B2-11-CastleSiegeJoinSideNotification_by-server.md b/docs/Packets/C1-B2-11-CastleSiegeJoinSideNotification_by-server.md new file mode 100644 index 000000000..a97064ec3 --- /dev/null +++ b/docs/Packets/C1-B2-11-CastleSiegeJoinSideNotification_by-server.md @@ -0,0 +1,19 @@ +# C1 B2 11 - CastleSiegeJoinSideNotification (by server) + +## Is sent when + +The server notifies the player of which siege side (attacker/defender) they are on. + +## Causes the following actions on the client side + +The client updates the castle siege mini-map accordingly. + +## Structure + +| Index | Length | Data Type | Value | Description | +|-------|--------|-----------|-------|-------------| +| 0 | 1 | Byte | 0xC1 | [Packet type](PacketTypes.md) | +| 1 | 1 | Byte | 5 | Packet header - length of the packet | +| 2 | 1 | Byte | 0xB2 | Packet header - packet type identifier | +| 3 | 1 | Byte | 0x11 | Packet header - sub packet type identifier | +| 4 | 1 | Byte | | Side; 0 = defender, 1 = attacker, 2 = neutral | \ No newline at end of file diff --git a/docs/Packets/C1-B2-12-CastleSiegeGateOperateResponse_by-server.md b/docs/Packets/C1-B2-12-CastleSiegeGateOperateResponse_by-server.md new file mode 100644 index 000000000..34e791b7b --- /dev/null +++ b/docs/Packets/C1-B2-12-CastleSiegeGateOperateResponse_by-server.md @@ -0,0 +1,20 @@ +# C1 B2 12 - CastleSiegeGateOperateResponse (by server) + +## Is sent when + +After a guild member of the castle owner requested to toggle a castle gate. + +## Causes the following actions on the client side + +The client shows the result of the gate toggle operation. + +## Structure + +| Index | Length | Data Type | Value | Description | +|-------|--------|-----------|-------|-------------| +| 0 | 1 | Byte | 0xC1 | [Packet type](PacketTypes.md) | +| 1 | 1 | Byte | 7 | Packet header - length of the packet | +| 2 | 1 | Byte | 0xB2 | Packet header - packet type identifier | +| 3 | 1 | Byte | 0x12 | Packet header - sub packet type identifier | +| 4 | 1 | Byte | | Result | +| 5 | 2 | ShortBigEndian | | GateIndex | \ No newline at end of file diff --git a/docs/Packets/C1-B2-13-CastleSiegeCrownStateUpdate_by-server.md b/docs/Packets/C1-B2-13-CastleSiegeCrownStateUpdate_by-server.md new file mode 100644 index 000000000..06c19ce4b --- /dev/null +++ b/docs/Packets/C1-B2-13-CastleSiegeCrownStateUpdate_by-server.md @@ -0,0 +1,19 @@ +# C1 B2 13 - CastleSiegeCrownStateUpdate (by server) + +## Is sent when + +The server updates the state of the castle crown during the siege. + +## Causes the following actions on the client side + +The client updates the crown state display. + +## Structure + +| Index | Length | Data Type | Value | Description | +|-------|--------|-----------|-------|-------------| +| 0 | 1 | Byte | 0xC1 | [Packet type](PacketTypes.md) | +| 1 | 1 | Byte | 5 | Packet header - length of the packet | +| 2 | 1 | Byte | 0xB2 | Packet header - packet type identifier | +| 3 | 1 | Byte | 0x13 | Packet header - sub packet type identifier | +| 4 | 1 | Byte | | State; 0 = locked, 1 = available | \ No newline at end of file diff --git a/docs/Packets/C1-B2-14-CastleSiegeCrownAccessState_by-server.md b/docs/Packets/C1-B2-14-CastleSiegeCrownAccessState_by-server.md new file mode 100644 index 000000000..2e2a45b52 --- /dev/null +++ b/docs/Packets/C1-B2-14-CastleSiegeCrownAccessState_by-server.md @@ -0,0 +1,20 @@ +# C1 B2 14 - CastleSiegeCrownAccessState (by server) + +## Is sent when + +The server updates the access state of the castle crown during the siege. + +## Causes the following actions on the client side + +The client updates the crown access state and accumulated time display. + +## Structure + +| Index | Length | Data Type | Value | Description | +|-------|--------|-----------|-------|-------------| +| 0 | 1 | Byte | 0xC1 | [Packet type](PacketTypes.md) | +| 1 | 1 | Byte | 9 | Packet header - length of the packet | +| 2 | 1 | Byte | 0xB2 | Packet header - packet type identifier | +| 3 | 1 | Byte | 0x14 | Packet header - sub packet type identifier | +| 4 | 1 | Byte | | State | +| 5 | 4 | IntegerBigEndian | | AccumulatedTimeMs | \ No newline at end of file diff --git a/docs/Packets/C1-B2-15-CastleSiegeSwitchInfo_by-server.md b/docs/Packets/C1-B2-15-CastleSiegeSwitchInfo_by-server.md new file mode 100644 index 000000000..e41b66668 --- /dev/null +++ b/docs/Packets/C1-B2-15-CastleSiegeSwitchInfo_by-server.md @@ -0,0 +1,24 @@ +# C1 B2 15 - CastleSiegeSwitchInfo (by server) + +## Is sent when + +The server sends information about a castle siege switch (e.g., life stone activation). + +## Causes the following actions on the client side + +The client updates the switch state display. + +## Structure + +| Index | Length | Data Type | Value | Description | +|-------|--------|-----------|-------|-------------| +| 0 | 1 | Byte | 0xC1 | [Packet type](PacketTypes.md) | +| 1 | 1 | Byte | 29 | Packet header - length of the packet | +| 2 | 1 | Byte | 0xB2 | Packet header - packet type identifier | +| 3 | 1 | Byte | 0x15 | Packet header - sub packet type identifier | +| 4 | 2 | ShortBigEndian | | SwitchIndex | +| 6 | 1 | Byte | | SwitchId | +| 7 | 1 | Byte | | State | +| 8 | 1 | Byte | | JoinSide | +| 9 | 9 | String | | GuildName | +| 18 | 11 | String | | UserName | \ No newline at end of file diff --git a/docs/Packets/C1-B2-16-CastleSiegeOwnershipChangeNotification_by-server.md b/docs/Packets/C1-B2-16-CastleSiegeOwnershipChangeNotification_by-server.md new file mode 100644 index 000000000..20d99af4d --- /dev/null +++ b/docs/Packets/C1-B2-16-CastleSiegeOwnershipChangeNotification_by-server.md @@ -0,0 +1,19 @@ +# C1 B2 16 - CastleSiegeOwnershipChangeNotification (by server) + +## Is sent when + +The server notifies all players that the castle ownership has changed. + +## Causes the following actions on the client side + +The client shows the new castle owner guild name. + +## Structure + +| Index | Length | Data Type | Value | Description | +|-------|--------|-----------|-------|-------------| +| 0 | 1 | Byte | 0xC1 | [Packet type](PacketTypes.md) | +| 1 | 1 | Byte | 12 | Packet header - length of the packet | +| 2 | 1 | Byte | 0xB2 | Packet header - packet type identifier | +| 3 | 1 | Byte | 0x16 | Packet header - sub packet type identifier | +| 4 | 8 | String | | GuildName | \ No newline at end of file diff --git a/docs/Packets/C1-B2-17-CastleSiegeBattleStartEnd_by-server.md b/docs/Packets/C1-B2-17-CastleSiegeBattleStartEnd_by-server.md new file mode 100644 index 000000000..d1c8c8af8 --- /dev/null +++ b/docs/Packets/C1-B2-17-CastleSiegeBattleStartEnd_by-server.md @@ -0,0 +1,19 @@ +# C1 B2 17 - CastleSiegeBattleStartEnd (by server) + +## Is sent when + +The server notifies all players that the castle siege battle has started or ended. + +## Causes the following actions on the client side + +The client updates the siege state accordingly. + +## Structure + +| Index | Length | Data Type | Value | Description | +|-------|--------|-----------|-------|-------------| +| 0 | 1 | Byte | 0xC1 | [Packet type](PacketTypes.md) | +| 1 | 1 | Byte | 5 | Packet header - length of the packet | +| 2 | 1 | Byte | 0xB2 | Packet header - packet type identifier | +| 3 | 1 | Byte | 0x17 | Packet header - sub packet type identifier | +| 4 | 1 | Boolean | | IsStarted | \ No newline at end of file diff --git a/docs/Packets/C1-B2-18-CastleSiegeRemainingTime_by-server.md b/docs/Packets/C1-B2-18-CastleSiegeRemainingTime_by-server.md new file mode 100644 index 000000000..cf0c6efc5 --- /dev/null +++ b/docs/Packets/C1-B2-18-CastleSiegeRemainingTime_by-server.md @@ -0,0 +1,20 @@ +# C1 B2 18 - CastleSiegeRemainingTime (by server) + +## Is sent when + +The server sends the remaining siege time. + +## Causes the following actions on the client side + +The client updates the remaining siege time display. + +## Structure + +| Index | Length | Data Type | Value | Description | +|-------|--------|-----------|-------|-------------| +| 0 | 1 | Byte | 0xC1 | [Packet type](PacketTypes.md) | +| 1 | 1 | Byte | 6 | Packet header - length of the packet | +| 2 | 1 | Byte | 0xB2 | Packet header - packet type identifier | +| 3 | 1 | Byte | 0x18 | Packet header - sub packet type identifier | +| 4 | 1 | Byte | | Hour | +| 5 | 1 | Byte | | Minute | \ No newline at end of file diff --git a/docs/Packets/C1-B2-19-CastleSiegeGateOperateState_by-server.md b/docs/Packets/C1-B2-19-CastleSiegeGateOperateState_by-server.md new file mode 100644 index 000000000..00bb3c830 --- /dev/null +++ b/docs/Packets/C1-B2-19-CastleSiegeGateOperateState_by-server.md @@ -0,0 +1,20 @@ +# C1 B2 19 - CastleSiegeGateOperateState (by server) + +## Is sent when + +The server sends the current operation state of a castle gate. + +## Causes the following actions on the client side + +The client updates the gate state display. + +## Structure + +| Index | Length | Data Type | Value | Description | +|-------|--------|-----------|-------|-------------| +| 0 | 1 | Byte | 0xC1 | [Packet type](PacketTypes.md) | +| 1 | 1 | Byte | 7 | Packet header - length of the packet | +| 2 | 1 | Byte | 0xB2 | Packet header - packet type identifier | +| 3 | 1 | Byte | 0x19 | Packet header - sub packet type identifier | +| 4 | 2 | ShortBigEndian | | GateIndex | +| 6 | 1 | Byte | | State | \ No newline at end of file diff --git a/docs/Packets/C1-B3-00-CastleSiegeGateState_by-server.md b/docs/Packets/C1-B3-00-CastleSiegeGateState_by-server.md new file mode 100644 index 000000000..ecd630892 --- /dev/null +++ b/docs/Packets/C1-B3-00-CastleSiegeGateState_by-server.md @@ -0,0 +1,20 @@ +# C1 B3 00 - CastleSiegeGateState (by server) + +## Is sent when + +The server sends the current state of a castle gate. + +## Causes the following actions on the client side + +The client updates the gate state display. + +## Structure + +| Index | Length | Data Type | Value | Description | +|-------|--------|-----------|-------|-------------| +| 0 | 1 | Byte | 0xC1 | [Packet type](PacketTypes.md) | +| 1 | 1 | Byte | 7 | Packet header - length of the packet | +| 2 | 1 | Byte | 0xB3 | Packet header - packet type identifier | +| 3 | 1 | Byte | 0x00 | Packet header - sub packet type identifier | +| 4 | 2 | ShortBigEndian | | GateIndex | +| 6 | 1 | Byte | | State | \ No newline at end of file diff --git a/docs/Packets/C1-B7-01-CastleSiegeMachineUseResult_by-server.md b/docs/Packets/C1-B7-01-CastleSiegeMachineUseResult_by-server.md new file mode 100644 index 000000000..7221286c8 --- /dev/null +++ b/docs/Packets/C1-B7-01-CastleSiegeMachineUseResult_by-server.md @@ -0,0 +1,21 @@ +# C1 B7 01 - CastleSiegeMachineUseResult (by server) + +## Is sent when + +After the player fired a siege machine (catapult). + +## Causes the following actions on the client side + +The client shows the catapult animation toward the target area. + +## Structure + +| Index | Length | Data Type | Value | Description | +|-------|--------|-----------|-------|-------------| +| 0 | 1 | Byte | 0xC1 | [Packet type](PacketTypes.md) | +| 1 | 1 | Byte | 8 | Packet header - length of the packet | +| 2 | 1 | Byte | 0xB7 | Packet header - packet type identifier | +| 3 | 1 | Byte | 0x01 | Packet header - sub packet type identifier | +| 4 | 2 | ShortBigEndian | | NpcIndex | +| 6 | 1 | Byte | | TargetX | +| 7 | 1 | Byte | | TargetY | \ No newline at end of file diff --git a/docs/Packets/C1-B7-02-CastleSiegeMachineRegionNotify_by-server.md b/docs/Packets/C1-B7-02-CastleSiegeMachineRegionNotify_by-server.md new file mode 100644 index 000000000..c9121fa25 --- /dev/null +++ b/docs/Packets/C1-B7-02-CastleSiegeMachineRegionNotify_by-server.md @@ -0,0 +1,20 @@ +# C1 B7 02 - CastleSiegeMachineRegionNotify (by server) + +## Is sent when + +The server notifies the player of the impact region of a siege machine. + +## Causes the following actions on the client side + +The client shows the impact area effect. + +## Structure + +| Index | Length | Data Type | Value | Description | +|-------|--------|-----------|-------|-------------| +| 0 | 1 | Byte | 0xC1 | [Packet type](PacketTypes.md) | +| 1 | 1 | Byte | 6 | Packet header - length of the packet | +| 2 | 1 | Byte | 0xB7 | Packet header - packet type identifier | +| 3 | 1 | Byte | 0x02 | Packet header - sub packet type identifier | +| 4 | 1 | Byte | | TargetX | +| 5 | 1 | Byte | | TargetY | \ No newline at end of file diff --git a/docs/Packets/C1-B7-03-CastleSiegeMachineInterface_by-server.md b/docs/Packets/C1-B7-03-CastleSiegeMachineInterface_by-server.md new file mode 100644 index 000000000..3b6738321 --- /dev/null +++ b/docs/Packets/C1-B7-03-CastleSiegeMachineInterface_by-server.md @@ -0,0 +1,19 @@ +# C1 B7 03 - CastleSiegeMachineInterface (by server) + +## Is sent when + +The server sends the siege machine interface to a player who is operating the machine. + +## Causes the following actions on the client side + +The client shows the siege machine operation interface. + +## Structure + +| Index | Length | Data Type | Value | Description | +|-------|--------|-----------|-------|-------------| +| 0 | 1 | Byte | 0xC1 | [Packet type](PacketTypes.md) | +| 1 | 1 | Byte | 5 | Packet header - length of the packet | +| 2 | 1 | Byte | 0xB7 | Packet header - packet type identifier | +| 3 | 1 | Byte | 0x03 | Packet header - sub packet type identifier | +| 4 | 1 | Byte | | MachineType | \ No newline at end of file diff --git a/docs/Packets/C1-B7-05-CastleSiegeLifeStoneState_by-server.md b/docs/Packets/C1-B7-05-CastleSiegeLifeStoneState_by-server.md new file mode 100644 index 000000000..219021f69 --- /dev/null +++ b/docs/Packets/C1-B7-05-CastleSiegeLifeStoneState_by-server.md @@ -0,0 +1,19 @@ +# C1 B7 05 - CastleSiegeLifeStoneState (by server) + +## Is sent when + +The server sends the current state of the castle life stone. + +## Causes the following actions on the client side + +The client updates the life stone state display. + +## Structure + +| Index | Length | Data Type | Value | Description | +|-------|--------|-----------|-------|-------------| +| 0 | 1 | Byte | 0xC1 | [Packet type](PacketTypes.md) | +| 1 | 1 | Byte | 5 | Packet header - length of the packet | +| 2 | 1 | Byte | 0xB7 | Packet header - packet type identifier | +| 3 | 1 | Byte | 0x05 | Packet header - sub packet type identifier | +| 4 | 1 | Byte | | State; The creation stage of the life stone (0 to 4). | \ No newline at end of file diff --git a/docs/Packets/C1-B9-02-CastleOwnerLogo_by-server.md b/docs/Packets/C1-B9-02-CastleOwnerLogo_by-server.md new file mode 100644 index 000000000..2914ad2e0 --- /dev/null +++ b/docs/Packets/C1-B9-02-CastleOwnerLogo_by-server.md @@ -0,0 +1,19 @@ +# C1 B9 02 - CastleOwnerLogo (by server) + +## Is sent when + +After the client requested the guild logo of the current castle owner. + +## Causes the following actions on the client side + +The client shows the castle owner guild logo. + +## Structure + +| Index | Length | Data Type | Value | Description | +|-------|--------|-----------|-------|-------------| +| 0 | 1 | Byte | 0xC1 | [Packet type](PacketTypes.md) | +| 1 | 1 | Byte | 36 | Packet header - length of the packet | +| 2 | 1 | Byte | 0xB9 | Packet header - packet type identifier | +| 3 | 1 | Byte | 0x02 | Packet header - sub packet type identifier | +| 4 | 32 | Binary | | Logo | \ No newline at end of file diff --git a/docs/Packets/C1-B9-03-HuntingZoneGuardInfo_by-server.md b/docs/Packets/C1-B9-03-HuntingZoneGuardInfo_by-server.md new file mode 100644 index 000000000..e3c6fc0c3 --- /dev/null +++ b/docs/Packets/C1-B9-03-HuntingZoneGuardInfo_by-server.md @@ -0,0 +1,20 @@ +# C1 B9 03 - HuntingZoneGuardInfo (by server) + +## Is sent when + +The server sends information about the hunting zone guard configuration. + +## Causes the following actions on the client side + +The client shows the hunting zone entrance configuration. + +## Structure + +| Index | Length | Data Type | Value | Description | +|-------|--------|-----------|-------|-------------| +| 0 | 1 | Byte | 0xC1 | [Packet type](PacketTypes.md) | +| 1 | 1 | Byte | 9 | Packet header - length of the packet | +| 2 | 1 | Byte | 0xB9 | Packet header - packet type identifier | +| 3 | 1 | Byte | 0x03 | Packet header - sub packet type identifier | +| 4 | 1 | Boolean | | IsEnabled | +| 5 | 4 | IntegerBigEndian | | TaxRate | \ No newline at end of file diff --git a/docs/Packets/C1-E6-GuildRelationshipChangeResponse_by-server.md b/docs/Packets/C1-E6-GuildRelationshipChangeResponse_by-server.md new file mode 100644 index 000000000..f3e233a5b --- /dev/null +++ b/docs/Packets/C1-E6-GuildRelationshipChangeResponse_by-server.md @@ -0,0 +1,20 @@ +# C1 E6 - GuildRelationshipChangeResponse (by server) + +## Is sent when + +After a guild relationship change was processed by the server. + +## Causes the following actions on the client side + +The client shows the result of the guild relationship change request. + +## Structure + +| Index | Length | Data Type | Value | Description | +|-------|--------|-----------|-------|-------------| +| 0 | 1 | Byte | 0xC1 | [Packet type](PacketTypes.md) | +| 1 | 1 | Byte | 9 | Packet header - length of the packet | +| 2 | 1 | Byte | 0xE6 | Packet header - packet type identifier | +| 3 | 1 | Byte | | Result | +| 4 | 1 | Byte | | RelationshipType | +| 5 | 4 | IntegerBigEndian | | TargetGuildId | \ No newline at end of file diff --git a/docs/Packets/C2-B2-1A-CastleSiegeMiniMapPlayerPositions_by-server.md b/docs/Packets/C2-B2-1A-CastleSiegeMiniMapPlayerPositions_by-server.md new file mode 100644 index 000000000..5bc82229c --- /dev/null +++ b/docs/Packets/C2-B2-1A-CastleSiegeMiniMapPlayerPositions_by-server.md @@ -0,0 +1,31 @@ +# C2 B2 1A - CastleSiegeMiniMapPlayerPositions (by server) + +## Is sent when + +The server sends the positions of all players in the castle siege mini map. + +## Causes the following actions on the client side + +The client updates the mini map with the player positions. + +## Structure + +| Index | Length | Data Type | Value | Description | +|-------|--------|-----------|-------|-------------| +| 0 | 1 | Byte | 0xC2 | [Packet type](PacketTypes.md) | +| 1 | 2 | Short | | Packet header - length of the packet | +| 3 | 1 | Byte | 0xB2 | Packet header - packet type identifier | +| 4 | 1 | Byte | 0x1A | Packet header - sub packet type identifier | +| 5 | 4 | IntegerBigEndian | | PlayerCount | +| 9 | MiniMapPlayerPosition.Length * PlayerCount | Array of MiniMapPlayerPosition | | Players | + +### MiniMapPlayerPosition Structure + +The position of one player on the mini map. + +Length: 2 Bytes + +| Index | Length | Data Type | Value | Description | +|-------|--------|-----------|-------|-------------| +| 0 | 1 | Byte | | PositionX | +| 1 | 1 | Byte | | PositionY | \ No newline at end of file diff --git a/docs/Packets/C2-B2-1B-CastleSiegeMiniMapNpcPositions_by-server.md b/docs/Packets/C2-B2-1B-CastleSiegeMiniMapNpcPositions_by-server.md new file mode 100644 index 000000000..e8d2cb1ab --- /dev/null +++ b/docs/Packets/C2-B2-1B-CastleSiegeMiniMapNpcPositions_by-server.md @@ -0,0 +1,32 @@ +# C2 B2 1B - CastleSiegeMiniMapNpcPositions (by server) + +## Is sent when + +The server sends the positions of all siege NPCs in the castle siege mini map. + +## Causes the following actions on the client side + +The client updates the mini map with the NPC positions. + +## Structure + +| Index | Length | Data Type | Value | Description | +|-------|--------|-----------|-------|-------------| +| 0 | 1 | Byte | 0xC2 | [Packet type](PacketTypes.md) | +| 1 | 2 | Short | | Packet header - length of the packet | +| 3 | 1 | Byte | 0xB2 | Packet header - packet type identifier | +| 4 | 1 | Byte | 0x1B | Packet header - sub packet type identifier | +| 5 | 4 | IntegerBigEndian | | NpcCount | +| 9 | MiniMapNpcPosition.Length * NpcCount | Array of MiniMapNpcPosition | | Npcs | + +### MiniMapNpcPosition Structure + +The position of one NPC on the mini map. + +Length: 3 Bytes + +| Index | Length | Data Type | Value | Description | +|-------|--------|-----------|-------|-------------| +| 0 | 1 | Byte | | NpcType | +| 1 | 1 | Byte | | PositionX | +| 2 | 1 | Byte | | PositionY | \ No newline at end of file diff --git a/docs/Packets/C2-B3-02-CastleSiegeNpcList_by-server.md b/docs/Packets/C2-B3-02-CastleSiegeNpcList_by-server.md new file mode 100644 index 000000000..e92903b85 --- /dev/null +++ b/docs/Packets/C2-B3-02-CastleSiegeNpcList_by-server.md @@ -0,0 +1,39 @@ +# C2 B3 02 - CastleSiegeNpcList (by server) + +## Is sent when + +After the guild master requested the list of all castle siege statues and gates. + +## Causes the following actions on the client side + +The client shows the list of castle siege NPCs with their current status. + +## Structure + +| Index | Length | Data Type | Value | Description | +|-------|--------|-----------|-------|-------------| +| 0 | 1 | Byte | 0xC2 | [Packet type](PacketTypes.md) | +| 1 | 2 | Short | | Packet header - length of the packet | +| 3 | 1 | Byte | 0xB3 | Packet header - packet type identifier | +| 4 | 1 | Byte | 0x02 | Packet header - sub packet type identifier | +| 5 | 1 | Byte | | Result | +| 6 | 4 | IntegerBigEndian | | NpcCount | +| 10 | CastleSiegeNpcInfo.Length * NpcCount | Array of CastleSiegeNpcInfo | | NpcList | + +### CastleSiegeNpcInfo Structure + +Information about one castle siege NPC (gate or statue). + +Length: 21 Bytes + +| Index | Length | Data Type | Value | Description | +|-------|--------|-----------|-------|-------------| +| 0 | 4 | IntegerLittleEndian | | NpcNumber | +| 4 | 4 | IntegerLittleEndian | | NpcIndex | +| 8 | 1 | Byte | | DefenseUpgradeLevel | +| 9 | 1 | Byte | | RegenerationLevel | +| 10 | 4 | IntegerLittleEndian | | MaxHp | +| 14 | 4 | IntegerLittleEndian | | CurrentHp | +| 18 | 1 | Byte | | PositionX | +| 19 | 1 | Byte | | PositionY | +| 20 | 1 | Boolean | | IsAlive | \ No newline at end of file diff --git a/docs/Packets/C2-B4-CastleSiegeRegisteredGuildList_by-server.md b/docs/Packets/C2-B4-CastleSiegeRegisteredGuildList_by-server.md new file mode 100644 index 000000000..2c64e1424 --- /dev/null +++ b/docs/Packets/C2-B4-CastleSiegeRegisteredGuildList_by-server.md @@ -0,0 +1,32 @@ +# C2 B4 - CastleSiegeRegisteredGuildList (by server) + +## Is sent when + +After the guild master requested the list of guilds registered for the next siege. + +## Causes the following actions on the client side + +The client shows the list of registered guilds and their mark counts. + +## Structure + +| Index | Length | Data Type | Value | Description | +|-------|--------|-----------|-------|-------------| +| 0 | 1 | Byte | 0xC2 | [Packet type](PacketTypes.md) | +| 1 | 2 | Short | | Packet header - length of the packet | +| 3 | 1 | Byte | 0xB4 | Packet header - packet type identifier | +| 4 | 4 | IntegerBigEndian | | GuildCount | +| 8 | RegisteredGuildEntry.Length * GuildCount | Array of RegisteredGuildEntry | | Guilds | + +### RegisteredGuildEntry Structure + +Information about one guild registered for the next castle siege. + +Length: 17 Bytes + +| Index | Length | Data Type | Value | Description | +|-------|--------|-----------|-------|-------------| +| 0 | 8 | String | | GuildName | +| 8 | 4 | IntegerBigEndian | | GuildMarkCount | +| 12 | 4 | IntegerBigEndian | | RegistrationId | +| 16 | 1 | Boolean | | IsCastleOwner | \ No newline at end of file diff --git a/docs/Packets/C2-B5-CastleSiegeGuildList_by-server.md b/docs/Packets/C2-B5-CastleSiegeGuildList_by-server.md new file mode 100644 index 000000000..1b51d17bd --- /dev/null +++ b/docs/Packets/C2-B5-CastleSiegeGuildList_by-server.md @@ -0,0 +1,33 @@ +# C2 B5 - CastleSiegeGuildList (by server) + +## Is sent when + +After the guild master requested the list of all guilds in the current castle siege. + +## Causes the following actions on the client side + +The client shows the list of guilds participating in the castle siege. + +## Structure + +| Index | Length | Data Type | Value | Description | +|-------|--------|-----------|-------|-------------| +| 0 | 1 | Byte | 0xC2 | [Packet type](PacketTypes.md) | +| 1 | 2 | Short | | Packet header - length of the packet | +| 3 | 1 | Byte | 0xB5 | Packet header - packet type identifier | +| 4 | 1 | Byte | | Result | +| 5 | 4 | IntegerBigEndian | | GuildCount | +| 9 | CastleSiegeGuildEntry.Length * GuildCount | Array of CastleSiegeGuildEntry | | Guilds | + +### CastleSiegeGuildEntry Structure + +Information about one guild in the castle siege. + +Length: 14 Bytes + +| Index | Length | Data Type | Value | Description | +|-------|--------|-----------|-------|-------------| +| 0 | 1 | Byte | | Side; 0 = defender, 1 = attacker | +| 1 | 1 | Boolean | | IsInvolved | +| 2 | 8 | String | | GuildName | +| 10 | 4 | IntegerBigEndian | | Score | \ No newline at end of file diff --git a/docs/Packets/C2-E9-AllianceList_by-server.md b/docs/Packets/C2-E9-AllianceList_by-server.md new file mode 100644 index 000000000..4a64b0752 --- /dev/null +++ b/docs/Packets/C2-E9-AllianceList_by-server.md @@ -0,0 +1,31 @@ +# C2 E9 - AllianceList (by server) + +## Is sent when + +After the player requested the alliance list. + +## Causes the following actions on the client side + +The client shows the list of guilds in the alliance. + +## Structure + +| Index | Length | Data Type | Value | Description | +|-------|--------|-----------|-------|-------------| +| 0 | 1 | Byte | 0xC2 | [Packet type](PacketTypes.md) | +| 1 | 2 | Short | | Packet header - length of the packet | +| 3 | 1 | Byte | 0xE9 | Packet header - packet type identifier | +| 4 | 1 | Byte | | GuildCount | +| 5 | AllianceGuildEntry.Length * GuildCount | Array of AllianceGuildEntry | | Guilds | + +### AllianceGuildEntry Structure + +Information about one guild in the alliance. + +Length: 19 Bytes + +| Index | Length | Data Type | Value | Description | +|-------|--------|-----------|-------|-------------| +| 0 | 8 | String | | GuildName | +| 8 | 1 | Byte | | MemberCount | +| 9 | 10 | String | | GuildMasterName | \ No newline at end of file diff --git a/docs/Packets/ServerToClient.md b/docs/Packets/ServerToClient.md index a69cc5b64..f2465e334 100644 --- a/docs/Packets/ServerToClient.md +++ b/docs/Packets/ServerToClient.md @@ -148,6 +148,38 @@ * [C1 AA 0D - DuelHealthBarInit (by server)](C1-AA-0D-DuelHealthBarInit_by-server.md) * [C2 AE - MuHelperConfigurationData (by server)](C2-AE-MuHelperConfigurationData_by-server.md) * [C1 AF 01 - ChaosCastleEnterResult (by server)](C1-AF-01-ChaosCastleEnterResult_by-server.md) + * [C1 B2 00 - CastleSiegeStatusResponse (by server)](C1-B2-00-CastleSiegeStatusResponse_by-server.md) + * [C1 B2 01 - CastleSiegeRegistrationResponse (by server)](C1-B2-01-CastleSiegeRegistrationResponse_by-server.md) + * [C1 B2 02 - CastleSiegeUnregisterResponse (by server)](C1-B2-02-CastleSiegeUnregisterResponse_by-server.md) + * [C1 B2 03 - CastleSiegeRegistrationStateResponse (by server)](C1-B2-03-CastleSiegeRegistrationStateResponse_by-server.md) + * [C1 B2 04 - CastleSiegeMarkRegistrationResponse (by server)](C1-B2-04-CastleSiegeMarkRegistrationResponse_by-server.md) + * [C1 B2 05 - CastleSiegeDefenseBuyResponse (by server)](C1-B2-05-CastleSiegeDefenseBuyResponse_by-server.md) + * [C1 B2 06 - CastleSiegeDefenseRepairResponse (by server)](C1-B2-06-CastleSiegeDefenseRepairResponse_by-server.md) + * [C1 B2 07 - CastleSiegeDefenseUpgradeResponse (by server)](C1-B2-07-CastleSiegeDefenseUpgradeResponse_by-server.md) + * [C1 B2 08 - CastleSiegeTaxInfoResponse (by server)](C1-B2-08-CastleSiegeTaxInfoResponse_by-server.md) + * [C1 B2 09 - CastleSiegeTaxChangeResponse (by server)](C1-B2-09-CastleSiegeTaxChangeResponse_by-server.md) + * [C1 B2 10 - CastleSiegeTributeWithdrawResponse (by server)](C1-B2-10-CastleSiegeTributeWithdrawResponse_by-server.md) + * [C1 B2 11 - CastleSiegeJoinSideNotification (by server)](C1-B2-11-CastleSiegeJoinSideNotification_by-server.md) + * [C1 B2 12 - CastleSiegeGateOperateResponse (by server)](C1-B2-12-CastleSiegeGateOperateResponse_by-server.md) + * [C1 B2 13 - CastleSiegeCrownStateUpdate (by server)](C1-B2-13-CastleSiegeCrownStateUpdate_by-server.md) + * [C1 B2 14 - CastleSiegeCrownAccessState (by server)](C1-B2-14-CastleSiegeCrownAccessState_by-server.md) + * [C1 B2 15 - CastleSiegeSwitchInfo (by server)](C1-B2-15-CastleSiegeSwitchInfo_by-server.md) + * [C1 B2 16 - CastleSiegeOwnershipChangeNotification (by server)](C1-B2-16-CastleSiegeOwnershipChangeNotification_by-server.md) + * [C1 B2 17 - CastleSiegeBattleStartEnd (by server)](C1-B2-17-CastleSiegeBattleStartEnd_by-server.md) + * [C1 B2 18 - CastleSiegeRemainingTime (by server)](C1-B2-18-CastleSiegeRemainingTime_by-server.md) + * [C1 B2 19 - CastleSiegeGateOperateState (by server)](C1-B2-19-CastleSiegeGateOperateState_by-server.md) + * [C2 B2 1A - CastleSiegeMiniMapPlayerPositions (by server)](C2-B2-1A-CastleSiegeMiniMapPlayerPositions_by-server.md) + * [C2 B2 1B - CastleSiegeMiniMapNpcPositions (by server)](C2-B2-1B-CastleSiegeMiniMapNpcPositions_by-server.md) + * [C1 B3 00 - CastleSiegeGateState (by server)](C1-B3-00-CastleSiegeGateState_by-server.md) + * [C2 B3 02 - CastleSiegeNpcList (by server)](C2-B3-02-CastleSiegeNpcList_by-server.md) + * [C2 B4 - CastleSiegeRegisteredGuildList (by server)](C2-B4-CastleSiegeRegisteredGuildList_by-server.md) + * [C2 B5 - CastleSiegeGuildList (by server)](C2-B5-CastleSiegeGuildList_by-server.md) + * [C1 B7 01 - CastleSiegeMachineUseResult (by server)](C1-B7-01-CastleSiegeMachineUseResult_by-server.md) + * [C1 B7 02 - CastleSiegeMachineRegionNotify (by server)](C1-B7-02-CastleSiegeMachineRegionNotify_by-server.md) + * [C1 B7 03 - CastleSiegeMachineInterface (by server)](C1-B7-03-CastleSiegeMachineInterface_by-server.md) + * [C1 B7 05 - CastleSiegeLifeStoneState (by server)](C1-B7-05-CastleSiegeLifeStoneState_by-server.md) + * [C1 B9 02 - CastleOwnerLogo (by server)](C1-B9-02-CastleOwnerLogo_by-server.md) + * [C1 B9 03 - HuntingZoneGuardInfo (by server)](C1-B9-03-HuntingZoneGuardInfo_by-server.md) * [C1 BA - SkillStageUpdate (by server)](C1-BA-SkillStageUpdate_by-server.md) * [C1 BF 00 - IllusionTempleEnterResult (by server)](C1-BF-00-IllusionTempleEnterResult_by-server.md) * [C1 BF 01 - IllusionTempleState (by server)](C1-BF-01-IllusionTempleState_by-server.md) @@ -175,6 +207,8 @@ * [C1 D4 - ObjectWalked (by server)](C1-D4-ObjectWalked_by-server.md) * [C1 D4 - ObjectWalkedExtended (by server)](C1-D4-ObjectWalkedExtended_by-server.md) * [C1 DE 00 - CharacterClassCreationUnlock (by server)](C1-DE-00-CharacterClassCreationUnlock_by-server.md) + * [C1 E6 - GuildRelationshipChangeResponse (by server)](C1-E6-GuildRelationshipChangeResponse_by-server.md) + * [C2 E9 - AllianceList (by server)](C2-E9-AllianceList_by-server.md) * [C1 F1 00 - GameServerEntered (by server)](C1-F1-00-GameServerEntered_by-server.md) * [C1 F1 01 - LoginResponse (by server)](C1-F1-01-LoginResponse_by-server.md) * [C3 F1 02 - LogoutResponse (by server)](C3-F1-02-LogoutResponse_by-server.md) diff --git a/src/Network/Packets/ServerToClient/ConnectionExtensions.cs b/src/Network/Packets/ServerToClient/ConnectionExtensions.cs index fefddfa0c..d3df1b5fa 100644 --- a/src/Network/Packets/ServerToClient/ConnectionExtensions.cs +++ b/src/Network/Packets/ServerToClient/ConnectionExtensions.cs @@ -6187,5 +6187,899 @@ int WritePacket() return packet.Header.Length; } + await connection.SendAsync(WritePacket).ConfigureAwait(false); + } + + /// + /// Sends a to this connection. + /// + /// The connection. + /// The result. + /// The state. + /// The start year. + /// The start month. + /// The start day. + /// The start hour. + /// The start minute. + /// The end year. + /// The end month. + /// The end day. + /// The end hour. + /// The end minute. + /// The siege start year. + /// The siege start month. + /// The siege start day. + /// The siege start hour. + /// The siege start minute. + /// The guild name. + /// The guild master name. + /// The remaining time. + /// + /// Is sent by the server when: After the player requested the current castle siege status from a castle siege npc. + /// Causes reaction on client side: The client shows the castle siege status. + /// + public static async ValueTask SendCastleSiegeStatusResponseAsync(this IConnection? connection, byte @result, byte @state, ushort @startYear, byte @startMonth, byte @startDay, byte @startHour, byte @startMinute, ushort @endYear, byte @endMonth, byte @endDay, byte @endHour, byte @endMinute, ushort @siegeStartYear, byte @siegeStartMonth, byte @siegeStartDay, byte @siegeStartHour, byte @siegeStartMinute, string @guildName, string @guildMasterName, uint @remainingTime) + { + if (connection is null) + { + return; + } + + int WritePacket() + { + var length = CastleSiegeStatusResponseRef.Length; + var packet = new CastleSiegeStatusResponseRef(connection.Output.GetSpan(length)[..length]); + packet.Result = @result; + packet.State = @state; + packet.StartYear = @startYear; + packet.StartMonth = @startMonth; + packet.StartDay = @startDay; + packet.StartHour = @startHour; + packet.StartMinute = @startMinute; + packet.EndYear = @endYear; + packet.EndMonth = @endMonth; + packet.EndDay = @endDay; + packet.EndHour = @endHour; + packet.EndMinute = @endMinute; + packet.SiegeStartYear = @siegeStartYear; + packet.SiegeStartMonth = @siegeStartMonth; + packet.SiegeStartDay = @siegeStartDay; + packet.SiegeStartHour = @siegeStartHour; + packet.SiegeStartMinute = @siegeStartMinute; + packet.GuildName = @guildName; + packet.GuildMasterName = @guildMasterName; + packet.RemainingTime = @remainingTime; + + return packet.Header.Length; + } + + await connection.SendAsync(WritePacket).ConfigureAwait(false); + } + + /// + /// Sends a to this connection. + /// + /// The connection. + /// The result. + /// The guild name. + /// + /// Is sent by the server when: After the player requested to register his guild for the next castle siege. + /// Causes reaction on client side: The client shows the result of the registration attempt. + /// + public static async ValueTask SendCastleSiegeRegistrationResponseAsync(this IConnection? connection, byte @result, string @guildName) + { + if (connection is null) + { + return; + } + + int WritePacket() + { + var length = CastleSiegeRegistrationResponseRef.Length; + var packet = new CastleSiegeRegistrationResponseRef(connection.Output.GetSpan(length)[..length]); + packet.Result = @result; + packet.GuildName = @guildName; + + return packet.Header.Length; + } + + await connection.SendAsync(WritePacket).ConfigureAwait(false); + } + + /// + /// Sends a to this connection. + /// + /// The connection. + /// The result. + /// + /// Is sent by the server when: After the player requested to un-register his guild from the next castle siege. + /// Causes reaction on client side: The client shows the result of the un-registration attempt. + /// + public static async ValueTask SendCastleSiegeUnregisterResponseAsync(this IConnection? connection, byte @result) + { + if (connection is null) + { + return; + } + + int WritePacket() + { + var length = CastleSiegeUnregisterResponseRef.Length; + var packet = new CastleSiegeUnregisterResponseRef(connection.Output.GetSpan(length)[..length]); + packet.Result = @result; + + return packet.Header.Length; + } + + await connection.SendAsync(WritePacket).ConfigureAwait(false); + } + + /// + /// Sends a to this connection. + /// + /// The connection. + /// The guild name. + /// The guild mark count. + /// The registration id. + /// + /// Is sent by the server when: After the player requested the current registration state of his guild. + /// Causes reaction on client side: The client shows the current registration state including the number of submitted guild marks. + /// + public static async ValueTask SendCastleSiegeRegistrationStateResponseAsync(this IConnection? connection, string @guildName, uint @guildMarkCount, uint @registrationId) + { + if (connection is null) + { + return; + } + + int WritePacket() + { + var length = CastleSiegeRegistrationStateResponseRef.Length; + var packet = new CastleSiegeRegistrationStateResponseRef(connection.Output.GetSpan(length)[..length]); + packet.GuildName = @guildName; + packet.GuildMarkCount = @guildMarkCount; + packet.RegistrationId = @registrationId; + + return packet.Header.Length; + } + + await connection.SendAsync(WritePacket).ConfigureAwait(false); + } + + /// + /// Sends a to this connection. + /// + /// The connection. + /// The result. + /// The guild name. + /// The guild mark count. + /// + /// Is sent by the server when: After the player submitted a guild mark for the castle siege registration. + /// Causes reaction on client side: The client shows the updated guild mark count. + /// + public static async ValueTask SendCastleSiegeMarkRegistrationResponseAsync(this IConnection? connection, byte @result, string @guildName, uint @guildMarkCount) + { + if (connection is null) + { + return; + } + + int WritePacket() + { + var length = CastleSiegeMarkRegistrationResponseRef.Length; + var packet = new CastleSiegeMarkRegistrationResponseRef(connection.Output.GetSpan(length)[..length]); + packet.Result = @result; + packet.GuildName = @guildName; + packet.GuildMarkCount = @guildMarkCount; + + return packet.Header.Length; + } + + await connection.SendAsync(WritePacket).ConfigureAwait(false); + } + + /// + /// Sends a to this connection. + /// + /// The connection. + /// The result. + /// The npc number. + /// The npc index. + /// + /// Is sent by the server when: After the player requested to buy a castle siege defense structure (gate or statue). + /// Causes reaction on client side: The client shows the result of the buy request. + /// + public static async ValueTask SendCastleSiegeDefenseBuyResponseAsync(this IConnection? connection, byte @result, uint @npcNumber, uint @npcIndex) + { + if (connection is null) + { + return; + } + + int WritePacket() + { + var length = CastleSiegeDefenseBuyResponseRef.Length; + var packet = new CastleSiegeDefenseBuyResponseRef(connection.Output.GetSpan(length)[..length]); + packet.Result = @result; + packet.NpcNumber = @npcNumber; + packet.NpcIndex = @npcIndex; + + return packet.Header.Length; + } + + await connection.SendAsync(WritePacket).ConfigureAwait(false); + } + + /// + /// Sends a to this connection. + /// + /// The connection. + /// The result. + /// The npc number. + /// The npc index. + /// + /// Is sent by the server when: After the player requested to repair a castle siege defense structure (gate or statue). + /// Causes reaction on client side: The client shows the result of the repair request. + /// + public static async ValueTask SendCastleSiegeDefenseRepairResponseAsync(this IConnection? connection, byte @result, uint @npcNumber, uint @npcIndex) + { + if (connection is null) + { + return; + } + + int WritePacket() + { + var length = CastleSiegeDefenseRepairResponseRef.Length; + var packet = new CastleSiegeDefenseRepairResponseRef(connection.Output.GetSpan(length)[..length]); + packet.Result = @result; + packet.NpcNumber = @npcNumber; + packet.NpcIndex = @npcIndex; + + return packet.Header.Length; + } + + await connection.SendAsync(WritePacket).ConfigureAwait(false); + } + + /// + /// Sends a to this connection. + /// + /// The connection. + /// The result. + /// The npc number. + /// The npc index. + /// The npc upgrade type. + /// The npc upgrade value. + /// + /// Is sent by the server when: After the player requested to upgrade a castle siege defense structure (gate or statue). + /// Causes reaction on client side: The client shows the result of the upgrade request and the new upgrade values. + /// + public static async ValueTask SendCastleSiegeDefenseUpgradeResponseAsync(this IConnection? connection, byte @result, uint @npcNumber, uint @npcIndex, uint @npcUpgradeType, uint @npcUpgradeValue) + { + if (connection is null) + { + return; + } + + int WritePacket() + { + var length = CastleSiegeDefenseUpgradeResponseRef.Length; + var packet = new CastleSiegeDefenseUpgradeResponseRef(connection.Output.GetSpan(length)[..length]); + packet.Result = @result; + packet.NpcNumber = @npcNumber; + packet.NpcIndex = @npcIndex; + packet.NpcUpgradeType = @npcUpgradeType; + packet.NpcUpgradeValue = @npcUpgradeValue; + + return packet.Header.Length; + } + + await connection.SendAsync(WritePacket).ConfigureAwait(false); + } + + /// + /// Sends a to this connection. + /// + /// The connection. + /// The tax rate chaos machine. + /// The tax rate normal. + /// The tax rate land of trials. + /// The is public hunting allowed. + /// The treasury. + /// + /// Is sent by the server when: After the guild master opened the castle npc to manage the castle taxes. + /// Causes reaction on client side: The client shows the current tax configuration and treasury amount. + /// + public static async ValueTask SendCastleSiegeTaxInfoResponseAsync(this IConnection? connection, byte @taxRateChaosMachine, byte @taxRateNormal, uint @taxRateLandOfTrials, bool @isPublicHuntingAllowed, ulong @treasury) + { + if (connection is null) + { + return; + } + + int WritePacket() + { + var length = CastleSiegeTaxInfoResponseRef.Length; + var packet = new CastleSiegeTaxInfoResponseRef(connection.Output.GetSpan(length)[..length]); + packet.TaxRateChaosMachine = @taxRateChaosMachine; + packet.TaxRateNormal = @taxRateNormal; + packet.TaxRateLandOfTrials = @taxRateLandOfTrials; + packet.IsPublicHuntingAllowed = @isPublicHuntingAllowed; + packet.Treasury = @treasury; + + return packet.Header.Length; + } + + await connection.SendAsync(WritePacket).ConfigureAwait(false); + } + + /// + /// Sends a to this connection. + /// + /// The connection. + /// The result. + /// The tax type. + /// The tax rate. + /// + /// Is sent by the server when: After the guild master changed the tax rate. + /// Causes reaction on client side: The client shows the result of the tax rate change. + /// + public static async ValueTask SendCastleSiegeTaxChangeResponseAsync(this IConnection? connection, byte @result, byte @taxType, uint @taxRate) + { + if (connection is null) + { + return; + } + + int WritePacket() + { + var length = CastleSiegeTaxChangeResponseRef.Length; + var packet = new CastleSiegeTaxChangeResponseRef(connection.Output.GetSpan(length)[..length]); + packet.Result = @result; + packet.TaxType = @taxType; + packet.TaxRate = @taxRate; + + return packet.Header.Length; + } + + await connection.SendAsync(WritePacket).ConfigureAwait(false); + } + + /// + /// Sends a to this connection. + /// + /// The connection. + /// The result. + /// The money. + /// + /// Is sent by the server when: After the guild master requested to withdraw tax money from the castle treasury. + /// Causes reaction on client side: The client shows the result of the withdrawal and the withdrawn amount. + /// + public static async ValueTask SendCastleSiegeTributeWithdrawResponseAsync(this IConnection? connection, byte @result, ulong @money) + { + if (connection is null) + { + return; + } + + int WritePacket() + { + var length = CastleSiegeTributeWithdrawResponseRef.Length; + var packet = new CastleSiegeTributeWithdrawResponseRef(connection.Output.GetSpan(length)[..length]); + packet.Result = @result; + packet.Money = @money; + + return packet.Header.Length; + } + + await connection.SendAsync(WritePacket).ConfigureAwait(false); + } + + /// + /// Sends a to this connection. + /// + /// The connection. + /// 0 = defender, 1 = attacker, 2 = neutral + /// + /// Is sent by the server when: The server notifies the player of which siege side (attacker/defender) they are on. + /// Causes reaction on client side: The client updates the castle siege mini-map accordingly. + /// + public static async ValueTask SendCastleSiegeJoinSideNotificationAsync(this IConnection? connection, byte @side) + { + if (connection is null) + { + return; + } + + int WritePacket() + { + var length = CastleSiegeJoinSideNotificationRef.Length; + var packet = new CastleSiegeJoinSideNotificationRef(connection.Output.GetSpan(length)[..length]); + packet.Side = @side; + + return packet.Header.Length; + } + + await connection.SendAsync(WritePacket).ConfigureAwait(false); + } + + /// + /// Sends a to this connection. + /// + /// The connection. + /// The result. + /// The gate index. + /// + /// Is sent by the server when: After a guild member of the castle owner requested to toggle a castle gate. + /// Causes reaction on client side: The client shows the result of the gate toggle operation. + /// + public static async ValueTask SendCastleSiegeGateOperateResponseAsync(this IConnection? connection, byte @result, ushort @gateIndex) + { + if (connection is null) + { + return; + } + + int WritePacket() + { + var length = CastleSiegeGateOperateResponseRef.Length; + var packet = new CastleSiegeGateOperateResponseRef(connection.Output.GetSpan(length)[..length]); + packet.Result = @result; + packet.GateIndex = @gateIndex; + + return packet.Header.Length; + } + + await connection.SendAsync(WritePacket).ConfigureAwait(false); + } + + /// + /// Sends a to this connection. + /// + /// The connection. + /// 0 = locked, 1 = available + /// + /// Is sent by the server when: The server updates the state of the castle crown during the siege. + /// Causes reaction on client side: The client updates the crown state display. + /// + public static async ValueTask SendCastleSiegeCrownStateUpdateAsync(this IConnection? connection, byte @state) + { + if (connection is null) + { + return; + } + + int WritePacket() + { + var length = CastleSiegeCrownStateUpdateRef.Length; + var packet = new CastleSiegeCrownStateUpdateRef(connection.Output.GetSpan(length)[..length]); + packet.State = @state; + + return packet.Header.Length; + } + + await connection.SendAsync(WritePacket).ConfigureAwait(false); + } + + /// + /// Sends a to this connection. + /// + /// The connection. + /// The state. + /// The accumulated time ms. + /// + /// Is sent by the server when: The server updates the access state of the castle crown during the siege. + /// Causes reaction on client side: The client updates the crown access state and accumulated time display. + /// + public static async ValueTask SendCastleSiegeCrownAccessStateAsync(this IConnection? connection, byte @state, uint @accumulatedTimeMs) + { + if (connection is null) + { + return; + } + + int WritePacket() + { + var length = CastleSiegeCrownAccessStateRef.Length; + var packet = new CastleSiegeCrownAccessStateRef(connection.Output.GetSpan(length)[..length]); + packet.State = @state; + packet.AccumulatedTimeMs = @accumulatedTimeMs; + + return packet.Header.Length; + } + + await connection.SendAsync(WritePacket).ConfigureAwait(false); + } + + /// + /// Sends a to this connection. + /// + /// The connection. + /// The switch index. + /// The switch id. + /// The state. + /// The join side. + /// The guild name. + /// The user name. + /// + /// Is sent by the server when: The server sends information about a castle siege switch (e.g., life stone activation). + /// Causes reaction on client side: The client updates the switch state display. + /// + public static async ValueTask SendCastleSiegeSwitchInfoAsync(this IConnection? connection, ushort @switchIndex, byte @switchId, byte @state, byte @joinSide, string @guildName, string @userName) + { + if (connection is null) + { + return; + } + + int WritePacket() + { + var length = CastleSiegeSwitchInfoRef.Length; + var packet = new CastleSiegeSwitchInfoRef(connection.Output.GetSpan(length)[..length]); + packet.SwitchIndex = @switchIndex; + packet.SwitchId = @switchId; + packet.State = @state; + packet.JoinSide = @joinSide; + packet.GuildName = @guildName; + packet.UserName = @userName; + + return packet.Header.Length; + } + + await connection.SendAsync(WritePacket).ConfigureAwait(false); + } + + /// + /// Sends a to this connection. + /// + /// The connection. + /// The guild name. + /// + /// Is sent by the server when: The server notifies all players that the castle ownership has changed. + /// Causes reaction on client side: The client shows the new castle owner guild name. + /// + public static async ValueTask SendCastleSiegeOwnershipChangeNotificationAsync(this IConnection? connection, string @guildName) + { + if (connection is null) + { + return; + } + + int WritePacket() + { + var length = CastleSiegeOwnershipChangeNotificationRef.Length; + var packet = new CastleSiegeOwnershipChangeNotificationRef(connection.Output.GetSpan(length)[..length]); + packet.GuildName = @guildName; + + return packet.Header.Length; + } + + await connection.SendAsync(WritePacket).ConfigureAwait(false); + } + + /// + /// Sends a to this connection. + /// + /// The connection. + /// The is started. + /// + /// Is sent by the server when: The server notifies all players that the castle siege battle has started or ended. + /// Causes reaction on client side: The client updates the siege state accordingly. + /// + public static async ValueTask SendCastleSiegeBattleStartEndAsync(this IConnection? connection, bool @isStarted) + { + if (connection is null) + { + return; + } + + int WritePacket() + { + var length = CastleSiegeBattleStartEndRef.Length; + var packet = new CastleSiegeBattleStartEndRef(connection.Output.GetSpan(length)[..length]); + packet.IsStarted = @isStarted; + + return packet.Header.Length; + } + + await connection.SendAsync(WritePacket).ConfigureAwait(false); + } + + /// + /// Sends a to this connection. + /// + /// The connection. + /// The hour. + /// The minute. + /// + /// Is sent by the server when: The server sends the remaining siege time. + /// Causes reaction on client side: The client updates the remaining siege time display. + /// + public static async ValueTask SendCastleSiegeRemainingTimeAsync(this IConnection? connection, byte @hour, byte @minute) + { + if (connection is null) + { + return; + } + + int WritePacket() + { + var length = CastleSiegeRemainingTimeRef.Length; + var packet = new CastleSiegeRemainingTimeRef(connection.Output.GetSpan(length)[..length]); + packet.Hour = @hour; + packet.Minute = @minute; + + return packet.Header.Length; + } + + await connection.SendAsync(WritePacket).ConfigureAwait(false); + } + + /// + /// Sends a to this connection. + /// + /// The connection. + /// The gate index. + /// The state. + /// + /// Is sent by the server when: The server sends the current operation state of a castle gate. + /// Causes reaction on client side: The client updates the gate state display. + /// + public static async ValueTask SendCastleSiegeGateOperateStateAsync(this IConnection? connection, ushort @gateIndex, byte @state) + { + if (connection is null) + { + return; + } + + int WritePacket() + { + var length = CastleSiegeGateOperateStateRef.Length; + var packet = new CastleSiegeGateOperateStateRef(connection.Output.GetSpan(length)[..length]); + packet.GateIndex = @gateIndex; + packet.State = @state; + + return packet.Header.Length; + } + + await connection.SendAsync(WritePacket).ConfigureAwait(false); + } + + /// + /// Sends a to this connection. + /// + /// The connection. + /// The gate index. + /// The state. + /// + /// Is sent by the server when: The server sends the current state of a castle gate. + /// Causes reaction on client side: The client updates the gate state display. + /// + public static async ValueTask SendCastleSiegeGateStateAsync(this IConnection? connection, ushort @gateIndex, byte @state) + { + if (connection is null) + { + return; + } + + int WritePacket() + { + var length = CastleSiegeGateStateRef.Length; + var packet = new CastleSiegeGateStateRef(connection.Output.GetSpan(length)[..length]); + packet.GateIndex = @gateIndex; + packet.State = @state; + + return packet.Header.Length; + } + + await connection.SendAsync(WritePacket).ConfigureAwait(false); + } + + /// + /// Sends a to this connection. + /// + /// The connection. + /// The npc index. + /// The target x. + /// The target y. + /// + /// Is sent by the server when: After the player fired a siege machine (catapult). + /// Causes reaction on client side: The client shows the catapult animation toward the target area. + /// + public static async ValueTask SendCastleSiegeMachineUseResultAsync(this IConnection? connection, ushort @npcIndex, byte @targetX, byte @targetY) + { + if (connection is null) + { + return; + } + + int WritePacket() + { + var length = CastleSiegeMachineUseResultRef.Length; + var packet = new CastleSiegeMachineUseResultRef(connection.Output.GetSpan(length)[..length]); + packet.NpcIndex = @npcIndex; + packet.TargetX = @targetX; + packet.TargetY = @targetY; + + return packet.Header.Length; + } + + await connection.SendAsync(WritePacket).ConfigureAwait(false); + } + + /// + /// Sends a to this connection. + /// + /// The connection. + /// The target x. + /// The target y. + /// + /// Is sent by the server when: The server notifies the player of the impact region of a siege machine. + /// Causes reaction on client side: The client shows the impact area effect. + /// + public static async ValueTask SendCastleSiegeMachineRegionNotifyAsync(this IConnection? connection, byte @targetX, byte @targetY) + { + if (connection is null) + { + return; + } + + int WritePacket() + { + var length = CastleSiegeMachineRegionNotifyRef.Length; + var packet = new CastleSiegeMachineRegionNotifyRef(connection.Output.GetSpan(length)[..length]); + packet.TargetX = @targetX; + packet.TargetY = @targetY; + + return packet.Header.Length; + } + + await connection.SendAsync(WritePacket).ConfigureAwait(false); + } + + /// + /// Sends a to this connection. + /// + /// The connection. + /// The machine type. + /// + /// Is sent by the server when: The server sends the siege machine interface to a player who is operating the machine. + /// Causes reaction on client side: The client shows the siege machine operation interface. + /// + public static async ValueTask SendCastleSiegeMachineInterfaceAsync(this IConnection? connection, byte @machineType) + { + if (connection is null) + { + return; + } + + int WritePacket() + { + var length = CastleSiegeMachineInterfaceRef.Length; + var packet = new CastleSiegeMachineInterfaceRef(connection.Output.GetSpan(length)[..length]); + packet.MachineType = @machineType; + + return packet.Header.Length; + } + + await connection.SendAsync(WritePacket).ConfigureAwait(false); + } + + /// + /// Sends a to this connection. + /// + /// The connection. + /// The creation stage of the life stone (0 to 4). + /// + /// Is sent by the server when: The server sends the current state of the castle life stone. + /// Causes reaction on client side: The client updates the life stone state display. + /// + public static async ValueTask SendCastleSiegeLifeStoneStateAsync(this IConnection? connection, byte @state) + { + if (connection is null) + { + return; + } + + int WritePacket() + { + var length = CastleSiegeLifeStoneStateRef.Length; + var packet = new CastleSiegeLifeStoneStateRef(connection.Output.GetSpan(length)[..length]); + packet.State = @state; + + return packet.Header.Length; + } + + await connection.SendAsync(WritePacket).ConfigureAwait(false); + } + + /// + /// Sends a to this connection. + /// + /// The connection. + /// The logo. + /// + /// Is sent by the server when: After the client requested the guild logo of the current castle owner. + /// Causes reaction on client side: The client shows the castle owner guild logo. + /// + public static async ValueTask SendCastleOwnerLogoAsync(this IConnection? connection, Memory @logo) + { + if (connection is null) + { + return; + } + + int WritePacket() + { + var length = CastleOwnerLogoRef.Length; + var packet = new CastleOwnerLogoRef(connection.Output.GetSpan(length)[..length]); + @logo.Span.CopyTo(packet.Logo); + + return packet.Header.Length; + } + + await connection.SendAsync(WritePacket).ConfigureAwait(false); + } + + /// + /// Sends a to this connection. + /// + /// The connection. + /// The is enabled. + /// The tax rate. + /// + /// Is sent by the server when: The server sends information about the hunting zone guard configuration. + /// Causes reaction on client side: The client shows the hunting zone entrance configuration. + /// + public static async ValueTask SendHuntingZoneGuardInfoAsync(this IConnection? connection, bool @isEnabled, uint @taxRate) + { + if (connection is null) + { + return; + } + + int WritePacket() + { + var length = HuntingZoneGuardInfoRef.Length; + var packet = new HuntingZoneGuardInfoRef(connection.Output.GetSpan(length)[..length]); + packet.IsEnabled = @isEnabled; + packet.TaxRate = @taxRate; + + return packet.Header.Length; + } + + await connection.SendAsync(WritePacket).ConfigureAwait(false); + } + + /// + /// Sends a to this connection. + /// + /// The connection. + /// The result. + /// The relationship type. + /// The target guild id. + /// + /// Is sent by the server when: After a guild relationship change was processed by the server. + /// Causes reaction on client side: The client shows the result of the guild relationship change request. + /// + public static async ValueTask SendGuildRelationshipChangeResponseAsync(this IConnection? connection, byte @result, byte @relationshipType, uint @targetGuildId) + { + if (connection is null) + { + return; + } + + int WritePacket() + { + var length = GuildRelationshipChangeResponseRef.Length; + var packet = new GuildRelationshipChangeResponseRef(connection.Output.GetSpan(length)[..length]); + packet.Result = @result; + packet.RelationshipType = @relationshipType; + packet.TargetGuildId = @targetGuildId; + + return packet.Header.Length; + } + await connection.SendAsync(WritePacket).ConfigureAwait(false); }} \ No newline at end of file diff --git a/src/Network/Packets/ServerToClient/ServerToClientPackets.cs b/src/Network/Packets/ServerToClient/ServerToClientPackets.cs index d36adccad..1d2bd315a 100644 --- a/src/Network/Packets/ServerToClient/ServerToClientPackets.cs +++ b/src/Network/Packets/ServerToClient/ServerToClientPackets.cs @@ -30082,6 +30082,3819 @@ public MapEventState.Events Event /// The packet as byte span. public static implicit operator Memory(MapEventState packet) => packet._data; } + + +/// +/// Is sent by the server when: After the player requested the current castle siege status from a castle siege npc. +/// Causes reaction on client side: The client shows the castle siege status. +/// +public readonly struct CastleSiegeStatusResponse +{ + private readonly Memory _data; + + /// + /// Initializes a new instance of the struct. + /// + /// The underlying data. + public CastleSiegeStatusResponse(Memory data) + : this(data, true) + { + } + + /// + /// Initializes a new instance of the struct. + /// + /// The underlying data. + /// If set to true, the header data is automatically initialized and written to the underlying span. + private CastleSiegeStatusResponse(Memory data, bool initialize) + { + this._data = data; + if (initialize) + { + var header = this.Header; + header.Type = HeaderType; + header.Code = Code; + header.Length = (byte)Math.Min(data.Length, Length); + header.SubCode = SubCode; + } + } + + /// + /// Gets the header type of this data packet. + /// + public static byte HeaderType => 0xC1; + + /// + /// Gets the operation code of this data packet. + /// + public static byte Code => 0xB2; + + /// + /// Gets the operation sub-code of this data packet. + /// The is used as a grouping key. + /// + public static byte SubCode => 0x00; + + /// + /// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed. + /// + public static int Length => 46; + + /// + /// Gets the header of this packet. + /// + public C1HeaderWithSubCode Header => new (this._data); + + /// + /// Gets or sets the result. + /// + public byte Result + { + get => this._data.Span[4]; + set => this._data.Span[4] = value; + } + + /// + /// Gets or sets the state. + /// + public byte State + { + get => this._data.Span[5]; + set => this._data.Span[5] = value; + } + + /// + /// Gets or sets the start year. + /// + public ushort StartYear + { + get => ReadUInt16BigEndian(this._data.Span[6..]); + set => WriteUInt16BigEndian(this._data.Span[6..], value); + } + + /// + /// Gets or sets the start month. + /// + public byte StartMonth + { + get => this._data.Span[8]; + set => this._data.Span[8] = value; + } + + /// + /// Gets or sets the start day. + /// + public byte StartDay + { + get => this._data.Span[9]; + set => this._data.Span[9] = value; + } + + /// + /// Gets or sets the start hour. + /// + public byte StartHour + { + get => this._data.Span[10]; + set => this._data.Span[10] = value; + } + + /// + /// Gets or sets the start minute. + /// + public byte StartMinute + { + get => this._data.Span[11]; + set => this._data.Span[11] = value; + } + + /// + /// Gets or sets the end year. + /// + public ushort EndYear + { + get => ReadUInt16BigEndian(this._data.Span[12..]); + set => WriteUInt16BigEndian(this._data.Span[12..], value); + } + + /// + /// Gets or sets the end month. + /// + public byte EndMonth + { + get => this._data.Span[14]; + set => this._data.Span[14] = value; + } + + /// + /// Gets or sets the end day. + /// + public byte EndDay + { + get => this._data.Span[15]; + set => this._data.Span[15] = value; + } + + /// + /// Gets or sets the end hour. + /// + public byte EndHour + { + get => this._data.Span[16]; + set => this._data.Span[16] = value; + } + + /// + /// Gets or sets the end minute. + /// + public byte EndMinute + { + get => this._data.Span[17]; + set => this._data.Span[17] = value; + } + + /// + /// Gets or sets the siege start year. + /// + public ushort SiegeStartYear + { + get => ReadUInt16BigEndian(this._data.Span[18..]); + set => WriteUInt16BigEndian(this._data.Span[18..], value); + } + + /// + /// Gets or sets the siege start month. + /// + public byte SiegeStartMonth + { + get => this._data.Span[20]; + set => this._data.Span[20] = value; + } + + /// + /// Gets or sets the siege start day. + /// + public byte SiegeStartDay + { + get => this._data.Span[21]; + set => this._data.Span[21] = value; + } + + /// + /// Gets or sets the siege start hour. + /// + public byte SiegeStartHour + { + get => this._data.Span[22]; + set => this._data.Span[22] = value; + } + + /// + /// Gets or sets the siege start minute. + /// + public byte SiegeStartMinute + { + get => this._data.Span[23]; + set => this._data.Span[23] = value; + } + + /// + /// Gets or sets the guild name. + /// + public string GuildName + { + get => this._data.Span.ExtractString(24, 8, System.Text.Encoding.UTF8); + set => this._data.Slice(24, 8).Span.WriteString(value, System.Text.Encoding.UTF8); + } + + /// + /// Gets or sets the guild master name. + /// + public string GuildMasterName + { + get => this._data.Span.ExtractString(32, 10, System.Text.Encoding.UTF8); + set => this._data.Slice(32, 10).Span.WriteString(value, System.Text.Encoding.UTF8); + } + + /// + /// Gets or sets the remaining time. + /// + public uint RemainingTime + { + get => ReadUInt32BigEndian(this._data.Span[42..]); + set => WriteUInt32BigEndian(this._data.Span[42..], value); + } + + /// + /// Performs an implicit conversion from a Memory of bytes to a . + /// + /// The packet as span. + /// The packet as struct. + public static implicit operator CastleSiegeStatusResponse(Memory packet) => new (packet, false); + + /// + /// Performs an implicit conversion from to a Memory of bytes. + /// + /// The packet as struct. + /// The packet as byte span. + public static implicit operator Memory(CastleSiegeStatusResponse packet) => packet._data; +} + + +/// +/// Is sent by the server when: After the player requested to register his guild for the next castle siege. +/// Causes reaction on client side: The client shows the result of the registration attempt. +/// +public readonly struct CastleSiegeRegistrationResponse +{ + private readonly Memory _data; + + /// + /// Initializes a new instance of the struct. + /// + /// The underlying data. + public CastleSiegeRegistrationResponse(Memory data) + : this(data, true) + { + } + + /// + /// Initializes a new instance of the struct. + /// + /// The underlying data. + /// If set to true, the header data is automatically initialized and written to the underlying span. + private CastleSiegeRegistrationResponse(Memory data, bool initialize) + { + this._data = data; + if (initialize) + { + var header = this.Header; + header.Type = HeaderType; + header.Code = Code; + header.Length = (byte)Math.Min(data.Length, Length); + header.SubCode = SubCode; + } + } + + /// + /// Gets the header type of this data packet. + /// + public static byte HeaderType => 0xC1; + + /// + /// Gets the operation code of this data packet. + /// + public static byte Code => 0xB2; + + /// + /// Gets the operation sub-code of this data packet. + /// The is used as a grouping key. + /// + public static byte SubCode => 0x01; + + /// + /// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed. + /// + public static int Length => 13; + + /// + /// Gets the header of this packet. + /// + public C1HeaderWithSubCode Header => new (this._data); + + /// + /// Gets or sets the result. + /// + public byte Result + { + get => this._data.Span[4]; + set => this._data.Span[4] = value; + } + + /// + /// Gets or sets the guild name. + /// + public string GuildName + { + get => this._data.Span.ExtractString(5, 8, System.Text.Encoding.UTF8); + set => this._data.Slice(5, 8).Span.WriteString(value, System.Text.Encoding.UTF8); + } + + /// + /// Performs an implicit conversion from a Memory of bytes to a . + /// + /// The packet as span. + /// The packet as struct. + public static implicit operator CastleSiegeRegistrationResponse(Memory packet) => new (packet, false); + + /// + /// Performs an implicit conversion from to a Memory of bytes. + /// + /// The packet as struct. + /// The packet as byte span. + public static implicit operator Memory(CastleSiegeRegistrationResponse packet) => packet._data; +} + + +/// +/// Is sent by the server when: After the player requested to un-register his guild from the next castle siege. +/// Causes reaction on client side: The client shows the result of the un-registration attempt. +/// +public readonly struct CastleSiegeUnregisterResponse +{ + private readonly Memory _data; + + /// + /// Initializes a new instance of the struct. + /// + /// The underlying data. + public CastleSiegeUnregisterResponse(Memory data) + : this(data, true) + { + } + + /// + /// Initializes a new instance of the struct. + /// + /// The underlying data. + /// If set to true, the header data is automatically initialized and written to the underlying span. + private CastleSiegeUnregisterResponse(Memory data, bool initialize) + { + this._data = data; + if (initialize) + { + var header = this.Header; + header.Type = HeaderType; + header.Code = Code; + header.Length = (byte)Math.Min(data.Length, Length); + header.SubCode = SubCode; + } + } + + /// + /// Gets the header type of this data packet. + /// + public static byte HeaderType => 0xC1; + + /// + /// Gets the operation code of this data packet. + /// + public static byte Code => 0xB2; + + /// + /// Gets the operation sub-code of this data packet. + /// The is used as a grouping key. + /// + public static byte SubCode => 0x02; + + /// + /// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed. + /// + public static int Length => 5; + + /// + /// Gets the header of this packet. + /// + public C1HeaderWithSubCode Header => new (this._data); + + /// + /// Gets or sets the result. + /// + public byte Result + { + get => this._data.Span[4]; + set => this._data.Span[4] = value; + } + + /// + /// Performs an implicit conversion from a Memory of bytes to a . + /// + /// The packet as span. + /// The packet as struct. + public static implicit operator CastleSiegeUnregisterResponse(Memory packet) => new (packet, false); + + /// + /// Performs an implicit conversion from to a Memory of bytes. + /// + /// The packet as struct. + /// The packet as byte span. + public static implicit operator Memory(CastleSiegeUnregisterResponse packet) => packet._data; +} + + +/// +/// Is sent by the server when: After the player requested the current registration state of his guild. +/// Causes reaction on client side: The client shows the current registration state including the number of submitted guild marks. +/// +public readonly struct CastleSiegeRegistrationStateResponse +{ + private readonly Memory _data; + + /// + /// Initializes a new instance of the struct. + /// + /// The underlying data. + public CastleSiegeRegistrationStateResponse(Memory data) + : this(data, true) + { + } + + /// + /// Initializes a new instance of the struct. + /// + /// The underlying data. + /// If set to true, the header data is automatically initialized and written to the underlying span. + private CastleSiegeRegistrationStateResponse(Memory data, bool initialize) + { + this._data = data; + if (initialize) + { + var header = this.Header; + header.Type = HeaderType; + header.Code = Code; + header.Length = (byte)Math.Min(data.Length, Length); + header.SubCode = SubCode; + } + } + + /// + /// Gets the header type of this data packet. + /// + public static byte HeaderType => 0xC1; + + /// + /// Gets the operation code of this data packet. + /// + public static byte Code => 0xB2; + + /// + /// Gets the operation sub-code of this data packet. + /// The is used as a grouping key. + /// + public static byte SubCode => 0x03; + + /// + /// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed. + /// + public static int Length => 20; + + /// + /// Gets the header of this packet. + /// + public C1HeaderWithSubCode Header => new (this._data); + + /// + /// Gets or sets the guild name. + /// + public string GuildName + { + get => this._data.Span.ExtractString(4, 8, System.Text.Encoding.UTF8); + set => this._data.Slice(4, 8).Span.WriteString(value, System.Text.Encoding.UTF8); + } + + /// + /// Gets or sets the guild mark count. + /// + public uint GuildMarkCount + { + get => ReadUInt32BigEndian(this._data.Span[12..]); + set => WriteUInt32BigEndian(this._data.Span[12..], value); + } + + /// + /// Gets or sets the registration id. + /// + public uint RegistrationId + { + get => ReadUInt32BigEndian(this._data.Span[16..]); + set => WriteUInt32BigEndian(this._data.Span[16..], value); + } + + /// + /// Performs an implicit conversion from a Memory of bytes to a . + /// + /// The packet as span. + /// The packet as struct. + public static implicit operator CastleSiegeRegistrationStateResponse(Memory packet) => new (packet, false); + + /// + /// Performs an implicit conversion from to a Memory of bytes. + /// + /// The packet as struct. + /// The packet as byte span. + public static implicit operator Memory(CastleSiegeRegistrationStateResponse packet) => packet._data; +} + + +/// +/// Is sent by the server when: After the player submitted a guild mark for the castle siege registration. +/// Causes reaction on client side: The client shows the updated guild mark count. +/// +public readonly struct CastleSiegeMarkRegistrationResponse +{ + private readonly Memory _data; + + /// + /// Initializes a new instance of the struct. + /// + /// The underlying data. + public CastleSiegeMarkRegistrationResponse(Memory data) + : this(data, true) + { + } + + /// + /// Initializes a new instance of the struct. + /// + /// The underlying data. + /// If set to true, the header data is automatically initialized and written to the underlying span. + private CastleSiegeMarkRegistrationResponse(Memory data, bool initialize) + { + this._data = data; + if (initialize) + { + var header = this.Header; + header.Type = HeaderType; + header.Code = Code; + header.Length = (byte)Math.Min(data.Length, Length); + header.SubCode = SubCode; + } + } + + /// + /// Gets the header type of this data packet. + /// + public static byte HeaderType => 0xC1; + + /// + /// Gets the operation code of this data packet. + /// + public static byte Code => 0xB2; + + /// + /// Gets the operation sub-code of this data packet. + /// The is used as a grouping key. + /// + public static byte SubCode => 0x04; + + /// + /// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed. + /// + public static int Length => 17; + + /// + /// Gets the header of this packet. + /// + public C1HeaderWithSubCode Header => new (this._data); + + /// + /// Gets or sets the result. + /// + public byte Result + { + get => this._data.Span[4]; + set => this._data.Span[4] = value; + } + + /// + /// Gets or sets the guild name. + /// + public string GuildName + { + get => this._data.Span.ExtractString(5, 8, System.Text.Encoding.UTF8); + set => this._data.Slice(5, 8).Span.WriteString(value, System.Text.Encoding.UTF8); + } + + /// + /// Gets or sets the guild mark count. + /// + public uint GuildMarkCount + { + get => ReadUInt32BigEndian(this._data.Span[13..]); + set => WriteUInt32BigEndian(this._data.Span[13..], value); + } + + /// + /// Performs an implicit conversion from a Memory of bytes to a . + /// + /// The packet as span. + /// The packet as struct. + public static implicit operator CastleSiegeMarkRegistrationResponse(Memory packet) => new (packet, false); + + /// + /// Performs an implicit conversion from to a Memory of bytes. + /// + /// The packet as struct. + /// The packet as byte span. + public static implicit operator Memory(CastleSiegeMarkRegistrationResponse packet) => packet._data; +} + + +/// +/// Is sent by the server when: After the player requested to buy a castle siege defense structure (gate or statue). +/// Causes reaction on client side: The client shows the result of the buy request. +/// +public readonly struct CastleSiegeDefenseBuyResponse +{ + private readonly Memory _data; + + /// + /// Initializes a new instance of the struct. + /// + /// The underlying data. + public CastleSiegeDefenseBuyResponse(Memory data) + : this(data, true) + { + } + + /// + /// Initializes a new instance of the struct. + /// + /// The underlying data. + /// If set to true, the header data is automatically initialized and written to the underlying span. + private CastleSiegeDefenseBuyResponse(Memory data, bool initialize) + { + this._data = data; + if (initialize) + { + var header = this.Header; + header.Type = HeaderType; + header.Code = Code; + header.Length = (byte)Math.Min(data.Length, Length); + header.SubCode = SubCode; + } + } + + /// + /// Gets the header type of this data packet. + /// + public static byte HeaderType => 0xC1; + + /// + /// Gets the operation code of this data packet. + /// + public static byte Code => 0xB2; + + /// + /// Gets the operation sub-code of this data packet. + /// The is used as a grouping key. + /// + public static byte SubCode => 0x05; + + /// + /// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed. + /// + public static int Length => 13; + + /// + /// Gets the header of this packet. + /// + public C1HeaderWithSubCode Header => new (this._data); + + /// + /// Gets or sets the result. + /// + public byte Result + { + get => this._data.Span[4]; + set => this._data.Span[4] = value; + } + + /// + /// Gets or sets the npc number. + /// + public uint NpcNumber + { + get => ReadUInt32LittleEndian(this._data.Span[5..]); + set => WriteUInt32LittleEndian(this._data.Span[5..], value); + } + + /// + /// Gets or sets the npc index. + /// + public uint NpcIndex + { + get => ReadUInt32LittleEndian(this._data.Span[9..]); + set => WriteUInt32LittleEndian(this._data.Span[9..], value); + } + + /// + /// Performs an implicit conversion from a Memory of bytes to a . + /// + /// The packet as span. + /// The packet as struct. + public static implicit operator CastleSiegeDefenseBuyResponse(Memory packet) => new (packet, false); + + /// + /// Performs an implicit conversion from to a Memory of bytes. + /// + /// The packet as struct. + /// The packet as byte span. + public static implicit operator Memory(CastleSiegeDefenseBuyResponse packet) => packet._data; +} + + +/// +/// Is sent by the server when: After the player requested to repair a castle siege defense structure (gate or statue). +/// Causes reaction on client side: The client shows the result of the repair request. +/// +public readonly struct CastleSiegeDefenseRepairResponse +{ + private readonly Memory _data; + + /// + /// Initializes a new instance of the struct. + /// + /// The underlying data. + public CastleSiegeDefenseRepairResponse(Memory data) + : this(data, true) + { + } + + /// + /// Initializes a new instance of the struct. + /// + /// The underlying data. + /// If set to true, the header data is automatically initialized and written to the underlying span. + private CastleSiegeDefenseRepairResponse(Memory data, bool initialize) + { + this._data = data; + if (initialize) + { + var header = this.Header; + header.Type = HeaderType; + header.Code = Code; + header.Length = (byte)Math.Min(data.Length, Length); + header.SubCode = SubCode; + } + } + + /// + /// Gets the header type of this data packet. + /// + public static byte HeaderType => 0xC1; + + /// + /// Gets the operation code of this data packet. + /// + public static byte Code => 0xB2; + + /// + /// Gets the operation sub-code of this data packet. + /// The is used as a grouping key. + /// + public static byte SubCode => 0x06; + + /// + /// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed. + /// + public static int Length => 13; + + /// + /// Gets the header of this packet. + /// + public C1HeaderWithSubCode Header => new (this._data); + + /// + /// Gets or sets the result. + /// + public byte Result + { + get => this._data.Span[4]; + set => this._data.Span[4] = value; + } + + /// + /// Gets or sets the npc number. + /// + public uint NpcNumber + { + get => ReadUInt32LittleEndian(this._data.Span[5..]); + set => WriteUInt32LittleEndian(this._data.Span[5..], value); + } + + /// + /// Gets or sets the npc index. + /// + public uint NpcIndex + { + get => ReadUInt32LittleEndian(this._data.Span[9..]); + set => WriteUInt32LittleEndian(this._data.Span[9..], value); + } + + /// + /// Performs an implicit conversion from a Memory of bytes to a . + /// + /// The packet as span. + /// The packet as struct. + public static implicit operator CastleSiegeDefenseRepairResponse(Memory packet) => new (packet, false); + + /// + /// Performs an implicit conversion from to a Memory of bytes. + /// + /// The packet as struct. + /// The packet as byte span. + public static implicit operator Memory(CastleSiegeDefenseRepairResponse packet) => packet._data; +} + + +/// +/// Is sent by the server when: After the player requested to upgrade a castle siege defense structure (gate or statue). +/// Causes reaction on client side: The client shows the result of the upgrade request and the new upgrade values. +/// +public readonly struct CastleSiegeDefenseUpgradeResponse +{ + private readonly Memory _data; + + /// + /// Initializes a new instance of the struct. + /// + /// The underlying data. + public CastleSiegeDefenseUpgradeResponse(Memory data) + : this(data, true) + { + } + + /// + /// Initializes a new instance of the struct. + /// + /// The underlying data. + /// If set to true, the header data is automatically initialized and written to the underlying span. + private CastleSiegeDefenseUpgradeResponse(Memory data, bool initialize) + { + this._data = data; + if (initialize) + { + var header = this.Header; + header.Type = HeaderType; + header.Code = Code; + header.Length = (byte)Math.Min(data.Length, Length); + header.SubCode = SubCode; + } + } + + /// + /// Gets the header type of this data packet. + /// + public static byte HeaderType => 0xC1; + + /// + /// Gets the operation code of this data packet. + /// + public static byte Code => 0xB2; + + /// + /// Gets the operation sub-code of this data packet. + /// The is used as a grouping key. + /// + public static byte SubCode => 0x07; + + /// + /// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed. + /// + public static int Length => 21; + + /// + /// Gets the header of this packet. + /// + public C1HeaderWithSubCode Header => new (this._data); + + /// + /// Gets or sets the result. + /// + public byte Result + { + get => this._data.Span[4]; + set => this._data.Span[4] = value; + } + + /// + /// Gets or sets the npc number. + /// + public uint NpcNumber + { + get => ReadUInt32LittleEndian(this._data.Span[5..]); + set => WriteUInt32LittleEndian(this._data.Span[5..], value); + } + + /// + /// Gets or sets the npc index. + /// + public uint NpcIndex + { + get => ReadUInt32LittleEndian(this._data.Span[9..]); + set => WriteUInt32LittleEndian(this._data.Span[9..], value); + } + + /// + /// Gets or sets the npc upgrade type. + /// + public uint NpcUpgradeType + { + get => ReadUInt32LittleEndian(this._data.Span[13..]); + set => WriteUInt32LittleEndian(this._data.Span[13..], value); + } + + /// + /// Gets or sets the npc upgrade value. + /// + public uint NpcUpgradeValue + { + get => ReadUInt32LittleEndian(this._data.Span[17..]); + set => WriteUInt32LittleEndian(this._data.Span[17..], value); + } + + /// + /// Performs an implicit conversion from a Memory of bytes to a . + /// + /// The packet as span. + /// The packet as struct. + public static implicit operator CastleSiegeDefenseUpgradeResponse(Memory packet) => new (packet, false); + + /// + /// Performs an implicit conversion from to a Memory of bytes. + /// + /// The packet as struct. + /// The packet as byte span. + public static implicit operator Memory(CastleSiegeDefenseUpgradeResponse packet) => packet._data; +} + + +/// +/// Is sent by the server when: After the guild master opened the castle npc to manage the castle taxes. +/// Causes reaction on client side: The client shows the current tax configuration and treasury amount. +/// +public readonly struct CastleSiegeTaxInfoResponse +{ + private readonly Memory _data; + + /// + /// Initializes a new instance of the struct. + /// + /// The underlying data. + public CastleSiegeTaxInfoResponse(Memory data) + : this(data, true) + { + } + + /// + /// Initializes a new instance of the struct. + /// + /// The underlying data. + /// If set to true, the header data is automatically initialized and written to the underlying span. + private CastleSiegeTaxInfoResponse(Memory data, bool initialize) + { + this._data = data; + if (initialize) + { + var header = this.Header; + header.Type = HeaderType; + header.Code = Code; + header.Length = (byte)Math.Min(data.Length, Length); + header.SubCode = SubCode; + } + } + + /// + /// Gets the header type of this data packet. + /// + public static byte HeaderType => 0xC1; + + /// + /// Gets the operation code of this data packet. + /// + public static byte Code => 0xB2; + + /// + /// Gets the operation sub-code of this data packet. + /// The is used as a grouping key. + /// + public static byte SubCode => 0x08; + + /// + /// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed. + /// + public static int Length => 19; + + /// + /// Gets the header of this packet. + /// + public C1HeaderWithSubCode Header => new (this._data); + + /// + /// Gets or sets the tax rate chaos machine. + /// + public byte TaxRateChaosMachine + { + get => this._data.Span[4]; + set => this._data.Span[4] = value; + } + + /// + /// Gets or sets the tax rate normal. + /// + public byte TaxRateNormal + { + get => this._data.Span[5]; + set => this._data.Span[5] = value; + } + + /// + /// Gets or sets the tax rate land of trials. + /// + public uint TaxRateLandOfTrials + { + get => ReadUInt32BigEndian(this._data.Span[6..]); + set => WriteUInt32BigEndian(this._data.Span[6..], value); + } + + /// + /// Gets or sets the is public hunting allowed. + /// + public bool IsPublicHuntingAllowed + { + get => this._data.Span[10..].GetBoolean(); + set => this._data.Span[10..].SetBoolean(value); + } + + /// + /// Gets or sets the treasury. + /// + public ulong Treasury + { + get => ReadUInt64BigEndian(this._data.Span[11..]); + set => WriteUInt64BigEndian(this._data.Span[11..], value); + } + + /// + /// Performs an implicit conversion from a Memory of bytes to a . + /// + /// The packet as span. + /// The packet as struct. + public static implicit operator CastleSiegeTaxInfoResponse(Memory packet) => new (packet, false); + + /// + /// Performs an implicit conversion from to a Memory of bytes. + /// + /// The packet as struct. + /// The packet as byte span. + public static implicit operator Memory(CastleSiegeTaxInfoResponse packet) => packet._data; +} + + +/// +/// Is sent by the server when: After the guild master changed the tax rate. +/// Causes reaction on client side: The client shows the result of the tax rate change. +/// +public readonly struct CastleSiegeTaxChangeResponse +{ + private readonly Memory _data; + + /// + /// Initializes a new instance of the struct. + /// + /// The underlying data. + public CastleSiegeTaxChangeResponse(Memory data) + : this(data, true) + { + } + + /// + /// Initializes a new instance of the struct. + /// + /// The underlying data. + /// If set to true, the header data is automatically initialized and written to the underlying span. + private CastleSiegeTaxChangeResponse(Memory data, bool initialize) + { + this._data = data; + if (initialize) + { + var header = this.Header; + header.Type = HeaderType; + header.Code = Code; + header.Length = (byte)Math.Min(data.Length, Length); + header.SubCode = SubCode; + } + } + + /// + /// Gets the header type of this data packet. + /// + public static byte HeaderType => 0xC1; + + /// + /// Gets the operation code of this data packet. + /// + public static byte Code => 0xB2; + + /// + /// Gets the operation sub-code of this data packet. + /// The is used as a grouping key. + /// + public static byte SubCode => 0x09; + + /// + /// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed. + /// + public static int Length => 10; + + /// + /// Gets the header of this packet. + /// + public C1HeaderWithSubCode Header => new (this._data); + + /// + /// Gets or sets the result. + /// + public byte Result + { + get => this._data.Span[4]; + set => this._data.Span[4] = value; + } + + /// + /// Gets or sets the tax type. + /// + public byte TaxType + { + get => this._data.Span[5]; + set => this._data.Span[5] = value; + } + + /// + /// Gets or sets the tax rate. + /// + public uint TaxRate + { + get => ReadUInt32BigEndian(this._data.Span[6..]); + set => WriteUInt32BigEndian(this._data.Span[6..], value); + } + + /// + /// Performs an implicit conversion from a Memory of bytes to a . + /// + /// The packet as span. + /// The packet as struct. + public static implicit operator CastleSiegeTaxChangeResponse(Memory packet) => new (packet, false); + + /// + /// Performs an implicit conversion from to a Memory of bytes. + /// + /// The packet as struct. + /// The packet as byte span. + public static implicit operator Memory(CastleSiegeTaxChangeResponse packet) => packet._data; +} + + +/// +/// Is sent by the server when: After the guild master requested to withdraw tax money from the castle treasury. +/// Causes reaction on client side: The client shows the result of the withdrawal and the withdrawn amount. +/// +public readonly struct CastleSiegeTributeWithdrawResponse +{ + private readonly Memory _data; + + /// + /// Initializes a new instance of the struct. + /// + /// The underlying data. + public CastleSiegeTributeWithdrawResponse(Memory data) + : this(data, true) + { + } + + /// + /// Initializes a new instance of the struct. + /// + /// The underlying data. + /// If set to true, the header data is automatically initialized and written to the underlying span. + private CastleSiegeTributeWithdrawResponse(Memory data, bool initialize) + { + this._data = data; + if (initialize) + { + var header = this.Header; + header.Type = HeaderType; + header.Code = Code; + header.Length = (byte)Math.Min(data.Length, Length); + header.SubCode = SubCode; + } + } + + /// + /// Gets the header type of this data packet. + /// + public static byte HeaderType => 0xC1; + + /// + /// Gets the operation code of this data packet. + /// + public static byte Code => 0xB2; + + /// + /// Gets the operation sub-code of this data packet. + /// The is used as a grouping key. + /// + public static byte SubCode => 0x10; + + /// + /// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed. + /// + public static int Length => 13; + + /// + /// Gets the header of this packet. + /// + public C1HeaderWithSubCode Header => new (this._data); + + /// + /// Gets or sets the result. + /// + public byte Result + { + get => this._data.Span[4]; + set => this._data.Span[4] = value; + } + + /// + /// Gets or sets the money. + /// + public ulong Money + { + get => ReadUInt64BigEndian(this._data.Span[5..]); + set => WriteUInt64BigEndian(this._data.Span[5..], value); + } + + /// + /// Performs an implicit conversion from a Memory of bytes to a . + /// + /// The packet as span. + /// The packet as struct. + public static implicit operator CastleSiegeTributeWithdrawResponse(Memory packet) => new (packet, false); + + /// + /// Performs an implicit conversion from to a Memory of bytes. + /// + /// The packet as struct. + /// The packet as byte span. + public static implicit operator Memory(CastleSiegeTributeWithdrawResponse packet) => packet._data; +} + + +/// +/// Is sent by the server when: The server notifies the player of which siege side (attacker/defender) they are on. +/// Causes reaction on client side: The client updates the castle siege mini-map accordingly. +/// +public readonly struct CastleSiegeJoinSideNotification +{ + private readonly Memory _data; + + /// + /// Initializes a new instance of the struct. + /// + /// The underlying data. + public CastleSiegeJoinSideNotification(Memory data) + : this(data, true) + { + } + + /// + /// Initializes a new instance of the struct. + /// + /// The underlying data. + /// If set to true, the header data is automatically initialized and written to the underlying span. + private CastleSiegeJoinSideNotification(Memory data, bool initialize) + { + this._data = data; + if (initialize) + { + var header = this.Header; + header.Type = HeaderType; + header.Code = Code; + header.Length = (byte)Math.Min(data.Length, Length); + header.SubCode = SubCode; + } + } + + /// + /// Gets the header type of this data packet. + /// + public static byte HeaderType => 0xC1; + + /// + /// Gets the operation code of this data packet. + /// + public static byte Code => 0xB2; + + /// + /// Gets the operation sub-code of this data packet. + /// The is used as a grouping key. + /// + public static byte SubCode => 0x11; + + /// + /// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed. + /// + public static int Length => 5; + + /// + /// Gets the header of this packet. + /// + public C1HeaderWithSubCode Header => new (this._data); + + /// + /// Gets or sets 0 = defender, 1 = attacker, 2 = neutral + /// + public byte Side + { + get => this._data.Span[4]; + set => this._data.Span[4] = value; + } + + /// + /// Performs an implicit conversion from a Memory of bytes to a . + /// + /// The packet as span. + /// The packet as struct. + public static implicit operator CastleSiegeJoinSideNotification(Memory packet) => new (packet, false); + + /// + /// Performs an implicit conversion from to a Memory of bytes. + /// + /// The packet as struct. + /// The packet as byte span. + public static implicit operator Memory(CastleSiegeJoinSideNotification packet) => packet._data; +} + + +/// +/// Is sent by the server when: After a guild member of the castle owner requested to toggle a castle gate. +/// Causes reaction on client side: The client shows the result of the gate toggle operation. +/// +public readonly struct CastleSiegeGateOperateResponse +{ + private readonly Memory _data; + + /// + /// Initializes a new instance of the struct. + /// + /// The underlying data. + public CastleSiegeGateOperateResponse(Memory data) + : this(data, true) + { + } + + /// + /// Initializes a new instance of the struct. + /// + /// The underlying data. + /// If set to true, the header data is automatically initialized and written to the underlying span. + private CastleSiegeGateOperateResponse(Memory data, bool initialize) + { + this._data = data; + if (initialize) + { + var header = this.Header; + header.Type = HeaderType; + header.Code = Code; + header.Length = (byte)Math.Min(data.Length, Length); + header.SubCode = SubCode; + } + } + + /// + /// Gets the header type of this data packet. + /// + public static byte HeaderType => 0xC1; + + /// + /// Gets the operation code of this data packet. + /// + public static byte Code => 0xB2; + + /// + /// Gets the operation sub-code of this data packet. + /// The is used as a grouping key. + /// + public static byte SubCode => 0x12; + + /// + /// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed. + /// + public static int Length => 7; + + /// + /// Gets the header of this packet. + /// + public C1HeaderWithSubCode Header => new (this._data); + + /// + /// Gets or sets the result. + /// + public byte Result + { + get => this._data.Span[4]; + set => this._data.Span[4] = value; + } + + /// + /// Gets or sets the gate index. + /// + public ushort GateIndex + { + get => ReadUInt16BigEndian(this._data.Span[5..]); + set => WriteUInt16BigEndian(this._data.Span[5..], value); + } + + /// + /// Performs an implicit conversion from a Memory of bytes to a . + /// + /// The packet as span. + /// The packet as struct. + public static implicit operator CastleSiegeGateOperateResponse(Memory packet) => new (packet, false); + + /// + /// Performs an implicit conversion from to a Memory of bytes. + /// + /// The packet as struct. + /// The packet as byte span. + public static implicit operator Memory(CastleSiegeGateOperateResponse packet) => packet._data; +} + + +/// +/// Is sent by the server when: The server updates the state of the castle crown during the siege. +/// Causes reaction on client side: The client updates the crown state display. +/// +public readonly struct CastleSiegeCrownStateUpdate +{ + private readonly Memory _data; + + /// + /// Initializes a new instance of the struct. + /// + /// The underlying data. + public CastleSiegeCrownStateUpdate(Memory data) + : this(data, true) + { + } + + /// + /// Initializes a new instance of the struct. + /// + /// The underlying data. + /// If set to true, the header data is automatically initialized and written to the underlying span. + private CastleSiegeCrownStateUpdate(Memory data, bool initialize) + { + this._data = data; + if (initialize) + { + var header = this.Header; + header.Type = HeaderType; + header.Code = Code; + header.Length = (byte)Math.Min(data.Length, Length); + header.SubCode = SubCode; + } + } + + /// + /// Gets the header type of this data packet. + /// + public static byte HeaderType => 0xC1; + + /// + /// Gets the operation code of this data packet. + /// + public static byte Code => 0xB2; + + /// + /// Gets the operation sub-code of this data packet. + /// The is used as a grouping key. + /// + public static byte SubCode => 0x13; + + /// + /// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed. + /// + public static int Length => 5; + + /// + /// Gets the header of this packet. + /// + public C1HeaderWithSubCode Header => new (this._data); + + /// + /// Gets or sets 0 = locked, 1 = available + /// + public byte State + { + get => this._data.Span[4]; + set => this._data.Span[4] = value; + } + + /// + /// Performs an implicit conversion from a Memory of bytes to a . + /// + /// The packet as span. + /// The packet as struct. + public static implicit operator CastleSiegeCrownStateUpdate(Memory packet) => new (packet, false); + + /// + /// Performs an implicit conversion from to a Memory of bytes. + /// + /// The packet as struct. + /// The packet as byte span. + public static implicit operator Memory(CastleSiegeCrownStateUpdate packet) => packet._data; +} + + +/// +/// Is sent by the server when: The server updates the access state of the castle crown during the siege. +/// Causes reaction on client side: The client updates the crown access state and accumulated time display. +/// +public readonly struct CastleSiegeCrownAccessState +{ + private readonly Memory _data; + + /// + /// Initializes a new instance of the struct. + /// + /// The underlying data. + public CastleSiegeCrownAccessState(Memory data) + : this(data, true) + { + } + + /// + /// Initializes a new instance of the struct. + /// + /// The underlying data. + /// If set to true, the header data is automatically initialized and written to the underlying span. + private CastleSiegeCrownAccessState(Memory data, bool initialize) + { + this._data = data; + if (initialize) + { + var header = this.Header; + header.Type = HeaderType; + header.Code = Code; + header.Length = (byte)Math.Min(data.Length, Length); + header.SubCode = SubCode; + } + } + + /// + /// Gets the header type of this data packet. + /// + public static byte HeaderType => 0xC1; + + /// + /// Gets the operation code of this data packet. + /// + public static byte Code => 0xB2; + + /// + /// Gets the operation sub-code of this data packet. + /// The is used as a grouping key. + /// + public static byte SubCode => 0x14; + + /// + /// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed. + /// + public static int Length => 9; + + /// + /// Gets the header of this packet. + /// + public C1HeaderWithSubCode Header => new (this._data); + + /// + /// Gets or sets the state. + /// + public byte State + { + get => this._data.Span[4]; + set => this._data.Span[4] = value; + } + + /// + /// Gets or sets the accumulated time ms. + /// + public uint AccumulatedTimeMs + { + get => ReadUInt32BigEndian(this._data.Span[5..]); + set => WriteUInt32BigEndian(this._data.Span[5..], value); + } + + /// + /// Performs an implicit conversion from a Memory of bytes to a . + /// + /// The packet as span. + /// The packet as struct. + public static implicit operator CastleSiegeCrownAccessState(Memory packet) => new (packet, false); + + /// + /// Performs an implicit conversion from to a Memory of bytes. + /// + /// The packet as struct. + /// The packet as byte span. + public static implicit operator Memory(CastleSiegeCrownAccessState packet) => packet._data; +} + + +/// +/// Is sent by the server when: The server sends information about a castle siege switch (e.g., life stone activation). +/// Causes reaction on client side: The client updates the switch state display. +/// +public readonly struct CastleSiegeSwitchInfo +{ + private readonly Memory _data; + + /// + /// Initializes a new instance of the struct. + /// + /// The underlying data. + public CastleSiegeSwitchInfo(Memory data) + : this(data, true) + { + } + + /// + /// Initializes a new instance of the struct. + /// + /// The underlying data. + /// If set to true, the header data is automatically initialized and written to the underlying span. + private CastleSiegeSwitchInfo(Memory data, bool initialize) + { + this._data = data; + if (initialize) + { + var header = this.Header; + header.Type = HeaderType; + header.Code = Code; + header.Length = (byte)Math.Min(data.Length, Length); + header.SubCode = SubCode; + } + } + + /// + /// Gets the header type of this data packet. + /// + public static byte HeaderType => 0xC1; + + /// + /// Gets the operation code of this data packet. + /// + public static byte Code => 0xB2; + + /// + /// Gets the operation sub-code of this data packet. + /// The is used as a grouping key. + /// + public static byte SubCode => 0x15; + + /// + /// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed. + /// + public static int Length => 29; + + /// + /// Gets the header of this packet. + /// + public C1HeaderWithSubCode Header => new (this._data); + + /// + /// Gets or sets the switch index. + /// + public ushort SwitchIndex + { + get => ReadUInt16BigEndian(this._data.Span[4..]); + set => WriteUInt16BigEndian(this._data.Span[4..], value); + } + + /// + /// Gets or sets the switch id. + /// + public byte SwitchId + { + get => this._data.Span[6]; + set => this._data.Span[6] = value; + } + + /// + /// Gets or sets the state. + /// + public byte State + { + get => this._data.Span[7]; + set => this._data.Span[7] = value; + } + + /// + /// Gets or sets the join side. + /// + public byte JoinSide + { + get => this._data.Span[8]; + set => this._data.Span[8] = value; + } + + /// + /// Gets or sets the guild name. + /// + public string GuildName + { + get => this._data.Span.ExtractString(9, 9, System.Text.Encoding.UTF8); + set => this._data.Slice(9, 9).Span.WriteString(value, System.Text.Encoding.UTF8); + } + + /// + /// Gets or sets the user name. + /// + public string UserName + { + get => this._data.Span.ExtractString(18, 11, System.Text.Encoding.UTF8); + set => this._data.Slice(18, 11).Span.WriteString(value, System.Text.Encoding.UTF8); + } + + /// + /// Performs an implicit conversion from a Memory of bytes to a . + /// + /// The packet as span. + /// The packet as struct. + public static implicit operator CastleSiegeSwitchInfo(Memory packet) => new (packet, false); + + /// + /// Performs an implicit conversion from to a Memory of bytes. + /// + /// The packet as struct. + /// The packet as byte span. + public static implicit operator Memory(CastleSiegeSwitchInfo packet) => packet._data; +} + + +/// +/// Is sent by the server when: The server notifies all players that the castle ownership has changed. +/// Causes reaction on client side: The client shows the new castle owner guild name. +/// +public readonly struct CastleSiegeOwnershipChangeNotification +{ + private readonly Memory _data; + + /// + /// Initializes a new instance of the struct. + /// + /// The underlying data. + public CastleSiegeOwnershipChangeNotification(Memory data) + : this(data, true) + { + } + + /// + /// Initializes a new instance of the struct. + /// + /// The underlying data. + /// If set to true, the header data is automatically initialized and written to the underlying span. + private CastleSiegeOwnershipChangeNotification(Memory data, bool initialize) + { + this._data = data; + if (initialize) + { + var header = this.Header; + header.Type = HeaderType; + header.Code = Code; + header.Length = (byte)Math.Min(data.Length, Length); + header.SubCode = SubCode; + } + } + + /// + /// Gets the header type of this data packet. + /// + public static byte HeaderType => 0xC1; + + /// + /// Gets the operation code of this data packet. + /// + public static byte Code => 0xB2; + + /// + /// Gets the operation sub-code of this data packet. + /// The is used as a grouping key. + /// + public static byte SubCode => 0x16; + + /// + /// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed. + /// + public static int Length => 12; + + /// + /// Gets the header of this packet. + /// + public C1HeaderWithSubCode Header => new (this._data); + + /// + /// Gets or sets the guild name. + /// + public string GuildName + { + get => this._data.Span.ExtractString(4, 8, System.Text.Encoding.UTF8); + set => this._data.Slice(4, 8).Span.WriteString(value, System.Text.Encoding.UTF8); + } + + /// + /// Performs an implicit conversion from a Memory of bytes to a . + /// + /// The packet as span. + /// The packet as struct. + public static implicit operator CastleSiegeOwnershipChangeNotification(Memory packet) => new (packet, false); + + /// + /// Performs an implicit conversion from to a Memory of bytes. + /// + /// The packet as struct. + /// The packet as byte span. + public static implicit operator Memory(CastleSiegeOwnershipChangeNotification packet) => packet._data; +} + + +/// +/// Is sent by the server when: The server notifies all players that the castle siege battle has started or ended. +/// Causes reaction on client side: The client updates the siege state accordingly. +/// +public readonly struct CastleSiegeBattleStartEnd +{ + private readonly Memory _data; + + /// + /// Initializes a new instance of the struct. + /// + /// The underlying data. + public CastleSiegeBattleStartEnd(Memory data) + : this(data, true) + { + } + + /// + /// Initializes a new instance of the struct. + /// + /// The underlying data. + /// If set to true, the header data is automatically initialized and written to the underlying span. + private CastleSiegeBattleStartEnd(Memory data, bool initialize) + { + this._data = data; + if (initialize) + { + var header = this.Header; + header.Type = HeaderType; + header.Code = Code; + header.Length = (byte)Math.Min(data.Length, Length); + header.SubCode = SubCode; + } + } + + /// + /// Gets the header type of this data packet. + /// + public static byte HeaderType => 0xC1; + + /// + /// Gets the operation code of this data packet. + /// + public static byte Code => 0xB2; + + /// + /// Gets the operation sub-code of this data packet. + /// The is used as a grouping key. + /// + public static byte SubCode => 0x17; + + /// + /// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed. + /// + public static int Length => 5; + + /// + /// Gets the header of this packet. + /// + public C1HeaderWithSubCode Header => new (this._data); + + /// + /// Gets or sets the is started. + /// + public bool IsStarted + { + get => this._data.Span[4..].GetBoolean(); + set => this._data.Span[4..].SetBoolean(value); + } + + /// + /// Performs an implicit conversion from a Memory of bytes to a . + /// + /// The packet as span. + /// The packet as struct. + public static implicit operator CastleSiegeBattleStartEnd(Memory packet) => new (packet, false); + + /// + /// Performs an implicit conversion from to a Memory of bytes. + /// + /// The packet as struct. + /// The packet as byte span. + public static implicit operator Memory(CastleSiegeBattleStartEnd packet) => packet._data; +} + + +/// +/// Is sent by the server when: The server sends the remaining siege time. +/// Causes reaction on client side: The client updates the remaining siege time display. +/// +public readonly struct CastleSiegeRemainingTime +{ + private readonly Memory _data; + + /// + /// Initializes a new instance of the struct. + /// + /// The underlying data. + public CastleSiegeRemainingTime(Memory data) + : this(data, true) + { + } + + /// + /// Initializes a new instance of the struct. + /// + /// The underlying data. + /// If set to true, the header data is automatically initialized and written to the underlying span. + private CastleSiegeRemainingTime(Memory data, bool initialize) + { + this._data = data; + if (initialize) + { + var header = this.Header; + header.Type = HeaderType; + header.Code = Code; + header.Length = (byte)Math.Min(data.Length, Length); + header.SubCode = SubCode; + } + } + + /// + /// Gets the header type of this data packet. + /// + public static byte HeaderType => 0xC1; + + /// + /// Gets the operation code of this data packet. + /// + public static byte Code => 0xB2; + + /// + /// Gets the operation sub-code of this data packet. + /// The is used as a grouping key. + /// + public static byte SubCode => 0x18; + + /// + /// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed. + /// + public static int Length => 6; + + /// + /// Gets the header of this packet. + /// + public C1HeaderWithSubCode Header => new (this._data); + + /// + /// Gets or sets the hour. + /// + public byte Hour + { + get => this._data.Span[4]; + set => this._data.Span[4] = value; + } + + /// + /// Gets or sets the minute. + /// + public byte Minute + { + get => this._data.Span[5]; + set => this._data.Span[5] = value; + } + + /// + /// Performs an implicit conversion from a Memory of bytes to a . + /// + /// The packet as span. + /// The packet as struct. + public static implicit operator CastleSiegeRemainingTime(Memory packet) => new (packet, false); + + /// + /// Performs an implicit conversion from to a Memory of bytes. + /// + /// The packet as struct. + /// The packet as byte span. + public static implicit operator Memory(CastleSiegeRemainingTime packet) => packet._data; +} + + +/// +/// Is sent by the server when: The server sends the current operation state of a castle gate. +/// Causes reaction on client side: The client updates the gate state display. +/// +public readonly struct CastleSiegeGateOperateState +{ + private readonly Memory _data; + + /// + /// Initializes a new instance of the struct. + /// + /// The underlying data. + public CastleSiegeGateOperateState(Memory data) + : this(data, true) + { + } + + /// + /// Initializes a new instance of the struct. + /// + /// The underlying data. + /// If set to true, the header data is automatically initialized and written to the underlying span. + private CastleSiegeGateOperateState(Memory data, bool initialize) + { + this._data = data; + if (initialize) + { + var header = this.Header; + header.Type = HeaderType; + header.Code = Code; + header.Length = (byte)Math.Min(data.Length, Length); + header.SubCode = SubCode; + } + } + + /// + /// Gets the header type of this data packet. + /// + public static byte HeaderType => 0xC1; + + /// + /// Gets the operation code of this data packet. + /// + public static byte Code => 0xB2; + + /// + /// Gets the operation sub-code of this data packet. + /// The is used as a grouping key. + /// + public static byte SubCode => 0x19; + + /// + /// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed. + /// + public static int Length => 7; + + /// + /// Gets the header of this packet. + /// + public C1HeaderWithSubCode Header => new (this._data); + + /// + /// Gets or sets the gate index. + /// + public ushort GateIndex + { + get => ReadUInt16BigEndian(this._data.Span[4..]); + set => WriteUInt16BigEndian(this._data.Span[4..], value); + } + + /// + /// Gets or sets the state. + /// + public byte State + { + get => this._data.Span[6]; + set => this._data.Span[6] = value; + } + + /// + /// Performs an implicit conversion from a Memory of bytes to a . + /// + /// The packet as span. + /// The packet as struct. + public static implicit operator CastleSiegeGateOperateState(Memory packet) => new (packet, false); + + /// + /// Performs an implicit conversion from to a Memory of bytes. + /// + /// The packet as struct. + /// The packet as byte span. + public static implicit operator Memory(CastleSiegeGateOperateState packet) => packet._data; +} + + +/// +/// Is sent by the server when: The server sends the positions of all players in the castle siege mini map. +/// Causes reaction on client side: The client updates the mini map with the player positions. +/// +public readonly struct CastleSiegeMiniMapPlayerPositions +{ + private readonly Memory _data; + + /// + /// Initializes a new instance of the struct. + /// + /// The underlying data. + public CastleSiegeMiniMapPlayerPositions(Memory data) + : this(data, true) + { + } + + /// + /// Initializes a new instance of the struct. + /// + /// The underlying data. + /// If set to true, the header data is automatically initialized and written to the underlying span. + private CastleSiegeMiniMapPlayerPositions(Memory data, bool initialize) + { + this._data = data; + if (initialize) + { + var header = this.Header; + header.Type = HeaderType; + header.Code = Code; + header.Length = (ushort)data.Length; + header.SubCode = SubCode; + } + } + + /// + /// Gets the header type of this data packet. + /// + public static byte HeaderType => 0xC2; + + /// + /// Gets the operation code of this data packet. + /// + public static byte Code => 0xB2; + + /// + /// Gets the operation sub-code of this data packet. + /// The is used as a grouping key. + /// + public static byte SubCode => 0x1A; + + /// + /// Gets the header of this packet. + /// + public C2HeaderWithSubCode Header => new (this._data); + + /// + /// Gets or sets the player count. + /// + public uint PlayerCount + { + get => ReadUInt32BigEndian(this._data.Span[5..]); + set => WriteUInt32BigEndian(this._data.Span[5..], value); + } + + /// + /// Gets the of the specified index. + /// + public MiniMapPlayerPosition this[int index] => new (this._data.Slice(9 + index * MiniMapPlayerPosition.Length)); + + /// + /// Performs an implicit conversion from a Memory of bytes to a . + /// + /// The packet as span. + /// The packet as struct. + public static implicit operator CastleSiegeMiniMapPlayerPositions(Memory packet) => new (packet, false); + + /// + /// Performs an implicit conversion from to a Memory of bytes. + /// + /// The packet as struct. + /// The packet as byte span. + public static implicit operator Memory(CastleSiegeMiniMapPlayerPositions packet) => packet._data; + + /// + /// Calculates the size of the packet for the specified count of . + /// + /// The count of from which the size will be calculated. + + public static int GetRequiredSize(int playersCount) => playersCount * MiniMapPlayerPosition.Length + 9; + + +/// +/// The position of one player on the mini map.. +/// +public readonly struct MiniMapPlayerPosition +{ + private readonly Memory _data; + + /// + /// Initializes a new instance of the struct. + /// + /// The underlying data. + public MiniMapPlayerPosition(Memory data) + { + this._data = data; + } + + /// + /// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed. + /// + public static int Length => 2; + + /// + /// Gets or sets the position x. + /// + public byte PositionX + { + get => this._data.Span[0]; + set => this._data.Span[0] = value; + } + + /// + /// Gets or sets the position y. + /// + public byte PositionY + { + get => this._data.Span[1]; + set => this._data.Span[1] = value; + } +} +} + + +/// +/// Is sent by the server when: The server sends the positions of all siege NPCs in the castle siege mini map. +/// Causes reaction on client side: The client updates the mini map with the NPC positions. +/// +public readonly struct CastleSiegeMiniMapNpcPositions +{ + private readonly Memory _data; + + /// + /// Initializes a new instance of the struct. + /// + /// The underlying data. + public CastleSiegeMiniMapNpcPositions(Memory data) + : this(data, true) + { + } + + /// + /// Initializes a new instance of the struct. + /// + /// The underlying data. + /// If set to true, the header data is automatically initialized and written to the underlying span. + private CastleSiegeMiniMapNpcPositions(Memory data, bool initialize) + { + this._data = data; + if (initialize) + { + var header = this.Header; + header.Type = HeaderType; + header.Code = Code; + header.Length = (ushort)data.Length; + header.SubCode = SubCode; + } + } + + /// + /// Gets the header type of this data packet. + /// + public static byte HeaderType => 0xC2; + + /// + /// Gets the operation code of this data packet. + /// + public static byte Code => 0xB2; + + /// + /// Gets the operation sub-code of this data packet. + /// The is used as a grouping key. + /// + public static byte SubCode => 0x1B; + + /// + /// Gets the header of this packet. + /// + public C2HeaderWithSubCode Header => new (this._data); + + /// + /// Gets or sets the npc count. + /// + public uint NpcCount + { + get => ReadUInt32BigEndian(this._data.Span[5..]); + set => WriteUInt32BigEndian(this._data.Span[5..], value); + } + + /// + /// Gets the of the specified index. + /// + public MiniMapNpcPosition this[int index] => new (this._data.Slice(9 + index * MiniMapNpcPosition.Length)); + + /// + /// Performs an implicit conversion from a Memory of bytes to a . + /// + /// The packet as span. + /// The packet as struct. + public static implicit operator CastleSiegeMiniMapNpcPositions(Memory packet) => new (packet, false); + + /// + /// Performs an implicit conversion from to a Memory of bytes. + /// + /// The packet as struct. + /// The packet as byte span. + public static implicit operator Memory(CastleSiegeMiniMapNpcPositions packet) => packet._data; + + /// + /// Calculates the size of the packet for the specified count of . + /// + /// The count of from which the size will be calculated. + + public static int GetRequiredSize(int npcsCount) => npcsCount * MiniMapNpcPosition.Length + 9; + + +/// +/// The position of one NPC on the mini map.. +/// +public readonly struct MiniMapNpcPosition +{ + private readonly Memory _data; + + /// + /// Initializes a new instance of the struct. + /// + /// The underlying data. + public MiniMapNpcPosition(Memory data) + { + this._data = data; + } + + /// + /// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed. + /// + public static int Length => 3; + + /// + /// Gets or sets the npc type. + /// + public byte NpcType + { + get => this._data.Span[0]; + set => this._data.Span[0] = value; + } + + /// + /// Gets or sets the position x. + /// + public byte PositionX + { + get => this._data.Span[1]; + set => this._data.Span[1] = value; + } + + /// + /// Gets or sets the position y. + /// + public byte PositionY + { + get => this._data.Span[2]; + set => this._data.Span[2] = value; + } +} +} + + +/// +/// Is sent by the server when: The server sends the current state of a castle gate. +/// Causes reaction on client side: The client updates the gate state display. +/// +public readonly struct CastleSiegeGateState +{ + private readonly Memory _data; + + /// + /// Initializes a new instance of the struct. + /// + /// The underlying data. + public CastleSiegeGateState(Memory data) + : this(data, true) + { + } + + /// + /// Initializes a new instance of the struct. + /// + /// The underlying data. + /// If set to true, the header data is automatically initialized and written to the underlying span. + private CastleSiegeGateState(Memory data, bool initialize) + { + this._data = data; + if (initialize) + { + var header = this.Header; + header.Type = HeaderType; + header.Code = Code; + header.Length = (byte)Math.Min(data.Length, Length); + header.SubCode = SubCode; + } + } + + /// + /// Gets the header type of this data packet. + /// + public static byte HeaderType => 0xC1; + + /// + /// Gets the operation code of this data packet. + /// + public static byte Code => 0xB3; + + /// + /// Gets the operation sub-code of this data packet. + /// The is used as a grouping key. + /// + public static byte SubCode => 0x00; + + /// + /// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed. + /// + public static int Length => 7; + + /// + /// Gets the header of this packet. + /// + public C1HeaderWithSubCode Header => new (this._data); + + /// + /// Gets or sets the gate index. + /// + public ushort GateIndex + { + get => ReadUInt16BigEndian(this._data.Span[4..]); + set => WriteUInt16BigEndian(this._data.Span[4..], value); + } + + /// + /// Gets or sets the state. + /// + public byte State + { + get => this._data.Span[6]; + set => this._data.Span[6] = value; + } + + /// + /// Performs an implicit conversion from a Memory of bytes to a . + /// + /// The packet as span. + /// The packet as struct. + public static implicit operator CastleSiegeGateState(Memory packet) => new (packet, false); + + /// + /// Performs an implicit conversion from to a Memory of bytes. + /// + /// The packet as struct. + /// The packet as byte span. + public static implicit operator Memory(CastleSiegeGateState packet) => packet._data; +} + + +/// +/// Is sent by the server when: After the guild master requested the list of all castle siege statues and gates. +/// Causes reaction on client side: The client shows the list of castle siege NPCs with their current status. +/// +public readonly struct CastleSiegeNpcList +{ + private readonly Memory _data; + + /// + /// Initializes a new instance of the struct. + /// + /// The underlying data. + public CastleSiegeNpcList(Memory data) + : this(data, true) + { + } + + /// + /// Initializes a new instance of the struct. + /// + /// The underlying data. + /// If set to true, the header data is automatically initialized and written to the underlying span. + private CastleSiegeNpcList(Memory data, bool initialize) + { + this._data = data; + if (initialize) + { + var header = this.Header; + header.Type = HeaderType; + header.Code = Code; + header.Length = (ushort)data.Length; + header.SubCode = SubCode; + } + } + + /// + /// Gets the header type of this data packet. + /// + public static byte HeaderType => 0xC2; + + /// + /// Gets the operation code of this data packet. + /// + public static byte Code => 0xB3; + + /// + /// Gets the operation sub-code of this data packet. + /// The is used as a grouping key. + /// + public static byte SubCode => 0x02; + + /// + /// Gets the header of this packet. + /// + public C2HeaderWithSubCode Header => new (this._data); + + /// + /// Gets or sets the result. + /// + public byte Result + { + get => this._data.Span[5]; + set => this._data.Span[5] = value; + } + + /// + /// Gets or sets the npc count. + /// + public uint NpcCount + { + get => ReadUInt32BigEndian(this._data.Span[6..]); + set => WriteUInt32BigEndian(this._data.Span[6..], value); + } + + /// + /// Gets the of the specified index. + /// + public CastleSiegeNpcInfo this[int index] => new (this._data.Slice(10 + index * CastleSiegeNpcInfo.Length)); + + /// + /// Performs an implicit conversion from a Memory of bytes to a . + /// + /// The packet as span. + /// The packet as struct. + public static implicit operator CastleSiegeNpcList(Memory packet) => new (packet, false); + + /// + /// Performs an implicit conversion from to a Memory of bytes. + /// + /// The packet as struct. + /// The packet as byte span. + public static implicit operator Memory(CastleSiegeNpcList packet) => packet._data; + + /// + /// Calculates the size of the packet for the specified count of . + /// + /// The count of from which the size will be calculated. + + public static int GetRequiredSize(int npcListCount) => npcListCount * CastleSiegeNpcInfo.Length + 10; + + +/// +/// Information about one castle siege NPC (gate or statue).. +/// +public readonly struct CastleSiegeNpcInfo +{ + private readonly Memory _data; + + /// + /// Initializes a new instance of the struct. + /// + /// The underlying data. + public CastleSiegeNpcInfo(Memory data) + { + this._data = data; + } + + /// + /// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed. + /// + public static int Length => 21; + + /// + /// Gets or sets the npc number. + /// + public uint NpcNumber + { + get => ReadUInt32LittleEndian(this._data.Span); + set => WriteUInt32LittleEndian(this._data.Span, value); + } + + /// + /// Gets or sets the npc index. + /// + public uint NpcIndex + { + get => ReadUInt32LittleEndian(this._data.Span[4..]); + set => WriteUInt32LittleEndian(this._data.Span[4..], value); + } + + /// + /// Gets or sets the defense upgrade level. + /// + public byte DefenseUpgradeLevel + { + get => this._data.Span[8]; + set => this._data.Span[8] = value; + } + + /// + /// Gets or sets the regeneration level. + /// + public byte RegenerationLevel + { + get => this._data.Span[9]; + set => this._data.Span[9] = value; + } + + /// + /// Gets or sets the max hp. + /// + public uint MaxHp + { + get => ReadUInt32LittleEndian(this._data.Span[10..]); + set => WriteUInt32LittleEndian(this._data.Span[10..], value); + } + + /// + /// Gets or sets the current hp. + /// + public uint CurrentHp + { + get => ReadUInt32LittleEndian(this._data.Span[14..]); + set => WriteUInt32LittleEndian(this._data.Span[14..], value); + } + + /// + /// Gets or sets the position x. + /// + public byte PositionX + { + get => this._data.Span[18]; + set => this._data.Span[18] = value; + } + + /// + /// Gets or sets the position y. + /// + public byte PositionY + { + get => this._data.Span[19]; + set => this._data.Span[19] = value; + } + + /// + /// Gets or sets the is alive. + /// + public bool IsAlive + { + get => this._data.Span[20..].GetBoolean(); + set => this._data.Span[20..].SetBoolean(value); + } +} +} + + +/// +/// Is sent by the server when: After the guild master requested the list of guilds registered for the next siege. +/// Causes reaction on client side: The client shows the list of registered guilds and their mark counts. +/// +public readonly struct CastleSiegeRegisteredGuildList +{ + private readonly Memory _data; + + /// + /// Initializes a new instance of the struct. + /// + /// The underlying data. + public CastleSiegeRegisteredGuildList(Memory data) + : this(data, true) + { + } + + /// + /// Initializes a new instance of the struct. + /// + /// The underlying data. + /// If set to true, the header data is automatically initialized and written to the underlying span. + private CastleSiegeRegisteredGuildList(Memory data, bool initialize) + { + this._data = data; + if (initialize) + { + var header = this.Header; + header.Type = HeaderType; + header.Code = Code; + header.Length = (ushort)data.Length; + } + } + + /// + /// Gets the header type of this data packet. + /// + public static byte HeaderType => 0xC2; + + /// + /// Gets the operation code of this data packet. + /// + public static byte Code => 0xB4; + + /// + /// Gets the header of this packet. + /// + public C2Header Header => new (this._data); + + /// + /// Gets or sets the guild count. + /// + public uint GuildCount + { + get => ReadUInt32BigEndian(this._data.Span[4..]); + set => WriteUInt32BigEndian(this._data.Span[4..], value); + } + + /// + /// Gets the of the specified index. + /// + public RegisteredGuildEntry this[int index] => new (this._data.Slice(8 + index * RegisteredGuildEntry.Length)); + + /// + /// Performs an implicit conversion from a Memory of bytes to a . + /// + /// The packet as span. + /// The packet as struct. + public static implicit operator CastleSiegeRegisteredGuildList(Memory packet) => new (packet, false); + + /// + /// Performs an implicit conversion from to a Memory of bytes. + /// + /// The packet as struct. + /// The packet as byte span. + public static implicit operator Memory(CastleSiegeRegisteredGuildList packet) => packet._data; + + /// + /// Calculates the size of the packet for the specified count of . + /// + /// The count of from which the size will be calculated. + + public static int GetRequiredSize(int guildsCount) => guildsCount * RegisteredGuildEntry.Length + 8; + + +/// +/// Information about one guild registered for the next castle siege.. +/// +public readonly struct RegisteredGuildEntry +{ + private readonly Memory _data; + + /// + /// Initializes a new instance of the struct. + /// + /// The underlying data. + public RegisteredGuildEntry(Memory data) + { + this._data = data; + } + + /// + /// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed. + /// + public static int Length => 17; + + /// + /// Gets or sets the guild name. + /// + public string GuildName + { + get => this._data.Span.ExtractString(0, 8, System.Text.Encoding.UTF8); + set => this._data.Slice(0, 8).Span.WriteString(value, System.Text.Encoding.UTF8); + } + + /// + /// Gets or sets the guild mark count. + /// + public uint GuildMarkCount + { + get => ReadUInt32BigEndian(this._data.Span[8..]); + set => WriteUInt32BigEndian(this._data.Span[8..], value); + } + + /// + /// Gets or sets the registration id. + /// + public uint RegistrationId + { + get => ReadUInt32BigEndian(this._data.Span[12..]); + set => WriteUInt32BigEndian(this._data.Span[12..], value); + } + + /// + /// Gets or sets the is castle owner. + /// + public bool IsCastleOwner + { + get => this._data.Span[16..].GetBoolean(); + set => this._data.Span[16..].SetBoolean(value); + } +} +} + + +/// +/// Is sent by the server when: After the guild master requested the list of all guilds in the current castle siege. +/// Causes reaction on client side: The client shows the list of guilds participating in the castle siege. +/// +public readonly struct CastleSiegeGuildList +{ + private readonly Memory _data; + + /// + /// Initializes a new instance of the struct. + /// + /// The underlying data. + public CastleSiegeGuildList(Memory data) + : this(data, true) + { + } + + /// + /// Initializes a new instance of the struct. + /// + /// The underlying data. + /// If set to true, the header data is automatically initialized and written to the underlying span. + private CastleSiegeGuildList(Memory data, bool initialize) + { + this._data = data; + if (initialize) + { + var header = this.Header; + header.Type = HeaderType; + header.Code = Code; + header.Length = (ushort)data.Length; + } + } + + /// + /// Gets the header type of this data packet. + /// + public static byte HeaderType => 0xC2; + + /// + /// Gets the operation code of this data packet. + /// + public static byte Code => 0xB5; + + /// + /// Gets the header of this packet. + /// + public C2Header Header => new (this._data); + + /// + /// Gets or sets the result. + /// + public byte Result + { + get => this._data.Span[4]; + set => this._data.Span[4] = value; + } + + /// + /// Gets or sets the guild count. + /// + public uint GuildCount + { + get => ReadUInt32BigEndian(this._data.Span[5..]); + set => WriteUInt32BigEndian(this._data.Span[5..], value); + } + + /// + /// Gets the of the specified index. + /// + public CastleSiegeGuildEntry this[int index] => new (this._data.Slice(9 + index * CastleSiegeGuildEntry.Length)); + + /// + /// Performs an implicit conversion from a Memory of bytes to a . + /// + /// The packet as span. + /// The packet as struct. + public static implicit operator CastleSiegeGuildList(Memory packet) => new (packet, false); + + /// + /// Performs an implicit conversion from to a Memory of bytes. + /// + /// The packet as struct. + /// The packet as byte span. + public static implicit operator Memory(CastleSiegeGuildList packet) => packet._data; + + /// + /// Calculates the size of the packet for the specified count of . + /// + /// The count of from which the size will be calculated. + + public static int GetRequiredSize(int guildsCount) => guildsCount * CastleSiegeGuildEntry.Length + 9; + + +/// +/// Information about one guild in the castle siege.. +/// +public readonly struct CastleSiegeGuildEntry +{ + private readonly Memory _data; + + /// + /// Initializes a new instance of the struct. + /// + /// The underlying data. + public CastleSiegeGuildEntry(Memory data) + { + this._data = data; + } + + /// + /// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed. + /// + public static int Length => 14; + + /// + /// Gets or sets 0 = defender, 1 = attacker + /// + public byte Side + { + get => this._data.Span[0]; + set => this._data.Span[0] = value; + } + + /// + /// Gets or sets the is involved. + /// + public bool IsInvolved + { + get => this._data.Span[1..].GetBoolean(); + set => this._data.Span[1..].SetBoolean(value); + } + + /// + /// Gets or sets the guild name. + /// + public string GuildName + { + get => this._data.Span.ExtractString(2, 8, System.Text.Encoding.UTF8); + set => this._data.Slice(2, 8).Span.WriteString(value, System.Text.Encoding.UTF8); + } + + /// + /// Gets or sets the score. + /// + public uint Score + { + get => ReadUInt32BigEndian(this._data.Span[10..]); + set => WriteUInt32BigEndian(this._data.Span[10..], value); + } +} +} + + +/// +/// Is sent by the server when: After the player fired a siege machine (catapult). +/// Causes reaction on client side: The client shows the catapult animation toward the target area. +/// +public readonly struct CastleSiegeMachineUseResult +{ + private readonly Memory _data; + + /// + /// Initializes a new instance of the struct. + /// + /// The underlying data. + public CastleSiegeMachineUseResult(Memory data) + : this(data, true) + { + } + + /// + /// Initializes a new instance of the struct. + /// + /// The underlying data. + /// If set to true, the header data is automatically initialized and written to the underlying span. + private CastleSiegeMachineUseResult(Memory data, bool initialize) + { + this._data = data; + if (initialize) + { + var header = this.Header; + header.Type = HeaderType; + header.Code = Code; + header.Length = (byte)Math.Min(data.Length, Length); + header.SubCode = SubCode; + } + } + + /// + /// Gets the header type of this data packet. + /// + public static byte HeaderType => 0xC1; + + /// + /// Gets the operation code of this data packet. + /// + public static byte Code => 0xB7; + + /// + /// Gets the operation sub-code of this data packet. + /// The is used as a grouping key. + /// + public static byte SubCode => 0x01; + + /// + /// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed. + /// + public static int Length => 8; + + /// + /// Gets the header of this packet. + /// + public C1HeaderWithSubCode Header => new (this._data); + + /// + /// Gets or sets the npc index. + /// + public ushort NpcIndex + { + get => ReadUInt16BigEndian(this._data.Span[4..]); + set => WriteUInt16BigEndian(this._data.Span[4..], value); + } + + /// + /// Gets or sets the target x. + /// + public byte TargetX + { + get => this._data.Span[6]; + set => this._data.Span[6] = value; + } + + /// + /// Gets or sets the target y. + /// + public byte TargetY + { + get => this._data.Span[7]; + set => this._data.Span[7] = value; + } + + /// + /// Performs an implicit conversion from a Memory of bytes to a . + /// + /// The packet as span. + /// The packet as struct. + public static implicit operator CastleSiegeMachineUseResult(Memory packet) => new (packet, false); + + /// + /// Performs an implicit conversion from to a Memory of bytes. + /// + /// The packet as struct. + /// The packet as byte span. + public static implicit operator Memory(CastleSiegeMachineUseResult packet) => packet._data; +} + + +/// +/// Is sent by the server when: The server notifies the player of the impact region of a siege machine. +/// Causes reaction on client side: The client shows the impact area effect. +/// +public readonly struct CastleSiegeMachineRegionNotify +{ + private readonly Memory _data; + + /// + /// Initializes a new instance of the struct. + /// + /// The underlying data. + public CastleSiegeMachineRegionNotify(Memory data) + : this(data, true) + { + } + + /// + /// Initializes a new instance of the struct. + /// + /// The underlying data. + /// If set to true, the header data is automatically initialized and written to the underlying span. + private CastleSiegeMachineRegionNotify(Memory data, bool initialize) + { + this._data = data; + if (initialize) + { + var header = this.Header; + header.Type = HeaderType; + header.Code = Code; + header.Length = (byte)Math.Min(data.Length, Length); + header.SubCode = SubCode; + } + } + + /// + /// Gets the header type of this data packet. + /// + public static byte HeaderType => 0xC1; + + /// + /// Gets the operation code of this data packet. + /// + public static byte Code => 0xB7; + + /// + /// Gets the operation sub-code of this data packet. + /// The is used as a grouping key. + /// + public static byte SubCode => 0x02; + + /// + /// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed. + /// + public static int Length => 6; + + /// + /// Gets the header of this packet. + /// + public C1HeaderWithSubCode Header => new (this._data); + + /// + /// Gets or sets the target x. + /// + public byte TargetX + { + get => this._data.Span[4]; + set => this._data.Span[4] = value; + } + + /// + /// Gets or sets the target y. + /// + public byte TargetY + { + get => this._data.Span[5]; + set => this._data.Span[5] = value; + } + + /// + /// Performs an implicit conversion from a Memory of bytes to a . + /// + /// The packet as span. + /// The packet as struct. + public static implicit operator CastleSiegeMachineRegionNotify(Memory packet) => new (packet, false); + + /// + /// Performs an implicit conversion from to a Memory of bytes. + /// + /// The packet as struct. + /// The packet as byte span. + public static implicit operator Memory(CastleSiegeMachineRegionNotify packet) => packet._data; +} + + +/// +/// Is sent by the server when: The server sends the siege machine interface to a player who is operating the machine. +/// Causes reaction on client side: The client shows the siege machine operation interface. +/// +public readonly struct CastleSiegeMachineInterface +{ + private readonly Memory _data; + + /// + /// Initializes a new instance of the struct. + /// + /// The underlying data. + public CastleSiegeMachineInterface(Memory data) + : this(data, true) + { + } + + /// + /// Initializes a new instance of the struct. + /// + /// The underlying data. + /// If set to true, the header data is automatically initialized and written to the underlying span. + private CastleSiegeMachineInterface(Memory data, bool initialize) + { + this._data = data; + if (initialize) + { + var header = this.Header; + header.Type = HeaderType; + header.Code = Code; + header.Length = (byte)Math.Min(data.Length, Length); + header.SubCode = SubCode; + } + } + + /// + /// Gets the header type of this data packet. + /// + public static byte HeaderType => 0xC1; + + /// + /// Gets the operation code of this data packet. + /// + public static byte Code => 0xB7; + + /// + /// Gets the operation sub-code of this data packet. + /// The is used as a grouping key. + /// + public static byte SubCode => 0x03; + + /// + /// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed. + /// + public static int Length => 5; + + /// + /// Gets the header of this packet. + /// + public C1HeaderWithSubCode Header => new (this._data); + + /// + /// Gets or sets the machine type. + /// + public byte MachineType + { + get => this._data.Span[4]; + set => this._data.Span[4] = value; + } + + /// + /// Performs an implicit conversion from a Memory of bytes to a . + /// + /// The packet as span. + /// The packet as struct. + public static implicit operator CastleSiegeMachineInterface(Memory packet) => new (packet, false); + + /// + /// Performs an implicit conversion from to a Memory of bytes. + /// + /// The packet as struct. + /// The packet as byte span. + public static implicit operator Memory(CastleSiegeMachineInterface packet) => packet._data; +} + + +/// +/// Is sent by the server when: The server sends the current state of the castle life stone. +/// Causes reaction on client side: The client updates the life stone state display. +/// +public readonly struct CastleSiegeLifeStoneState +{ + private readonly Memory _data; + + /// + /// Initializes a new instance of the struct. + /// + /// The underlying data. + public CastleSiegeLifeStoneState(Memory data) + : this(data, true) + { + } + + /// + /// Initializes a new instance of the struct. + /// + /// The underlying data. + /// If set to true, the header data is automatically initialized and written to the underlying span. + private CastleSiegeLifeStoneState(Memory data, bool initialize) + { + this._data = data; + if (initialize) + { + var header = this.Header; + header.Type = HeaderType; + header.Code = Code; + header.Length = (byte)Math.Min(data.Length, Length); + header.SubCode = SubCode; + } + } + + /// + /// Gets the header type of this data packet. + /// + public static byte HeaderType => 0xC1; + + /// + /// Gets the operation code of this data packet. + /// + public static byte Code => 0xB7; + + /// + /// Gets the operation sub-code of this data packet. + /// The is used as a grouping key. + /// + public static byte SubCode => 0x05; + + /// + /// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed. + /// + public static int Length => 5; + + /// + /// Gets the header of this packet. + /// + public C1HeaderWithSubCode Header => new (this._data); + + /// + /// Gets or sets the creation stage of the life stone (0 to 4). + /// + public byte State + { + get => this._data.Span[4]; + set => this._data.Span[4] = value; + } + + /// + /// Performs an implicit conversion from a Memory of bytes to a . + /// + /// The packet as span. + /// The packet as struct. + public static implicit operator CastleSiegeLifeStoneState(Memory packet) => new (packet, false); + + /// + /// Performs an implicit conversion from to a Memory of bytes. + /// + /// The packet as struct. + /// The packet as byte span. + public static implicit operator Memory(CastleSiegeLifeStoneState packet) => packet._data; +} + + +/// +/// Is sent by the server when: After the client requested the guild logo of the current castle owner. +/// Causes reaction on client side: The client shows the castle owner guild logo. +/// +public readonly struct CastleOwnerLogo +{ + private readonly Memory _data; + + /// + /// Initializes a new instance of the struct. + /// + /// The underlying data. + public CastleOwnerLogo(Memory data) + : this(data, true) + { + } + + /// + /// Initializes a new instance of the struct. + /// + /// The underlying data. + /// If set to true, the header data is automatically initialized and written to the underlying span. + private CastleOwnerLogo(Memory data, bool initialize) + { + this._data = data; + if (initialize) + { + var header = this.Header; + header.Type = HeaderType; + header.Code = Code; + header.Length = (byte)Math.Min(data.Length, Length); + header.SubCode = SubCode; + } + } + + /// + /// Gets the header type of this data packet. + /// + public static byte HeaderType => 0xC1; + + /// + /// Gets the operation code of this data packet. + /// + public static byte Code => 0xB9; + + /// + /// Gets the operation sub-code of this data packet. + /// The is used as a grouping key. + /// + public static byte SubCode => 0x02; + + /// + /// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed. + /// + public static int Length => 36; + + /// + /// Gets the header of this packet. + /// + public C1HeaderWithSubCode Header => new (this._data); + + /// + /// Gets or sets the logo. + /// + public Span Logo + { + get => this._data.Slice(4, 32).Span; + } + + /// + /// Performs an implicit conversion from a Memory of bytes to a . + /// + /// The packet as span. + /// The packet as struct. + public static implicit operator CastleOwnerLogo(Memory packet) => new (packet, false); + + /// + /// Performs an implicit conversion from to a Memory of bytes. + /// + /// The packet as struct. + /// The packet as byte span. + public static implicit operator Memory(CastleOwnerLogo packet) => packet._data; +} + + +/// +/// Is sent by the server when: The server sends information about the hunting zone guard configuration. +/// Causes reaction on client side: The client shows the hunting zone entrance configuration. +/// +public readonly struct HuntingZoneGuardInfo +{ + private readonly Memory _data; + + /// + /// Initializes a new instance of the struct. + /// + /// The underlying data. + public HuntingZoneGuardInfo(Memory data) + : this(data, true) + { + } + + /// + /// Initializes a new instance of the struct. + /// + /// The underlying data. + /// If set to true, the header data is automatically initialized and written to the underlying span. + private HuntingZoneGuardInfo(Memory data, bool initialize) + { + this._data = data; + if (initialize) + { + var header = this.Header; + header.Type = HeaderType; + header.Code = Code; + header.Length = (byte)Math.Min(data.Length, Length); + header.SubCode = SubCode; + } + } + + /// + /// Gets the header type of this data packet. + /// + public static byte HeaderType => 0xC1; + + /// + /// Gets the operation code of this data packet. + /// + public static byte Code => 0xB9; + + /// + /// Gets the operation sub-code of this data packet. + /// The is used as a grouping key. + /// + public static byte SubCode => 0x03; + + /// + /// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed. + /// + public static int Length => 9; + + /// + /// Gets the header of this packet. + /// + public C1HeaderWithSubCode Header => new (this._data); + + /// + /// Gets or sets the is enabled. + /// + public bool IsEnabled + { + get => this._data.Span[4..].GetBoolean(); + set => this._data.Span[4..].SetBoolean(value); + } + + /// + /// Gets or sets the tax rate. + /// + public uint TaxRate + { + get => ReadUInt32BigEndian(this._data.Span[5..]); + set => WriteUInt32BigEndian(this._data.Span[5..], value); + } + + /// + /// Performs an implicit conversion from a Memory of bytes to a . + /// + /// The packet as span. + /// The packet as struct. + public static implicit operator HuntingZoneGuardInfo(Memory packet) => new (packet, false); + + /// + /// Performs an implicit conversion from to a Memory of bytes. + /// + /// The packet as struct. + /// The packet as byte span. + public static implicit operator Memory(HuntingZoneGuardInfo packet) => packet._data; +} + + +/// +/// Is sent by the server when: After a guild relationship change was processed by the server. +/// Causes reaction on client side: The client shows the result of the guild relationship change request. +/// +public readonly struct GuildRelationshipChangeResponse +{ + private readonly Memory _data; + + /// + /// Initializes a new instance of the struct. + /// + /// The underlying data. + public GuildRelationshipChangeResponse(Memory data) + : this(data, true) + { + } + + /// + /// Initializes a new instance of the struct. + /// + /// The underlying data. + /// If set to true, the header data is automatically initialized and written to the underlying span. + private GuildRelationshipChangeResponse(Memory data, bool initialize) + { + this._data = data; + if (initialize) + { + var header = this.Header; + header.Type = HeaderType; + header.Code = Code; + header.Length = (byte)Math.Min(data.Length, Length); + } + } + + /// + /// Gets the header type of this data packet. + /// + public static byte HeaderType => 0xC1; + + /// + /// Gets the operation code of this data packet. + /// + public static byte Code => 0xE6; + + /// + /// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed. + /// + public static int Length => 9; + + /// + /// Gets the header of this packet. + /// + public C1Header Header => new (this._data); + + /// + /// Gets or sets the result. + /// + public byte Result + { + get => this._data.Span[3]; + set => this._data.Span[3] = value; + } + + /// + /// Gets or sets the relationship type. + /// + public byte RelationshipType + { + get => this._data.Span[4]; + set => this._data.Span[4] = value; + } + + /// + /// Gets or sets the target guild id. + /// + public uint TargetGuildId + { + get => ReadUInt32BigEndian(this._data.Span[5..]); + set => WriteUInt32BigEndian(this._data.Span[5..], value); + } + + /// + /// Performs an implicit conversion from a Memory of bytes to a . + /// + /// The packet as span. + /// The packet as struct. + public static implicit operator GuildRelationshipChangeResponse(Memory packet) => new (packet, false); + + /// + /// Performs an implicit conversion from to a Memory of bytes. + /// + /// The packet as struct. + /// The packet as byte span. + public static implicit operator Memory(GuildRelationshipChangeResponse packet) => packet._data; +} + + +/// +/// Is sent by the server when: After the player requested the alliance list. +/// Causes reaction on client side: The client shows the list of guilds in the alliance. +/// +public readonly struct AllianceList +{ + private readonly Memory _data; + + /// + /// Initializes a new instance of the struct. + /// + /// The underlying data. + public AllianceList(Memory data) + : this(data, true) + { + } + + /// + /// Initializes a new instance of the struct. + /// + /// The underlying data. + /// If set to true, the header data is automatically initialized and written to the underlying span. + private AllianceList(Memory data, bool initialize) + { + this._data = data; + if (initialize) + { + var header = this.Header; + header.Type = HeaderType; + header.Code = Code; + header.Length = (ushort)data.Length; + } + } + + /// + /// Gets the header type of this data packet. + /// + public static byte HeaderType => 0xC2; + + /// + /// Gets the operation code of this data packet. + /// + public static byte Code => 0xE9; + + /// + /// Gets the header of this packet. + /// + public C2Header Header => new (this._data); + + /// + /// Gets or sets the guild count. + /// + public byte GuildCount + { + get => this._data.Span[4]; + set => this._data.Span[4] = value; + } + + /// + /// Gets the of the specified index. + /// + public AllianceGuildEntry this[int index] => new (this._data.Slice(5 + index * AllianceGuildEntry.Length)); + + /// + /// Performs an implicit conversion from a Memory of bytes to a . + /// + /// The packet as span. + /// The packet as struct. + public static implicit operator AllianceList(Memory packet) => new (packet, false); + + /// + /// Performs an implicit conversion from to a Memory of bytes. + /// + /// The packet as struct. + /// The packet as byte span. + public static implicit operator Memory(AllianceList packet) => packet._data; + + /// + /// Calculates the size of the packet for the specified count of . + /// + /// The count of from which the size will be calculated. + + public static int GetRequiredSize(int guildsCount) => guildsCount * AllianceGuildEntry.Length + 5; + + +/// +/// Information about one guild in the alliance.. +/// +public readonly struct AllianceGuildEntry +{ + private readonly Memory _data; + + /// + /// Initializes a new instance of the struct. + /// + /// The underlying data. + public AllianceGuildEntry(Memory data) + { + this._data = data; + } + + /// + /// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed. + /// + public static int Length => 19; + + /// + /// Gets or sets the guild name. + /// + public string GuildName + { + get => this._data.Span.ExtractString(0, 8, System.Text.Encoding.UTF8); + set => this._data.Slice(0, 8).Span.WriteString(value, System.Text.Encoding.UTF8); + } + + /// + /// Gets or sets the member count. + /// + public byte MemberCount + { + get => this._data.Span[8]; + set => this._data.Span[8] = value; + } + + /// + /// Gets or sets the guild master name. + /// + public string GuildMasterName + { + get => this._data.Span.ExtractString(9, 10, System.Text.Encoding.UTF8); + set => this._data.Slice(9, 10).Span.WriteString(value, System.Text.Encoding.UTF8); + } +} +} /// /// Defines the role of a guild member. /// diff --git a/src/Network/Packets/ServerToClient/ServerToClientPackets.xml b/src/Network/Packets/ServerToClient/ServerToClientPackets.xml index 65e8368e7..de6fc2aca 100644 --- a/src/Network/Packets/ServerToClient/ServerToClientPackets.xml +++ b/src/Network/Packets/ServerToClient/ServerToClientPackets.xml @@ -10794,6 +10794,1097 @@ + + C1HeaderWithSubCode + B2 + 00 + CastleSiegeStatusResponse + 46 + ServerToClient + After the player requested the current castle siege status from a castle siege npc. + The client shows the castle siege status. + + + 4 + Byte + Result + + + 5 + Byte + State + + + 6 + ShortBigEndian + StartYear + + + 8 + Byte + StartMonth + + + 9 + Byte + StartDay + + + 10 + Byte + StartHour + + + 11 + Byte + StartMinute + + + 12 + ShortBigEndian + EndYear + + + 14 + Byte + EndMonth + + + 15 + Byte + EndDay + + + 16 + Byte + EndHour + + + 17 + Byte + EndMinute + + + 18 + ShortBigEndian + SiegeStartYear + + + 20 + Byte + SiegeStartMonth + + + 21 + Byte + SiegeStartDay + + + 22 + Byte + SiegeStartHour + + + 23 + Byte + SiegeStartMinute + + + 24 + String + GuildName + 8 + + + 32 + String + GuildMasterName + 10 + + + 42 + IntegerBigEndian + RemainingTime + + + + + C1HeaderWithSubCode + B2 + 01 + CastleSiegeRegistrationResponse + 13 + ServerToClient + After the player requested to register his guild for the next castle siege. + The client shows the result of the registration attempt. + + + 4 + Byte + Result + + + 5 + String + GuildName + 8 + + + + + C1HeaderWithSubCode + B2 + 02 + CastleSiegeUnregisterResponse + 5 + ServerToClient + After the player requested to un-register his guild from the next castle siege. + The client shows the result of the un-registration attempt. + + + 4 + Byte + Result + + + + + C1HeaderWithSubCode + B2 + 03 + CastleSiegeRegistrationStateResponse + 20 + ServerToClient + After the player requested the current registration state of his guild. + The client shows the current registration state including the number of submitted guild marks. + + + 4 + String + GuildName + 8 + + + 12 + IntegerBigEndian + GuildMarkCount + + + 16 + IntegerBigEndian + RegistrationId + + + + + C1HeaderWithSubCode + B2 + 04 + CastleSiegeMarkRegistrationResponse + 17 + ServerToClient + After the player submitted a guild mark for the castle siege registration. + The client shows the updated guild mark count. + + + 4 + Byte + Result + + + 5 + String + GuildName + 8 + + + 13 + IntegerBigEndian + GuildMarkCount + + + + + C1HeaderWithSubCode + B2 + 05 + CastleSiegeDefenseBuyResponse + 13 + ServerToClient + After the player requested to buy a castle siege defense structure (gate or statue). + The client shows the result of the buy request. + + + 4 + Byte + Result + + + 5 + IntegerLittleEndian + NpcNumber + + + 9 + IntegerLittleEndian + NpcIndex + + + + + C1HeaderWithSubCode + B2 + 06 + CastleSiegeDefenseRepairResponse + 13 + ServerToClient + After the player requested to repair a castle siege defense structure (gate or statue). + The client shows the result of the repair request. + + + 4 + Byte + Result + + + 5 + IntegerLittleEndian + NpcNumber + + + 9 + IntegerLittleEndian + NpcIndex + + + + + C1HeaderWithSubCode + B2 + 07 + CastleSiegeDefenseUpgradeResponse + 21 + ServerToClient + After the player requested to upgrade a castle siege defense structure (gate or statue). + The client shows the result of the upgrade request and the new upgrade values. + + + 4 + Byte + Result + + + 5 + IntegerLittleEndian + NpcNumber + + + 9 + IntegerLittleEndian + NpcIndex + + + 13 + IntegerLittleEndian + NpcUpgradeType + + + 17 + IntegerLittleEndian + NpcUpgradeValue + + + + + C1HeaderWithSubCode + B2 + 08 + CastleSiegeTaxInfoResponse + 19 + ServerToClient + After the guild master opened the castle npc to manage the castle taxes. + The client shows the current tax configuration and treasury amount. + + + 4 + Byte + TaxRateChaosMachine + + + 5 + Byte + TaxRateNormal + + + 6 + IntegerBigEndian + TaxRateLandOfTrials + + + 10 + Boolean + IsPublicHuntingAllowed + + + 11 + LongBigEndian + Treasury + + + + + C1HeaderWithSubCode + B2 + 09 + CastleSiegeTaxChangeResponse + 10 + ServerToClient + After the guild master changed the tax rate. + The client shows the result of the tax rate change. + + + 4 + Byte + Result + + + 5 + Byte + TaxType + + + 6 + IntegerBigEndian + TaxRate + + + + + C1HeaderWithSubCode + B2 + 10 + CastleSiegeTributeWithdrawResponse + 13 + ServerToClient + After the guild master requested to withdraw tax money from the castle treasury. + The client shows the result of the withdrawal and the withdrawn amount. + + + 4 + Byte + Result + + + 5 + LongBigEndian + Money + + + + + C1HeaderWithSubCode + B2 + 11 + CastleSiegeJoinSideNotification + 5 + ServerToClient + The server notifies the player of which siege side (attacker/defender) they are on. + The client updates the castle siege mini-map accordingly. + + + 4 + Byte + Side + 0 = defender, 1 = attacker, 2 = neutral + + + + + C1HeaderWithSubCode + B2 + 12 + CastleSiegeGateOperateResponse + 7 + ServerToClient + After a guild member of the castle owner requested to toggle a castle gate. + The client shows the result of the gate toggle operation. + + + 4 + Byte + Result + + + 5 + ShortBigEndian + GateIndex + + + + + C1HeaderWithSubCode + B2 + 13 + CastleSiegeCrownStateUpdate + 5 + ServerToClient + The server updates the state of the castle crown during the siege. + The client updates the crown state display. + + + 4 + Byte + State + 0 = locked, 1 = available + + + + + C1HeaderWithSubCode + B2 + 14 + CastleSiegeCrownAccessState + 9 + ServerToClient + The server updates the access state of the castle crown during the siege. + The client updates the crown access state and accumulated time display. + + + 4 + Byte + State + + + 5 + IntegerBigEndian + AccumulatedTimeMs + + + + + C1HeaderWithSubCode + B2 + 15 + CastleSiegeSwitchInfo + 29 + ServerToClient + The server sends information about a castle siege switch (e.g., life stone activation). + The client updates the switch state display. + + + 4 + ShortBigEndian + SwitchIndex + + + 6 + Byte + SwitchId + + + 7 + Byte + State + + + 8 + Byte + JoinSide + + + 9 + String + GuildName + 9 + + + 18 + String + UserName + 11 + + + + + C1HeaderWithSubCode + B2 + 16 + CastleSiegeOwnershipChangeNotification + 12 + ServerToClient + The server notifies all players that the castle ownership has changed. + The client shows the new castle owner guild name. + + + 4 + String + GuildName + 8 + + + + + C1HeaderWithSubCode + B2 + 17 + CastleSiegeBattleStartEnd + 5 + ServerToClient + The server notifies all players that the castle siege battle has started or ended. + The client updates the siege state accordingly. + + + 4 + Boolean + IsStarted + + + + + C1HeaderWithSubCode + B2 + 18 + CastleSiegeRemainingTime + 6 + ServerToClient + The server sends the remaining siege time. + The client updates the remaining siege time display. + + + 4 + Byte + Hour + + + 5 + Byte + Minute + + + + + C1HeaderWithSubCode + B2 + 19 + CastleSiegeGateOperateState + 7 + ServerToClient + The server sends the current operation state of a castle gate. + The client updates the gate state display. + + + 4 + ShortBigEndian + GateIndex + + + 6 + Byte + State + + + + + C2HeaderWithSubCode + B2 + 1A + CastleSiegeMiniMapPlayerPositions + ServerToClient + The server sends the positions of all players in the castle siege mini map. + The client updates the mini map with the player positions. + + + 5 + IntegerBigEndian + PlayerCount + + + 9 + Structure[] + MiniMapPlayerPosition + Players + PlayerCount + + + + + MiniMapPlayerPosition + The position of one player on the mini map. + 2 + + + 0 + Byte + PositionX + + + 1 + Byte + PositionY + + + + + + + C2HeaderWithSubCode + B2 + 1B + CastleSiegeMiniMapNpcPositions + ServerToClient + The server sends the positions of all siege NPCs in the castle siege mini map. + The client updates the mini map with the NPC positions. + + + 5 + IntegerBigEndian + NpcCount + + + 9 + Structure[] + MiniMapNpcPosition + Npcs + NpcCount + + + + + MiniMapNpcPosition + The position of one NPC on the mini map. + 3 + + + 0 + Byte + NpcType + + + 1 + Byte + PositionX + + + 2 + Byte + PositionY + + + + + + + C1HeaderWithSubCode + B3 + 00 + CastleSiegeGateState + 7 + ServerToClient + The server sends the current state of a castle gate. + The client updates the gate state display. + + + 4 + ShortBigEndian + GateIndex + + + 6 + Byte + State + + + + + C2HeaderWithSubCode + B3 + 02 + CastleSiegeNpcList + ServerToClient + After the guild master requested the list of all castle siege statues and gates. + The client shows the list of castle siege NPCs with their current status. + + + 5 + Byte + Result + + + 6 + IntegerBigEndian + NpcCount + + + 10 + Structure[] + CastleSiegeNpcInfo + NpcList + NpcCount + + + + + CastleSiegeNpcInfo + Information about one castle siege NPC (gate or statue). + 21 + + + 0 + IntegerLittleEndian + NpcNumber + + + 4 + IntegerLittleEndian + NpcIndex + + + 8 + Byte + DefenseUpgradeLevel + + + 9 + Byte + RegenerationLevel + + + 10 + IntegerLittleEndian + MaxHp + + + 14 + IntegerLittleEndian + CurrentHp + + + 18 + Byte + PositionX + + + 19 + Byte + PositionY + + + 20 + Boolean + IsAlive + + + + + + + C2Header + B4 + CastleSiegeRegisteredGuildList + ServerToClient + After the guild master requested the list of guilds registered for the next siege. + The client shows the list of registered guilds and their mark counts. + + + 4 + IntegerBigEndian + GuildCount + + + 8 + Structure[] + RegisteredGuildEntry + Guilds + GuildCount + + + + + RegisteredGuildEntry + Information about one guild registered for the next castle siege. + 17 + + + 0 + String + GuildName + 8 + + + 8 + IntegerBigEndian + GuildMarkCount + + + 12 + IntegerBigEndian + RegistrationId + + + 16 + Boolean + IsCastleOwner + + + + + + + C2Header + B5 + CastleSiegeGuildList + ServerToClient + After the guild master requested the list of all guilds in the current castle siege. + The client shows the list of guilds participating in the castle siege. + + + 4 + Byte + Result + + + 5 + IntegerBigEndian + GuildCount + + + 9 + Structure[] + CastleSiegeGuildEntry + Guilds + GuildCount + + + + + CastleSiegeGuildEntry + Information about one guild in the castle siege. + 14 + + + 0 + Byte + Side + 0 = defender, 1 = attacker + + + 1 + Boolean + IsInvolved + + + 2 + String + GuildName + 8 + + + 10 + IntegerBigEndian + Score + + + + + + + C1HeaderWithSubCode + B7 + 01 + CastleSiegeMachineUseResult + 8 + ServerToClient + After the player fired a siege machine (catapult). + The client shows the catapult animation toward the target area. + + + 4 + ShortBigEndian + NpcIndex + + + 6 + Byte + TargetX + + + 7 + Byte + TargetY + + + + + C1HeaderWithSubCode + B7 + 02 + CastleSiegeMachineRegionNotify + 6 + ServerToClient + The server notifies the player of the impact region of a siege machine. + The client shows the impact area effect. + + + 4 + Byte + TargetX + + + 5 + Byte + TargetY + + + + + C1HeaderWithSubCode + B7 + 03 + CastleSiegeMachineInterface + 5 + ServerToClient + The server sends the siege machine interface to a player who is operating the machine. + The client shows the siege machine operation interface. + + + 4 + Byte + MachineType + + + + + C1HeaderWithSubCode + B7 + 05 + CastleSiegeLifeStoneState + 5 + ServerToClient + The server sends the current state of the castle life stone. + The client updates the life stone state display. + + + 4 + Byte + State + The creation stage of the life stone (0 to 4). + + + + + C1HeaderWithSubCode + B9 + 02 + CastleOwnerLogo + 36 + ServerToClient + After the client requested the guild logo of the current castle owner. + The client shows the castle owner guild logo. + + + 4 + Binary + Logo + 32 + + + + + C1HeaderWithSubCode + B9 + 03 + HuntingZoneGuardInfo + 9 + ServerToClient + The server sends information about the hunting zone guard configuration. + The client shows the hunting zone entrance configuration. + + + 4 + Boolean + IsEnabled + + + 5 + IntegerBigEndian + TaxRate + + + + + C1Header + E6 + GuildRelationshipChangeResponse + 9 + ServerToClient + After a guild relationship change was processed by the server. + The client shows the result of the guild relationship change request. + + + 3 + Byte + Result + + + 4 + Byte + RelationshipType + + + 5 + IntegerBigEndian + TargetGuildId + + + + + C2Header + E9 + AllianceList + ServerToClient + After the player requested the alliance list. + The client shows the list of guilds in the alliance. + + + 4 + Byte + GuildCount + + + 5 + Structure[] + AllianceGuildEntry + Guilds + GuildCount + + + + + AllianceGuildEntry + Information about one guild in the alliance. + 19 + + + 0 + String + GuildName + 8 + + + 8 + Byte + MemberCount + + + 9 + String + GuildMasterName + 10 + + + + + diff --git a/src/Network/Packets/ServerToClient/ServerToClientPacketsRef.cs b/src/Network/Packets/ServerToClient/ServerToClientPacketsRef.cs index f723a70bf..ddc0c9fde 100644 --- a/src/Network/Packets/ServerToClient/ServerToClientPacketsRef.cs +++ b/src/Network/Packets/ServerToClient/ServerToClientPacketsRef.cs @@ -28556,3 +28556,3816 @@ public MapEventState.Events Event /// The packet as byte span. public static implicit operator Span(MapEventStateRef packet) => packet._data; } + + +/// +/// Is sent by the server when: After the player requested the current castle siege status from a castle siege npc. +/// Causes reaction on client side: The client shows the castle siege status. +/// +public readonly ref struct CastleSiegeStatusResponseRef +{ + private readonly Span _data; + + /// + /// Initializes a new instance of the struct. + /// + /// The underlying data. + public CastleSiegeStatusResponseRef(Span data) + : this(data, true) + { + } + + /// + /// Initializes a new instance of the struct. + /// + /// The underlying data. + /// If set to true, the header data is automatically initialized and written to the underlying span. + private CastleSiegeStatusResponseRef(Span data, bool initialize) + { + this._data = data; + if (initialize) + { + var header = this.Header; + header.Type = HeaderType; + header.Code = Code; + header.Length = (byte)Math.Min(data.Length, Length); + header.SubCode = SubCode; + } + } + + /// + /// Gets the header type of this data packet. + /// + public static byte HeaderType => 0xC1; + + /// + /// Gets the operation code of this data packet. + /// + public static byte Code => 0xB2; + + /// + /// Gets the operation sub-code of this data packet. + /// The is used as a grouping key. + /// + public static byte SubCode => 0x00; + + /// + /// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed. + /// + public static int Length => 46; + + /// + /// Gets the header of this packet. + /// + public C1HeaderWithSubCodeRef Header => new (this._data); + + /// + /// Gets or sets the result. + /// + public byte Result + { + get => this._data[4]; + set => this._data[4] = value; + } + + /// + /// Gets or sets the state. + /// + public byte State + { + get => this._data[5]; + set => this._data[5] = value; + } + + /// + /// Gets or sets the start year. + /// + public ushort StartYear + { + get => ReadUInt16BigEndian(this._data[6..]); + set => WriteUInt16BigEndian(this._data[6..], value); + } + + /// + /// Gets or sets the start month. + /// + public byte StartMonth + { + get => this._data[8]; + set => this._data[8] = value; + } + + /// + /// Gets or sets the start day. + /// + public byte StartDay + { + get => this._data[9]; + set => this._data[9] = value; + } + + /// + /// Gets or sets the start hour. + /// + public byte StartHour + { + get => this._data[10]; + set => this._data[10] = value; + } + + /// + /// Gets or sets the start minute. + /// + public byte StartMinute + { + get => this._data[11]; + set => this._data[11] = value; + } + + /// + /// Gets or sets the end year. + /// + public ushort EndYear + { + get => ReadUInt16BigEndian(this._data[12..]); + set => WriteUInt16BigEndian(this._data[12..], value); + } + + /// + /// Gets or sets the end month. + /// + public byte EndMonth + { + get => this._data[14]; + set => this._data[14] = value; + } + + /// + /// Gets or sets the end day. + /// + public byte EndDay + { + get => this._data[15]; + set => this._data[15] = value; + } + + /// + /// Gets or sets the end hour. + /// + public byte EndHour + { + get => this._data[16]; + set => this._data[16] = value; + } + + /// + /// Gets or sets the end minute. + /// + public byte EndMinute + { + get => this._data[17]; + set => this._data[17] = value; + } + + /// + /// Gets or sets the siege start year. + /// + public ushort SiegeStartYear + { + get => ReadUInt16BigEndian(this._data[18..]); + set => WriteUInt16BigEndian(this._data[18..], value); + } + + /// + /// Gets or sets the siege start month. + /// + public byte SiegeStartMonth + { + get => this._data[20]; + set => this._data[20] = value; + } + + /// + /// Gets or sets the siege start day. + /// + public byte SiegeStartDay + { + get => this._data[21]; + set => this._data[21] = value; + } + + /// + /// Gets or sets the siege start hour. + /// + public byte SiegeStartHour + { + get => this._data[22]; + set => this._data[22] = value; + } + + /// + /// Gets or sets the siege start minute. + /// + public byte SiegeStartMinute + { + get => this._data[23]; + set => this._data[23] = value; + } + + /// + /// Gets or sets the guild name. + /// + public string GuildName + { + get => this._data.ExtractString(24, 8, System.Text.Encoding.UTF8); + set => this._data.Slice(24, 8).WriteString(value, System.Text.Encoding.UTF8); + } + + /// + /// Gets or sets the guild master name. + /// + public string GuildMasterName + { + get => this._data.ExtractString(32, 10, System.Text.Encoding.UTF8); + set => this._data.Slice(32, 10).WriteString(value, System.Text.Encoding.UTF8); + } + + /// + /// Gets or sets the remaining time. + /// + public uint RemainingTime + { + get => ReadUInt32BigEndian(this._data[42..]); + set => WriteUInt32BigEndian(this._data[42..], value); + } + + /// + /// Performs an implicit conversion from a Span of bytes to a . + /// + /// The packet as span. + /// The packet as struct. + public static implicit operator CastleSiegeStatusResponseRef(Span packet) => new (packet, false); + + /// + /// Performs an implicit conversion from to a Span of bytes. + /// + /// The packet as struct. + /// The packet as byte span. + public static implicit operator Span(CastleSiegeStatusResponseRef packet) => packet._data; +} + + +/// +/// Is sent by the server when: After the player requested to register his guild for the next castle siege. +/// Causes reaction on client side: The client shows the result of the registration attempt. +/// +public readonly ref struct CastleSiegeRegistrationResponseRef +{ + private readonly Span _data; + + /// + /// Initializes a new instance of the struct. + /// + /// The underlying data. + public CastleSiegeRegistrationResponseRef(Span data) + : this(data, true) + { + } + + /// + /// Initializes a new instance of the struct. + /// + /// The underlying data. + /// If set to true, the header data is automatically initialized and written to the underlying span. + private CastleSiegeRegistrationResponseRef(Span data, bool initialize) + { + this._data = data; + if (initialize) + { + var header = this.Header; + header.Type = HeaderType; + header.Code = Code; + header.Length = (byte)Math.Min(data.Length, Length); + header.SubCode = SubCode; + } + } + + /// + /// Gets the header type of this data packet. + /// + public static byte HeaderType => 0xC1; + + /// + /// Gets the operation code of this data packet. + /// + public static byte Code => 0xB2; + + /// + /// Gets the operation sub-code of this data packet. + /// The is used as a grouping key. + /// + public static byte SubCode => 0x01; + + /// + /// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed. + /// + public static int Length => 13; + + /// + /// Gets the header of this packet. + /// + public C1HeaderWithSubCodeRef Header => new (this._data); + + /// + /// Gets or sets the result. + /// + public byte Result + { + get => this._data[4]; + set => this._data[4] = value; + } + + /// + /// Gets or sets the guild name. + /// + public string GuildName + { + get => this._data.ExtractString(5, 8, System.Text.Encoding.UTF8); + set => this._data.Slice(5, 8).WriteString(value, System.Text.Encoding.UTF8); + } + + /// + /// Performs an implicit conversion from a Span of bytes to a . + /// + /// The packet as span. + /// The packet as struct. + public static implicit operator CastleSiegeRegistrationResponseRef(Span packet) => new (packet, false); + + /// + /// Performs an implicit conversion from to a Span of bytes. + /// + /// The packet as struct. + /// The packet as byte span. + public static implicit operator Span(CastleSiegeRegistrationResponseRef packet) => packet._data; +} + + +/// +/// Is sent by the server when: After the player requested to un-register his guild from the next castle siege. +/// Causes reaction on client side: The client shows the result of the un-registration attempt. +/// +public readonly ref struct CastleSiegeUnregisterResponseRef +{ + private readonly Span _data; + + /// + /// Initializes a new instance of the struct. + /// + /// The underlying data. + public CastleSiegeUnregisterResponseRef(Span data) + : this(data, true) + { + } + + /// + /// Initializes a new instance of the struct. + /// + /// The underlying data. + /// If set to true, the header data is automatically initialized and written to the underlying span. + private CastleSiegeUnregisterResponseRef(Span data, bool initialize) + { + this._data = data; + if (initialize) + { + var header = this.Header; + header.Type = HeaderType; + header.Code = Code; + header.Length = (byte)Math.Min(data.Length, Length); + header.SubCode = SubCode; + } + } + + /// + /// Gets the header type of this data packet. + /// + public static byte HeaderType => 0xC1; + + /// + /// Gets the operation code of this data packet. + /// + public static byte Code => 0xB2; + + /// + /// Gets the operation sub-code of this data packet. + /// The is used as a grouping key. + /// + public static byte SubCode => 0x02; + + /// + /// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed. + /// + public static int Length => 5; + + /// + /// Gets the header of this packet. + /// + public C1HeaderWithSubCodeRef Header => new (this._data); + + /// + /// Gets or sets the result. + /// + public byte Result + { + get => this._data[4]; + set => this._data[4] = value; + } + + /// + /// Performs an implicit conversion from a Span of bytes to a . + /// + /// The packet as span. + /// The packet as struct. + public static implicit operator CastleSiegeUnregisterResponseRef(Span packet) => new (packet, false); + + /// + /// Performs an implicit conversion from to a Span of bytes. + /// + /// The packet as struct. + /// The packet as byte span. + public static implicit operator Span(CastleSiegeUnregisterResponseRef packet) => packet._data; +} + + +/// +/// Is sent by the server when: After the player requested the current registration state of his guild. +/// Causes reaction on client side: The client shows the current registration state including the number of submitted guild marks. +/// +public readonly ref struct CastleSiegeRegistrationStateResponseRef +{ + private readonly Span _data; + + /// + /// Initializes a new instance of the struct. + /// + /// The underlying data. + public CastleSiegeRegistrationStateResponseRef(Span data) + : this(data, true) + { + } + + /// + /// Initializes a new instance of the struct. + /// + /// The underlying data. + /// If set to true, the header data is automatically initialized and written to the underlying span. + private CastleSiegeRegistrationStateResponseRef(Span data, bool initialize) + { + this._data = data; + if (initialize) + { + var header = this.Header; + header.Type = HeaderType; + header.Code = Code; + header.Length = (byte)Math.Min(data.Length, Length); + header.SubCode = SubCode; + } + } + + /// + /// Gets the header type of this data packet. + /// + public static byte HeaderType => 0xC1; + + /// + /// Gets the operation code of this data packet. + /// + public static byte Code => 0xB2; + + /// + /// Gets the operation sub-code of this data packet. + /// The is used as a grouping key. + /// + public static byte SubCode => 0x03; + + /// + /// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed. + /// + public static int Length => 20; + + /// + /// Gets the header of this packet. + /// + public C1HeaderWithSubCodeRef Header => new (this._data); + + /// + /// Gets or sets the guild name. + /// + public string GuildName + { + get => this._data.ExtractString(4, 8, System.Text.Encoding.UTF8); + set => this._data.Slice(4, 8).WriteString(value, System.Text.Encoding.UTF8); + } + + /// + /// Gets or sets the guild mark count. + /// + public uint GuildMarkCount + { + get => ReadUInt32BigEndian(this._data[12..]); + set => WriteUInt32BigEndian(this._data[12..], value); + } + + /// + /// Gets or sets the registration id. + /// + public uint RegistrationId + { + get => ReadUInt32BigEndian(this._data[16..]); + set => WriteUInt32BigEndian(this._data[16..], value); + } + + /// + /// Performs an implicit conversion from a Span of bytes to a . + /// + /// The packet as span. + /// The packet as struct. + public static implicit operator CastleSiegeRegistrationStateResponseRef(Span packet) => new (packet, false); + + /// + /// Performs an implicit conversion from to a Span of bytes. + /// + /// The packet as struct. + /// The packet as byte span. + public static implicit operator Span(CastleSiegeRegistrationStateResponseRef packet) => packet._data; +} + + +/// +/// Is sent by the server when: After the player submitted a guild mark for the castle siege registration. +/// Causes reaction on client side: The client shows the updated guild mark count. +/// +public readonly ref struct CastleSiegeMarkRegistrationResponseRef +{ + private readonly Span _data; + + /// + /// Initializes a new instance of the struct. + /// + /// The underlying data. + public CastleSiegeMarkRegistrationResponseRef(Span data) + : this(data, true) + { + } + + /// + /// Initializes a new instance of the struct. + /// + /// The underlying data. + /// If set to true, the header data is automatically initialized and written to the underlying span. + private CastleSiegeMarkRegistrationResponseRef(Span data, bool initialize) + { + this._data = data; + if (initialize) + { + var header = this.Header; + header.Type = HeaderType; + header.Code = Code; + header.Length = (byte)Math.Min(data.Length, Length); + header.SubCode = SubCode; + } + } + + /// + /// Gets the header type of this data packet. + /// + public static byte HeaderType => 0xC1; + + /// + /// Gets the operation code of this data packet. + /// + public static byte Code => 0xB2; + + /// + /// Gets the operation sub-code of this data packet. + /// The is used as a grouping key. + /// + public static byte SubCode => 0x04; + + /// + /// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed. + /// + public static int Length => 17; + + /// + /// Gets the header of this packet. + /// + public C1HeaderWithSubCodeRef Header => new (this._data); + + /// + /// Gets or sets the result. + /// + public byte Result + { + get => this._data[4]; + set => this._data[4] = value; + } + + /// + /// Gets or sets the guild name. + /// + public string GuildName + { + get => this._data.ExtractString(5, 8, System.Text.Encoding.UTF8); + set => this._data.Slice(5, 8).WriteString(value, System.Text.Encoding.UTF8); + } + + /// + /// Gets or sets the guild mark count. + /// + public uint GuildMarkCount + { + get => ReadUInt32BigEndian(this._data[13..]); + set => WriteUInt32BigEndian(this._data[13..], value); + } + + /// + /// Performs an implicit conversion from a Span of bytes to a . + /// + /// The packet as span. + /// The packet as struct. + public static implicit operator CastleSiegeMarkRegistrationResponseRef(Span packet) => new (packet, false); + + /// + /// Performs an implicit conversion from to a Span of bytes. + /// + /// The packet as struct. + /// The packet as byte span. + public static implicit operator Span(CastleSiegeMarkRegistrationResponseRef packet) => packet._data; +} + + +/// +/// Is sent by the server when: After the player requested to buy a castle siege defense structure (gate or statue). +/// Causes reaction on client side: The client shows the result of the buy request. +/// +public readonly ref struct CastleSiegeDefenseBuyResponseRef +{ + private readonly Span _data; + + /// + /// Initializes a new instance of the struct. + /// + /// The underlying data. + public CastleSiegeDefenseBuyResponseRef(Span data) + : this(data, true) + { + } + + /// + /// Initializes a new instance of the struct. + /// + /// The underlying data. + /// If set to true, the header data is automatically initialized and written to the underlying span. + private CastleSiegeDefenseBuyResponseRef(Span data, bool initialize) + { + this._data = data; + if (initialize) + { + var header = this.Header; + header.Type = HeaderType; + header.Code = Code; + header.Length = (byte)Math.Min(data.Length, Length); + header.SubCode = SubCode; + } + } + + /// + /// Gets the header type of this data packet. + /// + public static byte HeaderType => 0xC1; + + /// + /// Gets the operation code of this data packet. + /// + public static byte Code => 0xB2; + + /// + /// Gets the operation sub-code of this data packet. + /// The is used as a grouping key. + /// + public static byte SubCode => 0x05; + + /// + /// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed. + /// + public static int Length => 13; + + /// + /// Gets the header of this packet. + /// + public C1HeaderWithSubCodeRef Header => new (this._data); + + /// + /// Gets or sets the result. + /// + public byte Result + { + get => this._data[4]; + set => this._data[4] = value; + } + + /// + /// Gets or sets the npc number. + /// + public uint NpcNumber + { + get => ReadUInt32LittleEndian(this._data[5..]); + set => WriteUInt32LittleEndian(this._data[5..], value); + } + + /// + /// Gets or sets the npc index. + /// + public uint NpcIndex + { + get => ReadUInt32LittleEndian(this._data[9..]); + set => WriteUInt32LittleEndian(this._data[9..], value); + } + + /// + /// Performs an implicit conversion from a Span of bytes to a . + /// + /// The packet as span. + /// The packet as struct. + public static implicit operator CastleSiegeDefenseBuyResponseRef(Span packet) => new (packet, false); + + /// + /// Performs an implicit conversion from to a Span of bytes. + /// + /// The packet as struct. + /// The packet as byte span. + public static implicit operator Span(CastleSiegeDefenseBuyResponseRef packet) => packet._data; +} + + +/// +/// Is sent by the server when: After the player requested to repair a castle siege defense structure (gate or statue). +/// Causes reaction on client side: The client shows the result of the repair request. +/// +public readonly ref struct CastleSiegeDefenseRepairResponseRef +{ + private readonly Span _data; + + /// + /// Initializes a new instance of the struct. + /// + /// The underlying data. + public CastleSiegeDefenseRepairResponseRef(Span data) + : this(data, true) + { + } + + /// + /// Initializes a new instance of the struct. + /// + /// The underlying data. + /// If set to true, the header data is automatically initialized and written to the underlying span. + private CastleSiegeDefenseRepairResponseRef(Span data, bool initialize) + { + this._data = data; + if (initialize) + { + var header = this.Header; + header.Type = HeaderType; + header.Code = Code; + header.Length = (byte)Math.Min(data.Length, Length); + header.SubCode = SubCode; + } + } + + /// + /// Gets the header type of this data packet. + /// + public static byte HeaderType => 0xC1; + + /// + /// Gets the operation code of this data packet. + /// + public static byte Code => 0xB2; + + /// + /// Gets the operation sub-code of this data packet. + /// The is used as a grouping key. + /// + public static byte SubCode => 0x06; + + /// + /// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed. + /// + public static int Length => 13; + + /// + /// Gets the header of this packet. + /// + public C1HeaderWithSubCodeRef Header => new (this._data); + + /// + /// Gets or sets the result. + /// + public byte Result + { + get => this._data[4]; + set => this._data[4] = value; + } + + /// + /// Gets or sets the npc number. + /// + public uint NpcNumber + { + get => ReadUInt32LittleEndian(this._data[5..]); + set => WriteUInt32LittleEndian(this._data[5..], value); + } + + /// + /// Gets or sets the npc index. + /// + public uint NpcIndex + { + get => ReadUInt32LittleEndian(this._data[9..]); + set => WriteUInt32LittleEndian(this._data[9..], value); + } + + /// + /// Performs an implicit conversion from a Span of bytes to a . + /// + /// The packet as span. + /// The packet as struct. + public static implicit operator CastleSiegeDefenseRepairResponseRef(Span packet) => new (packet, false); + + /// + /// Performs an implicit conversion from to a Span of bytes. + /// + /// The packet as struct. + /// The packet as byte span. + public static implicit operator Span(CastleSiegeDefenseRepairResponseRef packet) => packet._data; +} + + +/// +/// Is sent by the server when: After the player requested to upgrade a castle siege defense structure (gate or statue). +/// Causes reaction on client side: The client shows the result of the upgrade request and the new upgrade values. +/// +public readonly ref struct CastleSiegeDefenseUpgradeResponseRef +{ + private readonly Span _data; + + /// + /// Initializes a new instance of the struct. + /// + /// The underlying data. + public CastleSiegeDefenseUpgradeResponseRef(Span data) + : this(data, true) + { + } + + /// + /// Initializes a new instance of the struct. + /// + /// The underlying data. + /// If set to true, the header data is automatically initialized and written to the underlying span. + private CastleSiegeDefenseUpgradeResponseRef(Span data, bool initialize) + { + this._data = data; + if (initialize) + { + var header = this.Header; + header.Type = HeaderType; + header.Code = Code; + header.Length = (byte)Math.Min(data.Length, Length); + header.SubCode = SubCode; + } + } + + /// + /// Gets the header type of this data packet. + /// + public static byte HeaderType => 0xC1; + + /// + /// Gets the operation code of this data packet. + /// + public static byte Code => 0xB2; + + /// + /// Gets the operation sub-code of this data packet. + /// The is used as a grouping key. + /// + public static byte SubCode => 0x07; + + /// + /// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed. + /// + public static int Length => 21; + + /// + /// Gets the header of this packet. + /// + public C1HeaderWithSubCodeRef Header => new (this._data); + + /// + /// Gets or sets the result. + /// + public byte Result + { + get => this._data[4]; + set => this._data[4] = value; + } + + /// + /// Gets or sets the npc number. + /// + public uint NpcNumber + { + get => ReadUInt32LittleEndian(this._data[5..]); + set => WriteUInt32LittleEndian(this._data[5..], value); + } + + /// + /// Gets or sets the npc index. + /// + public uint NpcIndex + { + get => ReadUInt32LittleEndian(this._data[9..]); + set => WriteUInt32LittleEndian(this._data[9..], value); + } + + /// + /// Gets or sets the npc upgrade type. + /// + public uint NpcUpgradeType + { + get => ReadUInt32LittleEndian(this._data[13..]); + set => WriteUInt32LittleEndian(this._data[13..], value); + } + + /// + /// Gets or sets the npc upgrade value. + /// + public uint NpcUpgradeValue + { + get => ReadUInt32LittleEndian(this._data[17..]); + set => WriteUInt32LittleEndian(this._data[17..], value); + } + + /// + /// Performs an implicit conversion from a Span of bytes to a . + /// + /// The packet as span. + /// The packet as struct. + public static implicit operator CastleSiegeDefenseUpgradeResponseRef(Span packet) => new (packet, false); + + /// + /// Performs an implicit conversion from to a Span of bytes. + /// + /// The packet as struct. + /// The packet as byte span. + public static implicit operator Span(CastleSiegeDefenseUpgradeResponseRef packet) => packet._data; +} + + +/// +/// Is sent by the server when: After the guild master opened the castle npc to manage the castle taxes. +/// Causes reaction on client side: The client shows the current tax configuration and treasury amount. +/// +public readonly ref struct CastleSiegeTaxInfoResponseRef +{ + private readonly Span _data; + + /// + /// Initializes a new instance of the struct. + /// + /// The underlying data. + public CastleSiegeTaxInfoResponseRef(Span data) + : this(data, true) + { + } + + /// + /// Initializes a new instance of the struct. + /// + /// The underlying data. + /// If set to true, the header data is automatically initialized and written to the underlying span. + private CastleSiegeTaxInfoResponseRef(Span data, bool initialize) + { + this._data = data; + if (initialize) + { + var header = this.Header; + header.Type = HeaderType; + header.Code = Code; + header.Length = (byte)Math.Min(data.Length, Length); + header.SubCode = SubCode; + } + } + + /// + /// Gets the header type of this data packet. + /// + public static byte HeaderType => 0xC1; + + /// + /// Gets the operation code of this data packet. + /// + public static byte Code => 0xB2; + + /// + /// Gets the operation sub-code of this data packet. + /// The is used as a grouping key. + /// + public static byte SubCode => 0x08; + + /// + /// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed. + /// + public static int Length => 19; + + /// + /// Gets the header of this packet. + /// + public C1HeaderWithSubCodeRef Header => new (this._data); + + /// + /// Gets or sets the tax rate chaos machine. + /// + public byte TaxRateChaosMachine + { + get => this._data[4]; + set => this._data[4] = value; + } + + /// + /// Gets or sets the tax rate normal. + /// + public byte TaxRateNormal + { + get => this._data[5]; + set => this._data[5] = value; + } + + /// + /// Gets or sets the tax rate land of trials. + /// + public uint TaxRateLandOfTrials + { + get => ReadUInt32BigEndian(this._data[6..]); + set => WriteUInt32BigEndian(this._data[6..], value); + } + + /// + /// Gets or sets the is public hunting allowed. + /// + public bool IsPublicHuntingAllowed + { + get => this._data[10..].GetBoolean(); + set => this._data[10..].SetBoolean(value); + } + + /// + /// Gets or sets the treasury. + /// + public ulong Treasury + { + get => ReadUInt64BigEndian(this._data[11..]); + set => WriteUInt64BigEndian(this._data[11..], value); + } + + /// + /// Performs an implicit conversion from a Span of bytes to a . + /// + /// The packet as span. + /// The packet as struct. + public static implicit operator CastleSiegeTaxInfoResponseRef(Span packet) => new (packet, false); + + /// + /// Performs an implicit conversion from to a Span of bytes. + /// + /// The packet as struct. + /// The packet as byte span. + public static implicit operator Span(CastleSiegeTaxInfoResponseRef packet) => packet._data; +} + + +/// +/// Is sent by the server when: After the guild master changed the tax rate. +/// Causes reaction on client side: The client shows the result of the tax rate change. +/// +public readonly ref struct CastleSiegeTaxChangeResponseRef +{ + private readonly Span _data; + + /// + /// Initializes a new instance of the struct. + /// + /// The underlying data. + public CastleSiegeTaxChangeResponseRef(Span data) + : this(data, true) + { + } + + /// + /// Initializes a new instance of the struct. + /// + /// The underlying data. + /// If set to true, the header data is automatically initialized and written to the underlying span. + private CastleSiegeTaxChangeResponseRef(Span data, bool initialize) + { + this._data = data; + if (initialize) + { + var header = this.Header; + header.Type = HeaderType; + header.Code = Code; + header.Length = (byte)Math.Min(data.Length, Length); + header.SubCode = SubCode; + } + } + + /// + /// Gets the header type of this data packet. + /// + public static byte HeaderType => 0xC1; + + /// + /// Gets the operation code of this data packet. + /// + public static byte Code => 0xB2; + + /// + /// Gets the operation sub-code of this data packet. + /// The is used as a grouping key. + /// + public static byte SubCode => 0x09; + + /// + /// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed. + /// + public static int Length => 10; + + /// + /// Gets the header of this packet. + /// + public C1HeaderWithSubCodeRef Header => new (this._data); + + /// + /// Gets or sets the result. + /// + public byte Result + { + get => this._data[4]; + set => this._data[4] = value; + } + + /// + /// Gets or sets the tax type. + /// + public byte TaxType + { + get => this._data[5]; + set => this._data[5] = value; + } + + /// + /// Gets or sets the tax rate. + /// + public uint TaxRate + { + get => ReadUInt32BigEndian(this._data[6..]); + set => WriteUInt32BigEndian(this._data[6..], value); + } + + /// + /// Performs an implicit conversion from a Span of bytes to a . + /// + /// The packet as span. + /// The packet as struct. + public static implicit operator CastleSiegeTaxChangeResponseRef(Span packet) => new (packet, false); + + /// + /// Performs an implicit conversion from to a Span of bytes. + /// + /// The packet as struct. + /// The packet as byte span. + public static implicit operator Span(CastleSiegeTaxChangeResponseRef packet) => packet._data; +} + + +/// +/// Is sent by the server when: After the guild master requested to withdraw tax money from the castle treasury. +/// Causes reaction on client side: The client shows the result of the withdrawal and the withdrawn amount. +/// +public readonly ref struct CastleSiegeTributeWithdrawResponseRef +{ + private readonly Span _data; + + /// + /// Initializes a new instance of the struct. + /// + /// The underlying data. + public CastleSiegeTributeWithdrawResponseRef(Span data) + : this(data, true) + { + } + + /// + /// Initializes a new instance of the struct. + /// + /// The underlying data. + /// If set to true, the header data is automatically initialized and written to the underlying span. + private CastleSiegeTributeWithdrawResponseRef(Span data, bool initialize) + { + this._data = data; + if (initialize) + { + var header = this.Header; + header.Type = HeaderType; + header.Code = Code; + header.Length = (byte)Math.Min(data.Length, Length); + header.SubCode = SubCode; + } + } + + /// + /// Gets the header type of this data packet. + /// + public static byte HeaderType => 0xC1; + + /// + /// Gets the operation code of this data packet. + /// + public static byte Code => 0xB2; + + /// + /// Gets the operation sub-code of this data packet. + /// The is used as a grouping key. + /// + public static byte SubCode => 0x10; + + /// + /// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed. + /// + public static int Length => 13; + + /// + /// Gets the header of this packet. + /// + public C1HeaderWithSubCodeRef Header => new (this._data); + + /// + /// Gets or sets the result. + /// + public byte Result + { + get => this._data[4]; + set => this._data[4] = value; + } + + /// + /// Gets or sets the money. + /// + public ulong Money + { + get => ReadUInt64BigEndian(this._data[5..]); + set => WriteUInt64BigEndian(this._data[5..], value); + } + + /// + /// Performs an implicit conversion from a Span of bytes to a . + /// + /// The packet as span. + /// The packet as struct. + public static implicit operator CastleSiegeTributeWithdrawResponseRef(Span packet) => new (packet, false); + + /// + /// Performs an implicit conversion from to a Span of bytes. + /// + /// The packet as struct. + /// The packet as byte span. + public static implicit operator Span(CastleSiegeTributeWithdrawResponseRef packet) => packet._data; +} + + +/// +/// Is sent by the server when: The server notifies the player of which siege side (attacker/defender) they are on. +/// Causes reaction on client side: The client updates the castle siege mini-map accordingly. +/// +public readonly ref struct CastleSiegeJoinSideNotificationRef +{ + private readonly Span _data; + + /// + /// Initializes a new instance of the struct. + /// + /// The underlying data. + public CastleSiegeJoinSideNotificationRef(Span data) + : this(data, true) + { + } + + /// + /// Initializes a new instance of the struct. + /// + /// The underlying data. + /// If set to true, the header data is automatically initialized and written to the underlying span. + private CastleSiegeJoinSideNotificationRef(Span data, bool initialize) + { + this._data = data; + if (initialize) + { + var header = this.Header; + header.Type = HeaderType; + header.Code = Code; + header.Length = (byte)Math.Min(data.Length, Length); + header.SubCode = SubCode; + } + } + + /// + /// Gets the header type of this data packet. + /// + public static byte HeaderType => 0xC1; + + /// + /// Gets the operation code of this data packet. + /// + public static byte Code => 0xB2; + + /// + /// Gets the operation sub-code of this data packet. + /// The is used as a grouping key. + /// + public static byte SubCode => 0x11; + + /// + /// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed. + /// + public static int Length => 5; + + /// + /// Gets the header of this packet. + /// + public C1HeaderWithSubCodeRef Header => new (this._data); + + /// + /// Gets or sets 0 = defender, 1 = attacker, 2 = neutral + /// + public byte Side + { + get => this._data[4]; + set => this._data[4] = value; + } + + /// + /// Performs an implicit conversion from a Span of bytes to a . + /// + /// The packet as span. + /// The packet as struct. + public static implicit operator CastleSiegeJoinSideNotificationRef(Span packet) => new (packet, false); + + /// + /// Performs an implicit conversion from to a Span of bytes. + /// + /// The packet as struct. + /// The packet as byte span. + public static implicit operator Span(CastleSiegeJoinSideNotificationRef packet) => packet._data; +} + + +/// +/// Is sent by the server when: After a guild member of the castle owner requested to toggle a castle gate. +/// Causes reaction on client side: The client shows the result of the gate toggle operation. +/// +public readonly ref struct CastleSiegeGateOperateResponseRef +{ + private readonly Span _data; + + /// + /// Initializes a new instance of the struct. + /// + /// The underlying data. + public CastleSiegeGateOperateResponseRef(Span data) + : this(data, true) + { + } + + /// + /// Initializes a new instance of the struct. + /// + /// The underlying data. + /// If set to true, the header data is automatically initialized and written to the underlying span. + private CastleSiegeGateOperateResponseRef(Span data, bool initialize) + { + this._data = data; + if (initialize) + { + var header = this.Header; + header.Type = HeaderType; + header.Code = Code; + header.Length = (byte)Math.Min(data.Length, Length); + header.SubCode = SubCode; + } + } + + /// + /// Gets the header type of this data packet. + /// + public static byte HeaderType => 0xC1; + + /// + /// Gets the operation code of this data packet. + /// + public static byte Code => 0xB2; + + /// + /// Gets the operation sub-code of this data packet. + /// The is used as a grouping key. + /// + public static byte SubCode => 0x12; + + /// + /// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed. + /// + public static int Length => 7; + + /// + /// Gets the header of this packet. + /// + public C1HeaderWithSubCodeRef Header => new (this._data); + + /// + /// Gets or sets the result. + /// + public byte Result + { + get => this._data[4]; + set => this._data[4] = value; + } + + /// + /// Gets or sets the gate index. + /// + public ushort GateIndex + { + get => ReadUInt16BigEndian(this._data[5..]); + set => WriteUInt16BigEndian(this._data[5..], value); + } + + /// + /// Performs an implicit conversion from a Span of bytes to a . + /// + /// The packet as span. + /// The packet as struct. + public static implicit operator CastleSiegeGateOperateResponseRef(Span packet) => new (packet, false); + + /// + /// Performs an implicit conversion from to a Span of bytes. + /// + /// The packet as struct. + /// The packet as byte span. + public static implicit operator Span(CastleSiegeGateOperateResponseRef packet) => packet._data; +} + + +/// +/// Is sent by the server when: The server updates the state of the castle crown during the siege. +/// Causes reaction on client side: The client updates the crown state display. +/// +public readonly ref struct CastleSiegeCrownStateUpdateRef +{ + private readonly Span _data; + + /// + /// Initializes a new instance of the struct. + /// + /// The underlying data. + public CastleSiegeCrownStateUpdateRef(Span data) + : this(data, true) + { + } + + /// + /// Initializes a new instance of the struct. + /// + /// The underlying data. + /// If set to true, the header data is automatically initialized and written to the underlying span. + private CastleSiegeCrownStateUpdateRef(Span data, bool initialize) + { + this._data = data; + if (initialize) + { + var header = this.Header; + header.Type = HeaderType; + header.Code = Code; + header.Length = (byte)Math.Min(data.Length, Length); + header.SubCode = SubCode; + } + } + + /// + /// Gets the header type of this data packet. + /// + public static byte HeaderType => 0xC1; + + /// + /// Gets the operation code of this data packet. + /// + public static byte Code => 0xB2; + + /// + /// Gets the operation sub-code of this data packet. + /// The is used as a grouping key. + /// + public static byte SubCode => 0x13; + + /// + /// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed. + /// + public static int Length => 5; + + /// + /// Gets the header of this packet. + /// + public C1HeaderWithSubCodeRef Header => new (this._data); + + /// + /// Gets or sets 0 = locked, 1 = available + /// + public byte State + { + get => this._data[4]; + set => this._data[4] = value; + } + + /// + /// Performs an implicit conversion from a Span of bytes to a . + /// + /// The packet as span. + /// The packet as struct. + public static implicit operator CastleSiegeCrownStateUpdateRef(Span packet) => new (packet, false); + + /// + /// Performs an implicit conversion from to a Span of bytes. + /// + /// The packet as struct. + /// The packet as byte span. + public static implicit operator Span(CastleSiegeCrownStateUpdateRef packet) => packet._data; +} + + +/// +/// Is sent by the server when: The server updates the access state of the castle crown during the siege. +/// Causes reaction on client side: The client updates the crown access state and accumulated time display. +/// +public readonly ref struct CastleSiegeCrownAccessStateRef +{ + private readonly Span _data; + + /// + /// Initializes a new instance of the struct. + /// + /// The underlying data. + public CastleSiegeCrownAccessStateRef(Span data) + : this(data, true) + { + } + + /// + /// Initializes a new instance of the struct. + /// + /// The underlying data. + /// If set to true, the header data is automatically initialized and written to the underlying span. + private CastleSiegeCrownAccessStateRef(Span data, bool initialize) + { + this._data = data; + if (initialize) + { + var header = this.Header; + header.Type = HeaderType; + header.Code = Code; + header.Length = (byte)Math.Min(data.Length, Length); + header.SubCode = SubCode; + } + } + + /// + /// Gets the header type of this data packet. + /// + public static byte HeaderType => 0xC1; + + /// + /// Gets the operation code of this data packet. + /// + public static byte Code => 0xB2; + + /// + /// Gets the operation sub-code of this data packet. + /// The is used as a grouping key. + /// + public static byte SubCode => 0x14; + + /// + /// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed. + /// + public static int Length => 9; + + /// + /// Gets the header of this packet. + /// + public C1HeaderWithSubCodeRef Header => new (this._data); + + /// + /// Gets or sets the state. + /// + public byte State + { + get => this._data[4]; + set => this._data[4] = value; + } + + /// + /// Gets or sets the accumulated time ms. + /// + public uint AccumulatedTimeMs + { + get => ReadUInt32BigEndian(this._data[5..]); + set => WriteUInt32BigEndian(this._data[5..], value); + } + + /// + /// Performs an implicit conversion from a Span of bytes to a . + /// + /// The packet as span. + /// The packet as struct. + public static implicit operator CastleSiegeCrownAccessStateRef(Span packet) => new (packet, false); + + /// + /// Performs an implicit conversion from to a Span of bytes. + /// + /// The packet as struct. + /// The packet as byte span. + public static implicit operator Span(CastleSiegeCrownAccessStateRef packet) => packet._data; +} + + +/// +/// Is sent by the server when: The server sends information about a castle siege switch (e.g., life stone activation). +/// Causes reaction on client side: The client updates the switch state display. +/// +public readonly ref struct CastleSiegeSwitchInfoRef +{ + private readonly Span _data; + + /// + /// Initializes a new instance of the struct. + /// + /// The underlying data. + public CastleSiegeSwitchInfoRef(Span data) + : this(data, true) + { + } + + /// + /// Initializes a new instance of the struct. + /// + /// The underlying data. + /// If set to true, the header data is automatically initialized and written to the underlying span. + private CastleSiegeSwitchInfoRef(Span data, bool initialize) + { + this._data = data; + if (initialize) + { + var header = this.Header; + header.Type = HeaderType; + header.Code = Code; + header.Length = (byte)Math.Min(data.Length, Length); + header.SubCode = SubCode; + } + } + + /// + /// Gets the header type of this data packet. + /// + public static byte HeaderType => 0xC1; + + /// + /// Gets the operation code of this data packet. + /// + public static byte Code => 0xB2; + + /// + /// Gets the operation sub-code of this data packet. + /// The is used as a grouping key. + /// + public static byte SubCode => 0x15; + + /// + /// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed. + /// + public static int Length => 29; + + /// + /// Gets the header of this packet. + /// + public C1HeaderWithSubCodeRef Header => new (this._data); + + /// + /// Gets or sets the switch index. + /// + public ushort SwitchIndex + { + get => ReadUInt16BigEndian(this._data[4..]); + set => WriteUInt16BigEndian(this._data[4..], value); + } + + /// + /// Gets or sets the switch id. + /// + public byte SwitchId + { + get => this._data[6]; + set => this._data[6] = value; + } + + /// + /// Gets or sets the state. + /// + public byte State + { + get => this._data[7]; + set => this._data[7] = value; + } + + /// + /// Gets or sets the join side. + /// + public byte JoinSide + { + get => this._data[8]; + set => this._data[8] = value; + } + + /// + /// Gets or sets the guild name. + /// + public string GuildName + { + get => this._data.ExtractString(9, 9, System.Text.Encoding.UTF8); + set => this._data.Slice(9, 9).WriteString(value, System.Text.Encoding.UTF8); + } + + /// + /// Gets or sets the user name. + /// + public string UserName + { + get => this._data.ExtractString(18, 11, System.Text.Encoding.UTF8); + set => this._data.Slice(18, 11).WriteString(value, System.Text.Encoding.UTF8); + } + + /// + /// Performs an implicit conversion from a Span of bytes to a . + /// + /// The packet as span. + /// The packet as struct. + public static implicit operator CastleSiegeSwitchInfoRef(Span packet) => new (packet, false); + + /// + /// Performs an implicit conversion from to a Span of bytes. + /// + /// The packet as struct. + /// The packet as byte span. + public static implicit operator Span(CastleSiegeSwitchInfoRef packet) => packet._data; +} + + +/// +/// Is sent by the server when: The server notifies all players that the castle ownership has changed. +/// Causes reaction on client side: The client shows the new castle owner guild name. +/// +public readonly ref struct CastleSiegeOwnershipChangeNotificationRef +{ + private readonly Span _data; + + /// + /// Initializes a new instance of the struct. + /// + /// The underlying data. + public CastleSiegeOwnershipChangeNotificationRef(Span data) + : this(data, true) + { + } + + /// + /// Initializes a new instance of the struct. + /// + /// The underlying data. + /// If set to true, the header data is automatically initialized and written to the underlying span. + private CastleSiegeOwnershipChangeNotificationRef(Span data, bool initialize) + { + this._data = data; + if (initialize) + { + var header = this.Header; + header.Type = HeaderType; + header.Code = Code; + header.Length = (byte)Math.Min(data.Length, Length); + header.SubCode = SubCode; + } + } + + /// + /// Gets the header type of this data packet. + /// + public static byte HeaderType => 0xC1; + + /// + /// Gets the operation code of this data packet. + /// + public static byte Code => 0xB2; + + /// + /// Gets the operation sub-code of this data packet. + /// The is used as a grouping key. + /// + public static byte SubCode => 0x16; + + /// + /// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed. + /// + public static int Length => 12; + + /// + /// Gets the header of this packet. + /// + public C1HeaderWithSubCodeRef Header => new (this._data); + + /// + /// Gets or sets the guild name. + /// + public string GuildName + { + get => this._data.ExtractString(4, 8, System.Text.Encoding.UTF8); + set => this._data.Slice(4, 8).WriteString(value, System.Text.Encoding.UTF8); + } + + /// + /// Performs an implicit conversion from a Span of bytes to a . + /// + /// The packet as span. + /// The packet as struct. + public static implicit operator CastleSiegeOwnershipChangeNotificationRef(Span packet) => new (packet, false); + + /// + /// Performs an implicit conversion from to a Span of bytes. + /// + /// The packet as struct. + /// The packet as byte span. + public static implicit operator Span(CastleSiegeOwnershipChangeNotificationRef packet) => packet._data; +} + + +/// +/// Is sent by the server when: The server notifies all players that the castle siege battle has started or ended. +/// Causes reaction on client side: The client updates the siege state accordingly. +/// +public readonly ref struct CastleSiegeBattleStartEndRef +{ + private readonly Span _data; + + /// + /// Initializes a new instance of the struct. + /// + /// The underlying data. + public CastleSiegeBattleStartEndRef(Span data) + : this(data, true) + { + } + + /// + /// Initializes a new instance of the struct. + /// + /// The underlying data. + /// If set to true, the header data is automatically initialized and written to the underlying span. + private CastleSiegeBattleStartEndRef(Span data, bool initialize) + { + this._data = data; + if (initialize) + { + var header = this.Header; + header.Type = HeaderType; + header.Code = Code; + header.Length = (byte)Math.Min(data.Length, Length); + header.SubCode = SubCode; + } + } + + /// + /// Gets the header type of this data packet. + /// + public static byte HeaderType => 0xC1; + + /// + /// Gets the operation code of this data packet. + /// + public static byte Code => 0xB2; + + /// + /// Gets the operation sub-code of this data packet. + /// The is used as a grouping key. + /// + public static byte SubCode => 0x17; + + /// + /// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed. + /// + public static int Length => 5; + + /// + /// Gets the header of this packet. + /// + public C1HeaderWithSubCodeRef Header => new (this._data); + + /// + /// Gets or sets the is started. + /// + public bool IsStarted + { + get => this._data[4..].GetBoolean(); + set => this._data[4..].SetBoolean(value); + } + + /// + /// Performs an implicit conversion from a Span of bytes to a . + /// + /// The packet as span. + /// The packet as struct. + public static implicit operator CastleSiegeBattleStartEndRef(Span packet) => new (packet, false); + + /// + /// Performs an implicit conversion from to a Span of bytes. + /// + /// The packet as struct. + /// The packet as byte span. + public static implicit operator Span(CastleSiegeBattleStartEndRef packet) => packet._data; +} + + +/// +/// Is sent by the server when: The server sends the remaining siege time. +/// Causes reaction on client side: The client updates the remaining siege time display. +/// +public readonly ref struct CastleSiegeRemainingTimeRef +{ + private readonly Span _data; + + /// + /// Initializes a new instance of the struct. + /// + /// The underlying data. + public CastleSiegeRemainingTimeRef(Span data) + : this(data, true) + { + } + + /// + /// Initializes a new instance of the struct. + /// + /// The underlying data. + /// If set to true, the header data is automatically initialized and written to the underlying span. + private CastleSiegeRemainingTimeRef(Span data, bool initialize) + { + this._data = data; + if (initialize) + { + var header = this.Header; + header.Type = HeaderType; + header.Code = Code; + header.Length = (byte)Math.Min(data.Length, Length); + header.SubCode = SubCode; + } + } + + /// + /// Gets the header type of this data packet. + /// + public static byte HeaderType => 0xC1; + + /// + /// Gets the operation code of this data packet. + /// + public static byte Code => 0xB2; + + /// + /// Gets the operation sub-code of this data packet. + /// The is used as a grouping key. + /// + public static byte SubCode => 0x18; + + /// + /// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed. + /// + public static int Length => 6; + + /// + /// Gets the header of this packet. + /// + public C1HeaderWithSubCodeRef Header => new (this._data); + + /// + /// Gets or sets the hour. + /// + public byte Hour + { + get => this._data[4]; + set => this._data[4] = value; + } + + /// + /// Gets or sets the minute. + /// + public byte Minute + { + get => this._data[5]; + set => this._data[5] = value; + } + + /// + /// Performs an implicit conversion from a Span of bytes to a . + /// + /// The packet as span. + /// The packet as struct. + public static implicit operator CastleSiegeRemainingTimeRef(Span packet) => new (packet, false); + + /// + /// Performs an implicit conversion from to a Span of bytes. + /// + /// The packet as struct. + /// The packet as byte span. + public static implicit operator Span(CastleSiegeRemainingTimeRef packet) => packet._data; +} + + +/// +/// Is sent by the server when: The server sends the current operation state of a castle gate. +/// Causes reaction on client side: The client updates the gate state display. +/// +public readonly ref struct CastleSiegeGateOperateStateRef +{ + private readonly Span _data; + + /// + /// Initializes a new instance of the struct. + /// + /// The underlying data. + public CastleSiegeGateOperateStateRef(Span data) + : this(data, true) + { + } + + /// + /// Initializes a new instance of the struct. + /// + /// The underlying data. + /// If set to true, the header data is automatically initialized and written to the underlying span. + private CastleSiegeGateOperateStateRef(Span data, bool initialize) + { + this._data = data; + if (initialize) + { + var header = this.Header; + header.Type = HeaderType; + header.Code = Code; + header.Length = (byte)Math.Min(data.Length, Length); + header.SubCode = SubCode; + } + } + + /// + /// Gets the header type of this data packet. + /// + public static byte HeaderType => 0xC1; + + /// + /// Gets the operation code of this data packet. + /// + public static byte Code => 0xB2; + + /// + /// Gets the operation sub-code of this data packet. + /// The is used as a grouping key. + /// + public static byte SubCode => 0x19; + + /// + /// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed. + /// + public static int Length => 7; + + /// + /// Gets the header of this packet. + /// + public C1HeaderWithSubCodeRef Header => new (this._data); + + /// + /// Gets or sets the gate index. + /// + public ushort GateIndex + { + get => ReadUInt16BigEndian(this._data[4..]); + set => WriteUInt16BigEndian(this._data[4..], value); + } + + /// + /// Gets or sets the state. + /// + public byte State + { + get => this._data[6]; + set => this._data[6] = value; + } + + /// + /// Performs an implicit conversion from a Span of bytes to a . + /// + /// The packet as span. + /// The packet as struct. + public static implicit operator CastleSiegeGateOperateStateRef(Span packet) => new (packet, false); + + /// + /// Performs an implicit conversion from to a Span of bytes. + /// + /// The packet as struct. + /// The packet as byte span. + public static implicit operator Span(CastleSiegeGateOperateStateRef packet) => packet._data; +} + + +/// +/// Is sent by the server when: The server sends the positions of all players in the castle siege mini map. +/// Causes reaction on client side: The client updates the mini map with the player positions. +/// +public readonly ref struct CastleSiegeMiniMapPlayerPositionsRef +{ + private readonly Span _data; + + /// + /// Initializes a new instance of the struct. + /// + /// The underlying data. + public CastleSiegeMiniMapPlayerPositionsRef(Span data) + : this(data, true) + { + } + + /// + /// Initializes a new instance of the struct. + /// + /// The underlying data. + /// If set to true, the header data is automatically initialized and written to the underlying span. + private CastleSiegeMiniMapPlayerPositionsRef(Span data, bool initialize) + { + this._data = data; + if (initialize) + { + var header = this.Header; + header.Type = HeaderType; + header.Code = Code; + header.Length = (ushort)data.Length; + header.SubCode = SubCode; + } + } + + /// + /// Gets the header type of this data packet. + /// + public static byte HeaderType => 0xC2; + + /// + /// Gets the operation code of this data packet. + /// + public static byte Code => 0xB2; + + /// + /// Gets the operation sub-code of this data packet. + /// The is used as a grouping key. + /// + public static byte SubCode => 0x1A; + + /// + /// Gets the header of this packet. + /// + public C2HeaderWithSubCodeRef Header => new (this._data); + + /// + /// Gets or sets the player count. + /// + public uint PlayerCount + { + get => ReadUInt32BigEndian(this._data[5..]); + set => WriteUInt32BigEndian(this._data[5..], value); + } + + /// + /// Gets the of the specified index. + /// + public MiniMapPlayerPositionRef this[int index] => new (this._data[(9 + index * MiniMapPlayerPositionRef.Length)..]); + + /// + /// Performs an implicit conversion from a Span of bytes to a . + /// + /// The packet as span. + /// The packet as struct. + public static implicit operator CastleSiegeMiniMapPlayerPositionsRef(Span packet) => new (packet, false); + + /// + /// Performs an implicit conversion from to a Span of bytes. + /// + /// The packet as struct. + /// The packet as byte span. + public static implicit operator Span(CastleSiegeMiniMapPlayerPositionsRef packet) => packet._data; + + /// + /// Calculates the size of the packet for the specified count of . + /// + /// The count of from which the size will be calculated. + + public static int GetRequiredSize(int playersCount) => playersCount * MiniMapPlayerPositionRef.Length + 9; + + +/// +/// The position of one player on the mini map.. +/// +public readonly ref struct MiniMapPlayerPositionRef +{ + private readonly Span _data; + + /// + /// Initializes a new instance of the struct. + /// + /// The underlying data. + public MiniMapPlayerPositionRef(Span data) + { + this._data = data; + } + + /// + /// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed. + /// + public static int Length => 2; + + /// + /// Gets or sets the position x. + /// + public byte PositionX + { + get => this._data[0]; + set => this._data[0] = value; + } + + /// + /// Gets or sets the position y. + /// + public byte PositionY + { + get => this._data[1]; + set => this._data[1] = value; + } +} +} + + +/// +/// Is sent by the server when: The server sends the positions of all siege NPCs in the castle siege mini map. +/// Causes reaction on client side: The client updates the mini map with the NPC positions. +/// +public readonly ref struct CastleSiegeMiniMapNpcPositionsRef +{ + private readonly Span _data; + + /// + /// Initializes a new instance of the struct. + /// + /// The underlying data. + public CastleSiegeMiniMapNpcPositionsRef(Span data) + : this(data, true) + { + } + + /// + /// Initializes a new instance of the struct. + /// + /// The underlying data. + /// If set to true, the header data is automatically initialized and written to the underlying span. + private CastleSiegeMiniMapNpcPositionsRef(Span data, bool initialize) + { + this._data = data; + if (initialize) + { + var header = this.Header; + header.Type = HeaderType; + header.Code = Code; + header.Length = (ushort)data.Length; + header.SubCode = SubCode; + } + } + + /// + /// Gets the header type of this data packet. + /// + public static byte HeaderType => 0xC2; + + /// + /// Gets the operation code of this data packet. + /// + public static byte Code => 0xB2; + + /// + /// Gets the operation sub-code of this data packet. + /// The is used as a grouping key. + /// + public static byte SubCode => 0x1B; + + /// + /// Gets the header of this packet. + /// + public C2HeaderWithSubCodeRef Header => new (this._data); + + /// + /// Gets or sets the npc count. + /// + public uint NpcCount + { + get => ReadUInt32BigEndian(this._data[5..]); + set => WriteUInt32BigEndian(this._data[5..], value); + } + + /// + /// Gets the of the specified index. + /// + public MiniMapNpcPositionRef this[int index] => new (this._data[(9 + index * MiniMapNpcPositionRef.Length)..]); + + /// + /// Performs an implicit conversion from a Span of bytes to a . + /// + /// The packet as span. + /// The packet as struct. + public static implicit operator CastleSiegeMiniMapNpcPositionsRef(Span packet) => new (packet, false); + + /// + /// Performs an implicit conversion from to a Span of bytes. + /// + /// The packet as struct. + /// The packet as byte span. + public static implicit operator Span(CastleSiegeMiniMapNpcPositionsRef packet) => packet._data; + + /// + /// Calculates the size of the packet for the specified count of . + /// + /// The count of from which the size will be calculated. + + public static int GetRequiredSize(int npcsCount) => npcsCount * MiniMapNpcPositionRef.Length + 9; + + +/// +/// The position of one NPC on the mini map.. +/// +public readonly ref struct MiniMapNpcPositionRef +{ + private readonly Span _data; + + /// + /// Initializes a new instance of the struct. + /// + /// The underlying data. + public MiniMapNpcPositionRef(Span data) + { + this._data = data; + } + + /// + /// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed. + /// + public static int Length => 3; + + /// + /// Gets or sets the npc type. + /// + public byte NpcType + { + get => this._data[0]; + set => this._data[0] = value; + } + + /// + /// Gets or sets the position x. + /// + public byte PositionX + { + get => this._data[1]; + set => this._data[1] = value; + } + + /// + /// Gets or sets the position y. + /// + public byte PositionY + { + get => this._data[2]; + set => this._data[2] = value; + } +} +} + + +/// +/// Is sent by the server when: The server sends the current state of a castle gate. +/// Causes reaction on client side: The client updates the gate state display. +/// +public readonly ref struct CastleSiegeGateStateRef +{ + private readonly Span _data; + + /// + /// Initializes a new instance of the struct. + /// + /// The underlying data. + public CastleSiegeGateStateRef(Span data) + : this(data, true) + { + } + + /// + /// Initializes a new instance of the struct. + /// + /// The underlying data. + /// If set to true, the header data is automatically initialized and written to the underlying span. + private CastleSiegeGateStateRef(Span data, bool initialize) + { + this._data = data; + if (initialize) + { + var header = this.Header; + header.Type = HeaderType; + header.Code = Code; + header.Length = (byte)Math.Min(data.Length, Length); + header.SubCode = SubCode; + } + } + + /// + /// Gets the header type of this data packet. + /// + public static byte HeaderType => 0xC1; + + /// + /// Gets the operation code of this data packet. + /// + public static byte Code => 0xB3; + + /// + /// Gets the operation sub-code of this data packet. + /// The is used as a grouping key. + /// + public static byte SubCode => 0x00; + + /// + /// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed. + /// + public static int Length => 7; + + /// + /// Gets the header of this packet. + /// + public C1HeaderWithSubCodeRef Header => new (this._data); + + /// + /// Gets or sets the gate index. + /// + public ushort GateIndex + { + get => ReadUInt16BigEndian(this._data[4..]); + set => WriteUInt16BigEndian(this._data[4..], value); + } + + /// + /// Gets or sets the state. + /// + public byte State + { + get => this._data[6]; + set => this._data[6] = value; + } + + /// + /// Performs an implicit conversion from a Span of bytes to a . + /// + /// The packet as span. + /// The packet as struct. + public static implicit operator CastleSiegeGateStateRef(Span packet) => new (packet, false); + + /// + /// Performs an implicit conversion from to a Span of bytes. + /// + /// The packet as struct. + /// The packet as byte span. + public static implicit operator Span(CastleSiegeGateStateRef packet) => packet._data; +} + + +/// +/// Is sent by the server when: After the guild master requested the list of all castle siege statues and gates. +/// Causes reaction on client side: The client shows the list of castle siege NPCs with their current status. +/// +public readonly ref struct CastleSiegeNpcListRef +{ + private readonly Span _data; + + /// + /// Initializes a new instance of the struct. + /// + /// The underlying data. + public CastleSiegeNpcListRef(Span data) + : this(data, true) + { + } + + /// + /// Initializes a new instance of the struct. + /// + /// The underlying data. + /// If set to true, the header data is automatically initialized and written to the underlying span. + private CastleSiegeNpcListRef(Span data, bool initialize) + { + this._data = data; + if (initialize) + { + var header = this.Header; + header.Type = HeaderType; + header.Code = Code; + header.Length = (ushort)data.Length; + header.SubCode = SubCode; + } + } + + /// + /// Gets the header type of this data packet. + /// + public static byte HeaderType => 0xC2; + + /// + /// Gets the operation code of this data packet. + /// + public static byte Code => 0xB3; + + /// + /// Gets the operation sub-code of this data packet. + /// The is used as a grouping key. + /// + public static byte SubCode => 0x02; + + /// + /// Gets the header of this packet. + /// + public C2HeaderWithSubCodeRef Header => new (this._data); + + /// + /// Gets or sets the result. + /// + public byte Result + { + get => this._data[5]; + set => this._data[5] = value; + } + + /// + /// Gets or sets the npc count. + /// + public uint NpcCount + { + get => ReadUInt32BigEndian(this._data[6..]); + set => WriteUInt32BigEndian(this._data[6..], value); + } + + /// + /// Gets the of the specified index. + /// + public CastleSiegeNpcInfoRef this[int index] => new (this._data[(10 + index * CastleSiegeNpcInfoRef.Length)..]); + + /// + /// Performs an implicit conversion from a Span of bytes to a . + /// + /// The packet as span. + /// The packet as struct. + public static implicit operator CastleSiegeNpcListRef(Span packet) => new (packet, false); + + /// + /// Performs an implicit conversion from to a Span of bytes. + /// + /// The packet as struct. + /// The packet as byte span. + public static implicit operator Span(CastleSiegeNpcListRef packet) => packet._data; + + /// + /// Calculates the size of the packet for the specified count of . + /// + /// The count of from which the size will be calculated. + + public static int GetRequiredSize(int npcListCount) => npcListCount * CastleSiegeNpcInfoRef.Length + 10; + + +/// +/// Information about one castle siege NPC (gate or statue).. +/// +public readonly ref struct CastleSiegeNpcInfoRef +{ + private readonly Span _data; + + /// + /// Initializes a new instance of the struct. + /// + /// The underlying data. + public CastleSiegeNpcInfoRef(Span data) + { + this._data = data; + } + + /// + /// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed. + /// + public static int Length => 21; + + /// + /// Gets or sets the npc number. + /// + public uint NpcNumber + { + get => ReadUInt32LittleEndian(this._data); + set => WriteUInt32LittleEndian(this._data, value); + } + + /// + /// Gets or sets the npc index. + /// + public uint NpcIndex + { + get => ReadUInt32LittleEndian(this._data[4..]); + set => WriteUInt32LittleEndian(this._data[4..], value); + } + + /// + /// Gets or sets the defense upgrade level. + /// + public byte DefenseUpgradeLevel + { + get => this._data[8]; + set => this._data[8] = value; + } + + /// + /// Gets or sets the regeneration level. + /// + public byte RegenerationLevel + { + get => this._data[9]; + set => this._data[9] = value; + } + + /// + /// Gets or sets the max hp. + /// + public uint MaxHp + { + get => ReadUInt32LittleEndian(this._data[10..]); + set => WriteUInt32LittleEndian(this._data[10..], value); + } + + /// + /// Gets or sets the current hp. + /// + public uint CurrentHp + { + get => ReadUInt32LittleEndian(this._data[14..]); + set => WriteUInt32LittleEndian(this._data[14..], value); + } + + /// + /// Gets or sets the position x. + /// + public byte PositionX + { + get => this._data[18]; + set => this._data[18] = value; + } + + /// + /// Gets or sets the position y. + /// + public byte PositionY + { + get => this._data[19]; + set => this._data[19] = value; + } + + /// + /// Gets or sets the is alive. + /// + public bool IsAlive + { + get => this._data[20..].GetBoolean(); + set => this._data[20..].SetBoolean(value); + } +} +} + + +/// +/// Is sent by the server when: After the guild master requested the list of guilds registered for the next siege. +/// Causes reaction on client side: The client shows the list of registered guilds and their mark counts. +/// +public readonly ref struct CastleSiegeRegisteredGuildListRef +{ + private readonly Span _data; + + /// + /// Initializes a new instance of the struct. + /// + /// The underlying data. + public CastleSiegeRegisteredGuildListRef(Span data) + : this(data, true) + { + } + + /// + /// Initializes a new instance of the struct. + /// + /// The underlying data. + /// If set to true, the header data is automatically initialized and written to the underlying span. + private CastleSiegeRegisteredGuildListRef(Span data, bool initialize) + { + this._data = data; + if (initialize) + { + var header = this.Header; + header.Type = HeaderType; + header.Code = Code; + header.Length = (ushort)data.Length; + } + } + + /// + /// Gets the header type of this data packet. + /// + public static byte HeaderType => 0xC2; + + /// + /// Gets the operation code of this data packet. + /// + public static byte Code => 0xB4; + + /// + /// Gets the header of this packet. + /// + public C2HeaderRef Header => new (this._data); + + /// + /// Gets or sets the guild count. + /// + public uint GuildCount + { + get => ReadUInt32BigEndian(this._data[4..]); + set => WriteUInt32BigEndian(this._data[4..], value); + } + + /// + /// Gets the of the specified index. + /// + public RegisteredGuildEntryRef this[int index] => new (this._data[(8 + index * RegisteredGuildEntryRef.Length)..]); + + /// + /// Performs an implicit conversion from a Span of bytes to a . + /// + /// The packet as span. + /// The packet as struct. + public static implicit operator CastleSiegeRegisteredGuildListRef(Span packet) => new (packet, false); + + /// + /// Performs an implicit conversion from to a Span of bytes. + /// + /// The packet as struct. + /// The packet as byte span. + public static implicit operator Span(CastleSiegeRegisteredGuildListRef packet) => packet._data; + + /// + /// Calculates the size of the packet for the specified count of . + /// + /// The count of from which the size will be calculated. + + public static int GetRequiredSize(int guildsCount) => guildsCount * RegisteredGuildEntryRef.Length + 8; + + +/// +/// Information about one guild registered for the next castle siege.. +/// +public readonly ref struct RegisteredGuildEntryRef +{ + private readonly Span _data; + + /// + /// Initializes a new instance of the struct. + /// + /// The underlying data. + public RegisteredGuildEntryRef(Span data) + { + this._data = data; + } + + /// + /// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed. + /// + public static int Length => 17; + + /// + /// Gets or sets the guild name. + /// + public string GuildName + { + get => this._data.ExtractString(0, 8, System.Text.Encoding.UTF8); + set => this._data.Slice(0, 8).WriteString(value, System.Text.Encoding.UTF8); + } + + /// + /// Gets or sets the guild mark count. + /// + public uint GuildMarkCount + { + get => ReadUInt32BigEndian(this._data[8..]); + set => WriteUInt32BigEndian(this._data[8..], value); + } + + /// + /// Gets or sets the registration id. + /// + public uint RegistrationId + { + get => ReadUInt32BigEndian(this._data[12..]); + set => WriteUInt32BigEndian(this._data[12..], value); + } + + /// + /// Gets or sets the is castle owner. + /// + public bool IsCastleOwner + { + get => this._data[16..].GetBoolean(); + set => this._data[16..].SetBoolean(value); + } +} +} + + +/// +/// Is sent by the server when: After the guild master requested the list of all guilds in the current castle siege. +/// Causes reaction on client side: The client shows the list of guilds participating in the castle siege. +/// +public readonly ref struct CastleSiegeGuildListRef +{ + private readonly Span _data; + + /// + /// Initializes a new instance of the struct. + /// + /// The underlying data. + public CastleSiegeGuildListRef(Span data) + : this(data, true) + { + } + + /// + /// Initializes a new instance of the struct. + /// + /// The underlying data. + /// If set to true, the header data is automatically initialized and written to the underlying span. + private CastleSiegeGuildListRef(Span data, bool initialize) + { + this._data = data; + if (initialize) + { + var header = this.Header; + header.Type = HeaderType; + header.Code = Code; + header.Length = (ushort)data.Length; + } + } + + /// + /// Gets the header type of this data packet. + /// + public static byte HeaderType => 0xC2; + + /// + /// Gets the operation code of this data packet. + /// + public static byte Code => 0xB5; + + /// + /// Gets the header of this packet. + /// + public C2HeaderRef Header => new (this._data); + + /// + /// Gets or sets the result. + /// + public byte Result + { + get => this._data[4]; + set => this._data[4] = value; + } + + /// + /// Gets or sets the guild count. + /// + public uint GuildCount + { + get => ReadUInt32BigEndian(this._data[5..]); + set => WriteUInt32BigEndian(this._data[5..], value); + } + + /// + /// Gets the of the specified index. + /// + public CastleSiegeGuildEntryRef this[int index] => new (this._data[(9 + index * CastleSiegeGuildEntryRef.Length)..]); + + /// + /// Performs an implicit conversion from a Span of bytes to a . + /// + /// The packet as span. + /// The packet as struct. + public static implicit operator CastleSiegeGuildListRef(Span packet) => new (packet, false); + + /// + /// Performs an implicit conversion from to a Span of bytes. + /// + /// The packet as struct. + /// The packet as byte span. + public static implicit operator Span(CastleSiegeGuildListRef packet) => packet._data; + + /// + /// Calculates the size of the packet for the specified count of . + /// + /// The count of from which the size will be calculated. + + public static int GetRequiredSize(int guildsCount) => guildsCount * CastleSiegeGuildEntryRef.Length + 9; + + +/// +/// Information about one guild in the castle siege.. +/// +public readonly ref struct CastleSiegeGuildEntryRef +{ + private readonly Span _data; + + /// + /// Initializes a new instance of the struct. + /// + /// The underlying data. + public CastleSiegeGuildEntryRef(Span data) + { + this._data = data; + } + + /// + /// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed. + /// + public static int Length => 14; + + /// + /// Gets or sets 0 = defender, 1 = attacker + /// + public byte Side + { + get => this._data[0]; + set => this._data[0] = value; + } + + /// + /// Gets or sets the is involved. + /// + public bool IsInvolved + { + get => this._data[1..].GetBoolean(); + set => this._data[1..].SetBoolean(value); + } + + /// + /// Gets or sets the guild name. + /// + public string GuildName + { + get => this._data.ExtractString(2, 8, System.Text.Encoding.UTF8); + set => this._data.Slice(2, 8).WriteString(value, System.Text.Encoding.UTF8); + } + + /// + /// Gets or sets the score. + /// + public uint Score + { + get => ReadUInt32BigEndian(this._data[10..]); + set => WriteUInt32BigEndian(this._data[10..], value); + } +} +} + + +/// +/// Is sent by the server when: After the player fired a siege machine (catapult). +/// Causes reaction on client side: The client shows the catapult animation toward the target area. +/// +public readonly ref struct CastleSiegeMachineUseResultRef +{ + private readonly Span _data; + + /// + /// Initializes a new instance of the struct. + /// + /// The underlying data. + public CastleSiegeMachineUseResultRef(Span data) + : this(data, true) + { + } + + /// + /// Initializes a new instance of the struct. + /// + /// The underlying data. + /// If set to true, the header data is automatically initialized and written to the underlying span. + private CastleSiegeMachineUseResultRef(Span data, bool initialize) + { + this._data = data; + if (initialize) + { + var header = this.Header; + header.Type = HeaderType; + header.Code = Code; + header.Length = (byte)Math.Min(data.Length, Length); + header.SubCode = SubCode; + } + } + + /// + /// Gets the header type of this data packet. + /// + public static byte HeaderType => 0xC1; + + /// + /// Gets the operation code of this data packet. + /// + public static byte Code => 0xB7; + + /// + /// Gets the operation sub-code of this data packet. + /// The is used as a grouping key. + /// + public static byte SubCode => 0x01; + + /// + /// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed. + /// + public static int Length => 8; + + /// + /// Gets the header of this packet. + /// + public C1HeaderWithSubCodeRef Header => new (this._data); + + /// + /// Gets or sets the npc index. + /// + public ushort NpcIndex + { + get => ReadUInt16BigEndian(this._data[4..]); + set => WriteUInt16BigEndian(this._data[4..], value); + } + + /// + /// Gets or sets the target x. + /// + public byte TargetX + { + get => this._data[6]; + set => this._data[6] = value; + } + + /// + /// Gets or sets the target y. + /// + public byte TargetY + { + get => this._data[7]; + set => this._data[7] = value; + } + + /// + /// Performs an implicit conversion from a Span of bytes to a . + /// + /// The packet as span. + /// The packet as struct. + public static implicit operator CastleSiegeMachineUseResultRef(Span packet) => new (packet, false); + + /// + /// Performs an implicit conversion from to a Span of bytes. + /// + /// The packet as struct. + /// The packet as byte span. + public static implicit operator Span(CastleSiegeMachineUseResultRef packet) => packet._data; +} + + +/// +/// Is sent by the server when: The server notifies the player of the impact region of a siege machine. +/// Causes reaction on client side: The client shows the impact area effect. +/// +public readonly ref struct CastleSiegeMachineRegionNotifyRef +{ + private readonly Span _data; + + /// + /// Initializes a new instance of the struct. + /// + /// The underlying data. + public CastleSiegeMachineRegionNotifyRef(Span data) + : this(data, true) + { + } + + /// + /// Initializes a new instance of the struct. + /// + /// The underlying data. + /// If set to true, the header data is automatically initialized and written to the underlying span. + private CastleSiegeMachineRegionNotifyRef(Span data, bool initialize) + { + this._data = data; + if (initialize) + { + var header = this.Header; + header.Type = HeaderType; + header.Code = Code; + header.Length = (byte)Math.Min(data.Length, Length); + header.SubCode = SubCode; + } + } + + /// + /// Gets the header type of this data packet. + /// + public static byte HeaderType => 0xC1; + + /// + /// Gets the operation code of this data packet. + /// + public static byte Code => 0xB7; + + /// + /// Gets the operation sub-code of this data packet. + /// The is used as a grouping key. + /// + public static byte SubCode => 0x02; + + /// + /// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed. + /// + public static int Length => 6; + + /// + /// Gets the header of this packet. + /// + public C1HeaderWithSubCodeRef Header => new (this._data); + + /// + /// Gets or sets the target x. + /// + public byte TargetX + { + get => this._data[4]; + set => this._data[4] = value; + } + + /// + /// Gets or sets the target y. + /// + public byte TargetY + { + get => this._data[5]; + set => this._data[5] = value; + } + + /// + /// Performs an implicit conversion from a Span of bytes to a . + /// + /// The packet as span. + /// The packet as struct. + public static implicit operator CastleSiegeMachineRegionNotifyRef(Span packet) => new (packet, false); + + /// + /// Performs an implicit conversion from to a Span of bytes. + /// + /// The packet as struct. + /// The packet as byte span. + public static implicit operator Span(CastleSiegeMachineRegionNotifyRef packet) => packet._data; +} + + +/// +/// Is sent by the server when: The server sends the siege machine interface to a player who is operating the machine. +/// Causes reaction on client side: The client shows the siege machine operation interface. +/// +public readonly ref struct CastleSiegeMachineInterfaceRef +{ + private readonly Span _data; + + /// + /// Initializes a new instance of the struct. + /// + /// The underlying data. + public CastleSiegeMachineInterfaceRef(Span data) + : this(data, true) + { + } + + /// + /// Initializes a new instance of the struct. + /// + /// The underlying data. + /// If set to true, the header data is automatically initialized and written to the underlying span. + private CastleSiegeMachineInterfaceRef(Span data, bool initialize) + { + this._data = data; + if (initialize) + { + var header = this.Header; + header.Type = HeaderType; + header.Code = Code; + header.Length = (byte)Math.Min(data.Length, Length); + header.SubCode = SubCode; + } + } + + /// + /// Gets the header type of this data packet. + /// + public static byte HeaderType => 0xC1; + + /// + /// Gets the operation code of this data packet. + /// + public static byte Code => 0xB7; + + /// + /// Gets the operation sub-code of this data packet. + /// The is used as a grouping key. + /// + public static byte SubCode => 0x03; + + /// + /// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed. + /// + public static int Length => 5; + + /// + /// Gets the header of this packet. + /// + public C1HeaderWithSubCodeRef Header => new (this._data); + + /// + /// Gets or sets the machine type. + /// + public byte MachineType + { + get => this._data[4]; + set => this._data[4] = value; + } + + /// + /// Performs an implicit conversion from a Span of bytes to a . + /// + /// The packet as span. + /// The packet as struct. + public static implicit operator CastleSiegeMachineInterfaceRef(Span packet) => new (packet, false); + + /// + /// Performs an implicit conversion from to a Span of bytes. + /// + /// The packet as struct. + /// The packet as byte span. + public static implicit operator Span(CastleSiegeMachineInterfaceRef packet) => packet._data; +} + + +/// +/// Is sent by the server when: The server sends the current state of the castle life stone. +/// Causes reaction on client side: The client updates the life stone state display. +/// +public readonly ref struct CastleSiegeLifeStoneStateRef +{ + private readonly Span _data; + + /// + /// Initializes a new instance of the struct. + /// + /// The underlying data. + public CastleSiegeLifeStoneStateRef(Span data) + : this(data, true) + { + } + + /// + /// Initializes a new instance of the struct. + /// + /// The underlying data. + /// If set to true, the header data is automatically initialized and written to the underlying span. + private CastleSiegeLifeStoneStateRef(Span data, bool initialize) + { + this._data = data; + if (initialize) + { + var header = this.Header; + header.Type = HeaderType; + header.Code = Code; + header.Length = (byte)Math.Min(data.Length, Length); + header.SubCode = SubCode; + } + } + + /// + /// Gets the header type of this data packet. + /// + public static byte HeaderType => 0xC1; + + /// + /// Gets the operation code of this data packet. + /// + public static byte Code => 0xB7; + + /// + /// Gets the operation sub-code of this data packet. + /// The is used as a grouping key. + /// + public static byte SubCode => 0x05; + + /// + /// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed. + /// + public static int Length => 5; + + /// + /// Gets the header of this packet. + /// + public C1HeaderWithSubCodeRef Header => new (this._data); + + /// + /// Gets or sets the creation stage of the life stone (0 to 4). + /// + public byte State + { + get => this._data[4]; + set => this._data[4] = value; + } + + /// + /// Performs an implicit conversion from a Span of bytes to a . + /// + /// The packet as span. + /// The packet as struct. + public static implicit operator CastleSiegeLifeStoneStateRef(Span packet) => new (packet, false); + + /// + /// Performs an implicit conversion from to a Span of bytes. + /// + /// The packet as struct. + /// The packet as byte span. + public static implicit operator Span(CastleSiegeLifeStoneStateRef packet) => packet._data; +} + + +/// +/// Is sent by the server when: After the client requested the guild logo of the current castle owner. +/// Causes reaction on client side: The client shows the castle owner guild logo. +/// +public readonly ref struct CastleOwnerLogoRef +{ + private readonly Span _data; + + /// + /// Initializes a new instance of the struct. + /// + /// The underlying data. + public CastleOwnerLogoRef(Span data) + : this(data, true) + { + } + + /// + /// Initializes a new instance of the struct. + /// + /// The underlying data. + /// If set to true, the header data is automatically initialized and written to the underlying span. + private CastleOwnerLogoRef(Span data, bool initialize) + { + this._data = data; + if (initialize) + { + var header = this.Header; + header.Type = HeaderType; + header.Code = Code; + header.Length = (byte)Math.Min(data.Length, Length); + header.SubCode = SubCode; + } + } + + /// + /// Gets the header type of this data packet. + /// + public static byte HeaderType => 0xC1; + + /// + /// Gets the operation code of this data packet. + /// + public static byte Code => 0xB9; + + /// + /// Gets the operation sub-code of this data packet. + /// The is used as a grouping key. + /// + public static byte SubCode => 0x02; + + /// + /// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed. + /// + public static int Length => 36; + + /// + /// Gets the header of this packet. + /// + public C1HeaderWithSubCodeRef Header => new (this._data); + + /// + /// Gets or sets the logo. + /// + public Span Logo + { + get => this._data.Slice(4, 32); + } + + /// + /// Performs an implicit conversion from a Span of bytes to a . + /// + /// The packet as span. + /// The packet as struct. + public static implicit operator CastleOwnerLogoRef(Span packet) => new (packet, false); + + /// + /// Performs an implicit conversion from to a Span of bytes. + /// + /// The packet as struct. + /// The packet as byte span. + public static implicit operator Span(CastleOwnerLogoRef packet) => packet._data; +} + + +/// +/// Is sent by the server when: The server sends information about the hunting zone guard configuration. +/// Causes reaction on client side: The client shows the hunting zone entrance configuration. +/// +public readonly ref struct HuntingZoneGuardInfoRef +{ + private readonly Span _data; + + /// + /// Initializes a new instance of the struct. + /// + /// The underlying data. + public HuntingZoneGuardInfoRef(Span data) + : this(data, true) + { + } + + /// + /// Initializes a new instance of the struct. + /// + /// The underlying data. + /// If set to true, the header data is automatically initialized and written to the underlying span. + private HuntingZoneGuardInfoRef(Span data, bool initialize) + { + this._data = data; + if (initialize) + { + var header = this.Header; + header.Type = HeaderType; + header.Code = Code; + header.Length = (byte)Math.Min(data.Length, Length); + header.SubCode = SubCode; + } + } + + /// + /// Gets the header type of this data packet. + /// + public static byte HeaderType => 0xC1; + + /// + /// Gets the operation code of this data packet. + /// + public static byte Code => 0xB9; + + /// + /// Gets the operation sub-code of this data packet. + /// The is used as a grouping key. + /// + public static byte SubCode => 0x03; + + /// + /// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed. + /// + public static int Length => 9; + + /// + /// Gets the header of this packet. + /// + public C1HeaderWithSubCodeRef Header => new (this._data); + + /// + /// Gets or sets the is enabled. + /// + public bool IsEnabled + { + get => this._data[4..].GetBoolean(); + set => this._data[4..].SetBoolean(value); + } + + /// + /// Gets or sets the tax rate. + /// + public uint TaxRate + { + get => ReadUInt32BigEndian(this._data[5..]); + set => WriteUInt32BigEndian(this._data[5..], value); + } + + /// + /// Performs an implicit conversion from a Span of bytes to a . + /// + /// The packet as span. + /// The packet as struct. + public static implicit operator HuntingZoneGuardInfoRef(Span packet) => new (packet, false); + + /// + /// Performs an implicit conversion from to a Span of bytes. + /// + /// The packet as struct. + /// The packet as byte span. + public static implicit operator Span(HuntingZoneGuardInfoRef packet) => packet._data; +} + + +/// +/// Is sent by the server when: After a guild relationship change was processed by the server. +/// Causes reaction on client side: The client shows the result of the guild relationship change request. +/// +public readonly ref struct GuildRelationshipChangeResponseRef +{ + private readonly Span _data; + + /// + /// Initializes a new instance of the struct. + /// + /// The underlying data. + public GuildRelationshipChangeResponseRef(Span data) + : this(data, true) + { + } + + /// + /// Initializes a new instance of the struct. + /// + /// The underlying data. + /// If set to true, the header data is automatically initialized and written to the underlying span. + private GuildRelationshipChangeResponseRef(Span data, bool initialize) + { + this._data = data; + if (initialize) + { + var header = this.Header; + header.Type = HeaderType; + header.Code = Code; + header.Length = (byte)Math.Min(data.Length, Length); + } + } + + /// + /// Gets the header type of this data packet. + /// + public static byte HeaderType => 0xC1; + + /// + /// Gets the operation code of this data packet. + /// + public static byte Code => 0xE6; + + /// + /// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed. + /// + public static int Length => 9; + + /// + /// Gets the header of this packet. + /// + public C1HeaderRef Header => new (this._data); + + /// + /// Gets or sets the result. + /// + public byte Result + { + get => this._data[3]; + set => this._data[3] = value; + } + + /// + /// Gets or sets the relationship type. + /// + public byte RelationshipType + { + get => this._data[4]; + set => this._data[4] = value; + } + + /// + /// Gets or sets the target guild id. + /// + public uint TargetGuildId + { + get => ReadUInt32BigEndian(this._data[5..]); + set => WriteUInt32BigEndian(this._data[5..], value); + } + + /// + /// Performs an implicit conversion from a Span of bytes to a . + /// + /// The packet as span. + /// The packet as struct. + public static implicit operator GuildRelationshipChangeResponseRef(Span packet) => new (packet, false); + + /// + /// Performs an implicit conversion from to a Span of bytes. + /// + /// The packet as struct. + /// The packet as byte span. + public static implicit operator Span(GuildRelationshipChangeResponseRef packet) => packet._data; +} + + +/// +/// Is sent by the server when: After the player requested the alliance list. +/// Causes reaction on client side: The client shows the list of guilds in the alliance. +/// +public readonly ref struct AllianceListRef +{ + private readonly Span _data; + + /// + /// Initializes a new instance of the struct. + /// + /// The underlying data. + public AllianceListRef(Span data) + : this(data, true) + { + } + + /// + /// Initializes a new instance of the struct. + /// + /// The underlying data. + /// If set to true, the header data is automatically initialized and written to the underlying span. + private AllianceListRef(Span data, bool initialize) + { + this._data = data; + if (initialize) + { + var header = this.Header; + header.Type = HeaderType; + header.Code = Code; + header.Length = (ushort)data.Length; + } + } + + /// + /// Gets the header type of this data packet. + /// + public static byte HeaderType => 0xC2; + + /// + /// Gets the operation code of this data packet. + /// + public static byte Code => 0xE9; + + /// + /// Gets the header of this packet. + /// + public C2HeaderRef Header => new (this._data); + + /// + /// Gets or sets the guild count. + /// + public byte GuildCount + { + get => this._data[4]; + set => this._data[4] = value; + } + + /// + /// Gets the of the specified index. + /// + public AllianceGuildEntryRef this[int index] => new (this._data[(5 + index * AllianceGuildEntryRef.Length)..]); + + /// + /// Performs an implicit conversion from a Span of bytes to a . + /// + /// The packet as span. + /// The packet as struct. + public static implicit operator AllianceListRef(Span packet) => new (packet, false); + + /// + /// Performs an implicit conversion from to a Span of bytes. + /// + /// The packet as struct. + /// The packet as byte span. + public static implicit operator Span(AllianceListRef packet) => packet._data; + + /// + /// Calculates the size of the packet for the specified count of . + /// + /// The count of from which the size will be calculated. + + public static int GetRequiredSize(int guildsCount) => guildsCount * AllianceGuildEntryRef.Length + 5; + + +/// +/// Information about one guild in the alliance.. +/// +public readonly ref struct AllianceGuildEntryRef +{ + private readonly Span _data; + + /// + /// Initializes a new instance of the struct. + /// + /// The underlying data. + public AllianceGuildEntryRef(Span data) + { + this._data = data; + } + + /// + /// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed. + /// + public static int Length => 19; + + /// + /// Gets or sets the guild name. + /// + public string GuildName + { + get => this._data.ExtractString(0, 8, System.Text.Encoding.UTF8); + set => this._data.Slice(0, 8).WriteString(value, System.Text.Encoding.UTF8); + } + + /// + /// Gets or sets the member count. + /// + public byte MemberCount + { + get => this._data[8]; + set => this._data[8] = value; + } + + /// + /// Gets or sets the guild master name. + /// + public string GuildMasterName + { + get => this._data.ExtractString(9, 10, System.Text.Encoding.UTF8); + set => this._data.Slice(9, 10).WriteString(value, System.Text.Encoding.UTF8); + } +} +}