2022-06-04 18:09:42 +08:00
using System ;
using System.Collections.Generic ;
using System.Linq ;
using System.Text ;
using System.Threading.Tasks ;
using System.Net ;
namespace RageCoop.Server.Scripting
{
2022-07-01 13:54:18 +08:00
/// <summary>
///
/// </summary>
2022-06-04 18:09:42 +08:00
public class ChatEventArgs : EventArgs
{
2022-07-01 13:54:18 +08:00
/// <summary>
/// The client that sent this message
/// </summary>
2022-07-29 15:07:52 +08:00
public Client Client { get ; set ; }
2022-07-01 13:54:18 +08:00
/// <summary>
/// Message
/// </summary>
2022-06-04 18:09:42 +08:00
public string Message { get ; set ; }
2022-07-29 15:07:52 +08:00
/// <summary>
/// Only used when sending a message via <see cref="API.SendChatMessage(string, List{Client}, string, bool?)"/>
/// </summary>
public string ClaimedSender { get ; set ; }
2022-06-04 18:09:42 +08:00
}
2022-07-01 13:54:18 +08:00
/// <summary>
///
/// </summary>
2022-06-21 18:13:30 +08:00
public class CustomEventReceivedArgs : EventArgs
{
2022-07-01 13:54:18 +08:00
/// <summary>
/// The <see cref="Client"/> that triggered this event
/// </summary>
2022-06-21 18:13:30 +08:00
public Client Sender { get ; set ; }
2022-07-02 18:30:16 +08:00
2022-07-01 13:54:18 +08:00
/// <summary>
/// The event hash
/// </summary>
2022-06-21 18:13:30 +08:00
public int Hash { get ; set ; }
2022-07-02 18:30:16 +08:00
2022-07-01 13:54:18 +08:00
/// <summary>
2022-07-03 21:00:05 +08:00
/// Supported types: byte, short, ushort, int, uint, long, ulong, float, bool, string, Vector3, Quaternion, Vector2 <see cref="ServerObject.Handle"/>
2022-07-01 13:54:18 +08:00
/// </summary>
2022-07-05 10:52:22 +08:00
public object [ ] Args { get ; set ; }
2022-06-21 18:13:30 +08:00
}
2022-07-01 13:54:18 +08:00
/// <summary>
///
/// </summary>
2022-06-21 18:13:30 +08:00
public class OnCommandEventArgs : EventArgs
{
2022-07-01 13:54:18 +08:00
/// <summary>
/// The <see cref="Client"/> that executed this command.
/// </summary>
2022-06-21 18:13:30 +08:00
public Client Sender { get ; set ; }
2022-07-01 13:54:18 +08:00
/// <summary>
/// The name of executed command
/// </summary>
2022-06-21 18:13:30 +08:00
public string Name { get ; set ; }
2022-07-01 13:54:18 +08:00
/// <summary>
/// Arguments
/// </summary>
2022-06-21 18:13:30 +08:00
public string [ ] Args { get ; set ; }
/// <summary>
/// If this value was set to true, corresponding handler registered with <see cref="API.RegisterCommand(string, Action{CommandContext})"/> will not be invoked.
/// </summary>
public bool Cancel { get ; set ; } = false ;
}
2022-07-01 13:54:18 +08:00
/// <summary>
///
/// </summary>
2022-06-04 18:09:42 +08:00
public class HandshakeEventArgs : EventArgs
{
2022-07-01 13:54:18 +08:00
/// <summary>
/// The player's ID
/// </summary>
2022-06-04 18:09:42 +08:00
public int ID { get ; set ; }
2022-07-01 13:54:18 +08:00
/// <summary>
/// The claimed username
/// </summary>
2022-06-04 18:09:42 +08:00
public string Username { get ; set ; }
2022-06-24 10:33:36 +08:00
/// <summary>
2022-06-24 16:49:59 +08:00
/// The client password hashed with SHA256 algorithm.
2022-06-24 10:33:36 +08:00
/// </summary>
public string PasswordHash { get ; set ; }
2022-07-01 13:54:18 +08:00
/// <summary>
/// The <see cref="EndPoint"/> that sent the handshake request.
/// </summary>
2022-06-04 18:09:42 +08:00
public IPEndPoint EndPoint { get ; set ; }
2022-07-01 13:54:18 +08:00
/// <summary>
/// Deny the connection attempt
/// </summary>
/// <param name="reason"></param>
2022-06-04 18:09:42 +08:00
public void Deny ( string reason )
{
DenyReason = reason ;
Cancel = true ;
}
internal string DenyReason { get ; set ; }
internal bool Cancel { get ; set ; } = false ;
}
}