Skip to content

Commit f234d4c

Browse files
authored
Merge pull request #34 from UncomplicatedCustomServer/Exiled-Dev
Exiled dev
2 parents 5ee631e + 1ff5dd7 commit f234d4c

113 files changed

Lines changed: 2686 additions & 2548 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Lines changed: 38 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -1,39 +1,39 @@
1-
using System;
2-
3-
namespace UncomplicatedCustomItems.Enums
4-
{
5-
/// <summary>
6-
/// Contains all of the available <see cref="CustomFlags"/>
7-
/// </summary>
8-
[Flags]
9-
public enum CustomFlags : long
10-
{
11-
// CustomFlags added via CustomFlagsExtensions should use 49 to 62
12-
None = 0,
13-
DoNotTriggerTeslaGates = 1L << 1,
14-
LifeSteal = 1L << 2,
15-
InfiniteAmmo = 1L << 3,
16-
DieOnUse = 1L << 4,
17-
WorkstationBan = 1L << 5,
18-
ItemGlow = 1L << 6,
19-
EffectWhenUsed = 1L << 7,
20-
EffectShot = 1L << 8,
21-
EffectWhenEquiped = 1L << 9,
22-
NoCharge = 1L << 10,
23-
CustomSound = 1L << 11,
24-
ExplosiveBullets = 1L << 12,
25-
ToolGun = 1L << 13,
26-
SpawnItemWhenDetonated = 1L << 14,
27-
Cluster = 1L << 15,
28-
SwitchRoleOnUse = 1L << 16,
29-
DieOnDrop = 1L << 17,
30-
VaporizeKills = 1L << 18,
31-
CantDrop = 1L << 19,
32-
ChangeAppearanceOnKill = 1L << 20,
33-
Disguise = 1L << 21,
34-
Craftable = 1L << 22,
35-
HealOnKill = 1L << 23,
36-
Capybara = 1L << 24,
37-
Custom = 1L << 48, // This should only be used if your coding your own CustomFlag
38-
}
1+
using System;
2+
3+
namespace UncomplicatedCustomItems.API.Enums
4+
{
5+
/// <summary>
6+
/// Contains all of the available <see cref="CustomFlags"/>
7+
/// </summary>
8+
[Flags]
9+
public enum CustomFlags : long
10+
{
11+
// CustomFlags added via CustomFlagsExtensions should use 49 to 62
12+
None = 0,
13+
DoNotTriggerTeslaGates = 1L << 1,
14+
LifeSteal = 1L << 2,
15+
InfiniteAmmo = 1L << 3,
16+
DieOnUse = 1L << 4,
17+
WorkstationBan = 1L << 5,
18+
ItemGlow = 1L << 6,
19+
EffectWhenUsed = 1L << 7,
20+
EffectShot = 1L << 8,
21+
EffectWhenEquiped = 1L << 9,
22+
NoCharge = 1L << 10,
23+
CustomSound = 1L << 11,
24+
ExplosiveBullets = 1L << 12,
25+
ToolGun = 1L << 13,
26+
SpawnItemWhenDetonated = 1L << 14,
27+
Cluster = 1L << 15,
28+
SwitchRoleOnUse = 1L << 16,
29+
DieOnDrop = 1L << 17,
30+
VaporizeKills = 1L << 18,
31+
CantDrop = 1L << 19,
32+
ChangeAppearanceOnKill = 1L << 20,
33+
Disguise = 1L << 21,
34+
Craftable = 1L << 22,
35+
HealOnKill = 1L << 23,
36+
Capybara = 1L << 24,
37+
Custom = 1L << 48, // This should only be used if your coding your own CustomFlag
38+
}
3939
}

UncomplicatedCustomItems/Enums/CustomItemType.cs renamed to UncomplicatedCustomItems/API/Enums/CustomItemType.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
using UncomplicatedCustomItems.API.Features;
22

3+
namespace UncomplicatedCustomItems.API.Enums
4+
{
35
/// <summary>
46
/// All of the <see cref="CustomItemType"/>s that can be used in making a <see cref="CustomItem"/>
57
/// </summary>
@@ -17,3 +19,4 @@ public enum CustomItemType
1719
Adrenaline,
1820
SCPItem,
1921
}
22+
}

UncomplicatedCustomItems/Enums/ItemEvents.cs renamed to UncomplicatedCustomItems/API/Enums/ItemEvents.cs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
using UncomplicatedCustomItems.API.Features;
22

3+
namespace UncomplicatedCustomItems.API.Enums
4+
{
35
/// <summary>
46
/// Contains all the <see cref="ItemEvents"/> that can be used in a <see cref="CustomItemType.Item"/> <see cref="CustomItem"/>
57
/// </summary>
@@ -12,4 +14,5 @@ public enum ItemEvents
1214
Noclip,
1315
Detonation,
1416
SSSS
15-
}
17+
}
18+
}

UncomplicatedCustomItems/Extensions/CustomFlagsExtensions.cs renamed to UncomplicatedCustomItems/API/Extensions/CustomFlagsExtensions.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
using UncomplicatedCustomItems.Enums;
1+
using UncomplicatedCustomItems.API.Enums;
22

3-
namespace UncomplicatedCustomItems.Extensions
3+
namespace UncomplicatedCustomItems.API.Extensions
44
{
55
/// <summary>
66
/// Class for handling new <see cref="CustomFlags"/> added by other plugins.

UncomplicatedCustomItems/Extensions/CustomItemExtensions.cs renamed to UncomplicatedCustomItems/API/Extensions/CustomItemExtensions.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@
33
using InventorySystem.Items.Firearms.Attachments;
44
using UncomplicatedCustomItems.API.Features;
55
using UncomplicatedCustomItems.API.Features.Helper;
6-
using UncomplicatedCustomItems.Enums;
6+
using UncomplicatedCustomItems.API.Enums;
77

8-
namespace UncomplicatedCustomItems.Extensions
8+
namespace UncomplicatedCustomItems.API.Extensions
99
{
1010
public static class CustomItemExtensions
1111
{

UncomplicatedCustomItems/Extensions/DictionaryExtension.cs renamed to UncomplicatedCustomItems/API/Extensions/DictionaryExtension.cs

Lines changed: 109 additions & 109 deletions
Original file line numberDiff line numberDiff line change
@@ -1,110 +1,110 @@
1-
using System;
2-
using System.Collections.Generic;
3-
4-
namespace UncomplicatedCustomItems.Extensions
5-
{
6-
public static class DictionaryExtension
7-
{
8-
/// <summary>
9-
/// Attempts to add a key-value pair to the dictionary. If the key already exists, updates its value.
10-
/// </summary>
11-
/// <typeparam name="TKey">Type of the dictionary key.</typeparam>
12-
/// <typeparam name="TValue">Type of the dictionary value.</typeparam>
13-
/// <param name="dictionary">The dictionary to modify.</param>
14-
/// <param name="Key">The key to add or update.</param>
15-
/// <param name="value">The value to associate with the key.</param>
16-
/// <exception cref="ArgumentNullException">Thrown if the dictionary is null.</exception>
17-
public static void TryAdd<TKey, TValue>(this Dictionary<TKey, TValue> dictionary, TKey Key, TValue value)
18-
{
19-
if (dictionary is null)
20-
throw new ArgumentNullException(nameof(dictionary));
21-
22-
if (dictionary.ContainsKey(Key))
23-
dictionary[Key] = value;
24-
else
25-
dictionary.Add(Key, value);
26-
}
27-
28-
/// <summary>
29-
/// Attempts to retrieve an element from the dictionary. If the key does not exist, returns a default value.
30-
/// </summary>
31-
/// <typeparam name="TKey">Type of the dictionary key.</typeparam>
32-
/// <typeparam name="TValue">Type of the dictionary value.</typeparam>
33-
/// <param name="dictionary">The dictionary to search.</param>
34-
/// <param name="key">The key to look for.</param>
35-
/// <param name="ifNot">The default value to return if the key is not found.</param>
36-
/// <returns>The value associated with the key, or the default value if the key does not exist.</returns>
37-
/// <exception cref="ArgumentNullException">Thrown if the dictionary is null.</exception>
38-
public static TValue TryGetElement<TKey, TValue>(this Dictionary<TKey, TValue> dictionary, TKey key, TValue ifNot)
39-
{
40-
if (dictionary is null)
41-
throw new ArgumentNullException(nameof(dictionary));
42-
43-
if (dictionary.ContainsKey(key))
44-
return dictionary[key];
45-
46-
return ifNot;
47-
}
48-
49-
/// <summary>
50-
/// Attempts to remove a key from the dictionary. If the key does not exist, does nothing.
51-
/// </summary>
52-
/// <typeparam name="TKey">Type of the dictionary key.</typeparam>
53-
/// <typeparam name="TValue">Type of the dictionary value.</typeparam>
54-
/// <param name="dictionary">The dictionary to modify.</param>
55-
/// <param name="key">The key to remove.</param>
56-
/// <exception cref="ArgumentNullException">Thrown if the dictionary is null.</exception>
57-
public static void TryRemove<TKey, TValue>(this Dictionary<TKey, TValue> dictionary, TKey key)
58-
{
59-
if (dictionary is null)
60-
throw new ArgumentNullException(nameof(dictionary));
61-
62-
if (dictionary.ContainsKey(key))
63-
dictionary.Remove(key);
64-
}
65-
66-
/// <summary>
67-
/// Returns a string representation of the dictionary, including its type and contents.
68-
/// </summary>
69-
/// <typeparam name="TKey">Type of the dictionary key.</typeparam>
70-
/// <typeparam name="TValue">Type of the dictionary value.</typeparam>
71-
/// <param name="dictionary">The dictionary to convert to a string.</param>
72-
/// <returns>A formatted string representation of the dictionary.</returns>
73-
public static string ToRealString<TKey, TValue>(this Dictionary<TKey, TValue> dictionary)
74-
{
75-
if (dictionary is null)
76-
return string.Empty;
77-
78-
string Data = $"[{dictionary.GetType().FullName}] Dictionary<{dictionary.GetType().GetGenericArguments()[0].FullName}, {dictionary.GetType().GetGenericArguments()[1].FullName}> ({dictionary.Count}) [\n";
79-
80-
foreach (KeyValuePair<TKey, TValue> kvp in dictionary)
81-
Data += $"{kvp.Key}: {kvp.Value},\n";
82-
83-
Data += "];";
84-
85-
return Data;
86-
}
87-
88-
/// <summary>
89-
/// Adds a range of key-value pairs to the dictionary.
90-
/// </summary>
91-
/// <typeparam name="TKey">Type of the dictionary key.</typeparam>
92-
/// <typeparam name="TValue">Type of the dictionary value.</typeparam>
93-
/// <param name="dictionary">The dictionary to modify.</param>
94-
/// <param name="items">A collection of key-value pairs to add.</param>
95-
/// <exception cref="ArgumentNullException">Thrown if the dictionary or items is null.</exception>
96-
public static void AddRange<TKey, TValue>(this Dictionary<TKey, TValue> dictionary, IEnumerable<KeyValuePair<TKey, TValue>> items)
97-
{
98-
if (dictionary is null)
99-
throw new ArgumentNullException(nameof(dictionary));
100-
101-
if (items is null)
102-
throw new ArgumentNullException(nameof(items));
103-
104-
foreach (var kvp in items)
105-
{
106-
dictionary[kvp.Key] = kvp.Value;
107-
}
108-
}
109-
}
1+
using System;
2+
using System.Collections.Generic;
3+
4+
namespace UncomplicatedCustomItems.API.Extensions
5+
{
6+
public static class DictionaryExtension
7+
{
8+
/// <summary>
9+
/// Attempts to add a key-value pair to the dictionary. If the key already exists, updates its value.
10+
/// </summary>
11+
/// <typeparam name="TKey">Type of the dictionary key.</typeparam>
12+
/// <typeparam name="TValue">Type of the dictionary value.</typeparam>
13+
/// <param name="dictionary">The dictionary to modify.</param>
14+
/// <param name="Key">The key to add or update.</param>
15+
/// <param name="value">The value to associate with the key.</param>
16+
/// <exception cref="ArgumentNullException">Thrown if the dictionary is null.</exception>
17+
public static void TryAdd<TKey, TValue>(this Dictionary<TKey, TValue> dictionary, TKey Key, TValue value)
18+
{
19+
if (dictionary is null)
20+
throw new ArgumentNullException(nameof(dictionary));
21+
22+
if (dictionary.ContainsKey(Key))
23+
dictionary[Key] = value;
24+
else
25+
dictionary.Add(Key, value);
26+
}
27+
28+
/// <summary>
29+
/// Attempts to retrieve an element from the dictionary. If the key does not exist, returns a default value.
30+
/// </summary>
31+
/// <typeparam name="TKey">Type of the dictionary key.</typeparam>
32+
/// <typeparam name="TValue">Type of the dictionary value.</typeparam>
33+
/// <param name="dictionary">The dictionary to search.</param>
34+
/// <param name="key">The key to look for.</param>
35+
/// <param name="ifNot">The default value to return if the key is not found.</param>
36+
/// <returns>The value associated with the key, or the default value if the key does not exist.</returns>
37+
/// <exception cref="ArgumentNullException">Thrown if the dictionary is null.</exception>
38+
public static TValue TryGetElement<TKey, TValue>(this Dictionary<TKey, TValue> dictionary, TKey key, TValue ifNot)
39+
{
40+
if (dictionary is null)
41+
throw new ArgumentNullException(nameof(dictionary));
42+
43+
if (dictionary.ContainsKey(key))
44+
return dictionary[key];
45+
46+
return ifNot;
47+
}
48+
49+
/// <summary>
50+
/// Attempts to remove a key from the dictionary. If the key does not exist, does nothing.
51+
/// </summary>
52+
/// <typeparam name="TKey">Type of the dictionary key.</typeparam>
53+
/// <typeparam name="TValue">Type of the dictionary value.</typeparam>
54+
/// <param name="dictionary">The dictionary to modify.</param>
55+
/// <param name="key">The key to remove.</param>
56+
/// <exception cref="ArgumentNullException">Thrown if the dictionary is null.</exception>
57+
public static void TryRemove<TKey, TValue>(this Dictionary<TKey, TValue> dictionary, TKey key)
58+
{
59+
if (dictionary is null)
60+
throw new ArgumentNullException(nameof(dictionary));
61+
62+
if (dictionary.ContainsKey(key))
63+
dictionary.Remove(key);
64+
}
65+
66+
/// <summary>
67+
/// Returns a string representation of the dictionary, including its type and contents.
68+
/// </summary>
69+
/// <typeparam name="TKey">Type of the dictionary key.</typeparam>
70+
/// <typeparam name="TValue">Type of the dictionary value.</typeparam>
71+
/// <param name="dictionary">The dictionary to convert to a string.</param>
72+
/// <returns>A formatted string representation of the dictionary.</returns>
73+
public static string ToRealString<TKey, TValue>(this Dictionary<TKey, TValue> dictionary)
74+
{
75+
if (dictionary is null)
76+
return string.Empty;
77+
78+
string Data = $"[{dictionary.GetType().FullName}] Dictionary<{dictionary.GetType().GetGenericArguments()[0].FullName}, {dictionary.GetType().GetGenericArguments()[1].FullName}> ({dictionary.Count}) [\n";
79+
80+
foreach (KeyValuePair<TKey, TValue> kvp in dictionary)
81+
Data += $"{kvp.Key}: {kvp.Value},\n";
82+
83+
Data += "];";
84+
85+
return Data;
86+
}
87+
88+
/// <summary>
89+
/// Adds a range of key-value pairs to the dictionary.
90+
/// </summary>
91+
/// <typeparam name="TKey">Type of the dictionary key.</typeparam>
92+
/// <typeparam name="TValue">Type of the dictionary value.</typeparam>
93+
/// <param name="dictionary">The dictionary to modify.</param>
94+
/// <param name="items">A collection of key-value pairs to add.</param>
95+
/// <exception cref="ArgumentNullException">Thrown if the dictionary or items is null.</exception>
96+
public static void AddRange<TKey, TValue>(this Dictionary<TKey, TValue> dictionary, IEnumerable<KeyValuePair<TKey, TValue>> items)
97+
{
98+
if (dictionary is null)
99+
throw new ArgumentNullException(nameof(dictionary));
100+
101+
if (items is null)
102+
throw new ArgumentNullException(nameof(items));
103+
104+
foreach (var kvp in items)
105+
{
106+
dictionary[kvp.Key] = kvp.Value;
107+
}
108+
}
109+
}
110110
}

UncomplicatedCustomItems/Extensions/HarmonyExtensions.cs renamed to UncomplicatedCustomItems/API/Extensions/HarmonyExtensions.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
using System.Reflection.Emit;
55
using HarmonyLib;
66

7-
namespace UncomplicatedCustomItems.Extensions
7+
namespace UncomplicatedCustomItems.API.Extensions
88
{
99
public static class HarmonyExtensions
1010
{

UncomplicatedCustomItems/Extensions/ItemExtensions.cs renamed to UncomplicatedCustomItems/API/Extensions/ItemExtensions.cs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
using Exiled.API.Features.Items;
2-
using UncomplicatedCustomItems.API;
32
using UncomplicatedCustomItems.API.Features;
4-
using UncomplicatedCustomItems.Interfaces;
3+
using UncomplicatedCustomItems.API.Interfaces;
54

6-
namespace UncomplicatedCustomItems.Extensions
5+
namespace UncomplicatedCustomItems.API.Extensions
76
{
87
/// <summary>
98
/// Contains all the item extensions for UCI.

0 commit comments

Comments
 (0)