From 8503c90567ed57e4048210e98ad0617d01233c62 Mon Sep 17 00:00:00 2001 From: Kaioru Date: Wed, 15 Nov 2023 13:16:50 +0800 Subject: [PATCH] Update collections to use immutable --- .../Skills/Resistance/Mechanic1SkillHandler.cs | 2 -- .../Skills/Resistance/Mechanic3SkillHandler.cs | 1 - .../Speakers/Facades/SpeakerUserInventory.cs | 5 +++-- ...ieldOnPacketUserCharacterInfoRequestPlug.cs | 4 ++-- .../Objects/Mob/Templates/MobTemplate.cs | 7 ++++--- .../Quests/Templates/QuestTemplateAct.cs | 1 - .../Templates/FieldTemplate.cs | 1 - .../Templates/ModifiedCommodityTemplate.cs | 1 - .../Skills/Modify/ModifySkillContext.cs | 7 ++++--- .../Skills/Templates/SkillTemplate.cs | 1 - .../Items/Templates/Sets/ItemSetTemplate.cs | 1 - .../Modify/ModifyInventoryContext.cs | 18 +++++++++++------- .../Social/PartyExtensions.cs | 5 +++-- .../Handlers/NettyTransportAcceptorHandler.cs | 3 +-- .../Handlers/NettyTransportConnectorHandler.cs | 3 +-- .../Repositories/Repository.cs | 1 - .../Tickers/TickerManager.cs | 3 +-- .../Commands/AbstractTemplateCommand.cs | 11 ++++++----- .../Commands/Admin/EquipCommand.cs | 10 ++++++---- .../Commands/Admin/FieldCommand.cs | 2 +- .../Commands/Admin/ItemCommand.cs | 2 +- .../Commands/Admin/MobCommand.cs | 2 +- .../Commands/Admin/NPCCommand.cs | 2 +- .../Commands/Admin/QuestCommand.cs | 2 +- .../Commands/Admin/SkillCommand.cs | 2 +- 25 files changed, 48 insertions(+), 49 deletions(-) diff --git a/src/common/Edelstein.Common.Gameplay.Game/Combat/Skills/Resistance/Mechanic1SkillHandler.cs b/src/common/Edelstein.Common.Gameplay.Game/Combat/Skills/Resistance/Mechanic1SkillHandler.cs index 812c38eb9..ecdc0deb9 100644 --- a/src/common/Edelstein.Common.Gameplay.Game/Combat/Skills/Resistance/Mechanic1SkillHandler.cs +++ b/src/common/Edelstein.Common.Gameplay.Game/Combat/Skills/Resistance/Mechanic1SkillHandler.cs @@ -1,7 +1,5 @@ using Edelstein.Common.Constants; using Edelstein.Protocol.Gameplay.Game.Combat; -using Edelstein.Protocol.Gameplay.Game.Objects.Mob; -using Edelstein.Protocol.Gameplay.Game.Objects.Mob.Stats; using Edelstein.Protocol.Gameplay.Game.Objects.User; namespace Edelstein.Common.Gameplay.Game.Combat.Skills.Resistance; diff --git a/src/common/Edelstein.Common.Gameplay.Game/Combat/Skills/Resistance/Mechanic3SkillHandler.cs b/src/common/Edelstein.Common.Gameplay.Game/Combat/Skills/Resistance/Mechanic3SkillHandler.cs index 26529c199..4a875e2a1 100644 --- a/src/common/Edelstein.Common.Gameplay.Game/Combat/Skills/Resistance/Mechanic3SkillHandler.cs +++ b/src/common/Edelstein.Common.Gameplay.Game/Combat/Skills/Resistance/Mechanic3SkillHandler.cs @@ -1,7 +1,6 @@ using Edelstein.Common.Constants; using Edelstein.Protocol.Gameplay.Game.Combat; using Edelstein.Protocol.Gameplay.Game.Objects; -using Edelstein.Protocol.Gameplay.Game.Objects.AffectedArea; using Edelstein.Protocol.Gameplay.Game.Objects.Mob; using Edelstein.Protocol.Gameplay.Game.Objects.Mob.Stats; using Edelstein.Protocol.Gameplay.Game.Objects.Summoned; diff --git a/src/common/Edelstein.Common.Gameplay.Game/Conversations/Speakers/Facades/SpeakerUserInventory.cs b/src/common/Edelstein.Common.Gameplay.Game/Conversations/Speakers/Facades/SpeakerUserInventory.cs index 7528ce080..0c139269e 100644 --- a/src/common/Edelstein.Common.Gameplay.Game/Conversations/Speakers/Facades/SpeakerUserInventory.cs +++ b/src/common/Edelstein.Common.Gameplay.Game/Conversations/Speakers/Facades/SpeakerUserInventory.cs @@ -1,4 +1,5 @@ -using Edelstein.Common.Gameplay.Game.Objects.User.Effects; +using System.Collections.Immutable; +using Edelstein.Common.Gameplay.Game.Objects.User.Effects; using Edelstein.Protocol.Gameplay.Game.Conversations.Speakers.Facades; using Edelstein.Protocol.Gameplay.Game.Objects.User; @@ -37,5 +38,5 @@ public bool HasSlotFor(int templateID, short count = 1) public bool HasSlotFor(IDictionary templates) => _user.StageUser.Context.Managers.Inventory.HasSlotFor(_user.Character.Inventories, templates .Select(kv => Tuple.Create(kv.Key, kv.Value)) - .ToList()); + .ToImmutableArray()); } diff --git a/src/common/Edelstein.Common.Gameplay.Game/Handling/Plugs/FieldOnPacketUserCharacterInfoRequestPlug.cs b/src/common/Edelstein.Common.Gameplay.Game/Handling/Plugs/FieldOnPacketUserCharacterInfoRequestPlug.cs index 1d0082bcf..035865712 100644 --- a/src/common/Edelstein.Common.Gameplay.Game/Handling/Plugs/FieldOnPacketUserCharacterInfoRequestPlug.cs +++ b/src/common/Edelstein.Common.Gameplay.Game/Handling/Plugs/FieldOnPacketUserCharacterInfoRequestPlug.cs @@ -44,9 +44,9 @@ public async Task Handle(IPipelineContext ctx, FieldOnPacketUserCharacterInfoReq .Select(kv => kv.Value) .Select(i => i.ID) .Where(i => i / 10000 == 301) - .ToList() ?? new List(); + .ToImmutableArray() ?? ImmutableArray.Empty; - packet.WriteInt(chairs.Count); + packet.WriteInt(chairs.Length); foreach (var chair in chairs) packet.WriteInt(chair); diff --git a/src/common/Edelstein.Common.Gameplay.Game/Objects/Mob/Templates/MobTemplate.cs b/src/common/Edelstein.Common.Gameplay.Game/Objects/Mob/Templates/MobTemplate.cs index bb17b1fd1..a1b052940 100644 --- a/src/common/Edelstein.Common.Gameplay.Game/Objects/Mob/Templates/MobTemplate.cs +++ b/src/common/Edelstein.Common.Gameplay.Game/Objects/Mob/Templates/MobTemplate.cs @@ -1,4 +1,5 @@ -using Duey.Abstractions; +using System.Collections.Immutable; +using Duey.Abstractions; using Edelstein.Protocol.Gameplay.Game.Objects; using Edelstein.Protocol.Gameplay.Game.Objects.Mob.Templates; using Edelstein.Protocol.Gameplay.Models.Characters.Skills.Templates; @@ -49,9 +50,9 @@ public MobTemplate(int id, IDataNode node, IDataNode info) var elemCount = 0; var elemAttrs = info.ResolveString("elemAttr") ?? string.Empty; - foreach (var group in elemAttrs.GroupBy(_ => elemCount++ / 2).ToList()) + foreach (var group in elemAttrs.GroupBy(_ => elemCount++ / 2).ToImmutableArray()) { - var groupList = group.ToList(); + var groupList = group.ToImmutableArray(); var elem = groupList[0] switch { 'P' => Element.Physical, diff --git a/src/common/Edelstein.Common.Gameplay.Game/Quests/Templates/QuestTemplateAct.cs b/src/common/Edelstein.Common.Gameplay.Game/Quests/Templates/QuestTemplateAct.cs index 6df05add4..60d9cd8c5 100644 --- a/src/common/Edelstein.Common.Gameplay.Game/Quests/Templates/QuestTemplateAct.cs +++ b/src/common/Edelstein.Common.Gameplay.Game/Quests/Templates/QuestTemplateAct.cs @@ -1,5 +1,4 @@ using System.Collections.Frozen; -using System.Collections.Immutable; using Duey.Abstractions; using Edelstein.Protocol.Gameplay.Game.Quests.Templates; diff --git a/src/common/Edelstein.Common.Gameplay.Game/Templates/FieldTemplate.cs b/src/common/Edelstein.Common.Gameplay.Game/Templates/FieldTemplate.cs index bdbcc5456..f130d9b07 100644 --- a/src/common/Edelstein.Common.Gameplay.Game/Templates/FieldTemplate.cs +++ b/src/common/Edelstein.Common.Gameplay.Game/Templates/FieldTemplate.cs @@ -1,5 +1,4 @@ using System.Collections.Frozen; -using System.Collections.Immutable; using Duey.Abstractions; using Edelstein.Common.Gameplay.Game.Spatial; using Edelstein.Common.Utilities.Spatial; diff --git a/src/common/Edelstein.Common.Gameplay.Shop/Commodities/Templates/ModifiedCommodityTemplate.cs b/src/common/Edelstein.Common.Gameplay.Shop/Commodities/Templates/ModifiedCommodityTemplate.cs index 538d26e18..f7041a6de 100644 --- a/src/common/Edelstein.Common.Gameplay.Shop/Commodities/Templates/ModifiedCommodityTemplate.cs +++ b/src/common/Edelstein.Common.Gameplay.Shop/Commodities/Templates/ModifiedCommodityTemplate.cs @@ -1,5 +1,4 @@ using System.Collections.Frozen; -using System.Collections.Immutable; using Duey.Abstractions; using Edelstein.Protocol.Gameplay.Shop.Commodities; using Edelstein.Protocol.Utilities.Templates; diff --git a/src/common/Edelstein.Common.Gameplay/Models/Characters/Skills/Modify/ModifySkillContext.cs b/src/common/Edelstein.Common.Gameplay/Models/Characters/Skills/Modify/ModifySkillContext.cs index f2d2432b1..9e19af9d0 100644 --- a/src/common/Edelstein.Common.Gameplay/Models/Characters/Skills/Modify/ModifySkillContext.cs +++ b/src/common/Edelstein.Common.Gameplay/Models/Characters/Skills/Modify/ModifySkillContext.cs @@ -1,4 +1,5 @@ -using Edelstein.Common.Constants; +using System.Collections.Immutable; +using Edelstein.Common.Constants; using Edelstein.Common.Utilities.Packets; using Edelstein.Protocol.Gameplay.Models.Characters; using Edelstein.Protocol.Gameplay.Models.Characters.Skills; @@ -59,13 +60,13 @@ public void ResetByJobLevel(int jobLevel) { foreach (var kv in _character.Skills.Records .Where(kv => JobConstants.GetJobLevel(jobLevel) == jobLevel) - .ToList()) + .ToImmutableArray()) Set(kv.Key, 0); } public void ResetAll() { - foreach (var kv in _character.Skills.Records.ToList()) + foreach (var kv in _character.Skills.Records.ToImmutableArray()) Set(kv.Key, 0); } diff --git a/src/common/Edelstein.Common.Gameplay/Models/Characters/Skills/Templates/SkillTemplate.cs b/src/common/Edelstein.Common.Gameplay/Models/Characters/Skills/Templates/SkillTemplate.cs index b68c1a83c..e0f4602f4 100644 --- a/src/common/Edelstein.Common.Gameplay/Models/Characters/Skills/Templates/SkillTemplate.cs +++ b/src/common/Edelstein.Common.Gameplay/Models/Characters/Skills/Templates/SkillTemplate.cs @@ -1,5 +1,4 @@ using System.Collections.Frozen; -using System.Collections.Immutable; using Duey.Abstractions; using Edelstein.Protocol.Gameplay.Models.Characters.Skills.Templates; diff --git a/src/common/Edelstein.Common.Gameplay/Models/Inventories/Items/Templates/Sets/ItemSetTemplate.cs b/src/common/Edelstein.Common.Gameplay/Models/Inventories/Items/Templates/Sets/ItemSetTemplate.cs index 13cdd0e3b..90110920b 100644 --- a/src/common/Edelstein.Common.Gameplay/Models/Inventories/Items/Templates/Sets/ItemSetTemplate.cs +++ b/src/common/Edelstein.Common.Gameplay/Models/Inventories/Items/Templates/Sets/ItemSetTemplate.cs @@ -1,5 +1,4 @@ using System.Collections.Frozen; -using System.Collections.Immutable; using Duey.Abstractions; using Edelstein.Protocol.Gameplay.Models.Inventories.Templates.Sets; diff --git a/src/common/Edelstein.Common.Gameplay/Models/Inventories/Modify/ModifyInventoryContext.cs b/src/common/Edelstein.Common.Gameplay/Models/Inventories/Modify/ModifyInventoryContext.cs index cc33e0366..11ac121fb 100644 --- a/src/common/Edelstein.Common.Gameplay/Models/Inventories/Modify/ModifyInventoryContext.cs +++ b/src/common/Edelstein.Common.Gameplay/Models/Inventories/Modify/ModifyInventoryContext.cs @@ -147,11 +147,13 @@ public override void Gather() var inventoryCopy = _inventory.Items .Where(kv => kv.Key > 0) .OrderBy(kv => kv.Key) - .ToList(); + .ToImmutableArray(); short position = 1; - inventoryCopy.ForEach(kv => RemoveSlot(kv.Key)); - inventoryCopy.ForEach(kv => SetSlot(position++, kv.Value)); + foreach (var kv in inventoryCopy) + RemoveSlot(kv.Key); + foreach (var kv in inventoryCopy) + SetSlot(position++, kv.Value); } public override void Sort() @@ -160,15 +162,17 @@ public override void Sort() .Where(kv => kv.Key > 0) .OrderBy(kv => kv.Value.ID) .ThenByDescending(kv => kv.Value is IItemSlotBundle bundle ? bundle.Number : 1) - .ToList(); + .ToImmutableArray(); - inventoryCopy.ForEach(kv => RemoveSlot(kv.Key)); - inventoryCopy.ForEach(kv => Add(kv.Value)); + foreach (var kv in inventoryCopy) + RemoveSlot(kv.Key); + foreach (var kv in inventoryCopy) + Add(kv.Value); } public override void Clear() => _inventory.Items .Where(kv => kv.Key > 0) - .ToList() + .ToImmutableList() .ForEach(kv => RemoveSlot(kv.Key)); public override short Add(int templateID) => diff --git a/src/common/Edelstein.Common.Gameplay/Social/PartyExtensions.cs b/src/common/Edelstein.Common.Gameplay/Social/PartyExtensions.cs index ec3f5c9b8..cada26faa 100644 --- a/src/common/Edelstein.Common.Gameplay/Social/PartyExtensions.cs +++ b/src/common/Edelstein.Common.Gameplay/Social/PartyExtensions.cs @@ -1,4 +1,5 @@ -using Edelstein.Protocol.Services.Social; +using System.Collections.Immutable; +using Edelstein.Protocol.Services.Social; using Edelstein.Protocol.Utilities.Packets; namespace Edelstein.Common.Gameplay.Social; @@ -7,7 +8,7 @@ public static class PartyExtensions { public static void WritePartyInfo(this IPacketWriter writer, IPartyMembership party) { - var members = party.Members.Values.ToList(); + var members = party.Members.Values.ToImmutableList(); for (var i = 0; i < 6; i++) writer.WriteInt(members.ElementAtOrDefault(i)?.CharacterID ?? 0); diff --git a/src/common/Edelstein.Common.Network.DotNetty/Handlers/NettyTransportAcceptorHandler.cs b/src/common/Edelstein.Common.Network.DotNetty/Handlers/NettyTransportAcceptorHandler.cs index cdee10b83..8573c5c9b 100644 --- a/src/common/Edelstein.Common.Network.DotNetty/Handlers/NettyTransportAcceptorHandler.cs +++ b/src/common/Edelstein.Common.Network.DotNetty/Handlers/NettyTransportAcceptorHandler.cs @@ -1,5 +1,4 @@ -using System.Buffers; -using DotNetty.Transport.Channels; +using DotNetty.Transport.Channels; using Edelstein.Common.Utilities.Packets; using Edelstein.Protocol.Network; using Edelstein.Protocol.Network.Transports; diff --git a/src/common/Edelstein.Common.Network.DotNetty/Handlers/NettyTransportConnectorHandler.cs b/src/common/Edelstein.Common.Network.DotNetty/Handlers/NettyTransportConnectorHandler.cs index b30954382..221df50cb 100644 --- a/src/common/Edelstein.Common.Network.DotNetty/Handlers/NettyTransportConnectorHandler.cs +++ b/src/common/Edelstein.Common.Network.DotNetty/Handlers/NettyTransportConnectorHandler.cs @@ -1,5 +1,4 @@ -using System.Buffers; -using DotNetty.Transport.Channels; +using DotNetty.Transport.Channels; using Edelstein.Common.Utilities.Packets; using Edelstein.Protocol.Network; using Edelstein.Protocol.Network.Transports; diff --git a/src/common/Edelstein.Common.Utilities/Repositories/Repository.cs b/src/common/Edelstein.Common.Utilities/Repositories/Repository.cs index a67ce4064..01c794b14 100644 --- a/src/common/Edelstein.Common.Utilities/Repositories/Repository.cs +++ b/src/common/Edelstein.Common.Utilities/Repositories/Repository.cs @@ -1,5 +1,4 @@ using System.Collections.Concurrent; -using System.Collections.Frozen; using Edelstein.Protocol.Utilities.Repositories; namespace Edelstein.Common.Utilities.Repositories; diff --git a/src/common/Edelstein.Common.Utilities/Tickers/TickerManager.cs b/src/common/Edelstein.Common.Utilities/Tickers/TickerManager.cs index 14a5fb0c0..40d913186 100644 --- a/src/common/Edelstein.Common.Utilities/Tickers/TickerManager.cs +++ b/src/common/Edelstein.Common.Utilities/Tickers/TickerManager.cs @@ -1,5 +1,4 @@ -using System.Collections.Immutable; -using Edelstein.Protocol.Utilities.Tickers; +using Edelstein.Protocol.Utilities.Tickers; using Microsoft.Extensions.Logging; namespace Edelstein.Common.Utilities.Tickers; diff --git a/src/plugin/Edelstein.Plugin.Rue/Commands/AbstractTemplateCommand.cs b/src/plugin/Edelstein.Plugin.Rue/Commands/AbstractTemplateCommand.cs index dc452883e..ae062449b 100644 --- a/src/plugin/Edelstein.Plugin.Rue/Commands/AbstractTemplateCommand.cs +++ b/src/plugin/Edelstein.Plugin.Rue/Commands/AbstractTemplateCommand.cs @@ -1,4 +1,5 @@ -using System.Diagnostics; +using System.Collections.Immutable; +using System.Diagnostics; using Edelstein.Protocol.Gameplay.Game.Objects.User; using Edelstein.Protocol.Utilities.Templates; using Gma.DataStructures.StringSearch; @@ -72,7 +73,7 @@ protected override async Task Execute(IFieldUser user, TArgs args) var results = _trie .Retrieve(args.Search.ToLower()) .DistinctBy(d => d.ID) - .ToList(); + .ToImmutableArray(); var elapsed = stopwatch.Elapsed; if (args.Search.All(char.IsDigit) && !results.Any()) @@ -90,7 +91,7 @@ protected override async Task Execute(IFieldUser user, TArgs args) { var maxPerPage = 6; var minPage = 1; - var maxPage = (int)Math.Ceiling((double)results.Count / maxPerPage); + var maxPage = (int)Math.Ceiling((double)results.Length / maxPerPage); var currentPage = 1; while (true) @@ -98,7 +99,7 @@ protected override async Task Execute(IFieldUser user, TArgs args) var items = results .Skip(maxPerPage * (currentPage - 1)) .Take(maxPerPage) - .ToList(); + .ToImmutableArray(); var menu = items.ToDictionary( r => r.ID, r => $"{r.DisplayString} ({r.ID})" @@ -107,7 +108,7 @@ protected override async Task Execute(IFieldUser user, TArgs args) if (currentPage < maxPage) menu.Add(-10, "#rNext page#k"); if (currentPage > minPage) menu.Add(-20, "#rPrevious page#k"); - var selection = target.AskMenu($"Found {results.Count} results for '{args.Search}' in {elapsed.TotalMilliseconds:F2}ms (page {currentPage} of {maxPage})", menu); + var selection = target.AskMenu($"Found {results.Length} results for '{args.Search}' in {elapsed.TotalMilliseconds:F2}ms (page {currentPage} of {maxPage})", menu); if (selection == -10) { currentPage++; continue; } if (selection == -20) { currentPage--; continue; } diff --git a/src/plugin/Edelstein.Plugin.Rue/Commands/Admin/EquipCommand.cs b/src/plugin/Edelstein.Plugin.Rue/Commands/Admin/EquipCommand.cs index d0583b7a3..1f878ce63 100644 --- a/src/plugin/Edelstein.Plugin.Rue/Commands/Admin/EquipCommand.cs +++ b/src/plugin/Edelstein.Plugin.Rue/Commands/Admin/EquipCommand.cs @@ -1,4 +1,5 @@ -using Edelstein.Protocol.Gameplay.Game.Objects.User; +using System.Collections.Immutable; +using Edelstein.Protocol.Gameplay.Game.Objects.User; using Edelstein.Protocol.Gameplay.Models.Inventories; using Edelstein.Protocol.Gameplay.Models.Inventories.Items; @@ -11,11 +12,12 @@ public class EquipCommand : AbstractCommand public override async Task Execute(IFieldUser user, string[] args) { - var equipped = user.Character.Inventories[ItemInventoryType.Equip]?.Items.ToList() ?? new List>(); - if (equipped.Count == 0) return; + var equipped = user.Character.Inventories[ItemInventoryType.Equip]?.Items + .ToImmutableArray() ?? ImmutableArray>.Empty; + if (equipped.Length == 0) return; var slot = await user.Prompt(target => target.AskMenu("Which equipment would you like to modify?", equipped - .ToDictionary( + .ToImmutableDictionary( i => (int)i.Key, i => $"{i.Value.ID}" )), -1); diff --git a/src/plugin/Edelstein.Plugin.Rue/Commands/Admin/FieldCommand.cs b/src/plugin/Edelstein.Plugin.Rue/Commands/Admin/FieldCommand.cs index 601928120..037b0cf6d 100644 --- a/src/plugin/Edelstein.Plugin.Rue/Commands/Admin/FieldCommand.cs +++ b/src/plugin/Edelstein.Plugin.Rue/Commands/Admin/FieldCommand.cs @@ -29,7 +29,7 @@ ITemplateManager strings protected override async Task> Indices() { var result = new List(); - var strings = (await _strings.RetrieveAll()).ToList(); + var strings = await _strings.RetrieveAll(); result.AddRange(strings.Select(s => new TemplateCommandIndex(s.ID, s.ID.ToString(), $"{s.StreetName}: {s.MapName}"))); result.AddRange(strings.Select(s => new TemplateCommandIndex(s.ID, s.MapName, $"{s.StreetName}: {s.MapName}"))); diff --git a/src/plugin/Edelstein.Plugin.Rue/Commands/Admin/ItemCommand.cs b/src/plugin/Edelstein.Plugin.Rue/Commands/Admin/ItemCommand.cs index eb5c10555..72bed7e9a 100644 --- a/src/plugin/Edelstein.Plugin.Rue/Commands/Admin/ItemCommand.cs +++ b/src/plugin/Edelstein.Plugin.Rue/Commands/Admin/ItemCommand.cs @@ -24,7 +24,7 @@ ITemplateManager strings protected override async Task> Indices() { var result = new List(); - var strings = (await _strings.RetrieveAll()).ToList(); + var strings = await _strings.RetrieveAll(); result.AddRange(strings.Select(s => new TemplateCommandIndex(s.ID, s.ID.ToString(), s.Name))); result.AddRange(strings.Select(s => new TemplateCommandIndex(s.ID, s.Name, s.Name))); diff --git a/src/plugin/Edelstein.Plugin.Rue/Commands/Admin/MobCommand.cs b/src/plugin/Edelstein.Plugin.Rue/Commands/Admin/MobCommand.cs index d4e0f2be2..4b1792d2d 100644 --- a/src/plugin/Edelstein.Plugin.Rue/Commands/Admin/MobCommand.cs +++ b/src/plugin/Edelstein.Plugin.Rue/Commands/Admin/MobCommand.cs @@ -20,7 +20,7 @@ ITemplateManager strings protected override async Task> Indices() { var result = new List(); - var strings = (await _strings.RetrieveAll()).ToList(); + var strings = await _strings.RetrieveAll(); result.AddRange(strings.Select(s => new TemplateCommandIndex(s.ID, s.ID.ToString(), s.Name))); result.AddRange(strings.Select(s => new TemplateCommandIndex(s.ID, s.Name, s.Name))); diff --git a/src/plugin/Edelstein.Plugin.Rue/Commands/Admin/NPCCommand.cs b/src/plugin/Edelstein.Plugin.Rue/Commands/Admin/NPCCommand.cs index e30b0b325..d4940f088 100644 --- a/src/plugin/Edelstein.Plugin.Rue/Commands/Admin/NPCCommand.cs +++ b/src/plugin/Edelstein.Plugin.Rue/Commands/Admin/NPCCommand.cs @@ -20,7 +20,7 @@ ITemplateManager strings protected override async Task> Indices() { var result = new List(); - var strings = (await _strings.RetrieveAll()).ToList(); + var strings = await _strings.RetrieveAll(); result.AddRange(strings.Select(s => new TemplateCommandIndex(s.ID, s.ID.ToString(), s.Name))); result.AddRange(strings.Select(s => new TemplateCommandIndex(s.ID, s.Name, $"{s.Name}{(!string.IsNullOrWhiteSpace(s.Func) ? $": {s.Func}" : "")}"))); diff --git a/src/plugin/Edelstein.Plugin.Rue/Commands/Admin/QuestCommand.cs b/src/plugin/Edelstein.Plugin.Rue/Commands/Admin/QuestCommand.cs index a892dbd9e..ede09ebb3 100644 --- a/src/plugin/Edelstein.Plugin.Rue/Commands/Admin/QuestCommand.cs +++ b/src/plugin/Edelstein.Plugin.Rue/Commands/Admin/QuestCommand.cs @@ -21,7 +21,7 @@ ITemplateManager templates protected override async Task> Indices() { var result = new List(); - var strings = (await _strings.RetrieveAll()).ToList(); + var strings = await _strings.RetrieveAll(); result.AddRange(strings.Select(s => new TemplateCommandIndex(s.ID, s.ID.ToString(), s.Name))); result.AddRange(strings.Select(s => new TemplateCommandIndex(s.ID, s.Name, s.Name))); diff --git a/src/plugin/Edelstein.Plugin.Rue/Commands/Admin/SkillCommand.cs b/src/plugin/Edelstein.Plugin.Rue/Commands/Admin/SkillCommand.cs index 5a9186ac0..c441f89a0 100644 --- a/src/plugin/Edelstein.Plugin.Rue/Commands/Admin/SkillCommand.cs +++ b/src/plugin/Edelstein.Plugin.Rue/Commands/Admin/SkillCommand.cs @@ -26,7 +26,7 @@ ITemplateManager strings protected override async Task> Indices() { var result = new List(); - var strings = (await _strings.RetrieveAll()).ToList(); + var strings = await _strings.RetrieveAll(); result.AddRange(strings.Select(s => new TemplateCommandIndex(s.ID, s.ID.ToString(), s.Name))); result.AddRange(strings.Select(s => new TemplateCommandIndex(s.ID, s.Name, s.Name)));