using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Net;
namespace RageCoop.Server.Scripting
{
///
///
///
public class ChatEventArgs : EventArgs
{
///
/// The client that sent this message, will be null if sent from server
///
public Client Client { get; set; }
///
/// Message
///
public string Message { get; set; }
///
/// Only used when sending a message via
///
public string ClaimedSender { get; set; }
}
///
///
///
public class CustomEventReceivedArgs : EventArgs
{
///
/// The that triggered this event
///
public Client Client { get; set; }
///
/// The event hash
///
public int Hash { get; set; }
///
/// Supported types: byte, short, ushort, int, uint, long, ulong, float, bool, string, Vector3, Quaternion, Vector2
///
public object[] Args { get; set; }
}
///
///
///
public class OnCommandEventArgs : EventArgs
{
///
/// The that executed this command, will be null if sent from server.
///
public Client Client { get; set; }
///
/// The name of executed command
///
public string Name { get; set; }
///
/// Arguments
///
public string[] Args { get; set; }
///
/// If this value was set to true, corresponding handler registered with will not be invoked.
///
public bool Cancel { get; set; } = false;
}
///
///
///
public class HandshakeEventArgs : EventArgs
{
///
/// The player's ID
///
public int ID { get; set; }
///
/// The claimed username
///
public string Username { get; set; }
///
/// The client password hashed with SHA256 algorithm.
///
public string PasswordHash { get; set; }
///
/// The that sent the handshake request.
///
public IPEndPoint EndPoint { get; set; }
///
/// Deny the connection attempt
///
///
public void Deny(string reason)
{
DenyReason=reason;
Cancel=true;
}
internal string DenyReason { get; set; }
internal bool Cancel { get; set; }=false;
}
}