feat(CS-P2): registration fee (zen) + already-registered guard on Guardsman
This commit is contained in:
@@ -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.
|
||||||
|
|||||||
@@ -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)
|
||||||
|
|||||||
Reference in New Issue
Block a user