fix: Adds command help, webpage, and fixes issues with other commands (#1669)

### Summary

- Fixes `[AdvancedSearch` being accessible by players 😱 
- Adds `[GenCommands` to generate the same commands html page on https://muo.gg/commands.
- Fixes `[helpinfo` so all commands properly show up!

> [!WARNING]  
> ### Developer Warning:
> Commands must now be registered in the `Configure` bootup phase.
> If a command is not registered early enough, it may not be available to systems like [helpinfo
> that cache their information.

> [!NOTE]  
> ### Developer Note:
> Various commands related to generating content have been changed to _Developer_ and above access level.

### Screenshots
<img width="673" alt="image" src="https://github.com/modernuo/ModernUO/assets/3953314/b105b5c9-5eb4-4ace-93ff-1bfb31e7132f">

<img width="547" alt="image" src="https://github.com/modernuo/ModernUO/assets/3953314/e97487e8-47a5-4aa7-89cc-9fe3deda584d">
This commit is contained in:
Kamron Batman 2024-02-10 00:19:19 -08:00 • committed by GitHub
parent 3244704ea2
commit fffda53263
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
88 changed files with 1163 additions and 557 deletions

View file

@ -2,16 +2,14 @@ namespace Server.Engines.AdvancedSearch;
public static class AdvancedSearchCommand
{
public static void Initialize()
public static void Configure()
{
CommandSystem.Register("XmlFind", AccessLevel.Player, OnCommand); // For those old school peeps!
CommandSystem.Register("AdvancedSearch", AccessLevel.Player, OnCommand);
CommandSystem.Register("AdvSrch", AccessLevel.Player, OnCommand);
CommandSystem.Register("AS", AccessLevel.Player, OnCommand);
CommandSystem.Register("AdvancedSearch", AccessLevel.Administrator, OnCommand); // For those old school peeps!
}
[Usage("AdvancedSearch")]
[Description("Opens the advanced search gump.")]
[Aliases("AdvSrch", "AS", "XmlFind")]
private static void OnCommand(CommandEventArgs e)
{
var from = e.Mobile;

View file

@ -19,7 +19,7 @@ namespace Server.Engines.CannedEvil
{
public static class ChampionCommands
{
public static void Initialize()
public static void Configure()
{
CommandSystem.Register("ClearChampByTarget", AccessLevel.Administrator, KillByTarget_OnCommand);
CommandSystem.Register("ClearChampByRegion", AccessLevel.Administrator, KillByRegion_OnCommand);

View file

@ -23,9 +23,9 @@ namespace Server.Engines.CannedEvil
{
private static readonly ILogger logger = LogFactory.GetLogger(typeof(ChampionGenerator));
public static void Initialize()
public static void Configure()
{
CommandSystem.Register("GenChamps", AccessLevel.Owner, ChampGen_OnCommand);
CommandSystem.Register("GenChamps", AccessLevel.Developer, ChampGen_OnCommand);
}
private static readonly ChampionEntry[] LLLocations = {

View file

@ -1231,7 +1231,7 @@ namespace Server.Engines.ConPVP
Timer.StartTimer(TimeSpan.FromSeconds(10.0), Unregister);
}
public static void Initialize()
public static void Configure()
{
EventSink.Speech += EventSink_Speech;
EventSink.Login += EventSink_Login;

View file

@ -35,7 +35,7 @@ public class Recipe
public TextDefinition TextDefinition => _td ??= TextDefinition.Of(CraftItem.NameNumber, CraftItem.NameString);
public static void Initialize()
public static void Configure()
{
CommandSystem.Register("LearnAllRecipes", AccessLevel.GameMaster, LearnAllRecipes_OnCommand);
CommandSystem.Register("ForgetAllRecipes", AccessLevel.GameMaster, ForgetAllRecipes_OnCommand);

View file

@ -6,10 +6,10 @@ namespace Server.Engines.Doom
{
public static class GenGauntlet
{
public static void Initialize()
public static void Configure()
{
CommandSystem.Register("GenGauntlet", AccessLevel.Administrator, GenGauntlet_OnCommand);
CommandSystem.Register("RemGauntlet", AccessLevel.Administrator, RemoveGauntlet);
CommandSystem.Register("GenGauntlet", AccessLevel.Developer, GenGauntlet_OnCommand);
CommandSystem.Register("RemGauntlet", AccessLevel.Developer, RemoveGauntlet);
}
public static void RemoveGauntlet(CommandEventArgs e)

View file

@ -190,7 +190,7 @@ public partial class LeverPuzzleController : Item
}
}
public static void Initialize()
public static void Configure()
{
CommandSystem.Register("GenLeverPuzzle", AccessLevel.Administrator, GenLampPuzzle_OnCommand);
}

View file

@ -639,14 +639,11 @@ namespace Server.Factions
return true;
}
public static void Initialize()
public static void Configure()
{
EventSink.Login += EventSink_Login;
EventSink.Logout += EventSink_Logout;
Timer.DelayCall(TimeSpan.FromMinutes(1.0), TimeSpan.FromMinutes(10.0), HandleAtrophy);
Timer.DelayCall(TimeSpan.FromSeconds(30.0), TimeSpan.FromSeconds(30.0), ProcessTick);
CommandSystem.Register("FactionElection", AccessLevel.GameMaster, FactionElection_OnCommand);
CommandSystem.Register("FactionCommander", AccessLevel.Administrator, FactionCommander_OnCommand);
CommandSystem.Register("FactionItemReset", AccessLevel.Administrator, FactionItemReset_OnCommand);
@ -654,6 +651,12 @@ namespace Server.Factions
CommandSystem.Register("FactionTownReset", AccessLevel.Administrator, FactionTownReset_OnCommand);
}
public static void Initialize()
{
Timer.DelayCall(TimeSpan.FromMinutes(1.0), TimeSpan.FromMinutes(10.0), HandleAtrophy);
Timer.DelayCall(TimeSpan.FromSeconds(30.0), TimeSpan.FromSeconds(30.0), ProcessTick);
}
public static void FactionTownReset_OnCommand(CommandEventArgs e)
{
var monoliths = BaseMonolith.Monoliths;

View file

@ -4,9 +4,9 @@ namespace Server.Factions
{
public static class Generator
{
public static void Initialize()
public static void Configure()
{
CommandSystem.Register("GenerateFactions", AccessLevel.Administrator, GenerateFactions_OnCommand);
CommandSystem.Register("GenerateFactions", AccessLevel.Developer, GenerateFactions_OnCommand);
}
public static void GenerateFactions_OnCommand(CommandEventArgs e)

View file

@ -420,6 +420,11 @@ namespace Server.Factions
return true;
}
public static void Configure()
{
CommandSystem.Register("GrantTownSilver", AccessLevel.Administrator, GrantTownSilver_OnCommand);
}
public static void Initialize()
{
var towns = Towns;
@ -429,8 +434,6 @@ namespace Server.Factions
towns[i].Sheriff = towns[i].Sheriff;
towns[i].Finance = towns[i].Finance;
}
CommandSystem.Register("GrantTownSilver", AccessLevel.Administrator, GrantTownSilver_OnCommand);
}
public bool IsSheriff(Mobile mob) =>

View file

@ -121,7 +121,7 @@ namespace Server.Engines.Help
public static List<PageEntry> List { get; } = new();
public static void Initialize()
public static void Configure()
{
CommandSystem.Register("Pages", AccessLevel.Counselor, Pages_OnCommand);
}

View file

@ -29,7 +29,7 @@ namespace Server.Engines.Help
IEnumerator IEnumerable.GetEnumerator() => m_Queue.GetEnumerator();
public static void Initialize()
public static void Configure()
{
CommandSystem.Register("SpeechLog", AccessLevel.Counselor, SpeechLog_OnCommand);
}

View file

@ -7,9 +7,9 @@ namespace Server.Commands
{
private static int m_Count;
public static void Initialize()
public static void Configure()
{
CommandSystem.Register("GenKhaldun", AccessLevel.Administrator, GenKhaldun_OnCommand);
CommandSystem.Register("GenKhaldun", AccessLevel.Developer, GenKhaldun_OnCommand);
}
public static bool FindMorphItem(int x, int y, int z, int inactiveItemID, int activeItemID)

View file

@ -144,6 +144,16 @@ namespace Server.Engines.MLQuests
public static void Configure()
{
Enabled = ServerConfiguration.GetOrUpdateSetting("questSystem.enableMLQuests", Core.ML);
CommandSystem.Register("MLQuestsInfo", AccessLevel.Administrator, MLQuestsInfo_OnCommand);
CommandSystem.Register("SaveQuest", AccessLevel.Administrator, SaveQuest_OnCommand);
CommandSystem.Register("SaveAllQuests", AccessLevel.Administrator, SaveAllQuests_OnCommand);
CommandSystem.Register("InvalidQuestItems", AccessLevel.Administrator, InvalidQuestItems_OnCommand);
TargetCommands.Register(new ViewQuestsCommand());
TargetCommands.Register(new ViewContextCommand());
EventSink.QuestGumpRequest += EventSink_QuestGumpRequest;
}
public static void Initialize()
@ -165,16 +175,6 @@ namespace Server.Engines.MLQuests
}
MLQuestPersistence.EnsureExistence();
CommandSystem.Register("MLQuestsInfo", AccessLevel.Administrator, MLQuestsInfo_OnCommand);
CommandSystem.Register("SaveQuest", AccessLevel.Administrator, SaveQuest_OnCommand);
CommandSystem.Register("SaveAllQuests", AccessLevel.Administrator, SaveAllQuests_OnCommand);
CommandSystem.Register("InvalidQuestItems", AccessLevel.Administrator, InvalidQuestItems_OnCommand);
TargetCommands.Register(new ViewQuestsCommand());
TargetCommands.Register(new ViewContextCommand());
EventSink.QuestGumpRequest += EventSink_QuestGumpRequest;
}
[Usage("MLQuestsInfo"),

View file

@ -96,7 +96,7 @@ namespace Server.Engines.PartySystem
}
}
public static void Initialize()
public static void Configure()
{
EventSink.Logout += EventSink_Logout;
EventSink.Login += EventSink_Login;

View file

@ -56,7 +56,7 @@ namespace Server
public static PathAlgorithm OverrideAlgorithm { get; set; }
public static void Initialize()
public static void Configure()
{
CommandSystem.Register("Path", AccessLevel.GameMaster, Path_OnCommand);
}

View file

@ -8,8 +8,6 @@ using Server.Items;
using Server.Json;
using Server.Mobiles;
using Server.Utilities;
using CPA = Server.CommandPropertyAttribute;
using static Server.Attributes;
namespace Server.Engines.Spawners;

View file

@ -29,7 +29,7 @@ namespace Server.Engines.Spawners
{
private static readonly ILogger logger = LogFactory.GetLogger(typeof(ConvertPremiumSpawners));
public static void Initialize()
public static void Configure()
{
CommandSystem.Register("ConvertPremiumSpawners", AccessLevel.Developer, ConvertPremiumSpawners_OnCommand);
}

View file

@ -23,7 +23,7 @@ namespace Server.Engines.Spawners
public class EditSpawnCommand : BaseCommand
{
public static void Initialize()
public static void Configure()
{
TargetCommands.Register(new EditSpawnCommand());
}

View file

@ -24,7 +24,7 @@ namespace Server.Engines.Spawners;
public class ExportSpawnersCommand : BaseCommand
{
public static void Initialize()
public static void Configure()
{
TargetCommands.Register(new ExportSpawnersCommand());
}

View file

@ -32,7 +32,7 @@ namespace Server.Engines.Spawners
{
private static readonly ILogger logger = LogFactory.GetLogger(typeof(GenerateSpawnersCommand));
public static void Initialize()
public static void Configure()
{
CommandSystem.Register("GenerateSpawners", AccessLevel.Developer, GenerateSpawners_OnCommand);
}

View file

@ -21,7 +21,7 @@ namespace Server.Engines.Spawners
{
public class RespawnCommand : BaseCommand
{
public static void Initialize()
public static void Configure()
{
TargetCommands.Register(new RespawnCommand());
}

View file

@ -24,7 +24,7 @@ namespace Server.Engines.Spawners
{
public class SpawnPropsCommand : BaseCommand
{
public static void Initialize()
public static void Configure()
{
TargetCommands.Register(new SpawnPropsCommand());
}

View file

@ -19,7 +19,6 @@ using Server.Engines.Spawners;
using Server.Mobiles;
using Server.Network;
using Server.Text;
using CPA = Server.CommandPropertyAttribute;
namespace Server.Gumps
{

View file

@ -32,7 +32,7 @@ public class SpawnerControllerGump : GumpGrid
public static int GetButtonID(int type, int index) => 1 + type + index * TypeCount;
public static void Initialize()
public static void Configure()
{
CommandSystem.Register("Spawn", AccessLevel.GameMaster, OpenSpawnGump_OnCommand);
}

View file

@ -21,6 +21,9 @@ public class StealableArtifacts : GenericPersistence
public static void Configure()
{
_stealableArtifactsPersistence = new StealableArtifacts();
CommandSystem.Register("GenStealArties", AccessLevel.Developer, GenStealArties_OnCommand);
CommandSystem.Register("RemoveStealArties", AccessLevel.Developer, RemoveStealArties_OnCommand);
}
public StealableArtifacts() : base("StealableArtifacts", 10)
@ -192,12 +195,6 @@ public class StealableArtifacts : GenericPersistence
private static int GetLampPostHue() =>
Utility.RandomDouble() < 0.9 ? 0 : Utility.RandomList(0x455, 0x47E, 0x482, 0x486, 0x48F, 0x4F2, 0x58C, 0x66C);
public static void Initialize()
{
CommandSystem.Register("GenStealArties", AccessLevel.Administrator, GenStealArties_OnCommand);
CommandSystem.Register("RemoveStealArties", AccessLevel.Administrator, RemoveStealArties_OnCommand);
}
[Usage("GenStealArties"), Description("Generates the stealable artifacts spawner.")]
private static void GenStealArties_OnCommand(CommandEventArgs args)
{