ddon-server/Arrowgene.Ddon.GameServer/Scripting/ScriptModule.cs
Paul Campbell 872275e95e feat: Add C# scripting support
- Added Roslyn to the project.
- Added an example of parsing game logic settings from a .csx file.
- Made GameLogicSettings.csx hotloadable.
- Adjusted exp point modifier settings for enemies and quests to be
  hotload friendly.
- Implemented a ScriptModule interface for GameServer scripts.
- Converted extended NPC facilities into scripting .csx files for each
  NPC and made directory hotloadable. New NPC options can be added after
  the server starts without a restart.
2024-12-26 10:38:16 -05:00

34 lines
984 B
C#

using Microsoft.CodeAnalysis.Scripting;
using System.Collections.Generic;
using System.IO;
namespace Arrowgene.Ddon.GameServer.Scripting
{
public abstract class ScriptModule
{
public abstract string ModuleRoot { get; }
public abstract string Filter { get; }
public abstract bool ScanSubdirectories { get; }
public FileSystemWatcher Watcher { get; set; }
public HashSet<string> Scripts { get; set; }
public ScriptModule()
{
Scripts = new HashSet<string>();
}
/// <summary>
/// Options passed into the compilation unit.
/// </summary>
/// <returns></returns>
public abstract ScriptOptions Options();
/// <summary>
/// Evaluates the result returned by the script.
/// </summary>
/// <param name="result"></param>
/// <returns></returns>
public abstract bool EvaluateResult(ScriptState<object> result);
}
}