21 Commits
1.2 ... 3.1

Author SHA1 Message Date
92cc79f707 Improved Setup
Update Dependency
2024-01-19 03:08:03 +01:00
6778375f43 Fix Dependency 2024-01-19 02:22:17 +01:00
0dcee037fc Update Readme 2024-01-19 02:22:12 +01:00
ee0ca69475 Fix wrong order of parameters 2024-01-19 02:13:25 +01:00
18d3b6bf66 Update Dependency Cshocker
Update Dependency CS2GSI
Update README
OpenShock now automatically gets shockerIds
2024-01-19 02:06:26 +01:00
d040995051 Dictionary 2024-01-19 01:55:21 +01:00
dbb0bcd89f ConfigurationValid() tobeimplemented 2024-01-19 01:55:15 +01:00
968c3a5c37 Add PiShockHttp 2024-01-19 01:43:04 +01:00
4039455bfd Update Dependecy CShocker 2024-01-19 01:42:47 +01:00
b196f62111 Update Readme... 2024-01-18 18:16:50 +01:00
b085de2b39 Update Readme 2024-01-18 18:16:10 +01:00
ba8b76bfba Update Readme 2024-01-18 18:15:11 +01:00
0f62e9e9c9 Fix setup 2024-01-18 00:21:51 +01:00
41a433bf3f Version 3:
CS2GSI and CShocker libraries
More extensive options for Events
Setup on first start
2024-01-18 00:06:39 +01:00
fa6a8d4e15 Update Dependency, Readme 2024-01-16 04:43:07 +01:00
96443f3c0a Update Readme 2024-01-16 01:36:06 +01:00
c7b9b6bc35 Update Readme 2024-01-16 01:35:25 +01:00
4e30b7f9d8 Update Readme 2024-01-16 01:22:53 +01:00
9f961f2c65 Add OnDamageTaken 2024-01-16 01:20:41 +01:00
f01d721281 Add Overwrite to Shocker.Control for intensity and duration 2024-01-16 01:20:28 +01:00
6a862fa814 Use CS2GSI 2024-01-16 00:53:01 +01:00
20 changed files with 610 additions and 584 deletions

View File

@ -4,5 +4,8 @@
<s:Boolean x:Key="/Default/UserDictionary/Words/=appmanifest/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=freezetime/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=libraryfolders/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=NYAA/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=OpenCS2hock/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=Sharecode/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=steamapps/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=steamid/@EntryIndexedValue">True</s:Boolean></wpf:ResourceDictionary>

View File

@ -1,3 +1,4 @@
<wpf:ResourceDictionary xml:space="preserve" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:s="clr-namespace:System;assembly=mscorlib" xmlns:ss="urn:shemas-jetbrains-com:settings-storage-xaml" xmlns:wpf="http://schemas.microsoft.com/winfx/2006/xaml/presentation">
<s:Boolean x:Key="/Default/ResxEditorPersonal/CheckedGroups/=OpenCS2hock_002FResources/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/AddReferences/RecentPaths/=C_003A_005CUsers_005CGlax_005CRiderProjects_005CCShocker_005CCShocker_005Cbin_005CDebug_005Cnet7_002E0_005CCShocker_002Edll/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/ResxEditorPersonal/Initialized/@EntryValue">True</s:Boolean></wpf:ResourceDictionary>

View File

@ -1,72 +0,0 @@
using Newtonsoft.Json.Linq;
namespace OpenCS2hock;
internal class CS2MessageHandler
{
internal delegate void CS2EventHandler();
internal event CS2EventHandler? OnKill;
internal event CS2EventHandler? OnDeath;
internal event CS2EventHandler? OnRoundStart;
internal event CS2EventHandler? OnRoundEnd;
internal event CS2EventHandler? OnRoundWin;
internal event CS2EventHandler? OnRoundLoss;
internal void HandleCS2Message(string message, string mySteamId)
{
JObject messageJson = JObject.Parse(message);
string? previousSteamId = messageJson.SelectToken("previously.player.steamid", false)?.Value<string>();
string? currentSteamId = messageJson.SelectToken("player.steamid", false)?.Value<string>();
RoundState currentRoundState = ParseRoundStateFromString(messageJson.SelectToken("round.phase", false)?.Value<string>());
RoundState previousRoundState = ParseRoundStateFromString(messageJson.SelectToken("previously.round.phase", false)?.Value<string>());
if(previousRoundState == RoundState.Over && currentRoundState == RoundState.Live)
OnRoundStart?.Invoke();
if(previousRoundState == RoundState.Live && currentRoundState == RoundState.FreezeTime)
OnRoundEnd?.Invoke();
if(previousRoundState == RoundState.Live && currentRoundState == RoundState.Over)
OnRoundEnd?.Invoke();
Team playerTeam = ParseTeamFromString(messageJson.SelectToken("player.team", false)?.Value<string>());
Team winnerTeam = ParseTeamFromString(messageJson.SelectToken("round.win_team", false)?.Value<string>());
if(winnerTeam != Team.None && playerTeam != Team.None && playerTeam == winnerTeam)
OnRoundWin?.Invoke();
else if(winnerTeam != Team.None && playerTeam != Team.None && playerTeam != winnerTeam)
OnRoundLoss?.Invoke();
int? previousDeaths = messageJson.SelectToken("previously.player.match_stats.deaths", false)?.Value<int>();
int? currentDeaths = messageJson.SelectToken("player.match_stats.deaths", false)?.Value<int>();
if(previousSteamId is null && currentSteamId == mySteamId && currentDeaths > previousDeaths)
OnDeath?.Invoke();
int? previousKills = messageJson.SelectToken("previously.player.match_stats.kills", false)?.Value<int>();
int? currentKills = messageJson.SelectToken("player.match_stats.kills", false)?.Value<int>();
if(previousSteamId is null && currentSteamId == mySteamId && currentKills > previousKills)
OnKill?.Invoke();
}
private RoundState ParseRoundStateFromString(string? str)
{
return str switch
{
"live" => RoundState.Live,
"freezetime" => RoundState.FreezeTime,
"over" => RoundState.Over,
_ => RoundState.Unknown
};
}
private Team ParseTeamFromString(string? str)
{
return str switch
{
"T" => Team.T,
"CT" => Team.CT,
_ => Team.None
};
}
private enum RoundState {FreezeTime, Live, Over, Unknown}
private enum Team {T, CT, None}
}

View File

@ -0,0 +1,51 @@
using CShocker.Shockers.Abstract;
using Microsoft.Extensions.Logging;
using Newtonsoft.Json;
namespace OpenCS2hock;
public struct Configuration
{
public LogLevel LogLevel = LogLevel.Information;
public List<Shocker> Shockers = new();
public List<ShockerAction> ShockerActions = new ();
public Configuration()
{
}
public override string ToString()
{
return $"Loglevel: {Enum.GetName(typeof(LogLevel), LogLevel)}\n" +
$"Shockers: {string.Join("\n---", Shockers)}\n" +
$"Actions: {string.Join("\n---", ShockerActions)}";
}
internal static Configuration GetConfigurationFromFile(string? path = null, ILogger? logger = null)
{
string settingsFilePath = path ?? "config.json";
if (!File.Exists(settingsFilePath))
Setup.Run().SaveConfiguration();
Configuration c = JsonConvert.DeserializeObject<Configuration>(File.ReadAllText(settingsFilePath), new CShocker.Shockers.ShockerJsonConverter());
if (!c.ConfigurationValid())
throw new Exception("Configuration validation failed.");
foreach (Shocker cShocker in c.Shockers)
cShocker.SetLogger(logger);
return c;
}
internal void SaveConfiguration(string? path = null)
{
string settingsFilePath = path ?? "config.json";
File.WriteAllText(settingsFilePath, JsonConvert.SerializeObject(this, Formatting.Indented));
}
private bool ConfigurationValid()
{
return true; //TODO Check values
}
}

View File

@ -1,17 +0,0 @@
namespace OpenCS2hock;
internal class ConfiguredInteger
{
private readonly int _min, _max;
internal ConfiguredInteger(int min = 0, int max = 50)
{
this._min = min;
this._max = max;
}
internal int GetValue()
{
return Random.Shared.Next(_min, _max);
}
}

View File

@ -1,51 +0,0 @@
using System.Net;
using System.Text;
namespace OpenCS2hock;
internal class GSIServer
{
private HttpListener HttpListener { get; init; }
internal delegate void OnMessageEventHandler(string content);
internal event OnMessageEventHandler? OnMessage;
private bool _keepRunning = true;
internal bool IsRunning { get; private set; }
internal GSIServer(int port)
{
HttpListener = new HttpListener();
HttpListener.Prefixes.Add($"http://127.0.0.1:{port}/");
HttpListener.Start();
Thread connectionListener = new (HandleConnection);
connectionListener.Start();
IsRunning = true;
}
private async void HandleConnection()
{
while (_keepRunning)
{
HttpListenerContext context = await HttpListener.GetContextAsync();
HttpListenerRequest request = context.Request;
Console.WriteLine($"[{request.HttpMethod}] {request.Url} - {request.UserAgent}");
HttpResponseMessage responseMessage = new (HttpStatusCode.Accepted);
context.Response.OutputStream.Write(Encoding.UTF8.GetBytes(responseMessage.ToString()));
StreamReader reader = new (request.InputStream, request.ContentEncoding);
string content = await reader.ReadToEndAsync();
OnMessage?.Invoke(content);
}
HttpListener.Close();
IsRunning = false;
}
internal void Dispose()
{
_keepRunning = false;
}
}

View File

@ -1,59 +0,0 @@
using Microsoft.Win32;
using Newtonsoft.Json;
namespace OpenCS2hock;
public static class Installer
{
internal static Settings GetSettings(string? path = null)
{
string settingsFilePath = path ?? "config.json";
if (!File.Exists(settingsFilePath))
File.WriteAllText(settingsFilePath, JsonConvert.SerializeObject(new Settings(), Formatting.Indented));
return JsonConvert.DeserializeObject<Settings>(File.ReadAllText(settingsFilePath));
}
internal static List<Shocker> GetShockers(Settings settings)
{
List<Shocker> shockers = new();
shockers.Add(new OpenShock(settings.OpenShockSettings.Endpoint, settings.OpenShockSettings.ApiKey,
settings.OpenShockSettings.Shockers,
new ConfiguredInteger(settings.IntensityRange.Min, settings.IntensityRange.Max),
new ConfiguredInteger(settings.DurationRange.Min, settings.DurationRange.Max)));
return shockers;
}
internal static void InstallGsi()
{
string installLocation = Path.Combine(GetInstallDirectory(), "game\\csgo\\cfg\\gamestate_integration_opencs2hock.cfg");
File.WriteAllText(installLocation, Resources.GSI_CFG_Content);
}
private static string GetInstallDirectory(int appId = 730)
{
string steamInstallation =
#pragma warning disable CA1416 //Registry only available on Windows
(string)(Registry.GetValue(@"HKEY_CURRENT_USER\SOFTWARE\Valve\Steam", "SteamPath", null) ??
#pragma warning restore CA1416
throw new DirectoryNotFoundException("No Steam Installation found."));
string libraryFolderFilepath = Path.Combine(steamInstallation, "steamapps\\libraryfolders.vdf");
string? libraryPath = null;
string? appManifestFolderPath = null;
foreach (string line in File.ReadAllLines(libraryFolderFilepath))
if (line.Contains("path"))
libraryPath = line.Split("\"").Last(split => split.Length > 0);
else if (line.Contains($"\"{appId}\""))
appManifestFolderPath = Path.Combine(libraryPath!, $"steamapps\\appmanifest_{appId}.acf");
string installationPath = "";
if (appManifestFolderPath is null)
throw new DirectoryNotFoundException($"No {appId} Installation found.");
foreach(string line in File.ReadAllLines(appManifestFolderPath))
if (line.Contains("installdir"))
installationPath = Path.Combine(libraryPath!, "steamapps\\common", line.Split("\"").Last(split => split.Length > 0));
return installationPath;
}
}

65
OpenCS2hock/Logger.cs Normal file
View File

@ -0,0 +1,65 @@
using Microsoft.Extensions.Logging;
namespace OpenCS2hock;
public class Logger : ILogger
{
private LogLevel _enabledLoglevel;
private readonly ConsoleColor _defaultForegroundColor = Console.ForegroundColor;
private readonly ConsoleColor _defaultBackgroundColor = Console.BackgroundColor;
public Logger(LogLevel logLevel = LogLevel.Trace)
{
_enabledLoglevel = logLevel;
}
public void UpdateLogLevel(LogLevel logLevel)
{
this._enabledLoglevel = logLevel;
}
public void Log<TState>(LogLevel logLevel, EventId eventId, TState state, Exception? exception, Func<TState, Exception?, string> formatter)
{
if (!IsEnabled(logLevel))
return;
Console.ForegroundColor = ForegroundColorForLogLevel(logLevel);
Console.BackgroundColor = BackgroundColorForLogLevel(logLevel);
Console.Write(logLevel.ToString()[..3].ToUpper());
Console.ResetColor();
// ReSharper disable once LocalizableElement
Console.Write($" [{DateTime.UtcNow:HH:mm:ss.fff}] ");
Console.WriteLine(formatter.Invoke(state, exception));
}
public bool IsEnabled(LogLevel logLevel)
{
return logLevel >= _enabledLoglevel;
}
public IDisposable? BeginScope<TState>(TState state) where TState : notnull
{
return null;
}
private ConsoleColor ForegroundColorForLogLevel(LogLevel logLevel)
{
return logLevel switch
{
LogLevel.Error or LogLevel.Critical => ConsoleColor.Black,
LogLevel.Debug => ConsoleColor.Black,
LogLevel.Information => ConsoleColor.White,
_ => _defaultForegroundColor
};
}
private ConsoleColor BackgroundColorForLogLevel(LogLevel logLevel)
{
return logLevel switch
{
LogLevel.Error or LogLevel.Critical => ConsoleColor.Red,
LogLevel.Debug => ConsoleColor.Yellow,
LogLevel.Information => ConsoleColor.Black,
_ => _defaultBackgroundColor
};
}
}

View File

@ -1,69 +1,109 @@
namespace OpenCS2hock;
using Microsoft.Extensions.Logging;
using CS2GSI;
using CShocker.Ranges;
using CShocker.Shockers.Abstract;
using CS2Event = CS2GSI.CS2Event;
namespace OpenCS2hock;
// ReSharper disable once InconsistentNaming
public class OpenCS2hock
{
private GSIServer GSIServer { get; init; }
private readonly CS2MessageHandler _cs2MessageHandler;
private readonly List<Shocker> _shockers;
private readonly Settings _settings;
private readonly CS2GSI.CS2GSI _cs2GSI;
private readonly Configuration _configuration;
private readonly Logger? _logger;
public OpenCS2hock(string? settingsPath = null)
public OpenCS2hock(string? configPath = null, bool editConfig = false, Logger? logger = null)
{
_settings = Installer.GetSettings(settingsPath);
this._shockers = Installer.GetShockers(_settings);
Console.WriteLine(_settings);
Installer.InstallGsi();
this._cs2MessageHandler = new CS2MessageHandler();
this._logger = logger;
this._logger?.Log(LogLevel.Information, "Starting OpenCS2hock...");
this._logger?.Log(LogLevel.Information, "Loading Configuration...");
this._configuration = Configuration.GetConfigurationFromFile(configPath, this._logger);
if(editConfig)
Setup.EditConfig(ref this._configuration);
this._logger?.Log(LogLevel.Information, $"Loglevel set to {_configuration.LogLevel}");
this._logger?.UpdateLogLevel(_configuration.LogLevel);
this._logger?.Log(LogLevel.Information, _configuration.ToString());
this._cs2GSI = new CS2GSI.CS2GSI(_logger);
this.SetupEventHandlers();
this.GSIServer = new GSIServer(3000);
this.GSIServer.OnMessage += OnGSIMessage;
Thread runningThread = new(() =>
{
while (GSIServer.IsRunning)
Thread.Sleep(10);
});
runningThread.Start();
while(this._cs2GSI.IsRunning)
Thread.Sleep(10);
}
private void SetupEventHandlers()
{
foreach (Shocker shocker in this._shockers)
this._logger?.Log(LogLevel.Information, "Setting up EventHandlers...");
foreach (ShockerAction shockerAction in this._configuration.ShockerActions)
{
foreach (KeyValuePair<string, string> kv in _settings.Actions)
foreach (string shockerId in shockerAction.ShockerIds)
{
switch (kv.Key)
Shocker shocker = this._configuration.Shockers.First(s => s.ShockerIds.Contains(shockerId));
switch (shockerAction.TriggerEvent)
{
case "OnKill":
this._cs2MessageHandler.OnKill += () => shocker.Control(Settings.StringToAction(kv.Value));
break;
case "OnDeath":
this._cs2MessageHandler.OnDeath += () => shocker.Control(Settings.StringToAction(kv.Value));
break;
case "OnRoundStart":
this._cs2MessageHandler.OnRoundStart += () => shocker.Control(Settings.StringToAction(kv.Value));
break;
case "OnRoundEnd":
this._cs2MessageHandler.OnRoundEnd += () => shocker.Control(Settings.StringToAction(kv.Value));
break;
case "OnRoundLoss":
this._cs2MessageHandler.OnRoundLoss += () => shocker.Control(Settings.StringToAction(kv.Value));
break;
case "OnRoundWin":
this._cs2MessageHandler.OnRoundWin += () => shocker.Control(Settings.StringToAction(kv.Value));
break;
case CS2Event.OnKill: this._cs2GSI.OnKill += args => EventHandler(args, shockerId, shocker, shockerAction); break;
case CS2Event.OnHeadshot: this._cs2GSI.OnHeadshot += args => EventHandler(args, shockerId, shocker, shockerAction); break;
case CS2Event.OnDeath: this._cs2GSI.OnDeath += args => EventHandler(args, shockerId, shocker, shockerAction); break;
case CS2Event.OnFlashed: this._cs2GSI.OnFlashed += args => EventHandler(args, shockerId, shocker, shockerAction); break;
case CS2Event.OnBurning: this._cs2GSI.OnBurning += args => EventHandler(args, shockerId, shocker, shockerAction); break;
case CS2Event.OnSmoked: this._cs2GSI.OnSmoked += args => EventHandler(args, shockerId, shocker, shockerAction); break;
case CS2Event.OnRoundStart: this._cs2GSI.OnRoundStart += args => EventHandler(args, shockerId, shocker, shockerAction); break;
case CS2Event.OnRoundOver: this._cs2GSI.OnRoundOver += args => EventHandler(args, shockerId, shocker, shockerAction); break;
case CS2Event.OnRoundWin: this._cs2GSI.OnRoundWin += args => EventHandler(args, shockerId, shocker, shockerAction); break;
case CS2Event.OnRoundLoss: this._cs2GSI.OnRoundLoss += args => EventHandler(args, shockerId, shocker, shockerAction); break;
case CS2Event.OnDamageTaken: this._cs2GSI.OnDamageTaken += args => EventHandler(args, shockerId, shocker, shockerAction); break;
case CS2Event.OnMatchStart: this._cs2GSI.OnMatchStart += args => EventHandler(args, shockerId, shocker, shockerAction); break;
case CS2Event.OnMatchOver: this._cs2GSI.OnMatchOver += args => EventHandler(args, shockerId, shocker, shockerAction); break;
case CS2Event.OnMoneyChange: this._cs2GSI.OnMoneyChange += args => EventHandler(args, shockerId, shocker, shockerAction); break;
case CS2Event.OnHealthChange: this._cs2GSI.OnHealthChange += args => EventHandler(args, shockerId, shocker, shockerAction); break;
case CS2Event.OnArmorChange: this._cs2GSI.OnArmorChange += args => EventHandler(args, shockerId, shocker, shockerAction); break;
case CS2Event.OnHelmetChange: this._cs2GSI.OnHelmetChange += args => EventHandler(args, shockerId, shocker, shockerAction); break;
case CS2Event.OnEquipmentValueChange: this._cs2GSI.OnEquipmentValueChange += args => EventHandler(args, shockerId, shocker, shockerAction); break;
case CS2Event.OnTeamChange: this._cs2GSI.OnTeamChange += args => EventHandler(args, shockerId, shocker, shockerAction); break;
case CS2Event.OnPlayerChange: this._cs2GSI.OnPlayerChange += args => EventHandler(args, shockerId, shocker, shockerAction); break;
case CS2Event.OnHalfTime: this._cs2GSI.OnHalfTime += args => EventHandler(args, shockerId, shocker, shockerAction); break;
case CS2Event.OnFreezeTime: this._cs2GSI.OnFreezeTime += args => EventHandler(args, shockerId, shocker, shockerAction); break;
case CS2Event.OnBombPlanted: this._cs2GSI.OnBombPlanted += args => EventHandler(args, shockerId, shocker, shockerAction); break;
case CS2Event.OnBombDefused: this._cs2GSI.OnBombDefused += args => EventHandler(args, shockerId, shocker, shockerAction); break;
case CS2Event.OnBombExploded: this._cs2GSI.OnBombExploded += args => EventHandler(args, shockerId, shocker, shockerAction); break;
case CS2Event.AnyEvent: this._cs2GSI.AnyEvent += args => EventHandler(args, shockerId, shocker, shockerAction); break;
case CS2Event.AnyMessage: this._cs2GSI.AnyMessage += args => EventHandler(args, shockerId, shocker, shockerAction); break;
default: this._logger?.Log(LogLevel.Debug, $"CS2Event {nameof(shockerAction.TriggerEvent)} unknown."); break;
}
}
}
}
private void OnGSIMessage(string content)
private void EventHandler(CS2EventArgs cs2EventArgs, string shockerId, Shocker shocker, ShockerAction shockerAction)
{
Directory.CreateDirectory(Path.Combine(Environment.CurrentDirectory, "CS2Events"));
string fileName = Path.Combine(Environment.CurrentDirectory, "CS2Events" ,$"{DateTime.Now.ToLongTimeString().Replace(':','.')}.json");
File.WriteAllText(fileName, content);
_cs2MessageHandler.HandleCS2Message(content, _settings.SteamId);
this._logger?.Log(LogLevel.Information, $"Shocker: {shocker}\nID: {shockerId}\nAction: {shockerAction}\nEventArgs: {cs2EventArgs}");
shocker.Control(shockerAction.Action, shockerId,
GetIntensity(shockerAction.ValueFromInput, shockerAction.TriggerEvent, cs2EventArgs, shockerId));
}
private int GetIntensity(bool valueFromInput, CS2Event cs2Event, CS2EventArgs eventArgs, string shockerId)
{
return valueFromInput
? IntensityFromCS2Event(cs2Event, eventArgs, shockerId)
: this._configuration.Shockers.First(shocker => shocker.ShockerIds.Contains(shockerId))
.IntensityRange.GetRandomRangeValue();
}
private int IntensityFromCS2Event(CS2Event cs2Event, CS2EventArgs eventArgs, string shockerId)
{
IntensityRange configuredRangeForShocker = this._configuration.Shockers
.First(shocker => shocker.ShockerIds.Contains(shockerId))
.IntensityRange;
return cs2Event switch
{
CS2Event.OnDamageTaken => MapInt(eventArgs.ValueAsOrDefault<int>(), 0, 100, configuredRangeForShocker.Min, configuredRangeForShocker.Max),
CS2Event.OnArmorChange => MapInt(eventArgs.ValueAsOrDefault<int>(), 0, 100, configuredRangeForShocker.Min, configuredRangeForShocker.Max),
_ => configuredRangeForShocker.GetRandomRangeValue()
};
}
private int MapInt(int input, int fromLow, int fromHigh, int toLow, int toHigh)
{
int mappedValue = (input - fromLow) * (toHigh - toLow) / (fromHigh - fromLow) + toLow;
return mappedValue;
}
}

View File

@ -6,24 +6,12 @@
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<RootNamespace>OpenCS2Hock</RootNamespace>
<IsPackable>false</IsPackable>
</PropertyGroup>
<ItemGroup>
<EmbeddedResource Update="Resources.resx">
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
</EmbeddedResource>
</ItemGroup>
<ItemGroup>
<Compile Update="Resources.Designer.cs">
<DesignTime>True</DesignTime>
<AutoGen>True</AutoGen>
<DependentUpon>Resources.resx</DependentUpon>
</Compile>
</ItemGroup>
<ItemGroup>
<PackageReference Include="CS2GSI" Version="1.0.7" />
<PackageReference Include="CShocker" Version="1.2.5" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
</ItemGroup>

View File

@ -1,44 +0,0 @@
using System.Net.Http.Headers;
using System.Text;
namespace OpenCS2hock;
internal class OpenShock : Shocker
{
protected override void ControlInternal(ControlAction action, string shockerId, int intensity, int duration)
{
HttpRequestMessage request = new (HttpMethod.Post, $"{Endpoint}/1/shockers/control")
{
Headers =
{
UserAgent = { new ProductInfoHeaderValue("OpenCS2hock", "1") },
Accept = { new MediaTypeWithQualityHeaderValue("application/json") }
},
Content = new StringContent(@"[ { "+
$"\"id\": \"{shockerId}\"," +
$"\"type\": {ControlActionToByte(action)},"+
$"\"intensity\": {intensity},"+
$"\"duration\": {duration}"+
"}]", Encoding.UTF8, new MediaTypeHeaderValue("application/json"))
};
request.Headers.Add("OpenShockToken", ApiKey);
HttpResponseMessage response = this.HttpClient.Send(request);
Console.WriteLine($"{request.RequestUri} response: {response.StatusCode}");
}
private byte ControlActionToByte(ControlAction action)
{
return action switch
{
ControlAction.Beep => 3,
ControlAction.Vibrate => 2,
ControlAction.Shock => 1,
_ => 0
};
}
internal OpenShock(string endpoint, string apiKey, string[] shockerIds, ConfiguredInteger intensity, ConfiguredInteger duration) : base(endpoint, apiKey, shockerIds, intensity, duration)
{
}
}

View File

@ -1,9 +1,11 @@
namespace OpenCS2hock;
using Microsoft.Extensions.Logging;
namespace OpenCS2hock;
public class Program
{
public static void Main(string[] args)
{
OpenCS2hock openCS2Hock = new OpenCS2hock();
OpenCS2hock openCS2Hock = new OpenCS2hock(editConfig: true, logger: new Logger(LogLevel.Information));
}
}

View File

@ -1,88 +0,0 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace OpenCS2hock {
using System;
/// <summary>
/// A strongly-typed resource class, for looking up localized strings, etc.
/// </summary>
// This class was auto-generated by the StronglyTypedResourceBuilder
// class via a tool like ResGen or Visual Studio.
// To add or remove a member, edit your .ResX file then rerun ResGen
// with the /str option, or rebuild your VS project.
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
internal class Resources {
private static global::System.Resources.ResourceManager resourceMan;
private static global::System.Globalization.CultureInfo resourceCulture;
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
internal Resources() {
}
/// <summary>
/// Returns the cached ResourceManager instance used by this class.
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Resources.ResourceManager ResourceManager {
get {
if (object.ReferenceEquals(resourceMan, null)) {
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("OpenCS2Hock.Resources", typeof(Resources).Assembly);
resourceMan = temp;
}
return resourceMan;
}
}
/// <summary>
/// Overrides the current thread's CurrentUICulture property for all
/// resource lookups using this strongly typed resource class.
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Globalization.CultureInfo Culture {
get {
return resourceCulture;
}
set {
resourceCulture = value;
}
}
/// <summary>
/// Looks up a localized string similar to &quot;OpenCS2hock&quot;
///{
///&quot;uri&quot; &quot;http://127.0.0.1:3000&quot;
///&quot;timeout&quot; &quot;5.0&quot;
///&quot;buffer&quot; &quot;0.1&quot;
///&quot;throttle&quot; &quot;0.5&quot;
///&quot;heartbeat&quot; &quot;60.0&quot;
///&quot;output&quot;
/// {
/// &quot;precision_time&quot; &quot;3&quot;
/// &quot;precision_position&quot; &quot;1&quot;
/// &quot;precision_vector&quot; &quot;3&quot;
/// }
///&quot;data&quot;
/// {
/// &quot;provider&quot; &quot;1&quot; // general info about client being listened to: game name, appid, client steamid, etc.
/// &quot;map&quot; &quot;1&quot; // map, gamemode, and current match phase (&apos;warmup&apos;, &apos;intermission&apos;, &apos;gameover&apos;, &apos;live&apos;) and current score
/// [rest of string was truncated]&quot;;.
/// </summary>
internal static string GSI_CFG_Content {
get {
return ResourceManager.GetString("GSI_CFG_Content", resourceCulture);
}
}
}
}

View File

@ -1,24 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:element name="root" msdata:IsDataSet="true">
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>1.3</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<data name="GSI_CFG_Content" type="System.Resources.ResXFileRef">
<value>gamestate_integration_opencs2hock.cfg;System.String, mscorlib, Version=4.0.0.0, Culture=neutral</value>
</data>
</root>

View File

@ -1,68 +0,0 @@
using Newtonsoft.Json;
namespace OpenCS2hock;
public struct Settings
{
public string SteamId = "";
public OpenShockSettings OpenShockSettings = new()
{
Endpoint = "https://api.shocklink.net",
ApiKey = "",
Shockers = Array.Empty<string>()
};
public Range IntensityRange = new ()
{
Min = 20,
Max = 60
};
public Range DurationRange = new()
{
Min = 1000,
Max = 1000
};
public Dictionary<string, string> Actions = new()
{
{"OnKill", "Nothing"},
{"OnDeath", "Shock"},
{"OnRoundStart", "Vibrate"},
{"OnRoundEnd", "Nothing"},
{"OnRoundWin", "Beep"},
{"OnRoundLoss", "Nothing"}
};
public Settings()
{
}
public override string ToString()
{
return JsonConvert.SerializeObject(this, Formatting.Indented);
}
internal static Shocker.ControlAction StringToAction(string str)
{
return str.ToLower() switch
{
"shock" => Shocker.ControlAction.Shock,
"vibrate" => Shocker.ControlAction.Vibrate,
"beep" => Shocker.ControlAction.Beep,
_ => Shocker.ControlAction.Nothing
};
}
}
public struct OpenShockSettings
{
public string Endpoint, ApiKey;
public string[] Shockers;
}
public struct Range
{
public short Min, Max;
}

275
OpenCS2hock/Setup.cs Normal file
View File

@ -0,0 +1,275 @@
using System.Text.RegularExpressions;
using CShocker.Ranges;
using CShocker.Shockers;
using CShocker.Shockers.Abstract;
using CShocker.Shockers.APIS;
using Microsoft.Extensions.Logging;
using CS2Event = CS2GSI.CS2Event;
namespace OpenCS2hock;
public static class Setup
{
internal static Configuration Run()
{
Console.Clear();
Console.WriteLine("Running first-time setup.");
Configuration c = new();
Console.WriteLine("First adding APIs:");
Console.WriteLine("Press Enter.");
while (Console.ReadKey().Key != ConsoleKey.Enter)
{//NYAA
}
bool addShocker = true;
while (c.Shockers.Count < 1 || addShocker)
{
Console.Clear();
AddShockerApi(ref c);
Console.WriteLine("Add another Shocker-API (Y/N):");
addShocker = Console.ReadKey().Key == ConsoleKey.Y;
}
Console.Clear();
Console.WriteLine("Now adding Actions:");
Console.WriteLine("Press Enter.");
while (Console.ReadKey().Key != ConsoleKey.Enter)
{//NYAA
}
bool addAction = true;
while (c.ShockerActions.Count < 1 || addAction)
{
Console.Clear();
AddAction(ref c);
Console.WriteLine("Add another Action (Y/N):");
addAction = Console.ReadKey().Key == ConsoleKey.Y;
}
return c;
}
internal static void EditConfig(ref Configuration c)
{
ConsoleKey? pressedKey = null;
while (pressedKey is not ConsoleKey.X && pressedKey is not ConsoleKey.Q)
{
Console.Clear();
Console.WriteLine("Config Edit Mode.");
Console.WriteLine("What do you want to edit?");
Console.WriteLine("1) LogLevel");
Console.WriteLine("2) Shocker-APIs");
Console.WriteLine("3) Event Actions");
Console.WriteLine("\nq) Quit Edit Mode");
pressedKey = Console.ReadKey().Key;
switch (pressedKey)
{
case ConsoleKey.D1:
Console.WriteLine("New LogLevel:");
string[] levels = Enum.GetNames<LogLevel>();
for(int i = 0; i < levels.Length; i++)
Console.WriteLine($"{i}) {levels[i]}");
int selected;
while (!int.TryParse(Console.ReadKey().KeyChar.ToString(), out selected) || selected < 0 ||
selected >= levels.Length)
{//NYAA
}
c.LogLevel = Enum.Parse<LogLevel>(levels[selected]);
break;
case ConsoleKey.D2:
bool addShocker = true;
while (c.Shockers.Count < 1 || addShocker)
{
Console.Clear();
AddShockerApi(ref c);
Console.WriteLine("Add another Shocker-API (Y/N):");
addShocker = Console.ReadKey().Key == ConsoleKey.Y;
}
break;
case ConsoleKey.D3:
bool addAction = true;
while (c.ShockerActions.Count < 1 || addAction)
{
Console.Clear();
AddAction(ref c);
Console.WriteLine("Add another Action (Y/N):");
addAction = Console.ReadKey().Key == ConsoleKey.Y;
}
break;
}
}
c.SaveConfiguration();
}
private static void AddShockerApi(ref Configuration c)
{
Console.WriteLine("Select API:");
Console.WriteLine("1) OpenShock (HTTP)");
Console.WriteLine("2) OpenShock (Serial) NotImplemented"); //TODO
Console.WriteLine("3) PiShock (HTTP)");
Console.WriteLine("4) PiShock (Serial) NotImplemented"); //TODO
string? selectedChar = Console.ReadLine();
int selected;
while (!int.TryParse(selectedChar, out selected) || (selected != 1 && selected != 3))
selectedChar = Console.ReadLine();
string apiUri, apiKey;
Shocker newShocker;
DurationRange durationRange;
IntensityRange intensityRange;
List<string> shockerIds = new();
switch (selected)
{
case 1: //OpenShock (HTTP)
apiUri = QueryString("OpenShock API-Endpoint (https://api.shocklink.net):", "https://api.shocklink.net");
apiKey = QueryString("OpenShock API-Key:","");
intensityRange = GetIntensityRange();
durationRange = GetDurationRange();
newShocker = new OpenShockHttp(shockerIds, intensityRange, durationRange, apiKey, apiUri);
newShocker.ShockerIds.AddRange(((OpenShockHttp)newShocker).GetShockers());
break;
case 3: //PiShock (HTTP)
apiUri = QueryString("PiShock API-Endpoint (https://do.pishock.com/api/apioperate):", "https://do.pishock.com/api/apioperate");
apiKey = QueryString("PiShock API-Key:","");
string username = QueryString("Username:","");
string shareCode = QueryString("Sharecode:","");
Console.WriteLine("Shocker IDs associated with this API:");
shockerIds = AddShockerIds();
intensityRange = GetIntensityRange();
durationRange = GetDurationRange();
newShocker = new PiShockHttp(shockerIds, intensityRange, durationRange, apiKey, username, shareCode, apiUri);
break;
// ReSharper disable thrice RedundantCaseLabel
case 2: //OpenShock (Serial)
case 4: //PiShock (Serial)
default:
throw new NotImplementedException();
}
c.Shockers.Add(newShocker);
}
private static void AddAction(ref Configuration c)
{
CS2Event triggerEvent = GetTrigger();
Console.WriteLine("Shocker IDs to trigger when Event occurs:");
List<string> shockerIds = GetShockerIds(c.Shockers);
ControlAction action = GetControlAction();
bool useEventArgsValue = QueryBool("Try using EventArgs to control Intensity (within set limits)?", "false");
c.ShockerActions.Add(new ShockerAction(triggerEvent, shockerIds, action, useEventArgsValue));
}
private static bool QueryBool(string queryString, string defaultResult)
{
string value = QueryString(queryString, defaultResult);
bool ret;
while (bool.TryParse(value, out ret))
value = QueryString(queryString, defaultResult);
return ret;
}
private static string QueryString(string queryString, string defaultResult)
{
Console.WriteLine(queryString);
string? userInput = Console.ReadLine();
return userInput?.Length > 0 ? userInput : defaultResult;
}
private static IntensityRange GetIntensityRange()
{
Regex intensityRangeRex = new (@"([0-9]{1,3})\-(1?[0-9]{1,2})");
string intensityRangeStr = "";
while(!intensityRangeRex.IsMatch(intensityRangeStr))
intensityRangeStr = QueryString("Intensity Range (0-100) in %:", "0-100");
short min = short.Parse(intensityRangeRex.Match(intensityRangeStr).Groups[1].Value);
short max = short.Parse(intensityRangeRex.Match(intensityRangeStr).Groups[2].Value);
return new IntensityRange(min, max);
}
private static DurationRange GetDurationRange()
{
Regex intensityRangeRex = new (@"([0-9]{1,4})\-([0-9]{1,5})");
string intensityRangeStr = "";
while(!intensityRangeRex.IsMatch(intensityRangeStr))
intensityRangeStr = QueryString("Duration Range (500-30000) in ms:", "500-30000");
short min = short.Parse(intensityRangeRex.Match(intensityRangeStr).Groups[1].Value);
short max = short.Parse(intensityRangeRex.Match(intensityRangeStr).Groups[2].Value);
return new DurationRange(min, max);
}
private static List<string> AddShockerIds()
{
List<string> ids = new();
bool addAnother = true;
while (ids.Count < 1 || addAnother)
{
string id = QueryString("Shocker ID:", "");
while (id.Length < 1)
id = QueryString("Shocker ID:", "");
ids.Add(id);
Console.WriteLine("Add another ID? (Y/N):");
addAnother = Console.ReadKey().Key == ConsoleKey.Y;
}
return ids;
}
private static List<string> GetShockerIds(List<Shocker> shockers)
{
List<string> ids = new();
bool addAnother = true;
while (ids.Count < 1 || addAnother)
{
Console.WriteLine("Select Shocker API:");
for(int i = 0; i < shockers.Count; i++)
Console.WriteLine($"{i}) {shockers[i]}");
int selectedShocker;
while (!int.TryParse(Console.ReadLine(), out selectedShocker) || selectedShocker < 0 || selectedShocker >= shockers.Count)
Console.WriteLine("Select Shocker API:");
for (int i = 0; i < shockers[selectedShocker].ShockerIds.Count; i++)
Console.WriteLine($"{i}) {shockers[selectedShocker].ShockerIds[i]}");
int selectedIndex;
while (!int.TryParse(Console.ReadLine(), out selectedIndex) || selectedIndex < 0 || selectedIndex >= shockers[selectedShocker].ShockerIds.Count)
Console.WriteLine("Select ID:");
ids.Add(shockers[selectedShocker].ShockerIds[selectedIndex]);
Console.WriteLine("Add another ID? (Y/N):");
addAnother = Console.ReadKey().Key == ConsoleKey.Y;
}
return ids;
}
private static CS2Event GetTrigger()
{
string[] names = Enum.GetNames(typeof(CS2Event));
Console.WriteLine("Select CS2 Trigger-Event:");
for (int i = 0; i < names.Length; i++)
Console.WriteLine($"{i}) {names[i]}");
int selectedIndex;
while (!int.TryParse(Console.ReadLine(), out selectedIndex))
Console.WriteLine("Select CS2 Trigger-Event:");
return Enum.Parse<CS2Event>(names[selectedIndex]);
}
private static ControlAction GetControlAction()
{
string[] names = Enum.GetNames(typeof(ControlAction));
Console.WriteLine("Select Action:");
for (int i = 0; i < names.Length; i++)
Console.WriteLine($"{i}) {names[i]}");
int selectedIndex;
while (!int.TryParse(Console.ReadLine(), out selectedIndex))
Console.WriteLine("Select Action:");
return Enum.Parse<ControlAction>(names[selectedIndex]);
}
}

View File

@ -1,37 +0,0 @@
namespace OpenCS2hock;
internal abstract class Shocker
{
protected readonly HttpClient HttpClient;
protected readonly string ApiKey,Endpoint;
private readonly string[] _shockerIds;
private readonly ConfiguredInteger _intensity, _duration;
internal enum ControlAction { Beep, Vibrate, Shock, Nothing }
internal void Control(ControlAction action, string? shockerId = null)
{
int intensity = _intensity.GetValue();
int duration = _duration.GetValue();
Console.WriteLine($"{action} {intensity} {duration}");
if (action is ControlAction.Nothing)
return;
if(shockerId is null)
foreach (string shocker in _shockerIds)
ControlInternal(action, shocker, intensity, duration);
else
ControlInternal(action, shockerId, intensity, duration);
}
protected abstract void ControlInternal(ControlAction action, string shockerId, int intensity, int duration);
protected Shocker(string endpoint, string apiKey, string[] shockerIds, ConfiguredInteger intensity, ConfiguredInteger duration)
{
this.Endpoint = endpoint;
this.ApiKey = apiKey;
this.HttpClient = new HttpClient();
this._shockerIds = shockerIds;
this._intensity = intensity;
this._duration = duration;
}
}

View File

@ -0,0 +1,29 @@
using CS2GSI;
using CShocker.Shockers;
namespace OpenCS2hock;
public struct ShockerAction
{
public CS2Event TriggerEvent;
// ReSharper disable thrice FieldCanBeMadeReadOnly.Global JsonDeserializer will throw a fit
public List<string> ShockerIds;
public ControlAction Action;
public bool ValueFromInput;
public ShockerAction(CS2Event trigger, List<string> shockerIds, ControlAction action, bool valueFromInput = false)
{
this.TriggerEvent = trigger;
this.ShockerIds = shockerIds;
this.Action = action;
this.ValueFromInput = valueFromInput;
}
public override string ToString()
{
return $"Trigger Event: {Enum.GetName(typeof(CS2Event), this.TriggerEvent)}\n" +
$"ShockerIds: {string.Join(", ", ShockerIds)}\n" +
$"Action: {Enum.GetName(typeof(ControlAction), this.Action)}\n" +
$"ValueFromInput: {ValueFromInput}";
}
}

View File

@ -1,23 +0,0 @@
"OpenCS2hock"
{
"uri" "http://127.0.0.1:3000"
"timeout" "2.0"
"buffer" "0.0"
"throttle" "0.1"
"heartbeat" "60.0"
"output"
{
"precision_time" "3"
"precision_position" "1"
"precision_vector" "3"
}
"data"
{
"provider" "1" // general info about client being listened to: game name, appid, client steamid, etc.
"map" "1" // map, gamemode, and current match phase ('warmup', 'intermission', 'gameover', 'live') and current score
"round" "1" // round phase ('freezetime', 'over', 'live'), bomb state ('planted', 'exploded', 'defused'), and round winner (if any)
"player_id" "1" // player name, clan tag, observer slot (ie key to press to observe this player) and team
"player_state" "1" // player state for this current round such as health, armor, kills this round, etc.
"player_match_stats" "1" // player stats this match such as kill, assists, score, deaths and MVPs
}
}

125
README.md
View File

@ -1,49 +1,104 @@
Example `config.json`. Place next to executable. Will also be generated on first start.
```
# OpenCS2hock
![GitHub License](https://img.shields.io/github/license/c9glax/OpenCS2hock)
![GitHub Release](https://img.shields.io/github/v/release/c9glax/OpenCS2hock)
Electrifying your Counter-Strike experience. With [OpenShock](https://openshock.org/)!
## How to use
Download [latest Release](https://github.com/C9Glax/OpenCS2hock/releases/latest) and execute.
Example `config.json`. Place next to executable. Will also be generated on first start.
```json
{
"SteamId": "<Your SteamId>",
"OpenShockSettings": {
"Endpoint": "https://api.shocklink.net",
"ApiKey": "<Your Shocklink API Key>",
"Shockers": [ "<Shocker Id> comma seperated" ]
},
"IntensityRange": {
"Min": 30,
"Max": 60
},
"DurationRange": {
"Min": 1000,
"Max": 1000
},
"Actions": {
"OnKill": "Beep",
"OnDeath": "Shock",
"OnRoundStart": "Nothing",
"OnRoundEnd": "Vibrate",
"OnRoundWin": "Nothing",
"OnRoundLoss": "Shock"
}
"LogLevel": 2,
"Shockers": [
{
"ShockerIds": [
"ID HERE"
],
"IntensityRange": {
"Min": 30,
"Max": 50
},
"DurationRange": {
"Min": 1000,
"Max": 1000
},
"ApiType": 0,
"Endpoint": "https://api.shocklink.net",
"ApiKey": "API KEY HERE"
}
],
"ShockerActions": [
{
"TriggerEvent": 2,
"ShockerIds": [
"SAME ID HERE"
],
"Action": 2,
"ValueFromInput": false
}
]
}
```
### SteamId
Your SteamId64 [here](https://steamid.io/lookup)
## LogLevel
[Levels](https://learn.microsoft.com/de-de/dotnet/api/microsoft.extensions.logging.loglevel?view=dotnet-plat-ext-8.0)
## Shockers
### ApiKey
For OpenShock get token [here](https://shocklink.net/#/dashboard/tokens)
- For OpenShock (HTTP) get token [here](https://shocklink.net/#/dashboard/tokens)
- For PiShock (HTTP) get information [here](https://apidocs.pishock.com/#header-authenticating)
### Shockers
List of Shocker-Ids, comma seperated. Get Id [here](https://shocklink.net/#/dashboard/shockers/own). Press the three dots -> Edit
### ApiType
CShocker [![Github](https://img.shields.io/badge/Github-8A2BE2)](https://github.com/C9Glax/cshocker) [here](https://github.com/C9Glax/CShocker/blob/master/CShocker/Shockers/Abstract/ShockerApi.cs)
Example `[ "ID-1", "ID-2" ]`
### ShockerIds
List of Shocker-Ids, comma seperated.
`[ "ID-1-asdasd", "ID-2-fghfgh" ]`
### Intensity Range
`0-100`
in percent
`0-100`
### Duration Range
in ms
- `0-30000` OpenShock
- `0-15000` PiShock
### Values for `Actions`
- Beep
- Shock
- Vibrate
### Username (PiShockHttp only)
For PiShock (HTTP) get information [here](https://apidocs.pishock.com/#header-authenticating)
### Sharecode (PiShockHttp only)
For PiShock (HTTP) get information [here](https://apidocs.pishock.com/#header-authenticating)
## ShockerActions
### TriggerEvent IDs
From CS2GSI [![Github](https://img.shields.io/badge/Github-8A2BE2)](https://github.com/C9Glax/CS2GSI) [here](https://github.com/C9Glax/CS2GSI/blob/master/CS2GSI/CS2Event.cs)
### ShockerIds
List of Shocker-Ids, comma seperated. (Same as in configured Shocker)
`[ "ID-1", "ID-2" ]`
### Actions
From CShocker [![Github](https://img.shields.io/badge/Github-8A2BE2)](https://github.com/C9Glax/cshocker) [here](https://github.com/C9Glax/CShocker/blob/master/CShocker/Shockers/ControlAction.cs)
### ValueFromInput
Use CS2GSI EventArgs value to determine Intensity (within configured IntensityRange)
# Using
### CS2GSI
[![GitHub License](https://img.shields.io/github/license/c9glax/CS2GSI)](https://img.shields.io/github/license/c9glax/CS2GSI/LICENSE)
[![NuGet Version](https://img.shields.io/nuget/v/CS2GSI)](https://www.nuget.org/packages/CS2GSI/)
[![Github](https://img.shields.io/badge/Github-8A2BE2)](https://github.com/C9Glax/CS2GSI)
[![GitHub Release](https://img.shields.io/github/v/release/c9glax/CS2GSI)](https://github.com/C9Glax/CS2GSI/releases/latest)
### CShocker
[![GitHub License](https://img.shields.io/github/license/c9glax/cshocker)](https://github.com/C9Glax/CShocker)
[![Github](https://img.shields.io/badge/Github-8A2BE2)](https://github.com/C9Glax/cshocker)
[![NuGet Version](https://img.shields.io/nuget/v/CShocker)](https://shields.io/badges/nu-get-version)