Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ The server sends a response with the result.
| 2 | 1 | Byte | 0xE5 | Packet header - packet type identifier |
| 3 | 1 | GuildRelationshipType | | RelationshipType |
| 4 | 1 | GuildRequestType | | RequestType |
| 5 | 2 | ShortLittleEndian | | TargetPlayerId |
| 5 | 2 | ShortBigEndian | | TargetPlayerId |

### GuildRelationshipType Enum

Expand Down
40 changes: 40 additions & 0 deletions docs/Packets/C1-E5-GuildRelationshipRequest_by-server.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# C1 E5 - GuildRelationshipRequest (by server)

## Is sent when

A guild master sent a relationship change request (alliance or hostility) and the server forwards this request to the target guild master.

## Causes the following actions on the client side

The target guild master (receiver of this message) sees the incoming request dialog.

## 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 | 0xE5 | Packet header - packet type identifier |
| 3 | 1 | GuildRelationshipType | | RelationshipType |
| 4 | 1 | GuildRelationshipRequestType | | RequestType |
| 5 | 2 | ShortBigEndian | | SenderId |

### GuildRelationshipType Enum

Describes the relationship type between guilds.

| Value | Name | Description |
|-------|------|-------------|
| 0 | Undefined | The undefined relationship type. |
| 1 | Alliance | The alliance relationship type. |
| 2 | Hostility | The hostility relationship type. |

### GuildRelationshipRequestType Enum

Describes the request type.

| Value | Name | Description |
|-------|------|-------------|
| 0 | Undefined | The undefined request type. |
| 1 | Join | The join type. |
| 2 | Leave | The leave type. |
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ The server sends a response back to the requester. If the guild master agreed, i
| 3 | 1 | GuildRelationshipType | | RelationshipType |
| 4 | 1 | GuildRequestType | | RequestType |
| 5 | 1 | Boolean | | Response |
| 6 | 2 | ShortLittleEndian | | TargetPlayerId |
| 6 | 2 | ShortBigEndian | | TargetPlayerId |

### GuildRelationshipType Enum

Expand Down
69 changes: 69 additions & 0 deletions docs/Packets/C1-E6-GuildRelationshipChangeResult_by-server.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
# C1 E6 - GuildRelationshipChangeResult (by server)

## Is sent when

The result of a guild relationship change request (alliance or hostility) is sent back to the requester.

## Causes the following actions on the client side

The requester sees the result of the relationship change.

## 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 | 0xE6 | Packet header - packet type identifier |
| 3 | 1 | GuildRelationshipType | | RelationshipType |
| 4 | 1 | GuildRelationshipRequestType | | RequestType |
| 5 | 1 | GuildRelationshipChangeResultType | | Result |
| 6 | 2 | ShortBigEndian | | GuildMasterId |

### GuildRelationshipChangeResultType Enum

Defines the result of a guild relationship change request.

| Value | Name | Description |
|-------|------|-------------|
| 0 | Failed | The request failed. |
| 1 | Success | The request was successful. |
| 16 | GuildNotFound | GUILD_ANS_NOTEXIST_GUILD: The guild does not exist. |
| 16 | FailedDuringCastleSiege | GUILD_ANS_UNIONFAIL_BY_CASTLE: Alliance function will be restricted due to the Castle Siege. |
| 17 | NoAuthorization | GUILD_ANS_NOTEXIST_PERMISSION: No authorization to perform this action. |
| 18 | NotExistExtraStatus | GUILD_ANS_NOTEXIST_EXTRA_STATUS: The extra status does not exist. |
| 19 | NotExistExtraType | GUILD_ANS_NOTEXIST_EXTRA_TYPE: The extra type does not exist. |
| 21 | AlreadyInAlliance | GUILD_ANS_EXIST_RELATIONSHIP_UNION: The guild already has an alliance relationship. |
| 22 | AlreadyInHostility | GUILD_ANS_EXIST_RELATIONSHIP_RIVAL: The guild already has a hostility relationship. |
| 23 | GuildAllianceExists | GUILD_ANS_EXIST_UNION: A guild alliance already exists. |
| 24 | HostileGuildExists | GUILD_ANS_EXIST_RIVAL: A hostile guild already exists. |
| 25 | GuildAllianceDoesNotExist | GUILD_ANS_NOTEXIST_UNION: The guild alliance does not exist. |
| 26 | HostileGuildDoesNotExist | GUILD_ANS_NOTEXIST_RIVAL: The hostile guild does not exist. |
| 27 | NotMasterOfGuildAlliance | GUILD_ANS_NOT_UNION_MASTER: The player is not the master of the guild alliance. |
| 28 | NotGuildRival | GUILD_ANS_NOT_GUILD_RIVAL: The guild is not a rival guild. |
| 29 | IncompleteRequirementsToCreateAlliance | GUILD_ANS_CANNOT_BE_UNION_MASTER_GUILD: The requirements to create an alliance are incomplete. |
| 30 | MaximumNumberOfGuildsInAllianceReached | GUILD_ANS_EXCEED_MAX_UNION_MEMBER: The maximum number of guilds in the alliance has been reached. |
| 32 | RequestCancelled | GUILD_ANS_CANCEL_REQUEST: The request has been cancelled. |
| 161 | AllianceMasterNotInGens | GUILD_ANS_UNION_MASTER_NOT_GENS: The alliance master is not in a Gens. |
| 162 | GuildMasterNotInGens | GUILD_ANS_GUILD_MASTER_NOT_GENS: The guild master is not in a Gens. |
| 163 | DifferentGens | GUILD_ANS_UNION_MASTER_DISAGREE_GENS: The alliance master and guild master belong to different Gens. |

### GuildRelationshipType Enum

Describes the relationship type between guilds.

| Value | Name | Description |
|-------|------|-------------|
| 0 | Undefined | The undefined relationship type. |
| 1 | Alliance | The alliance relationship type. |
| 2 | Hostility | The hostility relationship type. |

### GuildRelationshipRequestType Enum

Describes the request type.

| Value | Name | Description |
|-------|------|-------------|
| 0 | Undefined | The undefined request type. |
| 1 | Join | The join type. |
| 2 | Leave | The leave type. |
41 changes: 41 additions & 0 deletions docs/Packets/C1-EB-01-RemoveAllianceGuildResult_by-server.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# C1 EB 01 - RemoveAllianceGuildResult (by server)

## Is sent when

A guild master sent a message to kick the guild from the alliance and it has been processed.

## Causes the following actions on the client side

The list of guilds is updated accordingly.

## 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 | 0xEB | Packet header - packet type identifier |
| 3 | 1 | Byte | 0x01 | Packet header - sub packet type identifier |
| 4 | 1 | Boolean | | Result |
| 5 | 1 | GuildRelationshipRequestType | | RequestType |
| 6 | 1 | GuildRelationshipType | | RelationshipType |

### GuildRelationshipRequestType Enum

Describes the request type.

| Value | Name | Description |
|-------|------|-------------|
| 0 | Undefined | The undefined request type. |
| 1 | Join | The join type. |
| 2 | Leave | The leave type. |

### GuildRelationshipType Enum

Describes the relationship type between guilds.

| Value | Name | Description |
|-------|------|-------------|
| 0 | Undefined | The undefined relationship type. |
| 1 | Alliance | The alliance relationship type. |
| 2 | Hostility | The hostility relationship type. |
1 change: 1 addition & 0 deletions docs/Packets/C1-F3-00-CharacterListExtended_by-server.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ Defines the role of a guild member.
|-------|------|-------------|
| 0 | NormalMember | The member is a normal member without special rights. |
| 32 | BattleMaster | The member is a battle master. |
| 64 | AssistantMaster | The member is the assistant guild master. |
| 128 | GuildMaster | The member is the guild master. |
| 255 | Undefined | The character is not a member, therefore the role is undefined. |

Expand Down
1 change: 1 addition & 0 deletions docs/Packets/C1-F3-00-CharacterList_by-server.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ Defines the role of a guild member.
|-------|------|-------------|
| 0 | NormalMember | The member is a normal member without special rights. |
| 32 | BattleMaster | The member is a battle master. |
| 64 | AssistantMaster | The member is the assistant guild master. |
| 128 | GuildMaster | The member is the guild master. |
| 255 | Undefined | The character is not a member, therefore the role is undefined. |

Expand Down
1 change: 1 addition & 0 deletions docs/Packets/C2-52-GuildList_by-server.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,5 +43,6 @@ Defines the role of a guild member.
|-------|------|-------------|
| 0 | NormalMember | The member is a normal member without special rights. |
| 32 | BattleMaster | The member is a battle master. |
| 64 | AssistantMaster | The member is the assistant guild master. |
| 128 | GuildMaster | The member is the guild master. |
| 255 | Undefined | The character is not a member, therefore the role is undefined. |
1 change: 1 addition & 0 deletions docs/Packets/C2-65-AssignCharacterToGuild_by-server.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,5 +39,6 @@ Defines the role of a guild member.
|-------|------|-------------|
| 0 | NormalMember | The member is a normal member without special rights. |
| 32 | BattleMaster | The member is a battle master. |
| 64 | AssistantMaster | The member is the assistant guild master. |
| 128 | GuildMaster | The member is the guild master. |
| 255 | Undefined | The character is not a member, therefore the role is undefined. |
34 changes: 34 additions & 0 deletions docs/Packets/C2-E9-AllianceList_by-server.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# C2 E9 - AllianceList (by server)

## Is sent when

A player requested the alliance list dialog.

## 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 | 1 | Boolean | | Success |
| 6 | 1 | Byte | | __RivalCount |
| 7 | 1 | Byte | | __UnionCount |
| 8 | AllianceGuildEntry.Length * GuildCount | Array of AllianceGuildEntry | | Guilds |

### AllianceGuildEntry Structure

Contains the data of one alliance guild entry.

Length: 41 Bytes

| Index | Length | Data Type | Value | Description |
|-------|--------|-----------|-------|-------------|
| 0 | 1 | Byte | | MemberCount |
| 1 | 32 | Binary | | Logo |
| 33 | 8 | String | | GuildName |
4 changes: 4 additions & 0 deletions docs/Packets/ServerToClient.md
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,10 @@
* [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 E5 - GuildRelationshipRequest (by server)](C1-E5-GuildRelationshipRequest_by-server.md)
* [C1 E6 - GuildRelationshipChangeResult (by server)](C1-E6-GuildRelationshipChangeResult_by-server.md)
* [C2 E9 - AllianceList (by server)](C2-E9-AllianceList_by-server.md)
* [C1 EB 01 - RemoveAllianceGuildResult (by server)](C1-EB-01-RemoveAllianceGuildResult_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)
Expand Down
40 changes: 40 additions & 0 deletions src/Dapr/GuildServer.Host/GuildChangePublisher.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ namespace MUnique.OpenMU.GuildServer.Host;
using global::Dapr.Client;
using Microsoft.Extensions.Logging;
using MUnique.OpenMU.Interfaces;
using MUnique.OpenMU.Persistence.EntityFramework.Model;
using MUnique.OpenMU.ServerClients;

/// <summary>
Expand Down Expand Up @@ -66,4 +67,43 @@ public async ValueTask AssignGuildToPlayerAsync(byte serverId, string characterN
this._logger.LogError(ex, nameof(this.AssignGuildToPlayerAsync));
}
}

/// <inheritdoc />
public async ValueTask AllianceCreatedAsync(uint masterGuildId, uint memberGuildId)
{
try
{
await this._daprClient.InvokeMethodAsync("pubsub", nameof(IGameServer.AllianceCreatedAsync), (masterGuildId, memberGuildId)).ConfigureAwait(false);
}
catch (Exception ex)
{
this._logger.LogError(ex, nameof(this.AllianceCreatedAsync));
}
}

/// <inheritdoc />
public async ValueTask AllianceDisbandedAsync(uint masterGuildId, uint memberGuildId)
{
try
{
await this._daprClient.InvokeMethodAsync("pubsub", nameof(IGameServer.AllianceDisbandedAsync), (masterGuildId, memberGuildId)).ConfigureAwait(false);
}
catch (Exception ex)
{
this._logger.LogError(ex, nameof(this.AllianceDisbandedAsync));
}
}

/// <inheritdoc />
public async ValueTask GuildHostilityChangedAsync(uint guildIdA, IReadOnlyList<uint> allianceGuildIdsA, uint guildIdB, IReadOnlyList<uint> allianceGuildIdsB, bool created)
{
try
{
await this._daprClient.PublishEventAsync("pubsub", nameof(IGameServer.GuildHostilityChangedAsync), (guildIdA, allianceGuildIdsA, guildIdB, allianceGuildIdsB, created)).ConfigureAwait(false);
}
catch (Exception ex)
{
this._logger.LogError(ex, nameof(this.GuildHostilityChangedAsync));
}
}
}
18 changes: 18 additions & 0 deletions src/Dapr/ServerClients/GameServer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -178,4 +178,22 @@ public async ValueTask<bool> BanPlayerAsync(string playerName)
{
return await this._client.InvokeMethodAsync<string, bool>(this._targetAppId, nameof(this.BanPlayerAsync), playerName).ConfigureAwait(false);
}

/// <inheritdoc />
public async ValueTask AllianceCreatedAsync(uint masterGuildId, uint memberGuildId)
{
await this._client.InvokeMethodAsync(this._targetAppId, nameof(this.AllianceCreatedAsync), (masterGuildId, memberGuildId)).ConfigureAwait(false);
}

/// <inheritdoc />
public async ValueTask AllianceDisbandedAsync(uint masterGuildId, uint memberGuildId)
{
await this._client.InvokeMethodAsync(this._targetAppId, nameof(this.AllianceDisbandedAsync), (masterGuildId, memberGuildId)).ConfigureAwait(false);
}

/// <inheritdoc />
public async ValueTask GuildHostilityChangedAsync(uint guildIdA, IReadOnlyList<uint> allianceGuildIdsA, uint guildIdB, IReadOnlyList<uint> allianceGuildIdsB, bool created)
{
await this._client.InvokeMethodAsync(this._targetAppId, nameof(this.GuildHostilityChangedAsync), (guildIdA, allianceGuildIdsA, guildIdB, allianceGuildIdsB, created)).ConfigureAwait(false);
}
}
Loading
Loading