添加经验书

This commit is contained in:
milimoe 2024-12-18 01:53:25 +08:00
parent d1eed22ee7
commit 7201a35cfb
Signed by: milimoe
GPG Key ID: 05D280912DA6C69E
6 changed files with 101 additions and 8 deletions

View File

@ -1294,12 +1294,13 @@ namespace Oshima.Core.Controllers
} }
[HttpPost("fightcustom")] [HttpPost("fightcustom")]
public List<string> FightCustom([FromQuery] long? qq = null, [FromQuery] long? eqq = null) public List<string> FightCustom([FromQuery] long? qq = null, [FromQuery] long? eqq = null, [FromQuery] bool? all = null)
{ {
try try
{ {
long userid = qq ?? Convert.ToInt64("10" + Verification.CreateVerifyCode(VerifyCodeType.NumberVerifyCode, 11)); long userid = qq ?? Convert.ToInt64("10" + Verification.CreateVerifyCode(VerifyCodeType.NumberVerifyCode, 11));
long enemyid = eqq ?? Convert.ToInt64("10" + Verification.CreateVerifyCode(VerifyCodeType.NumberVerifyCode, 11)); long enemyid = eqq ?? Convert.ToInt64("10" + Verification.CreateVerifyCode(VerifyCodeType.NumberVerifyCode, 11));
bool showAllRound = all ?? false;
PluginConfig pc = new("saved", userid.ToString()); PluginConfig pc = new("saved", userid.ToString());
pc.LoadConfig(); pc.LoadConfig();
@ -1340,7 +1341,7 @@ namespace Oshima.Core.Controllers
return [$"对方似乎还没有自建角色,请发送【生成自建角色】创建!"]; return [$"对方似乎还没有自建角色,请发送【生成自建角色】创建!"];
} }
return FunGameActionQueue.StartGame([character1, character2], false, false, false, false, false); return FunGameActionQueue.StartGame([character1, character2], false, false, false, false, false, showAllRound);
} }
else else
{ {
@ -1354,7 +1355,7 @@ namespace Oshima.Core.Controllers
} }
[HttpPost("fightcustom2")] [HttpPost("fightcustom2")]
public List<string> FightCustom2([FromQuery] long? qq = null, [FromQuery] string? name = null) public List<string> FightCustom2([FromQuery] long? qq = null, [FromQuery] string? name = null, [FromQuery] bool? all = null)
{ {
try try
{ {
@ -1365,7 +1366,7 @@ namespace Oshima.Core.Controllers
{ {
return [$"找不到此名称对应的玩家!"]; return [$"找不到此名称对应的玩家!"];
} }
return FightCustom(qq, enemyid); return FightCustom(qq, enemyid, all);
} }
return [$"决斗发起失败!"]; return [$"决斗发起失败!"];
} }

View File

@ -561,7 +561,7 @@ namespace Oshima.Core.Utils
} }
} }
public static List<string> StartGame(List<Character> characters, bool printout, bool isWeb = false, bool isTeam = false, bool deathMatchRoundDetail = false, bool showRoundEndDetail = false) public static List<string> StartGame(List<Character> characters, bool printout, bool isWeb = false, bool isTeam = false, bool deathMatchRoundDetail = false, bool showRoundEndDetail = false, bool showAllRound = false)
{ {
PrintOut = printout; PrintOut = printout;
IsWeb = isWeb; IsWeb = isWeb;
@ -746,12 +746,19 @@ namespace Oshima.Core.Utils
} }
string roundMsg = ""; string roundMsg = "";
if (actionQueue.LastRound.HasKill) if (actionQueue.LastRound.HasKill || showAllRound)
{ {
roundMsg = Msg; roundMsg = Msg;
if (!deathMatchRoundDetail) if (!deathMatchRoundDetail)
{ {
roundMsg = actionQueue.LastRound.ToString().Trim() + $"\r\n{(isTeam ? $"{string.Join(" / ", actionQueue.Teams.Values.Select(t => $"{t.Name}({t.Score})"))}{actionQueue.GetTeam(actionQueue.LastRound.Actor)}" : "")}\r\n"; roundMsg = actionQueue.LastRound.ToString().Trim() + $"\r\n{(isTeam ? $"{string.Join(" / ", actionQueue.Teams.Values.Select(t => $"{t.Name}({t.Score})"))}{actionQueue.GetTeam(actionQueue.LastRound.Actor)}" : "")}";
if (showAllRound)
{
foreach (Character character in actionQueue.Queue)
{
roundMsg += $"[ {character} ] 生命值:{character.HP:0.##}/{character.MaxHP:0.##} / 魔法值:{character.MP:0.##}/{character.MaxMP:0.##}\r\n";
}
}
} }
Msg = ""; Msg = "";
} }

View File

@ -6,6 +6,7 @@ using Oshima.FunGame.OshimaModules;
using Oshima.FunGame.OshimaModules.Characters; using Oshima.FunGame.OshimaModules.Characters;
using Oshima.FunGame.OshimaModules.Effects.OpenEffects; using Oshima.FunGame.OshimaModules.Effects.OpenEffects;
using Oshima.FunGame.OshimaModules.Items; using Oshima.FunGame.OshimaModules.Items;
using Oshima.FunGame.OshimaModules.Items.Consumable;
using Oshima.FunGame.OshimaModules.Skills; using Oshima.FunGame.OshimaModules.Skills;
namespace Oshima.Core.Utils namespace Oshima.Core.Utils
@ -46,6 +47,7 @@ namespace Oshima.Core.Utils
Equipment.AddRange([new 5(), new 15(), new 25(), new 35()]); Equipment.AddRange([new 5(), new 15(), new 25(), new 35()]);
Items.AddRange(exItems.Values.Where(i => (int)i.ItemType > 4)); Items.AddRange(exItems.Values.Where(i => (int)i.ItemType > 4));
Items.AddRange([new (), new (), new ()]);
AllItems.AddRange(Equipment); AllItems.AddRange(Equipment);
AllItems.AddRange(Items); AllItems.AddRange(Items);
@ -583,6 +585,13 @@ namespace Oshima.Core.Utils
msg += ItemSet.GetQualityTypeName(mfk.QualityType) + ItemSet.GetItemTypeName(mfk.ItemType) + "【" + mfk.Name + "】!\r\n" + mfk.Description; msg += ItemSet.GetQualityTypeName(mfk.QualityType) + ItemSet.GetItemTypeName(mfk.ItemType) + "【" + mfk.Name + "】!\r\n" + mfk.Description;
break; break;
case 7:
Item = Items[Random.Shared.Next(Items.Count)].Copy();
SetSellAndTradeTime();
user.Inventory.Items.Add();
msg += ItemSet.GetQualityTypeName(.QualityType) + ItemSet.GetItemTypeName(.ItemType) + "【" + .Name + "】!\r\n" + .Description;
break;
case 0: case 0:
default: default:
if ((int)type > (int)QualityType.Orange) type = QualityType.Orange; if ((int)type > (int)QualityType.Orange) type = QualityType.Orange;

View File

@ -0,0 +1,69 @@
using Milimoe.FunGame.Core.Entity;
using Milimoe.FunGame.Core.Library.Constant;
using Oshima.FunGame.OshimaModules.Effects.ItemEffects;
using Oshima.FunGame.OshimaModules.Skills;
namespace Oshima.FunGame.OshimaModules.Items.Consumable
{
public class : Item
{
public override long Id => (long)ConsumableID.;
public override string Name => "小经验书";
public override string Description => Skills.Active?.Description ?? "";
public override QualityType QualityType => QualityType.White;
public (User? user = null, int remainUseTimes = 1) : base(ItemType.Consumable)
{
User = user;
Skills.Active = new (this, 200);
RemainUseTimes = remainUseTimes;
}
}
public class : Item
{
public override long Id => (long)ConsumableID.;
public override string Name => "中经验书";
public override string Description => Skills.Active?.Description ?? "";
public override QualityType QualityType => QualityType.Green;
public (User? user = null, int remainUseTimes = 1) : base(ItemType.Consumable)
{
User = user;
Skills.Active = new (this, 500);
RemainUseTimes = remainUseTimes;
}
}
public class : Item
{
public override long Id => (long)ConsumableID.;
public override string Name => "大经验书";
public override string Description => Skills.Active?.Description ?? "";
public override QualityType QualityType => QualityType.Blue;
public (User? user = null, int remainUseTimes = 1) : base(ItemType.Consumable)
{
User = user;
Skills.Active = new (this, 1000);
RemainUseTimes = remainUseTimes;
}
}
public class : Skill
{
public override long Id => (long)ItemActiveID.;
public override string Name => "经验书";
public override string Description => Effects.Count > 0 ? Effects.First().Description : "";
public (Item? item = null, double exp = 0) : base(SkillType.Item)
{
Level = 1;
Item = item;
Effects.Add(new GetEXP(this, new()
{
{ "exp", exp }
}));
}
}
}

View File

@ -7,4 +7,11 @@
25 = 14003, 25 = 14003,
35 = 14004, 35 = 14004,
} }
public enum ConsumableID : long
{
= 15001,
= 15002,
= 15003,
}
} }

View File

@ -104,6 +104,6 @@
public enum ItemActiveID : long public enum ItemActiveID : long
{ {
= 6001,
} }
} }