mirror of
https://github.com/oshima-studios/OshimaGameModule.git
synced 2025-12-05 16:16:35 +00:00
完善共斗、社团,一些指令优化
This commit is contained in:
parent
5c55f6e48c
commit
5c619fea3e
@ -41,11 +41,14 @@ namespace Oshima.FunGame.OshimaModules.Models
|
|||||||
public static Dictionary<long, Room> UsersInRoom { get; set; } = [];
|
public static Dictionary<long, Room> UsersInRoom { get; set; } = [];
|
||||||
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];
|
||||||
|
public static Dictionary<long, double> UserForgingRanking { get; } = [];
|
||||||
public static Dictionary<long, int> UserHorseRacingRanking { get; } = [];
|
public static Dictionary<long, int> UserHorseRacingRanking { get; } = [];
|
||||||
|
public static Dictionary<long, int> UserCooperativeRanking { get; } = [];
|
||||||
public static Dictionary<long, double> UserCreditsRanking { get; } = [];
|
public static Dictionary<long, double> UserCreditsRanking { get; } = [];
|
||||||
public static Dictionary<long, double> UserMaterialsRanking { get; } = [];
|
public static Dictionary<long, double> UserMaterialsRanking { get; } = [];
|
||||||
public static Dictionary<long, double> UserEXPRanking { get; } = [];
|
public static Dictionary<long, double> UserEXPRanking { get; } = [];
|
||||||
public static Dictionary<long, double> UserSkillRanking { get; } = [];
|
public static Dictionary<long, double> UserSkillRanking { get; } = [];
|
||||||
|
public static Dictionary<long, Club> ClubIdAndClub { get; } = [];
|
||||||
public static DateTime RankingUpdateTime { get; set; } = DateTime.Now;
|
public static DateTime RankingUpdateTime { get; set; } = DateTime.Now;
|
||||||
public static char[] SplitChars => [',', ' ', ',', ';', ';'];
|
public static char[] SplitChars => [',', ' ', ',', ';', ';'];
|
||||||
|
|
||||||
|
|||||||
@ -40,6 +40,10 @@ namespace Oshima.FunGame.OshimaModules.Regions
|
|||||||
{
|
{
|
||||||
template = CreateNewHorseRacingStore();
|
template = CreateNewHorseRacingStore();
|
||||||
}
|
}
|
||||||
|
else if (storeName == "dokyo_cooperative")
|
||||||
|
{
|
||||||
|
template = CreateNewCooperativeStore();
|
||||||
|
}
|
||||||
else return null;
|
else return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -106,21 +110,24 @@ namespace Oshima.FunGame.OshimaModules.Regions
|
|||||||
{
|
{
|
||||||
if (storeName == "dokyo_forge")
|
if (storeName == "dokyo_forge")
|
||||||
{
|
{
|
||||||
double forgePoints = 0;
|
|
||||||
if (pc.TryGetValue("forgepoints", out object? value) && double.TryParse(value.ToString(), out double points))
|
if (pc.TryGetValue("forgepoints", out object? value) && double.TryParse(value.ToString(), out double points))
|
||||||
{
|
{
|
||||||
forgePoints = points;
|
return $"现有锻造积分:{points:0.##}";
|
||||||
}
|
}
|
||||||
return $"现有锻造积分:{forgePoints:0.##}";
|
|
||||||
}
|
}
|
||||||
else if (storeName == "dokyo_horseracing")
|
else if (storeName == "dokyo_horseracing")
|
||||||
{
|
{
|
||||||
double horseRacingPoints = 0;
|
if (pc.TryGetValue("horseRacingPoints", out object? value) && int.TryParse(value.ToString(), out int points))
|
||||||
if (pc.TryGetValue("horseRacingPoints", out object? value) && double.TryParse(value.ToString(), out double points))
|
|
||||||
{
|
{
|
||||||
horseRacingPoints = points;
|
return $"现有赛马积分:{points:0.##}";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (storeName == "dokyo_cooperative")
|
||||||
|
{
|
||||||
|
if (pc.TryGetValue("cooperativePoints", out object? value) && int.TryParse(value.ToString(), out int points))
|
||||||
|
{
|
||||||
|
return $"现有共斗积分:{points:0.##}";
|
||||||
}
|
}
|
||||||
return $"现有赛马积分:{horseRacingPoints:0.##}";
|
|
||||||
}
|
}
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
@ -163,6 +170,19 @@ namespace Oshima.FunGame.OshimaModules.Regions
|
|||||||
store.CopyGoodsToNextRefreshGoods(newStore.Goods);
|
store.CopyGoodsToNextRefreshGoods(newStore.Goods);
|
||||||
}
|
}
|
||||||
storeTemplate.Add("dokyo_horseracing", store);
|
storeTemplate.Add("dokyo_horseracing", store);
|
||||||
|
|
||||||
|
store = storeTemplate.Get("dokyo_cooperative");
|
||||||
|
if (store is null)
|
||||||
|
{
|
||||||
|
store = CreateNewCooperativeStore();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Store newStore = CreateNewCooperativeStore();
|
||||||
|
store.NextRefreshGoods.Clear();
|
||||||
|
store.CopyGoodsToNextRefreshGoods(newStore.Goods);
|
||||||
|
}
|
||||||
|
storeTemplate.Add("dokyo_cooperative", store);
|
||||||
|
|
||||||
storeTemplate.SaveConfig();
|
storeTemplate.SaveConfig();
|
||||||
}
|
}
|
||||||
@ -207,5 +227,34 @@ namespace Oshima.FunGame.OshimaModules.Regions
|
|||||||
store.Goods[1].Quota = 300;
|
store.Goods[1].Quota = 300;
|
||||||
return store;
|
return store;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static Store CreateNewCooperativeStore()
|
||||||
|
{
|
||||||
|
Store store = new("共斗积分商店")
|
||||||
|
{
|
||||||
|
GetNewerGoodsOnVisiting = true,
|
||||||
|
AutoRefresh = true,
|
||||||
|
RefreshInterval = 1,
|
||||||
|
NextRefreshDate = DateTime.Today.AddHours(4),
|
||||||
|
GlobalStock = true,
|
||||||
|
};
|
||||||
|
Item item = new 奖券();
|
||||||
|
store.AddItem(item, -1);
|
||||||
|
store.SetPrice(1, "共斗积分", 15);
|
||||||
|
store.Goods[1].Quota = 300;
|
||||||
|
item = new 十连奖券();
|
||||||
|
store.AddItem(item, -1);
|
||||||
|
store.SetPrice(2, "共斗积分", 120);
|
||||||
|
store.Goods[2].Quota = 100;
|
||||||
|
Item[] items = [.. FunGameConstant.CharacterLevelBreakItems.Union(FunGameConstant.SkillLevelUpItems).OrderBy(o => Random.Shared.Next()).Take(5)];
|
||||||
|
int i = 3;
|
||||||
|
foreach (Item cItem in items)
|
||||||
|
{
|
||||||
|
store.AddItem(cItem, -1);
|
||||||
|
store.SetPrice(i, "共斗积分", 4 * ((int)cItem.QualityType + 1));
|
||||||
|
i++;
|
||||||
|
}
|
||||||
|
return store;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -135,6 +135,7 @@ namespace Oshima.FunGame.OshimaServers
|
|||||||
TaskScheduler.Shared.AddRecurringTask("刷新存档缓存", TimeSpan.FromMinutes(1), () =>
|
TaskScheduler.Shared.AddRecurringTask("刷新存档缓存", TimeSpan.FromMinutes(1), () =>
|
||||||
{
|
{
|
||||||
FunGameService.RefreshSavedCache();
|
FunGameService.RefreshSavedCache();
|
||||||
|
FunGameService.RefreshClubData();
|
||||||
Controller.WriteLine("读取 FunGame 存档缓存", LogLevel.Debug);
|
Controller.WriteLine("读取 FunGame 存档缓存", LogLevel.Debug);
|
||||||
OnlineService.RoomsAutoDisband();
|
OnlineService.RoomsAutoDisband();
|
||||||
Controller.WriteLine("清除空闲房间", LogLevel.Debug);
|
Controller.WriteLine("清除空闲房间", LogLevel.Debug);
|
||||||
|
|||||||
@ -1,6 +1,7 @@
|
|||||||
using System.Text;
|
using System.Text;
|
||||||
using Milimoe.FunGame.Core.Api.Utility;
|
using Milimoe.FunGame.Core.Api.Utility;
|
||||||
using Milimoe.FunGame.Core.Entity;
|
using Milimoe.FunGame.Core.Entity;
|
||||||
|
using Milimoe.FunGame.Core.Interface.Entity;
|
||||||
using Milimoe.FunGame.Core.Library.Constant;
|
using Milimoe.FunGame.Core.Library.Constant;
|
||||||
using Oshima.FunGame.OshimaModules.Models;
|
using Oshima.FunGame.OshimaModules.Models;
|
||||||
using Oshima.FunGame.OshimaModules.Regions;
|
using Oshima.FunGame.OshimaModules.Regions;
|
||||||
@ -10,7 +11,6 @@ namespace Oshima.FunGame.OshimaServers.Model
|
|||||||
{
|
{
|
||||||
public class Cooperative
|
public class Cooperative
|
||||||
{
|
{
|
||||||
private const int MaxRounds = 9999;
|
|
||||||
private static readonly Random _random = new();
|
private static readonly Random _random = new();
|
||||||
|
|
||||||
public static async Task RunCooperativeGame(List<string> msgs, Room room)
|
public static async Task RunCooperativeGame(List<string> msgs, Room room)
|
||||||
@ -33,7 +33,7 @@ namespace Oshima.FunGame.OshimaServers.Model
|
|||||||
{
|
{
|
||||||
User userTemp = FunGameService.GetUser(pc);
|
User userTemp = FunGameService.GetUser(pc);
|
||||||
pcs[userTemp] = pc;
|
pcs[userTemp] = pc;
|
||||||
characters[user] = user.Inventory.MainCharacter;
|
characters[userTemp] = userTemp.Inventory.MainCharacter;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -51,120 +51,162 @@ namespace Oshima.FunGame.OshimaServers.Model
|
|||||||
builder.AppendLine("☆--- 共斗模式玩家列表 ---☆");
|
builder.AppendLine("☆--- 共斗模式玩家列表 ---☆");
|
||||||
builder.AppendLine($"房间号:{room.Roomid}");
|
builder.AppendLine($"房间号:{room.Roomid}");
|
||||||
|
|
||||||
|
bool next = true;
|
||||||
foreach (User user in characters.Keys)
|
foreach (User user in characters.Keys)
|
||||||
{
|
{
|
||||||
builder.AppendLine($"[ {user} ] 出战角色:{characters[user].ToStringWithLevelWithOutUser()}");
|
Character character = characters[user];
|
||||||
}
|
double hpPercent = character.HP / character.MaxHP * 100;
|
||||||
|
ISkill[] skills = [character.NormalAttack, .. character.Skills];
|
||||||
msgs.Add(builder.ToString().Trim());
|
builder.AppendLine($"[ {user} ] 主战角色:{characters[user].ToStringWithLevelWithOutUser()},核心属性:{CharacterSet.GetPrimaryAttributeName(character.PrimaryAttribute)};" +
|
||||||
|
$"攻击力:{character.ATK:0.##};当前生命值;{hpPercent:0.##}%;拥有技能:{string.Join(",", skills.Select(s => $"{s.Name}({s.Level})"))}。");
|
||||||
// 生成敌人
|
if (hpPercent < 10)
|
||||||
OshimaRegion region = FunGameConstant.Regions.OrderBy(o => _random.Next()).First();
|
|
||||||
List<Character> enemys = [];
|
|
||||||
Character? enemy = null;
|
|
||||||
bool isUnit = Random.Shared.Next(2) != 0;
|
|
||||||
if (!isUnit)
|
|
||||||
{
|
|
||||||
enemy = region.Characters.OrderBy(o => Random.Shared.Next()).FirstOrDefault();
|
|
||||||
if (enemy != null)
|
|
||||||
{
|
{
|
||||||
enemy = enemy.Copy();
|
next = false;
|
||||||
enemy.ExHPPercentage += 0.2;
|
builder.AppendLine($"[ {user} ] 的主战角色重伤未愈,当前生命值低于 10%,请先回复生命值或设置其他主战角色!推荐使用【生命之泉】指令快速治疗。");
|
||||||
enemys.Add(enemy);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
|
||||||
|
msgs.Add(builder.ToString().Trim() + "\r\n");
|
||||||
|
builder.Clear();
|
||||||
|
|
||||||
|
if (next)
|
||||||
{
|
{
|
||||||
for (int i = 0; i < Math.Max(1, characters.Count); i++)
|
// 生成敌人
|
||||||
|
OshimaRegion region = FunGameConstant.Regions.OrderBy(o => _random.Next()).First();
|
||||||
|
List<Character> enemys = [];
|
||||||
|
Character? enemy = null;
|
||||||
|
bool isUnit = Random.Shared.Next(2) != 0;
|
||||||
|
if (!isUnit)
|
||||||
{
|
{
|
||||||
enemy = region.Units.OrderBy(o => Random.Shared.Next()).FirstOrDefault();
|
enemy = region.Characters.OrderBy(o => Random.Shared.Next()).FirstOrDefault();
|
||||||
if (enemy != null)
|
if (enemy != null)
|
||||||
{
|
{
|
||||||
enemy = enemy.Copy();
|
enemy = enemy.Copy();
|
||||||
int dcount = enemys.Count(e => e.Name == enemy.Name);
|
|
||||||
if (dcount > 0 && FunGameConstant.GreekAlphabet.Length > dcount) enemy.Name += FunGameConstant.GreekAlphabet[dcount - 1];
|
|
||||||
enemys.Add(enemy);
|
enemys.Add(enemy);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
else
|
||||||
if (enemys.Count == 0)
|
|
||||||
{
|
|
||||||
msgs.Add("没有可用的敌人,返回游戏房间。");
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
Item[] weapons = [.. FunGameConstant.Equipment.Where(i => i.Id.ToString().StartsWith("11") && (int)i.QualityType == 5)];
|
|
||||||
Item[] armors = [.. FunGameConstant.Equipment.Where(i => i.Id.ToString().StartsWith("12") && (int)i.QualityType == 5)];
|
|
||||||
Item[] shoes = [.. FunGameConstant.Equipment.Where(i => i.Id.ToString().StartsWith("13") && (int)i.QualityType == 5)];
|
|
||||||
Item[] accessory = [.. FunGameConstant.Equipment.Where(i => i.Id.ToString().StartsWith("14") && (int)i.QualityType == 5)];
|
|
||||||
Item[] consumables = [.. FunGameConstant.AllItems.Where(i => i.ItemType == ItemType.Consumable && i.IsInGameItem)];
|
|
||||||
// 敌人为动态难度,根据玩家的等级生成
|
|
||||||
int cLevel = (int)characters.Values.Average(c => c.Level) + 5;
|
|
||||||
int sLevel = cLevel / 7;
|
|
||||||
int mLevel = cLevel / 9;
|
|
||||||
int naLevel = mLevel;
|
|
||||||
foreach (Character enemy_loop in enemys)
|
|
||||||
{
|
{
|
||||||
FunGameService.EnhanceBoss(enemy_loop, weapons, armors, shoes, accessory, consumables, cLevel, sLevel, mLevel, naLevel, false, false, isUnit);
|
for (int i = 0; i < Math.Max(1, characters.Count); i++)
|
||||||
|
{
|
||||||
|
enemy = region.Units.OrderBy(o => Random.Shared.Next()).FirstOrDefault();
|
||||||
|
if (enemy != null)
|
||||||
|
{
|
||||||
|
enemy = enemy.Copy();
|
||||||
|
int dcount = enemys.Count(e => e.Name.StartsWith(enemy.Name));
|
||||||
|
if (dcount > 0 && FunGameConstant.GreekAlphabet.Length > dcount) enemy.Name += FunGameConstant.GreekAlphabet[dcount - 1];
|
||||||
|
enemys.Add(enemy);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
// 开始战斗
|
if (enemys.Count == 0)
|
||||||
Team team1 = new($"房间{room.Roomid}", characters.Values);
|
|
||||||
Team team2 = new($"{region.Name}", enemys);
|
|
||||||
FunGameActionQueue actionQueue = new();
|
|
||||||
List<string> gameMsgs = await actionQueue.StartTeamGame([team1, team2], showAllRound: true);
|
|
||||||
if (gameMsgs.Count > 15)
|
|
||||||
{
|
{
|
||||||
gameMsgs = gameMsgs[^15..];
|
msgs.Add("没有可用的敌人,返回游戏房间。");
|
||||||
}
|
|
||||||
msgs.AddRange(gameMsgs);
|
|
||||||
|
|
||||||
// 结算奖励
|
|
||||||
Character? mvp = actionQueue.GamingQueue.CharacterStatistics.OrderByDescending(d => d.Value.Rating).Select(d => d.Key).FirstOrDefault();
|
|
||||||
int multiplication = 1;
|
|
||||||
int award = multiplication * enemys.Count;
|
|
||||||
if (enemys.All(e => e.HP == 0))
|
|
||||||
{
|
|
||||||
multiplication = 15;
|
|
||||||
award = multiplication * enemys.Count;
|
|
||||||
builder.Clear();
|
|
||||||
builder.AppendLine($"☆--- 战斗胜利奖励 ---☆");
|
|
||||||
builder.AppendLine($"击杀了全部敌人,所有玩家获得奖励:{award} {General.GameplayEquilibriumConstant.InGameMaterial}");
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
builder.AppendLine($"☆--- 战斗失败奖励 ---☆");
|
Item[] weapons = [.. FunGameConstant.Equipment.Where(i => i.Id.ToString().StartsWith("11") && (int)i.QualityType == 5)];
|
||||||
int count = enemys.Count(e => e.HP == 0);
|
Item[] armors = [.. FunGameConstant.Equipment.Where(i => i.Id.ToString().StartsWith("12") && (int)i.QualityType == 5)];
|
||||||
award = multiplication * count;
|
Item[] shoes = [.. FunGameConstant.Equipment.Where(i => i.Id.ToString().StartsWith("13") && (int)i.QualityType == 5)];
|
||||||
builder.AppendLine($"击杀了 {count} 个敌人,所有玩家获得奖励:{award} {General.GameplayEquilibriumConstant.InGameMaterial}");
|
Item[] accessory = [.. FunGameConstant.Equipment.Where(i => i.Id.ToString().StartsWith("14") && (int)i.QualityType == 5)];
|
||||||
}
|
Item[] consumables = [.. FunGameConstant.AllItems.Where(i => i.ItemType == ItemType.Consumable && i.IsInGameItem)];
|
||||||
foreach (User user in characters.Keys)
|
// 敌人为动态难度,根据玩家的等级生成
|
||||||
{
|
int cLevel = (int)characters.Values.Average(c => c.Level) + 5;
|
||||||
user.Inventory.Materials += award;
|
int sLevel = cLevel / 7;
|
||||||
}
|
int mLevel = cLevel / 9;
|
||||||
if (mvp != null)
|
int naLevel = mLevel;
|
||||||
{
|
foreach (Character enemy_loop in enemys)
|
||||||
builder.AppendLine($"MVP 玩家额外获得奖励:{award} {General.GameplayEquilibriumConstant.InGameMaterial}");
|
|
||||||
if (characters.Keys.FirstOrDefault(u => u.Id == mvp.User.Id) is User mvpUser)
|
|
||||||
{
|
{
|
||||||
mvpUser.Inventory.Materials += award;
|
FunGameService.EnhanceBoss(enemy_loop, weapons, armors, shoes, accessory, consumables, cLevel, sLevel, mLevel, naLevel, false, false, isUnit);
|
||||||
}
|
}
|
||||||
|
// 开始战斗
|
||||||
|
Team team1 = new($"房间{room.Roomid}", characters.Values);
|
||||||
|
Team team2 = new($"{region.Name}", enemys);
|
||||||
|
FunGameActionQueue actionQueue = new();
|
||||||
|
List<string> gameMsgs = await actionQueue.StartTeamGame([team1, team2], showAllRound: true);
|
||||||
|
if (gameMsgs.Count > 15)
|
||||||
|
{
|
||||||
|
gameMsgs = gameMsgs[^15..];
|
||||||
|
}
|
||||||
|
msgs.AddRange(gameMsgs);
|
||||||
|
|
||||||
|
// 结算奖励
|
||||||
|
Character? mvp = actionQueue.GamingQueue.CharacterStatistics.OrderByDescending(d => d.Value.Rating).Select(d => d.Key).FirstOrDefault();
|
||||||
|
int award = cLevel;
|
||||||
|
if (enemys.All(e => e.HP == 0))
|
||||||
|
{
|
||||||
|
builder.AppendLine($"☆--- 战斗胜利奖励 ---☆");
|
||||||
|
builder.AppendLine($"击杀了全部敌人,所有玩家获得奖励:{award} {General.GameplayEquilibriumConstant.InGameMaterial} 和 {award} 点共斗积分。");
|
||||||
|
builder.AppendLine($"所有角色获得【生命之泉】奖励!状态已经回复至满。");
|
||||||
|
foreach (Character character in characters.Values)
|
||||||
|
{
|
||||||
|
character.Recovery();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
builder.AppendLine($"☆--- 战斗失败奖励 ---☆");
|
||||||
|
int count = enemys.Count(e => e.HP == 0);
|
||||||
|
if (isUnit)
|
||||||
|
{
|
||||||
|
award = cLevel / enemys.Count * count;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
award = 0;
|
||||||
|
}
|
||||||
|
if (count > 0)
|
||||||
|
{
|
||||||
|
builder.AppendLine($"击杀了 {count} 个敌人,所有玩家获得奖励:{award} {General.GameplayEquilibriumConstant.InGameMaterial} 和 {award} 点共斗积分。");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
builder.AppendLine($"未能击杀任何敌人,无法获得奖励。");
|
||||||
|
}
|
||||||
|
builder.AppendLine($"角色进入重伤未愈状态,请所有玩家立即使用【生命之泉】指令回复状态!使用【酒馆】指令可以补满角色能量。");
|
||||||
|
}
|
||||||
|
foreach (User user in characters.Keys)
|
||||||
|
{
|
||||||
|
user.Inventory.Materials += award;
|
||||||
|
PluginConfig pc = pcs[user];
|
||||||
|
if (pc.TryGetValue("cooperativePoints", out object? value) && int.TryParse(value.ToString(), out int cooperativePoints))
|
||||||
|
{
|
||||||
|
pc.Add("cooperativePoints", cooperativePoints + award);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
pc.Add("cooperativePoints", award);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (mvp != null && characters.ContainsKey(mvp.User))
|
||||||
|
{
|
||||||
|
int mvpAward = cLevel / 5;
|
||||||
|
builder.AppendLine($"MVP 玩家 [ {mvp.User.Username} ] 额外获得奖励:{mvpAward} {General.GameplayEquilibriumConstant.InGameMaterial}。");
|
||||||
|
mvp.User.Inventory.Materials += mvpAward;
|
||||||
|
}
|
||||||
|
builder.AppendLine($"共斗积分可以在【共斗商店】中兑换物品。");
|
||||||
|
builder.AppendLine($"\r\n☆--- 战斗数据 ---☆");
|
||||||
|
int index = 1;
|
||||||
|
foreach (Character character in actionQueue.GamingQueue.CharacterStatistics.Where(kv => characters.ContainsValue(kv.Key)).
|
||||||
|
OrderByDescending(kv => kv.Value.Rating).Select(kv => kv.Key))
|
||||||
|
{
|
||||||
|
CharacterStatistics stats = actionQueue.GamingQueue.CharacterStatistics[character];
|
||||||
|
builder.AppendLine($"{index + ". "}[ {character.ToStringWithLevel()} ]");
|
||||||
|
builder.AppendLine($"技术得分:{stats.Rating:0.0#} / 击杀数:{stats.Kills} / 助攻数:{stats.Assists} / 死亡数:{stats.Deaths}");
|
||||||
|
builder.AppendLine($"存活时长:{stats.LiveTime:0.##} / 存活回合数:{stats.LiveRound} / 行动回合数:{stats.ActionTurn}");
|
||||||
|
builder.AppendLine($"控制时长:{stats.ControlTime:0.##} / 总计治疗:{stats.TotalHeal:0.##} / 护盾抵消:{stats.TotalShield:0.##}");
|
||||||
|
builder.AppendLine($"总计伤害:{stats.TotalDamage:0.##} / 总计物理伤害:{stats.TotalPhysicalDamage:0.##} / 总计魔法伤害:{stats.TotalMagicDamage:0.##}");
|
||||||
|
builder.AppendLine($"总承受伤害:{stats.TotalTakenDamage:0.##} / 总承受物理伤害:{stats.TotalTakenPhysicalDamage:0.##} / 总承受魔法伤害:{stats.TotalTakenMagicDamage:0.##}");
|
||||||
|
if (stats.TotalTrueDamage > 0 || stats.TotalTakenTrueDamage > 0) builder.AppendLine($"总计真实伤害:{stats.TotalTrueDamage:0.##} / 总承受真实伤害:{stats.TotalTakenTrueDamage:0.##}");
|
||||||
|
builder.AppendLine($"每秒伤害:{stats.DamagePerSecond:0.##} / 每回合伤害:{stats.DamagePerTurn:0.##}");
|
||||||
|
index++;
|
||||||
|
}
|
||||||
|
msgs.Add(builder.ToString().Trim());
|
||||||
}
|
}
|
||||||
builder.AppendLine($"☆--- 战斗数据 ---☆");
|
}
|
||||||
int index = 1;
|
else
|
||||||
foreach (Character character in actionQueue.GamingQueue.CharacterStatistics.Where(kv => characters.ContainsValue(kv.Key)).Select(kv => kv.Key))
|
{
|
||||||
{
|
msgs.Add("返回游戏房间。");
|
||||||
CharacterStatistics stats = actionQueue.GamingQueue.CharacterStatistics[character];
|
|
||||||
builder.AppendLine($"{index + ". "}[ {character.ToStringWithLevel()} ]");
|
|
||||||
builder.AppendLine($"技术得分:{stats.Rating:0.0#} / 击杀数:{stats.Kills} / 助攻数:{stats.Assists} / 死亡数:{stats.Deaths}");
|
|
||||||
builder.AppendLine($"存活时长:{stats.LiveTime:0.##} / 存活回合数:{stats.LiveRound} / 行动回合数:{stats.ActionTurn}");
|
|
||||||
builder.AppendLine($"控制时长:{stats.ControlTime:0.##} / 总计治疗:{stats.TotalHeal:0.##} / 护盾抵消:{stats.TotalShield:0.##}");
|
|
||||||
builder.AppendLine($"总计伤害:{stats.TotalDamage:0.##} / 总计物理伤害:{stats.TotalPhysicalDamage:0.##} / 总计魔法伤害:{stats.TotalMagicDamage:0.##}");
|
|
||||||
builder.AppendLine($"总承受伤害:{stats.TotalTakenDamage:0.##} / 总承受物理伤害:{stats.TotalTakenPhysicalDamage:0.##} / 总承受魔法伤害:{stats.TotalTakenMagicDamage:0.##}");
|
|
||||||
if (stats.TotalTrueDamage > 0 || stats.TotalTakenTrueDamage > 0) builder.AppendLine($"总计真实伤害:{stats.TotalTrueDamage:0.##} / 总承受真实伤害:{stats.TotalTakenTrueDamage:0.##}");
|
|
||||||
builder.AppendLine($"每秒伤害:{stats.DamagePerSecond:0.##} / 每回合伤害:{stats.DamagePerTurn:0.##}");
|
|
||||||
index++;
|
|
||||||
}
|
|
||||||
msgs.Add(builder.ToString().Trim());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// 存档
|
// 存档
|
||||||
|
|||||||
@ -19,6 +19,8 @@
|
|||||||
{"我的状态", "查看主战角色状态"},
|
{"我的状态", "查看主战角色状态"},
|
||||||
{"装备 <角色序号> <物品序号>", "装备指定物品给角色"},
|
{"装备 <角色序号> <物品序号>", "装备指定物品给角色"},
|
||||||
{"取消装备 <角色序号> <装备槽序号>", "卸下角色装备(槽位1-6)"},
|
{"取消装备 <角色序号> <装备槽序号>", "卸下角色装备(槽位1-6)"},
|
||||||
|
{"加物/添加背包物品 <角色序号> <物品序号>", "添加指定消耗品到角色背包"},
|
||||||
|
{"减物/移除背包物品 <角色序号> <背包物品序号>", "取回角色背包的消耗品"},
|
||||||
{"角色升级 [角色序号]", "提升角色等级(默认1)"},
|
{"角色升级 [角色序号]", "提升角色等级(默认1)"},
|
||||||
{"角色突破 [角色序号]", "突破等级限制(默认1)"},
|
{"角色突破 [角色序号]", "突破等级限制(默认1)"},
|
||||||
{"突破信息 [角色序号]", "查看突破需求(默认1)"},
|
{"突破信息 [角色序号]", "查看突破需求(默认1)"},
|
||||||
@ -79,6 +81,8 @@
|
|||||||
{"金币排行榜", "查看全服金币数量排行榜"},
|
{"金币排行榜", "查看全服金币数量排行榜"},
|
||||||
{"钻石排行榜", "查看全服钻石数量排行榜"},
|
{"钻石排行榜", "查看全服钻石数量排行榜"},
|
||||||
{"赛马排行榜", "查看全服赛马积分排行榜"},
|
{"赛马排行榜", "查看全服赛马积分排行榜"},
|
||||||
|
{"共斗排行榜", "查看全服共斗积分排行榜"},
|
||||||
|
{"锻造排行榜", "查看全服锻造积分排行榜"},
|
||||||
};
|
};
|
||||||
|
|
||||||
public static Dictionary<string, string> PlayHelp { get; } = new() {
|
public static Dictionary<string, string> PlayHelp { get; } = new() {
|
||||||
@ -90,6 +94,7 @@
|
|||||||
{"主城", "查看主城信息"},
|
{"主城", "查看主城信息"},
|
||||||
{"查地区 <地区序号>", "查看指定地区信息"},
|
{"查地区 <地区序号>", "查看指定地区信息"},
|
||||||
{"探索 <地区序号> <{角色序号...}>", "探索指定地区(可多角色)"},
|
{"探索 <地区序号> <{角色序号...}>", "探索指定地区(可多角色)"},
|
||||||
|
{"小队探索 <地区序号>", "以小队探索指定地区"},
|
||||||
{"探索结算", "结算所有未完成的探索"},
|
{"探索结算", "结算所有未完成的探索"},
|
||||||
{"挑战金币秘境 <难度>", "以小队挑战金币秘境,秘境难度1-5"},
|
{"挑战金币秘境 <难度>", "以小队挑战金币秘境,秘境难度1-5"},
|
||||||
{"挑战钻石秘境 <难度>", "以小队挑战钻石秘境,秘境难度1-5"},
|
{"挑战钻石秘境 <难度>", "以小队挑战钻石秘境,秘境难度1-5"},
|
||||||
@ -105,8 +110,10 @@
|
|||||||
{"创建房间 <类型>", "类型:mix/team/cooperative/horseracing对应混战/团队/共斗/赛马" },
|
{"创建房间 <类型>", "类型:mix/team/cooperative/horseracing对应混战/团队/共斗/赛马" },
|
||||||
{"加入房间 <房间号>", "加入多人游戏房间" },
|
{"加入房间 <房间号>", "加入多人游戏房间" },
|
||||||
{"退出房间", "退出多人游戏房间" },
|
{"退出房间", "退出多人游戏房间" },
|
||||||
{"创建赛马", "快速创建赛马房间" },
|
|
||||||
{"开始游戏", "开始多人游戏" },
|
{"开始游戏", "开始多人游戏" },
|
||||||
|
{"房间列表", "查看本群聊的房间列表" },
|
||||||
|
{"房间信息", "查看多人游戏房间信息" },
|
||||||
|
{"创建赛马", "快速创建赛马房间" },
|
||||||
{"加入赛马", "快速加入赛马房间" },
|
{"加入赛马", "快速加入赛马房间" },
|
||||||
{"创建共斗", "快速创建共斗房间" },
|
{"创建共斗", "快速创建共斗房间" },
|
||||||
{"创建混战", "快速创建混战房间" },
|
{"创建混战", "快速创建混战房间" },
|
||||||
@ -114,20 +121,24 @@
|
|||||||
};
|
};
|
||||||
|
|
||||||
public static Dictionary<string, string> ClubHelp { get; } = new() {
|
public static Dictionary<string, string> ClubHelp { get; } = new() {
|
||||||
{"我的社团", "查看社团信息"},
|
{"社团列表", "查看公开可加入的社团列表"},
|
||||||
|
{"查看社团", "查看指定社团信息"},
|
||||||
|
{"我的社团", "查看我的社团信息"},
|
||||||
{"私信 <对方UID/昵称> <内容>", "发送私信给对方"},
|
{"私信 <对方UID/昵称> <内容>", "发送私信给对方"},
|
||||||
{"加入社团 <社团序号>", "申请加入社团"},
|
{"加入社团 <社团序号>", "加入指定社团"},
|
||||||
|
{"邀请加入 <对方UID>", "管理员可以邀请加入社团"},
|
||||||
{"退出社团", "退出当前社团"},
|
{"退出社团", "退出当前社团"},
|
||||||
{"创建社团 <前缀>", "创建一个公开社团,若指令中包含私密一词,将创建私密社团\r\n社团前缀:3-4个字符,允许:英文字母和数字、部分特殊字符"},
|
{"创建社团 <前缀>", "创建一个公开社团,若指令中包含私密一词,将创建私密社团\r\n社团前缀:3-4个字符,允许:英文字母和数字、部分特殊字符"},
|
||||||
{"查看社团成员", "查看社团成员列表"},
|
{"查看社团成员", "查看社团成员列表"},
|
||||||
{"查看社团管理", "查看管理员列表"},
|
{"查看社团管理", "查看管理员列表"},
|
||||||
{"查看申请人列表", "查看申请加入的玩家列表"},
|
{"查看申请人列表", "查看申请加入的玩家列表"},
|
||||||
|
{"查看受邀人列表", "查看待接受邀请的玩家列表"},
|
||||||
{"解散社团", "解散当前社团"},
|
{"解散社团", "解散当前社团"},
|
||||||
{"社团批准 <对方UID>", "批准加入申请"},
|
{"社团批准 <对方UID>", "批准加入申请"},
|
||||||
{"社团拒绝 <对方UID>", "拒绝加入申请"},
|
{"社团拒绝 <对方UID>", "拒绝加入申请"},
|
||||||
{"社团踢出 <对方UID>", "踢出社团成员"},
|
{"社团踢出 <对方UID>", "踢出社团成员"},
|
||||||
{"社团转让 <对方UID>", "转让社团所有权"},
|
{"社团转让 <对方UID>", "转让社团所有权"},
|
||||||
{"社团设置 <设置项> <{参数...}>", "修改社团设置"},
|
{"社团设置 <设置项> <{参数...}>", "修改社团设置,设置项有:名称/前缀/描述/批准/公开/管理/取消管理/新社长"},
|
||||||
{"社团捐献 <金币数>", "捐献金币到社团基金"},
|
{"社团捐献 <金币数>", "捐献金币到社团基金"},
|
||||||
{"社团任务列表", "查看社团任务列表"},
|
{"社团任务列表", "查看社团任务列表"},
|
||||||
{"做社团任务 <任务序号>", "开始指定社团任务"},
|
{"做社团任务 <任务序号>", "开始指定社团任务"},
|
||||||
@ -160,7 +171,8 @@
|
|||||||
{"商店3", "查看杂货铺商品"},
|
{"商店3", "查看杂货铺商品"},
|
||||||
{"商店4", "查看慈善基金会商品"},
|
{"商店4", "查看慈善基金会商品"},
|
||||||
{"锻造商店/商店5", "查看锻造积分商店商品"},
|
{"锻造商店/商店5", "查看锻造积分商店商品"},
|
||||||
{"赛马商店/商店6", "查看锻造积分商店商品"},
|
{"赛马商店/商店6", "查看赛马积分商店商品"},
|
||||||
|
{"共斗商店/商店7", "查看共斗积分商店商品"},
|
||||||
{"商店查看 <商品序号>", "查看指定商品详情,访问任意商店后2分钟内可用"},
|
{"商店查看 <商品序号>", "查看指定商品详情,访问任意商店后2分钟内可用"},
|
||||||
{"商店购买 <商品序号>", "购买指定商品,访问任意商店后2分钟内可用"},
|
{"商店购买 <商品序号>", "购买指定商品,访问任意商店后2分钟内可用"},
|
||||||
{"商店出售 <物品序号>", "向商店出售具有回收价的指定物品"},
|
{"商店出售 <物品序号>", "向商店出售具有回收价的指定物品"},
|
||||||
|
|||||||
@ -656,6 +656,7 @@ namespace Oshima.FunGame.OshimaServers.Service
|
|||||||
int reduce;
|
int reduce;
|
||||||
string reduceUnit;
|
string reduceUnit;
|
||||||
IEnumerable<Item>? items = null;
|
IEnumerable<Item>? items = null;
|
||||||
|
bool useItem = false;
|
||||||
if (useCurrency)
|
if (useCurrency)
|
||||||
{
|
{
|
||||||
if (is10)
|
if (is10)
|
||||||
@ -666,7 +667,8 @@ namespace Oshima.FunGame.OshimaServers.Service
|
|||||||
{
|
{
|
||||||
items = user.Inventory.Items.Where(i => i is 奖券);
|
items = user.Inventory.Items.Where(i => i is 奖券);
|
||||||
}
|
}
|
||||||
if (items.Any())
|
useItem = items.Any();
|
||||||
|
if (useItem)
|
||||||
{
|
{
|
||||||
reduceUnit = items.First().Name;
|
reduceUnit = items.First().Name;
|
||||||
reduce = 1;
|
reduce = 1;
|
||||||
@ -730,7 +732,7 @@ namespace Oshima.FunGame.OshimaServers.Service
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (items != null && items.Any())
|
if (items != null && useItem)
|
||||||
{
|
{
|
||||||
msgs.Insert(0, $"本次抽卡使用{reduceUnit}代替金币抽卡!你的库存剩余 {items.Count()} 张{reduceUnit}。");
|
msgs.Insert(0, $"本次抽卡使用{reduceUnit}代替金币抽卡!你的库存剩余 {items.Count()} 张{reduceUnit}。");
|
||||||
}
|
}
|
||||||
@ -2180,6 +2182,19 @@ namespace Oshima.FunGame.OshimaServers.Service
|
|||||||
return $"你的{needy}不足 {reduce} 呢,无法购买【{goods.Name}】!";
|
return $"你的{needy}不足 {reduce} 呢,无法购买【{goods.Name}】!";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else if (needy == "共斗积分")
|
||||||
|
{
|
||||||
|
double reduce = Calculation.Round2Digits(goods.Prices[needy] * count);
|
||||||
|
if (pc.TryGetValue("cooperativePoints", out object? value) && double.TryParse(value.ToString(), out double points) && points >= reduce)
|
||||||
|
{
|
||||||
|
points -= reduce;
|
||||||
|
pc.Add("cooperativePoints", points);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return $"你的{needy}不足 {reduce} 呢,无法购买【{goods.Name}】!";
|
||||||
|
}
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
return $"不支持的货币类型:{needy},无法购买【{goods.Name}】!";
|
return $"不支持的货币类型:{needy},无法购买【{goods.Name}】!";
|
||||||
@ -2632,7 +2647,7 @@ namespace Oshima.FunGame.OshimaServers.Service
|
|||||||
enemy = region.Units.OrderBy(o => Random.Shared.Next()).First().Copy();
|
enemy = region.Units.OrderBy(o => Random.Shared.Next()).First().Copy();
|
||||||
enemys.Add(enemy);
|
enemys.Add(enemy);
|
||||||
enemy = region.Units.OrderBy(o => Random.Shared.Next()).First().Copy();
|
enemy = region.Units.OrderBy(o => Random.Shared.Next()).First().Copy();
|
||||||
enemy.FirstName = enemys.Any(e => e.Name == enemy.Name) ? "2" : "";
|
enemy.FirstName = enemys.Any(e => e.Name.StartsWith(enemy.Name)) ? "2" : "";
|
||||||
enemys.Add(enemy);
|
enemys.Add(enemy);
|
||||||
break;
|
break;
|
||||||
case 5:
|
case 5:
|
||||||
@ -2640,10 +2655,10 @@ namespace Oshima.FunGame.OshimaServers.Service
|
|||||||
enemy = region.Units.OrderBy(o => Random.Shared.Next()).First().Copy();
|
enemy = region.Units.OrderBy(o => Random.Shared.Next()).First().Copy();
|
||||||
enemys.Add(enemy);
|
enemys.Add(enemy);
|
||||||
enemy = region.Units.OrderBy(o => Random.Shared.Next()).First().Copy();
|
enemy = region.Units.OrderBy(o => Random.Shared.Next()).First().Copy();
|
||||||
enemy.FirstName = enemys.Any(e => e.Name == enemy.Name) ? "α" : "";
|
enemy.FirstName = enemys.Any(e => e.Name.StartsWith(enemy.Name)) ? "α" : "";
|
||||||
enemys.Add(enemy);
|
enemys.Add(enemy);
|
||||||
enemy = region.Units.OrderBy(o => Random.Shared.Next()).First().Copy();
|
enemy = region.Units.OrderBy(o => Random.Shared.Next()).First().Copy();
|
||||||
enemy.FirstName = enemys.Any(e => e.Name == enemy.Name) ? "β" : "";
|
enemy.FirstName = enemys.Any(e => e.Name.StartsWith(enemy.Name)) ? "β" : "";
|
||||||
enemys.Add(enemy);
|
enemys.Add(enemy);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -3597,7 +3612,7 @@ namespace Oshima.FunGame.OshimaServers.Service
|
|||||||
if (enemy != null)
|
if (enemy != null)
|
||||||
{
|
{
|
||||||
enemy = enemy.Copy();
|
enemy = enemy.Copy();
|
||||||
int dcount = enemys.Count(e => e.Name == enemy.Name);
|
int dcount = enemys.Count(e => e.Name.StartsWith(enemy.Name));
|
||||||
if (dcount > 0 && FunGameConstant.GreekAlphabet.Length > dcount) enemy.Name += FunGameConstant.GreekAlphabet[dcount - 1];
|
if (dcount > 0 && FunGameConstant.GreekAlphabet.Length > dcount) enemy.Name += FunGameConstant.GreekAlphabet[dcount - 1];
|
||||||
enemys.Add(enemy);
|
enemys.Add(enemy);
|
||||||
}
|
}
|
||||||
@ -4579,6 +4594,14 @@ namespace Oshima.FunGame.OshimaServers.Service
|
|||||||
{
|
{
|
||||||
FunGameConstant.UserHorseRacingRanking[user.Id] = horseRacingPoints;
|
FunGameConstant.UserHorseRacingRanking[user.Id] = horseRacingPoints;
|
||||||
}
|
}
|
||||||
|
if (pc.TryGetValue("forgepoints", out value3) && double.TryParse(value3.ToString(), out double forgepoints))
|
||||||
|
{
|
||||||
|
FunGameConstant.UserForgingRanking[user.Id] = forgepoints;
|
||||||
|
}
|
||||||
|
if (pc.TryGetValue("cooperativePoints", out value3) && int.TryParse(value3.ToString(), out int cooperativePoints))
|
||||||
|
{
|
||||||
|
FunGameConstant.UserCooperativeRanking[user.Id] = cooperativePoints;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
ReleaseUserSemaphoreSlim(fileName);
|
ReleaseUserSemaphoreSlim(fileName);
|
||||||
}
|
}
|
||||||
@ -4586,6 +4609,26 @@ namespace Oshima.FunGame.OshimaServers.Service
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void RefreshClubData()
|
||||||
|
{
|
||||||
|
string directoryPath = $@"{AppDomain.CurrentDomain.BaseDirectory}configs/clubs";
|
||||||
|
if (Directory.Exists(directoryPath))
|
||||||
|
{
|
||||||
|
string[] filePaths = Directory.GetFiles(directoryPath);
|
||||||
|
foreach (string filePath in filePaths)
|
||||||
|
{
|
||||||
|
string fileName = Path.GetFileNameWithoutExtension(filePath);
|
||||||
|
EntityModuleConfig<Club> clubs = new("clubs", fileName);
|
||||||
|
clubs.LoadConfig();
|
||||||
|
Club? club = clubs.Get("club");
|
||||||
|
if (club != null)
|
||||||
|
{
|
||||||
|
FunGameConstant.ClubIdAndClub[club.Id] = club;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public static void RefreshDailyQuest()
|
public static void RefreshDailyQuest()
|
||||||
{
|
{
|
||||||
string directoryPath = $@"{AppDomain.CurrentDomain.BaseDirectory}configs/quests";
|
string directoryPath = $@"{AppDomain.CurrentDomain.BaseDirectory}configs/quests";
|
||||||
|
|||||||
@ -287,6 +287,18 @@ namespace Oshima.FunGame.OshimaServers.Service
|
|||||||
}
|
}
|
||||||
return msg;
|
return msg;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static string RoomInfo(Room room)
|
||||||
|
{
|
||||||
|
string username = "";
|
||||||
|
if (FunGameConstant.UserIdAndUsername.TryGetValue(room.RoomMaster.Id, out User? value) && value != null)
|
||||||
|
{
|
||||||
|
username = value.Username;
|
||||||
|
}
|
||||||
|
string msg = $"房间号:{room.Roomid}\r\n房间类型:{room.Name}\r\n创建时间:{room.CreateTime.ToString(General.GeneralDateTimeFormatChinese)}\r\n房主:{username}\r\n" +
|
||||||
|
$"人数:{room.UserAndIsReady.Count} / {room.MaxUsers}";
|
||||||
|
return msg;
|
||||||
|
}
|
||||||
|
|
||||||
public static void RoomsAutoDisband()
|
public static void RoomsAutoDisband()
|
||||||
{
|
{
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@ -319,34 +319,7 @@ namespace Oshima.FunGame.WebAPI.Services
|
|||||||
{
|
{
|
||||||
FunGameSimulation = true;
|
FunGameSimulation = true;
|
||||||
List<string> msgs = await Controller.GetTest(false, maxRespawnTimesMix: 0);
|
List<string> msgs = await Controller.GetTest(false, maxRespawnTimesMix: 0);
|
||||||
List<string> real = [];
|
List<string> real = MergeMessages(msgs);
|
||||||
int perMergeLength = msgs.Count > 7 ? 7 : msgs.Count - 1;
|
|
||||||
int remain = perMergeLength;
|
|
||||||
string merge = "";
|
|
||||||
for (int i = 0; i < msgs.Count - 2; i++)
|
|
||||||
{
|
|
||||||
remain--;
|
|
||||||
merge += msgs[i] + "\r\n";
|
|
||||||
if (remain == 0)
|
|
||||||
{
|
|
||||||
real.Add(merge);
|
|
||||||
merge = "";
|
|
||||||
if ((msgs.Count - i - 3) < perMergeLength)
|
|
||||||
{
|
|
||||||
remain = msgs.Count - i - 3;
|
|
||||||
}
|
|
||||||
else remain = perMergeLength;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (msgs.Count > 2)
|
|
||||||
{
|
|
||||||
real.Add(msgs[^2]);
|
|
||||||
real.Add(msgs[^1]);
|
|
||||||
}
|
|
||||||
if (real.Count >= 3)
|
|
||||||
{
|
|
||||||
real = real[^3..];
|
|
||||||
}
|
|
||||||
int count = 1;
|
int count = 1;
|
||||||
foreach (string msg in real)
|
foreach (string msg in real)
|
||||||
{
|
{
|
||||||
@ -375,34 +348,7 @@ namespace Oshima.FunGame.WebAPI.Services
|
|||||||
{
|
{
|
||||||
FunGameSimulation = true;
|
FunGameSimulation = true;
|
||||||
List<string> msgs = await Controller.GetTest(false, maxRespawnTimesMix: maxRespawnTimesMix);
|
List<string> msgs = await Controller.GetTest(false, maxRespawnTimesMix: maxRespawnTimesMix);
|
||||||
List<string> real = [];
|
List<string> real = MergeMessages(msgs);
|
||||||
int perMergeLength = msgs.Count > 7 ? 7 : msgs.Count - 1;
|
|
||||||
int remain = perMergeLength;
|
|
||||||
string merge = "";
|
|
||||||
for (int i = 0; i < msgs.Count - 2; i++)
|
|
||||||
{
|
|
||||||
remain--;
|
|
||||||
merge += msgs[i] + "\r\n";
|
|
||||||
if (remain == 0)
|
|
||||||
{
|
|
||||||
real.Add(merge);
|
|
||||||
merge = "";
|
|
||||||
if ((msgs.Count - i - 3) < perMergeLength)
|
|
||||||
{
|
|
||||||
remain = msgs.Count - i - 3;
|
|
||||||
}
|
|
||||||
else remain = perMergeLength;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (msgs.Count > 2)
|
|
||||||
{
|
|
||||||
real.Add(msgs[^2]);
|
|
||||||
real.Add(msgs[^1]);
|
|
||||||
}
|
|
||||||
if (real.Count >= 3)
|
|
||||||
{
|
|
||||||
real = real[^3..];
|
|
||||||
}
|
|
||||||
int count = 1;
|
int count = 1;
|
||||||
foreach (string msg in real)
|
foreach (string msg in real)
|
||||||
{
|
{
|
||||||
@ -432,38 +378,7 @@ namespace Oshima.FunGame.WebAPI.Services
|
|||||||
{
|
{
|
||||||
FunGameSimulation = true;
|
FunGameSimulation = true;
|
||||||
List<string> msgs = await Controller.GetTest(false, true);
|
List<string> msgs = await Controller.GetTest(false, true);
|
||||||
List<string> real = [];
|
List<string> real = MergeMessages(msgs);
|
||||||
if (msgs.Count > 0)
|
|
||||||
{
|
|
||||||
real.Add(msgs[0]);
|
|
||||||
}
|
|
||||||
int perMergeLength = msgs.Count > 7 ? 7 : msgs.Count - 1;
|
|
||||||
int remain = perMergeLength;
|
|
||||||
string merge = "";
|
|
||||||
for (int i = 1; i < msgs.Count - 2; i++)
|
|
||||||
{
|
|
||||||
remain--;
|
|
||||||
merge += msgs[i] + "\r\n";
|
|
||||||
if (remain == 0)
|
|
||||||
{
|
|
||||||
real.Add(merge);
|
|
||||||
merge = "";
|
|
||||||
if ((msgs.Count - i - 3) < perMergeLength)
|
|
||||||
{
|
|
||||||
remain = msgs.Count - i - 3;
|
|
||||||
}
|
|
||||||
else remain = perMergeLength;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (msgs.Count > 2)
|
|
||||||
{
|
|
||||||
real.Add(msgs[^2]);
|
|
||||||
real.Add(msgs[^1]);
|
|
||||||
}
|
|
||||||
if (real.Count >= 3)
|
|
||||||
{
|
|
||||||
real = real[^3..];
|
|
||||||
}
|
|
||||||
int count = 1;
|
int count = 1;
|
||||||
foreach (string msg in real)
|
foreach (string msg in real)
|
||||||
{
|
{
|
||||||
@ -858,13 +773,22 @@ namespace Oshima.FunGame.WebAPI.Services
|
|||||||
{
|
{
|
||||||
string detail = e.Detail.Replace("改名拒绝", "").Trim();
|
string detail = e.Detail.Replace("改名拒绝", "").Trim();
|
||||||
string msg = "";
|
string msg = "";
|
||||||
if (long.TryParse(detail, out long target))
|
string[] strings = detail.Split(' ', StringSplitOptions.RemoveEmptyEntries);
|
||||||
|
if (strings.Length > 0)
|
||||||
{
|
{
|
||||||
msg = Controller.ApproveReName(uid, target, false);
|
string reason = "";
|
||||||
}
|
if (strings.Length > 1)
|
||||||
if (msg != "")
|
{
|
||||||
{
|
reason = string.Join(" ", strings[1..]).Trim();
|
||||||
await SendAsync(e, "改名拒绝", msg);
|
}
|
||||||
|
if (long.TryParse(strings[0], out long target))
|
||||||
|
{
|
||||||
|
msg = Controller.ApproveReName(uid, target, false, false, reason);
|
||||||
|
}
|
||||||
|
if (msg != "")
|
||||||
|
{
|
||||||
|
await SendAsync(e, "改名拒绝", msg);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
@ -884,6 +808,45 @@ namespace Oshima.FunGame.WebAPI.Services
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (e.Detail.StartsWith("社团改名拒绝"))
|
||||||
|
{
|
||||||
|
string detail = e.Detail.Replace("社团改名拒绝", "").Trim();
|
||||||
|
string msg = "";
|
||||||
|
string[] strings = detail.Split(' ', StringSplitOptions.RemoveEmptyEntries);
|
||||||
|
if (strings.Length > 0)
|
||||||
|
{
|
||||||
|
string reason = "";
|
||||||
|
if (strings.Length > 1)
|
||||||
|
{
|
||||||
|
reason = string.Join(" ", strings[1..]).Trim();
|
||||||
|
}
|
||||||
|
if (long.TryParse(strings[0], out long target))
|
||||||
|
{
|
||||||
|
msg = Controller.ApproveReName(uid, target, false, true, reason);
|
||||||
|
}
|
||||||
|
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, isClub: true);
|
||||||
|
}
|
||||||
|
if (msg != "")
|
||||||
|
{
|
||||||
|
await SendAsync(e, "社团改名批准", msg);
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
if (e.Detail.StartsWith("自定义改名"))
|
if (e.Detail.StartsWith("自定义改名"))
|
||||||
{
|
{
|
||||||
e.UseNotice = false;
|
e.UseNotice = false;
|
||||||
@ -1691,45 +1654,7 @@ namespace Oshima.FunGame.WebAPI.Services
|
|||||||
{
|
{
|
||||||
msgs = await Controller.FightCustom2(uid, detail.Trim(), true);
|
msgs = await Controller.FightCustom2(uid, detail.Trim(), true);
|
||||||
}
|
}
|
||||||
List<string> real = [];
|
List<string> real = MergeMessages(msgs);
|
||||||
if (msgs.Count > 2)
|
|
||||||
{
|
|
||||||
if (msgs.Count < 20)
|
|
||||||
{
|
|
||||||
int perMergeLength = msgs.Count > 7 ? 7 : msgs.Count - 1;
|
|
||||||
int remain = perMergeLength;
|
|
||||||
string merge = "";
|
|
||||||
for (int i = 0; i < msgs.Count - 1; i++)
|
|
||||||
{
|
|
||||||
remain--;
|
|
||||||
merge += msgs[i] + "\r\n";
|
|
||||||
if (remain == 0)
|
|
||||||
{
|
|
||||||
real.Add(merge);
|
|
||||||
merge = "";
|
|
||||||
if ((msgs.Count - i - 2) < perMergeLength)
|
|
||||||
{
|
|
||||||
remain = msgs.Count - i - 2;
|
|
||||||
}
|
|
||||||
else remain = perMergeLength;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
real.Add(string.Join("\r\n", msgs[^8..^2]));
|
|
||||||
}
|
|
||||||
real.Add(msgs[^2]);
|
|
||||||
real.Add(msgs[^1]);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
real = msgs;
|
|
||||||
}
|
|
||||||
if (real.Count >= 3)
|
|
||||||
{
|
|
||||||
real = real[^3..];
|
|
||||||
}
|
|
||||||
int count = 1;
|
int count = 1;
|
||||||
foreach (string msg in real)
|
foreach (string msg in real)
|
||||||
{
|
{
|
||||||
@ -1751,37 +1676,7 @@ namespace Oshima.FunGame.WebAPI.Services
|
|||||||
{
|
{
|
||||||
msgs = await Controller.FightCustom2(uid, detail.Trim(), false);
|
msgs = await Controller.FightCustom2(uid, detail.Trim(), false);
|
||||||
}
|
}
|
||||||
List<string> real = [];
|
List<string> real = MergeMessages(msgs);
|
||||||
if (msgs.Count > 2)
|
|
||||||
{
|
|
||||||
int perMergeLength = msgs.Count > 7 ? 7 : msgs.Count - 1;
|
|
||||||
int remain = perMergeLength;
|
|
||||||
string merge = "";
|
|
||||||
for (int i = 0; i < msgs.Count - 1; i++)
|
|
||||||
{
|
|
||||||
remain--;
|
|
||||||
merge += msgs[i] + "\r\n";
|
|
||||||
if (remain == 0)
|
|
||||||
{
|
|
||||||
real.Add(merge);
|
|
||||||
merge = "";
|
|
||||||
if ((msgs.Count - i - 3) < perMergeLength)
|
|
||||||
{
|
|
||||||
remain = msgs.Count - i - 3;
|
|
||||||
}
|
|
||||||
else remain = perMergeLength;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
real.Add(msgs[^1]);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
real = msgs;
|
|
||||||
}
|
|
||||||
if (real.Count >= 3)
|
|
||||||
{
|
|
||||||
real = real[^3..];
|
|
||||||
}
|
|
||||||
int count = 1;
|
int count = 1;
|
||||||
foreach (string msg in real)
|
foreach (string msg in real)
|
||||||
{
|
{
|
||||||
@ -1803,45 +1698,7 @@ namespace Oshima.FunGame.WebAPI.Services
|
|||||||
{
|
{
|
||||||
msgs = await Controller.FightCustomTeam2(uid, detail.Trim(), true);
|
msgs = await Controller.FightCustomTeam2(uid, detail.Trim(), true);
|
||||||
}
|
}
|
||||||
List<string> real = [];
|
List<string> real = MergeMessages(msgs);
|
||||||
if (msgs.Count >= 3)
|
|
||||||
{
|
|
||||||
if (msgs.Count < 20)
|
|
||||||
{
|
|
||||||
int perMergeLength = msgs.Count > 7 ? 7 : msgs.Count - 1;
|
|
||||||
int remain = perMergeLength;
|
|
||||||
string merge = "";
|
|
||||||
for (int i = 0; i < msgs.Count - 1; i++)
|
|
||||||
{
|
|
||||||
remain--;
|
|
||||||
merge += msgs[i] + "\r\n";
|
|
||||||
if (remain == 0)
|
|
||||||
{
|
|
||||||
real.Add(merge);
|
|
||||||
merge = "";
|
|
||||||
if ((msgs.Count - i - 3) < perMergeLength)
|
|
||||||
{
|
|
||||||
remain = msgs.Count - i - 3;
|
|
||||||
}
|
|
||||||
else remain = perMergeLength;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
real.Add(msgs[^3]);
|
|
||||||
}
|
|
||||||
real.Add(msgs[^2]);
|
|
||||||
real.Add(msgs[^1]);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
real = msgs;
|
|
||||||
}
|
|
||||||
if (real.Count >= 3)
|
|
||||||
{
|
|
||||||
real = real[^3..];
|
|
||||||
}
|
|
||||||
int count = 1;
|
int count = 1;
|
||||||
foreach (string msg in real)
|
foreach (string msg in real)
|
||||||
{
|
{
|
||||||
@ -1877,45 +1734,7 @@ namespace Oshima.FunGame.WebAPI.Services
|
|||||||
if (int.TryParse(detail.Trim(), out int index))
|
if (int.TryParse(detail.Trim(), out int index))
|
||||||
{
|
{
|
||||||
msgs = await Controller.FightBossTeam(uid, index, true);
|
msgs = await Controller.FightBossTeam(uid, index, true);
|
||||||
List<string> real = [];
|
List<string> real = MergeMessages(msgs);
|
||||||
if (msgs.Count >= 3)
|
|
||||||
{
|
|
||||||
if (msgs.Count < 20)
|
|
||||||
{
|
|
||||||
int perMergeLength = msgs.Count > 7 ? 7 : msgs.Count - 1;
|
|
||||||
int remain = perMergeLength;
|
|
||||||
string merge = "";
|
|
||||||
for (int i = 0; i < msgs.Count - 1; i++)
|
|
||||||
{
|
|
||||||
remain--;
|
|
||||||
merge += msgs[i] + "\r\n";
|
|
||||||
if (remain == 0)
|
|
||||||
{
|
|
||||||
real.Add(merge);
|
|
||||||
merge = "";
|
|
||||||
if ((msgs.Count - i - 3) < perMergeLength)
|
|
||||||
{
|
|
||||||
remain = msgs.Count - i - 3;
|
|
||||||
}
|
|
||||||
else remain = perMergeLength;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
real.Add(msgs[^3]);
|
|
||||||
}
|
|
||||||
real.Add(msgs[^2]);
|
|
||||||
real.Add(msgs[^1]);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
real = msgs;
|
|
||||||
}
|
|
||||||
if (real.Count >= 3)
|
|
||||||
{
|
|
||||||
real = real[^3..];
|
|
||||||
}
|
|
||||||
int count = 1;
|
int count = 1;
|
||||||
foreach (string msg in real)
|
foreach (string msg in real)
|
||||||
{
|
{
|
||||||
@ -1937,45 +1756,7 @@ namespace Oshima.FunGame.WebAPI.Services
|
|||||||
if (int.TryParse(detail.Trim(), out int index))
|
if (int.TryParse(detail.Trim(), out int index))
|
||||||
{
|
{
|
||||||
msgs = await Controller.FightBoss(uid, index, true);
|
msgs = await Controller.FightBoss(uid, index, true);
|
||||||
List<string> real = [];
|
List<string> real = MergeMessages(msgs);
|
||||||
if (msgs.Count >= 3)
|
|
||||||
{
|
|
||||||
if (msgs.Count < 20)
|
|
||||||
{
|
|
||||||
int perMergeLength = msgs.Count > 7 ? 7 : msgs.Count - 1;
|
|
||||||
int remain = perMergeLength;
|
|
||||||
string merge = "";
|
|
||||||
for (int i = 0; i < msgs.Count - 1; i++)
|
|
||||||
{
|
|
||||||
remain--;
|
|
||||||
merge += msgs[i] + "\r\n";
|
|
||||||
if (remain == 0)
|
|
||||||
{
|
|
||||||
real.Add(merge);
|
|
||||||
merge = "";
|
|
||||||
if ((msgs.Count - i - 3) < perMergeLength)
|
|
||||||
{
|
|
||||||
remain = msgs.Count - i - 3;
|
|
||||||
}
|
|
||||||
else remain = perMergeLength;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
real.Add(msgs[^3]);
|
|
||||||
}
|
|
||||||
real.Add(msgs[^2]);
|
|
||||||
real.Add(msgs[^1]);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
real = msgs;
|
|
||||||
}
|
|
||||||
if (real.Count >= 3)
|
|
||||||
{
|
|
||||||
real = real[^3..];
|
|
||||||
}
|
|
||||||
int count = 1;
|
int count = 1;
|
||||||
foreach (string msg in real)
|
foreach (string msg in real)
|
||||||
{
|
{
|
||||||
@ -2043,7 +1824,35 @@ namespace Oshima.FunGame.WebAPI.Services
|
|||||||
string detail = e.Detail.Replace("加入社团", "").Trim();
|
string detail = e.Detail.Replace("加入社团", "").Trim();
|
||||||
if (int.TryParse(detail, out int c))
|
if (int.TryParse(detail, out int c))
|
||||||
{
|
{
|
||||||
string msg = Controller.JoinClub(uid, c);
|
string msg = Controller.ClubJoin(uid, c);
|
||||||
|
if (msg != "")
|
||||||
|
{
|
||||||
|
await SendAsync(e, "社团", msg);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (e.Detail.StartsWith("邀请加入", StringComparison.CurrentCultureIgnoreCase))
|
||||||
|
{
|
||||||
|
string detail = e.Detail.Replace("邀请加入", "").Trim();
|
||||||
|
if (int.TryParse(detail, out int id))
|
||||||
|
{
|
||||||
|
string msg = Controller.ClubInvite(uid, id);
|
||||||
|
if (msg != "")
|
||||||
|
{
|
||||||
|
await SendAsync(e, "社团", msg);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (e.Detail.StartsWith("取消邀请加入", StringComparison.CurrentCultureIgnoreCase))
|
||||||
|
{
|
||||||
|
string detail = e.Detail.Replace("取消邀请加入", "").Trim();
|
||||||
|
if (int.TryParse(detail, out int id))
|
||||||
|
{
|
||||||
|
string msg = Controller.ClubInvite(uid, id, true);
|
||||||
if (msg != "")
|
if (msg != "")
|
||||||
{
|
{
|
||||||
await SendAsync(e, "社团", msg);
|
await SendAsync(e, "社团", msg);
|
||||||
@ -2061,7 +1870,7 @@ namespace Oshima.FunGame.WebAPI.Services
|
|||||||
isPublic = false;
|
isPublic = false;
|
||||||
}
|
}
|
||||||
detail = detail.Replace("私密", "").Trim();
|
detail = detail.Replace("私密", "").Trim();
|
||||||
string msg = Controller.CreateClub(uid, isPublic, detail);
|
string msg = Controller.ClubCreate(uid, isPublic, detail);
|
||||||
if (msg != "")
|
if (msg != "")
|
||||||
{
|
{
|
||||||
await SendAsync(e, "社团", msg);
|
await SendAsync(e, "社团", msg);
|
||||||
@ -2071,7 +1880,7 @@ namespace Oshima.FunGame.WebAPI.Services
|
|||||||
|
|
||||||
if (e.Detail == "退出社团")
|
if (e.Detail == "退出社团")
|
||||||
{
|
{
|
||||||
string msg = Controller.QuitClub(uid);
|
string msg = Controller.ClubQuit(uid);
|
||||||
if (msg != "")
|
if (msg != "")
|
||||||
{
|
{
|
||||||
await SendAsync(e, "社团", "\r\n" + msg);
|
await SendAsync(e, "社团", "\r\n" + msg);
|
||||||
@ -2081,7 +1890,7 @@ namespace Oshima.FunGame.WebAPI.Services
|
|||||||
|
|
||||||
if (e.Detail == "我的社团")
|
if (e.Detail == "我的社团")
|
||||||
{
|
{
|
||||||
string msg = Controller.ShowClubInfo(uid);
|
string msg = Controller.ClubShowInfo(uid);
|
||||||
if (msg != "")
|
if (msg != "")
|
||||||
{
|
{
|
||||||
await SendAsync(e, "社团", "\r\n" + msg);
|
await SendAsync(e, "社团", "\r\n" + msg);
|
||||||
@ -2089,9 +1898,28 @@ namespace Oshima.FunGame.WebAPI.Services
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (e.Detail.StartsWith("社团列表"))
|
||||||
|
{
|
||||||
|
string detail = e.Detail.Replace("社团列表", "").Trim();
|
||||||
|
string msg = "";
|
||||||
|
if (int.TryParse(detail, out int page))
|
||||||
|
{
|
||||||
|
msg = Controller.ClubShowList(uid, page);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
msg = Controller.ClubShowList(uid, 1);
|
||||||
|
}
|
||||||
|
if (msg.Trim() != "")
|
||||||
|
{
|
||||||
|
await SendAsync(e, "社团", msg);
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
if (e.Detail == "解散社团")
|
if (e.Detail == "解散社团")
|
||||||
{
|
{
|
||||||
string msg = Controller.DisbandClub(uid);
|
string msg = Controller.ClubDisband(uid);
|
||||||
if (msg != "")
|
if (msg != "")
|
||||||
{
|
{
|
||||||
await SendAsync(e, "社团", "\r\n" + msg);
|
await SendAsync(e, "社团", "\r\n" + msg);
|
||||||
@ -2104,7 +1932,7 @@ namespace Oshima.FunGame.WebAPI.Services
|
|||||||
string detail = e.Detail.Replace("查看社团成员", "").Trim();
|
string detail = e.Detail.Replace("查看社团成员", "").Trim();
|
||||||
if (int.TryParse(detail, out int page) && page > 0)
|
if (int.TryParse(detail, out int page) && page > 0)
|
||||||
{
|
{
|
||||||
string msg = Controller.ShowClubMemberList(uid, 0, page);
|
string msg = Controller.ClubShowMemberList(uid, 0, page);
|
||||||
if (msg != "")
|
if (msg != "")
|
||||||
{
|
{
|
||||||
await SendAsync(e, "社团", "\r\n" + msg);
|
await SendAsync(e, "社团", "\r\n" + msg);
|
||||||
@ -2112,7 +1940,7 @@ namespace Oshima.FunGame.WebAPI.Services
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
string msg = Controller.ShowClubMemberList(uid, 0, 1);
|
string msg = Controller.ClubShowMemberList(uid, 0, 1);
|
||||||
if (msg != "")
|
if (msg != "")
|
||||||
{
|
{
|
||||||
await SendAsync(e, "社团", "\r\n" + msg);
|
await SendAsync(e, "社团", "\r\n" + msg);
|
||||||
@ -2126,7 +1954,7 @@ namespace Oshima.FunGame.WebAPI.Services
|
|||||||
string detail = e.Detail.Replace("查看社团管理", "").Trim();
|
string detail = e.Detail.Replace("查看社团管理", "").Trim();
|
||||||
if (int.TryParse(detail, out int page) && page > 0)
|
if (int.TryParse(detail, out int page) && page > 0)
|
||||||
{
|
{
|
||||||
string msg = Controller.ShowClubMemberList(uid, 1, page);
|
string msg = Controller.ClubShowMemberList(uid, 1, page);
|
||||||
if (msg != "")
|
if (msg != "")
|
||||||
{
|
{
|
||||||
await SendAsync(e, "社团", "\r\n" + msg);
|
await SendAsync(e, "社团", "\r\n" + msg);
|
||||||
@ -2134,7 +1962,7 @@ namespace Oshima.FunGame.WebAPI.Services
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
string msg = Controller.ShowClubMemberList(uid, 1, 1);
|
string msg = Controller.ClubShowMemberList(uid, 1, 1);
|
||||||
if (msg != "")
|
if (msg != "")
|
||||||
{
|
{
|
||||||
await SendAsync(e, "社团", "\r\n" + msg);
|
await SendAsync(e, "社团", "\r\n" + msg);
|
||||||
@ -2148,7 +1976,7 @@ namespace Oshima.FunGame.WebAPI.Services
|
|||||||
string detail = e.Detail.Replace("查看申请人列表", "").Trim();
|
string detail = e.Detail.Replace("查看申请人列表", "").Trim();
|
||||||
if (int.TryParse(detail, out int page) && page > 0)
|
if (int.TryParse(detail, out int page) && page > 0)
|
||||||
{
|
{
|
||||||
string msg = Controller.ShowClubMemberList(uid, 2, page);
|
string msg = Controller.ClubShowMemberList(uid, 2, page);
|
||||||
if (msg != "")
|
if (msg != "")
|
||||||
{
|
{
|
||||||
await SendAsync(e, "社团", "\r\n" + msg);
|
await SendAsync(e, "社团", "\r\n" + msg);
|
||||||
@ -2156,7 +1984,29 @@ namespace Oshima.FunGame.WebAPI.Services
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
string msg = Controller.ShowClubMemberList(uid, 2, 1);
|
string msg = Controller.ClubShowMemberList(uid, 2, 1);
|
||||||
|
if (msg != "")
|
||||||
|
{
|
||||||
|
await SendAsync(e, "社团", "\r\n" + msg);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (e.Detail.StartsWith("查看受邀人列表"))
|
||||||
|
{
|
||||||
|
string detail = e.Detail.Replace("查看受邀人列表", "").Trim();
|
||||||
|
if (int.TryParse(detail, out int page) && page > 0)
|
||||||
|
{
|
||||||
|
string msg = Controller.ClubShowMemberList(uid, 3, page);
|
||||||
|
if (msg != "")
|
||||||
|
{
|
||||||
|
await SendAsync(e, "社团", "\r\n" + msg);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
string msg = Controller.ClubShowMemberList(uid, 3, 1);
|
||||||
if (msg != "")
|
if (msg != "")
|
||||||
{
|
{
|
||||||
await SendAsync(e, "社团", "\r\n" + msg);
|
await SendAsync(e, "社团", "\r\n" + msg);
|
||||||
@ -2170,7 +2020,7 @@ namespace Oshima.FunGame.WebAPI.Services
|
|||||||
string detail = e.Detail.Replace("社团批准", "").Replace("@", "").Trim();
|
string detail = e.Detail.Replace("社团批准", "").Replace("@", "").Trim();
|
||||||
if (long.TryParse(detail, out long id))
|
if (long.TryParse(detail, out long id))
|
||||||
{
|
{
|
||||||
string msg = Controller.ApproveClub(uid, id, true);
|
string msg = Controller.ClubApprove(uid, id, true);
|
||||||
if (msg != "")
|
if (msg != "")
|
||||||
{
|
{
|
||||||
await SendAsync(e, "社团", msg);
|
await SendAsync(e, "社团", msg);
|
||||||
@ -2184,7 +2034,7 @@ namespace Oshima.FunGame.WebAPI.Services
|
|||||||
string detail = e.Detail.Replace("社团拒绝", "").Replace("@", "").Trim();
|
string detail = e.Detail.Replace("社团拒绝", "").Replace("@", "").Trim();
|
||||||
if (long.TryParse(detail, out long id))
|
if (long.TryParse(detail, out long id))
|
||||||
{
|
{
|
||||||
string msg = Controller.ApproveClub(uid, id, false);
|
string msg = Controller.ClubApprove(uid, id, false);
|
||||||
if (msg != "")
|
if (msg != "")
|
||||||
{
|
{
|
||||||
await SendAsync(e, "社团", msg);
|
await SendAsync(e, "社团", msg);
|
||||||
@ -2198,7 +2048,7 @@ namespace Oshima.FunGame.WebAPI.Services
|
|||||||
string detail = e.Detail.Replace("社团踢出", "").Replace("@", "").Trim();
|
string detail = e.Detail.Replace("社团踢出", "").Replace("@", "").Trim();
|
||||||
if (long.TryParse(detail, out long id))
|
if (long.TryParse(detail, out long id))
|
||||||
{
|
{
|
||||||
string msg = Controller.KickClub(uid, id);
|
string msg = Controller.ClubKick(uid, id);
|
||||||
if (msg != "")
|
if (msg != "")
|
||||||
{
|
{
|
||||||
await SendAsync(e, "社团", msg);
|
await SendAsync(e, "社团", msg);
|
||||||
@ -2230,7 +2080,7 @@ namespace Oshima.FunGame.WebAPI.Services
|
|||||||
{
|
{
|
||||||
args = [.. strings[1..]];
|
args = [.. strings[1..]];
|
||||||
}
|
}
|
||||||
string msg = Controller.ChangeClub(uid, part, [.. args]);
|
string msg = Controller.ClubChange(uid, part, [.. args]);
|
||||||
if (msg != "")
|
if (msg != "")
|
||||||
{
|
{
|
||||||
await SendAsync(e, "社团", msg);
|
await SendAsync(e, "社团", msg);
|
||||||
@ -2243,7 +2093,7 @@ namespace Oshima.FunGame.WebAPI.Services
|
|||||||
{
|
{
|
||||||
string detail = e.Detail.Replace("社团转让", "").Replace("@", "").Trim();
|
string detail = e.Detail.Replace("社团转让", "").Replace("@", "").Trim();
|
||||||
List<string> args = [detail];
|
List<string> args = [detail];
|
||||||
string msg = Controller.ChangeClub(uid, "setmaster", [.. args]);
|
string msg = Controller.ClubChange(uid, "setmaster", [.. args]);
|
||||||
if (msg != "")
|
if (msg != "")
|
||||||
{
|
{
|
||||||
await SendAsync(e, "社团", msg);
|
await SendAsync(e, "社团", msg);
|
||||||
@ -2251,6 +2101,21 @@ namespace Oshima.FunGame.WebAPI.Services
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (e.Detail.StartsWith("社团捐献"))
|
||||||
|
{
|
||||||
|
string detail = e.Detail.Replace("社团捐献", "").Trim();
|
||||||
|
string msg = "";
|
||||||
|
if (double.TryParse(detail, out double credits))
|
||||||
|
{
|
||||||
|
msg = Controller.ClubContribution(uid, credits);
|
||||||
|
}
|
||||||
|
if (msg.Trim() != "")
|
||||||
|
{
|
||||||
|
await SendAsync(e, "社团", msg);
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
if (e.Detail == "每日商店")
|
if (e.Detail == "每日商店")
|
||||||
{
|
{
|
||||||
string msg = Controller.ShowDailyStore(uid);
|
string msg = Controller.ShowDailyStore(uid);
|
||||||
@ -2403,7 +2268,7 @@ namespace Oshima.FunGame.WebAPI.Services
|
|||||||
}
|
}
|
||||||
if (cindexs.Count > 1 && cindexs.Count <= 5)
|
if (cindexs.Count > 1 && cindexs.Count <= 5)
|
||||||
{
|
{
|
||||||
(msg, eid) = Controller.ExploreRegion(uid, cindexs[0], [.. cindexs.Skip(1).Select(id => (long)id)]);
|
(msg, eid) = Controller.ExploreRegion(uid, cindexs[0], false, [.. cindexs.Skip(1).Select(id => (long)id)]);
|
||||||
if (msg.Trim() != "")
|
if (msg.Trim() != "")
|
||||||
{
|
{
|
||||||
await SendAsync(e, "探索", msg);
|
await SendAsync(e, "探索", msg);
|
||||||
@ -2428,6 +2293,44 @@ namespace Oshima.FunGame.WebAPI.Services
|
|||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (e.Detail.StartsWith("小队探索"))
|
||||||
|
{
|
||||||
|
string detail = e.Detail.Replace("小队探索", "").Trim();
|
||||||
|
string msg = "";
|
||||||
|
string eid = "";
|
||||||
|
string[] strings = detail.Split(FunGameConstant.SplitChars, StringSplitOptions.TrimEntries | StringSplitOptions.RemoveEmptyEntries);
|
||||||
|
List<int> cindexs = [];
|
||||||
|
foreach (string s in strings)
|
||||||
|
{
|
||||||
|
if (int.TryParse(s, out int c))
|
||||||
|
{
|
||||||
|
cindexs.Add(c);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (cindexs.Count > 0)
|
||||||
|
{
|
||||||
|
(msg, eid) = Controller.ExploreRegion(uid, cindexs[0], true);
|
||||||
|
if (msg.Trim() != "")
|
||||||
|
{
|
||||||
|
await SendAsync(e, "探索", msg);
|
||||||
|
}
|
||||||
|
_ = Task.Run(async () =>
|
||||||
|
{
|
||||||
|
await Task.Delay(FunGameConstant.ExploreTime * 60 * 1000);
|
||||||
|
msg = Controller.SettleExplore(eid, uid);
|
||||||
|
if (msg.Trim() != "")
|
||||||
|
{
|
||||||
|
await SendAsync(e, "探索", msg, msgSeq: 2);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
await SendAsync(e, "探索", "探索指令格式错误,正确格式为:小队探索 <地区序号>");
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
if (e.Detail == "生命之泉")
|
if (e.Detail == "生命之泉")
|
||||||
{
|
{
|
||||||
@ -2971,6 +2874,16 @@ namespace Oshima.FunGame.WebAPI.Services
|
|||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (e.Detail == "共斗商店")
|
||||||
|
{
|
||||||
|
string msg = Controller.ShowSystemStore(uid, "铎京城", "dokyo_cooperative");
|
||||||
|
if (msg.Trim() != "")
|
||||||
|
{
|
||||||
|
await SendAsync(e, "商店", msg);
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
if (e.Detail.StartsWith("商店"))
|
if (e.Detail.StartsWith("商店"))
|
||||||
{
|
{
|
||||||
@ -2998,6 +2911,9 @@ namespace Oshima.FunGame.WebAPI.Services
|
|||||||
case 6:
|
case 6:
|
||||||
msg = Controller.ShowSystemStore(uid, "铎京城", "dokyo_horseracing");
|
msg = Controller.ShowSystemStore(uid, "铎京城", "dokyo_horseracing");
|
||||||
break;
|
break;
|
||||||
|
case 7:
|
||||||
|
msg = Controller.ShowSystemStore(uid, "铎京城", "dokyo_cooperative");
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -3301,7 +3217,7 @@ namespace Oshima.FunGame.WebAPI.Services
|
|||||||
}
|
}
|
||||||
if (groupId != "")
|
if (groupId != "")
|
||||||
{
|
{
|
||||||
string msg = Controller.CreateRoom(uid, "horseracing", "", groupId);
|
string msg = Controller.RoomCreate(uid, "horseracing", "", groupId);
|
||||||
if (msg.Trim() != "")
|
if (msg.Trim() != "")
|
||||||
{
|
{
|
||||||
await SendAsync(e, "赛马", msg);
|
await SendAsync(e, "赛马", msg);
|
||||||
@ -3327,7 +3243,7 @@ namespace Oshima.FunGame.WebAPI.Services
|
|||||||
}
|
}
|
||||||
if (groupId != "")
|
if (groupId != "")
|
||||||
{
|
{
|
||||||
string msg = Controller.CreateRoom(uid, "cooperative", "", groupId);
|
string msg = Controller.RoomCreate(uid, "cooperative", "", groupId);
|
||||||
if (msg.Trim() != "")
|
if (msg.Trim() != "")
|
||||||
{
|
{
|
||||||
await SendAsync(e, "房间", msg);
|
await SendAsync(e, "房间", msg);
|
||||||
@ -3353,7 +3269,7 @@ namespace Oshima.FunGame.WebAPI.Services
|
|||||||
}
|
}
|
||||||
if (groupId != "")
|
if (groupId != "")
|
||||||
{
|
{
|
||||||
string msg = Controller.CreateRoom(uid, "mix", "", groupId);
|
string msg = Controller.RoomCreate(uid, "mix", "", groupId);
|
||||||
if (msg.Trim() != "")
|
if (msg.Trim() != "")
|
||||||
{
|
{
|
||||||
await SendAsync(e, "房间", msg);
|
await SendAsync(e, "房间", msg);
|
||||||
@ -3379,7 +3295,7 @@ namespace Oshima.FunGame.WebAPI.Services
|
|||||||
}
|
}
|
||||||
if (groupId != "")
|
if (groupId != "")
|
||||||
{
|
{
|
||||||
string msg = Controller.CreateRoom(uid, "team", "", groupId);
|
string msg = Controller.RoomCreate(uid, "team", "", groupId);
|
||||||
if (msg.Trim() != "")
|
if (msg.Trim() != "")
|
||||||
{
|
{
|
||||||
await SendAsync(e, "房间", msg);
|
await SendAsync(e, "房间", msg);
|
||||||
@ -3407,7 +3323,7 @@ namespace Oshima.FunGame.WebAPI.Services
|
|||||||
{
|
{
|
||||||
if (FunGameConstant.Rooms.Values.FirstOrDefault(r => r.GameMap == groupId) is Room room)
|
if (FunGameConstant.Rooms.Values.FirstOrDefault(r => r.GameMap == groupId) is Room room)
|
||||||
{
|
{
|
||||||
string msg = Controller.IntoRoom(uid, room.Roomid, "");
|
string msg = Controller.RoomInto(uid, room.Roomid, "");
|
||||||
if (msg.Trim() != "")
|
if (msg.Trim() != "")
|
||||||
{
|
{
|
||||||
await SendAsync(e, "赛马", msg);
|
await SendAsync(e, "赛马", msg);
|
||||||
@ -3450,7 +3366,7 @@ namespace Oshima.FunGame.WebAPI.Services
|
|||||||
password = detail[(firstSpaceIndex + 1)..].Trim();
|
password = detail[(firstSpaceIndex + 1)..].Trim();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
string msg = Controller.CreateRoom(uid, roomType, password, groupId);
|
string msg = Controller.RoomCreate(uid, roomType, password, groupId);
|
||||||
if (msg.Trim() != "")
|
if (msg.Trim() != "")
|
||||||
{
|
{
|
||||||
await SendAsync(e, "房间", msg);
|
await SendAsync(e, "房间", msg);
|
||||||
@ -3488,7 +3404,7 @@ namespace Oshima.FunGame.WebAPI.Services
|
|||||||
password = detail[(firstSpaceIndex + 1)..].Trim();
|
password = detail[(firstSpaceIndex + 1)..].Trim();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
string msg = Controller.IntoRoom(uid, roomid, password);
|
string msg = Controller.RoomInto(uid, roomid, password);
|
||||||
if (msg.Trim() != "")
|
if (msg.Trim() != "")
|
||||||
{
|
{
|
||||||
await SendAsync(e, "房间", msg);
|
await SendAsync(e, "房间", msg);
|
||||||
@ -3519,41 +3435,8 @@ namespace Oshima.FunGame.WebAPI.Services
|
|||||||
await SendAsync(e, "房间", "你不在房间中或者所在的房间不是赛马房间,请使用【开始游戏】指令。注意:只有房主才可以开始游戏。");
|
await SendAsync(e, "房间", "你不在房间中或者所在的房间不是赛马房间,请使用【开始游戏】指令。注意:只有房主才可以开始游戏。");
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
(Room room, List<string> msgs) = await Controller.RunGame(uid);
|
(Room room, List<string> msgs) = await Controller.RoomRunGame(uid);
|
||||||
List<string> real = [];
|
List<string> real = MergeMessages(msgs);
|
||||||
if (msgs.Count > 1)
|
|
||||||
{
|
|
||||||
if (msgs.Count > 20)
|
|
||||||
{
|
|
||||||
msgs = [msgs[0], .. msgs[^20..]];
|
|
||||||
}
|
|
||||||
int perMergeLength = msgs.Count > 5 ? 5 : msgs.Count;
|
|
||||||
int remain = perMergeLength;
|
|
||||||
string merge = "";
|
|
||||||
for (int i = 0; i < msgs.Count; i++)
|
|
||||||
{
|
|
||||||
remain--;
|
|
||||||
merge += msgs[i] + "\r\n";
|
|
||||||
if (remain == 0 || i == msgs.Count - 1)
|
|
||||||
{
|
|
||||||
real.Add(merge);
|
|
||||||
merge = "";
|
|
||||||
if (msgs.Count < perMergeLength)
|
|
||||||
{
|
|
||||||
remain = msgs.Count;
|
|
||||||
}
|
|
||||||
else remain = perMergeLength;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
real = msgs;
|
|
||||||
}
|
|
||||||
if (real.Count >= 3)
|
|
||||||
{
|
|
||||||
real = [real[0], .. real[^2..]];
|
|
||||||
}
|
|
||||||
int count = 1;
|
int count = 1;
|
||||||
foreach (string msg in real)
|
foreach (string msg in real)
|
||||||
{
|
{
|
||||||
@ -3582,7 +3465,33 @@ namespace Oshima.FunGame.WebAPI.Services
|
|||||||
}
|
}
|
||||||
if (groupId != "")
|
if (groupId != "")
|
||||||
{
|
{
|
||||||
string msg = Controller.QuitRoom(uid);
|
string msg = Controller.RoomQuit(uid);
|
||||||
|
if (msg.Trim() != "")
|
||||||
|
{
|
||||||
|
await SendAsync(e, "房间", msg);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
await SendAsync(e, "房间", "请在群聊中进行多人游戏。");
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (e.Detail == "房间列表")
|
||||||
|
{
|
||||||
|
string groupId = "";
|
||||||
|
if (e.IsGroup && e is GroupAtMessage groupAtMessage && groupAtMessage.GroupOpenId != "")
|
||||||
|
{
|
||||||
|
groupId = groupAtMessage.GroupOpenId;
|
||||||
|
}
|
||||||
|
else if (e.IsGroup && e is ThirdPartyMessage thirdPartyMessage && thirdPartyMessage.GroupOpenId != "")
|
||||||
|
{
|
||||||
|
groupId = thirdPartyMessage.GroupOpenId;
|
||||||
|
}
|
||||||
|
if (groupId != "")
|
||||||
|
{
|
||||||
|
string msg = Controller.RoomShowList(uid, groupId);
|
||||||
if (msg.Trim() != "")
|
if (msg.Trim() != "")
|
||||||
{
|
{
|
||||||
await SendAsync(e, "房间", msg);
|
await SendAsync(e, "房间", msg);
|
||||||
@ -3644,6 +3553,82 @@ namespace Oshima.FunGame.WebAPI.Services
|
|||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (e.Detail == $"共斗排行榜")
|
||||||
|
{
|
||||||
|
string msg = Controller.GetRanking(uid, 4);
|
||||||
|
if (msg.Trim() != "")
|
||||||
|
{
|
||||||
|
await SendAsync(e, "排行榜", msg);
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (e.Detail == $"锻造排行榜")
|
||||||
|
{
|
||||||
|
string msg = Controller.GetRanking(uid, 5);
|
||||||
|
if (msg.Trim() != "")
|
||||||
|
{
|
||||||
|
await SendAsync(e, "排行榜", msg);
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (e.Detail.StartsWith("加物") || e.Detail.StartsWith("添加背包物品"))
|
||||||
|
{
|
||||||
|
string detail = e.Detail.Replace("加物", "").Replace("添加背包物品", "").Trim();
|
||||||
|
string[] strings = detail.Split(FunGameConstant.SplitChars, StringSplitOptions.TrimEntries | StringSplitOptions.RemoveEmptyEntries);
|
||||||
|
if (strings.Length < 2)
|
||||||
|
{
|
||||||
|
await SendAsync(e, "加物", "格式不正确,请使用:加物 <角色> <{库存物品序号...}>。多个物品序号使用空格隔开。");
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
List<int> ids = [];
|
||||||
|
int cid = -999;
|
||||||
|
for (int i = 0; i < strings.Length; i++)
|
||||||
|
{
|
||||||
|
if (int.TryParse(strings[i], out int id))
|
||||||
|
{
|
||||||
|
if (i != 0) ids.Add(id);
|
||||||
|
else cid = id;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
string msg = Controller.AddItemsToCharacter(uid, cid, [.. ids]);
|
||||||
|
if (msg != "")
|
||||||
|
{
|
||||||
|
await SendAsync(e, "加物", msg);
|
||||||
|
}
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (e.Detail.StartsWith("减物") || e.Detail.StartsWith("移除背包物品"))
|
||||||
|
{
|
||||||
|
string detail = e.Detail.Replace("减物", "").Replace("移除背包物品", "").Trim();
|
||||||
|
string[] strings = detail.Split(FunGameConstant.SplitChars, StringSplitOptions.TrimEntries | StringSplitOptions.RemoveEmptyEntries);
|
||||||
|
if (strings.Length < 2)
|
||||||
|
{
|
||||||
|
await SendAsync(e, "减物", "格式不正确,请使用:减物 <角色> <{库存物品序号...}>。多个物品序号使用空格隔开。");
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
List<int> ids = [];
|
||||||
|
int cid = -999;
|
||||||
|
for (int i = 0; i < strings.Length; i++)
|
||||||
|
{
|
||||||
|
if (int.TryParse(strings[i], out int id))
|
||||||
|
{
|
||||||
|
if (i != 0) ids.Add(id);
|
||||||
|
else cid = id;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
string msg = Controller.RemoveItemsFromCharacter(uid, cid, [.. 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))
|
||||||
{
|
{
|
||||||
@ -3662,5 +3647,44 @@ namespace Oshima.FunGame.WebAPI.Services
|
|||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public List<string> MergeMessages(List<string> msgs)
|
||||||
|
{
|
||||||
|
List<string> real = [];
|
||||||
|
if (msgs.Count > 1)
|
||||||
|
{
|
||||||
|
if (msgs.Count > 20)
|
||||||
|
{
|
||||||
|
msgs = [msgs[0], .. msgs[^20..]];
|
||||||
|
}
|
||||||
|
int perMergeLength = msgs.Count > 5 ? 5 : msgs.Count;
|
||||||
|
int remain = perMergeLength;
|
||||||
|
string merge = "";
|
||||||
|
for (int i = 0; i < msgs.Count; i++)
|
||||||
|
{
|
||||||
|
remain--;
|
||||||
|
merge += msgs[i] + "\r\n";
|
||||||
|
if (remain == 0 || i == msgs.Count - 1)
|
||||||
|
{
|
||||||
|
real.Add(merge);
|
||||||
|
merge = "";
|
||||||
|
if (msgs.Count < perMergeLength)
|
||||||
|
{
|
||||||
|
remain = msgs.Count;
|
||||||
|
}
|
||||||
|
else remain = perMergeLength;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
real = msgs;
|
||||||
|
}
|
||||||
|
if (real.Count >= 3)
|
||||||
|
{
|
||||||
|
real = [real[0], .. real[^2..]];
|
||||||
|
}
|
||||||
|
return real;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user