71 lines
3.5 KiB
C#

using Milimoe.FunGame.Core.Api.Utility;
using Milimoe.FunGame.Core.Entity;
using Oshima.Core.Constant;
using Oshima.FunGame.OshimaModules.Items;
namespace Oshima.FunGame.OshimaModules
{
public class ItemModule : Milimoe.FunGame.Core.Library.Common.Addon.ItemModule
{
public override string Name => OshimaGameModuleConstant.Item;
public override string Description => OshimaGameModuleConstant.Description;
public override string Version => OshimaGameModuleConstant.Version;
public override string Author => OshimaGameModuleConstant.Author;
public Dictionary<string, Item> KnownItems { get; } = [];
public override Dictionary<string, Item> Items
{
get
{
Dictionary<string, Item> items = Factory.GetGameModuleInstances<Item>(OshimaGameModuleConstant.General, OshimaGameModuleConstant.Item);
if (KnownItems.Count == 0 && items.Count > 0)
{
foreach (string key in items.Keys)
{
KnownItems[key] = items[key];
}
}
return items;
}
}
protected override Factory.EntityFactoryDelegate<Item> ItemFactory()
{
return (id, name, args) =>
{
return id switch
{
(long)AccessoryID.10 => new 10(),
(long)AccessoryID.20 => new 20(),
(long)AccessoryID.30 => new 30(),
(long)AccessoryID.40 => new 40(),
(long)ConsumableID. => new (),
(long)ConsumableID. => new (),
(long)ConsumableID. => new (),
(long)SpecialItemID. => new (),
(long)SpecialItemID. => new (),
(long)SpecialItemID. => new (),
(long)SpecialItemID. => new (),
(long)SpecialItemID. => new (),
(long)SpecialItemID. => new (),
(long)SpecialItemID. => new (),
(long)ConsumableID. => new (),
(long)ConsumableID. => new (),
(long)ConsumableID. => new (),
(long)ConsumableID.1 => new 1(),
(long)ConsumableID.2 => new 2(),
(long)ConsumableID.3 => new 3(),
(long)ConsumableID.1 => new 1(),
(long)ConsumableID.2 => new 2(),
(long)ConsumableID.3 => new 3(),
(long)GiftBoxID. => new (),
(long)GiftBoxID. => new (),
(long)GiftBoxID. => new (),
(long)GiftBoxID. => new (),
_ => null,
};
};
}
}
}