public Container(RealmManager manager, ushort objType, int?life, bool dying, bool permanent = false) : base(manager, objType, life, false, dying, false) { Inventory = new Inventory(this); SlotTypes = new int[12]; BagOwners = new int[0]; Permanent = permanent; for (int i = 0; i < SlotTypes.Length; i++) { if (SlotTypes[i] == 0) { SlotTypes[i] = 10; } } XElement node = manager.GameData.ObjectTypeToElement[ObjectType]; SlotTypes = Utils.FromCommaSepString32(node.Element("SlotTypes").Value); XElement eq = node.Element("Equipment"); if (eq != null) { Item[] inv = Utils.FromCommaSepString16(eq.Value) .Select(_ => _ == 0xffff ? null : manager.GameData.Items[_]) .ToArray(); Array.Resize(ref inv, 12); Inventory.SetItems(inv); } }
private void Initialize(RInventory dbLink) { Inventory = new Inventory(this); BagOwners = new int[0]; DbLink = dbLink; var node = Manager.Resources.GameData.ObjectTypeToElement[ObjectType]; SlotTypes = Utils.ResizeArray(node.Element("SlotTypes").Value.CommaToArray<int>(), BagSize); XElement eq = node.Element("Equipment"); if (eq != null) { var inv = eq.Value.CommaToArray<ushort>().Select(_ => _ == 0xffff ? null : Manager.Resources.GameData.Items[_]).ToArray(); Array.Resize(ref inv, BagSize); Inventory.SetItems(inv); } }
public Container(RealmManager manager, ushort objType, int?life, bool dying) : base(manager, objType, life, false, dying, false) { Inventory = new Inventory(this); SlotTypes = new int[12]; BagOwners = new int[0]; var node = manager.GameData.ObjectTypeToElement[ObjectType]; SlotTypes = node.Element("SlotTypes").Value.CommaToArray <int>(); XElement eq = node.Element("Equipment"); if (eq != null) { var inv = eq.Value.CommaToArray <ushort>().Select(_ => _ == 0xffff ? null : manager.GameData.Items[_]).ToArray(); Array.Resize(ref inv, 12); Inventory.SetItems(inv); } }