-
Notifications
You must be signed in to change notification settings - Fork 337
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #466 from bernatvadell/feat/bc-start-time
Implement Blood Castle start time system
- Loading branch information
Showing
13 changed files
with
280 additions
and
251 deletions.
There are no files selected for viewing
33 changes: 33 additions & 0 deletions
33
src/GameLogic/PlugIns/ChatCommands/StartBloodCastleEventChatCommandPlugIn.cs
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
// <copyright file="StartBloodCastleEventChatCommandPlugIn.cs" company="MUnique"> | ||
// Licensed under the MIT License. See LICENSE file in the project root for full license information. | ||
// </copyright> | ||
|
||
namespace MUnique.OpenMU.GameLogic.PlugIns.ChatCommands; | ||
|
||
using System.Runtime.InteropServices; | ||
using MUnique.OpenMU.GameLogic.PlugIns.PeriodicTasks; | ||
using MUnique.OpenMU.PlugIns; | ||
|
||
/// <summary> | ||
/// A chat command plugin which handles the startds command. | ||
/// </summary> | ||
[Guid("7177533A-F147-407E-97B0-C4D8E1AC1AF4")] | ||
[PlugIn(nameof(StartBloodCastleEventChatCommandPlugIn), "Handles the chat command '/startbc'. Starts the blood castle event at the next possible time.")] | ||
[ChatCommandHelp(Command, "Starts the blood castle event at the next possible time.", CharacterStatus.GameMaster)] | ||
public class StartBloodCastleEventChatCommandPlugIn : IChatCommandPlugIn | ||
{ | ||
private const string Command = "/startbc"; | ||
|
||
/// <inheritdoc /> | ||
public string Key => Command; | ||
|
||
/// <inheritdoc/> | ||
public CharacterStatus MinCharacterStatusRequirement => CharacterStatus.GameMaster; | ||
|
||
/// <inheritdoc /> | ||
public async ValueTask HandleCommandAsync(Player player, string command) | ||
{ | ||
var bloodCastle = player.GameContext.PlugInManager.GetStrategy<MiniGameType, IPeriodicMiniGameStartPlugIn>(MiniGameType.BloodCastle); | ||
bloodCastle?.ForceStart(); | ||
} | ||
} |
23 changes: 23 additions & 0 deletions
23
src/GameLogic/PlugIns/PeriodicTasks/BloodCastleGameServerState.cs
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
// <copyright file="BloodCastleGameServerState.cs" company="MUnique"> | ||
// Licensed under the MIT License. See LICENSE file in the project root for full license information. | ||
// </copyright> | ||
|
||
namespace MUnique.OpenMU.GameLogic.PlugIns.PeriodicTasks; | ||
|
||
/// <summary> | ||
/// The state of a game server state for a blood castle event. | ||
/// </summary> | ||
public class BloodCastleGameServerState : PeriodicTaskGameServerState | ||
{ | ||
/// <summary> | ||
/// Initializes a new instance of the <see cref="BloodCastleGameServerState"/> class. | ||
/// </summary> | ||
/// <param name="context">The context.</param> | ||
public BloodCastleGameServerState(IGameContext context) | ||
: base(context) | ||
{ | ||
} | ||
|
||
/// <inheritdoc /> | ||
public override string Description => "Blood Castle"; | ||
} |
24 changes: 24 additions & 0 deletions
24
src/GameLogic/PlugIns/PeriodicTasks/BloodCastleStartConfiguration.cs
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
// <copyright file="BloodCastleStartConfiguration.cs" company="MUnique"> | ||
// Licensed under the MIT License. See LICENSE file in the project root for full license information. | ||
// </copyright> | ||
|
||
namespace MUnique.OpenMU.GameLogic.PlugIns.PeriodicTasks; | ||
|
||
/// <summary> | ||
/// The blood castle start configuration. | ||
/// </summary> | ||
public class BloodCastleStartConfiguration : MiniGameStartConfiguration | ||
{ | ||
/// <summary> | ||
/// Gets the default configuration for blood castle. | ||
/// </summary> | ||
public static BloodCastleStartConfiguration Default => | ||
new() | ||
{ | ||
PreStartMessageDelay = TimeSpan.Zero, | ||
EntranceOpenedMessage = "Blood Castle entrance is open and closes in {0} minute(s).", | ||
EntranceClosedMessage = "Blood Castle entrance closed.", | ||
TaskDuration = TimeSpan.FromMinutes(20), | ||
Timetable = GenerateTimeSequence(TimeSpan.FromMinutes(120)).ToList(), | ||
}; | ||
} |
32 changes: 32 additions & 0 deletions
32
src/GameLogic/PlugIns/PeriodicTasks/BloodCastleStartPlugIn.cs
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
// <copyright file="BloodCastleStartPlugIn.cs" company="MUnique"> | ||
// Licensed under the MIT License. See LICENSE file in the project root for full license information. | ||
// </copyright> | ||
|
||
namespace MUnique.OpenMU.GameLogic.PlugIns.PeriodicTasks; | ||
|
||
using System.Runtime.InteropServices; | ||
using MUnique.OpenMU.GameLogic.MiniGames; | ||
using MUnique.OpenMU.PlugIns; | ||
|
||
/// <summary> | ||
/// This plugin enables the start of the blood castle. | ||
/// </summary> | ||
[PlugIn(nameof(BloodCastleStartPlugIn), "Blood Castle event")] | ||
[Guid("95E68C14-AD87-4B3C-AF46-45B8F1C3BC2A")] | ||
public sealed class BloodCastleStartPlugIn : MiniGameStartBasePlugIn<BloodCastleStartConfiguration, BloodCastleGameServerState> | ||
{ | ||
/// <inheritdoc /> | ||
public override MiniGameType Key => MiniGameType.BloodCastle; | ||
|
||
/// <inheritdoc /> | ||
public override object CreateDefaultConfig() | ||
{ | ||
return BloodCastleStartConfiguration.Default; | ||
} | ||
|
||
/// <inheritdoc /> | ||
protected override BloodCastleGameServerState CreateState(IGameContext gameContext) | ||
{ | ||
return new BloodCastleGameServerState(gameContext); | ||
} | ||
} |
This file contains 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
This file contains 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
This file contains 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
Oops, something went wrong.