mirror of
https://github.com/RaidMax/IW4M-Admin.git
synced 2025-06-10 15:20:48 -05:00
initial framework for gsc + iw4madmin integration
improvements to script plugin capabilities and error feedback
This commit is contained in:
@ -10,7 +10,7 @@ namespace SharedLibraryCore.Interfaces
|
||||
bool IsParser => false;
|
||||
Task OnLoadAsync(IManager manager);
|
||||
Task OnUnloadAsync();
|
||||
Task OnEventAsync(GameEvent E, Server S);
|
||||
Task OnEventAsync(GameEvent gameEvent, Server server);
|
||||
Task OnTickAsync(Server S);
|
||||
}
|
||||
}
|
@ -18,6 +18,6 @@ namespace SharedLibraryCore.Interfaces
|
||||
/// discovers the script plugins
|
||||
/// </summary>
|
||||
/// <returns>initialized script plugin collection</returns>
|
||||
IEnumerable<IPlugin> DiscoverScriptPlugins();
|
||||
IEnumerable<IPlugin> DiscoverScriptPlugins(IServiceProvider serviceProvider);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,5 +1,6 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace SharedLibraryCore.Interfaces
|
||||
{
|
||||
@ -18,8 +19,10 @@ namespace SharedLibraryCore.Interfaces
|
||||
/// <param name="isTargetRequired">target required or not</param>
|
||||
/// <param name="args">command arguments (name, is required)</param>
|
||||
/// <param name="executeAction">action to peform when commmand is executed</param>
|
||||
/// <param name="supportedGames"></param>
|
||||
/// <returns></returns>
|
||||
IManagerCommand CreateScriptCommand(string name, string alias, string description, string permission,
|
||||
bool isTargetRequired, IEnumerable<(string, bool)> args, Action<GameEvent> executeAction);
|
||||
bool isTargetRequired, IEnumerable<(string, bool)> args, Func<GameEvent, Task> executeAction,
|
||||
Server.Game[] supportedGames);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
15
SharedLibraryCore/Interfaces/IScriptPluginTimerHelper.cs
Normal file
15
SharedLibraryCore/Interfaces/IScriptPluginTimerHelper.cs
Normal file
@ -0,0 +1,15 @@
|
||||
using System;
|
||||
using System.Threading;
|
||||
|
||||
namespace SharedLibraryCore.Interfaces;
|
||||
|
||||
public interface IScriptPluginTimerHelper
|
||||
{
|
||||
void Start(int delay, int interval);
|
||||
void Start(int interval);
|
||||
void Start();
|
||||
void Stop();
|
||||
void OnTick(Delegate action, string actionName);
|
||||
bool IsRunning { get; }
|
||||
void SetDependency(SemaphoreSlim dependentSemaphore);
|
||||
}
|
@ -387,5 +387,23 @@ namespace SharedLibraryCore
|
||||
}
|
||||
|
||||
public abstract Task<long> GetIdForServer(Server server = null);
|
||||
|
||||
public string[] ExecuteServerCommand(string command)
|
||||
{
|
||||
return this.ExecuteCommandAsync(command).GetAwaiter().GetResult();
|
||||
}
|
||||
|
||||
public string GetServerDvar(string dvarName)
|
||||
{
|
||||
return this.GetDvarAsync<string>(dvarName).GetAwaiter().GetResult()?.Value;
|
||||
}
|
||||
|
||||
public void SetServerDvar(string dvarName, string dvarValue)
|
||||
{
|
||||
this.SetDvarAsync(dvarName, dvarValue).GetAwaiter().GetResult();
|
||||
}
|
||||
|
||||
public EFClient GetClientByNumber(int clientNumber) =>
|
||||
GetClientsAsList().FirstOrDefault(client => client.ClientNumber == clientNumber);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -28,32 +28,32 @@
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="FluentValidation" Version="10.3.6"/>
|
||||
<PackageReference Include="Humanizer.Core" Version="2.13.14"/>
|
||||
<PackageReference Include="Humanizer.Core.ru" Version="2.13.14"/>
|
||||
<PackageReference Include="Humanizer.Core.de" Version="2.13.14"/>
|
||||
<PackageReference Include="Humanizer.Core.es" Version="2.13.14"/>
|
||||
<PackageReference Include="Humanizer.Core.pt" Version="2.13.14"/>
|
||||
<PackageReference Include="Microsoft.AspNetCore.Authentication.Cookies" Version="2.2.0"/>
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="6.0.1"/>
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="6.0.1"/>
|
||||
<PackageReference Include="Microsoft.Extensions.Configuration" Version="6.0.0"/>
|
||||
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="6.0.0"/>
|
||||
<PackageReference Include="Microsoft.Extensions.Localization" Version="6.0.1"/>
|
||||
<PackageReference Include="Microsoft.Extensions.Logging.Console" Version="6.0.0"/>
|
||||
<PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="6.0.0"/>
|
||||
<PackageReference Include="Microsoft.Extensions.Options.ConfigurationExtensions" Version="6.0.0"/>
|
||||
<PackageReference Include="Newtonsoft.Json" Version="13.0.1"/>
|
||||
<PackageReference Include="Serilog.AspNetCore" Version="4.1.0"/>
|
||||
<PackageReference Include="SimpleCrypto.NetCore" Version="1.0.0"/>
|
||||
<PackageReference Include="FluentValidation" Version="10.3.6" />
|
||||
<PackageReference Include="Humanizer.Core" Version="2.13.14" />
|
||||
<PackageReference Include="Humanizer.Core.ru" Version="2.13.14" />
|
||||
<PackageReference Include="Humanizer.Core.de" Version="2.13.14" />
|
||||
<PackageReference Include="Humanizer.Core.es" Version="2.13.14" />
|
||||
<PackageReference Include="Humanizer.Core.pt" Version="2.13.14" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.Authentication.Cookies" Version="2.2.0" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="6.0.1" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="6.0.1" />
|
||||
<PackageReference Include="Microsoft.Extensions.Configuration" Version="6.0.0" />
|
||||
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="6.0.0" />
|
||||
<PackageReference Include="Microsoft.Extensions.Localization" Version="6.0.1" />
|
||||
<PackageReference Include="Microsoft.Extensions.Logging.Console" Version="6.0.0" />
|
||||
<PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="6.0.0" />
|
||||
<PackageReference Include="Microsoft.Extensions.Options.ConfigurationExtensions" Version="6.0.0" />
|
||||
<PackageReference Include="Newtonsoft.Json" Version="13.0.1" />
|
||||
<PackageReference Include="Serilog.AspNetCore" Version="4.1.0" />
|
||||
<PackageReference Include="SimpleCrypto.NetCore" Version="1.0.0" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\Data\Data.csproj"/>
|
||||
<ProjectReference Include="..\Data\Data.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
<Target Name="PreBuild" BeforeTargets="PreBuildEvent">
|
||||
<Exec Command="if not exist "$(ProjectDir)..\BUILD" (
if $(ConfigurationName) == Debug (
md "$(ProjectDir)..\BUILD"
)
)
if not exist "$(ProjectDir)..\BUILD\Plugins" (
if $(ConfigurationName) == Debug (
md "$(ProjectDir)..\BUILD\Plugins"
)
)"/>
|
||||
<Exec Command="if not exist "$(ProjectDir)..\BUILD" (
if $(ConfigurationName) == Debug (
md "$(ProjectDir)..\BUILD"
)
)
if not exist "$(ProjectDir)..\BUILD\Plugins" (
if $(ConfigurationName) == Debug (
md "$(ProjectDir)..\BUILD\Plugins"
)
)" />
|
||||
</Target>
|
||||
|
||||
<PropertyGroup>
|
||||
@ -61,7 +61,7 @@
|
||||
</PropertyGroup>
|
||||
<Target DependsOnTargets="BuildOnlySettings;ResolveReferences" Name="CopyProjectReferencesToPackage">
|
||||
<ItemGroup>
|
||||
<BuildOutputInPackage Include="@(ReferenceCopyLocalPaths->WithMetadataValue('ReferenceSourceTarget', 'ProjectReference'))"/>
|
||||
<BuildOutputInPackage Include="@(ReferenceCopyLocalPaths->WithMetadataValue('ReferenceSourceTarget', 'ProjectReference'))" />
|
||||
</ItemGroup>
|
||||
</Target>
|
||||
|
||||
|
Reference in New Issue
Block a user