forked from Oshima-Studios/OshimaGameModule
新增改名和审核系统
This commit is contained in:
parent
53fed27111
commit
cc605d8483
@ -55,12 +55,23 @@ namespace Oshima.FunGame.OshimaModules.Items
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
args["msg"] = msg;
|
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)
|
if (item is HPRecovery expBook)
|
||||||
{
|
{
|
||||||
truemsg += $"回复了 {expBook.HP * times} 点生命值!";
|
truemsg += $"回复了 {expBook.HP * count} 点生命值!";
|
||||||
}
|
}
|
||||||
args["truemsg"] = truemsg;
|
args["truemsg"] = truemsg;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
args["truemsg"] = msg;
|
||||||
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -56,12 +56,23 @@ namespace Oshima.FunGame.OshimaModules.Items
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
args["msg"] = msg;
|
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)
|
if (item is HPRecovery expBook)
|
||||||
{
|
{
|
||||||
truemsg += $"回复了 {expBook.HP * times} 点生命值!";
|
truemsg += $"回复了 {expBook.HP * count} 点生命值!";
|
||||||
}
|
}
|
||||||
args["truemsg"] = truemsg;
|
args["truemsg"] = truemsg;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
args["truemsg"] = msg;
|
||||||
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -56,12 +56,23 @@ namespace Oshima.FunGame.OshimaModules.Items
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
args["msg"] = msg;
|
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)
|
if (item is EXPBook expBook)
|
||||||
{
|
{
|
||||||
truemsg += $"获得了 {expBook.EXP * times} 点经验值!";
|
truemsg += $"获得了 {expBook.EXP * count} 点经验值!";
|
||||||
}
|
}
|
||||||
args["truemsg"] = truemsg;
|
args["truemsg"] = truemsg;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
args["truemsg"] = msg;
|
||||||
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -55,12 +55,23 @@ namespace Oshima.FunGame.OshimaModules.Items
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
args["msg"] = msg;
|
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)
|
if (item is EPAdd expBook)
|
||||||
{
|
{
|
||||||
truemsg += $"获得了 {expBook.EP * times} 点能量值!";
|
truemsg += $"获得了 {expBook.EP * count} 点能量值!";
|
||||||
}
|
}
|
||||||
args["truemsg"] = truemsg;
|
args["truemsg"] = truemsg;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
args["truemsg"] = msg;
|
||||||
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -55,12 +55,23 @@ namespace Oshima.FunGame.OshimaModules.Items
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
args["msg"] = msg;
|
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)
|
if (item is MPRecovery expBook)
|
||||||
{
|
{
|
||||||
truemsg += $"回复了 {expBook.MP * times} 点魔法值!";
|
truemsg += $"回复了 {expBook.MP * count} 点魔法值!";
|
||||||
}
|
}
|
||||||
args["truemsg"] = truemsg;
|
args["truemsg"] = truemsg;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
args["truemsg"] = msg;
|
||||||
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -41,7 +41,8 @@
|
|||||||
奥术符文 = 18006,
|
奥术符文 = 18006,
|
||||||
混沌之核 = 18007,
|
混沌之核 = 18007,
|
||||||
奖券 = 18008,
|
奖券 = 18008,
|
||||||
十连奖券 = 18009
|
十连奖券 = 18009,
|
||||||
|
改名卡 = 18010
|
||||||
}
|
}
|
||||||
|
|
||||||
public enum GiftBoxID : long
|
public enum GiftBoxID : long
|
||||||
|
|||||||
13
OshimaModules/Items/SpecialItem/改名卡.cs
Normal file
13
OshimaModules/Items/SpecialItem/改名卡.cs
Normal 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;
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -51,6 +51,7 @@ namespace Oshima.FunGame.OshimaModules
|
|||||||
(long)SpecialItemID.混沌之核 => new 混沌之核(),
|
(long)SpecialItemID.混沌之核 => new 混沌之核(),
|
||||||
(long)SpecialItemID.奖券 => new 奖券(),
|
(long)SpecialItemID.奖券 => new 奖券(),
|
||||||
(long)SpecialItemID.十连奖券 => new 十连奖券(),
|
(long)SpecialItemID.十连奖券 => new 十连奖券(),
|
||||||
|
(long)SpecialItemID.改名卡 => new 改名卡(),
|
||||||
(long)ConsumableID.小回复药 => new 小回复药(),
|
(long)ConsumableID.小回复药 => new 小回复药(),
|
||||||
(long)ConsumableID.中回复药 => new 中回复药(),
|
(long)ConsumableID.中回复药 => new 中回复药(),
|
||||||
(long)ConsumableID.大回复药 => new 大回复药(),
|
(long)ConsumableID.大回复药 => new 大回复药(),
|
||||||
|
|||||||
@ -29,6 +29,7 @@ namespace Oshima.FunGame.OshimaServers.Service
|
|||||||
public static List<Item> AllItems { get; } = [];
|
public static List<Item> AllItems { get; } = [];
|
||||||
public static List<Skill> AllSkills { get; } = [];
|
public static List<Skill> AllSkills { get; } = [];
|
||||||
public static Dictionary<long, User> UserIdAndUsername { 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[] ItemCanUsed => [ItemType.Consumable, ItemType.MagicCard, ItemType.SpecialItem, ItemType.GiftBox, ItemType.Others];
|
||||||
public static ItemType[] ItemCanNotDrawCard => [ItemType.Collectible, ItemType.QuestItem, ItemType.GiftBox, ItemType.Others];
|
public static ItemType[] ItemCanNotDrawCard => [ItemType.Collectible, ItemType.QuestItem, ItemType.GiftBox, ItemType.Others];
|
||||||
|
|
||||||
|
|||||||
@ -63,7 +63,7 @@ namespace Oshima.FunGame.OshimaServers.Service
|
|||||||
FunGameConstant.Items.AddRange(exItems.Values.Where(i => (int)i.ItemType > 4));
|
FunGameConstant.Items.AddRange(exItems.Values.Where(i => (int)i.ItemType > 4));
|
||||||
FunGameConstant.Items.AddRange([new 小经验书(), new 中经验书(), new 大经验书(), new 升华之印(), new 流光之印(), new 永恒之印(), new 技能卷轴(), new 智慧之果(), new 奥术符文(), new 混沌之核(),
|
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 小回复药(), 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);
|
FunGameConstant.AllItems.AddRange(FunGameConstant.Equipment);
|
||||||
@ -727,7 +727,8 @@ namespace Oshima.FunGame.OshimaServers.Service
|
|||||||
int r = Random.Shared.Next(8);
|
int r = Random.Shared.Next(8);
|
||||||
double q = Random.Shared.NextDouble() * 100;
|
double q = Random.Shared.NextDouble() * 100;
|
||||||
QualityType type = QualityType.White;
|
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])
|
if (q <= FunGameConstant.DrawCardProbabilities[typeTemp])
|
||||||
{
|
{
|
||||||
@ -848,7 +849,8 @@ namespace Oshima.FunGame.OshimaServers.Service
|
|||||||
// 生成随机数并确定品质
|
// 生成随机数并确定品质
|
||||||
double randomValue = Random.Shared.NextDouble() * 100;
|
double randomValue = Random.Shared.NextDouble() * 100;
|
||||||
QualityType type = QualityType.White;
|
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])
|
if (randomValue <= adjustedProbabilities[typeTemp])
|
||||||
{
|
{
|
||||||
@ -1766,7 +1768,8 @@ namespace Oshima.FunGame.OshimaServers.Service
|
|||||||
|
|
||||||
// 生成任务奖励物品
|
// 生成任务奖励物品
|
||||||
QualityType qualityType = QualityType.Blue;
|
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])
|
if (Random.Shared.NextDouble() <= pE[qt])
|
||||||
{
|
{
|
||||||
@ -1782,7 +1785,8 @@ namespace Oshima.FunGame.OshimaServers.Service
|
|||||||
items.Add(item);
|
items.Add(item);
|
||||||
itemsCount[item.Name] = 1;
|
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])
|
if (Random.Shared.NextDouble() <= pE[qt])
|
||||||
{
|
{
|
||||||
@ -1898,7 +1902,8 @@ namespace Oshima.FunGame.OshimaServers.Service
|
|||||||
{
|
{
|
||||||
// 从缓存中获取收集的物品
|
// 从缓存中获取收集的物品
|
||||||
List<string> willRemove = [];
|
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<string> items = value.Where(str => str == item);
|
||||||
IEnumerable<Quest> progressiveQuests = quests.Values.Where(q => q.QuestType == QuestType.Progressive && q.Status == QuestState.InProgress);
|
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;
|
newItem.User = user;
|
||||||
if (newItem.QualityType >= QualityType.Orange) newItem.IsLock = true;
|
if (newItem.QualityType >= QualityType.Orange) newItem.IsLock = true;
|
||||||
SetSellAndTradeTime(newItem);
|
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);
|
user.Inventory.Items.Add(newItem);
|
||||||
// 连接到任务系统
|
// 连接到任务系统
|
||||||
AddExploreItemCache(user.Id, item.Name);
|
AddExploreItemCache(user.Id, item.Name);
|
||||||
@ -2132,7 +2144,8 @@ namespace Oshima.FunGame.OshimaServers.Service
|
|||||||
|
|
||||||
public static async Task UpdateRegionWeather()
|
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();
|
region.ChangeRandomWeather();
|
||||||
}
|
}
|
||||||
@ -2159,10 +2172,12 @@ namespace Oshima.FunGame.OshimaServers.Service
|
|||||||
{
|
{
|
||||||
List<string> willRemove = [];
|
List<string> willRemove = [];
|
||||||
IEnumerable<Activity> activityList = Activities.Where(a => a.Status == ActivityState.InProgress);
|
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);
|
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)
|
if (quest.NeedyExploreCharacterName == item)
|
||||||
{
|
{
|
||||||
@ -2183,10 +2198,12 @@ namespace Oshima.FunGame.OshimaServers.Service
|
|||||||
{
|
{
|
||||||
List<string> willRemove = [];
|
List<string> willRemove = [];
|
||||||
IEnumerable<Activity> activityList = Activities.Where(a => a.Status == ActivityState.InProgress);
|
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);
|
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)
|
if (quest.NeedyExploreItemName == item)
|
||||||
{
|
{
|
||||||
@ -2207,10 +2224,12 @@ namespace Oshima.FunGame.OshimaServers.Service
|
|||||||
{
|
{
|
||||||
List<string> willRemove = [];
|
List<string> willRemove = [];
|
||||||
IEnumerable<Activity> activityList = Activities.Where(a => a.Status == ActivityState.InProgress);
|
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);
|
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)
|
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)
|
public static async Task GenerateExploreModel(ExploreModel model, OshimaRegion region, long[] characterIds, User user)
|
||||||
{
|
{
|
||||||
|
QualityType[] types = [];
|
||||||
int characterCount = characterIds.Length;
|
int characterCount = characterIds.Length;
|
||||||
int diff = region.Difficulty switch
|
int diff = region.Difficulty switch
|
||||||
{
|
{
|
||||||
@ -2597,7 +2617,8 @@ namespace Oshima.FunGame.OshimaServers.Service
|
|||||||
if (Random.Shared.NextDouble() > 0.6)
|
if (Random.Shared.NextDouble() > 0.6)
|
||||||
{
|
{
|
||||||
QualityType qualityType = QualityType.Blue;
|
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])
|
if (Random.Shared.NextDouble() <= pE[type])
|
||||||
{
|
{
|
||||||
@ -2637,7 +2658,8 @@ namespace Oshima.FunGame.OshimaServers.Service
|
|||||||
break;
|
break;
|
||||||
case ExploreResult.Earned:
|
case ExploreResult.Earned:
|
||||||
QualityType quality = QualityType.Blue;
|
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])
|
if (Random.Shared.NextDouble() <= pE[type])
|
||||||
{
|
{
|
||||||
@ -2717,6 +2739,13 @@ namespace Oshima.FunGame.OshimaServers.Service
|
|||||||
newItem.User = user;
|
newItem.User = user;
|
||||||
if (newItem.QualityType >= QualityType.Orange) newItem.IsLock = true;
|
if (newItem.QualityType >= QualityType.Orange) newItem.IsLock = true;
|
||||||
SetSellAndTradeTime(newItem);
|
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);
|
user.Inventory.Items.Add(newItem);
|
||||||
// 连接到任务系统
|
// 连接到任务系统
|
||||||
AddExploreItemCache(user.Id, item.Name);
|
AddExploreItemCache(user.Id, item.Name);
|
||||||
@ -2835,6 +2864,14 @@ namespace Oshima.FunGame.OshimaServers.Service
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (SQLService.IsItemInOffers(sql, item.Guid))
|
||||||
|
{
|
||||||
|
result = false;
|
||||||
|
if (msg != "") msg += "\r\n";
|
||||||
|
msg += $"物品 {itemIndex}. {item.Name}:此物品已经在其它的交易报价中了,无法多次添加。";
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
if (item.IsLock)
|
if (item.IsLock)
|
||||||
{
|
{
|
||||||
result = false;
|
result = false;
|
||||||
@ -2994,7 +3031,7 @@ namespace Oshima.FunGame.OshimaServers.Service
|
|||||||
{
|
{
|
||||||
offers = sql.GetOffersByOfferor(user.Id);
|
offers = sql.GetOffersByOfferor(user.Id);
|
||||||
offers = [.. offers, .. sql.GetOffersByOfferee(user.Id)];
|
offers = [.. offers, .. sql.GetOffersByOfferee(user.Id)];
|
||||||
offers = [.. offers.DistinctBy(o => o.Id)];
|
offers = [.. offers.DistinctBy(o => o.Id).OrderByDescending(o => o.Id)];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return offers;
|
return offers;
|
||||||
@ -3153,6 +3190,10 @@ namespace Oshima.FunGame.OshimaServers.Service
|
|||||||
offer.OffereeItems = [.. SQLService.GetOfferItemsByOfferIdAndUserId(sql, offerId, user)];
|
offer.OffereeItems = [.. SQLService.GetOfferItemsByOfferIdAndUserId(sql, offerId, user)];
|
||||||
offer.OfferorItems = [.. SQLService.GetOfferItemsByOfferIdAndUserId(sql, offerId, user2)];
|
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)
|
foreach (Guid itemGuid in offer.OffereeItems)
|
||||||
{
|
{
|
||||||
if (user.Inventory.Items.FirstOrDefault(i => i.Guid == itemGuid) is Item item)
|
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.NextSellableTime = DateTimeUtility.GetTradableTime();
|
||||||
newItem.NextTradableTime = DateTimeUtility.GetTradableTime();
|
newItem.NextTradableTime = DateTimeUtility.GetTradableTime();
|
||||||
user2.Inventory.Items.Add(newItem);
|
user2.Inventory.Items.Add(newItem);
|
||||||
|
|
||||||
|
offereeItems.Add(newItem);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
foreach (Guid itemGuid in offer.OfferorItems)
|
foreach (Guid itemGuid in offer.OfferorItems)
|
||||||
@ -3181,8 +3224,15 @@ namespace Oshima.FunGame.OshimaServers.Service
|
|||||||
newItem.NextSellableTime = DateTimeUtility.GetTradableTime();
|
newItem.NextSellableTime = DateTimeUtility.GetTradableTime();
|
||||||
newItem.NextTradableTime = DateTimeUtility.GetTradableTime();
|
newItem.NextTradableTime = DateTimeUtility.GetTradableTime();
|
||||||
user.Inventory.Items.Add(newItem);
|
user.Inventory.Items.Add(newItem);
|
||||||
|
|
||||||
|
offerorItems.Add(newItem);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
itemsTradeRecord.Add("offeror", offerorItems);
|
||||||
|
itemsTradeRecord.Add("offeree", offereeItems);
|
||||||
|
itemsTradeRecord.SaveConfig();
|
||||||
|
|
||||||
user.LastTime = DateTime.Now;
|
user.LastTime = DateTime.Now;
|
||||||
pc.Add("user", user);
|
pc.Add("user", user);
|
||||||
pc.SaveConfig();
|
pc.SaveConfig();
|
||||||
|
|||||||
@ -54,10 +54,11 @@ namespace Oshima.FunGame.OshimaServers.Service
|
|||||||
return offers;
|
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 = [];
|
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)
|
if (user != null && helper.Success)
|
||||||
{
|
{
|
||||||
foreach (DataRow dr in ds.Tables[0].Rows)
|
foreach (DataRow dr in ds.Tables[0].Rows)
|
||||||
@ -71,6 +72,29 @@ namespace Oshima.FunGame.OshimaServers.Service
|
|||||||
return itemGuids;
|
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)
|
public static void AddOffer(SQLHelper helper, long offeror, long offeree, OfferState status = OfferState.Created, int negotiatedTimes = 0)
|
||||||
{
|
{
|
||||||
bool hasTransaction = helper.Transaction != null;
|
bool hasTransaction = helper.Transaction != null;
|
||||||
@ -248,12 +272,12 @@ namespace Oshima.FunGame.OshimaServers.Service
|
|||||||
offer.Status = (OfferState)Convert.ToInt32(dr[OffersQuery.Column_Status]);
|
offer.Status = (OfferState)Convert.ToInt32(dr[OffersQuery.Column_Status]);
|
||||||
offer.NegotiatedTimes = Convert.ToInt32(dr[OffersQuery.Column_NegotiatedTimes]);
|
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;
|
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;
|
offer.FinishTime = dt;
|
||||||
}
|
}
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@ -625,6 +625,13 @@ namespace Oshima.FunGame.WebAPI.Services
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (e.Detail == "还原存档")
|
if (e.Detail == "还原存档")
|
||||||
|
{
|
||||||
|
e.UseNotice = false;
|
||||||
|
await SendAsync(e, "还原存档", "\r\n请在该指令前添加【确认】二字,即使用【确认还原存档】指令。");
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (e.Detail == "确认还原存档")
|
||||||
{
|
{
|
||||||
string msg = Controller.RestoreSaved(uid);
|
string msg = Controller.RestoreSaved(uid);
|
||||||
if (msg != "")
|
if (msg != "")
|
||||||
@ -639,12 +646,19 @@ namespace Oshima.FunGame.WebAPI.Services
|
|||||||
string msg = Controller.NewCustomCharacter(uid);
|
string msg = Controller.NewCustomCharacter(uid);
|
||||||
if (msg != "")
|
if (msg != "")
|
||||||
{
|
{
|
||||||
await SendAsync(e, "抽卡", "\r\n" + msg);
|
await SendAsync(e, "生成自建角色", "\r\n" + msg);
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (e.Detail == "角色改名")
|
if (e.Detail == "角色改名")
|
||||||
|
{
|
||||||
|
e.UseNotice = false;
|
||||||
|
await SendAsync(e, "改名", "\r\n为防止玩家手误更改自己的昵称,请在该指令前添加【确认】二字,即使用【确认角色改名】指令。");
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (e.Detail == "确认角色改名")
|
||||||
{
|
{
|
||||||
string msg = Controller.ReName(uid);
|
string msg = Controller.ReName(uid);
|
||||||
if (msg != "")
|
if (msg != "")
|
||||||
@ -654,6 +668,85 @@ namespace Oshima.FunGame.WebAPI.Services
|
|||||||
return result;
|
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 == "角色重随")
|
if (e.Detail == "角色重随")
|
||||||
{
|
{
|
||||||
string msg = Controller.RandomCustomCharacter(uid, false);
|
string msg = Controller.RandomCustomCharacter(uid, false);
|
||||||
@ -998,12 +1091,7 @@ namespace Oshima.FunGame.WebAPI.Services
|
|||||||
if (int.TryParse(detail, out int index))
|
if (int.TryParse(detail, out int index))
|
||||||
{
|
{
|
||||||
List<string> msgs = Controller.AcceptQuest(uid, index);
|
List<string> msgs = Controller.AcceptQuest(uid, index);
|
||||||
int count = 1;
|
await SendAsync(e, "开始任务", string.Join("\r\n", msgs));
|
||||||
foreach (string msg in msgs)
|
|
||||||
{
|
|
||||||
await SendAsync(e, "开始任务", msg, msgSeq: count++);
|
|
||||||
await Task.Delay(2000);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
@ -2454,6 +2542,26 @@ namespace Oshima.FunGame.WebAPI.Services
|
|||||||
return result;
|
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))
|
if (uid == GeneralSettings.Master && e.Detail.StartsWith("重载FunGame", StringComparison.CurrentCultureIgnoreCase))
|
||||||
{
|
{
|
||||||
string msg = Controller.Relaod(uid);
|
string msg = Controller.Relaod(uid);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user