- add game interface reconnect comand
- add ScriptReconnect Event
This commit is contained in:
parent
6d57d209b0
commit
abbe33f22a
66
Commands/GameInterfaceReconnectCommand.cs
Normal file
66
Commands/GameInterfaceReconnectCommand.cs
Normal file
@ -0,0 +1,66 @@
|
||||
using SharedLibraryCore;
|
||||
using SharedLibraryCore.Commands;
|
||||
using SharedLibraryCore.Configuration;
|
||||
using SharedLibraryCore.Database.Models;
|
||||
using SharedLibraryCore.Interfaces;
|
||||
using SharedLibraryCore.Interfaces.Events;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
|
||||
namespace ClanTagRankCommands.Commands
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// Example script command
|
||||
/// </summary>
|
||||
///
|
||||
|
||||
public class GameInterfaceReconnectCommand : Command
|
||||
{
|
||||
|
||||
private readonly IMetaServiceV2 _metaService;
|
||||
//private readonly IConfigurationHandler<ClanTagConfiguration> _configurationHandler;
|
||||
private ClanTagConfiguration Config;
|
||||
|
||||
|
||||
public GameInterfaceReconnectCommand(CommandConfiguration config, ITranslationLookup lookup, ClanTagConfiguration _Config, IMetaServiceV2 metaService, IConfigurationHandlerFactory configurationHandlerFactory) : base(config, lookup)
|
||||
{
|
||||
_metaService = metaService;
|
||||
|
||||
Config = _Config;
|
||||
|
||||
Name = "GameInterfaceReconnect";
|
||||
Description = "set a user's clan tag Rank (does not give permissions)";
|
||||
Alias = "gir";
|
||||
Permission = EFClient.Permission.Administrator;
|
||||
RequiresTarget = false;
|
||||
//Arguments = new[]
|
||||
//{
|
||||
// new CommandArgument()
|
||||
// {
|
||||
// Name = "rank",
|
||||
// Required = true
|
||||
// }
|
||||
//};
|
||||
}
|
||||
|
||||
public override Task ExecuteAsync(GameEvent E)
|
||||
{
|
||||
var gir = new GameEvent()
|
||||
{
|
||||
Origin = Utilities.IW4MAdminClient(),
|
||||
Owner = E.Owner,
|
||||
Type = GameEvent.EventType.Other,
|
||||
Subtype = "ScriptReconnect",
|
||||
};
|
||||
|
||||
E.Owner.ExecuteEvent(gir);
|
||||
return Task.CompletedTask;
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
@ -17,6 +17,7 @@ namespace IW4MAdmin.Plugins.ClanTagRankCommands.Events
|
||||
|
||||
private const string EVENT_RC = "RC";
|
||||
private const string EVENT_ScriptBan = "ScriptBan";
|
||||
private const string EVENT_ScriptReconnect = "ScriptReconnect";
|
||||
|
||||
/// <summary>
|
||||
/// this is a custom event printed out by _clientids.gsc (used for recording highest personal round records)
|
||||
@ -63,6 +64,28 @@ namespace IW4MAdmin.Plugins.ClanTagRankCommands.Events
|
||||
}
|
||||
);
|
||||
}
|
||||
private EventGeneratorCallback ScriptReconnect()
|
||||
{
|
||||
return (EVENT_ScriptReconnect, EVENT_ScriptReconnect, (eventLine, _, _) =>
|
||||
{
|
||||
string[] lineSplit = eventLine.Split(";");
|
||||
|
||||
|
||||
//long originId = lineSplit[1].ConvertGuidToLong(NumberStyles.Integer);
|
||||
//int clientnum = int.Parse(lineSplit[2]);
|
||||
var ScriptReconnect = new ScriptReconnectEvent
|
||||
|
||||
{
|
||||
Type = GameEvent.EventType.Other,
|
||||
Subtype = EVENT_ScriptReconnect,
|
||||
Origin = Utilities.IW4MAdminClient(),
|
||||
//Target = new EFClient { NetworkId = originId, Name = lineSplit[3], ClientNumber = clientnum },
|
||||
ScriptData = eventLine
|
||||
};
|
||||
return ScriptReconnect;
|
||||
}
|
||||
);
|
||||
}
|
||||
//private const string EVENT_RoundNumber = "RoundNumber";
|
||||
|
||||
///// <summary>
|
||||
@ -86,12 +109,15 @@ namespace IW4MAdmin.Plugins.ClanTagRankCommands.Events
|
||||
public IEnumerable<EventGeneratorCallback> Events =>
|
||||
new[]
|
||||
{
|
||||
RC(),ScriptBan()
|
||||
RC(),ScriptBan(), ScriptReconnect(),
|
||||
|
||||
};
|
||||
|
||||
public class ScriptBanEvent : GameScriptEvent
|
||||
{
|
||||
}
|
||||
public class ScriptReconnectEvent : GameScriptEvent
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user