On oxide, I get this error when trying to load the plugin:
[CSharp] Started Oxide.Compiler v successfully
Error while compiling CaseSystem: A constant value is expected | Line: 857, Pos: 18
The compile error is coming from this block:
switch (arg.Args[0])
{
case "SELL":
arg.Args[0] is not being treated cleanly as a string by the Oxide compiler, so it complains at the first string case.
I patched it to force the console argument into a string first:
var action = arg.Args != null && arg.Args.Length > 0 ? arg.Args[0].ToString() : string.Empty;
switch (action)
{
But then upon reload I got:
[CSharp] Started Oxide.Compiler v successfully
Error while compiling CaseSystem: Argument 1: cannot convert from 'Facepunch.StringView' to 'string' | Line: 861, Pos: 61
The specific line is this pattern:
var id = arg.Args[1];
var reward = _config.RewardList.FirstOrDefault(p => p.RewardID == id);
arg.Args[1] is now a Facepunch.StringView, but RewardID is a string, so the compiler will not compare them directly.
I patched the whole console command section properly this time by converting all arg.Args values into a normal string[] first:
var args = arg.Args == null ? new string[0] : arg.Args.Select(x => x.ToString()).ToArray();
this fixed it, but thought you might want to take a look at it
CaseSystem_patched_v3.cs