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