Skip to content

Commit

Permalink
Rust 5/4 Update
Browse files Browse the repository at this point in the history
  • Loading branch information
dassjosh committed May 4, 2023
1 parent 2032f07 commit 0905444
Show file tree
Hide file tree
Showing 24 changed files with 126 additions and 20 deletions.
63 changes: 56 additions & 7 deletions DiscordSignLogger.cs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
//DiscordSignLogger created with PluginMerge v(1.0.5.0) by MJSU @ https://github.com/dassjosh/Plugin.Merge
namespace Oxide.Plugins
{
[Info("Discord Sign Logger", "MJSU", "1.0.9")]
[Info("Discord Sign Logger", "MJSU", "1.0.10")]
[Description("Logs Sign / Firework Changes To Discord")]
public partial class DiscordSignLogger : RustPlugin
{
Expand Down Expand Up @@ -72,7 +72,7 @@ public partial class DiscordSignLogger : RustPlugin
private readonly StringBuilder _sb = new StringBuilder();
private readonly StringBuilder _actions = new StringBuilder();
public readonly Hash<UnityEngine.Color, Brush> FireworkBrushes = new Hash<UnityEngine.Color, Brush>();
private readonly Hash<uint, SignageUpdate> _updates = new Hash<uint, SignageUpdate>();
private readonly Hash<NetworkableId, SignageUpdate> _updates = new Hash<NetworkableId, SignageUpdate>();
private readonly Hash<string, string> _prefabNameLookup = new Hash<string, string>();

private DiscordChannel _actionChannel;
Expand Down Expand Up @@ -768,7 +768,7 @@ private void EraseCommand(ConsoleSystem.Arg arg)
return;
}

uint id = arg.GetUInt(0);
NetworkableId id = arg.GetEntityID(0);
uint index = arg.GetUInt(1);
BaseEntity entity = BaseNetworkable.serverEntities.Find(id) as BaseEntity;
if (entity == null)
Expand Down Expand Up @@ -1047,7 +1047,7 @@ private void OnPlaceholderAPIReady()
RegisterPlaceholder("dsl.entity.id", (player, s) =>
{
BaseEntity entity = _log.Entity;
return entity ? entity.net?.ID ?? 0 : 0;
return entity ? entity.net?.ID.Value ?? 0 : 0;
}, "Displays the entity ID");

Expand Down Expand Up @@ -1614,7 +1614,7 @@ public TimeSpan GetRemainingBan(BasePlayer player)
public class SignUpdateLog : ILogEvent
{
public ulong PlayerId { get; set; }
public uint EntityId { get; set; }
public ulong EntityId { get; set; }
public int ItemId { get; set; }
public uint TextureIndex { get; set; }

Expand Down Expand Up @@ -1643,7 +1643,7 @@ public BaseEntity Entity
return null;
}

_entity = BaseNetworkable.serverEntities.Find(EntityId) as BaseEntity;
_entity = BaseNetworkable.serverEntities.Find(new NetworkableId(EntityId)) as BaseEntity;

return _entity;
}
Expand All @@ -1658,7 +1658,7 @@ public SignUpdateLog()
public SignUpdateLog(BaseImageUpdate update)
{
PlayerId = update.PlayerId;
EntityId = update.Entity.net.ID;
EntityId = update.Entity.net.ID.Value;
LogDate = DateTime.UtcNow;

if (update.SupportsTextureIndex)
Expand Down Expand Up @@ -2039,6 +2039,55 @@ public ActionMessageButtonCommand(ActionMessageButtonCommand settings) : base(se
}
#endregion

#region Configuration\PluginSupport\PluginSettings.cs
public class PluginSettings
{
[JsonProperty("Sign Artist Settings")]
public SignArtistSettings SignArtist { get; set; }

public PluginSettings(PluginSettings settings)
{
SignArtist = new SignArtistSettings(settings?.SignArtist);
}
}
#endregion

#region Configuration\PluginSupport\SignArtistSettings.cs
public class SignArtistSettings
{
[JsonProperty("Log /sil")]
public bool LogSil { get; set; }

[JsonProperty("Log /sili")]
public bool LogSili { get; set; }

[JsonProperty("Log /silt")]
public bool LogSilt { get; set; }

public SignArtistSettings(SignArtistSettings settings)
{
LogSil = settings?.LogSil ?? true;
LogSili = settings?.LogSili ?? true;
LogSilt = settings?.LogSilt ?? true;
}

public bool ShouldLog(string url)
{
if (url.StartsWith("http://assets.imgix.net"))
{
return LogSilt;
}

if (ItemManager.itemDictionaryByName.ContainsKey(url))
{
return LogSili;
}

return LogSil;
}
}
#endregion

}

}
Binary file modified src/References/Assembly-CSharp-firstpass.dll
Binary file not shown.
Binary file modified src/References/Assembly-CSharp.dll
Binary file not shown.
Binary file modified src/References/Facepunch.Console.dll
Binary file not shown.
Binary file modified src/References/Facepunch.Network.dll
Binary file not shown.
Binary file modified src/References/Facepunch.System.dll
Binary file not shown.
Binary file modified src/References/Facepunch.Unity.dll
Binary file not shown.
Binary file modified src/References/Facepunch.UnityEngine.dll
Binary file not shown.
Binary file modified src/References/Oxide.CSharp.dll
Binary file not shown.
Binary file modified src/References/Oxide.Core.dll
Binary file not shown.
Binary file modified src/References/Oxide.References.dll
Binary file not shown.
Binary file modified src/References/Oxide.Rust.dll
Binary file not shown.
Binary file modified src/References/Rust.Data.dll
Binary file not shown.
Binary file modified src/References/Rust.Global.dll
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
using Newtonsoft.Json;

namespace Rust.SignLogger.Configuration.PluginSupport
{
public class PluginSettings
{
[JsonProperty("Sign Artist Settings")]
public SignArtistSettings SignArtist { get; set; }

public PluginSettings(PluginSettings settings)
{
SignArtist = new SignArtistSettings(settings?.SignArtist);
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
using Newtonsoft.Json;

namespace Rust.SignLogger.Configuration.PluginSupport
{
public class SignArtistSettings
{
[JsonProperty("Log /sil")]
public bool LogSil { get; set; }

[JsonProperty("Log /sili")]
public bool LogSili { get; set; }

[JsonProperty("Log /silt")]
public bool LogSilt { get; set; }

public SignArtistSettings(SignArtistSettings settings)
{
LogSil = settings?.LogSil ?? true;
LogSili = settings?.LogSili ?? true;
LogSilt = settings?.LogSilt ?? true;
}

public bool ShouldLog(string url)
{
if (url.StartsWith("http://assets.imgix.net"))
{
return LogSilt;
}

if (ItemManager.itemDictionaryByName.ContainsKey(url))
{
return LogSili;
}

return LogSil;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
using Oxide.Ext.Discord.Entities;
using Oxide.Ext.Discord.Entities.Channels;
using Oxide.Ext.Discord.Entities.Interactions.MessageComponents;
using Rust.SignLogger.Configuration.PluginSupport;
using Rust.SignLogger.Discord;

namespace Rust.SignLogger.Configuration
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ namespace Rust.SignLogger.Data
public class SignUpdateLog : ILogEvent
{
public ulong PlayerId { get; set; }
public uint EntityId { get; set; }
public ulong EntityId { get; set; }
public int ItemId { get; set; }
public uint TextureIndex { get; set; }

Expand Down Expand Up @@ -39,7 +39,7 @@ public BaseEntity Entity
return null;
}

_entity = BaseNetworkable.serverEntities.Find(EntityId) as BaseEntity;
_entity = BaseNetworkable.serverEntities.Find(new NetworkableId(EntityId)) as BaseEntity;

return _entity;
}
Expand All @@ -54,7 +54,7 @@ public SignUpdateLog()
public SignUpdateLog(BaseImageUpdate update)
{
PlayerId = update.PlayerId;
EntityId = update.Entity.net.ID;
EntityId = update.Entity.net.ID.Value;
LogDate = DateTime.UtcNow;

if (update.SupportsTextureIndex)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
using Oxide.Plugins;
using Rust.SignLogger.Configuration;
using Rust.SignLogger.Enums;
using UnityEngine;

namespace Rust.SignLogger.Plugins
{
Expand All @@ -16,7 +17,7 @@ private void EraseCommand(ConsoleSystem.Arg arg)
return;
}

uint id = arg.GetUInt(0);
NetworkableId id = arg.GetEntityID(0);
uint index = arg.GetUInt(1);
BaseEntity entity = BaseNetworkable.serverEntities.Find(id) as BaseEntity;
if (entity == null)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ public partial class DiscordSignLogger
private readonly StringBuilder _sb = new StringBuilder();
private readonly StringBuilder _actions = new StringBuilder();
public readonly Hash<UnityEngine.Color, Brush> FireworkBrushes = new Hash<UnityEngine.Color, Brush>();
private readonly Hash<uint, SignageUpdate> _updates = new Hash<uint, SignageUpdate>();
private readonly Hash<NetworkableId, SignageUpdate> _updates = new Hash<NetworkableId, SignageUpdate>();
private readonly Hash<string, string> _prefabNameLookup = new Hash<string, string>();

private DiscordChannel _actionChannel;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ private void OnPlaceholderAPIReady()
RegisterPlaceholder("dsl.entity.id", (player, s) =>
{
BaseEntity entity = _log.Entity;
return entity ? entity.net?.ID ?? 0 : 0;
return entity ? entity.net?.ID.Value ?? 0 : 0;
}, "Displays the entity ID");

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
namespace Rust.SignLogger.Plugins
{
//Define:FileOrder=1
[Info("Discord Sign Logger", "MJSU", "1.0.9")]
[Info("Discord Sign Logger", "MJSU", "1.0.10")]
[Description("Logs Sign / Firework Changes To Discord")]
public partial class DiscordSignLogger : RustPlugin
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,19 +28,19 @@
<Reference Include="Facepunch.UnityEngine, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null">
<HintPath>..\..\References\Facepunch.UnityEngine.dll</HintPath>
</Reference>
<Reference Include="Oxide.Core, Version=2.0.4002.0, Culture=neutral, PublicKeyToken=null">
<Reference Include="Oxide.Core">
<HintPath>..\..\References\Oxide.Core.dll</HintPath>
</Reference>
<Reference Include="Oxide.CSharp, Version=2.0.4046.0, Culture=neutral, PublicKeyToken=null">
<Reference Include="Oxide.CSharp">
<HintPath>..\..\References\Oxide.CSharp.dll</HintPath>
</Reference>
<Reference Include="Oxide.Ext.Discord">
<HintPath>..\..\References\Oxide.Ext.Discord.dll</HintPath>
</Reference>
<Reference Include="Oxide.References, Version=2.0.3779.0, Culture=neutral, PublicKeyToken=null">
<Reference Include="Oxide.References">
<HintPath>..\..\References\Oxide.References.dll</HintPath>
</Reference>
<Reference Include="Oxide.Rust, Version=2.0.5355.0, Culture=neutral, PublicKeyToken=null">
<Reference Include="Oxide.Rust">
<HintPath>..\..\References\Oxide.Rust.dll</HintPath>
</Reference>
<Reference Include="Oxide.Unity, Version=2.0.3772.0, Culture=neutral, PublicKeyToken=null">
Expand Down
6 changes: 4 additions & 2 deletions src/Rust.DiscordSignLogger/Rust.DiscordSignLogger/merge.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
# What platform to write the code file for (Oxide, uMod)
Platform: Oxide
Merge Settings:
# Outputted plugin name
# Outputted plugin name
Plugin Name: DiscordSignLogger
# Which type of file to output (Plugin, Framework, or MergeFramework)
Creator Mode: Plugin
# Overrides the default namespace
Namespace Override: ''
# Paths to use when reading in source code relative to the merge config
Plugin Input Paths:
- ./
Expand All @@ -24,7 +26,7 @@ Merge Settings:
Ignore Namespaces:
- Rust.SignLogger
Code Style:
# Character to use for code indents
# Character to use for code indents
Indent Character: ' '
# The amount of characters to use when indenting once
Indent Char Amount: 4
Expand Down

0 comments on commit 0905444

Please sign in to comment.