Skip to content

Commit 945d83e

Browse files
committed
Thingus was for sleep deprived me to do
1 parent ad46b44 commit 945d83e

8 files changed

Lines changed: 92 additions & 44 deletions

File tree

Config.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ namespace ExtendedItems
99
public class Config : IConfig
1010
{
1111
public bool IsEnabled { get; set; } = true;
12-
public bool Debug { get; set; } = false;
12+
public bool Debug { get; set; } = true;
1313

1414
#region Config Settings
1515

Items/AdminAbuse.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ public class AdminAbuse : CustomWeapon
2020
{
2121
[Description("thanks to hayden for the idea on buckshot or else it wouldnt have worked")]
2222
public override uint Id { get; set; } = 799;
23-
public override string Name { get; set; } = "Regert";
23+
public override string Name { get; set; } = "Regert (dont use this because it crashes the server)";
2424
public override string Description { get; set; } = "you asked for it!";
2525
public override float Weight { get; set; } = 0f;
2626
public override float Damage { get; set; } = 0;

Items/Coin.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
using Exiled.API.Enums;
2+
using Exiled.API.Features;
23
using Exiled.API.Features.Attributes;
34
using Exiled.API.Features.Spawn;
45
using Exiled.CustomItems.API.Features;
@@ -71,6 +72,7 @@ private void OnFlippingCoin(FlippingCoinEventArgs ev)
7172
}
7273

7374
ev.Player.ShowHint($"{Plugin.Instance?.Config.WinHints.RandomItem()}");
75+
7476
Effects.ForEach((effect) => { ev.Player.EnableEffect(effect.Type, effect.Intensity, effect.Duration, true); });
7577
});
7678
}

Items/GrenadeLauncher.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
using Exiled.Events.EventArgs.Item;
99
using Exiled.Events.EventArgs.Player;
1010
using InventorySystem.Items.Firearms.Attachments;
11+
using YamlDotNet.Serialization;
1112
using E = ExtendedItems.Utils;
1213
using ItemEvents = Exiled.Events.Handlers.Item;
1314

@@ -22,9 +23,9 @@ public class GrenadeLauncher : CustomWeapon
2223
public override string Name { get; set; } = "Grenade Launcher";
2324
public override string Description { get; set; } = "A modified Chaos Insergency LMG that fires High Explisove Grenades";
2425
public override float Weight { get; set; } = 10f;
25-
2626
public override float Damage { get; set; } = 0f;
2727
public override byte ClipSize { get; set; } = 1;
28+
[YamlIgnore]
2829
public override AttachmentName[] Attachments { get; set; } = [AttachmentName.Laser, AttachmentName.IronSights, AttachmentName.ShortBarrel];
2930
public override SpawnProperties? SpawnProperties { get; set; } = new()
3031

Items/Scp1162.cs

Lines changed: 51 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,15 @@
66
using Exiled.CustomItems.API.Features;
77
using Exiled.Events.EventArgs.Player;
88
using System.ComponentModel;
9+
using System;
910
using UnityEngine;
1011
using YamlDotNet.Serialization;
1112
using Random = System.Random;
1213
using ServerEvents = Exiled.Events.Handlers.Server;
14+
using PlayerEvent = Exiled.Events.Handlers.Player;
15+
using E = ExtendedItems.Utils;
16+
using InventorySystem.Items.Usables;
17+
using InventorySystem.Items.Usables.Scp330;
1318

1419
namespace ExtendedItems.Items
1520
{
@@ -24,7 +29,6 @@ public class Scp1162 : CustomItem
2429

2530
[Description("Chance from 0 to 1 that the item will be destroyed.")]
2631
public float LoseChance { get; set; } = 0.15f;
27-
2832
public override SpawnProperties? SpawnProperties { get; set; }
2933
[YamlIgnore] private readonly Random _rng = new();
3034

@@ -56,13 +60,16 @@ public class Scp1162 : CustomItem
5660
ItemType.Coin,
5761
ItemType.Flashlight,
5862
ItemType.Radio,
63+
ItemType.Ammo9x19
5964

6065
];
6166

67+
public Tuple<string, uint> ServerJoin { get; set; } = new("Welcome to the server!", 10);
68+
6269
private void OnRoundStarted()
6370
{
6471
Room room = Room.Get(Plugin.Instance.Config.Scp1162Room);
65-
Vector3 globalPos = Utils.GetGlobalCords(Plugin.Instance.Config.Scp1162Room, new Vector3(16.68f, 11.6f, 8.11f));
72+
Vector3 globalPos = E.GetGlobalCords(Plugin.Instance.Config.Scp1162Room, new Vector3(16.68f, 11.6f, 8.11f));
6673

6774
Quaternion rotation = room.Rotation;
6875
Vector3 rot = new(0f, 1f, 0.0f);
@@ -78,23 +85,28 @@ private void OnRoundStarted()
7885
protected override void SubscribeEvents()
7986
{
8087
ServerEvents.RoundStarted += OnRoundStarted;
88+
PlayerEvent.PickingUpItem += OnPickingUp;
89+
PlayerEvent.DroppingItem += OnDroppingItem;
8190

8291
base.SubscribeEvents();
8392
}
8493

8594
protected override void UnsubscribeEvents()
8695
{
8796
ServerEvents.RoundStarted -= OnRoundStarted;
97+
PlayerEvent.PickingUpItem -= OnPickingUp;
98+
PlayerEvent.DroppingItem -= OnDroppingItem;
8899

89100
base.UnsubscribeEvents();
90101
}
91102

92103
protected override void OnDroppingItem(DroppingItemEventArgs ev)
93104
{
105+
if (!Check(ev.Item)) return;
94106
ev.Item.Destroy();
95107

96108
Room room = Room.Get(Plugin.Instance.Config.Scp1162Room);
97-
Vector3 globalPos = Utils.GetGlobalCords(Plugin.Instance.Config.Scp1162Room, new Vector3(16.68f, 11.6f, 8.11f));
109+
Vector3 globalPos = E.GetGlobalCords(Plugin.Instance.Config.Scp1162Room, new Vector3(16.68f, 11.6f, 8.11f));
98110

99111
Quaternion rotation = room.Rotation;
100112
Vector3 rot = new(0f, 1f, 0.0f);
@@ -111,43 +123,56 @@ protected override void OnDroppingItem(DroppingItemEventArgs ev)
111123

112124
protected override void OnPickingUp(PickingUpItemEventArgs ev)
113125
{
126+
if (!Check(ev.Pickup) || ev.Player.NetId < 2) return;
114127
ev.IsAllowed = false;
115-
128+
int item = new();
129+
Random candy = new();
130+
Item Currentlyitem = ev.Player.CurrentItem;
131+
ItemType ItemtoGive;
116132
try
117133
{
118-
Item item = ev.Player.CurrentItem;
119-
if (item == null)
134+
if(ev.Player.CurrentItem is null || ev.Player.CurrentItem.Type == ItemType.None)
120135
{
121-
ev.Player.EnableEffect(EffectType.SeveredHands, byte.MaxValue);
136+
ev.Player.ShowHint("You insert your hands into SCP-1162 and lose feeling in them.", 5);
137+
ev.Player.ShowHitMarker(2);
138+
ev.Player.EnableEffect(EffectType.SeveredHands);
139+
return;
122140
}
123-
else
141+
else if(Currentlyitem.Type == ItemType.SCP330)
124142
{
125-
if (item.Type == ItemType.SCP330)
126-
{
127-
ev.IsAllowed = false;
128-
ev.Player.ShowHint("You can't trade an SCP-330-1 instance with SCP-1162.", 5);
129-
return;
130-
}
131-
ev.Player.RemoveItem(item);
132-
if (_rng.NextDouble() < LoseChance) return;
133-
item = ev.Player.AddItem(ItemTypes[_rng.Next(0, ItemTypes.Length)]);
134-
135-
136-
137-
ev.Player.CurrentItem = item;
138-
143+
ev.Player.ShowHint("You put an SCP-330-1 instance in and SCP-1162 just spits it back out");
144+
return;
145+
}
146+
ev.Player.RemoveHeldItem();
147+
if (_rng.NextDouble() < LoseChance)
148+
{
149+
ev.Player.ShowHint("You insert your item into SCP-1162 and it gets destroyed.", 5);
150+
return;
139151
}
140-
return;
152+
ItemtoGive = ItemTypes[_rng.Next(0, ItemTypes.Length)];
153+
if(ItemtoGive == ItemType.Ammo9x19)
154+
{
155+
var thing = candy.Next(0, 6);
156+
ItemtoGive = ItemType.None;
157+
ev.Player.TryAddCandy(E.AddCandy(thing));
158+
}
159+
141160
}
142-
catch
161+
catch (Exception ex)
143162
{
144-
// ignored
163+
var timeUtc = DateTime.UtcNow;
164+
TimeZoneInfo easternZone = TimeZoneInfo.FindSystemTimeZoneById("Eastern Standard Time");
165+
DateTime EstTime = TimeZoneInfo.ConvertTimeFromUtc(timeUtc, easternZone);
166+
string now = EstTime.ToString("dd, hh:mm:ss.ff tt");
167+
Log.Error($"Error: {ex} occured.");
168+
ev.Player.ShowHint($"Something went wrong at {now}.\nplease send a DM to Cactusman or Noobest1001 on Discord or make an issue on Github.", 5);
145169
}
146170

147171
base.OnPickingUp(ev);
148172
}
173+
149174

150-
private void Spawn(RoomType room, Vector3 offset)
175+
private void SpawnRoom(RoomType room, Vector3 offset)
151176
{
152177
Room temp = Room.Get(room);
153178
Vector3 globalPos = Utils.GetGlobalCords(room, offset);

Items/Sniper.cs

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -15,22 +15,15 @@ public class Sniper : CustomWeapon
1515
{
1616
public override uint Id { get; set; } = 802;
1717
public override string Name { get; set; } = "SR-118";
18-
1918
public override string Description { get; set; } = "A modified E-11 that fires 5.56 at supersonic velocity that deals significantly more damage";
20-
21-
public override float Weight { get; set; } = 8f;
19+
public override float Weight { get; set; } = 5f;
2220
public override float Damage { get; set; } = 112f;
2321
public override byte ClipSize { get; set; } = 1;
2422

2523
[YamlIgnore]
2624
public override AttachmentName[] Attachments { get; set; } =
2725
[
28-
AttachmentName.LowcapMagAP,
29-
AttachmentName.Foregrip,
30-
AttachmentName.DotSight,
31-
AttachmentName.RecoilReducingStock,
32-
AttachmentName.RifleBody,
33-
AttachmentName.SoundSuppressor
26+
AttachmentName.LowcapMagAP, AttachmentName.Foregrip, AttachmentName.DotSight, AttachmentName.RecoilReducingStock, AttachmentName.CarbineBody, AttachmentName.MuzzleBrake
3427
];
3528

3629
public override SpawnProperties? SpawnProperties { get; set; } = new()

Items/Tranquilizer.cs

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,10 @@
33
using Exiled.API.Features.Attributes;
44
using Exiled.API.Features.Spawn;
55
using Exiled.CustomItems.API.Features;
6+
using Exiled.CustomRoles.API;
67
using Exiled.Events.EventArgs.Player;
78
using MEC;
9+
using Mirror;
810
using PlayerRoles;
911
using PlayerRoles.PlayableScps.Scp096;
1012
using PlayerStatsSystem;
@@ -98,21 +100,21 @@ protected override void OnShot(ShotEventArgs ev)
98100
item = ev.Target.CurrentItem;
99101
}
100102

101-
var rand = _rng.NextDouble();
103+
double rand = _rng.NextDouble();
102104
_resistances.TryGetValue(ev.Target.NetId, out float tResistance);
103105

104-
var effective = ev.Target.IsScp ? rand < ScpChance - tResistance : rand < HumanChance - tResistance;
106+
bool effective = ev.Target.IsScp ? rand < ScpChance - tResistance : rand < HumanChance - tResistance;
105107

106108
if ((ev.Target.Role == RoleTypeId.Scp173 && !EffectiveOn173) || !effective)
107109
{
108110
base.OnShot(ev);
109111
return;
110112
}
111113

112-
var lift = ev.Player.Lift;
114+
Lift lift = ev.Player.Lift;
113115

114116
ev.Target.Scale = Vector3.zero;
115-
_resistances[ev.Target.NetId] = tResistance + Resistance;
117+
_resistances[ev.Target.NetId] = tResistance + (_rng.Next(1,10)/100);
116118

117119
ev.Target.EnableEffect(EffectType.Ensnared, byte.MaxValue);
118120
ev.Target.EnableEffect(EffectType.Flashed, byte.MaxValue);

Utils.cs

Lines changed: 27 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
using Exiled.API.Enums;
22
using Exiled.API.Extensions;
33
using Exiled.API.Features;
4+
using InventorySystem.Items.Usables.Scp330;
45
using UnityEngine;
56
using CK = Exiled.CustomItems.API.Features;
67
using EP = Exiled.API.Features.Player;
@@ -151,8 +152,32 @@ public static List<string> GetPropertiesOfHeldOrFirst(EP player)
151152
helditem.CopyProperties(response);
152153
return response;
153154
}
154-
155-
155+
public static CandyKindID AddCandy(int candy)
156+
{
157+
return candy switch
158+
{
159+
0 => CandyKindID.Pink,
160+
1 => CandyKindID.Blue,
161+
2 => CandyKindID.Green,
162+
3 => CandyKindID.Yellow,
163+
4 => CandyKindID.Purple,
164+
5 => CandyKindID.Rainbow,
165+
_ => CandyKindID.Red,
166+
};
167+
}
168+
public static string CandytoString(int candy)
169+
{
170+
return candy switch
171+
{
172+
0 => "<color=#FFC0CB>Pink</color>",
173+
1 => "<color=#0000FF>Blue</color>",
174+
2 => "<color=#008000>Green</color>",
175+
3 => "<color=#FFFF00>Yellow</color>",
176+
4 => "<color=#800080>Purple</color>",
177+
5 => "<color=#FF0000>R</color><color=#FF7F00>a</color><color=#FFFF00>i</color><color=#00FF00>n</color><color=#0000FF>b</color><color=#4B0082>o</color><color=#8A2BE2>w</color>",
178+
_ => "<color=#FF0000>Red</color>",
179+
};
180+
}
156181

157182
}
158183
}

0 commit comments

Comments
 (0)