2024-12-26 22:26:23 -05:00
|
|
|
using Arrowgene.Ddon.GameServer.Scripting.Interfaces;
|
2024-08-23 16:49:44 -04:00
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.IO;
|
2024-12-26 22:26:23 -05:00
|
|
|
|
|
|
|
|
namespace Arrowgene.Ddon.GameServer.Scripting
|
|
|
|
|
{
|
2025-02-03 00:56:57 -05:00
|
|
|
public class QuestModule : GameServerScriptModule
|
2024-12-26 22:26:23 -05:00
|
|
|
{
|
|
|
|
|
public override string ModuleRoot => "quests";
|
|
|
|
|
public override string Filter => "*.csx";
|
|
|
|
|
public override bool ScanSubdirectories => true;
|
2025-02-05 00:31:41 -05:00
|
|
|
public override bool EnableHotLoad => true;
|
2024-12-26 22:26:23 -05:00
|
|
|
|
|
|
|
|
public QuestModule()
|
|
|
|
|
{
|
2025-07-03 09:28:21 -04:00
|
|
|
IgnoredScripts.Add("EmblemTrial.csx");
|
2024-12-26 22:26:23 -05:00
|
|
|
}
|
|
|
|
|
|
2025-06-29 02:07:13 -07:00
|
|
|
public override bool EvaluateResult(string path, object result, IDictionary<string, object> variables)
|
2024-12-26 22:26:23 -05:00
|
|
|
{
|
|
|
|
|
if (result == null)
|
|
|
|
|
{
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
2024-08-23 16:49:44 -04:00
|
|
|
if (IgnoredScripts.Contains(Path.GetFileName(path)))
|
|
|
|
|
{
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
2025-06-29 02:07:13 -07:00
|
|
|
IQuest quest = (IQuest)result;
|
2024-12-26 22:26:23 -05:00
|
|
|
if (quest == null)
|
|
|
|
|
{
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Initialize any state required
|
|
|
|
|
quest.Initialize(path);
|
|
|
|
|
|
2025-02-05 00:31:41 -05:00
|
|
|
// TODO: Load quest through a different Mechanism
|
|
|
|
|
LibDdon.LoadQuest(quest);
|
2024-12-26 22:26:23 -05:00
|
|
|
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|