diff --git a/OshimaModules/Models/ExploreModel.cs b/OshimaModules/Models/ExploreModel.cs new file mode 100644 index 0000000..b3fb45e --- /dev/null +++ b/OshimaModules/Models/ExploreModel.cs @@ -0,0 +1,19 @@ +using Oshima.Core.Constant; + +namespace Oshima.FunGame.OshimaServers.Model +{ + public class ExploreModel() + { + public Guid Guid { get; set; } = Guid.NewGuid(); + public long RegionId { get; set; } = 0; + public IEnumerable CharacterIds { get; set; } = []; + public DateTime? StartTime { get; set; } = null; + public ExploreResult Result { get; set; } = ExploreResult.Nothing; + public string String { get; set; } = ""; + public double CreditsAward { get; set; } = 0; + public double MaterialsAward { get; set; } = 0; + public Dictionary Awards { get; set; } = []; + public bool FightWin { get; set; } = false; + public double[] AfterFightHPs { get; set; } = []; + } +} diff --git a/OshimaServers/Model/ExploreModel.cs b/OshimaServers/Model/ExploreModel.cs deleted file mode 100644 index 8428df9..0000000 --- a/OshimaServers/Model/ExploreModel.cs +++ /dev/null @@ -1,43 +0,0 @@ -using System.Text; -using Milimoe.FunGame.Core.Entity; -using Milimoe.FunGame.Core.Library.Constant; -using Oshima.Core.Constant; -using Oshima.FunGame.OshimaServers.Service; - -namespace Oshima.FunGame.OshimaServers.Model -{ - public class ExploreModel() - { - public Guid Guid { get; set; } = Guid.NewGuid(); - public long RegionId { get; set; } = 0; - public IEnumerable CharacterIds { get; set; } = []; - public DateTime? StartTime { get; set; } = null; - public ExploreResult Result { get; set; } = ExploreResult.Nothing; - public string String { get; set; } = ""; - public double CreditsAward { get; set; } = 0; - public double MaterialsAward { get; set; } = 0; - public Dictionary Awards { get; set; } = []; - public bool FightWin { get; set; } = false; - public double[] AfterFightHPs { get; set; } = []; - - public string GetExploreInfo(IEnumerable inventoryCharacters, IEnumerable regions) - { - StringBuilder sb = new(); - - if (CharacterIds.Any()) - { - if (regions.FirstOrDefault(r => r.Id == RegionId) is Region region) - { - sb.AppendLine($"☆--- 正在探索 {RegionId} 号地区:{region.Name} ---☆"); - if (StartTime != null) - { - sb.AppendLine($"探索时间:{StartTime.Value.ToString(General.GeneralDateTimeFormatChinese)}"); - } - sb.AppendLine($"探索角色:{FunGameService.GetCharacterGroupInfoByInventorySequence(inventoryCharacters, CharacterIds, ",")}"); - } - } - - return sb.ToString().Trim(); - } - } -} diff --git a/OshimaServers/Service/FunGameService.cs b/OshimaServers/Service/FunGameService.cs index 61eca65..ca96a9b 100644 --- a/OshimaServers/Service/FunGameService.cs +++ b/OshimaServers/Service/FunGameService.cs @@ -2875,6 +2875,26 @@ namespace Oshima.FunGame.OshimaServers.Service pc.SaveConfig(); } + public static string GetExploreInfo(ExploreModel model, IEnumerable inventoryCharacters, IEnumerable regions) + { + StringBuilder sb = new(); + + if (model.CharacterIds.Any()) + { + if (regions.FirstOrDefault(r => r.Id == model.RegionId) is Region region) + { + sb.AppendLine($"☆--- 正在探索 {model.RegionId} 号地区:{region.Name} ---☆"); + if (model.StartTime != null) + { + sb.AppendLine($"探索时间:{model.StartTime.Value.ToString(General.GeneralDateTimeFormatChinese)}"); + } + sb.AppendLine($"探索角色:{GetCharacterGroupInfoByInventorySequence(inventoryCharacters, model.CharacterIds, ",")}"); + } + } + + return sb.ToString().Trim(); + } + public static bool SettleExplore(string exploreId, PluginConfig pc, User user, out string msg) { bool result = false; @@ -4348,7 +4368,7 @@ namespace Oshima.FunGame.OshimaServers.Service { foreach (MarketItem marketItem in MarketItemsValid) { - builder.AppendLine(FunGameService.GetMarketItemInfo(marketItem, true, user?.Id ?? 0)); + builder.AppendLine(GetMarketItemInfo(marketItem, true, user?.Id ?? 0)); } builder.AppendLine("提示:使用【市场查看+序号】查看商品详细信息,使用【市场购买+序号】购买商品。"); } @@ -4367,8 +4387,7 @@ namespace Oshima.FunGame.OshimaServers.Service StringBuilder builder = new(); if (simply) { - builder.AppendLine($"{item.Id}. {item.Name}"); - builder.AppendLine($"{ItemSet.GetQualityTypeName(item.Item.QualityType)} {ItemSet.GetItemTypeName(item.Item.ItemType)}"); + builder.AppendLine($"{item.Id}. [{ItemSet.GetQualityTypeName(item.Item.QualityType)}|{ItemSet.GetItemTypeName(item.Item.ItemType)}] {item.Name}"); string username = item.Username; if (FunGameConstant.UserIdAndUsername.TryGetValue(item.User, out User? user) && user != null) { diff --git a/OshimaWebAPI/Controllers/FunGameController.cs b/OshimaWebAPI/Controllers/FunGameController.cs index 76fa7b0..1c08b92 100644 --- a/OshimaWebAPI/Controllers/FunGameController.cs +++ b/OshimaWebAPI/Controllers/FunGameController.cs @@ -5676,7 +5676,7 @@ namespace Oshima.FunGame.WebAPI.Controllers { if (msg2 != "") msg2 += "\r\n"; msg2 += $"你暂时无法使用以下角色进行探索:[ {FunGameService.GetCharacterGroupInfoByInventorySequence(user.Inventory.Characters, exploring, " ] / [ ")} ]," + - $"因为这些角色已经参与了另一场探索:\r\n{model.GetExploreInfo(user.Inventory.Characters, FunGameConstant.Regions)}"; + $"因为这些角色已经参与了另一场探索:\r\n{FunGameService.GetExploreInfo(model, user.Inventory.Characters, FunGameConstant.Regions)}"; } } if (msg2 != "") @@ -5761,7 +5761,7 @@ namespace Oshima.FunGame.WebAPI.Controllers ExploreModel? model = pc2.Get(guid); if (model is null) continue; if (msg2 != "") msg2 += "\r\n"; - msg2 += model.GetExploreInfo(user.Inventory.Characters, FunGameConstant.Regions); + msg2 += FunGameService.GetExploreInfo(model, user.Inventory.Characters, FunGameConstant.Regions); } if (msg2 != "") {