From 4479555156ebc69795be681644c74151f05d26a8 Mon Sep 17 00:00:00 2001
From: Kamron Batman <3953314+kamronbatman@users.noreply.github.com>
Date: Sat, 10 Feb 2024 20:31:25 -0800
Subject: [PATCH] fix: Fixes missing methods. Adds more admin gump world
building (#1675)
### Summary
- Fixe commands missing in helpinfo.
- Adds more admin gump world building options.
### Screenshots
---
.../Server/Network/NetState/DumpNetStates.cs | 2 +-
Projects/UOContent/Commands/ExportWSC.cs | 22 +-
Projects/UOContent/Commands/GenCommands.cs | 2 +-
Projects/UOContent/Commands/HelpInfo.cs | 51 ++---
.../Commands/Object Creation/DecorateMag.cs | 2 +-
.../UOContent/Engines/ConPVP/DuelContext.cs | 3 +
.../UOContent/Engines/Doom/GenGauntlet.cs | 4 +
.../Doom/LeverPuzzle/LeverPuzzleController.cs | 5 +-
.../Engines/Factions/Core/Faction.cs | 8 +
.../Engines/Factions/Core/Generator.cs | 3 +
.../UOContent/Engines/Factions/Core/Town.cs | 2 +
.../UOContent/Engines/Khaldun/KhaldunGen.cs | 2 +
Projects/UOContent/Engines/Party/Party.cs | 2 +
.../UOContent/Engines/Pathing/MovementPath.cs | 2 +
.../Commands/ConvertPremiumSpawners.cs | 2 +
.../Commands/GenerateSpawnersCommand.cs | 18 +-
.../Engines/Spawners/SpawnerControllerGump.cs | 5 +-
Projects/UOContent/Gumps/AdminGump.cs | 82 +++++---
.../UOContent/Items/Addons/SHTeleporter.cs | 192 ++++++++----------
Projects/UOContent/Items/Misc/WayPoint.cs | 2 +
Projects/UOContent/Misc/AutoRestart.cs | 2 +
docs/commands/commands.7z | Bin 11821 -> 12416 bytes
22 files changed, 212 insertions(+), 201 deletions(-)
diff --git a/Projects/Server/Network/NetState/DumpNetStates.cs b/Projects/Server/Network/NetState/DumpNetStates.cs
index 24b98b9eb..be3c2bdea 100644
--- a/Projects/Server/Network/NetState/DumpNetStates.cs
+++ b/Projects/Server/Network/NetState/DumpNetStates.cs
@@ -21,7 +21,7 @@ public static class DumpNetStates
{
public static void Configure()
{
- CommandSystem.Register("DumpNetStates", AccessLevel.Administrator, DumpNetStatesCommand);
+ CommandSystem.Register("DumpNetStates", AccessLevel.Developer, DumpNetStatesCommand);
}
public static void DumpNetStatesCommand(CommandEventArgs args)
diff --git a/Projects/UOContent/Commands/ExportWSC.cs b/Projects/UOContent/Commands/ExportWSC.cs
index 5b870cf92..3d08afc18 100644
--- a/Projects/UOContent/Commands/ExportWSC.cs
+++ b/Projects/UOContent/Commands/ExportWSC.cs
@@ -6,20 +6,30 @@ namespace Server.Commands
{
public static class ExportCommand
{
- private const string ExportFile = @"C:\Uo\WorldForge\items.wsc";
-
public static void Configure()
{
- CommandSystem.Register("ExportWSC", AccessLevel.Administrator, Export_OnCommand);
+ CommandSystem.Register("ExportWSC", AccessLevel.Developer, Export_OnCommand);
}
+ [Usage("ExportWSC ")]
+ [Description("Exports all static items to a WSC file. This will delete all static items in the world. Please make a backup.")]
public static void Export_OnCommand(CommandEventArgs e)
{
- var w = new StreamWriter(ExportFile);
+ if (e.Arguments.Length < 1)
+ {
+ e.Mobile.SendMessage("Usage: [ExportWSC ]");
+ return;
+ }
+
+ var exportFilePath = e.GetString(0);
+ var fi = new FileInfo(exportFilePath);
+ fi.Directory.EnsureDirectory();
+
+ var w = new StreamWriter(exportFilePath);
var remove = new List- ();
var count = 0;
- e.Mobile.SendMessage($"Exporting all static items to \"{ExportFile}\"...");
+ e.Mobile.SendMessage($"Exporting all static items to \"{exportFilePath}\"...");
e.Mobile.SendMessage("This will delete all static items in the world. Please make a backup.");
foreach (var item in World.Items.Values)
@@ -60,7 +70,7 @@ namespace Server.Commands
item.Delete();
}
- e.Mobile.SendMessage($"Export complete. Exported {count} statics.");
+ e.Mobile.SendMessage($"Export complete. Exported {count} statics.");
}
}
}
diff --git a/Projects/UOContent/Commands/GenCommands.cs b/Projects/UOContent/Commands/GenCommands.cs
index 5268e6322..22fab6953 100644
--- a/Projects/UOContent/Commands/GenCommands.cs
+++ b/Projects/UOContent/Commands/GenCommands.cs
@@ -15,7 +15,7 @@ public static class GenCommands
CommandSystem.Register("GenCommands", AccessLevel.Developer, GenCommandsWebpage_OnCommand);
}
- [Usage("GenCommands []")]
+ [Usage("GenCommands")]
[Aliases("GenCmdWeb")]
[Description("Generates a webpage to the web folder with a list of all commands.")]
private static void GenCommandsWebpage_OnCommand(CommandEventArgs e)
diff --git a/Projects/UOContent/Commands/HelpInfo.cs b/Projects/UOContent/Commands/HelpInfo.cs
index 2f49d79eb..f3768e9df 100644
--- a/Projects/UOContent/Commands/HelpInfo.cs
+++ b/Projects/UOContent/Commands/HelpInfo.cs
@@ -1,4 +1,5 @@
using System.Collections.Generic;
+using System.Reflection;
using Server.Commands.Generic;
using Server.Gumps;
using Server.Network;
@@ -87,36 +88,23 @@ public static class HelpInfo
var mi = e.Handler.Method;
- var attrs = mi.GetCustomAttributes(typeof(UsageAttribute), false);
+ var usageAttr = mi.GetCustomAttribute(typeof(UsageAttribute), false) as UsageAttribute;
+ var usage = usageAttr?.Usage;
- if (attrs.Length == 0)
- {
- continue;
- }
-
- var usage = attrs[0] as UsageAttribute;
-
- attrs = mi.GetCustomAttributes(typeof(DescriptionAttribute), false);
-
- if (attrs.Length == 0)
- {
- continue;
- }
-
- if (usage == null || attrs[0] is not DescriptionAttribute desc)
- {
- continue;
- }
-
- attrs = mi.GetCustomAttributes(typeof(AliasesAttribute), false);
-
- var aliases = attrs.Length == 0 ? null : attrs[0] as AliasesAttribute;
-
- var descString = desc.Description
+ var descAttr = mi.GetCustomAttribute(typeof(DescriptionAttribute), false) as DescriptionAttribute;
+ var desc = descAttr?.Description
.ReplaceOrdinal("<", "(")
.ReplaceOrdinal(">", ")");
- list.Add(new CommandInfo(e.AccessLevel, e.Command, aliases?.Aliases, usage.Usage, null, descString));
+ if (e.Handler.Target == null && usage == null && desc == null)
+ {
+ continue;
+ }
+
+ var aliasesAttr = mi.GetCustomAttribute(typeof(AliasesAttribute), false) as AliasesAttribute;
+ var aliases = aliasesAttr?.Aliases;
+
+ list.Add(new CommandInfo(e.AccessLevel, e.Command, aliases, usage, null, desc));
}
for (var i = 0; i < TargetCommands.AllCommands.Count; ++i)
@@ -165,16 +153,11 @@ public static class HelpInfo
{
var command = commandImpls[i];
- var usage = command.Usage;
- var desc = command.Description;
-
- if (usage == null || desc == null)
- {
- continue;
- }
-
var cmds = command.Accessors;
var cmd = cmds[0];
+
+ var desc = command.Description ?? "No description available.";
+ var usage = command.Usage ?? cmd;
var aliases = new string[cmds.Length - 1];
for (var j = 0; j < aliases.Length; ++j)
diff --git a/Projects/UOContent/Commands/Object Creation/DecorateMag.cs b/Projects/UOContent/Commands/Object Creation/DecorateMag.cs
index 66c66ddc6..8a19d146a 100644
--- a/Projects/UOContent/Commands/Object Creation/DecorateMag.cs
+++ b/Projects/UOContent/Commands/Object Creation/DecorateMag.cs
@@ -24,7 +24,7 @@ namespace Server.Commands
}
[Usage("DecorateMag")]
- [Description("Generates world decoration.")]
+ [Description("Generates world decoration for Magincia after it was ruined.")]
private static void DecorateMag_OnCommand(CommandEventArgs e)
{
m_Mobile = e.Mobile;
diff --git a/Projects/UOContent/Engines/ConPVP/DuelContext.cs b/Projects/UOContent/Engines/ConPVP/DuelContext.cs
index 2b9402313..025178f2c 100644
--- a/Projects/UOContent/Engines/ConPVP/DuelContext.cs
+++ b/Projects/UOContent/Engines/ConPVP/DuelContext.cs
@@ -1239,6 +1239,9 @@ namespace Server.Engines.ConPVP
CommandSystem.Register("vli", AccessLevel.GameMaster, vli_oc);
}
+ [Usage("vli")]
+ [Aliases("ViewLadderInfo")]
+ [Description("View ladder information.")]
private static void vli_oc(CommandEventArgs e)
{
e.Mobile.BeginTarget(-1, false, TargetFlags.None, vli_ot);
diff --git a/Projects/UOContent/Engines/Doom/GenGauntlet.cs b/Projects/UOContent/Engines/Doom/GenGauntlet.cs
index ea37ee5f8..c770afa85 100644
--- a/Projects/UOContent/Engines/Doom/GenGauntlet.cs
+++ b/Projects/UOContent/Engines/Doom/GenGauntlet.cs
@@ -12,6 +12,8 @@ namespace Server.Engines.Doom
CommandSystem.Register("RemGauntlet", AccessLevel.Developer, RemoveGauntlet);
}
+ [Usage("RemGauntlet")]
+ [Description("Removes the Gauntlet from Dungeon Doom.")]
public static void RemoveGauntlet(CommandEventArgs e)
{
RemoveMobile(387, 400);
@@ -45,6 +47,8 @@ namespace Server.Engines.Doom
RemoveItem(433, 326, 4);
}
+ [Usage("GenGauntlet")]
+ [Description("Generates the Gauntlet in Dungeon Doom.")]
public static void GenGauntlet_OnCommand(CommandEventArgs e)
{
RemoveGauntlet(e);
diff --git a/Projects/UOContent/Engines/Doom/LeverPuzzle/LeverPuzzleController.cs b/Projects/UOContent/Engines/Doom/LeverPuzzle/LeverPuzzleController.cs
index 7e97095b3..8af67df58 100644
--- a/Projects/UOContent/Engines/Doom/LeverPuzzle/LeverPuzzleController.cs
+++ b/Projects/UOContent/Engines/Doom/LeverPuzzle/LeverPuzzleController.cs
@@ -192,10 +192,11 @@ public partial class LeverPuzzleController : Item
public static void Configure()
{
- CommandSystem.Register("GenLeverPuzzle", AccessLevel.Administrator, GenLampPuzzle_OnCommand);
+ CommandSystem.Register("GenLeverPuzzle", AccessLevel.Developer, GenLampPuzzle_OnCommand);
}
- [Usage("GenLeverPuzzle"), Description("Generates lamp room and lever puzzle in doom.")]
+ [Usage("GenLeverPuzzle")]
+ [Description("Generates lamp room and lever puzzle in doom.")]
public static void GenLampPuzzle_OnCommand(CommandEventArgs e)
{
foreach (var item in Map.Malas.GetItemsAt(lp_Center))
diff --git a/Projects/UOContent/Engines/Factions/Core/Faction.cs b/Projects/UOContent/Engines/Factions/Core/Faction.cs
index 15f7a79f4..c0bb0b049 100644
--- a/Projects/UOContent/Engines/Factions/Core/Faction.cs
+++ b/Projects/UOContent/Engines/Factions/Core/Faction.cs
@@ -657,6 +657,8 @@ namespace Server.Factions
Timer.DelayCall(TimeSpan.FromSeconds(30.0), TimeSpan.FromSeconds(30.0), ProcessTick);
}
+ [Usage("FactionTownReset")]
+ [Description("Resets all faction town data in the world.")]
public static void FactionTownReset_OnCommand(CommandEventArgs e)
{
var monoliths = BaseMonolith.Monoliths;
@@ -715,6 +717,8 @@ namespace Server.Factions
}
}
+ [Usage("FactionReset")]
+ [Description("Resets all faction data in the world.")]
public static void FactionReset_OnCommand(CommandEventArgs e)
{
var monoliths = BaseMonolith.Monoliths;
@@ -787,6 +791,8 @@ namespace Server.Factions
}
}
+ [Usage("FactionItemReset")]
+ [Description("Resets all faction items in the world.")]
public static void FactionItemReset_OnCommand(CommandEventArgs e)
{
var items = new List
- ();
@@ -869,6 +875,8 @@ namespace Server.Factions
}
}
+ [Usage("FactionElection")]
+ [Description("Opens the election properties for the targeted faction stone.")]
public static void FactionElection_OnCommand(CommandEventArgs e)
{
e.Mobile.SendMessage("Target a faction stone to open its election properties.");
diff --git a/Projects/UOContent/Engines/Factions/Core/Generator.cs b/Projects/UOContent/Engines/Factions/Core/Generator.cs
index 6cd6fbe0f..97f3a0e40 100644
--- a/Projects/UOContent/Engines/Factions/Core/Generator.cs
+++ b/Projects/UOContent/Engines/Factions/Core/Generator.cs
@@ -9,6 +9,9 @@ namespace Server.Factions
CommandSystem.Register("GenerateFactions", AccessLevel.Developer, GenerateFactions_OnCommand);
}
+ [Usage("GenerateFactions")]
+ [Aliases("FactionGen", "GenFactions")]
+ [Description("Enables and generates factions.")]
public static void GenerateFactions_OnCommand(CommandEventArgs e)
{
var from = e.Mobile;
diff --git a/Projects/UOContent/Engines/Factions/Core/Town.cs b/Projects/UOContent/Engines/Factions/Core/Town.cs
index 2a13fa11f..480b60f16 100644
--- a/Projects/UOContent/Engines/Factions/Core/Town.cs
+++ b/Projects/UOContent/Engines/Factions/Core/Town.cs
@@ -544,6 +544,8 @@ namespace Server.Factions
return null;
}
+ [Usage("GrantTownSilver ")]
+ [Description("Grants silver to the town of the current region.")]
public static void GrantTownSilver_OnCommand(CommandEventArgs e)
{
var town = FromRegion(e.Mobile.Region);
diff --git a/Projects/UOContent/Engines/Khaldun/KhaldunGen.cs b/Projects/UOContent/Engines/Khaldun/KhaldunGen.cs
index 3057a9c43..5ee4316a7 100644
--- a/Projects/UOContent/Engines/Khaldun/KhaldunGen.cs
+++ b/Projects/UOContent/Engines/Khaldun/KhaldunGen.cs
@@ -113,6 +113,8 @@ namespace Server.Commands
m_Count++;
}
+ [Usage("GenKhaldun")]
+ [Description("Generates Khaldun Puzzles")]
public static void GenKhaldun_OnCommand(CommandEventArgs e)
{
m_Count = 0;
diff --git a/Projects/UOContent/Engines/Party/Party.cs b/Projects/UOContent/Engines/Party/Party.cs
index 03c28b130..4b86149c8 100644
--- a/Projects/UOContent/Engines/Party/Party.cs
+++ b/Projects/UOContent/Engines/Party/Party.cs
@@ -105,6 +105,8 @@ namespace Server.Engines.PartySystem
CommandSystem.Register("ListenToParty", AccessLevel.GameMaster, ListenToParty_OnCommand);
}
+ [Usage("ListenToParty")]
+ [Description("Listen to the targeted player's party chat.")]
public static void ListenToParty_OnCommand(CommandEventArgs e)
{
e.Mobile.BeginTarget(-1, false, TargetFlags.None, ListenToParty_OnTarget);
diff --git a/Projects/UOContent/Engines/Pathing/MovementPath.cs b/Projects/UOContent/Engines/Pathing/MovementPath.cs
index 1652dd053..2ae2e714b 100644
--- a/Projects/UOContent/Engines/Pathing/MovementPath.cs
+++ b/Projects/UOContent/Engines/Pathing/MovementPath.cs
@@ -61,6 +61,8 @@ namespace Server
CommandSystem.Register("Path", AccessLevel.GameMaster, Path_OnCommand);
}
+ [Usage("Path")]
+ [Description("Draws a path from your current location to a targeted location.")]
public static void Path_OnCommand(CommandEventArgs e)
{
e.Mobile.BeginTarget(-1, true, TargetFlags.None, Path_OnTarget);
diff --git a/Projects/UOContent/Engines/Spawners/Commands/ConvertPremiumSpawners.cs b/Projects/UOContent/Engines/Spawners/Commands/ConvertPremiumSpawners.cs
index 57238a1b3..9afa835a3 100644
--- a/Projects/UOContent/Engines/Spawners/Commands/ConvertPremiumSpawners.cs
+++ b/Projects/UOContent/Engines/Spawners/Commands/ConvertPremiumSpawners.cs
@@ -34,6 +34,8 @@ namespace Server.Engines.Spawners
CommandSystem.Register("ConvertPremiumSpawners", AccessLevel.Developer, ConvertPremiumSpawners_OnCommand);
}
+ [Usage("ConvertPremiumSpawners