Skip to content

Commit 599b74b

Browse files
authored
Merge pull request #70 from UncomplicatedCustomServer/dev-main
UCR v9.0.0 for EXILED - Release Candidate I
2 parents 7077a88 + 7f4e519 commit 599b74b

46 files changed

Lines changed: 1049 additions & 834 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

CODE_OF_CONDUCT.md

Lines changed: 128 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,128 @@
1+
# Contributor Covenant Code of Conduct
2+
3+
## Our Pledge
4+
5+
We as members, contributors, and leaders pledge to make participation in our
6+
community a harassment-free experience for everyone, regardless of age, body
7+
size, visible or invisible disability, ethnicity, sex characteristics, gender
8+
identity and expression, level of experience, education, socio-economic status,
9+
nationality, personal appearance, race, religion, or sexual identity
10+
and orientation.
11+
12+
We pledge to act and interact in ways that contribute to an open, welcoming,
13+
diverse, inclusive, and healthy community.
14+
15+
## Our Standards
16+
17+
Examples of behavior that contributes to a positive environment for our
18+
community include:
19+
20+
* Demonstrating empathy and kindness toward other people
21+
* Being respectful of differing opinions, viewpoints, and experiences
22+
* Giving and gracefully accepting constructive feedback
23+
* Accepting responsibility and apologizing to those affected by our mistakes,
24+
and learning from the experience
25+
* Focusing on what is best not just for us as individuals, but for the
26+
overall community
27+
28+
Examples of unacceptable behavior include:
29+
30+
* The use of sexualized language or imagery, and sexual attention or
31+
advances of any kind
32+
* Trolling, insulting or derogatory comments, and personal or political attacks
33+
* Public or private harassment
34+
* Publishing others' private information, such as a physical or email
35+
address, without their explicit permission
36+
* Other conduct which could reasonably be considered inappropriate in a
37+
professional setting
38+
39+
## Enforcement Responsibilities
40+
41+
Community leaders are responsible for clarifying and enforcing our standards of
42+
acceptable behavior and will take appropriate and fair corrective action in
43+
response to any behavior that they deem inappropriate, threatening, offensive,
44+
or harmful.
45+
46+
Community leaders have the right and responsibility to remove, edit, or reject
47+
comments, commits, code, wiki edits, issues, and other contributions that are
48+
not aligned to this Code of Conduct, and will communicate reasons for moderation
49+
decisions when appropriate.
50+
51+
## Scope
52+
53+
This Code of Conduct applies within all community spaces, and also applies when
54+
an individual is officially representing the community in public spaces.
55+
Examples of representing our community include using an official e-mail address,
56+
posting via an official social media account, or acting as an appointed
57+
representative at an online or offline event.
58+
59+
## Enforcement
60+
61+
Instances of abusive, harassing, or otherwise unacceptable behavior may be
62+
reported to the community leaders responsible for enforcement at
63+
contact@ucserver.it.
64+
All complaints will be reviewed and investigated promptly and fairly.
65+
66+
All community leaders are obligated to respect the privacy and security of the
67+
reporter of any incident.
68+
69+
## Enforcement Guidelines
70+
71+
Community leaders will follow these Community Impact Guidelines in determining
72+
the consequences for any action they deem in violation of this Code of Conduct:
73+
74+
### 1. Correction
75+
76+
**Community Impact**: Use of inappropriate language or other behavior deemed
77+
unprofessional or unwelcome in the community.
78+
79+
**Consequence**: A private, written warning from community leaders, providing
80+
clarity around the nature of the violation and an explanation of why the
81+
behavior was inappropriate. A public apology may be requested.
82+
83+
### 2. Warning
84+
85+
**Community Impact**: A violation through a single incident or series
86+
of actions.
87+
88+
**Consequence**: A warning with consequences for continued behavior. No
89+
interaction with the people involved, including unsolicited interaction with
90+
those enforcing the Code of Conduct, for a specified period of time. This
91+
includes avoiding interactions in community spaces as well as external channels
92+
like social media. Violating these terms may lead to a temporary or
93+
permanent ban.
94+
95+
### 3. Temporary Ban
96+
97+
**Community Impact**: A serious violation of community standards, including
98+
sustained inappropriate behavior.
99+
100+
**Consequence**: A temporary ban from any sort of interaction or public
101+
communication with the community for a specified period of time. No public or
102+
private interaction with the people involved, including unsolicited interaction
103+
with those enforcing the Code of Conduct, is allowed during this period.
104+
Violating these terms may lead to a permanent ban.
105+
106+
### 4. Permanent Ban
107+
108+
**Community Impact**: Demonstrating a pattern of violation of community
109+
standards, including sustained inappropriate behavior, harassment of an
110+
individual, or aggression toward or disparagement of classes of individuals.
111+
112+
**Consequence**: A permanent ban from any sort of public interaction within
113+
the community.
114+
115+
## Attribution
116+
117+
This Code of Conduct is adapted from the [Contributor Covenant][homepage],
118+
version 2.0, available at
119+
https://www.contributor-covenant.org/version/2/0/code_of_conduct.html.
120+
121+
Community Impact Guidelines were inspired by [Mozilla's code of conduct
122+
enforcement ladder](https://github.com/mozilla/diversity).
123+
124+
[homepage]: https://www.contributor-covenant.org
125+
126+
For answers to common questions about this code of conduct, see the FAQ at
127+
https://www.contributor-covenant.org/faq. Translations are available at
128+
https://www.contributor-covenant.org/translations.

CONTRIBUTING.md

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
# Contributing
2+
3+
Thank you for your interest in contributing to UncomplicatedCustomServer! We develop Open Source plugins for EXILED and LabAPI.
4+
5+
## Getting Started
6+
7+
1. Fork the repository
8+
2. Clone your fork: `git clone https://github.com/yourusername/repository-name.git`
9+
3. Create a new branch: `git checkout -b feature/your-feature-name`
10+
4. Make your changes
11+
5. Commit your changes: `git commit -m "feat: add new feature"`
12+
6. Push to your fork: `git push origin feature/your-feature-name`
13+
7. Create a Pull Request
14+
15+
## Requirements
16+
17+
- .NET 8.0 SDK or higher
18+
- Visual Studio 2022 or JetBrains Rider (recommended)
19+
- Basic knowledge of C# and EXILED/LabAPI
20+
21+
## Coding Standards
22+
23+
- Follow C# naming conventions
24+
- Add XML documentation for public APIs
25+
- Use proper exception handling
26+
- Test your changes on an actual SCP:SL server when possible
27+
28+
## Pull Requests
29+
30+
- Use clear, descriptive titles
31+
- Describe what your changes do
32+
- Ensure the project builds successfully
33+
- Test functionality when possible
34+
- Link related issues
35+
36+
## Issues
37+
38+
- Check existing issues before creating new ones
39+
- Use clear titles and detailed descriptions
40+
- Include steps to reproduce bugs
41+
- Mention your environment details
42+
43+
---
44+
45+
Thank you for contributing!
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
/*
2+
* This file is a part of the UncomplicatedCustomRoles project.
3+
*
4+
* Copyright (c) 2023-present FoxWorn3365 (Federico Cosma) <me@fcosma.it>
5+
*
6+
* This file is licensed under the GNU Affero General Public License v3.0.
7+
* You should have received a copy of the AGPL license along with this file.
8+
* If not, see <https://www.gnu.org/licenses/>.
9+
*/
10+
11+
using System.Collections.Generic;
12+
13+
namespace UncomplicatedCustomRoles.API.Features.CustomModules
14+
{
15+
public class ColorfulNickname : CustomModule
16+
{
17+
public override List<string> RequiredArgs => new()
18+
{
19+
"color"
20+
};
21+
22+
internal string Color => TryGetStringValue("color", string.Empty);
23+
24+
public override void OnAdded()
25+
{
26+
if (Color == string.Empty)
27+
return;
28+
29+
string nick = CustomRole.Player.DisplayNickname.Replace("<color=#855439>*</color>", "");
30+
string color = Color.StartsWith("#") ? Color : $"#{Color}";
31+
CustomRole.Player.CustomInfo = CustomRole.Player.CustomInfo.Replace(nick, $"<color={color}>{nick}</color>");
32+
}
33+
}
34+
}

UncomplicatedCustomRoles/API/Features/CustomModules/CustomModule.cs

Lines changed: 21 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
using System;
1313
using System.Collections.Generic;
1414
using System.Linq;
15+
using UncomplicatedCustomRoles.Extensions;
1516
using UncomplicatedCustomRoles.Manager;
1617

1718
namespace UncomplicatedCustomRoles.API.Features.CustomModules
@@ -45,14 +46,19 @@ public virtual string Name
4546
/// Gets the args of the current <see cref="CustomModule"/>
4647
/// </summary>
4748
/// <remarks>Every value is a <see cref="string"/></remarks>
48-
public Dictionary<string, string> Args { get; private set; }
49+
public Dictionary<string, object> Args { get; private set; }
50+
51+
/// <summary>
52+
/// Gets the args of the current <see cref="CustomModule"/> with the value converted as string
53+
/// </summary>
54+
public Dictionary<string, string> StringArgs => Args.ConvertToString();
4955

5056
/// <summary>
5157
/// Gets the instance of the <see cref="SummonedCustomRole"/> in which the current <see cref="CustomModule"/> is embedded
5258
/// </summary>
5359
public SummonedCustomRole CustomRole { get; private set; }
5460

55-
internal void Initialize(SummonedCustomRole summonedCustomRole, Dictionary<string, string> args)
61+
internal void Initialize(SummonedCustomRole summonedCustomRole, Dictionary<string, object> args)
5662
{
5763
CustomRole = summonedCustomRole;
5864
Args = args;
@@ -87,24 +93,32 @@ public virtual void OnRemoved()
8793
public virtual void Execute()
8894
{ }
8995

96+
/// <summary>
97+
/// Try to get a generic <see cref="object"/> value from the <see cref="Args"/> and if not present just return a default value.
98+
/// </summary>
99+
/// <param name="param"></param>
100+
/// <param name="def"></param>
101+
/// <returns></returns>
102+
public object TryGetValue(string param, object def = null) => Args.TryGetValue(param, out object value) ? value : def;
103+
90104
/// <summary>
91105
/// Try to get a value from the <see cref="Args"/> and if not present just return a default value.
92106
/// </summary>
93107
/// <param name="param"></param>
94108
/// <param name="def"></param>
95109
/// <returns></returns>
96-
public string TryGetValue(string param, string def = null) => Args.TryGetValue(param, out string value) ? value : def;
110+
public string TryGetStringValue(string param, string def = null) => StringArgs.TryGetValue(param, out string value) ? value : def;
97111

98112
#nullable enable
99113
internal static List<CustomModule> Load(List<object> modules, SummonedCustomRole summonedCustomRole)
100114
{
101115
LogManager.Silent($"[CM Loader] Initialize loading for {summonedCustomRole}\nPreloaded {YamlFlagsHandler.Modules.Length} modules...");
102116

103-
Dictionary<string, Dictionary<string, string>?> data = YamlFlagsHandler.Decode(modules) ?? new();
117+
Dictionary<string, Dictionary<string, object>?> data = YamlFlagsHandler.Decode(modules) ?? new();
104118

105119
List<CustomModule> mods = new();
106120

107-
foreach (KeyValuePair<string, Dictionary<string, string>?> module in data)
121+
foreach (KeyValuePair<string, Dictionary<string, object>?> module in data)
108122
if (InitializeCustomModule(module.Key, module.Value, YamlFlagsHandler.Modules, summonedCustomRole) is CustomModule mod)
109123
mods.Add(mod);
110124

@@ -113,7 +127,7 @@ internal static List<CustomModule> Load(List<object> modules, SummonedCustomRole
113127
return mods;
114128
}
115129

116-
internal static CustomModule? FastAdd(Type type, SummonedCustomRole role, Dictionary<string, string>? args = null)
130+
internal static CustomModule? FastAdd(Type type, SummonedCustomRole role, Dictionary<string, object>? args = null)
117131
{
118132
if (Activator.CreateInstance(type) is not CustomModule module)
119133
{
@@ -127,7 +141,7 @@ internal static List<CustomModule> Load(List<object> modules, SummonedCustomRole
127141
return module;
128142
}
129143

130-
private static CustomModule? InitializeCustomModule(string name, Dictionary<string, string>? args, Type[] types, SummonedCustomRole summonedCustomRole)
144+
private static CustomModule? InitializeCustomModule(string name, Dictionary<string, object>? args, Type[] types, SummonedCustomRole summonedCustomRole)
131145
{
132146
try
133147
{

UncomplicatedCustomRoles/API/Features/CustomModules/CustomPermissions.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,6 @@ public class CustomPermissions : CustomModule
1919
"permissions"
2020
};
2121

22-
internal string[] Permissions => Args.TryGetValue("permissions", out string permissions) ? permissions.Replace(" ", string.Empty).Split(',') : new string[] { };
22+
internal string[] Permissions => StringArgs.TryGetValue("permissions", out string permissions) ? permissions.Replace(" ", string.Empty).Split(',') : new string[] { };
2323
}
2424
}

UncomplicatedCustomRoles/API/Features/CustomModules/CustomScpAnnouncer.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,6 @@ public class CustomScpAnnouncer : CustomModule
1919
"name"
2020
};
2121

22-
internal string RoleName => TryGetValue("name", "SCP 404");
22+
internal string RoleName => TryGetStringValue("name", "SCP 404");
2323
}
2424
}

UncomplicatedCustomRoles/API/Features/CustomModules/DropItemOnDeath.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ public class DropItemOnDeath : CustomModule
1212
"item"
1313
};
1414

15-
public ItemType? Item => Args.TryGetValue("item", out string rawItem) && Enum.TryParse(rawItem, out ItemType item) && item is not ItemType.None ? item : null;
15+
public ItemType? Item => StringArgs.TryGetValue("item", out string rawItem) && Enum.TryParse(rawItem, out ItemType item) && item is not ItemType.None ? item : null;
1616

1717
public override void OnRemoved()
1818
{
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
/*
2+
* This file is a part of the UncomplicatedCustomRoles project.
3+
*
4+
* Copyright (c) 2023-present FoxWorn3365 (Federico Cosma) <me@fcosma.it>
5+
*
6+
* This file is licensed under the GNU Affero General Public License v3.0.
7+
* You should have received a copy of the AGPL license along with this file.
8+
* If not, see <https://www.gnu.org/licenses/>.
9+
*/
10+
11+
using InventorySystem.Items.Usables.Scp330;
12+
using System.Collections.Generic;
13+
14+
namespace UncomplicatedCustomRoles.API.Features.CustomModules
15+
{
16+
public class FullCandyBag : CustomModule
17+
{
18+
public override List<string> RequiredArgs => new()
19+
{
20+
"candies"
21+
};
22+
23+
internal List<CandyKindID> Kinds => Args.TryGetValue("candies", out object kinds) ? kinds as List<CandyKindID> : new();
24+
25+
public override void OnAdded()
26+
{
27+
foreach (CandyKindID kind in Kinds)
28+
CustomRole.Player.TryAddCandy(kind);
29+
}
30+
}
31+
}

UncomplicatedCustomRoles/API/Features/CustomModules/ItemBan.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ public class ItemBan : CustomModule
2121
"item_type"
2222
};
2323

24-
public ItemType? Type => Args.TryGetValue("item_type", out string itemType) && Enum.TryParse(itemType, out ItemType type) ? type : null;
24+
public ItemType? Type => StringArgs.TryGetValue("item_type", out string itemType) && Enum.TryParse(itemType, out ItemType type) ? type : null;
2525

2626
public static bool ValidatePickup(SummonedCustomRole role, Pickup pickup)
2727
{

UncomplicatedCustomRoles/API/Features/CustomModules/LifeStealer.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,6 @@ public class LifeStealer : CustomModule
1919
"percentage"
2020
};
2121

22-
public int Percentage => Args.TryGetValue("percentage", out string perc) && int.TryParse(perc, out int numPerc) ? numPerc : 0; // NOTE: Percentage MUST be an int so like 75 is 75% (0.75)
22+
public int Percentage => StringArgs.TryGetValue("percentage", out string perc) && int.TryParse(perc, out int numPerc) ? numPerc : 0; // NOTE: Percentage MUST be an int so like 75 is 75% (0.75)
2323
}
2424
}

0 commit comments

Comments
 (0)