添加更多礼包

This commit is contained in:
milimoe 2025-12-22 01:34:55 +08:00
parent 26b46741e5
commit 9ec0b848de
Signed by: milimoe
GPG Key ID: 9554D37E4B8991D0
5 changed files with 268 additions and 11 deletions

View File

@ -1,4 +1,5 @@
using Milimoe.FunGame.Core.Entity;
using Milimoe.FunGame.Core.Api.Utility;
using Milimoe.FunGame.Core.Entity;
using Milimoe.FunGame.Core.Library.Constant;
using Oshima.FunGame.OshimaModules.Skills;
@ -163,7 +164,7 @@ namespace Oshima.FunGame.OshimaModules.Items
public class : Item, .GiftBox
{
public override long Id => (long)GiftBoxID.;
public override string Name => "魔法卡礼包";
public override string Name => $"{ItemSet.GetQualityTypeName(QualityType)}魔法卡礼包";
public override string Description => Skills.Active?.Description ?? "";
public int Count { get; set; } = 1;
public Dictionary<string, int> Gifts { get; set; } = [];
@ -201,7 +202,7 @@ namespace Oshima.FunGame.OshimaModules.Items
public override long Id => (long)GiftBoxID.;
public override string Name => "探索助力礼包";
public override string Description => Skills.Active?.Description ?? "";
public override QualityType QualityType => QualityType.Red;
public override QualityType QualityType => QualityType.White;
public Dictionary<string, int> Gifts { get; set; } = [];
public (User? user = null, int remainUseTimes = 1) : base(ItemType.GiftBox)
@ -217,6 +218,115 @@ namespace Oshima.FunGame.OshimaModules.Items
}
}
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, 50000 },
{ General.GameplayEquilibriumConstant.InGameMaterial, 100 },
{ new ().Name, 1 }
}, remainUseTimes);
}
}
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, 50000 }
}, remainUseTimes);
}
}
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, 40000 },
{ General.GameplayEquilibriumConstant.InGameMaterial, 500 },
{ new (QualityType.Orange, 5).Name, 5 }
}, remainUseTimes);
}
}
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, 10000 },
{ General.GameplayEquilibriumConstant.InGameMaterial, 100 },
{ Factory.OpenFactory.GetInstance<Item>(14515, "", []).Name, 1 }
}, 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, 40000 },
{ General.GameplayEquilibriumConstant.InGameMaterial, 500 },
{ new (QualityType.Orange, 5).Name, 5 },
{ new (QualityType.Red, 2).Name, 2 }
}, remainUseTimes);
}
protected override bool OnItemUsed(User user, int times, Dictionary<string, object> args)
{
return .OnItemUsed(user, this, times, args);
}
}
public class : Skill
{
public override long Id => (long)ItemActiveID.;

View File

@ -105,6 +105,12 @@
= 20003,
= 20004,
= 20005,
= 20006
= 20006,
= 20007,
= 20008,
= 20009,
= 20010,
= 20011,
= 20012
}
}

View File

@ -123,6 +123,11 @@ namespace Oshima.FunGame.OshimaModules
(long)GiftBoxID. => new (),
(long)GiftBoxID. => new (),
(long)GiftBoxID. => new (),
(long)GiftBoxID. => new (),
(long)GiftBoxID. => new (),
(long)GiftBoxID. => new (),
(long)GiftBoxID. => new (),
(long)GiftBoxID. => new (),
_ => null,
};
};

View File

@ -1,7 +1,9 @@
using System.Text;
using System.Xml.Linq;
using Milimoe.FunGame.Core.Api.Transmittal;
using Milimoe.FunGame.Core.Api.Utility;
using Milimoe.FunGame.Core.Entity;
using Milimoe.FunGame.Core.Interface.Entity;
using Milimoe.FunGame.Core.Library.Constant;
using Oshima.Core.Constant;
using Oshima.FunGame.OshimaModules.Characters;
@ -67,14 +69,15 @@ namespace Oshima.FunGame.OshimaServers.Service
FunGameConstant.Items.AddRange(exItems.Values.Where(i => (int)i.ItemType > 4));
FunGameConstant.Items.AddRange([new (), new (), new (), new (), new (), new (), new (), new (), new (), new (),
new (), new (), new (), new 1(), new 2(), new 3(), new 1(), new 2(), new 3(), new (), new (), new (), new (),
new 1(), new 2(), new 3(), new (), new (), new (), new (), new (), new (), new (), new (), new ()
new 1(), new 2(), new 3(), new (), new (), new (), new (), new (), new (), new (), new (), new (),
new (), new (), new (), new (), new ()
]);
FunGameConstant.UserDailyItems.AddRange([new (), new (), new (), new (), new (), new (), new (), new (), new (), new (), new (), new (),
new (), new (), new (), new (), new (), new (), new (), new 绿(), new (), new (), new (), new (), new (), new (), new (), new (), new (),
new (), new (), new (), new (), new (), new (), new (), new (), new (), new (), new (), new (), new (), new ()]);
FunGameConstant.NotForSaleItems.AddRange([]);
FunGameConstant.NotForSaleItems.AddRange([new (), new (), new ()]);
FunGameConstant.AllItems.AddRange(FunGameConstant.Equipment);
FunGameConstant.AllItems.AddRange(FunGameConstant.Items);
@ -4271,8 +4274,7 @@ namespace Oshima.FunGame.OshimaServers.Service
return msg;
}
private static string GetStoreString(Store? store, User? user = null, string activity = "")
public static string GetStoreString(Store? store, User? user = null, string activity = "")
{
if (store is null) return "";
@ -4365,7 +4367,7 @@ namespace Oshima.FunGame.OshimaServers.Service
return builder.ToString().Trim();
}
private static string GetGoodsString(Goods goods, User? user = null, string activity = "")
public static string GetGoodsString(Goods goods, User? user = null, string activity = "")
{
StringBuilder builder = new();
builder.AppendLine($"{goods.Id}. {goods.Name}");
@ -4418,6 +4420,135 @@ namespace Oshima.FunGame.OshimaServers.Service
return builder.ToString().Trim();
}
public static string GetItemString(Item item, bool isShowGeneralDescription, bool isShowInStore = false, string activity = "")
{
StringBuilder builder = new();
builder.AppendLine($"【{item.Name}】{(item.IsLock ? " []" : "")}");
string itemquality = ItemSet.GetQualityTypeName(item.QualityType);
string itemtype = ItemSet.GetItemTypeName(item.ItemType) + (item.ItemType == ItemType.Weapon && item.WeaponType != WeaponType.None ? "-" + ItemSet.GetWeaponTypeName(item.WeaponType) : "");
if (itemtype != "") itemtype = $" {itemtype}";
builder.AppendLine($"{itemquality + itemtype}");
if (isShowInStore && item.Price > 0)
{
if (activity != null)
{
builder.Append("售价:");
switch (activity)
{
case "双旦活动":
builder.AppendLine($"{item.Price / 2:0.##} {item.GameplayEquilibriumConstant.InGameCurrency}-50%,原价:{item.Price:0.##} {item.GameplayEquilibriumConstant.InGameCurrency}");
break;
default:
builder.AppendLine($"{item.Price:0.##} {item.GameplayEquilibriumConstant.InGameCurrency}");
break;
}
}
else builder.AppendLine($"售价:{item.Price:0.##} {item.GameplayEquilibriumConstant.InGameCurrency}");
}
else if (item.Price > 0)
{
builder.AppendLine($"回收价:{item.Price:0.##} {item.GameplayEquilibriumConstant.InGameCurrency}");
}
if (item.RemainUseTimes > 0)
{
builder.AppendLine($"{(isShowInStore ? "" : "")}可用次数:{item.RemainUseTimes}");
}
if (isShowInStore)
{
if (item.IsSellable)
{
builder.AppendLine($"购买此物品后可立即出售");
}
if (item.IsTradable)
{
DateTime date = DateTimeUtility.GetTradableTime();
builder.AppendLine($"购买此物品后将在 {date.ToString(General.GeneralDateTimeFormatChinese)} 后可交易");
}
}
else
{
List<string> sellandtrade = [];
bool useRN = false;
if (item.IsLock)
{
sellandtrade.Add("不可出售");
sellandtrade.Add("不可交易");
}
else
{
if (item.IsSellable)
{
sellandtrade.Add("可出售");
}
if (!item.IsSellable && item.NextSellableTime != DateTime.MinValue)
{
useRN = true;
sellandtrade.Add($"此物品将在 {item.NextSellableTime.ToString(General.GeneralDateTimeFormatChinese)} 后可出售");
}
else if (!item.IsSellable)
{
sellandtrade.Add("不可出售");
}
if (item.IsTradable)
{
sellandtrade.Add("可交易");
}
if (!item.IsTradable && item.NextTradableTime != DateTime.MinValue)
{
useRN = true;
sellandtrade.Add($"此物品将在 {item.NextTradableTime.ToString(General.GeneralDateTimeFormatChinese)} 后可交易");
}
else if (!item.IsTradable)
{
sellandtrade.Add("不可交易");
}
}
if (sellandtrade.Count > 0) builder.AppendLine(string.Join(useRN ? "\r\n" : " ", sellandtrade).Trim());
}
if (isShowGeneralDescription && item.GeneralDescription != "")
{
builder.AppendLine("物品描述:" + item.GeneralDescription);
}
else if (item.Description != "")
{
builder.AppendLine("物品描述:" + item.Description);
}
if (item.ItemType == ItemType.MagicCardPack && item.Skills.Magics.Count > 0)
{
builder.AppendLine("== 魔法卡 ==\r\n" + string.Join("\r\n", item.Skills.Magics.Select(m => m.ToString().Trim())));
}
if (item.Skills.Active != null || item.Skills.Passives.Count > 0)
{
builder.AppendLine("== 物品技能 ==");
if (item.Skills.Active != null) builder.AppendLine($"{item.Skills.Active.ToString().Trim()}");
foreach (Skill skill in item.Skills.Passives)
{
builder.AppendLine($"{skill.ToString().Trim()}");
}
}
if (item.BackgroundStory != "")
{
builder.AppendLine($"\"{item.BackgroundStory}\"");
}
return builder.ToString();
}
public static void GenerateForgeResult(User user, ForgeModel model, bool simulate = false)
{
if (model.ForgeMaterials.Count == 0)

View File

@ -8034,15 +8034,20 @@ namespace Oshima.FunGame.WebAPI.Controllers
{
int count = 0;
string itemMsg = "";
string activityName = "";
if (FunGameService.Activities.FirstOrDefault(a => a.Name == "双旦活动") is Activity activity && activity.Status == ActivityState.InProgress)
{
activityName = "双旦活动";
}
foreach (Item item in good.Items)
{
count++;
Item newItem = item.Copy(true);
newItem.Character = user.Inventory.MainCharacter;
if (newItem.ItemType != ItemType.MagicCard) newItem.SetLevel(1);
itemMsg += $"[ {count} ] {newItem.ToString(false, true)}".Trim();
itemMsg += $"[ {count} ] {FunGameService.GetItemString(newItem, false, true, activityName)}".Trim();
}
msg = good.ToString(user).Split("包含物品:")[0].Trim();
msg = FunGameService.GetGoodsString(good, user, activityName).Split("包含物品:")[0].Trim();
int buyCount = 0;
if (user != null)
{