Skip to content

Commit

Permalink
Update
Browse files Browse the repository at this point in the history
Added death messages to be configurable with groups in config instead of
using the permission node.
  • Loading branch information
M0RG4N01 committed Nov 13, 2016
1 parent 6dce2d7 commit e97a354
Show file tree
Hide file tree
Showing 21 changed files with 52 additions and 12 deletions.
Binary file modified .vs/DeathMessagesRemastered/v14/.suo
Binary file not shown.
41 changes: 34 additions & 7 deletions Class1.cs
Expand Up @@ -16,6 +16,7 @@
using DeathMessages;
using Steamworks;
using SDG.Unturned;
using Rocket.API.Serialisation;

namespace Remastered.DeathMessages
{
Expand All @@ -33,15 +34,27 @@ protected override void Load()

#endregion
Rocket.Core.Logging.Logger.LogError("PLEASE NOTE:");
Rocket.Core.Logging.Logger.LogError("Don't forget to set the permission 'deathmessage' in one of the groups.");
Rocket.Core.Logging.Logger.LogError("Groups options are now configurable in the config!");
Rocket.Core.Logging.Logger.Log("##########################################");


}


private void UnturnedPlayerEvents_OnPlayerDeath(Rocket.Unturned.Player.UnturnedPlayer player, EDeathCause cause, ELimb limb, CSteamID murderer)

{
if (player.HasPermission("deathmessage"))
int num = Provider.clients.Count;
if (Instance.Configuration.Instance.Groups !=null && Instance.Configuration.Instance.Groups.Count > 0)
{
foreach (SteamPlayer current in Provider.clients)
{
if (this.CheckDeathMessage(current.playerID.steamID))
{
num--;
}
}
}
{
if (cause.ToString() == "ZOMBIE")
{
Expand Down Expand Up @@ -100,11 +113,11 @@ private void UnturnedPlayerEvents_OnPlayerDeath(Rocket.Unturned.Player.UnturnedP
{
UnturnedChat.Say(player.CharacterName + " " + this.Configuration.Instance.bleeding, Color.red);
}
else if (cause.ToString() == "LANDMINE")
else if (cause.ToString() == "LANDMINE")
{
UnturnedChat.Say(player.CharacterName + " " + this.Configuration.Instance.landmine, Color.red);
}
else if (cause.ToString() == "BREATH")
else if (cause.ToString() == "BREATH")
{
UnturnedChat.Say(player.CharacterName + " " + this.Configuration.Instance.breath, Color.red);
}
Expand Down Expand Up @@ -161,7 +174,7 @@ private void UnturnedPlayerEvents_OnPlayerDeath(Rocket.Unturned.Player.UnturnedP
{
UnturnedChat.Say(player.CharacterName + " " + this.Configuration.Instance.suicide, Color.red);
}

}
}
protected override void Unload()
Expand All @@ -181,6 +194,20 @@ public void UnturnedPlayerEvents_OnPlayerUpdateHealth(Rocket.Unturned.Player.Unt
}
}
}
private bool CheckDeathMessage(CSteamID CSteamID)
{
if (SteamAdminlist.checkAdmin(CSteamID))
{
return true;
}
foreach (RocketPermissionsGroup current in R.Permissions.GetGroups(new RocketPlayer(CSteamID.ToString(), null, false), true))
{
if (Instance.Configuration.Instance.Groups.Contains(current.Id))
{
return true;
}
}
return false;
}
}

}
14 changes: 12 additions & 2 deletions DMC.cs
@@ -1,4 +1,6 @@
using Rocket.API;
using System.Collections.Generic;
using System.Xml.Serialization;

namespace DeathMessages
{
Expand Down Expand Up @@ -40,7 +42,9 @@ public class DMC2 : IRocketPluginConfiguration
public string fire;
public string spark;
public string boulder;

[XmlArray("Groups"), XmlArrayItem(ElementName = "Group")]
public List<string> Groups = new List<string>();

public void LoadDefaults()
{

Expand Down Expand Up @@ -79,7 +83,13 @@ public void LoadDefaults()
fire = "was killed by fire!";
spark = "has been sparked out";
boulder = "was killed by a gigantic boulder!";

this.Groups = new List<string>
{
"default",
"vip"
};
}

}

}
5 changes: 2 additions & 3 deletions DeathMessagesRemastered.csproj
Expand Up @@ -39,9 +39,8 @@
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\..\Program Files (x86)\Steam\steamapps\common\Unturned\Unturned_Data\Managed\Assembly-CSharp-firstpass.dll</HintPath>
</Reference>
<Reference Include="Assembly-UnityScript-firstpass, Version=0.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\..\Program Files (x86)\Steam\steamapps\common\Unturned\Unturned_Data\Managed\Assembly-UnityScript-firstpass.dll</HintPath>
<Reference Include="Assembly-UnityScript-firstpass">
<HintPath>C:\Program Files (x86)\Steam\steamapps\common\Unturned\Unturned_Data\Managed\Assembly-UnityScript-firstpass.dll</HintPath>
</Reference>
<Reference Include="Rocket.API, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
Expand Down
Binary file added bin/Release/Assembly-CSharp-firstpass.dll
Binary file not shown.
Binary file added bin/Release/Assembly-CSharp.dll
Binary file not shown.
Binary file added bin/Release/Assembly-UnityScript-firstpass.dll
Binary file not shown.
Binary file added bin/Release/Boo.Lang.dll
Binary file not shown.
Binary file modified bin/Release/DeathMessagesRemastered.dll
Binary file not shown.
Binary file added bin/Release/DeathMessagesRemastered.pdb
Binary file not shown.
Binary file added bin/Release/Newtonsoft.Json.dll
Binary file not shown.
Binary file added bin/Release/Rocket.API.dll
Binary file not shown.
Binary file added bin/Release/Rocket.Core.dll
Binary file not shown.
Binary file added bin/Release/Rocket.Unturned.dll
Binary file not shown.
Binary file added bin/Release/UnityEngine.dll
Binary file not shown.
Binary file added bin/Release/UnityScript.Lang.dll
Binary file not shown.
Expand Up @@ -9,3 +9,7 @@ E:\Death-Messages-Remasterd\bin\Release\DeathMessagesRemastered.dll
E:\Death-Messages-Remasterd\bin\Release\DeathMessagesRemastered.pdb
E:\Death-Messages-Remasterd\obj\Release\DeathMessagesRemastered.dll
E:\Death-Messages-Remasterd\obj\Release\DeathMessagesRemastered.pdb
E:\Death-Messages-Remasterd\obj\Release\DeathMessagesRemastered.csprojResolveAssemblyReference.cache
E:\Death-Messages-Remasterd\bin\Release\Assembly-UnityScript-firstpass.dll
E:\Death-Messages-Remasterd\bin\Release\Boo.Lang.dll
E:\Death-Messages-Remasterd\bin\Release\UnityScript.Lang.dll
Binary file not shown.
Binary file modified obj/Release/DeathMessagesRemastered.dll
Binary file not shown.
Binary file modified obj/Release/DeathMessagesRemastered.pdb
Binary file not shown.
Binary file modified obj/Release/DesignTimeResolveAssemblyReferencesInput.cache
Binary file not shown.

0 comments on commit e97a354

Please sign in to comment.