Skip to content

Commit

Permalink
version 1.5.1
Browse files Browse the repository at this point in the history
  • Loading branch information
ChrizziDerKek committed Aug 27, 2024
1 parent 2bbb23f commit d1a30b1
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 8 deletions.
17 changes: 15 additions & 2 deletions BSR_Client/Logic.cs
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ public void RemovePlayer(string player)
Players.Remove(player);
PlayerTurns.Remove(player);
Playerlist.Items.Remove(player);
PlayersAlive--;
int it = 0;
foreach (Button b in Elements.Players)
{
Expand Down Expand Up @@ -384,8 +385,7 @@ public void SetItemData(Button slot, EItem type)
slot.Visibility = type == EItem.Nothing ? Visibility.Hidden : Visibility.Visible;
if (type != EItem.Nothing)
{
string desc;
if (!ItemDescriptions.TryGetValue(type, out desc))
if (!ItemDescriptions.TryGetValue(type, out string desc))
desc = "NO DESCRIPTION";
slot.ToolTip = type.ToString() + "\n\n" + desc;
}
Expand Down Expand Up @@ -722,5 +722,18 @@ public bool IsIpValid(string ip)
return false;
return true;
}

public string GetPlayerFromSlot(int slotId)
{
Button slot = Elements.Players[slotId];
if (slot == null)
return null;
if (!(slot.Content is Grid))
return null;
UIElement text = (slot.Content as Grid).Children[1];
if (!(text is TextBlock))
return null;
return (text as TextBlock).Text;
}
}
}
9 changes: 5 additions & 4 deletions BSR_Client/MainWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -233,13 +233,13 @@ private void Button_Click(object sender, RoutedEventArgs e)
{
UsedAdrenaline = false;
SaveItems();
string target = Players[int.Parse(action.Replace("Player", "")) - 1];
string target = GetPlayerFromSlot(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];
string target = GetPlayerFromSlot(int.Parse(action.Replace("Player", "")) - 1);
Packet.Create(EPacket.BlockItemUsage).Add(target).Add(UsedKatana).Send(Sync);
if (UsedHeroine)
Announce("Gave Heroine to " + target);
Expand All @@ -249,11 +249,12 @@ private void Button_Click(object sender, RoutedEventArgs e)
UsedKatana = false;
Shoot.IsEnabled = true;
BlockPlayers();
UnlockItems();
}
if (UsedShotgun)
{
UsedShotgun = false;
string target = Players[int.Parse(action.Replace("Player", "")) - 1];
string target = GetPlayerFromSlot(int.Parse(action.Replace("Player", "")) - 1);
bool you = target == MyName;
if (you)
Announce("Shooting yourself");
Expand Down Expand Up @@ -442,7 +443,7 @@ public void Receive(string message)
break;
case EPacket.Disconnect:
if (Players.Count == 2)
Environment.Exit(0);
ShowEndscreen();
RemovePlayer(data.ReadStr(0));
break;
case EPacket.UseItem:
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.5.0")]
[assembly: AssemblyFileVersion("1.5.0")]
[assembly: AssemblyVersion("1.5.1")]
[assembly: AssemblyFileVersion("1.5.1")]

0 comments on commit d1a30b1

Please sign in to comment.