2025-07-07 00:40:45 +08:00

219 lines
8.1 KiB
C#
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

using Milimoe.FunGame.Core.Entity;
using Milimoe.FunGame.Core.Library.Constant;
using Oshima.FunGame.OshimaModules.Skills;
namespace Oshima.FunGame.OshimaModules.Items
{
public class
{
public interface GiftBox
{
public Dictionary<string, int> Gifts { get; set; }
}
public static void Init(Item item, Dictionary<string, int> gifts, int remainUseTimes = 1)
{
if (item is GiftBox box)
{
box.Gifts = gifts;
}
item.Skills.Active = new (item);
item.RemainUseTimes = remainUseTimes;
item.IsInGameItem = false;
item.IsReduceTimesAfterUse = true;
item.IsRemoveAfterUse = true;
}
public static bool OnItemUsed(User user, Item item, int times, Dictionary<string, object> args)
{
string msg = "";
if (item is GiftBox box)
{
}
args["msg"] = msg;
return msg.Trim() != "";
}
}
public class : Item, .GiftBox
{
public override long Id => (long)GiftBoxID.;
public override string Name => "年夜饭";
public override string Description => Skills.Active?.Description ?? "";
public override QualityType QualityType => QualityType.White;
public Dictionary<string, int> Gifts { get; set; } = [];
public (User? user = null, int remainUseTimes = 1) : base(ItemType.GiftBox)
{
User = user;
.Init(this, new()
{
{ General.GameplayEquilibriumConstant.InGameCurrency, 100000 },
{ General.GameplayEquilibriumConstant.InGameMaterial, 2000 },
{ new ().Name, 20 },
{ new ().Name, 20 },
{ new ().Name, 10 },
{ new ().Name, 20 },
{ new ().Name, 5 },
{ new 3().Name, 5 },
{ new 3().Name, 5 }
}, remainUseTimes);
}
protected override bool OnItemUsed(User user, int times, Dictionary<string, object> args)
{
return .OnItemUsed(user, this, times, args);
}
}
public class : Item, .GiftBox
{
public override long Id => (long)GiftBoxID.;
public override string Name => "蛇年大吉";
public override string Description => Skills.Active?.Description ?? "";
public override QualityType QualityType => QualityType.White;
public Dictionary<string, int> Gifts { get; set; } = [];
public (User? user = null, int remainUseTimes = 1) : base(ItemType.GiftBox)
{
User = user;
.Init(this, new()
{
{ General.GameplayEquilibriumConstant.InGameCurrency, 88888 },
{ General.GameplayEquilibriumConstant.InGameMaterial, 888 },
{ new ().Name, 20 },
{ new ().Name, 10 },
{ new ().Name, 5 },
{ new ().Name, 3 },
{ new ().Name, 20 },
{ new ().Name, 10 },
{ new ().Name, 3 },
{ new ().Name, 20 }
}, remainUseTimes);
}
protected override bool OnItemUsed(User user, int times, Dictionary<string, object> args)
{
return .OnItemUsed(user, this, times, args);
}
}
public class : Item, .GiftBox
{
public override long Id => (long)GiftBoxID.;
public override string Name => "新春快乐";
public override string Description => Skills.Active?.Description ?? "";
public override QualityType QualityType => QualityType.White;
public Dictionary<string, int> Gifts { get; set; } = [];
public (User? user = null, int remainUseTimes = 1) : base(ItemType.GiftBox)
{
User = user;
.Init(this, new()
{
{ General.GameplayEquilibriumConstant.InGameCurrency, 100000 },
{ General.GameplayEquilibriumConstant.InGameMaterial, 2000 },
{ new ().Name, 20 },
{ new ().Name, 20 },
{ new ().Name, 10 },
{ new ().Name, 20 },
{ new ().Name, 5 },
{ new 3().Name, 5 },
{ new 3().Name, 5 }
}, remainUseTimes);
}
protected override bool OnItemUsed(User user, int times, Dictionary<string, object> args)
{
return .OnItemUsed(user, this, times, args);
}
}
public class : Item, .GiftBox
{
public override long Id => (long)GiftBoxID.;
public override string Name => "毕业礼包";
public override string Description => Skills.Active?.Description ?? "";
public override QualityType QualityType => QualityType.Gold;
public Dictionary<string, int> Gifts { get; set; } = [];
public (User? user = null, int remainUseTimes = 1) : base(ItemType.GiftBox)
{
User = user;
.Init(this, new()
{
{ General.GameplayEquilibriumConstant.InGameCurrency, 294000 },
{ General.GameplayEquilibriumConstant.InGameMaterial, 2660 },
{ new ().Name, 49 },
{ new ().Name, 21 },
{ new ().Name, 6 },
{ new ().Name, 78 },
{ new ().Name, 35 },
{ new ().Name, 10 },
{ new ().Name, 2 },
{ new ().Name, 164 }
}, remainUseTimes);
}
}
public class : Item, .GiftBox
{
public override long Id => (long)GiftBoxID.;
public override string Name => "魔法卡礼包";
public override string Description => Skills.Active?.Description ?? "";
public int Count { get; set; } = 1;
public Dictionary<string, int> Gifts { get; set; } = [];
private const string GiftName = "与礼包同品质、随机属性、随机魔法技能的魔法卡";
public (QualityType type = QualityType.White, int count = 1, User? user = null, int remainUseTimes = 1) : base(ItemType.GiftBox)
{
QualityType = type;
Others.Add("QualityType", (int)type);
Count = count;
Others.Add("Count", count);
User = user;
.Init(this, new()
{
{ GiftName, count }
}, remainUseTimes);
}
protected override void AfterCopy()
{
if (Others.TryGetValue("QualityType", out object? value) && int.TryParse(value.ToString(), out int qualityType))
{
QualityType = (QualityType)qualityType;
}
if (Others.TryGetValue("Count", out value) && int.TryParse(value.ToString(), out int count))
{
Count = count;
Gifts[GiftName] = count;
}
}
}
public class : Skill
{
public override long Id => (long)ItemActiveID.;
public override string Name => "礼包";
public override string Description
{
get
{
if (Item is .GiftBox box && box.Gifts.Count > 0)
{
return "打开后可立即获得:" + string.Join("", box.Gifts.Select(kv => $"{kv.Key} * {kv.Value}"));
}
return "";
}
}
public (Item? item = null) : base(SkillType.Item)
{
Level = 1;
Item = item;
}
}
}