feat(CS-P2): registration fee (zen) + already-registered guard on Guardsman

This commit is contained in:
Acentech Dev
2026-07-15 00:36:20 +03:00
parent 44dcb2fd58
commit 41588bd237
2 changed files with 22 additions and 1 deletions

View File

@@ -25,6 +25,12 @@ public class CastleSiegeConfiguration
/// <summary>Gets or sets how long the siege phase lasts.</summary> /// <summary>Gets or sets how long the siege phase lasts.</summary>
public TimeSpan SiegeDuration { get; set; } = TimeSpan.FromMinutes(10); public TimeSpan SiegeDuration { get; set; } = TimeSpan.FromMinutes(10);
/// <summary>
/// Gets or sets the registration fee (in zen) a guild master must pay to register the guild
/// for the siege. 0 disables the fee.
/// </summary>
public int RegistrationFee { get; set; } = 100000;
/// <summary> /// <summary>
/// Returns true if <paramref name="now"/> falls within a 5-second window of any configured /// Returns true if <paramref name="now"/> falls within a 5-second window of any configured
/// registration-open time. /// registration-open time.

View File

@@ -65,8 +65,23 @@ public class CastleSiegeGuardsmanTalkPlugIn : IPlayerTalkToNpcPlugIn
} }
} }
if (context.RegisteredGuilds.Contains(guildName))
{
await ShowAsync(player, $"Your guild '{guildName}' is already registered for the Castle Siege.").ConfigureAwait(false);
return;
}
var fee = context.Configuration.RegistrationFee;
if (fee > 0 && !player.TryRemoveMoney(fee))
{
await ShowAsync(player, $"You need {fee} zen to register your guild for the Castle Siege.").ConfigureAwait(false);
return;
}
context.RegisterGuild(guildName); context.RegisterGuild(guildName);
await ShowAsync(player, $"Your guild '{guildName}' is registered for the Castle Siege.").ConfigureAwait(false); await ShowAsync(player, fee > 0
? $"Your guild '{guildName}' is registered for the Castle Siege. ({fee} zen paid)"
: $"Your guild '{guildName}' is registered for the Castle Siege.").ConfigureAwait(false);
} }
private static ValueTask ShowAsync(Player player, string text) private static ValueTask ShowAsync(Player player, string text)