ModernUO/Projects/UOContent/Commands/ResetStaffDress.cs
Kamron Batman fffda53263
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">
2024-02-10 00:19:19 -08:00

70 lines
1.8 KiB
C#

using Server.Items;
using Server.Mobiles;
using Server.Network;
namespace Server.Commands;
public static class StaffDress
{
public static void Configure()
{
CommandSystem.Register("ResetStaffDress", AccessLevel.Counselor, StaffDress_OnCommand);
}
[Usage("ResetStaffDress")]
[Description("Resets staff to proper GM")]
public static void StaffDress_OnCommand(CommandEventArgs e)
{
if (e.Mobile is not PlayerMobile pm)
{
return;
}
pm.Race = Race.Human;
pm.Karma = pm.Fame = pm.Kills = pm.ShortTermMurders = pm.BodyMod = 0;
pm.Body = 987;
pm.SolidHueOverride = pm.HueMod = -1;
pm.FacialHairItemID = 0;
pm.Blessed = true;
pm.DisplayGuildTitle = false;
pm.DisplayChampionTitle = false;
if (pm.Mount != null)
{
pm.Mount.Rider = null;
}
pm.NetState.SendSpeedControl(SpeedControlSetting.Mount);
pm.ResetStaffAccess();
if (pm.AccessLevel < AccessLevel.Administrator)
{
pm.Hue = Race.Human.ClipSkinHue((pm.Hue + 1) & 0x3FFF);
}
for (var i = pm.Items.Count - 1; i >= 0; i--)
{
var item = pm.Items[i];
if (item.Layer is Layer.FacialHair)
{
item.Delete();
}
if (item.Layer is not Layer.Backpack
and not Layer.Bank
and not Layer.Hair
and not Layer.Mount
and not Layer.ShopBuy
and not Layer.ShopResale
and not Layer.ShopSell)
{
pm.AddToBackpack(item);
}
}
if (pm.AccessLevel > AccessLevel.Player)
{
pm.AddItem(new StaffRobe(pm.AccessLevel));
}
}
}