diff --git a/OshimaWebAPI/Controllers/FunGameController.cs b/OshimaWebAPI/Controllers/FunGameController.cs index 3bec545..e210168 100644 --- a/OshimaWebAPI/Controllers/FunGameController.cs +++ b/OshimaWebAPI/Controllers/FunGameController.cs @@ -5129,6 +5129,50 @@ namespace Oshima.FunGame.WebAPI.Controllers } return regions; } + + [HttpGet("getplayerregion")] + public List GetPlayerRegion([FromQuery] int? index = null, bool showDokyoDetail = true) + { + List regions = []; + if (index != null) + { + if (FunGameConstant.PlayerRegions.FirstOrDefault(kv => kv.Id == index) is OshimaRegion region) + { + regions.Add(region.ToString()); + } + else + { + regions.Add($"找不到指定编号的地区!"); + } + } + else if (FunGameConstant.PlayerRegions.Count > 0) + { + regions.Add($"铎京城及周边地区地图:"); + List regionList = [.. FunGameConstant.PlayerRegions]; + if (showDokyoDetail) + { + OshimaRegion dokyo = regionList.First(); + regionList.Remove(dokyo); + regions.Add(dokyo.ToString()); + } + for (int i = 0; i < regionList.Count; i++) + { + OshimaRegion region = regionList[i]; + List crops = []; + if (FunGameConstant.ExploreItems.TryGetValue(region, out List? list) && list != null) + { + crops = list; + } + regions.Add($"{region.Id}. {region.Name}" + (crops.Count > 0 ? "(作物:" + string.Join(",", crops.Select(i => i.Name)) + ")" : "")); + } + regions.Add($"提示:使用【查地区+序号】指令来查看指定地区的信息。"); + } + else + { + regions.Add($"铎京城及周边地区的地图遇到了问题,暂时无法显示……"); + } + return regions; + } [HttpPost("exploreregion")] public string ExploreRegion([FromQuery] long? uid = null, [FromQuery] long? id = null) diff --git a/OshimaWebAPI/Services/RainBOTService.cs b/OshimaWebAPI/Services/RainBOTService.cs index b69eeb6..3e1a7da 100644 --- a/OshimaWebAPI/Services/RainBOTService.cs +++ b/OshimaWebAPI/Services/RainBOTService.cs @@ -2032,7 +2032,14 @@ namespace Oshima.FunGame.WebAPI.Services List msgs = []; if (int.TryParse(detail, out int cid)) { - msgs = Controller.GetRegion(cid); + if (cid > 0 && cid <= 12) + { + msgs = Controller.GetRegion(cid); + } + else if (cid == 0 || cid > 12) + { + msgs = Controller.GetPlayerRegion(cid); + } } else { @@ -2045,6 +2052,16 @@ namespace Oshima.FunGame.WebAPI.Services return result; } + if (e.Detail == "主城" || e.Detail == "铎京") + { + List msgs = Controller.GetPlayerRegion(); + if (msgs.Count > 0) + { + await SendAsync(e, "铎京", string.Join("\r\n", msgs)); + } + return result; + } + if (e.Detail == "世界地图") { List msgs = Controller.GetRegion();