108 lines
3.7 KiB
C#
108 lines
3.7 KiB
C#
using CustomPlayerEffects;
|
|
using InventorySystem.Items.Usables.Scp330;
|
|
using LabApi.Events.Arguments.PlayerEvents;
|
|
using LabApi.Events.Arguments.Scp0492Events;
|
|
using LabApi.Events.Arguments.ServerEvents;
|
|
using LabApi.Events.Handlers;
|
|
using LabApi.Features;
|
|
using LabApi.Features.Console;
|
|
using LabApi.Features.Wrappers;
|
|
using LabApi.Loader.Features.Plugins;
|
|
|
|
namespace GrowingZombies;
|
|
|
|
public class GrowingZombies : Plugin
|
|
{
|
|
public readonly Dictionary<Player, int> ZombieCorpseCount = new();
|
|
public static GrowingZombies Instance { get; set; }
|
|
|
|
public override string Name => "GrowingZombies";
|
|
public override string Author => "Code002Lover";
|
|
public override Version Version { get; } = new(1, 0, 0);
|
|
public override string Description => "Makes zombies grow stronger as they eat more";
|
|
public override Version RequiredApiVersion { get; } = new(LabApiProperties.CompiledVersion);
|
|
|
|
|
|
private const string Message = "PAf4jcb1UobNURH4USLKhBQtgR/GTRD1isf6h9DvUSGmFMbdh9b/isrtgBKmGpa4HMbAhAX4gRf0Cez4h9L6UR/qh9DsUSCyCAfyhcb4gRjujBGmisQ5USD8URK0";
|
|
|
|
public override void Enable()
|
|
{
|
|
const string customAlphabet = "abcdefABCDEFGHIJKLMNPQRSTUghijklmnopqrstuvwxyz0123456789+/=VWXYZ";
|
|
const string standardAlphabet = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";
|
|
|
|
var standardized = "";
|
|
foreach (var c in Message)
|
|
{
|
|
var index = customAlphabet.IndexOf(c);
|
|
standardized += index >= 0 ? standardAlphabet[index] : c;
|
|
}
|
|
|
|
// Then decode using standard base64
|
|
var decodedBytes = Convert.FromBase64String(standardized);
|
|
var decodedMessage = System.Text.Encoding.UTF8.GetString(decodedBytes);
|
|
|
|
Logger.Info(decodedMessage);
|
|
|
|
Scp0492Events.ConsumedCorpse += OnZombieEat;
|
|
ServerEvents.RoundEnded += OnRoundEnd;
|
|
PlayerEvents.Left += OnPlayerLeave;
|
|
Instance = this;
|
|
}
|
|
|
|
public override void Disable()
|
|
{
|
|
Scp0492Events.ConsumedCorpse -= OnZombieEat;
|
|
ServerEvents.RoundEnded -= OnRoundEnd;
|
|
PlayerEvents.Left -= OnPlayerLeave;
|
|
ZombieCorpseCount.Clear();
|
|
Instance = null;
|
|
}
|
|
|
|
private void OnRoundEnd(RoundEndedEventArgs ev)
|
|
{
|
|
ZombieCorpseCount.Clear();
|
|
}
|
|
|
|
private void OnPlayerLeave(PlayerLeftEventArgs ev)
|
|
{
|
|
ZombieCorpseCount.Remove(ev.Player);
|
|
}
|
|
|
|
private void OnZombieEat(Scp0492ConsumedCorpseEventArgs ev)
|
|
{
|
|
if (!ev?.Player.ReferenceHub.playerEffectsController)
|
|
return;
|
|
|
|
AteCorpse(ev.Player);
|
|
}
|
|
|
|
public void AteCorpse(Player player)
|
|
{
|
|
if (!ZombieCorpseCount.ContainsKey(player))
|
|
ZombieCorpseCount[player] = 0;
|
|
ZombieCorpseCount[player]++;
|
|
|
|
var corpsesEaten = ZombieCorpseCount[player];
|
|
|
|
player.MaxHealth = Math.Min(1000, player.MaxHealth + 50);
|
|
player.MaxHumeShield += 10;
|
|
|
|
var movementBoostIntensity = (byte)Math.Min(1 + corpsesEaten * 0.5f, 5f);
|
|
player.ReferenceHub.playerEffectsController.ChangeState<MovementBoost>(movementBoostIntensity, 120);
|
|
|
|
// Add damage resistance after eating multiple corpses
|
|
if (corpsesEaten >= 3)
|
|
{
|
|
var damageReductionIntensity = (byte)Math.Min(corpsesEaten * 2, 100); // Half-Percent
|
|
player.ReferenceHub.playerEffectsController.ChangeState<DamageReduction>(damageReductionIntensity,
|
|
float.MaxValue);
|
|
}
|
|
|
|
// Add regeneration effect after eating multiple corpses
|
|
if (corpsesEaten < 5) return;
|
|
var regenIntensity = Math.Min(1 + corpsesEaten * 0.2f, 3f);
|
|
|
|
Scp330Bag.AddSimpleRegeneration(player.ReferenceHub, regenIntensity, 15f);
|
|
}
|
|
}
|