fix: Fixes codegenned spawners and adds RunUO spawner import support (#1682)

> [!IMPORTANT]  
> This code change includes important fixes for all spawners after they were converted to codegen!

> [!NOTE] 
> **Developer Note**
> Usage/Description/Aliases attributes were moved to the core so they can be used by the command registration system.

### Summary
- **Fixes spawners not registering their spawns on world load**
- Changes `[GenerateSpawners` to `[ImportSpawners`
- Removes `ConvertPremiumSpawners`
- Adds Premium spawner import support to `[ImportSpawners`
- Adds RunUO XML import support: https://github.com/ruaduck/xmlspawner/blob/ServUOMaster/XmlSpawner/XmlSpawner%20Core/SpawnerExporter.cs
- Fixed an issue where not manually registering an alias meant it wasn't available as a command
This commit is contained in:
Kamron Batman 2024-02-17 10:46:55 -08:00 • committed by GitHub
parent cc064a27a5
commit d0d7be8de0
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
12 changed files with 568 additions and 522 deletions

View file

@ -1,28 +0,0 @@
using System;
namespace Server
{
[AttributeUsage(AttributeTargets.Method)]
public class UsageAttribute : Attribute
{
public UsageAttribute(string usage) => Usage = usage;
public string Usage { get; }
}
[AttributeUsage(AttributeTargets.Method)]
public class DescriptionAttribute : Attribute
{
public DescriptionAttribute(string description) => Description = description;
public string Description { get; }
}
[AttributeUsage(AttributeTargets.Method)]
public class AliasesAttribute : Attribute
{
public AliasesAttribute(params string[] aliases) => Aliases = aliases;
public string[] Aliases { get; }
}
}

View file

@ -33,7 +33,6 @@ namespace Server.Commands
Register("Where", AccessLevel.Counselor, Where_OnCommand);
Register("AutoPageNotify", AccessLevel.Counselor, APN_OnCommand);
Register("APN", AccessLevel.Counselor, APN_OnCommand);
Register("Animate", AccessLevel.GameMaster, Animate_OnCommand);
@ -47,12 +46,8 @@ namespace Server.Commands
Register("Client", AccessLevel.Counselor, Client_OnCommand);
Register("SMsg", AccessLevel.Counselor, StaffMessage_OnCommand);
Register("SM", AccessLevel.Counselor, StaffMessage_OnCommand);
Register("S", AccessLevel.Counselor, StaffMessage_OnCommand);
Register("BCast", AccessLevel.GameMaster, BroadcastMessage_OnCommand);
Register("BC", AccessLevel.GameMaster, BroadcastMessage_OnCommand);
Register("B", AccessLevel.GameMaster, BroadcastMessage_OnCommand);
Register("Bank", AccessLevel.GameMaster, Bank_OnCommand);
@ -736,14 +731,16 @@ namespace Server.Commands
}
}
[Usage("SMsg <text>"), Aliases("S", "SM")]
[Usage("SMsg <text>")]
[Aliases("S", "SM")]
[Description("Broadcasts a message to all online staff.")]
public static void StaffMessage_OnCommand(CommandEventArgs e)
{
BroadcastMessage(AccessLevel.Counselor, e.Mobile.SpeechHue, $"[{e.Mobile.Name}] {e.ArgString}");
}
[Usage("BCast <text>"), Aliases("B", "BC")]
[Usage("BCast <text>")]
[Aliases("B", "BC")]
[Description("Broadcasts a message to everyone online.")]
public static void BroadcastMessage_OnCommand(CommandEventArgs e)
{
@ -764,7 +761,8 @@ namespace Server.Commands
}
}
[Usage("AutoPageNotify"), Aliases("APN")]
[Usage("AutoPageNotify")]
[Aliases("APN")]
[Description("Toggles your auto-page-notify status.")]
public static void APN_OnCommand(CommandEventArgs e)
{
@ -782,8 +780,8 @@ namespace Server.Commands
}
}
[Usage("Animate <action> <frameCount> <repeatCount> <forward> <repeat> <delay>"),
Description("Makes your character do a specified animation.")]
[Usage("Animate <action> <frameCount> <repeatCount> <forward> <repeat> <delay>")]
[Description("Makes your character do a specified animation.")]
public static void Animate_OnCommand(CommandEventArgs e)
{
if (e.Length == 6)