diff --git a/src/GameLogic/GameContext.cs b/src/GameLogic/GameContext.cs
index 6abbf3d..96a3a0a 100644
--- a/src/GameLogic/GameContext.cs
+++ b/src/GameLogic/GameContext.cs
@@ -304,6 +304,23 @@ public class GameContext : AsyncDisposable, IGameContext
return miniGameContext;
}
+ ///
+ /// Gets the currently open instance, if any.
+ ///
+ /// The open Heykel Savasi context, or if none is currently open.
+ ///
+ /// ADAMU-CUSTOM: used by to look up the event context
+ /// when a player talks to NPC 560. Mutations of (,
+ /// ) are synchronized via , so this
+ /// read takes the same lock and snapshots the values before searching.
+ ///
+ public async ValueTask GetOpenHeykelSavasiAsync()
+ {
+ using var l = await this._mapInitializerLock.LockAsync().ConfigureAwait(false);
+ return this._miniGames.Values.OfType()
+ .FirstOrDefault(g => g.State == MiniGameState.Open);
+ }
+
///
public async ValueTask RemoveMiniGameAsync(MiniGameContext miniGameContext)
{
diff --git a/src/GameLogic/PlugIns/HeykelSavasiNpcPlugin.cs b/src/GameLogic/PlugIns/HeykelSavasiNpcPlugin.cs
new file mode 100644
index 0000000..e85a897
--- /dev/null
+++ b/src/GameLogic/PlugIns/HeykelSavasiNpcPlugin.cs
@@ -0,0 +1,54 @@
+//
+// Licensed under the MIT License. See LICENSE file in the project root for full license information.
+//
+
+namespace MUnique.OpenMU.GameLogic.PlugIns;
+
+using System.Runtime.InteropServices;
+using MUnique.OpenMU.GameLogic.MiniGames;
+using MUnique.OpenMU.GameLogic.NPC;
+using MUnique.OpenMU.GameLogic.Views;
+using MUnique.OpenMU.GameLogic.Views.MiniGames;
+using MUnique.OpenMU.Interfaces;
+using MUnique.OpenMU.PlugIns;
+
+///
+/// Handles talking to the Heykel Savasi (statue war) NPC (number 560): opens the team-select
+/// panel while the event's registration is open.
+///
+[Guid("80E3B326-474F-45AC-9FA4-3464801AE079")]
+[PlugIn]
+public class HeykelSavasiNpcPlugin : IPlayerTalkToNpcPlugIn
+{
+ ///
+ /// Gets the NPC number of the Heykel Savasi event NPC.
+ ///
+ public static short NpcNumber => 560;
+
+ ///
+ public async ValueTask PlayerTalksToNpcAsync(Player player, NonPlayerCharacter npc, NpcTalkEventArgs eventArgs)
+ {
+ if (npc.Definition.Number != NpcNumber)
+ {
+ return;
+ }
+
+ eventArgs.HasBeenHandled = true;
+ eventArgs.LeavesDialogOpen = false;
+
+ var context = player.GameContext is GameContext gameContext
+ ? await gameContext.GetOpenHeykelSavasiAsync().ConfigureAwait(false)
+ : null;
+ if (context is null)
+ {
+ await player.InvokeViewPlugInAsync(p =>
+ p.ShowMessageAsync("Heykel Savasi su an acik degil.", MessageType.BlueNormal)).ConfigureAwait(false);
+ return;
+ }
+
+ var red = context.TeamCount(HeykelSavasiTeam.Red);
+ var blue = context.TeamCount(HeykelSavasiTeam.Blue);
+ await player.InvokeViewPlugInAsync(p =>
+ p.ShowTeamPanelAsync(red, blue)).ConfigureAwait(false);
+ }
+}