-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
076ffd2
commit 82b04c0
Showing
15 changed files
with
253 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
|
||
Microsoft Visual Studio Solution File, Format Version 12.00 | ||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CustomChatColors", "CustomChatColors\CustomChatColors.csproj", "{4E66C6D8-1DCD-4A6E-A353-6EE6D4C119CA}" | ||
EndProject | ||
Global | ||
GlobalSection(SolutionConfigurationPlatforms) = preSolution | ||
Debug|Any CPU = Debug|Any CPU | ||
Release|Any CPU = Release|Any CPU | ||
EndGlobalSection | ||
GlobalSection(ProjectConfigurationPlatforms) = postSolution | ||
{4E66C6D8-1DCD-4A6E-A353-6EE6D4C119CA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | ||
{4E66C6D8-1DCD-4A6E-A353-6EE6D4C119CA}.Debug|Any CPU.Build.0 = Debug|Any CPU | ||
{4E66C6D8-1DCD-4A6E-A353-6EE6D4C119CA}.Release|Any CPU.ActiveCfg = Release|Any CPU | ||
{4E66C6D8-1DCD-4A6E-A353-6EE6D4C119CA}.Release|Any CPU.Build.0 = Release|Any CPU | ||
EndGlobalSection | ||
EndGlobal |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
<wpf:ResourceDictionary xml:space="preserve" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:s="clr-namespace:System;assembly=mscorlib" xmlns:ss="urn:shemas-jetbrains-com:settings-storage-xaml" xmlns:wpf="http://schemas.microsoft.com/winfx/2006/xaml/presentation"> | ||
<s:Boolean x:Key="/Default/AddReferences/RecentPaths/=C_003A_005CUsers_005Cpapershredder432_005CRiderProjects_005CCustomChatColors_005CCustomChatColors_005Clibs_005CAssembly_002DCSharp_002Edll/@EntryIndexedValue">True</s:Boolean> | ||
<s:Boolean x:Key="/Default/AddReferences/RecentPaths/=C_003A_005CUsers_005Cpapershredder432_005CRiderProjects_005CCustomChatColors_005CCustomChatColors_005Clibs_005Ccom_002Erlabrecque_002Esteamworks_002Enet_002Edll/@EntryIndexedValue">True</s:Boolean> | ||
<s:Boolean x:Key="/Default/AddReferences/RecentPaths/=C_003A_005CUsers_005Cpapershredder432_005CRiderProjects_005CCustomChatColors_005CCustomChatColors_005Clibs_005CRocket_002EAPI_002Edll/@EntryIndexedValue">True</s:Boolean> | ||
<s:Boolean x:Key="/Default/AddReferences/RecentPaths/=C_003A_005CUsers_005Cpapershredder432_005CRiderProjects_005CCustomChatColors_005CCustomChatColors_005Clibs_005CRocket_002ECore_002Edll/@EntryIndexedValue">True</s:Boolean> | ||
<s:Boolean x:Key="/Default/AddReferences/RecentPaths/=C_003A_005CUsers_005Cpapershredder432_005CRiderProjects_005CCustomChatColors_005CCustomChatColors_005Clibs_005CRocket_002EUnturned_002Edll/@EntryIndexedValue">True</s:Boolean> | ||
<s:Boolean x:Key="/Default/AddReferences/RecentPaths/=C_003A_005CUsers_005Cpapershredder432_005CRiderProjects_005CCustomChatColors_005CCustomChatColors_005Clibs_005CSDG_002ENetTransport_002Edll/@EntryIndexedValue">True</s:Boolean> | ||
<s:Boolean x:Key="/Default/AddReferences/RecentPaths/=C_003A_005CUsers_005Cpapershredder432_005CRiderProjects_005CCustomChatColors_005CCustomChatColors_005Clibs_005CUnityEngine_002ECoreModule_002Edll/@EntryIndexedValue">True</s:Boolean> | ||
<s:Boolean x:Key="/Default/AddReferences/RecentPaths/=C_003A_005CUsers_005Cpapershredder432_005CRiderProjects_005CCustomChatColors_005CCustomChatColors_005Clibs_005CUnityEngine_002Edll/@EntryIndexedValue">True</s:Boolean></wpf:ResourceDictionary> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
using System; | ||
using System.Linq; | ||
using Rocket.Core.Plugins; | ||
using Rocket.Unturned.Player; | ||
using SDG.Unturned; | ||
using UnityEngine; | ||
|
||
namespace CustomChatColors | ||
{ | ||
public class CustomChatColors : RocketPlugin<CustomChatColorsConfiguration> | ||
{ | ||
public static CustomChatColors Instance; | ||
|
||
protected override void Load() | ||
{ | ||
Instance = this; | ||
|
||
ChatManager.onChatted += OnChatted; | ||
|
||
Rocket.Core.Logging.Logger.Log("Loaded! Made by papershredder432#0883, join the support Discord here: https://discord.gg/ydjYVJ2"); | ||
Rocket.Core.Logging.Logger.Log($"Loaded {Configuration.Instance.CustomColors.Count} unique player color(s)!"); | ||
} | ||
|
||
private void OnChatted(SteamPlayer player, EChatMode mode, ref Color chatted, ref bool isrich, string text, ref bool isvisible) | ||
{ | ||
if (text.StartsWith("/")) | ||
return; | ||
|
||
var playerId = player.playerID.steamID; | ||
var uPlayer = UnturnedPlayer.FromCSteamID(playerId); | ||
if (Configuration.Instance.CustomColors.FirstOrDefault(x => x.PlayerId == playerId.m_SteamID) == null) | ||
return; | ||
|
||
var multipleEntries = Configuration.Instance.CustomColors.FindAll(x => x.PlayerId == playerId.m_SteamID); | ||
if (multipleEntries.Count > 1) | ||
{ | ||
Rocket.Core.Logging.Logger.LogWarning($"Found {multipleEntries.Count} for {playerId}! Remove the duplicate entries in the config for their custom color to work!"); | ||
return; | ||
} | ||
|
||
var selectedEntry = Configuration.Instance.CustomColors.FirstOrDefault(x => x.PlayerId == playerId.m_SteamID); | ||
|
||
isvisible = false; | ||
|
||
switch (mode) | ||
{ | ||
case EChatMode.GROUP: | ||
ChatManager.serverSendMessage($"[GROUP] <color=#{selectedEntry.HexColorCode}>{uPlayer.CharacterName}: {text}</color>", Color.grey, null, null, mode, uPlayer.SteamProfile.AvatarIcon.ToString(), true); | ||
break; | ||
|
||
case EChatMode.LOCAL: | ||
ChatManager.serverSendMessage($"[AREA] <color=#{selectedEntry.HexColorCode}>{uPlayer.CharacterName}: {text}</color>", Color.grey, null, null, mode, uPlayer.SteamProfile.AvatarIcon.ToString(), true); | ||
break; | ||
|
||
case EChatMode.GLOBAL: | ||
ChatManager.serverSendMessage($"<color=#{selectedEntry.HexColorCode}>{uPlayer.CharacterName}: {text}</color>", Color.grey, null, null, mode, uPlayer.SteamProfile.AvatarIcon.ToString(), true); | ||
break; | ||
|
||
case EChatMode.WELCOME: | ||
break; | ||
case EChatMode.SAY: | ||
break; | ||
|
||
default: | ||
Rocket.Core.Logging.Logger.Log("How'd ya get here?"); | ||
break; | ||
} | ||
} | ||
|
||
protected override void Unload() | ||
{ | ||
Instance = null; | ||
|
||
ChatManager.onChatted -= OnChatted; | ||
|
||
Rocket.Core.Logging.Logger.Log("Unloaded"); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | ||
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" /> | ||
<PropertyGroup> | ||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> | ||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> | ||
<ProjectGuid>{4E66C6D8-1DCD-4A6E-A353-6EE6D4C119CA}</ProjectGuid> | ||
<OutputType>Library</OutputType> | ||
<AppDesignerFolder>Properties</AppDesignerFolder> | ||
<RootNamespace>CustomChatColors</RootNamespace> | ||
<AssemblyName>CustomChatColors</AssemblyName> | ||
<TargetFrameworkVersion>v4.8</TargetFrameworkVersion> | ||
<FileAlignment>512</FileAlignment> | ||
</PropertyGroup> | ||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> | ||
<PlatformTarget>AnyCPU</PlatformTarget> | ||
<DebugSymbols>true</DebugSymbols> | ||
<DebugType>full</DebugType> | ||
<Optimize>false</Optimize> | ||
<OutputPath>bin\Debug\</OutputPath> | ||
<DefineConstants>DEBUG;TRACE</DefineConstants> | ||
<ErrorReport>prompt</ErrorReport> | ||
<WarningLevel>4</WarningLevel> | ||
</PropertyGroup> | ||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> | ||
<PlatformTarget>AnyCPU</PlatformTarget> | ||
<DebugType>pdbonly</DebugType> | ||
<Optimize>true</Optimize> | ||
<OutputPath>bin\Release\</OutputPath> | ||
<DefineConstants>TRACE</DefineConstants> | ||
<ErrorReport>prompt</ErrorReport> | ||
<WarningLevel>4</WarningLevel> | ||
</PropertyGroup> | ||
<ItemGroup> | ||
<Reference Include="Assembly-CSharp, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null"> | ||
<HintPath>libs\Assembly-CSharp.dll</HintPath> | ||
</Reference> | ||
<Reference Include="com.rlabrecque.steamworks.net, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null"> | ||
<HintPath>libs\com.rlabrecque.steamworks.net.dll</HintPath> | ||
</Reference> | ||
<Reference Include="Rocket.API, Version=4.9.3.5, Culture=neutral, PublicKeyToken=null"> | ||
<HintPath>libs\Rocket.API.dll</HintPath> | ||
</Reference> | ||
<Reference Include="Rocket.Core, Version=4.9.3.5, Culture=neutral, PublicKeyToken=null"> | ||
<HintPath>libs\Rocket.Core.dll</HintPath> | ||
</Reference> | ||
<Reference Include="Rocket.Unturned, Version=4.9.3.14, Culture=neutral, PublicKeyToken=null"> | ||
<HintPath>libs\Rocket.Unturned.dll</HintPath> | ||
</Reference> | ||
<Reference Include="SDG.NetTransport, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null"> | ||
<HintPath>libs\SDG.NetTransport.dll</HintPath> | ||
</Reference> | ||
<Reference Include="System" /> | ||
<Reference Include="System.Core" /> | ||
<Reference Include="System.Data" /> | ||
<Reference Include="System.Xml" /> | ||
<Reference Include="UnityEngine, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null"> | ||
<HintPath>libs\UnityEngine.dll</HintPath> | ||
</Reference> | ||
<Reference Include="UnityEngine.CoreModule, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null"> | ||
<HintPath>libs\UnityEngine.CoreModule.dll</HintPath> | ||
</Reference> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<Compile Include="CustomChatColors.cs" /> | ||
<Compile Include="CustomChatColorsConfiguration.cs" /> | ||
<Compile Include="Models\MCustomColor.cs" /> | ||
<Compile Include="Properties\AssemblyInfo.cs" /> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<Folder Include="libs" /> | ||
</ItemGroup> | ||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> | ||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it. | ||
Other similar extension points exist, see Microsoft.Common.targets. | ||
<Target Name="BeforeBuild"> | ||
</Target> | ||
<Target Name="AfterBuild"> | ||
</Target> | ||
--> | ||
|
||
</Project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
using System.Collections.Generic; | ||
using CustomChatColors.Models; | ||
using Rocket.API; | ||
|
||
namespace CustomChatColors | ||
{ | ||
public class CustomChatColorsConfiguration : IRocketPluginConfiguration | ||
{ | ||
public List<MCustomColor> CustomColors; | ||
|
||
public void LoadDefaults() | ||
{ | ||
CustomColors = new List<MCustomColor> | ||
{ | ||
new MCustomColor { PlayerId = 76561198132469161, HexColorCode = "FF00FF"} | ||
}; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
using System.Xml.Serialization; | ||
|
||
namespace CustomChatColors.Models | ||
{ | ||
public class MCustomColor | ||
{ | ||
[XmlAttribute] | ||
public ulong PlayerId { get; set; } | ||
|
||
[XmlAttribute] | ||
public string HexColorCode { get; set; } | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
using System.Reflection; | ||
using System.Runtime.InteropServices; | ||
|
||
// General Information about an assembly is controlled through the following | ||
// set of attributes. Change these attribute values to modify the information | ||
// associated with an assembly. | ||
[assembly: AssemblyTitle("CustomChatColors")] | ||
[assembly: AssemblyDescription("")] | ||
[assembly: AssemblyConfiguration("")] | ||
[assembly: AssemblyCompany("")] | ||
[assembly: AssemblyProduct("CustomChatColors")] | ||
[assembly: AssemblyCopyright("Copyright © 2022")] | ||
[assembly: AssemblyTrademark("")] | ||
[assembly: AssemblyCulture("")] | ||
|
||
// Setting ComVisible to false makes the types in this assembly not visible | ||
// to COM components. If you need to access a type in this assembly from | ||
// COM, set the ComVisible attribute to true on that type. | ||
[assembly: ComVisible(false)] | ||
|
||
// The following GUID is for the ID of the typelib if this project is exposed to COM | ||
[assembly: Guid("4E66C6D8-1DCD-4A6E-A353-6EE6D4C119CA")] | ||
|
||
// Version information for an assembly consists of the following four values: | ||
// | ||
// Major Version | ||
// Minor Version | ||
// Build Number | ||
// Revision | ||
// | ||
// You can specify all the values or you can default the Build and Revision Numbers | ||
// by using the '*' as shown below: | ||
// [assembly: AssemblyVersion("1.0.*")] | ||
[assembly: AssemblyVersion("1.0.0.0")] | ||
[assembly: AssemblyFileVersion("1.0.0.0")] |
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.