Draft
Conversation
Co-authored-by: sven-n <5238610+sven-n@users.noreply.github.com> Agent-Logs-Url: https://github.com/MUnique/OpenMU/sessions/e52bf91b-bbbe-4854-b5b7-194f4e8580cf
…ix edge cases Co-authored-by: sven-n <5238610+sven-n@users.noreply.github.com> Agent-Logs-Url: https://github.com/MUnique/OpenMU/sessions/e52bf91b-bbbe-4854-b5b7-194f4e8580cf
Copilot
AI
changed the title
[WIP] Implement guild alliance system for Castle Siege
Implement Guild Alliance System
Mar 24, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Implements the foundational guild alliance and hostility system required as a prerequisite for Castle Siege. Multiple guilds can form an alliance under a master guild, with full CRUD lifecycle and transitive hostility support.
Core Server Logic
IGuildServer— Added 8 new methods:CreateAllianceAsync,RemoveAllianceGuildAsync,DisbandAllianceAsync,GetAllianceGuildsAsync,IsAllianceMasterAsync,GetAllianceMasterIdAsync,SetHostilityAsync,GetGuildRelationshipAsync. AddedAllianceGuildEntryandGuildRelationshiptypes.GuildServer— Full implementation. Alliance master is identified by self-referencingAllianceGuildproperty. Max alliance size enforced viaMaxAllianceSize = 5constant. Transitive hostility: if any guild in Alliance A is hostile to any guild in Alliance B, all members across both alliances are considered rivals.GuildPosition— AddedAssistantMastervalue for castle siege NPC management.Publisher & Context
IGuildChangePublisher— AddedAllianceCreatedAsync,AllianceGuildRemovedAsync,AllianceDisbandedAsync.GameServerContext.ForEachAlliancePlayerAsync— Removed the TODO stub; now queriesGuildServer.GetAllianceGuildsAsyncto iterate online players across all guilds in the alliance.Network Packets (Server→Client)
Three new server-to-client packets added to XML, generated structs, ref structs, and
ConnectionExtensions:0xE5GuildRelationshipRequest0xE6GuildRelationshipChangeResult0xE9AllianceListGame Logic & Handlers
GuildRelationshipChangeAction— Validates guild master status, routes join/leave/hostility requests. Alliance join uses aPendingAllianceRequestproperty onPlayerfor the two-step request/response flow (mirroring the guild war pattern).GuildRelationshipChangeHandlerPlugIn(C1 E5),GuildRelationshipChangeResponseHandlerPlugIn(C1 E6),AllianceListRequestHandlerPlugIn(C1 E9),AllianceGroupHandlerPlugIn+RemoveAllianceGuildHandlerPlugIn(C1 EB 01).ShowGuildRelationshipRequestPlugIn,ShowGuildRelationshipChangeResultPlugIn,ShowAllianceListPlugIn.Dapr
Both
GuildChangePublisherandServerClients/GuildServerupdated to implement the new interface methods.Original prompt
This section details on the original issue you should resolve
<issue_title>Guild Alliance System</issue_title>
<issue_description>## Summary
Implement the Guild Alliance system, which allows multiple guilds to form an alliance under an alliance master guild. This is a prerequisite for Castle Siege, where entire alliances participate as a unit. The system also includes guild hostility (rival relationships).
Prerequisites
None — this is the foundational phase.
Background
OpenMU already has partial support for alliances:
Interfaces.GuildhasAllianceGuildandHostilitynavigation properties.DataModel.Entities.GuildextendsInterfaces.GuildwithMembers.IEventPublisher.AllianceMessageAsync.IGameServerContext.ForEachAlliancePlayerAsyncis declared but needs implementation.C1-E6-GuildRelationshipChangeResponse,C1-E9-RequestAllianceList,C1-EB-01-RemoveAllianceGuildRequest.What's missing is the actual server-side CRUD logic for alliances and the corresponding message handlers.
Requirements
1.
IGuildServerExtensions (Interfaces/IGuildServer.cs)Add these methods to the
IGuildServerinterface:Add supporting types:
2.
GuildPositionExtension (Interfaces/GuildPosition.cs)Add
AssistantMastervalue (needed for castle siege NPC management):3.
GuildServerImplementation (GuildServer/GuildServer.cs)Implement the alliance CRUD methods:
CreateAllianceAsync: SetAllianceGuildon both guilds. The requesting guild becomes the alliance master (self-referencingAllianceGuild). The target guild'sAllianceGuildis set to the master. Enforce configurable max alliance size (default 5). Both guild masters must agree (request/response flow similar to guild join).RemoveAllianceGuildAsync: Only the alliance master can remove member guilds. Clear the removed guild'sAllianceGuild.DisbandAllianceAsync: ClearAllianceGuildon all member guilds.GetAllianceGuildsAsync: Find all guilds in the_guildDictionarywhoseGuild.AllianceGuildmatches the given guild's alliance master. Also query the database for offline alliance members.IsAllianceMasterAsync: A guild is the alliance master whenguild.AllianceGuildpoints to itself.GetAllianceMasterIdAsync: Return the runtime uint ID of the alliance master guild.SetHostilityAsync: Set or clearGuild.Hostilityon the requesting guild.GetGuildRelationshipAsync: ReturnUnionif both guilds share the sameAllianceGuild,Rivalif hostility exists (transitively through alliances),Noneotherwise.Hostility transitivity rule: If any guild in Alliance A has
Hostilitypointing to any guild in Alliance B, all members of both alliances are rivals.4.
IGuildChangePublisherExtensions (GuildServer/IGuildChangePublisher.cs)Add methods to broadcast alliance changes to game servers:
Implement in
GuildChangeToGameServerPublisher.cs.5. Player Action (
GameLogic/PlayerActions/Guild/GuildRelationshipChangeAction.cs) — New fileValidates the request:
Calls the appropriate
IGuildServermethod viaIGameServerContext.GuildServer.6. Message Handlers — New files in
GameServer/MessageHandler/Guild/Follow the pattern of existing handlers (e.g.,
GuildRequestHandlerPlugIn.cs):GuildRelationshipChangeHandlerPlugIn: HandlesC1-E5(or the correct headcode for guild relationship requests). Parses the packet, calls `GuildRelationshipC...💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.