Skip to content
This repository was archived by the owner on Oct 22, 2024. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
78 changes: 47 additions & 31 deletions Commands/ForceBleedingCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,54 +21,70 @@ public class ForceBleedingCommand : IRocketCommand

public string Name => "forcebleeding";

public string Help => $"{Instance.DefaultTranslations.Translate("ForceBleedingHelp")}";
public string Help => $"{Instance.Translations.Instance.Translate("ForceBleedingHelp")}";

public string Syntax => $"/forcebl (name/steamid) - {Help}";

public List<string> Aliases => new List<string>() { "forcebl", "fbl" };
public List<string> Aliases => new List<string>() {"forcebl", "fbl"};

public List<string> Permissions => new List<string>() { "forcebleeding" };
public List<string> Permissions => new List<string>() {"forcebleeding"};

public void Execute(IRP caller, string[] command)
{
if (caller is UP)
if (caller is UP up)
{
UP up = (UP)caller;
if (command.Length == 1)
switch (command.Length)
{
if (!TryFindPlayer(command[0], out UP target))
case 1:
{
SendChat(up, $"{Instance.DefaultTranslations.Translate("ErrorIncorrectPlayer")}", Color.white);
return;
if (!TryFindPlayer(command[0], out var target))
{
SendChat(up, $"{Instance.Translations.Instance.Translate("ErrorIncorrectPlayer")}",
Color.white);
return;
}

target.Player.life.serverSetBleeding(true);
SendChat(up,
$"{Instance.Translations.Instance.Translate("SuccessfullyForceBleeding", target.CharacterName)}",
Color.white);
if (Config.MessageForceBleeding)
SendChat(target, $"{Instance.Translations.Instance.Translate("YouBleedingNow")}",
Color.white);
break;
}
target.Player.life.serverSetBleeding(true);
SendChat(up, $"{Instance.DefaultTranslations.Translate("SuccessfullyForceBleeding", target.CharacterName)}", Color.white);
if (Config.MessageForceBleeding)
SendChat(target, $"{Instance.DefaultTranslations.Translate("YouBleedingNow")}", Color.white);
}
else if (command.Length == 0)
{
up.Player.life.serverSetBleeding(true);
SendChat(up, $"{Instance.DefaultTranslations.Translate("SuccessfullyForceBleedingYourself")}", Color.white);
case 0:
up.Player.life.serverSetBleeding(true);
SendChat(up, $"{Instance.Translations.Instance.Translate("SuccessfullyForceBleedingYourself")}",
Color.white);
break;
default:
SendChat(up, $"{Syntax}", Color.white);
break;
}
else SendChat(up, $"{Syntax}", Color.white);
}
else
{
if (command.Length == 1)
if (command.Length != 1)
{
if (!TryFindPlayer(command[0], out UP target))
{
SendConsole($"{Instance.DefaultTranslations.Translate("ErrorIncorrectPlayer")}", ConsoleColor.White);
return;
}
target.Player.life.serverSetBleeding(true);
SendConsole($"{Instance.DefaultTranslations.Translate("SuccessfullyForceBleeding", target.CharacterName)}", ConsoleColor.White);
if (Config.MessageForceBleeding)
SendChat(target, $"{Instance.DefaultTranslations.Translate("YouBleedingNow")}", Color.white);
SendConsole($"{Syntax}", ConsoleColor.White);
return;
}
else SendConsole($"{Syntax}", ConsoleColor.White);

if (!TryFindPlayer(command[0], out var target))
{
SendConsole($"{Instance.Translations.Instance.Translate("ErrorIncorrectPlayer")}",
ConsoleColor.White);
return;
}

target.Player.life.serverSetBleeding(true);
SendConsole(
$"{Instance.Translations.Instance.Translate("SuccessfullyForceBleeding", target.CharacterName)}",
ConsoleColor.White);
if (Config.MessageForceBleeding)
SendChat(target, $"{Instance.Translations.Instance.Translate("YouBleedingNow")}", Color.white);
}
}
}
}
}
78 changes: 47 additions & 31 deletions Commands/ForceBrokenCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,54 +21,70 @@ public class ForceBrokenCommand : IRocketCommand

public string Name => "forcebroken";

public string Help => $"{Instance.DefaultTranslations.Translate("ForceBrokenHelp")}";
public string Help => $"{Instance.Translations.Instance.Translate("ForceBrokenHelp")}";

public string Syntax => $"/forcebr (name/steamid) - {Help}";

public List<string> Aliases => new List<string>() { "forcebr", "fbr" };
public List<string> Aliases => new List<string>() {"forcebr", "fbr"};

public List<string> Permissions => new List<string>() { "forcebroken" };
public List<string> Permissions => new List<string>() {"forcebroken"};

public void Execute(IRP caller, string[] command)
{
if (caller is UP)
if (caller is UP up)
{
UP up = (UP)caller;
if (command.Length == 1)
switch (command.Length)
{
if (!TryFindPlayer(command[0], out UP target))
case 1:
{
SendChat(up, $"{Instance.DefaultTranslations.Translate("ErrorIncorrectPlayer")}", Color.white);
return;
if (!TryFindPlayer(command[0], out var target))
{
SendChat(up, $"{Instance.Translations.Instance.Translate("ErrorIncorrectPlayer")}",
Color.white);
return;
}

target.Player.life.serverSetLegsBroken(true);
SendChat(up,
$"{Instance.Translations.Instance.Translate("SuccessfullyForceBroken", target.CharacterName)}",
Color.white);
if (Config.MessageForceBroken)
SendChat(target, $"{Instance.Translations.Instance.Translate("YourLegWasBroken")}",
Color.white);
break;
}
target.Player.life.serverSetLegsBroken(true);
SendChat(up, $"{Instance.DefaultTranslations.Translate("SuccessfullyForceBroken", target.CharacterName)}", Color.white);
if (Config.MessageForceBroken)
SendChat(target, $"{Instance.DefaultTranslations.Translate("YourLegWasBroken")}", Color.white);
}
else if (command.Length == 0)
{
up.Player.life.serverSetLegsBroken(true);
SendChat(up, $"{Instance.DefaultTranslations.Translate("SuccessfullyForceBrokenYourself")}", Color.white);
case 0:
up.Player.life.serverSetLegsBroken(true);
SendChat(up, $"{Instance.Translations.Instance.Translate("SuccessfullyForceBrokenYourself")}",
Color.white);
break;
default:
SendChat(up, $"{Syntax}", Color.white);
break;
}
else SendChat(up, $"{Syntax}", Color.white);
}
else
{
if (command.Length == 1)
if (command.Length != 1)
{
if (!TryFindPlayer(command[0], out UP target))
{
SendConsole($"{Instance.DefaultTranslations.Translate("ErrorIncorrectPlayer")}", ConsoleColor.White);
return;
}
target.Player.life.serverSetLegsBroken(true);
SendConsole($"{Instance.DefaultTranslations.Translate("SuccessfullyForceBroken", target.CharacterName)}", ConsoleColor.White);
if (Config.MessageForceBroken)
SendChat(target, $"{Instance.DefaultTranslations.Translate("YourLegWasBroken")}", Color.white);
SendConsole($"{Syntax}", ConsoleColor.White);
return;
}
else SendConsole($"{Syntax}", ConsoleColor.White);

if (!TryFindPlayer(command[0], out var target))
{
SendConsole($"{Instance.Translations.Instance.Translate("ErrorIncorrectPlayer")}",
ConsoleColor.White);
return;
}

target.Player.life.serverSetLegsBroken(true);
SendConsole(
$"{Instance.Translations.Instance.Translate("SuccessfullyForceBroken", target.CharacterName)}",
ConsoleColor.White);
if (Config.MessageForceBroken)
SendChat(target, $"{Instance.Translations.Instance.Translate("YourLegWasBroken")}", Color.white);
}
}
}
}
}
63 changes: 37 additions & 26 deletions Commands/HealBallCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,47 +19,58 @@ public class HealBallCommand : IRocketCommand

public string Name => "healball";

public string Help => $"{Instance.DefaultTranslations.Translate("HealBallHelp")}";
public string Help => $"{Instance.Translations.Instance.Translate("HealBallHelp")}";

public string Syntax => $"/healball [radius] - {Help}";

public List<string> Aliases => new List<string>() { "healb", "hball", "hb" };
public List<string> Aliases => new List<string>() {"healb", "hball", "hb"};

public List<string> Permissions => new List<string>() { "healball" };
public List<string> Permissions => new List<string>() {"healball"};

public void Execute(IRP caller, string[] command)
{
UP up = (UP)caller;
if (command.Length == 1)
var up = (UP) caller;
if (command.Length != 1)
{
if (command[0] == "*")
SendChat(up, $"{Syntax}", Color.white);
return;
}

if (command[0] == "*")
{
foreach (var pl in Provider.clients)
{
foreach (var pl in Provider.clients)
pl.player.Heal();
if (Config.MessageHeal)
SendChat(UP.FromSteamPlayer(pl), $"{Instance.Translations.Instance.Translate("YouWasHealed")}",
Color.white);
}

SendChat(up, $"{Instance.Translations.Instance.Translate("SuccessfullyHealed")}", Color.white);
}
else
{
if (int.Parse(command[0]) > 0 && int.Parse(command[0]) <= Config.MaximumRadius)
{
var pls = Provider.clients.FindAll(x =>
Vector3.Distance(up.Position, UP.FromSteamPlayer(x).Position) <= int.Parse(command[0]) &&
x.playerID.steamID.m_SteamID != up.CSteamID.m_SteamID);
foreach (var pl in pls)
{
pl.player.Heal();
if (Config.MessageHeal)
SendChat(UP.FromSteamPlayer(pl), $"{Instance.DefaultTranslations.Translate("YouWasHealed")}", Color.white);
SendChat(UP.FromSteamPlayer(pl),
$"{Instance.Translations.Instance.Translate("YouWasHealed")}", Color.white);
}
SendChat(up, $"{Instance.DefaultTranslations.Translate("SuccessfullyHealed")}", Color.white);

SendChat(up,
$"{Instance.Translations.Instance.Translate("SuccessfullyHealedRadius", pls.Count, command[0])}",
Color.white);
}
else
{
if (int.Parse(command[0]) > 0 && int.Parse(command[0]) <= Config.MaximumRadius)
{
var pls = Provider.clients.FindAll(x => Vector3.Distance(up.Position, UP.FromSteamPlayer(x).Position) <= int.Parse(command[0]) && x.playerID.steamID.m_SteamID != up.CSteamID.m_SteamID);
foreach (var pl in pls)
{
pl.player.Heal();
if (Config.MessageHeal)
SendChat(UP.FromSteamPlayer(pl), $"{Instance.DefaultTranslations.Translate("YouWasHealed")}", Color.white);
}
SendChat(up, $"{Instance.DefaultTranslations.Translate("SuccessfullyHealedRadius", pls.Count, command[0])}", Color.white);
}
else
SendChat(up, $"{Instance.DefaultTranslations.Translate("IncorrectRadius", Config.MaximumRadius)}", Color.white);
}
SendChat(up, $"{Instance.Translations.Instance.Translate("IncorrectRadius", Config.MaximumRadius)}",
Color.white);
}
else SendChat(up, $"{Syntax}", Color.white);
}
}
}
}
75 changes: 45 additions & 30 deletions Commands/HealPlayerCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,54 +19,69 @@ public class HealPlayer : IRocketCommand

public string Name => "heal";

public string Help => $"{Instance.DefaultTranslations.Translate("HealHelp")}";
public string Help => $"{Instance.Translations.Instance.Translate("HealHelp")}";

public string Syntax => $"/heal (name/steamid) - {Help}";

public List<string> Aliases => new List<string>() { };

public List<string> Permissions => new List<string>() { "heal" };
public List<string> Permissions => new List<string>() {"heal"};

public void Execute(IRP caller, string[] command)
{
if (caller is UP)
if (caller is UP up)
{
UP up = (UP)caller;
if (command.Length == 1)
switch (command.Length)
{
if (!TryFindPlayer(command[0], out UP target))
case 1:
{
SendChat(up, $"{Instance.DefaultTranslations.Translate("ErrorIncorrectPlayer")}", Color.white);
return;
if (!TryFindPlayer(command[0], out var target))
{
SendChat(up, $"{Instance.Translations.Instance.Translate("ErrorIncorrectPlayer")}",
Color.white);
return;
}

target.Player.Heal();
SendChat(up,
$"{Instance.Translations.Instance.Translate("SuccessfullyHealedPlayer", target.CharacterName)}",
Color.white);
if (Config.MessageHeal)
SendChat(target, $"{Instance.Translations.Instance.Translate("YouWasHealed")}", Color.white);
break;
}
target.Player.Heal();
SendChat(up, $"{Instance.DefaultTranslations.Translate("SuccessfullyHealedPlayer", target.CharacterName)}", Color.white);
if (Config.MessageHeal)
SendChat(target, $"{Instance.DefaultTranslations.Translate("YouWasHealed")}", Color.white);
}
else if (command.Length == 0)
{
up.Player.Heal();
SendChat(up, $"{Instance.DefaultTranslations.Translate("SuccessfullyHealedYourself")}", Color.white);
case 0:
up.Player.Heal();
SendChat(up, $"{Instance.Translations.Instance.Translate("SuccessfullyHealedYourself")}",
Color.white);
break;
default:
SendChat(up, $"{Syntax}", Color.white);
break;
}
else SendChat(up, $"{Syntax}", Color.white);
}
else
{
if (command.Length == 1)
if (command.Length != 1)
{
if (!TryFindPlayer(command[0], out UP target))
{
SendConsole($"{Instance.DefaultTranslations.Translate("ErrorIncorrectPlayer")}", ConsoleColor.White);
return;
}
target.Player.Heal();
SendConsole($"{Instance.DefaultTranslations.Translate("SuccessfullyHealedPlayer", target.CharacterName)}", ConsoleColor.White);
if (Config.MessageHeal)
SendChat(target, $"{Instance.DefaultTranslations.Translate("YouWasHealed")}", Color.white);
SendConsole($"{Syntax}", ConsoleColor.White);
return;
}
else SendConsole($"{Syntax}", ConsoleColor.White);

if (!TryFindPlayer(command[0], out var target))
{
SendConsole($"{Instance.Translations.Instance.Translate("ErrorIncorrectPlayer")}",
ConsoleColor.White);
return;
}

target.Player.Heal();
SendConsole(
$"{Instance.Translations.Instance.Translate("SuccessfullyHealedPlayer", target.CharacterName)}",
ConsoleColor.White);
if (Config.MessageHeal)
SendChat(target, $"{Instance.Translations.Instance.Translate("YouWasHealed")}", Color.white);
}
}
}
}
}
Loading