diff --git a/BSR_Client/BSR_Client.csproj b/BSR_Client/BSR_Client.csproj index 1aedd26..dc53329 100644 --- a/BSR_Client/BSR_Client.csproj +++ b/BSR_Client/BSR_Client.csproj @@ -119,13 +119,16 @@ + + + diff --git a/BSR_Client/Constants.cs b/BSR_Client/Constants.cs index a8e1521..7e311cc 100644 --- a/BSR_Client/Constants.cs +++ b/BSR_Client/Constants.cs @@ -31,6 +31,7 @@ public enum EPacket RequestItems, RequestItemsAck, StealItem, + BlockItemUsage, } public enum EBullet @@ -55,6 +56,8 @@ public enum EItem Gunpowder, //Bullet, Trashbin, + Heroine, + Katana, Count, } @@ -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 = ""; @@ -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 }, }; diff --git a/BSR_Client/Logic.cs b/BSR_Client/Logic.cs index 769c157..54d08d4 100644 --- a/BSR_Client/Logic.cs +++ b/BSR_Client/Logic.cs @@ -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; @@ -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]; @@ -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(); diff --git a/BSR_Client/MainWindow.xaml.cs b/BSR_Client/MainWindow.xaml.cs index 1c71e40..80923b9 100644 --- a/BSR_Client/MainWindow.xaml.cs +++ b/BSR_Client/MainWindow.xaml.cs @@ -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) { @@ -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": @@ -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) { @@ -340,6 +370,7 @@ public void Receive(string message) else { yourturn = true; + LockedItems = false; SetActive(true); } } @@ -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: @@ -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; }); diff --git a/BSR_Client/Properties/AssemblyInfo.cs b/BSR_Client/Properties/AssemblyInfo.cs index c971242..abcb2f4 100644 --- a/BSR_Client/Properties/AssemblyInfo.cs +++ b/BSR_Client/Properties/AssemblyInfo.cs @@ -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")] diff --git a/BSR_Client/textures/heroine.png b/BSR_Client/textures/heroine.png index a6015a5..7f3eddd 100644 Binary files a/BSR_Client/textures/heroine.png and b/BSR_Client/textures/heroine.png differ diff --git a/BSR_Client/textures/katana.png b/BSR_Client/textures/katana.png new file mode 100644 index 0000000..6480b3c Binary files /dev/null and b/BSR_Client/textures/katana.png differ