-
Notifications
You must be signed in to change notification settings - Fork 328
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Required for the spectator feature. Added chat commands which are helpful for testing and required for game masters anyway.
- Loading branch information
Showing
9 changed files
with
211 additions
and
4 deletions.
There are no files selected for viewing
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
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
27 changes: 27 additions & 0 deletions
27
src/GameLogic/PlugIns/ChatCommands/HideChatCommandPlugIn.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,27 @@ | ||
using System.Runtime.InteropServices; | ||
using MUnique.OpenMU.PlugIns; | ||
|
||
namespace MUnique.OpenMU.GameLogic.PlugIns.ChatCommands; | ||
|
||
/// <summary> | ||
/// A chat command plugin which handles hide commands. | ||
/// </summary> | ||
[Guid("7CE1CA66-C6B1-4840-9997-EF15C49FAB49")] | ||
[PlugIn("Hide command", "Handles the chat command '/hide'. Hides the own player from others.")] | ||
[ChatCommandHelp(Command, "Hides the own player from others.", CharacterStatus.GameMaster)] | ||
public class HideChatCommandPlugIn : IChatCommandPlugIn | ||
{ | ||
private const string Command = "/hide"; | ||
|
||
/// <inheritdoc /> | ||
public string Key => Command; | ||
|
||
/// <inheritdoc/> | ||
public CharacterStatus MinCharacterStatusRequirement => CharacterStatus.GameMaster; | ||
|
||
/// <inheritdoc /> | ||
public async ValueTask HandleCommandAsync(Player player, string command) | ||
{ | ||
await player.AddInvisibleEffectAsync().ConfigureAwait(false); | ||
} | ||
} |
27 changes: 27 additions & 0 deletions
27
src/GameLogic/PlugIns/ChatCommands/UnHideChatCommandPlugIn.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,27 @@ | ||
using System.Runtime.InteropServices; | ||
using MUnique.OpenMU.PlugIns; | ||
|
||
namespace MUnique.OpenMU.GameLogic.PlugIns.ChatCommands; | ||
|
||
/// <summary> | ||
/// A chat command plugin which handles unhide commands. | ||
/// </summary> | ||
[Guid("0F0ADAC6-88C7-4EC0-94A2-A289173DEDA7")] | ||
[PlugIn("Hide command", "Handles the chat command '/unhide'. Unhides the own player from others.")] | ||
[ChatCommandHelp(Command, "Unhides the own player from others.", CharacterStatus.GameMaster)] | ||
public class UnHideChatCommandPlugIn : IChatCommandPlugIn | ||
{ | ||
private const string Command = "/unhide"; | ||
|
||
/// <inheritdoc /> | ||
public string Key => Command; | ||
|
||
/// <inheritdoc/> | ||
public CharacterStatus MinCharacterStatusRequirement => CharacterStatus.GameMaster; | ||
|
||
/// <inheritdoc /> | ||
public async ValueTask HandleCommandAsync(Player player, string command) | ||
{ | ||
await player.RemoveInvisibleEffectAsync().ConfigureAwait(false); | ||
} | ||
} |
47 changes: 47 additions & 0 deletions
47
src/Persistence/Initialization/Skills/InvisibleEffectInitializer.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,47 @@ | ||
// <copyright file="InvisibleEffectInitializer.cs" company="MUnique"> | ||
// Licensed under the MIT License. See LICENSE file in the project root for full license information. | ||
// </copyright> | ||
|
||
namespace MUnique.OpenMU.Persistence.Initialization.Skills; | ||
|
||
using MUnique.OpenMU.AttributeSystem; | ||
using MUnique.OpenMU.DataModel.Attributes; | ||
using MUnique.OpenMU.DataModel.Configuration; | ||
using MUnique.OpenMU.GameLogic.Attributes; | ||
|
||
/// <summary> | ||
/// Initializer which initializes the invisible effect. | ||
/// </summary> | ||
public class InvisibleEffectInitializer : InitializerBase | ||
{ | ||
/// <summary> | ||
/// Initializes a new instance of the <see cref="InvisibleEffectInitializer"/> class. | ||
/// </summary> | ||
/// <param name="context">The context.</param> | ||
/// <param name="gameConfiguration">The game configuration.</param> | ||
public InvisibleEffectInitializer(IContext context, GameConfiguration gameConfiguration) | ||
: base(context, gameConfiguration) | ||
{ | ||
} | ||
|
||
/// <inheritdoc/> | ||
public override void Initialize() | ||
{ | ||
var magicEffect = this.Context.CreateNew<MagicEffectDefinition>(); | ||
this.GameConfiguration.MagicEffects.Add(magicEffect); | ||
magicEffect.Number = (byte)MagicEffectNumber.Transparency; | ||
magicEffect.Name = "Invisible"; | ||
magicEffect.InformObservers = false; | ||
magicEffect.SendDuration = false; | ||
magicEffect.StopByDeath = false; | ||
magicEffect.Duration = this.Context.CreateNew<PowerUpDefinitionValue>(); | ||
magicEffect.Duration.ConstantValue.Value = (float)TimeSpan.FromDays(1).TotalSeconds; | ||
|
||
var invisibleEffect = this.Context.CreateNew<PowerUpDefinition>(); | ||
magicEffect.PowerUpDefinitions.Add(invisibleEffect); | ||
invisibleEffect.TargetAttribute = Stats.IsInvisible.GetPersistent(this.GameConfiguration); | ||
invisibleEffect.Boost = this.Context.CreateNew<PowerUpDefinitionValue>(); | ||
invisibleEffect.Boost.ConstantValue.Value = 1; | ||
invisibleEffect.Boost.ConstantValue.AggregateType = AggregateType.AddRaw; | ||
} | ||
} |
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