From 23ab14df4fa1326c0ffac967570a78931df058e7 Mon Sep 17 00:00:00 2001 From: White Date: Fri, 10 Jul 2015 16:58:32 +0930 Subject: [PATCH] Added backwards compatibility for SSC --- TShockAPI/DB/CharacterManager.cs | 8 ++++++++ TShockAPI/NetItem.cs | 4 ++-- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/TShockAPI/DB/CharacterManager.cs b/TShockAPI/DB/CharacterManager.cs index c6f68cff..20ec8b82 100755 --- a/TShockAPI/DB/CharacterManager.cs +++ b/TShockAPI/DB/CharacterManager.cs @@ -80,6 +80,14 @@ namespace TShockAPI.DB List inventory = reader.Get("Inventory").Split('~').Select(NetItem.Parse).ToList(); if (inventory.Count < NetItem.MaxInventory) { + //TODO: unhardcode this - stop using magic numbers and use NetItem numbers + //Set new armour slots empty + inventory.InsertRange(67, new NetItem[2]); + //Set new vanity slots empty + inventory.InsertRange(77, new NetItem[2]); + //Set new dye slots empty + inventory.InsertRange(87, new NetItem[2]); + //Set the rest of the new slots empty inventory.AddRange(new NetItem[NetItem.MaxInventory - inventory.Count]); } playerData.inventory = inventory.ToArray(); diff --git a/TShockAPI/NetItem.cs b/TShockAPI/NetItem.cs index 35fef45d..af2c8ac8 100644 --- a/TShockAPI/NetItem.cs +++ b/TShockAPI/NetItem.cs @@ -24,7 +24,7 @@ namespace TShockAPI public static readonly int SafeSlots = PiggySlots; /// - /// 59 - The size of the player's inventory (inventory, coins, ammo) + /// 59 - The size of the player's inventory (inventory, coins, ammo, held item) /// public static readonly int InventorySlots = 59; @@ -49,7 +49,7 @@ namespace TShockAPI public static readonly int MiscDyeSlots = MiscEquipSlots; /// - /// 179 - The inventory size (including armour, dies, coins, ammo, piggy, safe, and trash) + /// 180 - The inventory size (inventory, held item, armour, dies, coins, ammo, piggy, safe, and trash) /// public static readonly int MaxInventory = InventorySlots + ArmorSlots + DyeSlots + MiscEquipSlots + MiscDyeSlots + PiggySlots + SafeSlots + 1;