Skip to content

Commit

Permalink
Update for 11.0.0
Browse files Browse the repository at this point in the history
  • Loading branch information
GrafDimenzio committed Aug 21, 2021
1 parent 87e1631 commit e9a0888
Show file tree
Hide file tree
Showing 5 changed files with 53 additions and 36 deletions.
38 changes: 22 additions & 16 deletions AdvancedCustomRoles/AdvancedCustomRoles.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -31,29 +31,35 @@
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="0Harmony, Version=2.0.4.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Lib.Harmony.2.0.4\lib\net472\0Harmony.dll</HintPath>
<Reference Include="0Harmony, Version=2.1.1.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Lib.Harmony.2.1.1\lib\net472\0Harmony.dll</HintPath>
</Reference>
<Reference Include="Assembly-CSharp, Version=0.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\SynapseSL.2.6.0\lib\net472\Assembly-CSharp.dll</HintPath>
<HintPath>..\packages\SynapseSL.2.7.0-dev3\lib\net472\Assembly-CSharp.dll</HintPath>
</Reference>
<Reference Include="Assembly-CSharp-firstpass, Version=0.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\SynapseSL.2.6.0\lib\net472\Assembly-CSharp-firstpass.dll</HintPath>
<HintPath>..\packages\SynapseSL.2.7.0-dev3\lib\net472\Assembly-CSharp-firstpass.dll</HintPath>
</Reference>
<Reference Include="LiteDB, Version=5.0.9.0, Culture=neutral, PublicKeyToken=4ee40123013c9f27, processorArchitecture=MSIL">
<HintPath>..\packages\LiteDB.5.0.9\lib\net45\LiteDB.dll</HintPath>
<Reference Include="LiteDB, Version=5.0.11.0, Culture=neutral, PublicKeyToken=4ee40123013c9f27, processorArchitecture=MSIL">
<HintPath>..\packages\LiteDB.5.0.11\lib\net45\LiteDB.dll</HintPath>
</Reference>
<Reference Include="Mirror, Version=0.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\SynapseSL.2.6.0\lib\net472\Mirror.dll</HintPath>
<HintPath>..\packages\SynapseSL.2.7.0-dev3\lib\net472\Mirror.dll</HintPath>
</Reference>
<Reference Include="Synapse, Version=2.6.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\SynapseSL.2.6.0\lib\net472\Synapse.dll</HintPath>
<Reference Include="Swan.Lite, Version=3.1.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Unosquare.Swan.Lite.3.1.0\lib\net461\Swan.Lite.dll</HintPath>
</Reference>
<Reference Include="Synapse, Version=2.7.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\SynapseSL.2.7.0-dev3\lib\net472\Synapse.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Runtime" />
<Reference Include="System.Runtime.CompilerServices.Unsafe, Version=4.0.4.1, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\System.Runtime.CompilerServices.Unsafe.4.5.2\lib\netstandard2.0\System.Runtime.CompilerServices.Unsafe.dll</HintPath>
<Reference Include="System.Runtime.CompilerServices.Unsafe, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\System.Runtime.CompilerServices.Unsafe.6.0.0-preview.7.21377.19\lib\net461\System.Runtime.CompilerServices.Unsafe.dll</HintPath>
</Reference>
<Reference Include="System.ValueTuple, Version=4.0.3.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>..\packages\System.ValueTuple.4.5.0\lib\net47\System.ValueTuple.dll</HintPath>
</Reference>
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
Expand All @@ -62,16 +68,16 @@
<Reference Include="System.Net.Http" />
<Reference Include="System.Xml" />
<Reference Include="UnityEngine, Version=0.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\SynapseSL.2.6.0\lib\net472\UnityEngine.dll</HintPath>
<HintPath>..\packages\SynapseSL.2.7.0-dev3\lib\net472\UnityEngine.dll</HintPath>
</Reference>
<Reference Include="UnityEngine.CoreModule, Version=0.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\SynapseSL.2.6.0\lib\net472\UnityEngine.CoreModule.dll</HintPath>
<HintPath>..\packages\SynapseSL.2.7.0-dev3\lib\net472\UnityEngine.CoreModule.dll</HintPath>
</Reference>
<Reference Include="UnityEngine.PhysicsModule, Version=0.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\SynapseSL.2.6.0\lib\net472\UnityEngine.PhysicsModule.dll</HintPath>
<HintPath>..\packages\SynapseSL.2.7.0-dev3\lib\net472\UnityEngine.PhysicsModule.dll</HintPath>
</Reference>
<Reference Include="YamlDotNet, Version=8.0.0.0, Culture=neutral, PublicKeyToken=ec19458f3c15af5e, processorArchitecture=MSIL">
<HintPath>..\packages\YamlDotNet.8.1.2\lib\net45\YamlDotNet.dll</HintPath>
<Reference Include="YamlDotNet, Version=11.0.0.0, Culture=neutral, PublicKeyToken=ec19458f3c15af5e, processorArchitecture=MSIL">
<HintPath>..\packages\YamlDotNet.11.2.1\lib\net45\YamlDotNet.dll</HintPath>
</Reference>
</ItemGroup>
<ItemGroup>
Expand Down
3 changes: 2 additions & 1 deletion AdvancedCustomRoles/AdvancedRoleScript.cs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@ public override void Spawn()
Player.RoleType = CustomRole.Spawnrole;
Player.MaxHealth = CustomRole.MaxHealth;
Player.Health = CustomRole.SpawnHealth;
Player.GodMode = CustomRole.GodMode;
if (CustomRole.GodMode)
Player.GodMode = true;
CustomRole.Inventory.Apply(Player);

if (!string.IsNullOrWhiteSpace(CustomRole.DisplayInfo))
Expand Down
34 changes: 21 additions & 13 deletions AdvancedCustomRoles/CustomRoleHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
using Synapse.Config;
using System.IO;
using Synapse.Api.Roles;
using System;

namespace AdvancedCustomRoles
{
Expand Down Expand Up @@ -37,22 +38,29 @@ public void Load()

foreach(var file in files)
{
var syml = new SYML(file);
syml.Load();
if(syml.Sections.Count == 0)
try
{
Logger.Get.Warn($"[AdvancedCustomRoles] No Section found in {file}");
continue;
var syml = new SYML(file);
syml.Load();
if (syml.Sections.Count == 0)
{
Logger.Get.Warn($"[AdvancedCustomRoles] No Section found in {file}");
continue;
}
var section = syml.Sections.FirstOrDefault().Value;
var role = section.LoadAs<CustomRole>();
if (Server.Get.RoleManager.IsIDRegistered(role.RoleID))
{
Logger.Get.Warn($"[AdvancedCustomRoles] CustomRole: {role.Name} is invalid since it ID is already registered please use a different one");
continue;
}
CustomRoles.Add(role);
Server.Get.RoleManager.RegisterCustomRole(new RoleInformation(role.Name, role.RoleID, typeof(AdvancedRoleScript)));
}
var section = syml.Sections.FirstOrDefault().Value;
var role = section.LoadAs<CustomRole>();
if (Server.Get.RoleManager.IsIDRegistered(role.RoleID))
catch(Exception e)
{
Logger.Get.Warn($"[AdvancedCustomRoles] CustomRole: {role.Name} is invalid since it ID is already registered please use a different one");
continue;
Logger.Get.Error($"Error while loading CustomRole: {file}\n\n{e}");
}
CustomRoles.Add(role);
Server.Get.RoleManager.RegisterCustomRole(new RoleInformation(role.Name, role.RoleID, typeof(AdvancedRoleScript)));
}
}

Expand Down Expand Up @@ -81,7 +89,7 @@ public void CreateExampleFile(string path)
},
Items = new List<SerializedPlayerItem>
{
new SerializedPlayerItem(0,0f,0,0,0,UnityEngine.Vector3.one,100,false)
new SerializedPlayerItem(0, 0, 0, UnityEngine.Vector3.one, 100, false)
}
},
RemoveRoleName = true,
Expand Down
2 changes: 1 addition & 1 deletion AdvancedCustomRoles/PluginClass.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ namespace AdvancedCustomRoles
SynapseMajor = 2,
SynapseMinor = 5,
SynapsePatch = 3,
Version = "v.1.0.0"
Version = "v.1.0.1"
)]
public class PluginClass : AbstractPlugin
{
Expand Down
12 changes: 7 additions & 5 deletions AdvancedCustomRoles/packages.config
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Lib.Harmony" version="2.0.4" targetFramework="net472" />
<package id="LiteDB" version="5.0.9" targetFramework="net472" />
<package id="SynapseSL" version="2.6.0" targetFramework="net472" />
<package id="System.Runtime.CompilerServices.Unsafe" version="4.5.2" targetFramework="net472" />
<package id="YamlDotNet" version="8.1.2" targetFramework="net472" />
<package id="Lib.Harmony" version="2.1.1" targetFramework="net472" />
<package id="LiteDB" version="5.0.11" targetFramework="net472" />
<package id="SynapseSL" version="2.7.0-dev3" targetFramework="net472" />
<package id="System.Runtime.CompilerServices.Unsafe" version="6.0.0-preview.7.21377.19" targetFramework="net472" />
<package id="System.ValueTuple" version="4.5.0" targetFramework="net472" />
<package id="Unosquare.Swan.Lite" version="3.1.0" targetFramework="net472" />
<package id="YamlDotNet" version="11.2.1" targetFramework="net472" />
</packages>

0 comments on commit e9a0888

Please sign in to comment.