Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rework #1

Merged
merged 23 commits into from
Sep 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name: Bug report
about: Create a report to help us improve
title: ''
labels: needs testing
assignees: joker-119
assignees: Mikihero

---

Expand All @@ -20,17 +20,17 @@ Steps to reproduce the behavior:
**Expected behavior**
A clear and concise description of what you expected to happen.

**Server logs**
Please include a pastebin of your localadmin log file (or both MA_log and SCP_log files if you use MultiAdmin) from the time in which the bug occured

**Copy of current CU config section**
**Actual behavior**
A clear and concise description of what actually happens.

**Copy of the relevant CU config section**
If you're experiencing an issue with the Class Max Health module, then post that entire part. Skip this if config is not relevant.

**EXILED Version ("latest" is not a version):**
For example 8.9.2


**Results of `show plugins` command in console:**
**Screenshot of the results of the `plym show` command in server console:**


**Additional context**
Add any other context about the problem here.
Add any other relevant context about the problem here.
27 changes: 12 additions & 15 deletions Common Utilities/API.cs
Original file line number Diff line number Diff line change
@@ -1,16 +1,13 @@
namespace Common_Utilities
{
using System.Collections.Generic;

using Exiled.API.Features;
using PlayerRoles;

public static class API
{
public static List<ItemType> GetStartItems(RoleTypeId role) => Main.Instance.PlayerHandlers.StartItems(role);

public static List<ItemType> GetStartItems(RoleTypeId role, Player player) => Main.Instance.PlayerHandlers.StartItems(role, player);

public static float GetHealthOnKill(RoleTypeId role) => Main.Instance.Config.HealthOnKill?.ContainsKey(role) ?? false ? Main.Instance.Config.HealthOnKill[role] : 0f;
}
namespace Common_Utilities.API;

using System.Collections.Generic;
using Exiled.API.Features;
using PlayerRoles;

public static class API
{
// API methods for potential use by other plugins, not sure if anyone actually uses this
public static float GetHealthOnKill(RoleTypeId role) => Plugin.Instance.Config.HealthOnKill?.ContainsKey(role) ?? false ? Plugin.Instance.Config.HealthOnKill[role] : 0f;

public static List<ItemType> GetStartItems(RoleTypeId role, Player player = null) => Plugin.Instance.playerHandlers.GetStartingInventory(role, player);
}
3 changes: 1 addition & 2 deletions Common Utilities/Common Utilities.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,8 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="EXILED" Version="8.4.3" />
<PackageReference Include="EXILEDOFFICIAL" Version="8.11.0" />
<PackageReference Include="StyleCop.Analyzers" Version="$(StyleCopVersion)" IncludeAssets="All" PrivateAssets="All" />
<PackageReference Include="Lib.Harmony" Version="$(HarmonyVersion)" />
</ItemGroup>

<ItemGroup>
Expand Down
74 changes: 39 additions & 35 deletions Common Utilities/Config.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,32 +14,41 @@ namespace Common_Utilities

public class Config : IConfig
{
[Description("If the plugin is enabled or not.")]
public bool IsEnabled { get; set; } = true;

[Description("Whether or not debug messages should be shown.")]
public bool Debug { get; set; } = false;

[Description("Whether or not MTF/CI can 'escape' while disarmed to switch teams.")]
public bool DisarmSwitchTeams { get; set; } = true;

[Description("Whether or not disarmed people will be prevented from interacting with doors/elevators.")]
public bool RestrictiveDisarming { get; set; } = true;
Mikihero marked this conversation as resolved.
Show resolved Hide resolved
[Description("Roles that when cuffed in the escape area will change into the target one.")]
public Dictionary<RoleTypeId, RoleTypeId> DisarmedEscapeSwitchRole { get; set; } =
new()
{
{
RoleTypeId.NtfCaptain, RoleTypeId.ChaosMarauder
},
{
RoleTypeId.ChaosMarauder, RoleTypeId.NtfCaptain
},
};

[Description("The text displayed at the timed interval specified below.")]
public string TimedBroadcast { get; set; } = "<color=#bfff00>This server is running </color><color=red>EXILED Common-Utilities</color><color=lime>, enjoy your stay!</color>";
public string TimedBroadcast { get; set; } = "<color=#bfff00>This server is running </color><color=red>EXILED Common-Utilities</color><color=#bfff00>, enjoy your stay!</color>";

[Description("The time each timed broadcast will be displayed.")]
public ushort TimedBroadcastDuration { get; set; } = 5;

[Description("The delay between each timed broadcast. To disable timed broadcasts, set this to 0")]
public float TimedBroadcastDelay { get; set; } = 300f;
public float TimedBroadcastDelay { get; set; } = 0;

[Description("The message displayed to the player when they first join the server. Setting this to empty will disable these broadcasts.")]
public string JoinMessage { get; set; } = "<color=lime>Welcome %player%! Please read our rules!</color>";
public string JoinMessage { get; set; } = string.Empty;

[Description("The amount of time (in seconds) the join message is displayed.")]
public ushort JoinMessageDuration { get; set; } = 5;

[Description("The amount of time (in seconds) after the round starts, before the facilities auto-nuke will start.")]
public float AutonukeTime { get; set; } = 1500f;
[Description("The amount of time (in seconds) after the round starts, before the facilities auto-nuke will start. Set to -1 to disable.")]
public float AutonukeTime { get; set; } = -1;

[Description("Wether or not the nuke should be unable to be disabled during the auto-nuke countdown.")]
public bool AutonukeLock { get; set; } = true;
Expand All @@ -54,26 +63,31 @@ public class Config : IConfig
};

[Description("Whether or not to show player's health under their name when you look at them.")]
public bool PlayerHealthInfo { get; set; } = true;
public bool PlayerHealthInfo { get; set; } = false;

[Description("Whether or not friendly fire should automatically turn on when a round ends (it will turn itself back off before the next round starts).")]
public bool FriendlyFireOnRoundEnd { get; set; } = false;

[Description("The multiplier applied to radio battery usage. Set to 0 to disable radio battery drain.")]
public float RadioBatteryDrainMultiplier { get; set; } = 1f;

[Description("The color to use for lights while the warhead is active.")]
public Color WarheadColor { get; set; } = new(1f, 0.2f, 0.2f);
[Description("Whether to change the color of lights while warhead is active.")]
public bool ChangeWarheadColor { get; set; } = false;

[Description("The color to use for lights while the warhead is active. In the RGBA format using values between 0 and 1. Ignored if ChangeWarheadColor is set to false.")]
public Color WarheadColor { get; set; } = new(1f, 0.2f, 0.2f, 1);

[Description("The maximum time, in seconds, that a player can be AFK before being kicked. Set to -1 to disable AFK system.")]
public int AfkLimit { get; set; } = 120;
public int AfkLimit { get; set; } = -1;

[Description("The roles that are ignored by the AFK system.")]
public List<RoleTypeId> AfkIgnoredRoles { get; set; } = new()
{
RoleTypeId.Scp079,
RoleTypeId.Spectator,
RoleTypeId.Tutorial,
RoleTypeId.Filmmaker,
RoleTypeId.Overwatch,
};

[Description("Whether or not probabilities should be additive (50 + 50 = 100) or not (50 + 50 = 2 seperate 50% chances)")]
Expand Down Expand Up @@ -114,7 +128,7 @@ public class Config : IConfig
{
new()
{
Type = ItemType.Ammo556x45,
AmmoType = ItemType.Ammo556x45,
Amount = 200,
Group = "none",
},
Expand All @@ -123,19 +137,17 @@ public class Config : IConfig
},
};

[Description("The list of custom 914 recipies. Original is the item being upgraded, New is the item to upgrade to, and Chance is the percent chance of the upgrade happening. You can specify multiple upgrade choices for the same item.")]
public Dictionary<Scp914KnobSetting, List<ItemUpgradeChance>> Scp914ItemChanges { get; set; } = new()
[Description("The list of custom 914 recipies. OriginalItem is the item being upgraded, NewItem is the item to upgrade to, and Chance is the percent chance of the upgrade happening. You can specify multiple upgrade choices for the same item.")]
public Dictionary<Scp914KnobSetting, List<ItemUpgradeChance>> Scp914ItemChances { get; set; } = new()
{
{
Scp914KnobSetting.Rough, new List<ItemUpgradeChance>
{
new()
{
new()
{
Original = ItemType.KeycardO5,
New = ItemType.MicroHID,
Chance = 50,
}
Original = ItemType.KeycardO5.ToString(),
New = ItemType.MicroHID.ToString(),
Chance = 50,
},
}
},
Expand All @@ -150,7 +162,7 @@ public class Config : IConfig
{
new()
{
Original = RoleTypeId.ClassD,
Original = RoleTypeId.ClassD.ToString(),
New = RoleTypeId.Spectator.ToString(),
Chance = 100,
}
Expand All @@ -159,7 +171,7 @@ public class Config : IConfig
},
};

[Description("The list of 914 teleport settings. Note that if you set \"zone\" to anything other than Unspecified, it will always select a random room from that zone that isn't in the ignoredRooms list, instead of the room type defined.")]
[Description("The list of 914 teleport settings. Note that if you set \"zone\" to anything other than Unspecified, it will always select a random room from that zone that isn't in the ignoredRooms list, instead of the provided room type.")]
public Dictionary<Scp914KnobSetting, List<Scp914TeleportChance>> Scp914TeleportChances { get; set; } = new()
{
{
Expand All @@ -168,7 +180,7 @@ public class Config : IConfig
new()
{
Room = RoomType.LczClassDSpawn,
Chance = 100,
Chance = 50,
},
new()
{
Expand All @@ -177,6 +189,7 @@ public class Config : IConfig
{
RoomType.Lcz173,
},
Chance = 100,
},
}
},
Expand Down Expand Up @@ -237,9 +250,6 @@ public class Config : IConfig
{
RoleTypeId.Scp173, 0
},
{
RoleTypeId.Scp939, 10
},
};

[Description("A list of roles and what their default starting health should be.")]
Expand All @@ -248,12 +258,6 @@ public class Config : IConfig
{
RoleTypeId.Scp173, 3200
},
{
RoleTypeId.NtfCaptain, 150
},
};

[Description("If the plugin is enabled or not.")]
public bool IsEnabled { get; set; } = true;
}
}
5 changes: 2 additions & 3 deletions Common Utilities/ConfigObjects/ItemChance.cs
Original file line number Diff line number Diff line change
@@ -1,17 +1,16 @@
namespace Common_Utilities.ConfigObjects;

public class ItemChance
public class ItemChance : IChanceObject
{
public string ItemName { get; set; } = ItemType.None.ToString();

public double Chance { get; set; }

public string Group { get; set; } = "none";

public void Deconstruct(out string name, out double i, out string groupKey)
public void Deconstruct(out string name, out double i)
{
name = ItemName;
i = Chance;
groupKey = Group;
}
}
14 changes: 7 additions & 7 deletions Common Utilities/ConfigObjects/ItemUpgradeChance.cs
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
namespace Common_Utilities.ConfigObjects
{
public class ItemUpgradeChance
public class ItemUpgradeChance : IChanceObject
{
public ItemType Original { get; set; }
public string Original { get; set; }

public ItemType New { get; set; }
public string New { get; set; }

public double Chance { get; set; }

public int Count { get; set; } = 1;

public void Deconstruct(out ItemType itemType, out ItemType itemType1, out double i, out int count)
public void Deconstruct(out string originalItem, out string destinationItem, out double chance, out int count)
{
itemType = Original;
itemType1 = New;
i = Chance;
originalItem = Original;
destinationItem = New;
chance = Chance;
count = Count;
}
}
Expand Down
10 changes: 5 additions & 5 deletions Common Utilities/ConfigObjects/PlayerUpgradeChance.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ namespace Common_Utilities.ConfigObjects
{
using PlayerRoles;

public class PlayerUpgradeChance
public class PlayerUpgradeChance : IChanceObject
{
public RoleTypeId Original { get; set; }
public string Original { get; set; }

public string New { get; set; } = RoleTypeId.Spectator.ToString();

Expand All @@ -14,11 +14,11 @@ public class PlayerUpgradeChance

public bool KeepHealth { get; set; } = true;

public void Deconstruct(out RoleTypeId old, out string newRole, out double i, out bool keepInventory, out bool keepHealth)
public void Deconstruct(out string oldRole, out string newRole, out double chance, out bool keepInventory, out bool keepHealth)
{
old = Original;
oldRole = Original;
newRole = New;
i = Chance;
chance = Chance;
keepInventory = KeepInventory;
keepHealth = KeepHealth;
}
Expand Down
2 changes: 1 addition & 1 deletion Common Utilities/ConfigObjects/Scp914EffectChance.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ namespace Common_Utilities.ConfigObjects
{
using Exiled.API.Enums;

public class Scp914EffectChance
public class Scp914EffectChance : IChanceObject
{
public EffectType Effect { get; set; }

Expand Down
40 changes: 19 additions & 21 deletions Common Utilities/ConfigObjects/Scp914TeleportChance.cs
Original file line number Diff line number Diff line change
@@ -1,32 +1,30 @@
namespace Common_Utilities.ConfigObjects;

using System.Collections.Generic;
using Exiled.API.Enums;
using UnityEngine;

namespace Common_Utilities.ConfigObjects
public class Scp914TeleportChance : IChanceObject
{
using Exiled.API.Enums;
using UnityEngine;
public ZoneType Zone { get; set; } = ZoneType.Unspecified;

public class Scp914TeleportChance
{
public ZoneType Zone { get; set; } = ZoneType.Unspecified;

public List<RoomType> IgnoredRooms { get; set; }
public List<RoomType> IgnoredRooms { get; set; } = new();

public RoomType Room { get; set; }
public RoomType Room { get; set; } = RoomType.Unknown;

public Vector3 Offset { get; set; } = Vector3.zero;
public Vector3 Offset { get; set; } = Vector3.zero;

public double Chance { get; set; }
public double Chance { get; set; }

public float Damage { get; set; } = 0f;
public float Damage { get; set; } = 0f;

public void Deconstruct(out RoomType room, out List<RoomType> ignoredRooms, out Vector3 offset, out double chance, out float damage, out ZoneType zone)
{
room = Room;
ignoredRooms = IgnoredRooms;
offset = Offset;
chance = Chance;
damage = Damage;
zone = Zone;
}
public void Deconstruct(out RoomType room, out List<RoomType> ignoredRooms, out Vector3 offset, out double chance, out float damage, out ZoneType zone)
{
room = Room;
ignoredRooms = IgnoredRooms;
offset = Offset;
chance = Chance;
damage = Damage;
zone = Zone;
}
}
Loading