diff --git a/TShockAPI/GetDataHandlers.cs b/TShockAPI/GetDataHandlers.cs index 9401102c..97a0b3d0 100644 --- a/TShockAPI/GetDataHandlers.cs +++ b/TShockAPI/GetDataHandlers.cs @@ -2972,8 +2972,9 @@ namespace TShockAPI { var id = args.Data.ReadInt16(); var owner = args.Data.ReadInt8(); + //var position = args.Data.ReadVector2(); - if (id is < 0 or > 400) + if (id is < 0 or > Main.maxItems) return true; if (id == 400 && owner == 255) @@ -4364,9 +4365,9 @@ namespace TShockAPI } // Handle kicks/bans on mediumcore/hardcore deaths. - if (args.TPlayer.difficulty == 1 || args.TPlayer.difficulty == 2) // Player is not softcore + if (args.TPlayer.difficulty == PlayerDifficultyID.MediumCore || args.TPlayer.difficulty == PlayerDifficultyID.Hardcore) // Player is not softcore { - bool mediumcore = args.TPlayer.difficulty == 1; + bool mediumcore = args.TPlayer.difficulty == PlayerDifficultyID.MediumCore; bool shouldBan = mediumcore ? TShock.Config.Settings.BanOnMediumcoreDeath : TShock.Config.Settings.BanOnHardcoreDeath; bool shouldKick = mediumcore ? TShock.Config.Settings.KickOnMediumcoreDeath : TShock.Config.Settings.KickOnHardcoreDeath; string banReason = mediumcore ? TShock.Config.Settings.MediumcoreBanReason : TShock.Config.Settings.HardcoreBanReason; @@ -4387,7 +4388,7 @@ namespace TShockAPI } } - if (args.TPlayer.difficulty == 2 && Main.ServerSideCharacter && args.Player.IsLoggedIn) + if (args.TPlayer.difficulty == PlayerDifficultyID.Hardcore && Main.ServerSideCharacter && args.Player.IsLoggedIn) { if (TShock.CharacterDB.RemovePlayer(args.Player.Account.ID)) { @@ -4578,7 +4579,7 @@ namespace TShockAPI // and the server will replicate the changes the client did. This means that PlayerData.StoreSlot is never called, so we need to // swap around the PlayerData items ourself. - Tuple GetArmorSlotsForLoadoutIndex(int index) + (int, int) GetArmorSlotsForLoadoutIndex(int index) { return index switch { @@ -4588,7 +4589,7 @@ namespace TShockAPI }; } - Tuple GetDyeSlotsForLoadoutIndex(int index) + (int, int) GetDyeSlotsForLoadoutIndex(int index) { return index switch { diff --git a/TShockAPI/NetItem.cs b/TShockAPI/NetItem.cs index 29852d76..9328abfc 100644 --- a/TShockAPI/NetItem.cs +++ b/TShockAPI/NetItem.cs @@ -100,52 +100,52 @@ namespace TShockAPI (LoadoutArmorSlots * 3) + (LoadoutDyeSlots * 3); - public static readonly Tuple InventoryIndex = new Tuple(0, InventorySlots); + public static readonly (int, int) InventoryIndex = (0, InventorySlots); - public static readonly Tuple ArmorIndex = - new Tuple(InventoryIndex.Item2, InventoryIndex.Item2 + ArmorSlots); + public static readonly (int, int) ArmorIndex = + (InventoryIndex.Item2, InventoryIndex.Item2 + ArmorSlots); - public static readonly Tuple DyeIndex = - new Tuple(ArmorIndex.Item2, ArmorIndex.Item2 + DyeSlots); + public static readonly (int, int) DyeIndex = + (ArmorIndex.Item2, ArmorIndex.Item2 + DyeSlots); - public static readonly Tuple MiscEquipIndex = - new Tuple(DyeIndex.Item2, DyeIndex.Item2 + MiscEquipSlots); + public static readonly (int, int) MiscEquipIndex = + (DyeIndex.Item2, DyeIndex.Item2 + MiscEquipSlots); - public static readonly Tuple MiscDyeIndex = - new Tuple(MiscEquipIndex.Item2, MiscEquipIndex.Item2 + MiscDyeSlots); + public static readonly (int, int) MiscDyeIndex = + (MiscEquipIndex.Item2, MiscEquipIndex.Item2 + MiscDyeSlots); - public static readonly Tuple PiggyIndex = - new Tuple(MiscDyeIndex.Item2, MiscDyeIndex.Item2 + PiggySlots); + public static readonly (int, int) PiggyIndex = + (MiscDyeIndex.Item2, MiscDyeIndex.Item2 + PiggySlots); - public static readonly Tuple SafeIndex = - new Tuple(PiggyIndex.Item2, PiggyIndex.Item2 + SafeSlots); + public static readonly (int, int) SafeIndex = + (PiggyIndex.Item2, PiggyIndex.Item2 + SafeSlots); - public static readonly Tuple TrashIndex = - new Tuple(SafeIndex.Item2, SafeIndex.Item2 + TrashSlots); + public static readonly (int, int) TrashIndex = + (SafeIndex.Item2, SafeIndex.Item2 + TrashSlots); - public static readonly Tuple ForgeIndex = - new Tuple(TrashIndex.Item2, TrashIndex.Item2 + ForgeSlots); + public static readonly (int, int) ForgeIndex = + (TrashIndex.Item2, TrashIndex.Item2 + ForgeSlots); - public static readonly Tuple VoidIndex = - new Tuple(ForgeIndex.Item2, ForgeIndex.Item2 + VoidSlots); + public static readonly (int, int) VoidIndex = + (ForgeIndex.Item2, ForgeIndex.Item2 + VoidSlots); - public static readonly Tuple Loadout1Armor = - new Tuple(VoidIndex.Item2, VoidIndex.Item2 + LoadoutArmorSlots); + public static readonly (int, int) Loadout1Armor = + (VoidIndex.Item2, VoidIndex.Item2 + LoadoutArmorSlots); - public static readonly Tuple Loadout1Dye = - new Tuple(Loadout1Armor.Item2, Loadout1Armor.Item2 + LoadoutDyeSlots); + public static readonly (int, int) Loadout1Dye = + (Loadout1Armor.Item2, Loadout1Armor.Item2 + LoadoutDyeSlots); - public static readonly Tuple Loadout2Armor = - new Tuple(Loadout1Dye.Item2, Loadout1Dye.Item2 + LoadoutArmorSlots); + public static readonly (int, int) Loadout2Armor = + (Loadout1Dye.Item2, Loadout1Dye.Item2 + LoadoutArmorSlots); - public static readonly Tuple Loadout2Dye = - new Tuple(Loadout2Armor.Item2, Loadout2Armor.Item2 + LoadoutDyeSlots); + public static readonly (int, int) Loadout2Dye = + (Loadout2Armor.Item2, Loadout2Armor.Item2 + LoadoutDyeSlots); - public static readonly Tuple Loadout3Armor = - new Tuple(Loadout2Dye.Item2, Loadout2Dye.Item2 + LoadoutArmorSlots); + public static readonly (int, int) Loadout3Armor = + (Loadout2Dye.Item2, Loadout2Dye.Item2 + LoadoutArmorSlots); - public static readonly Tuple Loadout3Dye = - new Tuple(Loadout3Armor.Item2, Loadout3Armor.Item2 + LoadoutDyeSlots); + public static readonly (int, int) Loadout3Dye = + (Loadout3Armor.Item2, Loadout3Armor.Item2 + LoadoutDyeSlots); [JsonProperty("netID")] private int _netId;