Slight fixes

This commit is contained in:
code002lover 2025-05-30 14:19:08 +02:00
parent 8b44d63602
commit fb5baf321c
3 changed files with 68 additions and 35 deletions

View File

@ -14,10 +14,10 @@ namespace CuffedFrenemies;
public class CuffedFrenemies : Plugin public class CuffedFrenemies : Plugin
{ {
public override string Name => "GamblingCoin"; public override string Name => "CuffedFrenemies";
public override string Author => "Code002Lover"; public override string Author => "Code002Lover";
public override Version Version { get; } = new(1, 0, 0); public override Version Version { get; } = new(1, 0, 0);
public override string Description => "Gamble your life away"; public override string Description => "Cuff your enemies";
public override Version RequiredApiVersion { get; } = new (LabApiProperties.CompiledVersion); public override Version RequiredApiVersion { get; } = new (LabApiProperties.CompiledVersion);
public override void Enable() public override void Enable()
@ -44,23 +44,6 @@ public class CuffedFrenemies : Plugin
return; return;
} }
if (ev.Target.RoleBase is Scp3114Role scp3114)
{
var stolenRole = scp3114.CurIdentity.StolenRole;
var ragdoll = scp3114.CurIdentity.Ragdoll.Info;
switch (stolenRole)
{
case RoleTypeId.ChaosConscript or RoleTypeId.ChaosMarauder or RoleTypeId.ChaosRepressor
or RoleTypeId.ChaosRifleman:
scp3114.CurIdentity.Ragdoll.Info = new RagdollData(ragdoll.OwnerHub, ragdoll.Handler, RoleTypeId.NtfPrivate, ragdoll.StartPosition, ragdoll.StartRotation, ragdoll.Nickname, ragdoll.CreationTime);
return;
case RoleTypeId.NtfPrivate or RoleTypeId.NtfCaptain or RoleTypeId.NtfSergeant
or RoleTypeId.NtfSpecialist:
scp3114.CurIdentity.Ragdoll.Info = new RagdollData(ragdoll.OwnerHub, ragdoll.Handler, RoleTypeId.ChaosConscript, ragdoll.StartPosition, ragdoll.StartRotation, ragdoll.Nickname, ragdoll.CreationTime);
return;
}
}
if (ev.Target.Team is Team.SCPs or Team.Dead) if (ev.Target.Team is Team.SCPs or Team.Dead)
{ {
return; return;

View File

@ -5,7 +5,7 @@ namespace GamblingCoin
public class GamblingCoinChancesConfig public class GamblingCoinChancesConfig
{ {
public int NukeChance { get; set; } = 20; public int NukeChance { get; set; } = 10;
public int SpawnWaveChance { get; set; } = 150; public int SpawnWaveChance { get; set; } = 150;
public int CommonItemChance { get; set; } = 600; public int CommonItemChance { get; set; } = 600;
public int UncommonItemChance { get; set; } = 400; public int UncommonItemChance { get; set; } = 400;
@ -14,15 +14,16 @@ namespace GamblingCoin
public int LegendaryItemChance { get; set; } = 30; public int LegendaryItemChance { get; set; } = 30;
public int RandomTeleportChance { get; set; } = 200; public int RandomTeleportChance { get; set; } = 200;
public int StealItemChance { get; set; } = 100; public int StealItemChance { get; set; } = 100;
public int ExplosionChance { get; set; } = 15; public int ExplosionChance { get; set; } = 40;
public int AntiMicroChance { get; set; } = 10; public int AntiMicroChance { get; set; } = 10;
public int GrenadeChance { get; set; } = 50; public int GrenadeChance { get; set; } = 50;
public int PocketDimensionChance { get; set; } = 75; public int PocketDimensionChance { get; set; } = 30;
public int SwitchInventoryChance { get; set; } = 150; public int SwitchInventoryChance { get; set; } = 150;
public int PositiveEffectChance { get; set; } = 300; public int PositiveEffectChance { get; set; } = 300;
public int NegativeEffectChance { get; set; } = 250; public int NegativeEffectChance { get; set; } = 350;
public int AdvancedPositiveEffectChance { get; set; } = 150; public int AdvancedPositiveEffectChance { get; set; } = 150;
public int AdvancedNegativeEffectChance { get; set; } = 250; public int AdvancedNegativeEffectChance { get; set; } = 250;
public int RemoveCoinChance { get; set; } = 300;
} }
public class GamblingCoinMessages public class GamblingCoinMessages
@ -99,7 +100,6 @@ namespace GamblingCoin
ItemType.KeycardO5, ItemType.KeycardO5,
ItemType.MicroHID, ItemType.MicroHID,
ItemType.Jailbird, ItemType.Jailbird,
ItemType.ParticleDisruptor,
ItemType.GunCom45, ItemType.GunCom45,
ItemType.Coin ItemType.Coin
}; };
@ -148,17 +148,19 @@ namespace GamblingCoin
public AdvancedEffectSettings AdvancedNegative { get; set; } = new() public AdvancedEffectSettings AdvancedNegative { get; set; } = new()
{ {
Effects = new[] { nameof(InsufficientLighting) }, Effects = new[] { nameof(InsufficientLighting), nameof(AmnesiaVision) },
Settings = new Dictionary<string, EffectSettings> Settings = new Dictionary<string, EffectSettings>
{ {
{ nameof(InsufficientLighting), new EffectSettings(1, 20f, true) } { nameof(InsufficientLighting), new EffectSettings(1, 20f, true) },
{ nameof(AmnesiaVision), new EffectSettings(3, 30f, true) },
{ nameof(Bleeding), new EffectSettings(3, 40f, true) },
} }
}; };
} }
public class AdvancedEffectSettings public class AdvancedEffectSettings
{ {
public String[] Effects { get; set; } public string[] Effects { get; set; }
public Dictionary<string, EffectSettings> Settings { get; set; } public Dictionary<string, EffectSettings> Settings { get; set; }
public AdvancedEffectSettings(){} public AdvancedEffectSettings(){}

View File

@ -1,4 +1,7 @@
using System.Diagnostics;
using System.Numerics; using System.Numerics;
using CustomPlayerEffects;
using InventorySystem.Items;
using LabApi.Events.Arguments.PlayerEvents; using LabApi.Events.Arguments.PlayerEvents;
using LabApi.Features.Wrappers; using LabApi.Features.Wrappers;
using MapGeneration; using MapGeneration;
@ -7,6 +10,7 @@ using PlayerRoles;
using Respawning.Waves; using Respawning.Waves;
using Utils; using Utils;
using Logger = LabApi.Features.Console.Logger; using Logger = LabApi.Features.Console.Logger;
using MicroHIDItem = InventorySystem.Items.MicroHID.MicroHIDItem;
using Random = UnityEngine.Random; using Random = UnityEngine.Random;
namespace GamblingCoin namespace GamblingCoin
@ -60,14 +64,54 @@ namespace GamblingCoin
.AddAction(x => .AddAction(x =>
{ {
x.Player.SendBroadcast(configMessages.LegendaryItemSpawnMessage, configGameplay.BroadcastDuration); x.Player.SendBroadcast(configMessages.LegendaryItemSpawnMessage, configGameplay.BroadcastDuration);
SpawnRandomItemAtPlayer(x.Player, configGameplay.Items.LegendaryItems);
var player = x.Player;
var items = configGameplay.Items.LegendaryItems;
var itemIndex = Random.Range(0, items.Length);
var item = items[itemIndex];
var pickup = Pickup.Create(item, player.Position + new UnityEngine.Vector3(0,1,0));
if (pickup == null) return;
if (item is ItemType.MicroHID)
{
var host = Player.List.First(player1 => player1.IsHost);
var micro = host.AddItem(pickup)!.Base;
var microItem = (MicroHIDItem)micro;
microItem.EnergyManager.ServerSetEnergy(microItem.ItemId.SerialNumber, 100);
var newPickup = host.DropItem(micro);
newPickup.Position = player.Position + new UnityEngine.Vector3(0, 1, 0);
return;
}
pickup.Spawn();
}, configChances.LegendaryItemChance) }, configChances.LegendaryItemChance)
.AddAction(x => .AddAction(x =>
{ {
x.Player.SendBroadcast(configMessages.RandomTeleportMessage, configGameplay.BroadcastDuration); x.Player.SendBroadcast(configMessages.RandomTeleportMessage, configGameplay.BroadcastDuration);
var randomRoom = Map.GetRandomRoom(); var randomRoom = Map.GetRandomRoom();
if (randomRoom == null) return; if(randomRoom == null) return;
var isInOtherZone = randomRoom is { Zone: FacilityZone.Other };
var isDetonated = Warhead.IsDetonated;
var isDecontaminating = Decontamination.IsDecontaminating;
var isInDetonatedZone = isDetonated && randomRoom.Zone is FacilityZone.HeavyContainment
or FacilityZone.LightContainment or FacilityZone.Entrance;
var isInDecontaminatedZone = isDecontaminating && randomRoom.Zone is FacilityZone.LightContainment;
while (isInOtherZone || isInDetonatedZone || isInDecontaminatedZone)
{
randomRoom = Map.GetRandomRoom();
if(randomRoom == null) return;
isInOtherZone = randomRoom is { Zone: FacilityZone.Other };
isInDetonatedZone = isDetonated && randomRoom.Zone is FacilityZone.HeavyContainment
or FacilityZone.LightContainment or FacilityZone.Entrance;
isInDecontaminatedZone = isDecontaminating && randomRoom.Zone is FacilityZone.LightContainment;
}
var newPos = randomRoom.Position; var newPos = randomRoom.Position;
@ -85,7 +129,7 @@ namespace GamblingCoin
x.Player.ClearInventory(); x.Player.ClearInventory();
ExplosionUtils.ServerExplode(x.Player.ReferenceHub, ExplosionType.Custom); TimedGrenadeProjectile.SpawnActive(x.Player.Position, ItemType.GrenadeHE, x.Player);
}, configChances.ExplosionChance) }, configChances.ExplosionChance)
.AddAction(x => .AddAction(x =>
{ {
@ -97,9 +141,7 @@ namespace GamblingCoin
{ {
x.Player.SendBroadcast(configMessages.GrenadeMessage, configGameplay.BroadcastDuration); x.Player.SendBroadcast(configMessages.GrenadeMessage, configGameplay.BroadcastDuration);
var grenade = (TimedGrenadeProjectile)Pickup.Create(ItemType.GrenadeHE, x.Player.Position); TimedGrenadeProjectile.SpawnActive(x.Player.Position, ItemType.GrenadeHE, x.Player, 2);
grenade?.Spawn();
grenade?.FuseEnd();
}, configChances.GrenadeChance) }, configChances.GrenadeChance)
.AddAction(x => .AddAction(x =>
{ {
@ -107,6 +149,8 @@ namespace GamblingCoin
var newPos = Map.Rooms.First(roomIdentifier => roomIdentifier.Zone==FacilityZone.Other).Position; var newPos = Map.Rooms.First(roomIdentifier => roomIdentifier.Zone==FacilityZone.Other).Position;
x.Player.ReferenceHub.playerEffectsController.ChangeState(nameof(Corroding),1, 999, true);
x.Player.Position = newPos + new UnityEngine.Vector3(0, configGameplay.TeleportHeightOffset, 0); x.Player.Position = newPos + new UnityEngine.Vector3(0, configGameplay.TeleportHeightOffset, 0);
}, },
configChances.PocketDimensionChance) configChances.PocketDimensionChance)
@ -156,7 +200,11 @@ namespace GamblingCoin
{ {
x.Player.AddItem(randomPlayerItem.Type); x.Player.AddItem(randomPlayerItem.Type);
} }
}, configChances.SwitchInventoryChance); }, configChances.SwitchInventoryChance)
.AddAction(x =>
{
x.Player.CurrentItem?.DropItem().Destroy();
}, configChances.RemoveCoinChance);
return; return;