diff --git a/AdvancedCustomRoles/AdvancedCustomRoles.csproj b/AdvancedCustomRoles/AdvancedCustomRoles.csproj index 363afcb..e9d048b 100644 --- a/AdvancedCustomRoles/AdvancedCustomRoles.csproj +++ b/AdvancedCustomRoles/AdvancedCustomRoles.csproj @@ -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" /> @@ -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> diff --git a/AdvancedCustomRoles/AdvancedRoleScript.cs b/AdvancedCustomRoles/AdvancedRoleScript.cs index fbb9469..2c68f43 100644 --- a/AdvancedCustomRoles/AdvancedRoleScript.cs +++ b/AdvancedCustomRoles/AdvancedRoleScript.cs @@ -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)) diff --git a/AdvancedCustomRoles/CustomRoleHandler.cs b/AdvancedCustomRoles/CustomRoleHandler.cs index 3bd9144..29d6ef7 100644 --- a/AdvancedCustomRoles/CustomRoleHandler.cs +++ b/AdvancedCustomRoles/CustomRoleHandler.cs @@ -5,6 +5,7 @@ using Synapse.Config; using System.IO; using Synapse.Api.Roles; +using System; namespace AdvancedCustomRoles { @@ -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))); } } @@ -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, diff --git a/AdvancedCustomRoles/PluginClass.cs b/AdvancedCustomRoles/PluginClass.cs index f18dfd3..7395837 100644 --- a/AdvancedCustomRoles/PluginClass.cs +++ b/AdvancedCustomRoles/PluginClass.cs @@ -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 { diff --git a/AdvancedCustomRoles/packages.config b/AdvancedCustomRoles/packages.config index 52adbad..03222eb 100644 --- a/AdvancedCustomRoles/packages.config +++ b/AdvancedCustomRoles/packages.config @@ -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> \ No newline at end of file