declutter and more functions
This commit is contained in:
parent
6bfd45a8b0
commit
129b76c0ca
|
@ -0,0 +1,364 @@
|
||||||
|
using System.Numerics;
|
||||||
|
using BattleBitAPI.Common;
|
||||||
|
|
||||||
|
namespace CommunityServerAPI;
|
||||||
|
|
||||||
|
public class APICommand
|
||||||
|
{
|
||||||
|
public string CommandPrefix = string.Empty;
|
||||||
|
public string Help = string.Empty;
|
||||||
|
|
||||||
|
public Command ChatCommand(MyPlayer player, ChatChannel channel, string msg)
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public class HealCommand : APICommand
|
||||||
|
{
|
||||||
|
public new string CommandPrefix = "!heal";
|
||||||
|
|
||||||
|
public new string Help =
|
||||||
|
"'steamid' 'amount': Heals specific player the specified amount";
|
||||||
|
|
||||||
|
public new Command ChatCommand(MyPlayer player, ChatChannel channel, string msg)
|
||||||
|
{
|
||||||
|
var splits = msg.Split(" ");
|
||||||
|
var c = new Command
|
||||||
|
{
|
||||||
|
StreamerId = Convert.ToUInt64(splits[1]),
|
||||||
|
Action = ActionType.Heal,
|
||||||
|
Amount = int.Parse(splits[2]),
|
||||||
|
ExecutorName = "Chat Test"
|
||||||
|
};
|
||||||
|
return c;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public class KillCommand : APICommand
|
||||||
|
{
|
||||||
|
public new string CommandPrefix = "!kill";
|
||||||
|
public new string Help = "'steamid': Kills specific player";
|
||||||
|
|
||||||
|
public new static Command ChatCommand(MyPlayer player, ChatChannel channel, string msg)
|
||||||
|
{
|
||||||
|
var splits = msg.Split(" ");
|
||||||
|
var c = new Command
|
||||||
|
{
|
||||||
|
StreamerId = Convert.ToUInt64(splits[1]),
|
||||||
|
Action = ActionType.Kill,
|
||||||
|
Amount = 0,
|
||||||
|
ExecutorName = "Chat Test"
|
||||||
|
};
|
||||||
|
return c;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public class GrenadeCommand : APICommand
|
||||||
|
{
|
||||||
|
public new string CommandPrefix = "!grenade";
|
||||||
|
public new string Help = "'steamid': spawns live grenade on specific player";
|
||||||
|
|
||||||
|
public new Command ChatCommand(MyPlayer player, ChatChannel channel, string msg)
|
||||||
|
{
|
||||||
|
var splits = msg.Split(" ");
|
||||||
|
var c = new Command
|
||||||
|
{
|
||||||
|
StreamerId = Convert.ToUInt64(splits[1]),
|
||||||
|
Action = ActionType.Grenade,
|
||||||
|
Amount = 0,
|
||||||
|
ExecutorName = "Chat Test"
|
||||||
|
};
|
||||||
|
return c;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public class TeleportCommand : APICommand
|
||||||
|
{
|
||||||
|
public new string CommandPrefix = "!teleport";
|
||||||
|
public new string Help = "'steamid' 'vector': tps specific player to vector location";
|
||||||
|
|
||||||
|
public new Command ChatCommand(MyPlayer player, ChatChannel channel, string msg)
|
||||||
|
{
|
||||||
|
var splits = msg.Split(" ");
|
||||||
|
var vectorStr = splits[2].Split(",");
|
||||||
|
var vector = new Vector3
|
||||||
|
{
|
||||||
|
X = Convert.ToSingle(vectorStr[0]),
|
||||||
|
Y = Convert.ToSingle(vectorStr[1]),
|
||||||
|
Z = Convert.ToSingle(vectorStr[1])
|
||||||
|
};
|
||||||
|
|
||||||
|
var c = new Command
|
||||||
|
{
|
||||||
|
StreamerId = Convert.ToUInt64(splits[1]),
|
||||||
|
Action = ActionType.Teleport,
|
||||||
|
Amount = 0,
|
||||||
|
Location = vector,
|
||||||
|
ExecutorName = "Chat Test"
|
||||||
|
};
|
||||||
|
return c;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public class SpeedCommand : APICommand
|
||||||
|
{
|
||||||
|
public new string CommandPrefix = "!speed";
|
||||||
|
|
||||||
|
public new string Help =
|
||||||
|
"'steamid' 'amount': Sets speed multiplier of specific player the specified amount";
|
||||||
|
|
||||||
|
public new Command ChatCommand(MyPlayer player, ChatChannel channel, string msg)
|
||||||
|
{
|
||||||
|
var splits = msg.Split(" ");
|
||||||
|
var c = new Command
|
||||||
|
{
|
||||||
|
StreamerId = Convert.ToUInt64(splits[1]),
|
||||||
|
Action = ActionType.Help,
|
||||||
|
Amount = int.Parse(splits[2]),
|
||||||
|
ExecutorName = "Chat Test"
|
||||||
|
};
|
||||||
|
return c;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public class ChangeAttachmentCommand : APICommand
|
||||||
|
{
|
||||||
|
public new string CommandPrefix = "!changeAttachment";
|
||||||
|
|
||||||
|
public new string Help =
|
||||||
|
"'steamid' 'pri=Attachment' 'sec=Attachment': the attachements of specific player the specified amount";
|
||||||
|
|
||||||
|
public new Command ChatCommand(MyPlayer player, ChatChannel channel, string msg)
|
||||||
|
{
|
||||||
|
var splits = msg.Split(" ");
|
||||||
|
var c = new Command
|
||||||
|
{
|
||||||
|
StreamerId = Convert.ToUInt64(splits[1]),
|
||||||
|
Action = ActionType.ChangeAttachement,
|
||||||
|
Amount = int.Parse(splits[2]),
|
||||||
|
AttachmentChange = Utility.ParseAttachments(splits),
|
||||||
|
ExecutorName = "Chat Test"
|
||||||
|
};
|
||||||
|
return c;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public class ChangeWeaponCommand : APICommand
|
||||||
|
{
|
||||||
|
public new string CommandPrefix = "!changeWeapon";
|
||||||
|
|
||||||
|
public new string Help =
|
||||||
|
"'steamid' 'pri=Weapon' 'sec=Weapon': the weapons of specific player the specified amount";
|
||||||
|
|
||||||
|
public new Command ChatCommand(MyPlayer player, ChatChannel channel, string msg)
|
||||||
|
{
|
||||||
|
var splits = msg.Split(" ");
|
||||||
|
var c = new Command
|
||||||
|
{
|
||||||
|
StreamerId = Convert.ToUInt64(splits[1]),
|
||||||
|
Action = ActionType.ChangeAttachement,
|
||||||
|
Amount = int.Parse(splits[2]),
|
||||||
|
AttachmentChange = Utility.ParseAttachments(splits),
|
||||||
|
ExecutorName = "Chat Test"
|
||||||
|
};
|
||||||
|
return c;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public class ForceStartCommand : APICommand
|
||||||
|
{
|
||||||
|
public new string CommandPrefix = "!forceStart";
|
||||||
|
|
||||||
|
public new string Help =
|
||||||
|
": forces the game to start";
|
||||||
|
|
||||||
|
public new Command ChatCommand(MyPlayer player, ChatChannel channel, string msg)
|
||||||
|
{
|
||||||
|
var c = new Command
|
||||||
|
{
|
||||||
|
Action = ActionType.Start,
|
||||||
|
ExecutorName = "Chat Test"
|
||||||
|
};
|
||||||
|
return c;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public class HelpCommand : APICommand
|
||||||
|
{
|
||||||
|
public new string CommandPrefix = "!help";
|
||||||
|
|
||||||
|
public new string Help =
|
||||||
|
": lists all commands";
|
||||||
|
|
||||||
|
public new Command ChatCommand(MyPlayer player, ChatChannel channel, string msg)
|
||||||
|
{
|
||||||
|
var c = new Command
|
||||||
|
{
|
||||||
|
Action = ActionType.Help,
|
||||||
|
ExecutorName = "Chat Test"
|
||||||
|
};
|
||||||
|
return c;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public class RevealCommand : APICommand
|
||||||
|
{
|
||||||
|
public new string CommandPrefix = "!reveal";
|
||||||
|
|
||||||
|
public new string Help =
|
||||||
|
"'steamid': reveal information about the specified player";
|
||||||
|
|
||||||
|
public new Command ChatCommand(MyPlayer player, ChatChannel channel, string msg)
|
||||||
|
{
|
||||||
|
var splits = msg.Split(" ");
|
||||||
|
var c = new Command
|
||||||
|
{
|
||||||
|
StreamerId = Convert.ToUInt64(splits[1]),
|
||||||
|
Action = ActionType.Reveal,
|
||||||
|
ExecutorName = "Chat Test"
|
||||||
|
};
|
||||||
|
return c;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public class ChangeDamageCommand : APICommand
|
||||||
|
{
|
||||||
|
public new string CommandPrefix = "!changeDamage";
|
||||||
|
|
||||||
|
public new string Help =
|
||||||
|
"'steamid' 'amount': change the damage of the specified player";
|
||||||
|
|
||||||
|
public new Command ChatCommand(MyPlayer player, ChatChannel channel, string msg)
|
||||||
|
{
|
||||||
|
var splits = msg.Split(" ");
|
||||||
|
var c = new Command
|
||||||
|
{
|
||||||
|
StreamerId = Convert.ToUInt64(splits[1]),
|
||||||
|
Action = ActionType.ChangeDamage,
|
||||||
|
Amount = int.Parse(splits[2]),
|
||||||
|
ExecutorName = "Chat Test"
|
||||||
|
};
|
||||||
|
return c;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public class ChangeReceivedDamageCommand : APICommand
|
||||||
|
{
|
||||||
|
public new string CommandPrefix = "!changeReceivedDamage";
|
||||||
|
|
||||||
|
public new string Help =
|
||||||
|
"'steamid' 'amount': change the received damage of the specified player";
|
||||||
|
|
||||||
|
public new Command ChatCommand(MyPlayer player, ChatChannel channel, string msg)
|
||||||
|
{
|
||||||
|
var splits = msg.Split(" ");
|
||||||
|
var c = new Command
|
||||||
|
{
|
||||||
|
StreamerId = Convert.ToUInt64(splits[1]),
|
||||||
|
Action = ActionType.ChangeReceivedDamage,
|
||||||
|
Amount = int.Parse(splits[2]),
|
||||||
|
ExecutorName = "Chat Test"
|
||||||
|
};
|
||||||
|
return c;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public class ChangeAmmoCommand : APICommand
|
||||||
|
{
|
||||||
|
public new string CommandPrefix = "!changeAmmo";
|
||||||
|
|
||||||
|
public new string Help =
|
||||||
|
"'steamid' 'amount': change the ammo of the specified player";
|
||||||
|
|
||||||
|
public new Command ChatCommand(MyPlayer player, ChatChannel channel, string msg)
|
||||||
|
{
|
||||||
|
var splits = msg.Split(" ");
|
||||||
|
var c = new Command
|
||||||
|
{
|
||||||
|
StreamerId = Convert.ToUInt64(splits[1]),
|
||||||
|
Action = ActionType.ChangeAmmo,
|
||||||
|
Amount = int.Parse(splits[2]),
|
||||||
|
ExecutorName = "Chat Test"
|
||||||
|
};
|
||||||
|
return c;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public class SetStreamerCommand : APICommand
|
||||||
|
{
|
||||||
|
public new string CommandPrefix = "!setStreamer";
|
||||||
|
|
||||||
|
public new string Help =
|
||||||
|
"'steamid': set the specified player as the streamer";
|
||||||
|
|
||||||
|
public new Command ChatCommand(MyPlayer player, ChatChannel channel, string msg)
|
||||||
|
{
|
||||||
|
var splits = msg.Split(" ");
|
||||||
|
var c = new Command
|
||||||
|
{
|
||||||
|
StreamerId = Convert.ToUInt64(splits[1]),
|
||||||
|
Action = ActionType.SetStreamer,
|
||||||
|
ExecutorName = "Chat Test"
|
||||||
|
};
|
||||||
|
return c;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public class RemoveStreamerCommand : APICommand
|
||||||
|
{
|
||||||
|
public new string CommandPrefix = "!rmStreamer";
|
||||||
|
|
||||||
|
public new string Help =
|
||||||
|
"'steamid': remove the streamer status from the specified player";
|
||||||
|
|
||||||
|
public new Command ChatCommand(MyPlayer player, ChatChannel channel, string msg)
|
||||||
|
{
|
||||||
|
var splits = msg.Split(" ");
|
||||||
|
var c = new Command
|
||||||
|
{
|
||||||
|
StreamerId = Convert.ToUInt64(splits[1]),
|
||||||
|
Action = ActionType.RemoveStreamer,
|
||||||
|
ExecutorName = "Chat Test"
|
||||||
|
};
|
||||||
|
return c;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public class OpCommand : APICommand
|
||||||
|
{
|
||||||
|
public new string CommandPrefix = "!op";
|
||||||
|
|
||||||
|
public new string Help =
|
||||||
|
"'steamid': grant operator privileges to the specified player";
|
||||||
|
|
||||||
|
public new Command ChatCommand(MyPlayer player, ChatChannel channel, string msg)
|
||||||
|
{
|
||||||
|
var splits = msg.Split(" ");
|
||||||
|
var c = new Command
|
||||||
|
{
|
||||||
|
StreamerId = Convert.ToUInt64(splits[1]),
|
||||||
|
Action = ActionType.GrantOP,
|
||||||
|
ExecutorName = "Chat Test"
|
||||||
|
};
|
||||||
|
return c;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public class DeopCommand : APICommand
|
||||||
|
{
|
||||||
|
public new string CommandPrefix = "!deop";
|
||||||
|
|
||||||
|
public new string Help =
|
||||||
|
"'steamid': revoke operator privileges from the specified player";
|
||||||
|
|
||||||
|
public new Command ChatCommand(MyPlayer player, ChatChannel channel, string msg)
|
||||||
|
{
|
||||||
|
var splits = msg.Split(" ");
|
||||||
|
var c = new Command
|
||||||
|
{
|
||||||
|
StreamerId = Convert.ToUInt64(splits[1]),
|
||||||
|
Action = ActionType.RevokeOP,
|
||||||
|
ExecutorName = "Chat Test"
|
||||||
|
};
|
||||||
|
return c;
|
||||||
|
}
|
||||||
|
}
|
|
@ -11,5 +11,10 @@ public enum ActionType
|
||||||
ChangeDamage,
|
ChangeDamage,
|
||||||
ChangeReceivedDamage,
|
ChangeReceivedDamage,
|
||||||
ChangeAmmo,
|
ChangeAmmo,
|
||||||
Help
|
Help,
|
||||||
|
Start,
|
||||||
|
SetStreamer,
|
||||||
|
RemoveStreamer,
|
||||||
|
GrantOP,
|
||||||
|
RevokeOP
|
||||||
}
|
}
|
342
Program.cs
342
Program.cs
|
@ -1,5 +1,4 @@
|
||||||
using System.Numerics;
|
using System.Text.Json;
|
||||||
using System.Text.Json;
|
|
||||||
using BattleBitAPI;
|
using BattleBitAPI;
|
||||||
using BattleBitAPI.Common;
|
using BattleBitAPI.Common;
|
||||||
using BattleBitAPI.Server;
|
using BattleBitAPI.Server;
|
||||||
|
@ -15,7 +14,7 @@ internal class Program
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
internal class MyPlayer : Player<MyPlayer>
|
public class MyPlayer : Player<MyPlayer>
|
||||||
{
|
{
|
||||||
public bool isAdmin;
|
public bool isAdmin;
|
||||||
public bool isStreamer;
|
public bool isStreamer;
|
||||||
|
@ -28,7 +27,18 @@ internal class MyGameServer : GameServer<MyPlayer>
|
||||||
new HealCommand(),
|
new HealCommand(),
|
||||||
new KillCommand(),
|
new KillCommand(),
|
||||||
new TeleportCommand(),
|
new TeleportCommand(),
|
||||||
new GrenadeCommand()
|
new GrenadeCommand(),
|
||||||
|
new ForceStartCommand(),
|
||||||
|
new SpeedCommand(),
|
||||||
|
new HelpCommand(),
|
||||||
|
new RevealCommand(),
|
||||||
|
new ChangeDamageCommand(),
|
||||||
|
new ChangeReceivedDamageCommand(),
|
||||||
|
new ChangeAmmoCommand(),
|
||||||
|
new SetStreamerCommand(),
|
||||||
|
new RemoveStreamerCommand(),
|
||||||
|
new OpCommand(),
|
||||||
|
new DeopCommand()
|
||||||
};
|
};
|
||||||
|
|
||||||
private readonly string mAdminJson = "./config/admins.json";
|
private readonly string mAdminJson = "./config/admins.json";
|
||||||
|
@ -72,6 +82,24 @@ internal class MyGameServer : GameServer<MyPlayer>
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void SaveAdmins()
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var newJson =
|
||||||
|
JsonSerializer.Serialize(mAdmins, new JsonSerializerOptions { WriteIndented = true });
|
||||||
|
|
||||||
|
// Write the JSON to the file, overwriting its content
|
||||||
|
File.WriteAllText(mAdminJson, newJson);
|
||||||
|
|
||||||
|
Console.WriteLine("Admins updated and saved to the file.");
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
Console.WriteLine("Admins couldn't be updated and saved to the file." + ex);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public override async Task OnConnected()
|
public override async Task OnConnected()
|
||||||
{
|
{
|
||||||
await Console.Out.WriteLineAsync(GameIP + " Connected");
|
await Console.Out.WriteLineAsync(GameIP + " Connected");
|
||||||
|
@ -182,290 +210,58 @@ internal class MyGameServer : GameServer<MyPlayer>
|
||||||
}
|
}
|
||||||
case ActionType.ChangeAmmo:
|
case ActionType.ChangeAmmo:
|
||||||
{
|
{
|
||||||
//set marker on Map
|
|
||||||
player.Message($"{c.ExecutorName} has set your Ammo to {c.Amount}");
|
player.Message($"{c.ExecutorName} has set your Ammo to {c.Amount}");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
case ActionType.Start:
|
||||||
|
{
|
||||||
|
player.Message("Forcing start");
|
||||||
|
ForceStartGame();
|
||||||
|
break;
|
||||||
|
}
|
||||||
case ActionType.Help:
|
case ActionType.Help:
|
||||||
{
|
{
|
||||||
foreach (var command in ChatCommands) SayToChat($"{command.CommandPrefix} {command.Help}");
|
foreach (var command in ChatCommands) SayToChat($"{command.CommandPrefix} {command.Help}");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
case ActionType.ChangeDamage:
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public class APICommand
|
|
||||||
{
|
|
||||||
public string CommandPrefix = string.Empty;
|
|
||||||
public string Help = string.Empty;
|
|
||||||
|
|
||||||
public Command ChatCommand(MyPlayer player, ChatChannel channel, string msg)
|
|
||||||
{
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public class HealCommand : APICommand
|
|
||||||
{
|
|
||||||
public new string CommandPrefix = "!heal";
|
|
||||||
|
|
||||||
public new string Help =
|
|
||||||
"'steamid' 'amount': Heals specific player the specified amount";
|
|
||||||
|
|
||||||
public new Command ChatCommand(MyPlayer player, ChatChannel channel, string msg)
|
|
||||||
{
|
|
||||||
var splits = msg.Split(" ");
|
|
||||||
var c = new Command
|
|
||||||
{
|
|
||||||
StreamerId = Convert.ToUInt64(splits[1]),
|
|
||||||
Action = ActionType.Heal,
|
|
||||||
Amount = int.Parse(splits[2]),
|
|
||||||
ExecutorName = "Chat Test"
|
|
||||||
};
|
|
||||||
return c;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public class KillCommand : APICommand
|
|
||||||
{
|
|
||||||
public new string CommandPrefix = "!kill";
|
|
||||||
public new string Help = "'steamid': Kills specific player";
|
|
||||||
|
|
||||||
public new static Command ChatCommand(MyPlayer player, ChatChannel channel, string msg)
|
|
||||||
{
|
|
||||||
var splits = msg.Split(" ");
|
|
||||||
var c = new Command
|
|
||||||
{
|
|
||||||
StreamerId = Convert.ToUInt64(splits[1]),
|
|
||||||
Action = ActionType.Kill,
|
|
||||||
Amount = 0,
|
|
||||||
ExecutorName = "Chat Test"
|
|
||||||
};
|
|
||||||
return c;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public class GrenadeCommand : APICommand
|
|
||||||
{
|
|
||||||
public new string CommandPrefix = "!grenade";
|
|
||||||
public new string Help = "'steamid': spawns live grenade on specific player";
|
|
||||||
|
|
||||||
public new Command ChatCommand(MyPlayer player, ChatChannel channel, string msg)
|
|
||||||
{
|
|
||||||
var splits = msg.Split(" ");
|
|
||||||
var c = new Command
|
|
||||||
{
|
|
||||||
StreamerId = Convert.ToUInt64(splits[1]),
|
|
||||||
Action = ActionType.Grenade,
|
|
||||||
Amount = 0,
|
|
||||||
ExecutorName = "Chat Test"
|
|
||||||
};
|
|
||||||
return c;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public class TeleportCommand : APICommand
|
|
||||||
{
|
|
||||||
public new string CommandPrefix = "!teleport";
|
|
||||||
public new string Help = "'steamid' 'vector': tps specific player to vector location";
|
|
||||||
|
|
||||||
public new Command ChatCommand(MyPlayer player, ChatChannel channel, string msg)
|
|
||||||
{
|
|
||||||
var splits = msg.Split(" ");
|
|
||||||
var vectorStr = splits[2].Split(",");
|
|
||||||
var vector = new Vector3
|
|
||||||
{
|
|
||||||
X = Convert.ToSingle(vectorStr[0]),
|
|
||||||
Y = Convert.ToSingle(vectorStr[1]),
|
|
||||||
Z = Convert.ToSingle(vectorStr[1])
|
|
||||||
};
|
|
||||||
|
|
||||||
var c = new Command
|
|
||||||
{
|
|
||||||
StreamerId = Convert.ToUInt64(splits[1]),
|
|
||||||
Action = ActionType.Teleport,
|
|
||||||
Amount = 0,
|
|
||||||
Location = vector,
|
|
||||||
ExecutorName = "Chat Test"
|
|
||||||
};
|
|
||||||
return c;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public class SpeedCommand : APICommand
|
|
||||||
{
|
|
||||||
public new string CommandPrefix = "!speed";
|
|
||||||
|
|
||||||
public new string Help =
|
|
||||||
"'steamid' 'amount': Sets speed multiplier of specific player the specified amount";
|
|
||||||
|
|
||||||
public new Command ChatCommand(MyPlayer player, ChatChannel channel, string msg)
|
|
||||||
{
|
|
||||||
var splits = msg.Split(" ");
|
|
||||||
var c = new Command
|
|
||||||
{
|
|
||||||
StreamerId = Convert.ToUInt64(splits[1]),
|
|
||||||
Action = ActionType.Help,
|
|
||||||
Amount = int.Parse(splits[2]),
|
|
||||||
ExecutorName = "Chat Test"
|
|
||||||
};
|
|
||||||
return c;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public class ChangeAttachmentCommand : APICommand
|
|
||||||
{
|
|
||||||
public new string CommandPrefix = "!changeAttachment";
|
|
||||||
|
|
||||||
public new string Help =
|
|
||||||
"'steamid' 'pri=Attachment' 'sec=Attachment': the attachements of specific player the specified amount";
|
|
||||||
|
|
||||||
public new Command ChatCommand(MyPlayer player, ChatChannel channel, string msg)
|
|
||||||
{
|
|
||||||
var splits = msg.Split(" ");
|
|
||||||
var c = new Command
|
|
||||||
{
|
|
||||||
StreamerId = Convert.ToUInt64(splits[1]),
|
|
||||||
Action = ActionType.ChangeAttachement,
|
|
||||||
Amount = int.Parse(splits[2]),
|
|
||||||
AttachmentChange = Utility.ParseAttachments(splits),
|
|
||||||
ExecutorName = "Chat Test"
|
|
||||||
};
|
|
||||||
return c;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public class ChangeWeaponCommand : APICommand
|
|
||||||
{
|
|
||||||
public new string CommandPrefix = "!changeWeapon";
|
|
||||||
|
|
||||||
public new string Help =
|
|
||||||
"'steamid' 'pri=Weapon' 'sec=Weapon': the weapons of specific player the specified amount";
|
|
||||||
|
|
||||||
public new Command ChatCommand(MyPlayer player, ChatChannel channel, string msg)
|
|
||||||
{
|
|
||||||
var splits = msg.Split(" ");
|
|
||||||
var c = new Command
|
|
||||||
{
|
|
||||||
StreamerId = Convert.ToUInt64(splits[1]),
|
|
||||||
Action = ActionType.ChangeAttachement,
|
|
||||||
Amount = int.Parse(splits[2]),
|
|
||||||
AttachmentChange = Utility.ParseAttachments(splits),
|
|
||||||
ExecutorName = "Chat Test"
|
|
||||||
};
|
|
||||||
return c;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
|
|
||||||
|
|
||||||
case "!changeWeapon":
|
|
||||||
{
|
|
||||||
c.Action = ActionType.ChangeWeapon;
|
|
||||||
c.Amount = 1;
|
|
||||||
c.Data = splits.Skip(0).Take(splits.Length);
|
|
||||||
c.ExecutorName = "Tester";
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case "!reveal":
|
|
||||||
{
|
|
||||||
c.Action = ActionType.Reveal;
|
|
||||||
c.Amount = 10;
|
|
||||||
c.ExecutorName = "Tester";
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case "!changeDamage":
|
|
||||||
{
|
|
||||||
c.Action = ActionType.ChangeDamage;
|
|
||||||
c.Amount = Int32.Parse(splits[1]);
|
|
||||||
c.ExecutorName = "Tester";
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case "!changeRecievedDamage":
|
|
||||||
{
|
|
||||||
c.Action = ActionType.ChangeReceivedDamage;
|
|
||||||
c.Amount = Int32.Parse(splits[1]);
|
|
||||||
c.ExecutorName = "Tester";
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case "!changeAmmo":
|
|
||||||
{
|
|
||||||
c.Action = ActionType.ChangeAmmo;
|
|
||||||
c.Amount = Int32.Parse(splits[2]);
|
|
||||||
c.ExecutorName = "Tester";
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case "!setStreamer":
|
|
||||||
{
|
|
||||||
var newId = Convert.ToUInt64(splits[1]);
|
|
||||||
player.Message($"{newId} is now a Streamer");
|
|
||||||
mListedStreamers.Add(newId);
|
|
||||||
foreach (var p in AllPlayers)
|
|
||||||
{
|
{
|
||||||
if (p.SteamID == newId)
|
player.SetGiveDamageMultiplier(c.Amount);
|
||||||
{
|
player.Message($"{c.ExecutorName} has set your Dmg Multiplier to {c.Amount}");
|
||||||
p.isStreamer = true;
|
break;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
SaveStreamers();
|
case ActionType.ChangeReceivedDamage:
|
||||||
return true;
|
|
||||||
}
|
|
||||||
case "!rmStreamer":
|
|
||||||
{
|
|
||||||
var newId = Convert.ToUInt64(splits[1]);
|
|
||||||
player.Message($"{newId} is now a Streamer");
|
|
||||||
mListedStreamers.Remove(newId);
|
|
||||||
foreach (var p in AllPlayers)
|
|
||||||
{
|
{
|
||||||
if (p.SteamID == newId)
|
player.SetReceiveDamageMultiplier(c.Amount);
|
||||||
{
|
player.Message($"{c.ExecutorName} has set your recieve Dmg Multiplier to {c.Amount}");
|
||||||
p.isStreamer = false;
|
break;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
SaveStreamers();
|
case ActionType.SetStreamer:
|
||||||
return true;
|
|
||||||
}
|
|
||||||
case "!op":
|
|
||||||
{
|
|
||||||
var newId = Convert.ToUInt64(splits[1]);
|
|
||||||
player.Message($"{newId} is now an Admin");
|
|
||||||
mAdmins.Add(newId);
|
|
||||||
foreach (var p in AllPlayers)
|
|
||||||
{
|
{
|
||||||
if (p.SteamID == newId)
|
player.isStreamer = true;
|
||||||
{
|
SaveStreamers();
|
||||||
p.isAdmin = true;
|
break;
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return true;
|
case ActionType.RemoveStreamer:
|
||||||
}
|
|
||||||
case "!deop":
|
|
||||||
{
|
|
||||||
var newId = Convert.ToUInt64(splits[1]);
|
|
||||||
player.Message($"{newId} is no longer an Admin");
|
|
||||||
mAdmins.Remove(newId);
|
|
||||||
foreach (var p in AllPlayers)
|
|
||||||
{
|
{
|
||||||
if (p.SteamID == newId)
|
player.isStreamer = false;
|
||||||
{
|
SaveStreamers();
|
||||||
p.isAdmin = false;
|
break;
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return true;
|
case ActionType.GrantOP:
|
||||||
|
{
|
||||||
|
player.isAdmin = true;
|
||||||
|
SaveAdmins();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case ActionType.RevokeOP:
|
||||||
|
{
|
||||||
|
player.isAdmin = false;
|
||||||
|
SaveAdmins();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
// Add more cases for other ActionType values as needed
|
||||||
}
|
}
|
||||||
case "!start":
|
}
|
||||||
{
|
}
|
||||||
player.Message($"Forcing start");
|
|
||||||
ForceStartGame();
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
case "!help":
|
|
||||||
{
|
|
||||||
SayToChat("Current commands:");
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
}
|
}
|
Loading…
Reference in New Issue