mirror of
https://github.com/oshima-studios/OshimaGameModule.git
synced 2025-05-07 19:29:35 +08:00
添加毕业礼包
This commit is contained in:
parent
175682db38
commit
c0477dfde5
@ -130,6 +130,33 @@ 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.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, 290000 },
|
||||
{ General.GameplayEquilibriumConstant.InGameMaterial, 2000 },
|
||||
{ new 升华之印().Name, 33 },
|
||||
{ new 流光之印().Name, 12 },
|
||||
{ new 永恒之印().Name, 2 },
|
||||
{ new 技能卷轴().Name, 76 },
|
||||
{ new 智慧之果().Name, 35 },
|
||||
{ new 奥术符文().Name, 10 },
|
||||
{ new 混沌之核().Name, 2 },
|
||||
{ new 大经验书().Name, 164 }
|
||||
}, remainUseTimes);
|
||||
}
|
||||
}
|
||||
|
||||
public class 礼包技能 : Skill
|
||||
{
|
||||
public override long Id => (long)ItemActiveID.礼包;
|
||||
|
@ -39,6 +39,7 @@
|
||||
{
|
||||
年夜饭 = 20001,
|
||||
蛇年大吉 = 20002,
|
||||
新春快乐 = 20003
|
||||
新春快乐 = 20003,
|
||||
毕业礼包 = 20004
|
||||
}
|
||||
}
|
||||
|
@ -52,6 +52,7 @@ namespace Oshima.FunGame.OshimaModules
|
||||
(long)GiftBoxID.年夜饭 => new 年夜饭(),
|
||||
(long)GiftBoxID.蛇年大吉 => new 蛇年大吉(),
|
||||
(long)GiftBoxID.新春快乐 => new 新春快乐(),
|
||||
(long)GiftBoxID.毕业礼包 => new 毕业礼包(),
|
||||
_ => null,
|
||||
};
|
||||
};
|
||||
|
@ -48,7 +48,7 @@ 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 中回复药(), new 大回复药(), new 魔力填充剂1(), new 魔力填充剂2(), new 魔力填充剂3(), new 能量饮料1(), new 能量饮料2(), new 能量饮料3(), new 年夜饭(), new 蛇年大吉(), new 新春快乐(), new 毕业礼包()]);
|
||||
|
||||
FunGameConstant.AllItems.AddRange(FunGameConstant.Equipment);
|
||||
FunGameConstant.AllItems.AddRange(FunGameConstant.Items);
|
||||
@ -1116,6 +1116,10 @@ namespace Oshima.FunGame.OshimaServers.Service
|
||||
{
|
||||
msg += "\r\n" + "新春纳福,喜乐安康!!";
|
||||
}
|
||||
else if (item.Name == nameof(毕业礼包))
|
||||
{
|
||||
msg += "\r\n" + "咦?!!啊咧!!!";
|
||||
}
|
||||
item.RemainUseTimes--;
|
||||
if (item.RemainUseTimes < 0) item.RemainUseTimes = 0;
|
||||
if (item.RemainUseTimes == 0)
|
||||
|
@ -5023,7 +5023,7 @@ namespace Oshima.FunGame.WebAPI.Controllers
|
||||
}
|
||||
|
||||
[HttpPost("creategiftbox")]
|
||||
public string CreateGiftBox([FromQuery] long? uid = null, [FromQuery] string? name = null)
|
||||
public string CreateGiftBox([FromQuery] long? uid = null, [FromQuery] string? name = null, [FromQuery] bool? checkRepeat = null)
|
||||
{
|
||||
long userid = uid ?? Convert.ToInt64("10" + Verification.CreateVerifyCode(VerifyCodeType.NumberVerifyCode, 11));
|
||||
string itemName = name ?? "";
|
||||
@ -5036,6 +5036,8 @@ namespace Oshima.FunGame.WebAPI.Controllers
|
||||
User user = FunGameService.GetUser(pc);
|
||||
|
||||
if (FunGameConstant.AllItems.FirstOrDefault(i => i.Name == itemName) is Item item)
|
||||
{
|
||||
if (checkRepeat ?? false)
|
||||
{
|
||||
PluginConfig pc2 = new("giftbox", "giftbox");
|
||||
pc2.LoadConfig();
|
||||
@ -5048,7 +5050,12 @@ namespace Oshima.FunGame.WebAPI.Controllers
|
||||
|
||||
if (list.Contains(user.Id))
|
||||
{
|
||||
return NetworkUtility.JsonSerialize($"你已经领取过这个礼包【{itemName}】啦,不能重复领取哦!");
|
||||
return $"你已经领取过这个礼包【{itemName}】啦,不能重复领取哦!";
|
||||
}
|
||||
|
||||
list.Add(user.Id);
|
||||
pc2.Add(itemName, list);
|
||||
pc2.SaveConfig();
|
||||
}
|
||||
|
||||
Item newItem = item.Copy();
|
||||
@ -5058,24 +5065,20 @@ namespace Oshima.FunGame.WebAPI.Controllers
|
||||
user.Inventory.Items.Add(newItem);
|
||||
string msg = $"恭喜你获得礼包【{itemName}】一份!";
|
||||
|
||||
list.Add(user.Id);
|
||||
pc2.Add(itemName, list);
|
||||
pc2.SaveConfig();
|
||||
|
||||
user.LastTime = DateTime.Now;
|
||||
pc.Add("user", user);
|
||||
pc.SaveConfig();
|
||||
|
||||
return NetworkUtility.JsonSerialize(msg);
|
||||
return msg;
|
||||
}
|
||||
else
|
||||
{
|
||||
return NetworkUtility.JsonSerialize("没有找到这个礼包,可能已经过期。");
|
||||
return "没有找到这个礼包,可能已经过期。";
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
return NetworkUtility.JsonSerialize(noSaved);
|
||||
return noSaved;
|
||||
}
|
||||
}
|
||||
|
||||
@ -5168,9 +5171,9 @@ namespace Oshima.FunGame.WebAPI.Controllers
|
||||
int halfdown = user.Inventory.Characters.Count(c => (c.HP / c.MaxHP) < 0.5 && c.HP > 0);
|
||||
int halfup = user.Inventory.Characters.Count(c => (c.HP / c.MaxHP) >= 0.5 && c.HP != c.MaxHP);
|
||||
|
||||
double deadNeed = 10000 * dead;
|
||||
double halfdownNeed = 6000 * halfdown;
|
||||
double halfupNeed = 2000 * halfup;
|
||||
double deadNeed = 3000 * dead;
|
||||
double halfdownNeed = 1500 * halfdown;
|
||||
double halfupNeed = 500 * halfup;
|
||||
double total = deadNeed + halfdownNeed + halfupNeed;
|
||||
|
||||
if (total == 0)
|
||||
@ -5197,9 +5200,9 @@ namespace Oshima.FunGame.WebAPI.Controllers
|
||||
}
|
||||
|
||||
msg += $"({dead} 个死亡角色,{halfdown} 个 50% 以下的角色,{halfup} 个 50% 以上的角色)\r\n" +
|
||||
$"收费标准:\r\n10000 {General.GameplayEquilibriumConstant.InGameCurrency} / 死亡角色\r\n" +
|
||||
$"6000 {General.GameplayEquilibriumConstant.InGameCurrency} / 50% 生命值以下的角色\r\n" +
|
||||
$"2000 {General.GameplayEquilibriumConstant.InGameCurrency} / 50% 生命值以上的角色";
|
||||
$"收费标准:\r\n3000 {General.GameplayEquilibriumConstant.InGameCurrency} / 死亡角色\r\n" +
|
||||
$"1500 {General.GameplayEquilibriumConstant.InGameCurrency} / 50% 生命值以下的角色\r\n" +
|
||||
$"500 {General.GameplayEquilibriumConstant.InGameCurrency} / 50% 生命值以上的角色";
|
||||
|
||||
return msg;
|
||||
}
|
||||
@ -5241,9 +5244,9 @@ namespace Oshima.FunGame.WebAPI.Controllers
|
||||
{
|
||||
FunGameService.Reload();
|
||||
FunGameSimulation.InitFunGameSimulation();
|
||||
return NetworkUtility.JsonSerialize("FunGame已重新加载。");
|
||||
return "FunGame已重新加载。";
|
||||
}
|
||||
return NetworkUtility.JsonSerialize("提供的参数不正确。");
|
||||
return "提供的参数不正确。";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -2005,6 +2005,16 @@ namespace Oshima.FunGame.WebAPI.Services
|
||||
return result;
|
||||
}
|
||||
|
||||
if (e.Detail == "毕业礼包")
|
||||
{
|
||||
string msg = Controller.CreateGiftBox(uid, "毕业礼包");
|
||||
if (msg != "")
|
||||
{
|
||||
await SendAsync(e, "毕业礼包", string.Join("\r\n", msg));
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
if (uid == GeneralSettings.Master && e.Detail.StartsWith("重载FunGame", StringComparison.CurrentCultureIgnoreCase))
|
||||
{
|
||||
string msg = Controller.Relaod(uid);
|
||||
|
Loading…
x
Reference in New Issue
Block a user