Skip to content

Commit

Permalink
actual version 1.5.0
Browse files Browse the repository at this point in the history
  • Loading branch information
ChrizziDerKek committed Aug 25, 2024
1 parent 45ac225 commit 4f594a7
Show file tree
Hide file tree
Showing 7 changed files with 93 additions and 6 deletions.
3 changes: 3 additions & 0 deletions BSR_Client/BSR_Client.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -119,13 +119,16 @@
<Content Include="sounds\bsr_gunpowder.wav" />
<Content Include="sounds\bsr_gunpowder_shot.wav" />
<Content Include="sounds\bsr_handcuff.wav" />
<Content Include="sounds\bsr_heroine.wav" />
<Content Include="sounds\bsr_inverter.wav" />
<Content Include="sounds\bsr_katana.wav" />
<Content Include="sounds\bsr_magazine.wav" />
<Content Include="sounds\bsr_magnify.wav" />
<Content Include="sounds\bsr_saw.wav" />
<Content Include="sounds\bsr_shot.wav" />
<Content Include="sounds\bsr_title.wav" />
<Content Include="sounds\bsr_trashbin.wav" />
<Resource Include="textures\katana.png" />
<Resource Include="textures\bullet.png" />
<Resource Include="textures\gunpowder.png" />
<Resource Include="textures\healingbullet.png" />
Expand Down
10 changes: 10 additions & 0 deletions BSR_Client/Constants.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ public enum EPacket
RequestItems,
RequestItemsAck,
StealItem,
BlockItemUsage,
}

public enum EBullet
Expand All @@ -55,6 +56,8 @@ public enum EItem
Gunpowder,
//Bullet,
Trashbin,
Heroine,
Katana,
Count,
}

Expand Down Expand Up @@ -92,6 +95,11 @@ public partial class MainWindow
private bool UsedShotgun = false;
private bool UsedAdrenaline = false;
private bool AreItemsCloned = false;
private bool UsedHeroine = false;
private bool UsedKatana = false;
private bool BlockItems = false;
private bool CanUseOneItem = false;
private bool LockedItems = false;
private EDebugMode DebugMode = EDebugMode.None;
private string ItemCloneTarget = "";
private string GameVersion = "";
Expand All @@ -114,6 +122,8 @@ public partial class MainWindow
{ EItem.Gunpowder, "Has a 50/50 chance of dealing 3 damage or exploding in the barrel and dealing 2 to yourself\nCan be combined with a saw to deal 4 damage or 3 to yourself" },
//{ EItem.Bullet, "Loads a new random bullet type into the gun\nAlways appears at the end of the round" },
{ EItem.Trashbin, "Allows you to throw away an item and receive a different one" },
{ EItem.Heroine, "Select a player to give them heroine\nThey can't use an item in their next round" },
{ EItem.Katana, "Select a player to cut their fingers off\nThey can only use 1 item in their next round" },
{ EItem.Count, null },
};

Expand Down
28 changes: 24 additions & 4 deletions BSR_Client/Logic.cs
Original file line number Diff line number Diff line change
Expand Up @@ -262,6 +262,12 @@ public bool IsPlayerActive()
return Shoot.IsEnabled;
}

public void BlockPlayers()
{
foreach (Button i in Elements.Players)
i.IsEnabled = false;
}

public void SetActive(bool active)
{
Shoot.IsEnabled = active;
Expand Down Expand Up @@ -376,10 +382,14 @@ public void SetItemData(Button slot, EItem type)
if (slot == null)
return;
slot.Visibility = type == EItem.Nothing ? Visibility.Hidden : Visibility.Visible;
if (type == EItem.Nothing)
slot.ToolTip = null;
else
slot.ToolTip = type.ToString() + "\n\n" + ItemDescriptions[type];
if (type != EItem.Nothing)
{
string desc;
if (!ItemDescriptions.TryGetValue(type, out desc))
desc = "NO DESCRIPTION";
slot.ToolTip = type.ToString() + "\n\n" + desc;
}
else slot.ToolTip = null;
if (!(slot.Content is Grid))
return;
UIElement text = (slot.Content as Grid).Children[1];
Expand Down Expand Up @@ -501,11 +511,21 @@ public EItem UseItem(string slot, bool sync)

public void UnlockItems()
{
if (LockedItems)
return;
for (int i = 0; i < Elements.Items.Length; i++)
if (!IsItemSlot(Elements.Items[i], "Nothing"))
Elements.Items[i].IsEnabled = true;
}

public void LockItems()
{
LockedItems = true;
for (int i = 0; i < Elements.Items.Length; i++)
if (!IsItemSlot(Elements.Items[i], "Nothing"))
Elements.Items[i].IsEnabled = false;
}

public bool ProcessIsRunning()
{
Process current = Process.GetCurrentProcess();
Expand Down
54 changes: 54 additions & 0 deletions BSR_Client/MainWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,12 @@ private void Button_Click(object sender, RoutedEventArgs e)
Packet.Create(EPacket.ItemTrashed).Add(MyName).Add(item.ToString()).Add(newitem.ToString()).Send(Sync);
return;
}
if (BlockItems && CanUseOneItem)
{
LockItems();
BlockItems = false;
CanUseOneItem = false;
}
PlaySfx(item);
switch (item)
{
Expand Down Expand Up @@ -206,6 +212,16 @@ private void Button_Click(object sender, RoutedEventArgs e)
if (GetItemCount() > 0)
UsedTrashBin = true;
break;
case EItem.Heroine:
UsedHeroine = true;
PreparePlayerItem();
Announce("Select a player to give them Heroine");
break;
case EItem.Katana:
UsedKatana = true;
PreparePlayerItem();
Announce("Select a player to use the Katana on");
break;
}
break;
case "Player1":
Expand All @@ -219,6 +235,20 @@ private void Button_Click(object sender, RoutedEventArgs e)
SaveItems();
string target = Players[int.Parse(action.Replace("Player", "")) - 1];
Packet.Create(EPacket.RequestItems).Add(target).Add(MyName).Send(Sync);
BlockPlayers();
}
if (UsedHeroine || UsedKatana)
{
string target = Players[int.Parse(action.Replace("Player", "")) - 1];
Packet.Create(EPacket.BlockItemUsage).Add(target).Add(UsedKatana).Send(Sync);
if (UsedHeroine)
Announce("Gave Heroine to " + target);
else
Announce("Used Katana on " + target);
UsedHeroine = false;
UsedKatana = false;
Shoot.IsEnabled = true;
BlockPlayers();
}
if (UsedShotgun)
{
Expand Down Expand Up @@ -340,6 +370,7 @@ public void Receive(string message)
else
{
yourturn = true;
LockedItems = false;
SetActive(true);
}
}
Expand All @@ -350,6 +381,18 @@ public void Receive(string message)
{
Announce("Your turn");
UnlockItems();
if (BlockItems)
{
if (CanUseOneItem)
Announce("You can only use 1 item this round");
else
Announce("You can't use items this round");
if (!CanUseOneItem)
{
LockItems();
BlockItems = false;
}
}
}
break;
case EPacket.Shoot:
Expand Down Expand Up @@ -489,6 +532,17 @@ public void Receive(string message)
}
Announce(data.ReadStr(0) + " stole " + data.ReadStr(3) + " from " + stealtarget);
break;
case EPacket.BlockItemUsage:
if (MyName == data.ReadStr(0))
{
BlockItems = true;
CanUseOneItem = data.ReadBool(1);
if (CanUseOneItem)
Announce("You can only use 1 item next round");
else
Announce("You can't use items next round");
}
break;
}
PacketHandled = true;
});
Expand Down
4 changes: 2 additions & 2 deletions BSR_Client/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -51,5 +51,5 @@
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.4.3")]
[assembly: AssemblyFileVersion("1.4.3")]
[assembly: AssemblyVersion("1.5.0")]
[assembly: AssemblyFileVersion("1.5.0")]
Binary file modified BSR_Client/textures/heroine.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added BSR_Client/textures/katana.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 4f594a7

Please sign in to comment.