添加普攻升级

This commit is contained in:
milimoe 2024-12-26 01:11:00 +08:00
parent bd4bff4a55
commit 76f8eb5918
Signed by: milimoe
GPG Key ID: 05D280912DA6C69E
7 changed files with 280 additions and 19 deletions

View File

@ -266,7 +266,7 @@ namespace Oshima.Core.Controllers
[HttpGet("iteminfo")]
public string GetItemInfo([FromQuery] long? id = null)
{
IEnumerable<Item> items = FunGameService.Equipment;
IEnumerable<Item> items = FunGameService.AllItems;
if (id != null)
{
List<string> msg = [];
@ -2535,6 +2535,13 @@ namespace Oshima.Core.Controllers
return NetworkUtility.JsonSerialize($"角色 [ {character} ] 等级不足 {needCount} 级,无法{isStudy}此技能!");
}
}
else if (key == "角色突破进度")
{
if (character.LevelBreak < needCount)
{
return NetworkUtility.JsonSerialize($"角色 [ {character} ] 等级突破进度不足 {needCount} 等阶,无法{isStudy}此技能!");
}
}
else if (key == General.GameplayEquilibriumConstant.InGameCurrency)
{
if (user.Inventory.Credits >= needCount)
@ -2583,6 +2590,8 @@ namespace Oshima.Core.Controllers
user.LastTime = DateTime.Now;
pc.Add("user", user);
pc.SaveConfig();
needy.Remove("角色等级");
needy.Remove("角色突破进度");
string msg = $"{isStudy}技能成功!本次消耗:{string.Join("", needy.Select(kv => kv.Key + " * " + kv.Value))},成功将【{skill.Name}】技能提升至 {skill.Level} 级!";
if (skill.Level == General.GameplayEquilibriumConstant.MaxSkillLevel)
@ -2618,6 +2627,171 @@ namespace Oshima.Core.Controllers
}
}
[HttpPost("getnormalattacklevelupneedy")]
public string GetNormalAttackLevelUpNeedy([FromQuery] long? qq = null, [FromQuery] int? c = null)
{
long userid = qq ?? Convert.ToInt64("10" + Verification.CreateVerifyCode(VerifyCodeType.NumberVerifyCode, 11));
int characterIndex = c ?? 0;
PluginConfig pc = new("saved", userid.ToString());
pc.LoadConfig();
if (pc.Count > 0)
{
User user = FunGameService.GetUser(pc);
Character? character;
if (characterIndex > 0 && characterIndex <= user.Inventory.Characters.Count)
{
character = user.Inventory.Characters.ToList()[characterIndex - 1];
}
else
{
return NetworkUtility.JsonSerialize($"没有找到与这个序号相对应的角色!");
}
NormalAttack na = character.NormalAttack;
if (na.Level + 1 == General.GameplayEquilibriumConstant.MaxNormalAttackLevel)
{
return NetworkUtility.JsonSerialize($"角色 [ {character} ] 的【{na.Name}】已经升至满级!");
}
return NetworkUtility.JsonSerialize($"角色 [ {character} ] 的【{na.Name}】等级:{na.Level} / {General.GameplayEquilibriumConstant.MaxNormalAttackLevel}" +
$"\r\n下一级所需升级材料\r\n" + FunGameService.GetNormalAttackLevelUpNeedy(na.Level + 1));
}
else
{
return NetworkUtility.JsonSerialize(noSaved);
}
}
[HttpPost("normalattacklevelup")]
public string NormalAttackLevelUp([FromQuery] long? qq = null, [FromQuery] int? c = null)
{
try
{
long userid = qq ?? Convert.ToInt64("10" + Verification.CreateVerifyCode(VerifyCodeType.NumberVerifyCode, 11));
int characterIndex = c ?? 0;
PluginConfig pc = new("saved", userid.ToString());
pc.LoadConfig();
if (pc.Count > 0)
{
User user = FunGameService.GetUser(pc);
Character? character = null;
if (characterIndex > 0 && characterIndex <= user.Inventory.Characters.Count)
{
character = user.Inventory.Characters.ToList()[characterIndex - 1];
}
else
{
return NetworkUtility.JsonSerialize($"没有找到与这个序号相对应的角色!");
}
NormalAttack na = character.NormalAttack;
if (na.Level == General.GameplayEquilibriumConstant.MaxNormalAttackLevel)
{
return NetworkUtility.JsonSerialize($"角色 [ {character} ] 的【{na.Name}】已经升至满级!");
}
if (FunGameService.NormalAttackLevelUpList.TryGetValue(na.Level + 1, out Dictionary<string, int>? needy) && needy != null && needy.Count > 0)
{
foreach (string key in needy.Keys)
{
int needCount = needy[key];
if (key == "角色等级")
{
if (character.Level < needCount)
{
return NetworkUtility.JsonSerialize($"角色 [ {character} ] 等级不足 {needCount} 级,无法升级此技能!");
}
}
else if (key == "角色突破进度")
{
if (character.LevelBreak < needCount)
{
return NetworkUtility.JsonSerialize($"角色 [ {character} ] 等级突破进度不足 {needCount} 等阶,无法升级此技能!");
}
}
else if (key == General.GameplayEquilibriumConstant.InGameCurrency)
{
if (user.Inventory.Credits >= needCount)
{
user.Inventory.Credits -= needCount;
}
else
{
return NetworkUtility.JsonSerialize($"你的{General.GameplayEquilibriumConstant.InGameCurrency}不足 {needCount} 呢,不满足升级条件!");
}
}
else if (key == General.GameplayEquilibriumConstant.InGameMaterial)
{
if (user.Inventory.Materials >= needCount)
{
user.Inventory.Materials -= needCount;
}
else
{
return NetworkUtility.JsonSerialize($"你的{General.GameplayEquilibriumConstant.InGameMaterial}不足 {needCount} 呢,不满足升级条件!");
}
}
else
{
if (needCount > 0)
{
IEnumerable<Item> items = user.Inventory.Items.Where(i => i.Name == key);
if (items.Count() >= needCount)
{
items = items.TakeLast(needCount);
foreach (Item item in items)
{
user.Inventory.Items.Remove(item);
}
}
else
{
return NetworkUtility.JsonSerialize($"你的物品【{key}】数量不足 {needCount} 呢,不满足升级条件!");
}
}
}
}
na.Level += 1;
user.LastTime = DateTime.Now;
pc.Add("user", user);
pc.SaveConfig();
needy.Remove("角色等级");
needy.Remove("角色突破进度");
string msg = $"角色 [ {character} ] 升级【{na.Name}】成功!本次消耗:{string.Join("", needy.Select(kv => kv.Key + " * " + kv.Value))},成功将【{na.Name}】提升至 {na.Level} 级!";
if (na.Level == General.GameplayEquilibriumConstant.MaxNormalAttackLevel)
{
msg += $"\r\n{na.Name}已经升至满级,恭喜!";
}
else
{
msg += $"\r\n下一级所需升级材料\r\n" + FunGameService.GetNormalAttackLevelUpNeedy(na.Level + 1);
}
return NetworkUtility.JsonSerialize(msg);
}
return NetworkUtility.JsonSerialize($"升级{na.Name}失败!角色 [ {character} ] 的【{na.Name}】当前等级:{na.Level}/{General.GameplayEquilibriumConstant.MaxNormalAttackLevel}" +
$"\r\n下一级所需升级材料\r\n" + FunGameService.GetSkillLevelUpNeedy(na.Level + 1));
}
else
{
return NetworkUtility.JsonSerialize(noSaved);
}
}
catch (Exception e)
{
return NetworkUtility.JsonSerialize(e.ToString());
}
}
[HttpGet("reload")]
public string Relaod([FromQuery] long? master = null)
{

View File

@ -1,7 +1,6 @@
using Milimoe.FunGame.Core.Api.Utility;
using Milimoe.FunGame.Core.Entity;
using Milimoe.FunGame.Core.Library.Common.Addon;
using Milimoe.FunGame.Core.Library.Constant;
using Oshima.Core.Configs;
using Oshima.Core.Constant;
using Oshima.Core.Utils;

View File

@ -78,7 +78,7 @@ namespace Oshima.Core.Utils
};
}
}
public static Dictionary<int, Dictionary<string, int>> SuperSkillLevelUpList
public static Dictionary<int, Dictionary<string, int>> SkillLevelUpList
{
get
{
@ -147,32 +147,32 @@ namespace Oshima.Core.Utils
};
}
}
public static Dictionary<int, Dictionary<string, int>> SkillLevelUpList
public static Dictionary<int, Dictionary<string, int>> NormalAttackLevelUpList
{
get
{
return new()
{
{
1, new()
2, new()
{
{ "角色等级", 6 },
{ "角色等级", 8 },
{ General.GameplayEquilibriumConstant.InGameCurrency, 2000 },
{ General.GameplayEquilibriumConstant.InGameMaterial, 10 },
{ nameof(), 1 },
}
},
{
2, new()
3, new()
{
{ "角色等级", 12 },
{ "角色等级", 16 },
{ General.GameplayEquilibriumConstant.InGameCurrency, 5000 },
{ General.GameplayEquilibriumConstant.InGameMaterial, 30 },
{ nameof(), 2 },
}
},
{
3, new()
4, new()
{
{ "角色等级", 24 },
{ General.GameplayEquilibriumConstant.InGameCurrency, 10000 },
@ -182,9 +182,9 @@ namespace Oshima.Core.Utils
}
},
{
4, new()
5, new()
{
{ "角色等级", 36 },
{ "角色等级", 32 },
{ General.GameplayEquilibriumConstant.InGameCurrency, 18000 },
{ General.GameplayEquilibriumConstant.InGameMaterial, 100 },
{ nameof(), 4 },
@ -192,9 +192,10 @@ namespace Oshima.Core.Utils
}
},
{
5, new()
6, new()
{
{ "角色等级", 48 },
{ "角色等级", 40 },
{ "角色突破进度", 4 },
{ General.GameplayEquilibriumConstant.InGameCurrency, 30000 },
{ General.GameplayEquilibriumConstant.InGameMaterial, 150 },
{ nameof(), 5 },
@ -203,15 +204,27 @@ namespace Oshima.Core.Utils
}
},
{
6, new()
7, new()
{
{ "角色等级", 60 },
{ "角色等级", 48 },
{ General.GameplayEquilibriumConstant.InGameCurrency, 47000 },
{ General.GameplayEquilibriumConstant.InGameMaterial, 210 },
{ nameof(), 6 },
{ nameof(), 4 },
{ nameof(), 2 }
}
},
{
8, new()
{
{ "角色等级", 56 },
{ General.GameplayEquilibriumConstant.InGameCurrency, 70000 },
{ General.GameplayEquilibriumConstant.InGameMaterial, 280 },
{ nameof(), 7 },
{ nameof(), 5 },
{ nameof(), 3 },
{ nameof(), 1 }
}
}
};
}
@ -242,7 +255,7 @@ namespace Oshima.Core.Utils
Equipment.AddRange([new 5(), new 15(), new 25(), new 35()]);
Items.AddRange(exItems.Values.Where(i => (int)i.ItemType > 4));
Items.AddRange([new (), new (), new (), new (), new (), new (), new (), new (), new ()]);
Items.AddRange([new (), new (), new (), new (), new (), new (), new (), new (), new (), new ()]);
AllItems.AddRange(Equipment);
AllItems.AddRange(Items);
@ -1161,9 +1174,44 @@ namespace Oshima.Core.Utils
{
if (SkillLevelUpList.TryGetValue(level, out Dictionary<string, int>? needy) && needy != null && needy.Count > 0)
{
return string.Join("", needy.Select(kv => kv.Key + " * " + kv.Value));
return GetNeedyInfo(needy);
}
return "";
}
public static string GetNormalAttackLevelUpNeedy(int level)
{
if (NormalAttackLevelUpList.TryGetValue(level, out Dictionary<string, int>? needy) && needy != null && needy.Count > 0)
{
return GetNeedyInfo(needy);
}
return "";
}
public static string GetNeedyInfo(Dictionary<string, int> needy)
{
string str = "";
foreach (string key in needy.Keys)
{
int needCount = needy[key];
if (str != "")
{
str += "";
}
if (key == "角色等级")
{
str += $"角色等级 {needCount} 级";
}
else if (key == "角色突破进度")
{
str += $"角色突破进度 {needCount} 等阶";
}
else
{
str += $"{key} * {needCount}";
}
}
return str;
}
}
}

View File

@ -23,5 +23,6 @@
= 18004,
= 18005,
= 18006,
= 18007,
}
}

View File

@ -0,0 +1,13 @@
using Milimoe.FunGame.Core.Entity;
using Milimoe.FunGame.Core.Library.Constant;
namespace Oshima.FunGame.OshimaModules.Items
{
public class () : Item(ItemType.SpecialItem)
{
public override long Id => (long)SpecialItemID.;
public override string Name => "混沌之核";
public override string Description => "升级技能必备的终级材料。";
public override QualityType QualityType => QualityType.Purple;
}
}

View File

@ -38,6 +38,7 @@ namespace Oshima.FunGame.OshimaModules
(long)SpecialItemID. => new (),
(long)SpecialItemID. => new (),
(long)SpecialItemID. => new (),
(long)SpecialItemID. => new (),
_ => null,
};
};

View File

@ -1350,5 +1350,30 @@
}
]
}
},
"YukiのCalfSocks-圣诞限定": {
"Id": 14515,
"Name": "YukiのCalfSocks-圣诞限定",
"Description": "增加角色 50% 暴击伤害。",
"BackgroundStory": "小雪的圣诞限定小腿袜,结合了圣诞树的红绿色,还有铃铛和鹿角的装饰。",
"ItemType": 4,
"WeaponType": 0,
"QualityType": 3,
"Skills": {
"Active": null,
"Passives": [
{
"Id": 7315,
"Name": "YukiのCalfSocks-圣诞限定",
"SkillType": 3,
"Effects": [
{
"Id": 8015,
"excrd": 0.5
}
]
}
]
}
}
}