From d04f57d8649ffec277fcd10a88afd454e9da2a59 Mon Sep 17 00:00:00 2001 From: Olink Date: Sun, 24 May 2020 17:09:25 -0400 Subject: [PATCH] Fixes #1867 --- CHANGELOG.md | 1 + TShockAPI/GetDataHandlers.cs | 7 +++++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7a888f9e..46e2ce49 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,6 +12,7 @@ This is the rolling changelog for TShock for Terraria. Use past tense when addin and lava, wet, honey, and dry rockets; and lava, wet, honey, and dry mines. (@Olink) * Fix Bloody Tear displaying the wrong text when used. (@Olink) +* Fix the visibility toggle for the last two accessory slots. (@Olink) ## TShock 4.4.0 (Pre-release 7 (Entangled)) diff --git a/TShockAPI/GetDataHandlers.cs b/TShockAPI/GetDataHandlers.cs index 8076d30b..46e3502d 100644 --- a/TShockAPI/GetDataHandlers.cs +++ b/TShockAPI/GetDataHandlers.cs @@ -1923,11 +1923,14 @@ namespace TShockAPI args.Player.TPlayer.shirtColor = shirtColor; args.Player.TPlayer.underShirtColor = underShirtColor; args.Player.TPlayer.shoeColor = shoeColor; + //@Olink: If you need to change bool[10], please make sure you also update the for loops below to account for it. + //There are two arrays from terraria that we only have a single array for. You will need to make sure that you are looking + //at the correct terraria array (hideVisual or hideVisual2). args.Player.TPlayer.hideVisibleAccessory = new bool[10]; for (int i = 0; i < 8; i++) args.Player.TPlayer.hideVisibleAccessory[i] = hideVisual[i]; - for (int i = 8; i < 10; i++) - args.Player.TPlayer.hideVisibleAccessory[i] = hideVisual2[i]; + for (int i = 0; i < 2; i++) + args.Player.TPlayer.hideVisibleAccessory[i+8] = hideVisual2[i]; args.Player.TPlayer.hideMisc = hideMisc; args.Player.TPlayer.extraAccessory = extraSlot; NetMessage.SendData((int)PacketTypes.PlayerInfo, -1, args.Player.Index, NetworkText.FromLiteral(args.Player.Name), args.Player.Index);