mirror of
https://github.com/oshima-studios/OshimaGameModule.git
synced 2025-04-23 12:29:35 +08:00
添加经验书
This commit is contained in:
parent
d1eed22ee7
commit
7201a35cfb
@ -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 [$"决斗发起失败!"];
|
||||||
}
|
}
|
||||||
|
@ -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 = "";
|
||||||
}
|
}
|
||||||
|
@ -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;
|
||||||
|
69
OshimaModules/Items/Consumable/经验书.cs
Normal file
69
OshimaModules/Items/Consumable/经验书.cs
Normal 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 }
|
||||||
|
}));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -7,4 +7,11 @@
|
|||||||
攻击之爪25 = 14003,
|
攻击之爪25 = 14003,
|
||||||
攻击之爪35 = 14004,
|
攻击之爪35 = 14004,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public enum ConsumableID : long
|
||||||
|
{
|
||||||
|
小经验书 = 15001,
|
||||||
|
中经验书 = 15002,
|
||||||
|
大经验书 = 15003,
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -104,6 +104,6 @@
|
|||||||
|
|
||||||
public enum ItemActiveID : long
|
public enum ItemActiveID : long
|
||||||
{
|
{
|
||||||
|
经验书 = 6001,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user