This repository was archived by the owner on Oct 22, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathExtensions.cs
More file actions
46 lines (42 loc) · 1.45 KB
/
Extensions.cs
File metadata and controls
46 lines (42 loc) · 1.45 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
using SDG.Unturned;
using Steamworks;
using System;
using Color = UnityEngine.Color;
using Logger = Rocket.Core.Logging.Logger;
using UP = Rocket.Unturned.Player.UnturnedPlayer;
namespace HealingBall
{
public static class Extensions
{
public static Configuration Config => Plugin.Instance.Configuration.Instance;
public static void SendChat(UP up, string text, Color color)
{
ChatManager.serverSendMessage($"<b><color=green>[HealingBall]</color> {text}</b>", color, null, up.SteamPlayer(), EChatMode.SAY, "", true);
}
public static void SendConsole(string text, ConsoleColor color)
{
Logger.Log(text, color);
}
public static bool TryFindPlayer(string parameter, out UP target)
{
if (ulong.TryParse(parameter, out ulong SID))
{
target = UP.FromCSteamID(new CSteamID(SID));
}
else target = UP.FromName(parameter);
if (target != null)
return true;
else return false;
}
public static void Heal(this Player player)
{
player.life.askHeal(100, Config.HealBleeding, Config.HealBroken);
if (Config.FillHunger)
player.life.askEat(100);
if (Config.FillThirst)
player.life.askDrink(100);
if (Config.HealToxic)
player.life.askDisinfect(100);
}
}
}