Skip to content
This repository has been archived by the owner on Jul 8, 2021. It is now read-only.

Commit

Permalink
Player's can no longer hide their tags >:(
Browse files Browse the repository at this point in the history
  • Loading branch information
MrMith committed Apr 10, 2019
1 parent 15569cd commit b8f9b14
Show file tree
Hide file tree
Showing 4 changed files with 77 additions and 47 deletions.
15 changes: 15 additions & 0 deletions SCP-343/SCP-343.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,9 @@
<AutoGenerateBindingRedirects>false</AutoGenerateBindingRedirects>
</PropertyGroup>
<ItemGroup>
<Reference Include="Assembly-CSharp">
<HintPath>..\..\..\..\steamcmd\steamapps\common\SCP Secret Laboratory\SCPSL_Data\Managed\Assembly-CSharp.dll</HintPath>
</Reference>
<Reference Include="Smod2">
<HintPath>..\..\..\..\steamcmd\steamapps\common\SCP Secret Laboratory\SCPSL_Data\Managed\Smod2.dll</HintPath>
</Reference>
Expand All @@ -50,6 +53,18 @@
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="System.Data" />
<Reference Include="System.Xml" />
<Reference Include="UnityEngine">
<HintPath>..\..\..\..\steamcmd\steamapps\common\SCP Secret Laboratory\SCPSL_Data\Managed\UnityEngine.dll</HintPath>
</Reference>
<Reference Include="UnityEngine.CoreModule">
<HintPath>..\..\..\..\steamcmd\steamapps\common\SCP Secret Laboratory\SCPSL_Data\Managed\UnityEngine.CoreModule.dll</HintPath>
</Reference>
<Reference Include="UnityEngine.Networking">
<HintPath>..\..\..\..\steamcmd\steamapps\common\SCP Secret Laboratory\SCPSL_Data\Managed\UnityEngine.Networking.dll</HintPath>
</Reference>
<Reference Include="UnityEngine.PhysicsModule">
<HintPath>..\..\..\..\steamcmd\steamapps\common\SCP Secret Laboratory\SCPSL_Data\Managed\UnityEngine.PhysicsModule.dll</HintPath>
</Reference>
</ItemGroup>
<ItemGroup>
<Compile Include="PlayerInfo.cs" />
Expand Down
2 changes: 1 addition & 1 deletion SCP-343/SCP_343.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ namespace SCP_343
name = "SCP-343",
description = "SCP-343 is a passive immortal D-Class Personnel. He spawns with one Flashlight and any weapon he picks up is morphed to prevent violence. He seeks to help out who he deems worthy.",
id = "Mith.SCP-343",
version = "1.4.0",
version = "1.4.1",
SmodMajor = 3,
SmodMinor = 4,
SmodRevision = 0
Expand Down
24 changes: 12 additions & 12 deletions SCP-343/SCP_343Commands.cs
Original file line number Diff line number Diff line change
Expand Up @@ -37,37 +37,37 @@ public string[] OnCall(ICommandSender sender, string[] args)
Regex regex = new Regex(@"\D+");
string PlayerIDString = regex.Replace(args[0],"");

foreach (Player Playa in PluginManager.Manager.Server.GetPlayers())
foreach (Player player in PluginManager.Manager.Server.GetPlayers())
{
if (Int32.TryParse(PlayerIDString, out int PlayerIDInt))
{
if (Playa.PlayerId == PlayerIDInt)
if (player.PlayerId == PlayerIDInt)
{
Playa.ChangeRole(Smod2.API.Role.CLASSD, true, true, true);
Playa.GiveItem(ItemType.FLASHLIGHT);
player.ChangeRole(Smod2.API.Role.CLASSD, true, true, true);
player.GiveItem(ItemType.FLASHLIGHT);

if (pluginOptions.SCP343_HP != -1)
{
Playa.SetHealth(pluginOptions.SCP343_HP);
player.SetHealth(pluginOptions.SCP343_HP);
}

if (Playa.GetUserGroup().BadgeText == null)
if (player.GetUserGroup().BadgeText == null)
{
Active343AndBadgeDict.Add(Playa.SteamId, new PlayerInfo("", ""));
Active343AndBadgeDict.Add(player.SteamId, new PlayerInfo("", ""));
}
else
{
Active343AndBadgeDict.Add(Playa.SteamId, new PlayerInfo(Playa.GetUserGroup().BadgeText, Playa.GetUserGroup().Color));
Active343AndBadgeDict.Add(player.SteamId, new PlayerInfo(player.GetUserGroup().BadgeText, player.GetUserGroup().Color));
}

if (pluginOptions.SCP343_shouldbroadcast)
{
Playa.PersonalBroadcast(5, "You're SCP-343! Check your console for more information about SCP-343.", true);
Playa.SendConsoleMessage("----------------------------------------------------------- \n" + pluginOptions.SCP343_broadcastinfo + "\n ----------------------------------------------------------- ");
player.PersonalBroadcast(5, "You're SCP-343! Check your console for more information about SCP-343.", true);
player.SendConsoleMessage("----------------------------------------------------------- \n" + pluginOptions.SCP343_broadcastinfo + "\n ----------------------------------------------------------- ");
}

Playa.SetRank("red", "SCP-343");
return new string[] { "Made " + Playa.Name + " SCP343!" };
player.SetRank("red", "SCP-343");
return new string[] { "Made " + player.Name + " SCP343!" };
}
}
}
Expand Down
83 changes: 49 additions & 34 deletions SCP-343/SCP_343EventLogic.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,13 @@ public class EventLogic : IEventHandlerPlayerPickupItem, IEventHandlerRoundStart
{
Random RNG = new Random();

DateTime timeOnEvent = DateTime.Now;

public Dictionary<string, PlayerInfo> Active343AndBadgeDict =
new Dictionary<string, PlayerInfo>();

public Dictionary<Team, int> teamAliveCount =
new Dictionary<Team, int>();
public Dictionary<Smod2.API.Team, int> teamAliveCount =
new Dictionary<Smod2.API.Team, int>();

public PluginOptions _343Config = new PluginOptions();

Expand Down Expand Up @@ -51,11 +53,11 @@ public void OnRoundStart(RoundStartEvent ev)
return;
}

foreach (Smod2.API.Player Playa in plugin.PluginManager.Server.GetPlayers())
foreach (Smod2.API.Player player in plugin.PluginManager.Server.GetPlayers())
{
if (Playa.TeamRole.Role == Smod2.API.Role.CLASSD)
if (player.TeamRole.Role == Smod2.API.Role.CLASSD)
{
DClassList.Add(Playa);
DClassList.Add(player);
}
}

Expand Down Expand Up @@ -155,7 +157,7 @@ public void OnPlayerHurt(PlayerHurtEvent ev)
{
if (Active343AndBadgeDict.ContainsKey(ev.Player.SteamId))
{
if (ev.Attacker?.TeamRole.Team == Team.SCP)
if (ev.Attacker?.TeamRole.Team == Smod2.API.Team.SCP)
{
ev.Damage = 0;
}
Expand Down Expand Up @@ -241,48 +243,61 @@ public void OnCheckRoundEnd(CheckRoundEndEvent ev)
if (Active343AndBadgeDict.Count >= 1 && !_343Config.SCP343_debug)
{
teamAliveCount.Clear();
foreach (Team team in Enum.GetValues(typeof(Team)))
foreach (Smod2.API.Team team in Enum.GetValues(typeof(Smod2.API.Team)))
{
teamAliveCount[team] = 0;
}

foreach (Player player in PluginManager.Manager.Server.GetPlayers())
{
if (DateTime.Now >= timeOnEvent)
{
if (Active343AndBadgeDict.ContainsKey(player.SteamId))
{
UnityEngine.GameObject playerGameObject = ((UnityEngine.GameObject)player.GetGameObject());
if (playerGameObject?.GetComponent<ServerRoles>()?.NetworkMyText != "SCP-343" || playerGameObject?.GetComponent<ServerRoles>()?.NetworkMyColor != "red")
{
player.HideTag(false);
player.SetRank("red","SCP-343");
timeOnEvent = DateTime.Now.AddSeconds(1);
}
}
}
teamAliveCount[player.TeamRole.Team]++;
}

if (_343Config.SCP343_HP == -1)
{
if (teamAliveCount[Team.SCP] == 0
&& teamAliveCount[Team.CHAOS_INSURGENCY] == 0
&& teamAliveCount[Team.CLASSD] == Active343AndBadgeDict.Count
&& teamAliveCount[Team.SCIENTIST] == 0)
if (teamAliveCount[Smod2.API.Team.SCP] == 0
&& teamAliveCount[Smod2.API.Team.CHAOS_INSURGENCY] == 0
&& teamAliveCount[Smod2.API.Team.CLASSD] == Active343AndBadgeDict.Count
&& teamAliveCount[Smod2.API.Team.SCIENTIST] == 0)
{
Smod2.PluginManager.Manager.Server.Round.Stats.ScientistsEscaped = 1;
Smod2.PluginManager.Manager.Server.Round.Stats.ClassDEscaped = 0;
ev.Status = ROUND_END_STATUS.MTF_VICTORY;
}//If SCPs, Chaos, ClassD and Scientists are dead then MTF win.
else if (teamAliveCount[Team.SCP] == 0
&& teamAliveCount[Team.CLASSD] == Active343AndBadgeDict.Count
&& teamAliveCount[Team.SCIENTIST] == 0
&& teamAliveCount[Team.NINETAILFOX] == 0)
else if (teamAliveCount[Smod2.API.Team.SCP] == 0
&& teamAliveCount[Smod2.API.Team.CLASSD] == Active343AndBadgeDict.Count
&& teamAliveCount[Smod2.API.Team.SCIENTIST] == 0
&& teamAliveCount[Smod2.API.Team.NINETAILFOX] == 0)
{
Smod2.PluginManager.Manager.Server.Round.Stats.ClassDEscaped = 0;
Smod2.PluginManager.Manager.Server.Round.Stats.ScientistsEscaped = 0;
ev.Status = ROUND_END_STATUS.CI_VICTORY;
}//If SCPs, ClassD, Scientists and MTF are dead then Chaos win.
else if (teamAliveCount[Team.NINETAILFOX] == 0
&& teamAliveCount[Team.CHAOS_INSURGENCY] == 0
&& teamAliveCount[Team.CLASSD] == Active343AndBadgeDict.Count
&& teamAliveCount[Team.SCIENTIST] == 0)
else if (teamAliveCount[Smod2.API.Team.NINETAILFOX] == 0
&& teamAliveCount[Smod2.API.Team.CHAOS_INSURGENCY] == 0
&& teamAliveCount[Smod2.API.Team.CLASSD] == Active343AndBadgeDict.Count
&& teamAliveCount[Smod2.API.Team.SCIENTIST] == 0)
{
Smod2.PluginManager.Manager.Server.Round.Stats.ClassDEscaped = 0;
Smod2.PluginManager.Manager.Server.Round.Stats.ScientistsEscaped = 0;
ev.Status = ROUND_END_STATUS.SCP_VICTORY;
} //If MTF, Chaos, ClassD and Scientists are dead then SCPs win.
else if (teamAliveCount[Team.NINETAILFOX] == 0
&& teamAliveCount[Team.CLASSD] == Active343AndBadgeDict.Count
&& teamAliveCount[Team.SCIENTIST] == 0)
else if (teamAliveCount[Smod2.API.Team.NINETAILFOX] == 0
&& teamAliveCount[Smod2.API.Team.CLASSD] == Active343AndBadgeDict.Count
&& teamAliveCount[Smod2.API.Team.SCIENTIST] == 0)
{
Smod2.PluginManager.Manager.Server.Round.Stats.ClassDEscaped = 0;
Smod2.PluginManager.Manager.Server.Round.Stats.ScientistsEscaped = 0;
Expand All @@ -291,18 +306,18 @@ public void OnCheckRoundEnd(CheckRoundEndEvent ev)
}
else
{
if (teamAliveCount[Team.NINETAILFOX] == 0
&& teamAliveCount[Team.CHAOS_INSURGENCY] == 0
&& teamAliveCount[Team.CLASSD] == Active343AndBadgeDict.Count
&& teamAliveCount[Team.SCIENTIST] == 0)
if (teamAliveCount[Smod2.API.Team.NINETAILFOX] == 0
&& teamAliveCount[Smod2.API.Team.CHAOS_INSURGENCY] == 0
&& teamAliveCount[Smod2.API.Team.CLASSD] == Active343AndBadgeDict.Count
&& teamAliveCount[Smod2.API.Team.SCIENTIST] == 0)
{
Smod2.PluginManager.Manager.Server.Round.Stats.ClassDEscaped = 0;
Smod2.PluginManager.Manager.Server.Round.Stats.ScientistsEscaped = 0;
ev.Status = ROUND_END_STATUS.SCP_VICTORY;
} //If MTF, Chaos, ClassD and Scientists are dead then SCPs win.
else if (teamAliveCount[Team.NINETAILFOX] == 0
&& teamAliveCount[Team.CLASSD] == Active343AndBadgeDict.Count
&& teamAliveCount[Team.SCIENTIST] == 0)
else if (teamAliveCount[Smod2.API.Team.NINETAILFOX] == 0
&& teamAliveCount[Smod2.API.Team.CLASSD] == Active343AndBadgeDict.Count
&& teamAliveCount[Smod2.API.Team.SCIENTIST] == 0)
{
Smod2.PluginManager.Manager.Server.Round.Stats.ClassDEscaped = 1;
Smod2.PluginManager.Manager.Server.Round.Stats.ScientistsEscaped = 0;
Expand Down Expand Up @@ -346,13 +361,13 @@ public void OnPocketDimensionEnter(PlayerPocketDimensionEnterEvent ev)
/// </summary>
public void OnRoundEnd(RoundEndEvent ev)
{
foreach (Player playa in Smod2.PluginManager.Manager.Server.GetPlayers())
foreach (Player player in Smod2.PluginManager.Manager.Server.GetPlayers())
{
if (Active343AndBadgeDict.ContainsKey(playa.SteamId))
if (Active343AndBadgeDict.ContainsKey(player.SteamId))
{
playa.SetRank(Active343AndBadgeDict[playa.SteamId].BadgeColor, Active343AndBadgeDict[playa.SteamId].BadgeName);
playa.SetHealth(100);
Active343AndBadgeDict.Remove(playa.SteamId);
player.SetRank(Active343AndBadgeDict[player.SteamId].BadgeColor, Active343AndBadgeDict[player.SteamId].BadgeName);
player.SetHealth(100);
Active343AndBadgeDict.Remove(player.SteamId);
}
}
Active343AndBadgeDict.Clear();
Expand Down

0 comments on commit b8f9b14

Please sign in to comment.