2024-12-31 12:39:20 -05:00
|
|
|
using Arrowgene.Ddon.GameServer.Scripting.Interfaces;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
|
|
|
|
|
namespace Arrowgene.Ddon.GameServer.Scripting
|
|
|
|
|
{
|
2025-02-03 00:56:57 -05:00
|
|
|
public class ChatCommandModule : GameServerScriptModule
|
2024-12-31 12:39:20 -05:00
|
|
|
{
|
|
|
|
|
public override string ModuleRoot => "chat_commands";
|
|
|
|
|
public override string Filter => "*.csx";
|
|
|
|
|
public override bool ScanSubdirectories => true;
|
|
|
|
|
public override bool EnableHotLoad => true;
|
|
|
|
|
|
|
|
|
|
public Dictionary<string, IChatCommand> Commands { get; private set; } = new Dictionary<string, IChatCommand>();
|
|
|
|
|
|
|
|
|
|
public ChatCommandModule()
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
2025-06-29 02:07:13 -07:00
|
|
|
public override bool EvaluateResult(string path, object result, IDictionary<string, object> variables)
|
2024-12-31 12:39:20 -05:00
|
|
|
{
|
|
|
|
|
if (result == null)
|
|
|
|
|
{
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
2025-06-29 02:07:13 -07:00
|
|
|
IChatCommand command = (IChatCommand)result;
|
2024-12-31 12:39:20 -05:00
|
|
|
if (command != null)
|
|
|
|
|
{
|
|
|
|
|
Commands[command.CommandName.ToLowerInvariant()] = command;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|