mirror of
https://github.com/oshima-studios/OshimaGameModule.git
synced 2025-04-23 12:29:35 +08:00
修改角色类默认的 ToString
This commit is contained in:
parent
0b5bc3b713
commit
bd71391d67
@ -1246,7 +1246,8 @@ namespace Oshima.FunGame.OshimaServers.Service
|
||||
for (int i = 0; i < genCount; i++)
|
||||
{
|
||||
int nowIndex = Bosses.Count > 0 ? Bosses.Keys.Max() + 1 : 1;
|
||||
Character boss = new CustomCharacter(nowIndex, GenerateRandomChineseUserName(), "", "Boss");
|
||||
string bossName = GenerateRandomChineseUserName();
|
||||
Character boss = new CustomCharacter(nowIndex, bossName, "", bossName);
|
||||
int cutRate = Random.Shared.Next(3) switch
|
||||
{
|
||||
0 => 1,
|
||||
|
@ -1892,6 +1892,10 @@ namespace Oshima.FunGame.WebAPI.Controllers
|
||||
long userid = uid ?? Convert.ToInt64("10" + Verification.CreateVerifyCode(VerifyCodeType.NumberVerifyCode, 11));
|
||||
string itemName = name ?? "";
|
||||
int useCount = count ?? 0;
|
||||
if (useCount <= 0)
|
||||
{
|
||||
return NetworkUtility.JsonSerialize("数量必须大于0!");
|
||||
}
|
||||
List<int> charactersIndex = characters?.ToList() ?? [];
|
||||
|
||||
PluginConfig pc = new("saved", userid.ToString());
|
||||
@ -2063,6 +2067,10 @@ namespace Oshima.FunGame.WebAPI.Controllers
|
||||
long userid = uid ?? Convert.ToInt64("10" + Verification.CreateVerifyCode(VerifyCodeType.NumberVerifyCode, 11));
|
||||
int characterIndex = c ?? 0;
|
||||
int upCount = count ?? 0;
|
||||
if (upCount <= 0)
|
||||
{
|
||||
return NetworkUtility.JsonSerialize("数量必须大于0!");
|
||||
}
|
||||
|
||||
PluginConfig pc = new("saved", userid.ToString());
|
||||
pc.LoadConfig();
|
||||
@ -2265,6 +2273,10 @@ namespace Oshima.FunGame.WebAPI.Controllers
|
||||
long userid = uid ?? Convert.ToInt64("10" + Verification.CreateVerifyCode(VerifyCodeType.NumberVerifyCode, 11));
|
||||
string itemName = name ?? "";
|
||||
int itemCount = count ?? 0;
|
||||
if (itemCount <= 0)
|
||||
{
|
||||
return NetworkUtility.JsonSerialize("数量必须大于0!");
|
||||
}
|
||||
long targetid = target ?? Convert.ToInt64("10" + Verification.CreateVerifyCode(VerifyCodeType.NumberVerifyCode, 11));
|
||||
|
||||
PluginConfig pc = new("saved", userid.ToString());
|
||||
@ -2437,6 +2449,10 @@ namespace Oshima.FunGame.WebAPI.Controllers
|
||||
long userid = uid ?? Convert.ToInt64("10" + Verification.CreateVerifyCode(VerifyCodeType.NumberVerifyCode, 11));
|
||||
string itemName = name ?? "";
|
||||
int useCount = count ?? 0;
|
||||
if (useCount <= 0)
|
||||
{
|
||||
return NetworkUtility.JsonSerialize("数量必须大于0!");
|
||||
}
|
||||
|
||||
PluginConfig pc = new("saved", userid.ToString());
|
||||
pc.LoadConfig();
|
||||
@ -4658,7 +4674,11 @@ namespace Oshima.FunGame.WebAPI.Controllers
|
||||
{
|
||||
long userid = uid ?? Convert.ToInt64("10" + Verification.CreateVerifyCode(VerifyCodeType.NumberVerifyCode, 11));
|
||||
long goodid = id ?? 0;
|
||||
int buycount = count ?? 0;
|
||||
int buycount = count ?? 1;
|
||||
if (buycount <= 0)
|
||||
{
|
||||
return NetworkUtility.JsonSerialize("数量必须大于0!");
|
||||
}
|
||||
|
||||
PluginConfig pc = new("saved", userid.ToString());
|
||||
pc.LoadConfig();
|
||||
|
@ -106,6 +106,11 @@ namespace Oshima.FunGame.WebAPI.Controllers
|
||||
C2CMessage? c2cMessage = JsonSerializer.Deserialize<C2CMessage>(payload.Data.ToString() ?? "");
|
||||
if (c2cMessage != null)
|
||||
{
|
||||
c2cMessage.Detail = c2cMessage.Detail.Trim();
|
||||
if (c2cMessage.Detail.StartsWith('/'))
|
||||
{
|
||||
c2cMessage.Detail = c2cMessage.Detail[1..];
|
||||
}
|
||||
// TODO
|
||||
Logger.LogInformation("收到来自用户 {c2cMessage.Author.UserOpenId} 的消息:{c2cMessage.Content}", c2cMessage.Author.UserOpenId, c2cMessage.Content);
|
||||
//// 上传图片
|
||||
@ -136,6 +141,10 @@ namespace Oshima.FunGame.WebAPI.Controllers
|
||||
if (groupAtMessage != null)
|
||||
{
|
||||
groupAtMessage.Detail = groupAtMessage.Detail.Trim();
|
||||
if (groupAtMessage.Detail.StartsWith('/'))
|
||||
{
|
||||
groupAtMessage.Detail = groupAtMessage.Detail[1..];
|
||||
}
|
||||
// TODO
|
||||
Logger.LogInformation("收到来自群组 {groupAtMessage.GroupOpenId} 的消息:{groupAtMessage.Content}", groupAtMessage.GroupOpenId, groupAtMessage.Content);
|
||||
// 回复消息
|
||||
|
@ -713,7 +713,7 @@ namespace Oshima.FunGame.WebAPI.Services
|
||||
if (e.Detail.StartsWith("分类库存"))
|
||||
{
|
||||
string detail = e.Detail.Replace("分类库存", "").Trim();
|
||||
string[] strings = detail.Split(" ");
|
||||
string[] strings = detail.Split(" ", StringSplitOptions.TrimEntries | StringSplitOptions.RemoveEmptyEntries);
|
||||
int t = -1;
|
||||
if (strings.Length > 0 && int.TryParse(strings[0].Trim(), out t))
|
||||
{
|
||||
@ -953,7 +953,7 @@ namespace Oshima.FunGame.WebAPI.Services
|
||||
if (e.Detail.StartsWith("取消装备", StringComparison.CurrentCultureIgnoreCase))
|
||||
{
|
||||
string detail = e.Detail.Replace("取消装备", "").Trim();
|
||||
string[] strings = detail.Split(" ");
|
||||
string[] strings = detail.Split(" ", StringSplitOptions.TrimEntries | StringSplitOptions.RemoveEmptyEntries);
|
||||
int c = -1, i = -1;
|
||||
if (strings.Length > 0 && int.TryParse(strings[0].Trim(), out c) && strings.Length > 1 && int.TryParse(strings[1].Trim(), out i))
|
||||
{
|
||||
@ -972,7 +972,7 @@ namespace Oshima.FunGame.WebAPI.Services
|
||||
if (e.Detail.StartsWith("装备", StringComparison.CurrentCultureIgnoreCase))
|
||||
{
|
||||
string detail = e.Detail.Replace("装备", "").Trim();
|
||||
string[] strings = detail.Split(" ");
|
||||
string[] strings = detail.Split(" ", StringSplitOptions.TrimEntries | StringSplitOptions.RemoveEmptyEntries);
|
||||
int c = -1, i = -1;
|
||||
if (strings.Length > 0 && int.TryParse(strings[0].Trim(), out c) && strings.Length > 1 && int.TryParse(strings[1].Trim(), out i))
|
||||
{
|
||||
@ -991,7 +991,7 @@ namespace Oshima.FunGame.WebAPI.Services
|
||||
if (e.Detail.StartsWith("查看技能升级", StringComparison.CurrentCultureIgnoreCase))
|
||||
{
|
||||
string detail = e.Detail.Replace("查看技能升级", "").Trim();
|
||||
string[] strings = detail.Split(" ");
|
||||
string[] strings = detail.Split(" ", StringSplitOptions.TrimEntries | StringSplitOptions.RemoveEmptyEntries);
|
||||
int c = -1;
|
||||
if (strings.Length > 0 && int.TryParse(strings[0].Trim(), out c) && strings.Length > 1)
|
||||
{
|
||||
@ -1011,7 +1011,7 @@ namespace Oshima.FunGame.WebAPI.Services
|
||||
if (e.Detail.StartsWith("技能升级", StringComparison.CurrentCultureIgnoreCase))
|
||||
{
|
||||
string detail = e.Detail.Replace("技能升级", "").Trim();
|
||||
string[] strings = detail.Split(" ");
|
||||
string[] strings = detail.Split(" ", StringSplitOptions.TrimEntries | StringSplitOptions.RemoveEmptyEntries);
|
||||
int c = -1;
|
||||
if (strings.Length > 0 && int.TryParse(strings[0].Trim(), out c) && strings.Length > 1)
|
||||
{
|
||||
@ -1031,7 +1031,7 @@ namespace Oshima.FunGame.WebAPI.Services
|
||||
if (e.Detail.StartsWith("合成魔法卡", StringComparison.CurrentCultureIgnoreCase))
|
||||
{
|
||||
string detail = e.Detail.Replace("合成魔法卡", "").Trim();
|
||||
string[] strings = detail.Split(" ");
|
||||
string[] strings = detail.Split(" ", StringSplitOptions.TrimEntries | StringSplitOptions.RemoveEmptyEntries);
|
||||
int id1 = -1, id2 = -1, id3 = -1;
|
||||
if (strings.Length > 0 && int.TryParse(strings[0].Trim(), out id1) && strings.Length > 1 && int.TryParse(strings[1].Trim(), out id2) && strings.Length > 2 && int.TryParse(strings[2].Trim(), out id3))
|
||||
{
|
||||
@ -1178,7 +1178,7 @@ namespace Oshima.FunGame.WebAPI.Services
|
||||
if (int.TryParse(match.Groups["count"].Value, out int count))
|
||||
{
|
||||
string characterIdsString = match.Groups["characterIds"].Value;
|
||||
int[] characterIds = characterIdsString != "" ? [.. characterIdsString.Split(chars, StringSplitOptions.RemoveEmptyEntries).Select(int.Parse)] : [1];
|
||||
int[] characterIds = characterIdsString != "" ? [.. characterIdsString.Split(chars, StringSplitOptions.TrimEntries | StringSplitOptions.RemoveEmptyEntries).Select(int.Parse)] : [1];
|
||||
string msg = NetworkUtility.JsonDeserialize<string>(Controller.UseItem2(uid, itemName, count, characterIds)) ?? "";
|
||||
if (msg != "")
|
||||
{
|
||||
@ -1195,7 +1195,7 @@ namespace Oshima.FunGame.WebAPI.Services
|
||||
if (int.TryParse(match.Groups["itemId"].Value, out int itemId))
|
||||
{
|
||||
string characterIdsString = match.Groups["characterIds"].Value;
|
||||
int[] characterIds = characterIdsString != "" ? [.. characterIdsString.Split(chars, StringSplitOptions.RemoveEmptyEntries).Select(int.Parse)] : [1];
|
||||
int[] characterIds = characterIdsString != "" ? [.. characterIdsString.Split(chars, StringSplitOptions.TrimEntries | StringSplitOptions.RemoveEmptyEntries).Select(int.Parse)] : [1];
|
||||
string msg = NetworkUtility.JsonDeserialize<string>(Controller.UseItem(uid, itemId, characterIds)) ?? "";
|
||||
if (msg != "")
|
||||
{
|
||||
@ -1246,7 +1246,7 @@ namespace Oshima.FunGame.WebAPI.Services
|
||||
{
|
||||
string detail = e.Detail.Replace("分解物品", "").Trim();
|
||||
List<int> ids = [];
|
||||
foreach (string str in detail.Split(' '))
|
||||
foreach (string str in detail.Split(' ', StringSplitOptions.TrimEntries | StringSplitOptions.RemoveEmptyEntries))
|
||||
{
|
||||
if (int.TryParse(str, out int id))
|
||||
{
|
||||
@ -1301,7 +1301,7 @@ namespace Oshima.FunGame.WebAPI.Services
|
||||
if (e.Detail.StartsWith("熟圣之力", StringComparison.CurrentCultureIgnoreCase))
|
||||
{
|
||||
string detail = e.Detail.Replace("熟圣之力", "").Trim();
|
||||
string[] strings = detail.Split(" ");
|
||||
string[] strings = detail.Split(" ", StringSplitOptions.TrimEntries | StringSplitOptions.RemoveEmptyEntries);
|
||||
int count = -1;
|
||||
if (strings.Length > 1 && int.TryParse(strings[1].Trim(), out count))
|
||||
{
|
||||
@ -1663,7 +1663,7 @@ namespace Oshima.FunGame.WebAPI.Services
|
||||
if (e.Detail.StartsWith("设置小队") || e.Detail.StartsWith("重组小队"))
|
||||
{
|
||||
string detail = e.Detail.Replace("设置小队", "").Replace("重组小队", "").Trim();
|
||||
string[] strings = detail.Split(' ');
|
||||
string[] strings = detail.Split(' ', StringSplitOptions.TrimEntries | StringSplitOptions.RemoveEmptyEntries);
|
||||
List<int> cindexs = [];
|
||||
foreach (string s in strings)
|
||||
{
|
||||
@ -1816,7 +1816,7 @@ namespace Oshima.FunGame.WebAPI.Services
|
||||
if (e.Detail.StartsWith("社团设置", StringComparison.CurrentCultureIgnoreCase))
|
||||
{
|
||||
string detail = e.Detail.Replace("社团设置", "").Trim();
|
||||
string[] strings = detail.Split(' ');
|
||||
string[] strings = detail.Split(' ', StringSplitOptions.TrimEntries | StringSplitOptions.RemoveEmptyEntries);
|
||||
if (strings.Length > 0)
|
||||
{
|
||||
string part = strings[0].Trim() switch
|
||||
@ -1870,12 +1870,18 @@ namespace Oshima.FunGame.WebAPI.Services
|
||||
if (e.Detail.StartsWith("商店购买", StringComparison.CurrentCultureIgnoreCase))
|
||||
{
|
||||
string detail = e.Detail.Replace("商店购买", "").Trim();
|
||||
if (int.TryParse(detail, out int id))
|
||||
string[] strings = detail.Split(' ', StringSplitOptions.TrimEntries | StringSplitOptions.RemoveEmptyEntries);
|
||||
if (strings.Length > 0 && int.TryParse(strings[0].Trim(), out int id))
|
||||
{
|
||||
string msg = NetworkUtility.JsonDeserialize<string>(Controller.DailyStoreBuy(uid, id)) ?? "";
|
||||
int count = 1;
|
||||
if (strings.Length > 1 && int.TryParse(strings[1].Trim(), out int temp))
|
||||
{
|
||||
count = temp;
|
||||
}
|
||||
string msg = NetworkUtility.JsonDeserialize<string>(Controller.DailyStoreBuy(uid, id, count)) ?? "";
|
||||
if (msg != "")
|
||||
{
|
||||
await SendAsync(e, "商店", msg);
|
||||
await SendAsync(e, "商店购买", msg);
|
||||
}
|
||||
}
|
||||
return result;
|
||||
|
Loading…
x
Reference in New Issue
Block a user