Added backwards compatibility for SSC

This commit is contained in:
White 2015-07-10 16:58:32 +09:30
parent e5cbee82e9
commit 23ab14df4f
2 changed files with 10 additions and 2 deletions

View file

@ -80,6 +80,14 @@ namespace TShockAPI.DB
List<NetItem> inventory = reader.Get<string>("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();

View file

@ -24,7 +24,7 @@ namespace TShockAPI
public static readonly int SafeSlots = PiggySlots;
/// <summary>
/// 59 - The size of the player's inventory (inventory, coins, ammo)
/// 59 - The size of the player's inventory (inventory, coins, ammo, held item)
/// </summary>
public static readonly int InventorySlots = 59;
@ -49,7 +49,7 @@ namespace TShockAPI
public static readonly int MiscDyeSlots = MiscEquipSlots;
/// <summary>
/// 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)
/// </summary>
public static readonly int MaxInventory = InventorySlots + ArmorSlots + DyeSlots + MiscEquipSlots + MiscDyeSlots + PiggySlots + SafeSlots + 1;