Skip to content

Commit

Permalink
Le funi
Browse files Browse the repository at this point in the history
  • Loading branch information
Michal78900 committed Sep 5, 2021
1 parent fc2f6f8 commit 42dc774
Show file tree
Hide file tree
Showing 6 changed files with 52 additions and 12 deletions.
11 changes: 11 additions & 0 deletions WaitAndChillReborn/Config.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
namespace WaitAndChillReborn
{
using Exiled.API.Enums;
using Exiled.API.Interfaces;
using System.Collections.Generic;
using System.ComponentModel;
Expand Down Expand Up @@ -49,6 +50,16 @@ public class Config : IConfig
"Coin",
};

[Description("List of ammo given to a player while in lobby:")]
public Dictionary<AmmoType, ushort> Ammo { get; private set; } = new Dictionary<AmmoType, ushort>()
{
{ AmmoType.Nato556, 0 },
{ AmmoType.Nato762, 0 },
{ AmmoType.Nato9, 0 },
{ AmmoType.Ammo12Gauge, 0 },
{ AmmoType.Ammo44Cal, 0 },
};

[Description("Allow dealing damage to other players, while in lobby.")]
public bool AllowDamage { get; private set; } = false;

Expand Down
21 changes: 19 additions & 2 deletions WaitAndChillReborn/Handler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
using Exiled.CustomItems.API;
using Mirror;
using InventorySystem.Items.ThrowableProjectiles;
using Exiled.API.Extensions;

public partial class Handler
{
Expand Down Expand Up @@ -86,7 +87,15 @@ internal void OnVerified(VerifiedEventArgs ev)
ev.Player.ChangeEffectIntensity<Scp207>(Config.ColaMultiplier);
}

ev.Player.ResetInventory(Config.Inventory);
Timing.CallDelayed(0.3f, () =>
{
ev.Player.ResetInventory(Config.Inventory);

foreach (var ammo in Config.Ammo)
{
ev.Player.Ammo[ammo.Key.GetItemType()] = ammo.Value;
}
});
});
}
}
Expand Down Expand Up @@ -120,7 +129,15 @@ internal void OnDied(DiedEventArgs ev)
ev.Target.ChangeEffectIntensity<Scp207>(Config.ColaMultiplier);
}

ev.Target.ResetInventory(Config.Inventory);
Timing.CallDelayed(0.3f, () =>
{
ev.Target.ResetInventory(Config.Inventory);

foreach (var ammo in Config.Ammo)
{
ev.Target.Ammo[ammo.Key.GetItemType()] = ammo.Value;
}
});
});
}
}
Expand Down
11 changes: 11 additions & 0 deletions WaitAndChillReborn/Patches/DroppingAmmoPatch.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
namespace WaitAndChillReborn.Patches
{
using HarmonyLib;
using InventorySystem;

[HarmonyPatch(typeof(InventoryExtensions), nameof(InventoryExtensions.ServerDropAmmo))]
internal static class DroppingAmmoPatch
{
private static bool Prefix(Inventory inv, ItemType ammoType, ushort amount, bool checkMinimals) => !Handler.IsLobby;
}
}
2 changes: 1 addition & 1 deletion WaitAndChillReborn/Plugin.cs
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ public override void OnDisabled()

public override string Name => "WaitAndChillReborn";
public override string Author => "Michal78900";
public override Version Version => new Version(3, 0, 2);
public override Version Version => new Version(3, 0, 3);
public override Version RequiredExiledVersion => new Version(3, 0, 0);
}
}
17 changes: 9 additions & 8 deletions WaitAndChillReborn/WaitAndChillReborn.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -47,28 +47,28 @@
<HintPath>..\..\..\Desktop\Exiled\CommandSystem.Core.dll</HintPath>
</Reference>
<Reference Include="Exiled.API, Version=3.0.0.0, Culture=neutral, processorArchitecture=AMD64">
<HintPath>..\packages\EXILED.3.0.0-alpha.77\lib\net472\Exiled.API.dll</HintPath>
<HintPath>..\packages\EXILED.3.0.0-alpha.82\lib\net472\Exiled.API.dll</HintPath>
</Reference>
<Reference Include="Exiled.Bootstrap, Version=3.0.0.0, Culture=neutral, processorArchitecture=AMD64">
<HintPath>..\packages\EXILED.3.0.0-alpha.77\lib\net472\Exiled.Bootstrap.dll</HintPath>
<HintPath>..\packages\EXILED.3.0.0-alpha.82\lib\net472\Exiled.Bootstrap.dll</HintPath>
</Reference>
<Reference Include="Exiled.CreditTags, Version=3.0.0.0, Culture=neutral, processorArchitecture=AMD64">
<HintPath>..\packages\EXILED.3.0.0-alpha.77\lib\net472\Exiled.CreditTags.dll</HintPath>
<HintPath>..\packages\EXILED.3.0.0-alpha.82\lib\net472\Exiled.CreditTags.dll</HintPath>
</Reference>
<Reference Include="Exiled.CustomItems, Version=3.0.0.0, Culture=neutral, processorArchitecture=AMD64">
<HintPath>..\packages\EXILED.3.0.0-alpha.77\lib\net472\Exiled.CustomItems.dll</HintPath>
<HintPath>..\packages\EXILED.3.0.0-alpha.82\lib\net472\Exiled.CustomItems.dll</HintPath>
</Reference>
<Reference Include="Exiled.Events, Version=3.0.0.0, Culture=neutral, processorArchitecture=AMD64">
<HintPath>..\packages\EXILED.3.0.0-alpha.77\lib\net472\Exiled.Events.dll</HintPath>
<HintPath>..\packages\EXILED.3.0.0-alpha.82\lib\net472\Exiled.Events.dll</HintPath>
</Reference>
<Reference Include="Exiled.Loader, Version=3.0.0.0, Culture=neutral, processorArchitecture=AMD64">
<HintPath>..\packages\EXILED.3.0.0-alpha.77\lib\net472\Exiled.Loader.dll</HintPath>
<HintPath>..\packages\EXILED.3.0.0-alpha.82\lib\net472\Exiled.Loader.dll</HintPath>
</Reference>
<Reference Include="Exiled.Permissions, Version=3.0.0.0, Culture=neutral, processorArchitecture=AMD64">
<HintPath>..\packages\EXILED.3.0.0-alpha.77\lib\net472\Exiled.Permissions.dll</HintPath>
<HintPath>..\packages\EXILED.3.0.0-alpha.82\lib\net472\Exiled.Permissions.dll</HintPath>
</Reference>
<Reference Include="Exiled.Updater, Version=3.1.1.0, Culture=neutral, processorArchitecture=AMD64">
<HintPath>..\packages\EXILED.3.0.0-alpha.77\lib\net472\Exiled.Updater.dll</HintPath>
<HintPath>..\packages\EXILED.3.0.0-alpha.82\lib\net472\Exiled.Updater.dll</HintPath>
</Reference>
<Reference Include="Mirror, Version=0.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
Expand Down Expand Up @@ -101,6 +101,7 @@
<Compile Include="Patches\BreakableWindowPatch.cs" />
<Compile Include="Patches\BulletHolePatch.cs" />
<Compile Include="Patches\DoorDamagePatch.cs" />
<Compile Include="Patches\DroppingAmmoPatch.cs" />
<Compile Include="Patches\GrenadeExplosionDetectedPatch.cs" />
<Compile Include="Plugin.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
Expand Down
2 changes: 1 addition & 1 deletion WaitAndChillReborn/packages.config
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="EXILED" version="3.0.0-alpha.77" targetFramework="net472" />
<package id="EXILED" version="3.0.0-alpha.82" targetFramework="net472" />
</packages>

0 comments on commit 42dc774

Please sign in to comment.