Skip to content

Commit

Permalink
Added SerializedPlayerInventory
Browse files Browse the repository at this point in the history
  • Loading branch information
GrafDimenzio committed Aug 21, 2021
1 parent ca4136e commit 72f99dc
Show file tree
Hide file tree
Showing 7 changed files with 52 additions and 61 deletions.
4 changes: 0 additions & 4 deletions SerpentsHand/EventHandlers.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using Synapse;
using System.Linq;

namespace SerpentsHand
{
Expand All @@ -19,10 +18,7 @@ private void Respawn(Synapse.Api.Events.SynapseEventArguments.TeamRespawnEventAr
private void SetClass(Synapse.Api.Events.SynapseEventArguments.PlayerSetClassEventArgs ev)
{
if (ev.Player.RoleID == 30)
{
ev.Position = PluginClass.Config.SpawnPoint.Parse().Position;
ev.Items = PluginClass.Config.Items.Select(x => x.Parse()).ToList();
}
}
}
}
10 changes: 5 additions & 5 deletions SerpentsHand/PluginClass.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
using Synapse.Api.Plugin;
using Synapse;
using Synapse.Api.Plugin;
using Synapse.Translation;
using Synapse;

namespace SerpentsHand
{
Expand All @@ -10,9 +10,9 @@ namespace SerpentsHand
LoadPriority = 1,
Name = "SerpentsHand",
SynapseMajor = 2,
SynapseMinor = 5,
SynapsePatch = 3,
Version = "v.1.2.0"
SynapseMinor = 7,
SynapsePatch = 0,
Version = "v.1.2.1"
)]
public class PluginClass : AbstractPlugin
{
Expand Down
52 changes: 24 additions & 28 deletions SerpentsHand/PluginConfig.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
using System.ComponentModel;
using System.Collections.Generic;
using System.Collections.Generic;
using System.ComponentModel;
using Synapse.Config;
using UnityEngine;

Expand All @@ -8,48 +8,44 @@ namespace SerpentsHand
public class PluginConfig : AbstractConfigSection
{
[Description("If friendlyfire for serpentshand is active")]
public bool friendlyfire = false;
public bool Friendlyfire { get; set; } = false;

[Description("The role that serpentshand will look like")]
public RoleType SpawnRole = RoleType.Tutorial;
public RoleType SpawnRole { get; set; } = RoleType.Tutorial;

[Description("The Health of SerpentsHand members")]
public int Health = 120;
public int Health { get; set; } = 120;

[Description("The Role Name that is displayed when you look at the Player")]
public string CustomRoleName = "<color=green>SerpentsHand</color>";
public string CustomRoleName { get; set; } = "<color=green>SerpentsHand</color>";

[Description("The chance that a SerpentsHand Squad spawns instead of a Chaos")]
public float SpawnChance = 50f;
public float SpawnChance { get; set; } = 50f;

[Description("The Cassie announcement that plays when SerpentsHand Spawn")]
public string Cassie = "serpents hand hasentered allremaining";
public string Cassie { get; set; } = "serpents hand hasentered allremaining";

[Description("The Spawnpoint where SerpentsHand spawn")]
public SerializedMapPoint SpawnPoint = new SerializedMapPoint("Root_*&*Outside Cams", -0.4426118f, 2.159119f, 7.987663f);

[Description("The amount of ammo that SerpentsHand spawns with")]
public Ammo Ammo = new Ammo();
public SerializedMapPoint SpawnPoint { get; set; } = new SerializedMapPoint("Root_*&*Outside Cams", -0.4426118f, 2.159119f, 7.987663f);

[Description("The maximal amount of players that can spawn as SerpentsHand in one squad")]
public int SpawnSize = 7;
public int SpawnSize { get; set; } = 7;

[Description("The items that Serpentshand spawn with")]
public List<SerializedItem> Items = new List<SerializedItem>
public SerializedPlayerInventory Inventory { get; set; } = new SerializedPlayerInventory
{
new SerializedItem((int)ItemType.KeycardChaosInsurgency,0,0,0,0,Vector3.one),
new SerializedItem((int)ItemType.Medkit,0,0,0,0,Vector3.one),
new SerializedItem((int)ItemType.GunLogicer,75,0,0,0,Vector3.one),
new SerializedItem((int)ItemType.Painkillers,0,0,0,0,Vector3.one)
Ammo = new SerializedAmmo
{
Ammo5 = 50,
Ammo7 = 50,
Ammo9 = 50,
},
Items = new List<SerializedPlayerItem>
{
new SerializedPlayerItem((int)ItemType.KeycardChaosInsurgency,0f,0u,Vector3.one,100,false),
new SerializedPlayerItem((int)ItemType.Medkit,0f,0u,Vector3.one,100,false),
new SerializedPlayerItem((int)ItemType.GunLogicer,75f,0u,Vector3.one,100,false),
new SerializedPlayerItem((int)ItemType.Painkillers,0f,0u,Vector3.one,100,false)
}
};
}

public class Ammo
{
public uint Ammo5 = 50;

public uint Ammo7 = 50;

public uint Ammo9 = 50;
}
}
28 changes: 14 additions & 14 deletions SerpentsHand/SerpentsHand.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -31,23 +31,23 @@
<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.5.3\lib\net472\Assembly-CSharp.dll</HintPath>
<HintPath>..\packages\SynapseSL.2.7.0-dev4\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.5.3\lib\net472\Assembly-CSharp-firstpass.dll</HintPath>
<HintPath>..\packages\SynapseSL.2.7.0-dev4\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.5.3\lib\net472\Mirror.dll</HintPath>
<HintPath>..\packages\SynapseSL.2.7.0-dev4\lib\net472\Mirror.dll</HintPath>
</Reference>
<Reference Include="Synapse, Version=2.5.3.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\SynapseSL.2.5.3\lib\net472\Synapse.dll</HintPath>
<Reference Include="Synapse, Version=2.7.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\SynapseSL.2.7.0-dev4\lib\net472\Synapse.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
Expand All @@ -62,16 +62,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.5.3\lib\net472\UnityEngine.dll</HintPath>
<HintPath>..\packages\SynapseSL.2.7.0-dev4\lib\net472\UnityEngine.dll</HintPath>
</Reference>
<Reference Include="UnityEngine.CoreModule, Version=0.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\SynapseSL.2.5.3\lib\net472\UnityEngine.CoreModule.dll</HintPath>
<HintPath>..\packages\SynapseSL.2.7.0-dev4\lib\net472\UnityEngine.CoreModule.dll</HintPath>
</Reference>
<Reference Include="UnityEngine.PhysicsModule, Version=0.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\SynapseSL.2.5.3\lib\net472\UnityEngine.PhysicsModule.dll</HintPath>
<HintPath>..\packages\SynapseSL.2.7.0-dev4\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
7 changes: 3 additions & 4 deletions SerpentsHand/SerpentsHandRole.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ public class SerpentsHandRole : Synapse.Api.Roles.Role

public override int GetTeamID() => 7;

public override List<int> GetFriendsID() => PluginClass.Config.friendlyfire ? new List<int> { (int)Team.SCP } : new List<int> { (int)Team.SCP, 7 };
public override List<int> GetFriendsID() => PluginClass.Config.Friendlyfire ? new List<int> { (int)Team.SCP } : new List<int> { (int)Team.SCP, 7 };

public override List<int> GetEnemiesID() => new List<int> { (int)Team.CDP, (int)Team.MTF, (int)Team.RSC };

Expand All @@ -19,9 +19,8 @@ public override void Spawn()
Player.RoleType = PluginClass.Config.SpawnRole;
Player.MaxHealth = PluginClass.Config.Health;
Player.Health = PluginClass.Config.Health;
Player.Ammo5 = PluginClass.Config.Ammo.Ammo5;
Player.Ammo7 = PluginClass.Config.Ammo.Ammo7;
Player.Ammo9 = PluginClass.Config.Ammo.Ammo9;
Player.Inventory.Clear();
PluginClass.Config.Inventory.Apply(Player);

Player.DisplayInfo = PluginClass.Config.CustomRoleName;
Player.RemoveDisplayInfo(PlayerInfoArea.Role);
Expand Down
4 changes: 2 additions & 2 deletions SerpentsHand/SerpentsHandTeam.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
using Synapse;
using System.Collections.Generic;
using Synapse;
using Synapse.Api;
using Synapse.Api.Teams;
using System.Collections.Generic;

namespace SerpentsHand
{
Expand Down
8 changes: 4 additions & 4 deletions SerpentsHand/packages.config
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<?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.5.3" 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-dev4" 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="YamlDotNet" version="11.2.1" targetFramework="net472" />
</packages>

0 comments on commit 72f99dc

Please sign in to comment.