mirror of
https://github.com/oshima-studios/OshimaGameModule.git
synced 2025-12-05 08:09:04 +00:00
更新主城信息查询
This commit is contained in:
parent
e62efbef32
commit
f9821a71cf
@ -5130,6 +5130,50 @@ namespace Oshima.FunGame.WebAPI.Controllers
|
|||||||
return regions;
|
return regions;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[HttpGet("getplayerregion")]
|
||||||
|
public List<string> GetPlayerRegion([FromQuery] int? index = null, bool showDokyoDetail = true)
|
||||||
|
{
|
||||||
|
List<string> 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<OshimaRegion> 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<Item> crops = [];
|
||||||
|
if (FunGameConstant.ExploreItems.TryGetValue(region, out List<Item>? 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")]
|
[HttpPost("exploreregion")]
|
||||||
public string ExploreRegion([FromQuery] long? uid = null, [FromQuery] long? id = null)
|
public string ExploreRegion([FromQuery] long? uid = null, [FromQuery] long? id = null)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -2031,9 +2031,16 @@ namespace Oshima.FunGame.WebAPI.Services
|
|||||||
string detail = e.Detail.Replace("查地区", "").Replace("查询地区", "").Trim();
|
string detail = e.Detail.Replace("查地区", "").Replace("查询地区", "").Trim();
|
||||||
List<string> msgs = [];
|
List<string> msgs = [];
|
||||||
if (int.TryParse(detail, out int cid))
|
if (int.TryParse(detail, out int cid))
|
||||||
|
{
|
||||||
|
if (cid > 0 && cid <= 12)
|
||||||
{
|
{
|
||||||
msgs = Controller.GetRegion(cid);
|
msgs = Controller.GetRegion(cid);
|
||||||
}
|
}
|
||||||
|
else if (cid == 0 || cid > 12)
|
||||||
|
{
|
||||||
|
msgs = Controller.GetPlayerRegion(cid);
|
||||||
|
}
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
msgs = Controller.GetRegion();
|
msgs = Controller.GetRegion();
|
||||||
@ -2045,6 +2052,16 @@ namespace Oshima.FunGame.WebAPI.Services
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (e.Detail == "主城" || e.Detail == "铎京")
|
||||||
|
{
|
||||||
|
List<string> msgs = Controller.GetPlayerRegion();
|
||||||
|
if (msgs.Count > 0)
|
||||||
|
{
|
||||||
|
await SendAsync(e, "铎京", string.Join("\r\n", msgs));
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
if (e.Detail == "世界地图")
|
if (e.Detail == "世界地图")
|
||||||
{
|
{
|
||||||
List<string> msgs = Controller.GetRegion();
|
List<string> msgs = Controller.GetRegion();
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user