78 lines
2.0 KiB
C#
Raw Normal View History

2021-08-15 07:54:25 +02:00
using System;
using System.Collections;
2021-08-15 07:54:25 +02:00
using System.Collections.Generic;
2021-08-18 12:47:36 +02:00
using System.ComponentModel;
2021-08-22 13:59:15 +02:00
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
2022-05-22 15:55:26 +08:00
using RageCoop.Core;
2021-08-15 07:54:25 +02:00
using Lidgren.Network;
2021-08-14 21:49:23 +02:00
2022-06-04 18:09:42 +08:00
namespace RageCoop.Server.Scripting
2021-08-14 21:49:23 +02:00
{
public abstract class ServerScript
{
2021-08-18 11:47:59 +02:00
}
2022-04-12 06:04:02 +02:00
[AttributeUsage(AttributeTargets.Method, Inherited = false)]
public class TriggerEvent : Attribute
{
public string EventName { get; set; }
public TriggerEvent(string eventName)
{
EventName = eventName;
}
}
public class EventContext
{
/// <summary>
/// Gets the client which executed the command
/// </summary>
public Client Client { get; internal set; }
/// <summary>
/// Arguments (all standard but no string!)
/// </summary>
public object[] Args { get; internal set; }
}
[AttributeUsage(AttributeTargets.Method, Inherited = false)]
public class Command : Attribute
2021-08-18 11:47:59 +02:00
{
/// <summary>
/// Sets name of the command
/// </summary>
public string Name { get; set; }
2021-12-16 14:52:48 +01:00
/// <summary>
/// Set the Usage (Example: "Please use "/help"". ArgsLength required!)
/// </summary>
public string Usage { get; set; }
2021-12-16 14:52:48 +01:00
/// <summary>
/// Set the length of arguments (Example: 2 for "/message USERNAME MESSAGE". Usage required!)
/// </summary>
public short ArgsLength { get; set; }
public Command(string name)
2021-08-15 07:54:25 +02:00
{
2021-08-18 11:47:59 +02:00
Name = name;
2021-08-15 07:54:25 +02:00
}
2021-08-14 21:49:23 +02:00
}
2021-08-18 11:47:59 +02:00
public class CommandContext
{
/// <summary>
/// Gets the client which executed the command
/// </summary>
2021-08-26 17:01:32 +02:00
public Client Client { get; internal set; }
2021-08-18 11:47:59 +02:00
/// <summary>
2021-12-16 14:52:48 +01:00
/// Gets the arguments (Example: "/message USERNAME MESSAGE", Args[0] for USERNAME)
2021-08-18 11:47:59 +02:00
/// </summary>
public string[] Args { get; internal set; }
}
2021-08-14 21:49:23 +02:00
}