新增改名和审核系统

This commit is contained in:
milimoe 2025-07-11 00:58:01 +08:00
parent 53fed27111
commit cc605d8483
Signed by: milimoe
GPG Key ID: 9554D37E4B8991D0
13 changed files with 1043 additions and 155 deletions

View File

@ -55,12 +55,23 @@ namespace Oshima.FunGame.OshimaModules.Items
}
}
args["msg"] = msg;
string truemsg = $"对角色 [ {targets[0]} ] 使用 {times} 个 [ {item.Name} ] 成功!";
if (result)
{
key = args.Keys.FirstOrDefault(s => s.Equals("useCount", StringComparison.CurrentCultureIgnoreCase)) ?? "";
if (key != "" && args.TryGetValue(key, out value) && value is int count && targets.Length > 0)
{
string truemsg = $"对角色 [ {targets[0]} ] 使用 {count} 个 [ {item.Name} ] 成功!";
if (item is HPRecovery expBook)
{
truemsg += $"回复了 {expBook.HP * times} 点生命值!";
truemsg += $"回复了 {expBook.HP * count} 点生命值!";
}
args["truemsg"] = truemsg;
}
}
else
{
args["truemsg"] = msg;
}
return result;
}
}

View File

@ -56,12 +56,23 @@ namespace Oshima.FunGame.OshimaModules.Items
}
}
args["msg"] = msg;
string truemsg = $"对角色 [ {targets[0]} ] 使用 {times} 个 [ {item.Name} ] 成功!";
if (result)
{
key = args.Keys.FirstOrDefault(s => s.Equals("useCount", StringComparison.CurrentCultureIgnoreCase)) ?? "";
if (key != "" && args.TryGetValue(key, out value) && value is int count && targets.Length > 0)
{
string truemsg = $"对角色 [ {targets[0]} ] 使用 {count} 个 [ {item.Name} ] 成功!";
if (item is HPRecovery expBook)
{
truemsg += $"回复了 {expBook.HP * times} 点生命值!";
truemsg += $"回复了 {expBook.HP * count} 点生命值!";
}
args["truemsg"] = truemsg;
}
}
else
{
args["truemsg"] = msg;
}
return result;
}
}

View File

@ -56,12 +56,23 @@ namespace Oshima.FunGame.OshimaModules.Items
}
}
args["msg"] = msg;
string truemsg = $"对角色 [ {targets[0]} ] 使用 {times} 个 [ {item.Name} ] 成功!";
if (result)
{
key = args.Keys.FirstOrDefault(s => s.Equals("useCount", StringComparison.CurrentCultureIgnoreCase)) ?? "";
if (key != "" && args.TryGetValue(key, out value) && value is int count && targets.Length > 0)
{
string truemsg = $"对角色 [ {targets[0]} ] 使用 {count} 个 [ {item.Name} ] 成功!";
if (item is EXPBook expBook)
{
truemsg += $"获得了 {expBook.EXP * times} 点经验值!";
truemsg += $"获得了 {expBook.EXP * count} 点经验值!";
}
args["truemsg"] = truemsg;
}
}
else
{
args["truemsg"] = msg;
}
return result;
}
}

View File

@ -55,12 +55,23 @@ namespace Oshima.FunGame.OshimaModules.Items
}
}
args["msg"] = msg;
string truemsg = $"对角色 [ {targets[0]} ] 使用 {times} 个 [ {item.Name} ] 成功!";
if (result)
{
key = args.Keys.FirstOrDefault(s => s.Equals("useCount", StringComparison.CurrentCultureIgnoreCase)) ?? "";
if (key != "" && args.TryGetValue(key, out value) && value is int count && targets.Length > 0)
{
string truemsg = $"对角色 [ {targets[0]} ] 使用 {count} 个 [ {item.Name} ] 成功!";
if (item is EPAdd expBook)
{
truemsg += $"获得了 {expBook.EP * times} 点能量值!";
truemsg += $"获得了 {expBook.EP * count} 点能量值!";
}
args["truemsg"] = truemsg;
}
}
else
{
args["truemsg"] = msg;
}
return result;
}
}

View File

@ -55,12 +55,23 @@ namespace Oshima.FunGame.OshimaModules.Items
}
}
args["msg"] = msg;
string truemsg = $"对角色 [ {targets[0]} ] 使用 {times} 个 [ {item.Name} ] 成功!";
if (result)
{
key = args.Keys.FirstOrDefault(s => s.Equals("useCount", StringComparison.CurrentCultureIgnoreCase)) ?? "";
if (key != "" && args.TryGetValue(key, out value) && value is int count && targets.Length > 0)
{
string truemsg = $"对角色 [ {targets[0]} ] 使用 {count} 个 [ {item.Name} ] 成功!";
if (item is MPRecovery expBook)
{
truemsg += $"回复了 {expBook.MP * times} 点魔法值!";
truemsg += $"回复了 {expBook.MP * count} 点魔法值!";
}
args["truemsg"] = truemsg;
}
}
else
{
args["truemsg"] = msg;
}
return result;
}
}

View File

@ -41,7 +41,8 @@
= 18006,
= 18007,
= 18008,
= 18009
= 18009,
= 18010
}
public enum GiftBoxID : long

View File

@ -0,0 +1,13 @@
using Milimoe.FunGame.Core.Entity;
using Milimoe.FunGame.Core.Library.Constant;
namespace Oshima.FunGame.OshimaModules.Items
{
public class () : Item(ItemType.SpecialItem)
{
public override long Id => (long)SpecialItemID.;
public override string Name => "改名卡";
public override string Description => "拥有改名卡时,可以使用【自定义改名】指令,来自定义个性化昵称。新昵称需要经过审核。";
public override QualityType QualityType => QualityType.Orange;
}
}

View File

@ -51,6 +51,7 @@ namespace Oshima.FunGame.OshimaModules
(long)SpecialItemID. => new (),
(long)SpecialItemID. => new (),
(long)SpecialItemID. => new (),
(long)SpecialItemID. => new (),
(long)ConsumableID. => new (),
(long)ConsumableID. => new (),
(long)ConsumableID. => new (),

View File

@ -29,6 +29,7 @@ namespace Oshima.FunGame.OshimaServers.Service
public static List<Item> AllItems { get; } = [];
public static List<Skill> AllSkills { get; } = [];
public static Dictionary<long, User> UserIdAndUsername { get; } = [];
public static Dictionary<long, Item> MarketItemIdAndItem { get; } = [];
public static ItemType[] ItemCanUsed => [ItemType.Consumable, ItemType.MagicCard, ItemType.SpecialItem, ItemType.GiftBox, ItemType.Others];
public static ItemType[] ItemCanNotDrawCard => [ItemType.Collectible, ItemType.QuestItem, ItemType.GiftBox, ItemType.Others];

View File

@ -63,7 +63,7 @@ namespace Oshima.FunGame.OshimaServers.Service
FunGameConstant.Items.AddRange(exItems.Values.Where(i => (int)i.ItemType > 4));
FunGameConstant.Items.AddRange([new (), new (), new (), new (), new (), new (), new (), new (), new (), new (),
new (), new (), new (), new 1(), new 2(), new 3(), new 1(), new 2(), new 3(), new (), new (), new (), new (),
new 1(), new 2(), new 3(), new (), new (), new (), new ()
new 1(), new 2(), new 3(), new (), new (), new (), new (), new ()
]);
FunGameConstant.AllItems.AddRange(FunGameConstant.Equipment);
@ -727,7 +727,8 @@ namespace Oshima.FunGame.OshimaServers.Service
int r = Random.Shared.Next(8);
double q = Random.Shared.NextDouble() * 100;
QualityType type = QualityType.White;
foreach (QualityType typeTemp in FunGameConstant.DrawCardProbabilities.Keys.OrderByDescending(o => (int)o))
QualityType[] types = [.. FunGameConstant.DrawCardProbabilities.Keys.OrderByDescending(o => (int)o)];
foreach (QualityType typeTemp in types)
{
if (q <= FunGameConstant.DrawCardProbabilities[typeTemp])
{
@ -848,7 +849,8 @@ namespace Oshima.FunGame.OshimaServers.Service
// 生成随机数并确定品质
double randomValue = Random.Shared.NextDouble() * 100;
QualityType type = QualityType.White;
foreach (QualityType typeTemp in adjustedProbabilities.Keys.OrderByDescending(o => (int)o))
QualityType[] types = [.. adjustedProbabilities.Keys.OrderByDescending(o => (int)o)];
foreach (QualityType typeTemp in types)
{
if (randomValue <= adjustedProbabilities[typeTemp])
{
@ -1259,7 +1261,7 @@ namespace Oshima.FunGame.OshimaServers.Service
if (item is cardBox)
{
List<string> cards = [];
for (int i = 0; i< cardBox.Count; i++)
for (int i = 0; i < cardBox.Count; i++)
{
Item newItem = GenerateMagicCard(item.QualityType);
if (newItem.QualityType >= QualityType.Orange) newItem.IsLock = true;
@ -1766,7 +1768,8 @@ namespace Oshima.FunGame.OshimaServers.Service
// 生成任务奖励物品
QualityType qualityType = QualityType.Blue;
foreach (QualityType qt in pE.Keys.OrderByDescending(q => (int)q))
QualityType[] types = [.. pE.Keys.OrderByDescending(q => (int)q)];
foreach (QualityType qt in types)
{
if (Random.Shared.NextDouble() <= pE[qt])
{
@ -1782,7 +1785,8 @@ namespace Oshima.FunGame.OshimaServers.Service
items.Add(item);
itemsCount[item.Name] = 1;
foreach (QualityType qt in pE.Keys.OrderByDescending(q => (int)q))
types = [.. pE.Keys.OrderByDescending(q => (int)q)];
foreach (QualityType qt in types)
{
if (Random.Shared.NextDouble() <= pE[qt])
{
@ -1898,7 +1902,8 @@ namespace Oshima.FunGame.OshimaServers.Service
{
// 从缓存中获取收集的物品
List<string> willRemove = [];
foreach (string item in value.Distinct())
string[] itemsLoop = [.. value.Distinct()];
foreach (string item in itemsLoop)
{
IEnumerable<string> items = value.Where(str => str == item);
IEnumerable<Quest> progressiveQuests = quests.Values.Where(q => q.QuestType == QuestType.Progressive && q.Status == QuestState.InProgress);
@ -1944,6 +1949,13 @@ namespace Oshima.FunGame.OshimaServers.Service
newItem.User = user;
if (newItem.QualityType >= QualityType.Orange) newItem.IsLock = true;
SetSellAndTradeTime(newItem);
int min = 0, max = 0;
if (FunGameConstant.PriceRanges.TryGetValue(item.QualityType, out (int Min, int Max) range))
{
(min, max) = (range.Min, range.Max);
}
double price = Random.Shared.Next(min, max) * 0.35;
newItem.Price = price;
user.Inventory.Items.Add(newItem);
// 连接到任务系统
AddExploreItemCache(user.Id, item.Name);
@ -2132,7 +2144,8 @@ namespace Oshima.FunGame.OshimaServers.Service
public static async Task UpdateRegionWeather()
{
foreach (Region region in FunGameConstant.Regions.Union(FunGameConstant.PlayerRegions))
Region[] regions = [.. FunGameConstant.Regions.Union(FunGameConstant.PlayerRegions)];
foreach (Region region in regions)
{
region.ChangeRandomWeather();
}
@ -2159,10 +2172,12 @@ namespace Oshima.FunGame.OshimaServers.Service
{
List<string> willRemove = [];
IEnumerable<Activity> activityList = Activities.Where(a => a.Status == ActivityState.InProgress);
foreach (string item in ActivitiesCharacterCache.Distinct())
IEnumerable<string> itemsLoop = ActivitiesCharacterCache.Distinct();
foreach (string item in itemsLoop)
{
IEnumerable<string> items = ActivitiesCharacterCache.Where(str => str == item);
foreach (Quest quest in activityList.SelectMany(a => a.Quests).Where(q => q.Status == QuestState.InProgress))
IEnumerable<Quest> quests = activityList.SelectMany(a => a.Quests).Where(q => q.Status == QuestState.InProgress);
foreach (Quest quest in quests)
{
if (quest.NeedyExploreCharacterName == item)
{
@ -2183,10 +2198,12 @@ namespace Oshima.FunGame.OshimaServers.Service
{
List<string> willRemove = [];
IEnumerable<Activity> activityList = Activities.Where(a => a.Status == ActivityState.InProgress);
foreach (string item in ActivitiesItemCache.Distinct())
IEnumerable<string> itemsLoop = ActivitiesItemCache.Distinct();
foreach (string item in itemsLoop)
{
IEnumerable<string> items = ActivitiesItemCache.Where(str => str == item);
foreach (Quest quest in activityList.SelectMany(a => a.Quests).Where(q => q.Status == QuestState.InProgress))
IEnumerable<Quest> quests = activityList.SelectMany(a => a.Quests).Where(q => q.Status == QuestState.InProgress);
foreach (Quest quest in quests)
{
if (quest.NeedyExploreItemName == item)
{
@ -2207,10 +2224,12 @@ namespace Oshima.FunGame.OshimaServers.Service
{
List<string> willRemove = [];
IEnumerable<Activity> activityList = Activities.Where(a => a.Status == ActivityState.InProgress);
foreach (string item in ActivitiesEventCache.Distinct())
IEnumerable<string> itemsLoop = ActivitiesEventCache.Distinct();
foreach (string item in itemsLoop)
{
IEnumerable<string> items = ActivitiesEventCache.Where(str => str == item);
foreach (Quest quest in activityList.SelectMany(a => a.Quests).Where(q => q.Status == QuestState.InProgress))
IEnumerable<Quest> quests = activityList.SelectMany(a => a.Quests).Where(q => q.Status == QuestState.InProgress);
foreach (Quest quest in quests)
{
if (quest.NeedyExploreEventName == item)
{
@ -2322,6 +2341,7 @@ namespace Oshima.FunGame.OshimaServers.Service
public static async Task GenerateExploreModel(ExploreModel model, OshimaRegion region, long[] characterIds, User user)
{
QualityType[] types = [];
int characterCount = characterIds.Length;
int diff = region.Difficulty switch
{
@ -2597,7 +2617,8 @@ namespace Oshima.FunGame.OshimaServers.Service
if (Random.Shared.NextDouble() > 0.6)
{
QualityType qualityType = QualityType.Blue;
foreach (QualityType type in pE.Keys.OrderByDescending(q => (int)q))
types = [.. pE.Keys.OrderByDescending(q => (int)q)];
foreach (QualityType type in types)
{
if (Random.Shared.NextDouble() <= pE[type])
{
@ -2637,7 +2658,8 @@ namespace Oshima.FunGame.OshimaServers.Service
break;
case ExploreResult.Earned:
QualityType quality = QualityType.Blue;
foreach (QualityType type in pE.Keys.OrderByDescending(q => (int)q))
types = [.. pE.Keys.OrderByDescending(q => (int)q)];
foreach (QualityType type in types)
{
if (Random.Shared.NextDouble() <= pE[type])
{
@ -2717,6 +2739,13 @@ namespace Oshima.FunGame.OshimaServers.Service
newItem.User = user;
if (newItem.QualityType >= QualityType.Orange) newItem.IsLock = true;
SetSellAndTradeTime(newItem);
int min = 0, max = 0;
if (FunGameConstant.PriceRanges.TryGetValue(item.QualityType, out (int Min, int Max) range))
{
(min, max) = (range.Min, range.Max);
}
double price = Random.Shared.Next(min, max) * 0.35;
newItem.Price = price;
user.Inventory.Items.Add(newItem);
// 连接到任务系统
AddExploreItemCache(user.Id, item.Name);
@ -2815,7 +2844,7 @@ namespace Oshima.FunGame.OshimaServers.Service
{
return "无法找到报价的接收方,请稍后再试。";
}
User addUser = isOpposite ? user2: user;
User addUser = isOpposite ? user2 : user;
offer.OfferorItems = [.. SQLService.GetOfferItemsByOfferIdAndUserId(sql, offerId, user)];
offer.OffereeItems = [.. SQLService.GetOfferItemsByOfferIdAndUserId(sql, offerId, user2)];
@ -2835,6 +2864,14 @@ namespace Oshima.FunGame.OshimaServers.Service
continue;
}
if (SQLService.IsItemInOffers(sql, item.Guid))
{
result = false;
if (msg != "") msg += "\r\n";
msg += $"物品 {itemIndex}. {item.Name}:此物品已经在其它的交易报价中了,无法多次添加。";
break;
}
if (item.IsLock)
{
result = false;
@ -2993,8 +3030,8 @@ namespace Oshima.FunGame.OshimaServers.Service
else
{
offers = sql.GetOffersByOfferor(user.Id);
offers = [.. offers, ..sql.GetOffersByOfferee(user.Id)];
offers = [.. offers.DistinctBy(o => o.Id)];
offers = [.. offers, .. sql.GetOffersByOfferee(user.Id)];
offers = [.. offers.DistinctBy(o => o.Id).OrderByDescending(o => o.Id)];
}
}
return offers;
@ -3153,6 +3190,10 @@ namespace Oshima.FunGame.OshimaServers.Service
offer.OffereeItems = [.. SQLService.GetOfferItemsByOfferIdAndUserId(sql, offerId, user)];
offer.OfferorItems = [.. SQLService.GetOfferItemsByOfferIdAndUserId(sql, offerId, user2)];
PluginConfig itemsTradeRecord = new("trades", offerId.ToString());
List<Item> offerorItems = [];
List<Item> offereeItems = [];
foreach (Guid itemGuid in offer.OffereeItems)
{
if (user.Inventory.Items.FirstOrDefault(i => i.Guid == itemGuid) is Item item)
@ -3166,6 +3207,8 @@ namespace Oshima.FunGame.OshimaServers.Service
newItem.NextSellableTime = DateTimeUtility.GetTradableTime();
newItem.NextTradableTime = DateTimeUtility.GetTradableTime();
user2.Inventory.Items.Add(newItem);
offereeItems.Add(newItem);
}
}
foreach (Guid itemGuid in offer.OfferorItems)
@ -3181,8 +3224,15 @@ namespace Oshima.FunGame.OshimaServers.Service
newItem.NextSellableTime = DateTimeUtility.GetTradableTime();
newItem.NextTradableTime = DateTimeUtility.GetTradableTime();
user.Inventory.Items.Add(newItem);
offerorItems.Add(newItem);
}
}
itemsTradeRecord.Add("offeror", offerorItems);
itemsTradeRecord.Add("offeree", offereeItems);
itemsTradeRecord.SaveConfig();
user.LastTime = DateTime.Now;
pc.Add("user", user);
pc.SaveConfig();

View File

@ -54,10 +54,11 @@ namespace Oshima.FunGame.OshimaServers.Service
return offers;
}
public static List<Guid> GetOfferItemsByOfferIdAndUserId(SQLHelper helper, long offerId, User user)
public static List<Guid> GetOfferItemsByOfferIdAndUserId(SQLHelper helper, long offerId, User user, long userId = -1)
{
if (userId == -1) userId = user.Id;
List<Guid> itemGuids = [];
DataSet ds = helper.ExecuteDataSet(OfferItemsQuery.Select_OfferItemsByOfferIdAndUserId(helper, offerId, user.Id));
DataSet ds = helper.ExecuteDataSet(OfferItemsQuery.Select_OfferItemsByOfferIdAndUserId(helper, offerId, userId));
if (user != null && helper.Success)
{
foreach (DataRow dr in ds.Tables[0].Rows)
@ -71,6 +72,29 @@ namespace Oshima.FunGame.OshimaServers.Service
return itemGuids;
}
public static List<Guid> GetUserItemGuids(SQLHelper helper, long userId)
{
helper.Parameters["UserId"] = userId;
DataSet ds = helper.ExecuteDataSet($"select {OfferItemsQuery.TableName}.{OfferItemsQuery.Column_ItemGuid} from {OffersQuery.TableName}\r\n" +
$"left join {OfferItemsQuery.TableName} on {OfferItemsQuery.TableName}.{OfferItemsQuery.Column_OfferId} = {OffersQuery.TableName}.{OffersQuery.Column_Id}\r\n" +
$"where {OfferItemsQuery.Column_UserId} = @UserId and {OffersQuery.Column_Status} not in ({(int)OfferState.Cancelled}, {(int)OfferState.Rejected}, {(int)OfferState.Completed})");
List<Guid> list = [];
if (helper.Success)
{
list = [.. ds.Tables[0].AsEnumerable().Select(dr => Guid.TryParse(dr.Field<string>(OfferItemsQuery.Column_ItemGuid), out Guid guid) ? guid : Guid.Empty)];
}
return list;
}
public static bool IsItemInOffers(SQLHelper helper, Guid itemGuid)
{
helper.Parameters["ItemGuid"] = itemGuid.ToString();
helper.ExecuteDataSet($"select {OffersQuery.TableName}.{OffersQuery.Column_Id} from {OffersQuery.TableName}\r\n" +
$"left join {OfferItemsQuery.TableName} on {OfferItemsQuery.TableName}.{OfferItemsQuery.Column_OfferId} = {OffersQuery.TableName}.{OffersQuery.Column_Id}\r\n" +
$"where {OfferItemsQuery.Column_ItemGuid} = @ItemGuid and {OffersQuery.Column_Status} not in ({(int)OfferState.Cancelled}, {(int)OfferState.Rejected}, {(int)OfferState.Completed})");
return helper.Success;
}
public static void AddOffer(SQLHelper helper, long offeror, long offeree, OfferState status = OfferState.Created, int negotiatedTimes = 0)
{
bool hasTransaction = helper.Transaction != null;
@ -248,12 +272,12 @@ namespace Oshima.FunGame.OshimaServers.Service
offer.Status = (OfferState)Convert.ToInt32(dr[OffersQuery.Column_Status]);
offer.NegotiatedTimes = Convert.ToInt32(dr[OffersQuery.Column_NegotiatedTimes]);
if (dr[OffersQuery.Column_CreateTime] != DBNull.Value && DateTime.TryParseExact(dr[OffersQuery.Column_CreateTime].ToString(), General.GeneralDateTimeFormat, null, System.Globalization.DateTimeStyles.None, out DateTime dt))
if (dr[OffersQuery.Column_CreateTime] != DBNull.Value && DateTime.TryParse(dr[OffersQuery.Column_CreateTime].ToString(), out DateTime dt))
{
offer.CreateTime = dt;
}
if (dr[OffersQuery.Column_FinishTime] != DBNull.Value && DateTime.TryParseExact(dr[OffersQuery.Column_FinishTime].ToString(), General.GeneralDateTimeFormat, null, System.Globalization.DateTimeStyles.None, out dt))
if (dr[OffersQuery.Column_FinishTime] != DBNull.Value && DateTime.TryParse(dr[OffersQuery.Column_FinishTime].ToString(), out dt))
{
offer.FinishTime = dt;
}

File diff suppressed because it is too large Load Diff

View File

@ -625,6 +625,13 @@ namespace Oshima.FunGame.WebAPI.Services
}
if (e.Detail == "还原存档")
{
e.UseNotice = false;
await SendAsync(e, "还原存档", "\r\n请在该指令前添加【确认】二字即使用【确认还原存档】指令。");
return result;
}
if (e.Detail == "确认还原存档")
{
string msg = Controller.RestoreSaved(uid);
if (msg != "")
@ -639,12 +646,19 @@ namespace Oshima.FunGame.WebAPI.Services
string msg = Controller.NewCustomCharacter(uid);
if (msg != "")
{
await SendAsync(e, "抽卡", "\r\n" + msg);
await SendAsync(e, "生成自建角色", "\r\n" + msg);
}
return result;
}
if (e.Detail == "角色改名")
{
e.UseNotice = false;
await SendAsync(e, "改名", "\r\n为防止玩家手误更改自己的昵称请在该指令前添加【确认】二字即使用【确认角色改名】指令。");
return result;
}
if (e.Detail == "确认角色改名")
{
string msg = Controller.ReName(uid);
if (msg != "")
@ -654,6 +668,85 @@ namespace Oshima.FunGame.WebAPI.Services
return result;
}
if (e.Detail == "查询改名")
{
string msg = Controller.GetReNameInfo(uid);
if (msg != "")
{
await SendAsync(e, "查询改名", "\r\n" + msg);
}
return result;
}
if (e.Detail.StartsWith("改名审核"))
{
string detail = e.Detail.Replace("改名审核", "").Trim();
string msg = "";
if (int.TryParse(detail, out int page))
{
msg = Controller.GetReNameExamines(uid, page);
}
else
{
msg = Controller.GetReNameExamines(uid);
}
if (msg != "")
{
await SendAsync(e, "改名审核", msg);
}
return result;
}
if (e.Detail.StartsWith("改名拒绝"))
{
string detail = e.Detail.Replace("改名拒绝", "").Trim();
string msg = "";
if (long.TryParse(detail, out long target))
{
msg = Controller.ApproveReName(uid, target, false);
}
if (msg != "")
{
await SendAsync(e, "改名拒绝", msg);
}
return result;
}
if (e.Detail.StartsWith("改名批准"))
{
string detail = e.Detail.Replace("改名批准", "").Trim();
string msg = "";
if (long.TryParse(detail, out long target))
{
msg = Controller.ApproveReName(uid, target);
}
if (msg != "")
{
await SendAsync(e, "改名批准", msg);
}
return result;
}
if (e.Detail.StartsWith("自定义改名"))
{
e.UseNotice = false;
await SendAsync(e, "改名", "\r\n自定义改名说明自定义改名需要库存中存在至少一张未上锁、且未处于交易、市场出售状态的改名卡提交改名申请后需要等待审核。" +
"在审核期间,改名卡将会被系统锁定,无法取消、重复提交申请,也不能解锁、分解、交易、出售该改名卡。如已知悉请在该指令前添加【确认】二字,即使用【确认自定义改名】指令。");
return result;
}
if (e.Detail.StartsWith("确认自定义改名"))
{
e.UseNotice = false;
string detail = e.Detail.Replace("自定义改名", "").Trim();
string msg = Controller.ReName_Custom(uid, detail);
if (msg != "")
{
await SendAsync(e, "改名", "\r\n" + msg);
}
return result;
}
if (e.Detail == "角色重随")
{
string msg = Controller.RandomCustomCharacter(uid, false);
@ -998,12 +1091,7 @@ namespace Oshima.FunGame.WebAPI.Services
if (int.TryParse(detail, out int index))
{
List<string> msgs = Controller.AcceptQuest(uid, index);
int count = 1;
foreach (string msg in msgs)
{
await SendAsync(e, "开始任务", msg, msgSeq: count++);
await Task.Delay(2000);
}
await SendAsync(e, "开始任务", string.Join("\r\n", msgs));
}
return result;
}
@ -2454,6 +2542,26 @@ namespace Oshima.FunGame.WebAPI.Services
return result;
}
if (e.Detail.StartsWith("商店出售", StringComparison.CurrentCultureIgnoreCase))
{
string detail = e.Detail.Replace("商店出售", "").Trim();
List<int> ids = [];
foreach (string str in detail.Split(' ', StringSplitOptions.TrimEntries | StringSplitOptions.RemoveEmptyEntries))
{
if (int.TryParse(str, out int id))
{
ids.Add(id);
}
}
string msg = Controller.StoreSellItem(uid, [.. ids]);
if (msg != "")
{
await SendAsync(e, "商店出售", msg);
}
return result;
}
if (uid == GeneralSettings.Master && e.Detail.StartsWith("重载FunGame", StringComparison.CurrentCultureIgnoreCase))
{
string msg = Controller.Relaod(uid);