yuanshen/Yuanshen.Common/Data/Excel/MaterialExcel.cs
wisedev 61cc2055cf First working version of the server
KCP gameserver with packet dispatch, scene streaming, combat, gacha and the
shop, plus a small HTTP server for the login flow and the wish history page.

Game data under assets is pulled out of the client instead of being typed by
hand. The excel tables come from the packed bin container and the spawn points
from the compiled scene scripts.
2026-09-04 02:06:53 +03:00

36 lines
1.1 KiB
C#

using System.Text.Json.Serialization;
using Yuanshen.Common.Data.Excel.Attributes;
namespace Yuanshen.Common.Data.Excel;
public sealed class MaterialItemUse
{
[JsonPropertyName("useOp")] public string UseOp { get; set; } = string.Empty;
[JsonPropertyName("useParam")] public List<string> UseParam { get; set; } = new();
}
[Excel(ExcelType.Material, "MaterialExcelConfigData.json")]
public sealed class MaterialExcel : ExcelItem
{
public const string GainAvatar = "ITEM_USE_GAIN_AVATAR";
[JsonPropertyName("id")] public uint Id { get; set; }
[JsonPropertyName("materialType")] public string MaterialType { get; set; } = string.Empty;
[JsonPropertyName("itemUse")] public List<MaterialItemUse> ItemUse { get; set; } = new();
public override uint ExcelId => Id;
public uint GainedAvatarId
{
get
{
foreach (MaterialItemUse use in ItemUse)
{
if (use.UseOp == GainAvatar && use.UseParam.Count != 0 && uint.TryParse(use.UseParam[0], out uint avatarId))
return avatarId;
}
return 0;
}
}
}