mirror of
https://github.com/sebastian-heinz/Arrowgene.DragonsDogmaOnline
synced 2026-08-03 11:12:41 -04:00
58 lines
1.5 KiB
C#
58 lines
1.5 KiB
C#
using Arrowgene.Ddon.GameServer.Scripting.Interfaces;
|
|
using Arrowgene.Ddon.Shared.Model;
|
|
using System.Collections.Generic;
|
|
|
|
namespace Arrowgene.Ddon.GameServer.Scripting
|
|
{
|
|
public class GameItemModule : GameServerScriptModule
|
|
{
|
|
public override string ModuleRoot => "game_items";
|
|
public override string Filter => "*.csx";
|
|
public override bool ScanSubdirectories => true;
|
|
public override bool EnableHotLoad => true;
|
|
|
|
private Dictionary<ItemId, IGameItem> Items { get; set; }
|
|
|
|
public bool HasItem(ItemId itemId)
|
|
{
|
|
return Items.ContainsKey(itemId);
|
|
}
|
|
|
|
public bool HasItem(uint itemId)
|
|
{
|
|
return HasItem((ItemId)itemId);
|
|
}
|
|
|
|
public IGameItem? GetItemInterface(ItemId itemId)
|
|
{
|
|
if (!Items.ContainsKey(itemId))
|
|
{
|
|
return null;
|
|
}
|
|
return Items[itemId];
|
|
}
|
|
|
|
public IGameItem? GetItemInterface(uint itemId)
|
|
{
|
|
return GetItemInterface((ItemId)itemId);
|
|
}
|
|
|
|
public GameItemModule()
|
|
{
|
|
Items = new Dictionary<ItemId, IGameItem>();
|
|
}
|
|
|
|
public override bool EvaluateResult(string path, object result, IDictionary<string, object> variables)
|
|
{
|
|
if (result == null)
|
|
{
|
|
return false;
|
|
}
|
|
|
|
IGameItem item = (IGameItem)result;
|
|
Items[item.ItemId] = item;
|
|
|
|
return true;
|
|
}
|
|
}
|
|
}
|